001package org.hl7.fhir.r5.model;
002
003
004/*
005 * #%L
006 * org.hl7.fhir.r5
007 * %%
008 * Copyright (C) 2014 - 2019 Health Level 7
009 * %%
010 * Licensed under the Apache License, Version 2.0 (the \"License\");
011 * you may not use this file except in compliance with the License.
012 * You may obtain a copy of the License at
013 * 
014 *      http://www.apache.org/licenses/LICENSE-2.0
015 * 
016 * Unless required by applicable law or agreed to in writing, software
017 * distributed under the License is distributed on an \"AS IS\" BASIS,
018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019 * See the License for the specific language governing permissions and
020 * limitations under the License.
021 * #L%
022 */
023
024/*
025  Copyright (c) 2011+, HL7, Inc.
026  All rights reserved.
027  
028  Redistribution and use in source and binary forms, with or without modification, \
029  are permitted provided that the following conditions are met:
030  
031   * Redistributions of source code must retain the above copyright notice, this \
032     list of conditions and the following disclaimer.
033   * Redistributions in binary form must reproduce the above copyright notice, \
034     this list of conditions and the following disclaimer in the documentation \
035     and/or other materials provided with the distribution.
036   * Neither the name of HL7 nor the names of its contributors may be used to 
037     endorse or promote products derived from this software without specific 
038     prior written permission.
039  
040  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
041  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
042  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
043  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
044  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
045  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
046  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
047  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
048  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
049  POSSIBILITY OF SUCH DAMAGE.
050  */
051
052// Generated on Tue, Dec 31, 2019 12:12+1100 for FHIR vcurrent
053
054import java.util.ArrayList;
055import java.util.Date;
056import java.util.List;
057import java.math.*;
058import org.hl7.fhir.utilities.Utilities;
059import org.hl7.fhir.r5.model.Enumerations.*;
060import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
061import org.hl7.fhir.exceptions.FHIRException;
062import org.hl7.fhir.instance.model.api.ICompositeType;
063import ca.uhn.fhir.model.api.annotation.ResourceDef;
064import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
065import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
066import ca.uhn.fhir.model.api.annotation.Child;
067import ca.uhn.fhir.model.api.annotation.ChildOrder;
068import ca.uhn.fhir.model.api.annotation.Description;
069import ca.uhn.fhir.model.api.annotation.Block;
070
071/**
072 * 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.
073 */
074@ResourceDef(name="ExplanationOfBenefit", profile="http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit")
075public class ExplanationOfBenefit extends DomainResource {
076
077    public enum ExplanationOfBenefitStatus {
078        /**
079         * The resource instance is currently in-force.
080         */
081        ACTIVE, 
082        /**
083         * The resource instance is withdrawn, rescinded or reversed.
084         */
085        CANCELLED, 
086        /**
087         * A new resource instance the contents of which is not complete.
088         */
089        DRAFT, 
090        /**
091         * The resource instance was entered in error.
092         */
093        ENTEREDINERROR, 
094        /**
095         * added to help the parsers with the generic types
096         */
097        NULL;
098        public static ExplanationOfBenefitStatus fromCode(String codeString) throws FHIRException {
099            if (codeString == null || "".equals(codeString))
100                return null;
101        if ("active".equals(codeString))
102          return ACTIVE;
103        if ("cancelled".equals(codeString))
104          return CANCELLED;
105        if ("draft".equals(codeString))
106          return DRAFT;
107        if ("entered-in-error".equals(codeString))
108          return ENTEREDINERROR;
109        if (Configuration.isAcceptInvalidEnums())
110          return null;
111        else
112          throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
113        }
114        public String toCode() {
115          switch (this) {
116            case ACTIVE: return "active";
117            case CANCELLED: return "cancelled";
118            case DRAFT: return "draft";
119            case ENTEREDINERROR: return "entered-in-error";
120            default: return "?";
121          }
122        }
123        public String getSystem() {
124          switch (this) {
125            case ACTIVE: return "http://hl7.org/fhir/explanationofbenefit-status";
126            case CANCELLED: return "http://hl7.org/fhir/explanationofbenefit-status";
127            case DRAFT: return "http://hl7.org/fhir/explanationofbenefit-status";
128            case ENTEREDINERROR: return "http://hl7.org/fhir/explanationofbenefit-status";
129            default: return "?";
130          }
131        }
132        public String getDefinition() {
133          switch (this) {
134            case ACTIVE: return "The resource instance is currently in-force.";
135            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
136            case DRAFT: return "A new resource instance the contents of which is not complete.";
137            case ENTEREDINERROR: return "The resource instance was entered in error.";
138            default: return "?";
139          }
140        }
141        public String getDisplay() {
142          switch (this) {
143            case ACTIVE: return "Active";
144            case CANCELLED: return "Cancelled";
145            case DRAFT: return "Draft";
146            case ENTEREDINERROR: return "Entered In Error";
147            default: return "?";
148          }
149        }
150    }
151
152  public static class ExplanationOfBenefitStatusEnumFactory implements EnumFactory<ExplanationOfBenefitStatus> {
153    public ExplanationOfBenefitStatus fromCode(String codeString) throws IllegalArgumentException {
154      if (codeString == null || "".equals(codeString))
155            if (codeString == null || "".equals(codeString))
156                return null;
157        if ("active".equals(codeString))
158          return ExplanationOfBenefitStatus.ACTIVE;
159        if ("cancelled".equals(codeString))
160          return ExplanationOfBenefitStatus.CANCELLED;
161        if ("draft".equals(codeString))
162          return ExplanationOfBenefitStatus.DRAFT;
163        if ("entered-in-error".equals(codeString))
164          return ExplanationOfBenefitStatus.ENTEREDINERROR;
165        throw new IllegalArgumentException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
166        }
167        public Enumeration<ExplanationOfBenefitStatus> fromType(Base code) throws FHIRException {
168          if (code == null)
169            return null;
170          if (code.isEmpty())
171            return new Enumeration<ExplanationOfBenefitStatus>(this);
172          String codeString = ((PrimitiveType) code).asStringValue();
173          if (codeString == null || "".equals(codeString))
174            return null;
175        if ("active".equals(codeString))
176          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ACTIVE);
177        if ("cancelled".equals(codeString))
178          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.CANCELLED);
179        if ("draft".equals(codeString))
180          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.DRAFT);
181        if ("entered-in-error".equals(codeString))
182          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ENTEREDINERROR);
183        throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
184        }
185    public String toCode(ExplanationOfBenefitStatus code) {
186      if (code == ExplanationOfBenefitStatus.ACTIVE)
187        return "active";
188      if (code == ExplanationOfBenefitStatus.CANCELLED)
189        return "cancelled";
190      if (code == ExplanationOfBenefitStatus.DRAFT)
191        return "draft";
192      if (code == ExplanationOfBenefitStatus.ENTEREDINERROR)
193        return "entered-in-error";
194      return "?";
195      }
196    public String toSystem(ExplanationOfBenefitStatus code) {
197      return code.getSystem();
198      }
199    }
200
201    @Block()
202    public static class RelatedClaimComponent extends BackboneElement implements IBaseBackboneElement {
203        /**
204         * Reference to a related claim.
205         */
206        @Child(name = "claim", type = {Claim.class}, order=1, min=0, max=1, modifier=false, summary=false)
207        @Description(shortDefinition="Reference to the related claim", formalDefinition="Reference to a related claim." )
208        protected Reference claim;
209
210        /**
211         * A code to convey how the claims are related.
212         */
213        @Child(name = "relationship", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
214        @Description(shortDefinition="How the reference claim is related", formalDefinition="A code to convey how the claims are related." )
215        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-claim-relationship")
216        protected CodeableConcept relationship;
217
218        /**
219         * An alternate organizational reference to the case or file to which this particular claim pertains.
220         */
221        @Child(name = "reference", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=false)
222        @Description(shortDefinition="File or case reference", formalDefinition="An alternate organizational reference to the case or file to which this particular claim pertains." )
223        protected Identifier reference;
224
225        private static final long serialVersionUID = 1047077926L;
226
227    /**
228     * Constructor
229     */
230      public RelatedClaimComponent() {
231        super();
232      }
233
234        /**
235         * @return {@link #claim} (Reference to a related claim.)
236         */
237        public Reference getClaim() { 
238          if (this.claim == null)
239            if (Configuration.errorOnAutoCreate())
240              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
241            else if (Configuration.doAutoCreate())
242              this.claim = new Reference(); // cc
243          return this.claim;
244        }
245
246        public boolean hasClaim() { 
247          return this.claim != null && !this.claim.isEmpty();
248        }
249
250        /**
251         * @param value {@link #claim} (Reference to a related claim.)
252         */
253        public RelatedClaimComponent setClaim(Reference value) { 
254          this.claim = value;
255          return this;
256        }
257
258        /**
259         * @return {@link #relationship} (A code to convey how the claims are related.)
260         */
261        public CodeableConcept getRelationship() { 
262          if (this.relationship == null)
263            if (Configuration.errorOnAutoCreate())
264              throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
265            else if (Configuration.doAutoCreate())
266              this.relationship = new CodeableConcept(); // cc
267          return this.relationship;
268        }
269
270        public boolean hasRelationship() { 
271          return this.relationship != null && !this.relationship.isEmpty();
272        }
273
274        /**
275         * @param value {@link #relationship} (A code to convey how the claims are related.)
276         */
277        public RelatedClaimComponent setRelationship(CodeableConcept value) { 
278          this.relationship = value;
279          return this;
280        }
281
282        /**
283         * @return {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
284         */
285        public Identifier getReference() { 
286          if (this.reference == null)
287            if (Configuration.errorOnAutoCreate())
288              throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
289            else if (Configuration.doAutoCreate())
290              this.reference = new Identifier(); // cc
291          return this.reference;
292        }
293
294        public boolean hasReference() { 
295          return this.reference != null && !this.reference.isEmpty();
296        }
297
298        /**
299         * @param value {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
300         */
301        public RelatedClaimComponent setReference(Identifier value) { 
302          this.reference = value;
303          return this;
304        }
305
306        protected void listChildren(List<Property> children) {
307          super.listChildren(children);
308          children.add(new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim));
309          children.add(new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship));
310          children.add(new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1, reference));
311        }
312
313        @Override
314        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
315          switch (_hash) {
316          case 94742588: /*claim*/  return new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim);
317          case -261851592: /*relationship*/  return new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship);
318          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);
319          default: return super.getNamedProperty(_hash, _name, _checkValid);
320          }
321
322        }
323
324      @Override
325      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
326        switch (hash) {
327        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
328        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
329        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Identifier
330        default: return super.getProperty(hash, name, checkValid);
331        }
332
333      }
334
335      @Override
336      public Base setProperty(int hash, String name, Base value) throws FHIRException {
337        switch (hash) {
338        case 94742588: // claim
339          this.claim = TypeConvertor.castToReference(value); // Reference
340          return value;
341        case -261851592: // relationship
342          this.relationship = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
343          return value;
344        case -925155509: // reference
345          this.reference = TypeConvertor.castToIdentifier(value); // Identifier
346          return value;
347        default: return super.setProperty(hash, name, value);
348        }
349
350      }
351
352      @Override
353      public Base setProperty(String name, Base value) throws FHIRException {
354        if (name.equals("claim")) {
355          this.claim = TypeConvertor.castToReference(value); // Reference
356        } else if (name.equals("relationship")) {
357          this.relationship = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
358        } else if (name.equals("reference")) {
359          this.reference = TypeConvertor.castToIdentifier(value); // Identifier
360        } else
361          return super.setProperty(name, value);
362        return value;
363      }
364
365      @Override
366      public Base makeProperty(int hash, String name) throws FHIRException {
367        switch (hash) {
368        case 94742588:  return getClaim();
369        case -261851592:  return getRelationship();
370        case -925155509:  return getReference();
371        default: return super.makeProperty(hash, name);
372        }
373
374      }
375
376      @Override
377      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
378        switch (hash) {
379        case 94742588: /*claim*/ return new String[] {"Reference"};
380        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
381        case -925155509: /*reference*/ return new String[] {"Identifier"};
382        default: return super.getTypesForProperty(hash, name);
383        }
384
385      }
386
387      @Override
388      public Base addChild(String name) throws FHIRException {
389        if (name.equals("claim")) {
390          this.claim = new Reference();
391          return this.claim;
392        }
393        else if (name.equals("relationship")) {
394          this.relationship = new CodeableConcept();
395          return this.relationship;
396        }
397        else if (name.equals("reference")) {
398          this.reference = new Identifier();
399          return this.reference;
400        }
401        else
402          return super.addChild(name);
403      }
404
405      public RelatedClaimComponent copy() {
406        RelatedClaimComponent dst = new RelatedClaimComponent();
407        copyValues(dst);
408        return dst;
409      }
410
411      public void copyValues(RelatedClaimComponent dst) {
412        super.copyValues(dst);
413        dst.claim = claim == null ? null : claim.copy();
414        dst.relationship = relationship == null ? null : relationship.copy();
415        dst.reference = reference == null ? null : reference.copy();
416      }
417
418      @Override
419      public boolean equalsDeep(Base other_) {
420        if (!super.equalsDeep(other_))
421          return false;
422        if (!(other_ instanceof RelatedClaimComponent))
423          return false;
424        RelatedClaimComponent o = (RelatedClaimComponent) other_;
425        return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true) && compareDeep(reference, o.reference, true)
426          ;
427      }
428
429      @Override
430      public boolean equalsShallow(Base other_) {
431        if (!super.equalsShallow(other_))
432          return false;
433        if (!(other_ instanceof RelatedClaimComponent))
434          return false;
435        RelatedClaimComponent o = (RelatedClaimComponent) other_;
436        return true;
437      }
438
439      public boolean isEmpty() {
440        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference
441          );
442      }
443
444  public String fhirType() {
445    return "ExplanationOfBenefit.related";
446
447  }
448
449  }
450
451    @Block()
452    public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
453        /**
454         * Type of Party to be reimbursed: Subscriber, provider, other.
455         */
456        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
457        @Description(shortDefinition="Category of recipient", formalDefinition="Type of Party to be reimbursed: Subscriber, provider, other." )
458        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payeetype")
459        protected CodeableConcept type;
460
461        /**
462         * Reference to the individual or organization to whom any payment will be made.
463         */
464        @Child(name = "party", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, RelatedPerson.class}, order=2, min=0, max=1, modifier=false, summary=false)
465        @Description(shortDefinition="Recipient reference", formalDefinition="Reference to the individual or organization to whom any payment will be made." )
466        protected Reference party;
467
468        private static final long serialVersionUID = -1948897146L;
469
470    /**
471     * Constructor
472     */
473      public PayeeComponent() {
474        super();
475      }
476
477        /**
478         * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
479         */
480        public CodeableConcept getType() { 
481          if (this.type == null)
482            if (Configuration.errorOnAutoCreate())
483              throw new Error("Attempt to auto-create PayeeComponent.type");
484            else if (Configuration.doAutoCreate())
485              this.type = new CodeableConcept(); // cc
486          return this.type;
487        }
488
489        public boolean hasType() { 
490          return this.type != null && !this.type.isEmpty();
491        }
492
493        /**
494         * @param value {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
495         */
496        public PayeeComponent setType(CodeableConcept value) { 
497          this.type = value;
498          return this;
499        }
500
501        /**
502         * @return {@link #party} (Reference to the individual or organization to whom any payment will be made.)
503         */
504        public Reference getParty() { 
505          if (this.party == null)
506            if (Configuration.errorOnAutoCreate())
507              throw new Error("Attempt to auto-create PayeeComponent.party");
508            else if (Configuration.doAutoCreate())
509              this.party = new Reference(); // cc
510          return this.party;
511        }
512
513        public boolean hasParty() { 
514          return this.party != null && !this.party.isEmpty();
515        }
516
517        /**
518         * @param value {@link #party} (Reference to the individual or organization to whom any payment will be made.)
519         */
520        public PayeeComponent setParty(Reference value) { 
521          this.party = value;
522          return this;
523        }
524
525        protected void listChildren(List<Property> children) {
526          super.listChildren(children);
527          children.add(new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type));
528          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));
529        }
530
531        @Override
532        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
533          switch (_hash) {
534          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type);
535          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);
536          default: return super.getNamedProperty(_hash, _name, _checkValid);
537          }
538
539        }
540
541      @Override
542      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
543        switch (hash) {
544        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
545        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
546        default: return super.getProperty(hash, name, checkValid);
547        }
548
549      }
550
551      @Override
552      public Base setProperty(int hash, String name, Base value) throws FHIRException {
553        switch (hash) {
554        case 3575610: // type
555          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
556          return value;
557        case 106437350: // party
558          this.party = TypeConvertor.castToReference(value); // Reference
559          return value;
560        default: return super.setProperty(hash, name, value);
561        }
562
563      }
564
565      @Override
566      public Base setProperty(String name, Base value) throws FHIRException {
567        if (name.equals("type")) {
568          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
569        } else if (name.equals("party")) {
570          this.party = TypeConvertor.castToReference(value); // Reference
571        } else
572          return super.setProperty(name, value);
573        return value;
574      }
575
576      @Override
577      public Base makeProperty(int hash, String name) throws FHIRException {
578        switch (hash) {
579        case 3575610:  return getType();
580        case 106437350:  return getParty();
581        default: return super.makeProperty(hash, name);
582        }
583
584      }
585
586      @Override
587      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
588        switch (hash) {
589        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
590        case 106437350: /*party*/ return new String[] {"Reference"};
591        default: return super.getTypesForProperty(hash, name);
592        }
593
594      }
595
596      @Override
597      public Base addChild(String name) throws FHIRException {
598        if (name.equals("type")) {
599          this.type = new CodeableConcept();
600          return this.type;
601        }
602        else if (name.equals("party")) {
603          this.party = new Reference();
604          return this.party;
605        }
606        else
607          return super.addChild(name);
608      }
609
610      public PayeeComponent copy() {
611        PayeeComponent dst = new PayeeComponent();
612        copyValues(dst);
613        return dst;
614      }
615
616      public void copyValues(PayeeComponent dst) {
617        super.copyValues(dst);
618        dst.type = type == null ? null : type.copy();
619        dst.party = party == null ? null : party.copy();
620      }
621
622      @Override
623      public boolean equalsDeep(Base other_) {
624        if (!super.equalsDeep(other_))
625          return false;
626        if (!(other_ instanceof PayeeComponent))
627          return false;
628        PayeeComponent o = (PayeeComponent) other_;
629        return compareDeep(type, o.type, true) && compareDeep(party, o.party, true);
630      }
631
632      @Override
633      public boolean equalsShallow(Base other_) {
634        if (!super.equalsShallow(other_))
635          return false;
636        if (!(other_ instanceof PayeeComponent))
637          return false;
638        PayeeComponent o = (PayeeComponent) other_;
639        return true;
640      }
641
642      public boolean isEmpty() {
643        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party);
644      }
645
646  public String fhirType() {
647    return "ExplanationOfBenefit.payee";
648
649  }
650
651  }
652
653    @Block()
654    public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
655        /**
656         * A number to uniquely identify care team entries.
657         */
658        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
659        @Description(shortDefinition="Order of care team", formalDefinition="A number to uniquely identify care team entries." )
660        protected PositiveIntType sequence;
661
662        /**
663         * Member of the team who provided the product or service.
664         */
665        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=2, min=1, max=1, modifier=false, summary=false)
666        @Description(shortDefinition="Practitioner or organization", formalDefinition="Member of the team who provided the product or service." )
667        protected Reference provider;
668
669        /**
670         * The party who is billing and/or responsible for the claimed products or services.
671         */
672        @Child(name = "responsible", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
673        @Description(shortDefinition="Indicator of the lead practitioner", formalDefinition="The party who is billing and/or responsible for the claimed products or services." )
674        protected BooleanType responsible;
675
676        /**
677         * The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.
678         */
679        @Child(name = "role", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
680        @Description(shortDefinition="Function within the team", formalDefinition="The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team." )
681        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-careteamrole")
682        protected CodeableConcept role;
683
684        /**
685         * The qualification of the practitioner which is applicable for this service.
686         */
687        @Child(name = "qualification", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
688        @Description(shortDefinition="Practitioner credential or specialization", formalDefinition="The qualification of the practitioner which is applicable for this service." )
689        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provider-qualification")
690        protected CodeableConcept qualification;
691
692        private static final long serialVersionUID = 1479624238L;
693
694    /**
695     * Constructor
696     */
697      public CareTeamComponent() {
698        super();
699      }
700
701    /**
702     * Constructor
703     */
704      public CareTeamComponent(int sequence, Reference provider) {
705        super();
706        this.setSequence(sequence);
707        this.setProvider(provider);
708      }
709
710        /**
711         * @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
712         */
713        public PositiveIntType getSequenceElement() { 
714          if (this.sequence == null)
715            if (Configuration.errorOnAutoCreate())
716              throw new Error("Attempt to auto-create CareTeamComponent.sequence");
717            else if (Configuration.doAutoCreate())
718              this.sequence = new PositiveIntType(); // bb
719          return this.sequence;
720        }
721
722        public boolean hasSequenceElement() { 
723          return this.sequence != null && !this.sequence.isEmpty();
724        }
725
726        public boolean hasSequence() { 
727          return this.sequence != null && !this.sequence.isEmpty();
728        }
729
730        /**
731         * @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
732         */
733        public CareTeamComponent setSequenceElement(PositiveIntType value) { 
734          this.sequence = value;
735          return this;
736        }
737
738        /**
739         * @return A number to uniquely identify care team entries.
740         */
741        public int getSequence() { 
742          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
743        }
744
745        /**
746         * @param value A number to uniquely identify care team entries.
747         */
748        public CareTeamComponent setSequence(int value) { 
749            if (this.sequence == null)
750              this.sequence = new PositiveIntType();
751            this.sequence.setValue(value);
752          return this;
753        }
754
755        /**
756         * @return {@link #provider} (Member of the team who provided the product or service.)
757         */
758        public Reference getProvider() { 
759          if (this.provider == null)
760            if (Configuration.errorOnAutoCreate())
761              throw new Error("Attempt to auto-create CareTeamComponent.provider");
762            else if (Configuration.doAutoCreate())
763              this.provider = new Reference(); // cc
764          return this.provider;
765        }
766
767        public boolean hasProvider() { 
768          return this.provider != null && !this.provider.isEmpty();
769        }
770
771        /**
772         * @param value {@link #provider} (Member of the team who provided the product or service.)
773         */
774        public CareTeamComponent setProvider(Reference value) { 
775          this.provider = value;
776          return this;
777        }
778
779        /**
780         * @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
781         */
782        public BooleanType getResponsibleElement() { 
783          if (this.responsible == null)
784            if (Configuration.errorOnAutoCreate())
785              throw new Error("Attempt to auto-create CareTeamComponent.responsible");
786            else if (Configuration.doAutoCreate())
787              this.responsible = new BooleanType(); // bb
788          return this.responsible;
789        }
790
791        public boolean hasResponsibleElement() { 
792          return this.responsible != null && !this.responsible.isEmpty();
793        }
794
795        public boolean hasResponsible() { 
796          return this.responsible != null && !this.responsible.isEmpty();
797        }
798
799        /**
800         * @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
801         */
802        public CareTeamComponent setResponsibleElement(BooleanType value) { 
803          this.responsible = value;
804          return this;
805        }
806
807        /**
808         * @return The party who is billing and/or responsible for the claimed products or services.
809         */
810        public boolean getResponsible() { 
811          return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
812        }
813
814        /**
815         * @param value The party who is billing and/or responsible for the claimed products or services.
816         */
817        public CareTeamComponent setResponsible(boolean value) { 
818            if (this.responsible == null)
819              this.responsible = new BooleanType();
820            this.responsible.setValue(value);
821          return this;
822        }
823
824        /**
825         * @return {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.)
826         */
827        public CodeableConcept getRole() { 
828          if (this.role == null)
829            if (Configuration.errorOnAutoCreate())
830              throw new Error("Attempt to auto-create CareTeamComponent.role");
831            else if (Configuration.doAutoCreate())
832              this.role = new CodeableConcept(); // cc
833          return this.role;
834        }
835
836        public boolean hasRole() { 
837          return this.role != null && !this.role.isEmpty();
838        }
839
840        /**
841         * @param value {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.)
842         */
843        public CareTeamComponent setRole(CodeableConcept value) { 
844          this.role = value;
845          return this;
846        }
847
848        /**
849         * @return {@link #qualification} (The qualification of the practitioner which is applicable for this service.)
850         */
851        public CodeableConcept getQualification() { 
852          if (this.qualification == null)
853            if (Configuration.errorOnAutoCreate())
854              throw new Error("Attempt to auto-create CareTeamComponent.qualification");
855            else if (Configuration.doAutoCreate())
856              this.qualification = new CodeableConcept(); // cc
857          return this.qualification;
858        }
859
860        public boolean hasQualification() { 
861          return this.qualification != null && !this.qualification.isEmpty();
862        }
863
864        /**
865         * @param value {@link #qualification} (The qualification of the practitioner which is applicable for this service.)
866         */
867        public CareTeamComponent setQualification(CodeableConcept value) { 
868          this.qualification = value;
869          return this;
870        }
871
872        protected void listChildren(List<Property> children) {
873          super.listChildren(children);
874          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence));
875          children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "Member of the team who provided the product or service.", 0, 1, provider));
876          children.add(new Property("responsible", "boolean", "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible));
877          children.add(new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1, role));
878          children.add(new Property("qualification", "CodeableConcept", "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification));
879        }
880
881        @Override
882        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
883          switch (_hash) {
884          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence);
885          case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "Member of the team who provided the product or service.", 0, 1, provider);
886          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);
887          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1, role);
888          case -631333393: /*qualification*/  return new Property("qualification", "CodeableConcept", "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification);
889          default: return super.getNamedProperty(_hash, _name, _checkValid);
890          }
891
892        }
893
894      @Override
895      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
896        switch (hash) {
897        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
898        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
899        case 1847674614: /*responsible*/ return this.responsible == null ? new Base[0] : new Base[] {this.responsible}; // BooleanType
900        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
901        case -631333393: /*qualification*/ return this.qualification == null ? new Base[0] : new Base[] {this.qualification}; // CodeableConcept
902        default: return super.getProperty(hash, name, checkValid);
903        }
904
905      }
906
907      @Override
908      public Base setProperty(int hash, String name, Base value) throws FHIRException {
909        switch (hash) {
910        case 1349547969: // sequence
911          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
912          return value;
913        case -987494927: // provider
914          this.provider = TypeConvertor.castToReference(value); // Reference
915          return value;
916        case 1847674614: // responsible
917          this.responsible = TypeConvertor.castToBoolean(value); // BooleanType
918          return value;
919        case 3506294: // role
920          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
921          return value;
922        case -631333393: // qualification
923          this.qualification = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
924          return value;
925        default: return super.setProperty(hash, name, value);
926        }
927
928      }
929
930      @Override
931      public Base setProperty(String name, Base value) throws FHIRException {
932        if (name.equals("sequence")) {
933          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
934        } else if (name.equals("provider")) {
935          this.provider = TypeConvertor.castToReference(value); // Reference
936        } else if (name.equals("responsible")) {
937          this.responsible = TypeConvertor.castToBoolean(value); // BooleanType
938        } else if (name.equals("role")) {
939          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
940        } else if (name.equals("qualification")) {
941          this.qualification = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
942        } else
943          return super.setProperty(name, value);
944        return value;
945      }
946
947      @Override
948      public Base makeProperty(int hash, String name) throws FHIRException {
949        switch (hash) {
950        case 1349547969:  return getSequenceElement();
951        case -987494927:  return getProvider();
952        case 1847674614:  return getResponsibleElement();
953        case 3506294:  return getRole();
954        case -631333393:  return getQualification();
955        default: return super.makeProperty(hash, name);
956        }
957
958      }
959
960      @Override
961      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
962        switch (hash) {
963        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
964        case -987494927: /*provider*/ return new String[] {"Reference"};
965        case 1847674614: /*responsible*/ return new String[] {"boolean"};
966        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
967        case -631333393: /*qualification*/ return new String[] {"CodeableConcept"};
968        default: return super.getTypesForProperty(hash, name);
969        }
970
971      }
972
973      @Override
974      public Base addChild(String name) throws FHIRException {
975        if (name.equals("sequence")) {
976          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.careTeam.sequence");
977        }
978        else if (name.equals("provider")) {
979          this.provider = new Reference();
980          return this.provider;
981        }
982        else if (name.equals("responsible")) {
983          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.careTeam.responsible");
984        }
985        else if (name.equals("role")) {
986          this.role = new CodeableConcept();
987          return this.role;
988        }
989        else if (name.equals("qualification")) {
990          this.qualification = new CodeableConcept();
991          return this.qualification;
992        }
993        else
994          return super.addChild(name);
995      }
996
997      public CareTeamComponent copy() {
998        CareTeamComponent dst = new CareTeamComponent();
999        copyValues(dst);
1000        return dst;
1001      }
1002
1003      public void copyValues(CareTeamComponent dst) {
1004        super.copyValues(dst);
1005        dst.sequence = sequence == null ? null : sequence.copy();
1006        dst.provider = provider == null ? null : provider.copy();
1007        dst.responsible = responsible == null ? null : responsible.copy();
1008        dst.role = role == null ? null : role.copy();
1009        dst.qualification = qualification == null ? null : qualification.copy();
1010      }
1011
1012      @Override
1013      public boolean equalsDeep(Base other_) {
1014        if (!super.equalsDeep(other_))
1015          return false;
1016        if (!(other_ instanceof CareTeamComponent))
1017          return false;
1018        CareTeamComponent o = (CareTeamComponent) other_;
1019        return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true) && compareDeep(responsible, o.responsible, true)
1020           && compareDeep(role, o.role, true) && compareDeep(qualification, o.qualification, true);
1021      }
1022
1023      @Override
1024      public boolean equalsShallow(Base other_) {
1025        if (!super.equalsShallow(other_))
1026          return false;
1027        if (!(other_ instanceof CareTeamComponent))
1028          return false;
1029        CareTeamComponent o = (CareTeamComponent) other_;
1030        return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true)
1031          ;
1032      }
1033
1034      public boolean isEmpty() {
1035        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible
1036          , role, qualification);
1037      }
1038
1039  public String fhirType() {
1040    return "ExplanationOfBenefit.careTeam";
1041
1042  }
1043
1044  }
1045
1046    @Block()
1047    public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
1048        /**
1049         * A number to uniquely identify supporting information entries.
1050         */
1051        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1052        @Description(shortDefinition="Information instance identifier", formalDefinition="A number to uniquely identify supporting information entries." )
1053        protected PositiveIntType sequence;
1054
1055        /**
1056         * The general class of the information supplied: information; exception; accident, employment; onset, etc.
1057         */
1058        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
1059        @Description(shortDefinition="Classification of the supplied information", formalDefinition="The general class of the information supplied: information; exception; accident, employment; onset, etc." )
1060        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-informationcategory")
1061        protected CodeableConcept category;
1062
1063        /**
1064         * System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.
1065         */
1066        @Child(name = "code", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1067        @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." )
1068        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-exception")
1069        protected CodeableConcept code;
1070
1071        /**
1072         * The date when or period to which this information refers.
1073         */
1074        @Child(name = "timing", type = {DateType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
1075        @Description(shortDefinition="When it occurred", formalDefinition="The date when or period to which this information refers." )
1076        protected DataType timing;
1077
1078        /**
1079         * Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.
1080         */
1081        @Child(name = "value", type = {BooleanType.class, StringType.class, Quantity.class, Attachment.class, Reference.class}, order=5, min=0, max=1, modifier=false, summary=false)
1082        @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." )
1083        protected DataType value;
1084
1085        /**
1086         * Provides the reason in the situation where a reason code is required in addition to the content.
1087         */
1088        @Child(name = "reason", type = {Coding.class}, order=6, min=0, max=1, modifier=false, summary=false)
1089        @Description(shortDefinition="Explanation for the information", formalDefinition="Provides the reason in the situation where a reason code is required in addition to the content." )
1090        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/missing-tooth-reason")
1091        protected Coding reason;
1092
1093        private static final long serialVersionUID = 1577205655L;
1094
1095    /**
1096     * Constructor
1097     */
1098      public SupportingInformationComponent() {
1099        super();
1100      }
1101
1102    /**
1103     * Constructor
1104     */
1105      public SupportingInformationComponent(int sequence, CodeableConcept category) {
1106        super();
1107        this.setSequence(sequence);
1108        this.setCategory(category);
1109      }
1110
1111        /**
1112         * @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
1113         */
1114        public PositiveIntType getSequenceElement() { 
1115          if (this.sequence == null)
1116            if (Configuration.errorOnAutoCreate())
1117              throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
1118            else if (Configuration.doAutoCreate())
1119              this.sequence = new PositiveIntType(); // bb
1120          return this.sequence;
1121        }
1122
1123        public boolean hasSequenceElement() { 
1124          return this.sequence != null && !this.sequence.isEmpty();
1125        }
1126
1127        public boolean hasSequence() { 
1128          return this.sequence != null && !this.sequence.isEmpty();
1129        }
1130
1131        /**
1132         * @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
1133         */
1134        public SupportingInformationComponent setSequenceElement(PositiveIntType value) { 
1135          this.sequence = value;
1136          return this;
1137        }
1138
1139        /**
1140         * @return A number to uniquely identify supporting information entries.
1141         */
1142        public int getSequence() { 
1143          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1144        }
1145
1146        /**
1147         * @param value A number to uniquely identify supporting information entries.
1148         */
1149        public SupportingInformationComponent setSequence(int value) { 
1150            if (this.sequence == null)
1151              this.sequence = new PositiveIntType();
1152            this.sequence.setValue(value);
1153          return this;
1154        }
1155
1156        /**
1157         * @return {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1158         */
1159        public CodeableConcept getCategory() { 
1160          if (this.category == null)
1161            if (Configuration.errorOnAutoCreate())
1162              throw new Error("Attempt to auto-create SupportingInformationComponent.category");
1163            else if (Configuration.doAutoCreate())
1164              this.category = new CodeableConcept(); // cc
1165          return this.category;
1166        }
1167
1168        public boolean hasCategory() { 
1169          return this.category != null && !this.category.isEmpty();
1170        }
1171
1172        /**
1173         * @param value {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1174         */
1175        public SupportingInformationComponent setCategory(CodeableConcept value) { 
1176          this.category = value;
1177          return this;
1178        }
1179
1180        /**
1181         * @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.)
1182         */
1183        public CodeableConcept getCode() { 
1184          if (this.code == null)
1185            if (Configuration.errorOnAutoCreate())
1186              throw new Error("Attempt to auto-create SupportingInformationComponent.code");
1187            else if (Configuration.doAutoCreate())
1188              this.code = new CodeableConcept(); // cc
1189          return this.code;
1190        }
1191
1192        public boolean hasCode() { 
1193          return this.code != null && !this.code.isEmpty();
1194        }
1195
1196        /**
1197         * @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.)
1198         */
1199        public SupportingInformationComponent setCode(CodeableConcept value) { 
1200          this.code = value;
1201          return this;
1202        }
1203
1204        /**
1205         * @return {@link #timing} (The date when or period to which this information refers.)
1206         */
1207        public DataType getTiming() { 
1208          return this.timing;
1209        }
1210
1211        /**
1212         * @return {@link #timing} (The date when or period to which this information refers.)
1213         */
1214        public DateType getTimingDateType() throws FHIRException { 
1215          if (this.timing == null)
1216            this.timing = new DateType();
1217          if (!(this.timing instanceof DateType))
1218            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.timing.getClass().getName()+" was encountered");
1219          return (DateType) this.timing;
1220        }
1221
1222        public boolean hasTimingDateType() { 
1223          return this != null && this.timing instanceof DateType;
1224        }
1225
1226        /**
1227         * @return {@link #timing} (The date when or period to which this information refers.)
1228         */
1229        public Period getTimingPeriod() throws FHIRException { 
1230          if (this.timing == null)
1231            this.timing = new Period();
1232          if (!(this.timing instanceof Period))
1233            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
1234          return (Period) this.timing;
1235        }
1236
1237        public boolean hasTimingPeriod() { 
1238          return this != null && this.timing instanceof Period;
1239        }
1240
1241        public boolean hasTiming() { 
1242          return this.timing != null && !this.timing.isEmpty();
1243        }
1244
1245        /**
1246         * @param value {@link #timing} (The date when or period to which this information refers.)
1247         */
1248        public SupportingInformationComponent setTiming(DataType value) { 
1249          if (value != null && !(value instanceof DateType || value instanceof Period))
1250            throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.timing[x]: "+value.fhirType());
1251          this.timing = value;
1252          return this;
1253        }
1254
1255        /**
1256         * @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.)
1257         */
1258        public DataType getValue() { 
1259          return this.value;
1260        }
1261
1262        /**
1263         * @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.)
1264         */
1265        public BooleanType getValueBooleanType() throws FHIRException { 
1266          if (this.value == null)
1267            this.value = new BooleanType();
1268          if (!(this.value instanceof BooleanType))
1269            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
1270          return (BooleanType) this.value;
1271        }
1272
1273        public boolean hasValueBooleanType() { 
1274          return this != null && this.value instanceof BooleanType;
1275        }
1276
1277        /**
1278         * @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.)
1279         */
1280        public StringType getValueStringType() throws FHIRException { 
1281          if (this.value == null)
1282            this.value = new StringType();
1283          if (!(this.value instanceof StringType))
1284            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
1285          return (StringType) this.value;
1286        }
1287
1288        public boolean hasValueStringType() { 
1289          return this != null && this.value instanceof StringType;
1290        }
1291
1292        /**
1293         * @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.)
1294         */
1295        public Quantity getValueQuantity() throws FHIRException { 
1296          if (this.value == null)
1297            this.value = new Quantity();
1298          if (!(this.value instanceof Quantity))
1299            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
1300          return (Quantity) this.value;
1301        }
1302
1303        public boolean hasValueQuantity() { 
1304          return this != null && this.value instanceof Quantity;
1305        }
1306
1307        /**
1308         * @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.)
1309         */
1310        public Attachment getValueAttachment() throws FHIRException { 
1311          if (this.value == null)
1312            this.value = new Attachment();
1313          if (!(this.value instanceof Attachment))
1314            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
1315          return (Attachment) this.value;
1316        }
1317
1318        public boolean hasValueAttachment() { 
1319          return this != null && this.value instanceof Attachment;
1320        }
1321
1322        /**
1323         * @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.)
1324         */
1325        public Reference getValueReference() throws FHIRException { 
1326          if (this.value == null)
1327            this.value = new Reference();
1328          if (!(this.value instanceof Reference))
1329            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
1330          return (Reference) this.value;
1331        }
1332
1333        public boolean hasValueReference() { 
1334          return this != null && this.value instanceof Reference;
1335        }
1336
1337        public boolean hasValue() { 
1338          return this.value != null && !this.value.isEmpty();
1339        }
1340
1341        /**
1342         * @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.)
1343         */
1344        public SupportingInformationComponent setValue(DataType value) { 
1345          if (value != null && !(value instanceof BooleanType || value instanceof StringType || value instanceof Quantity || value instanceof Attachment || value instanceof Reference))
1346            throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.value[x]: "+value.fhirType());
1347          this.value = value;
1348          return this;
1349        }
1350
1351        /**
1352         * @return {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1353         */
1354        public Coding getReason() { 
1355          if (this.reason == null)
1356            if (Configuration.errorOnAutoCreate())
1357              throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1358            else if (Configuration.doAutoCreate())
1359              this.reason = new Coding(); // cc
1360          return this.reason;
1361        }
1362
1363        public boolean hasReason() { 
1364          return this.reason != null && !this.reason.isEmpty();
1365        }
1366
1367        /**
1368         * @param value {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1369         */
1370        public SupportingInformationComponent setReason(Coding value) { 
1371          this.reason = value;
1372          return this;
1373        }
1374
1375        protected void listChildren(List<Property> children) {
1376          super.listChildren(children);
1377          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence));
1378          children.add(new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category));
1379          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));
1380          children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing));
1381          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));
1382          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));
1383        }
1384
1385        @Override
1386        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1387          switch (_hash) {
1388          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence);
1389          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category);
1390          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);
1391          case 164632566: /*timing[x]*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1392          case -873664438: /*timing*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1393          case 807935768: /*timingDate*/  return new Property("timing[x]", "date", "The date when or period to which this information refers.", 0, 1, timing);
1394          case -615615829: /*timingPeriod*/  return new Property("timing[x]", "Period", "The date when or period to which this information refers.", 0, 1, timing);
1395          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);
1396          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);
1397          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);
1398          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);
1399          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);
1400          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);
1401          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);
1402          case -934964668: /*reason*/  return new Property("reason", "Coding", "Provides the reason in the situation where a reason code is required in addition to the content.", 0, 1, reason);
1403          default: return super.getNamedProperty(_hash, _name, _checkValid);
1404          }
1405
1406        }
1407
1408      @Override
1409      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1410        switch (hash) {
1411        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1412        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1413        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1414        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // DataType
1415        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
1416        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
1417        default: return super.getProperty(hash, name, checkValid);
1418        }
1419
1420      }
1421
1422      @Override
1423      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1424        switch (hash) {
1425        case 1349547969: // sequence
1426          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1427          return value;
1428        case 50511102: // category
1429          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1430          return value;
1431        case 3059181: // code
1432          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1433          return value;
1434        case -873664438: // timing
1435          this.timing = TypeConvertor.castToType(value); // DataType
1436          return value;
1437        case 111972721: // value
1438          this.value = TypeConvertor.castToType(value); // DataType
1439          return value;
1440        case -934964668: // reason
1441          this.reason = TypeConvertor.castToCoding(value); // Coding
1442          return value;
1443        default: return super.setProperty(hash, name, value);
1444        }
1445
1446      }
1447
1448      @Override
1449      public Base setProperty(String name, Base value) throws FHIRException {
1450        if (name.equals("sequence")) {
1451          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1452        } else if (name.equals("category")) {
1453          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1454        } else if (name.equals("code")) {
1455          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1456        } else if (name.equals("timing[x]")) {
1457          this.timing = TypeConvertor.castToType(value); // DataType
1458        } else if (name.equals("value[x]")) {
1459          this.value = TypeConvertor.castToType(value); // DataType
1460        } else if (name.equals("reason")) {
1461          this.reason = TypeConvertor.castToCoding(value); // Coding
1462        } else
1463          return super.setProperty(name, value);
1464        return value;
1465      }
1466
1467      @Override
1468      public Base makeProperty(int hash, String name) throws FHIRException {
1469        switch (hash) {
1470        case 1349547969:  return getSequenceElement();
1471        case 50511102:  return getCategory();
1472        case 3059181:  return getCode();
1473        case 164632566:  return getTiming();
1474        case -873664438:  return getTiming();
1475        case -1410166417:  return getValue();
1476        case 111972721:  return getValue();
1477        case -934964668:  return getReason();
1478        default: return super.makeProperty(hash, name);
1479        }
1480
1481      }
1482
1483      @Override
1484      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1485        switch (hash) {
1486        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1487        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1488        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1489        case -873664438: /*timing*/ return new String[] {"date", "Period"};
1490        case 111972721: /*value*/ return new String[] {"boolean", "string", "Quantity", "Attachment", "Reference"};
1491        case -934964668: /*reason*/ return new String[] {"Coding"};
1492        default: return super.getTypesForProperty(hash, name);
1493        }
1494
1495      }
1496
1497      @Override
1498      public Base addChild(String name) throws FHIRException {
1499        if (name.equals("sequence")) {
1500          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.supportingInfo.sequence");
1501        }
1502        else if (name.equals("category")) {
1503          this.category = new CodeableConcept();
1504          return this.category;
1505        }
1506        else if (name.equals("code")) {
1507          this.code = new CodeableConcept();
1508          return this.code;
1509        }
1510        else if (name.equals("timingDate")) {
1511          this.timing = new DateType();
1512          return this.timing;
1513        }
1514        else if (name.equals("timingPeriod")) {
1515          this.timing = new Period();
1516          return this.timing;
1517        }
1518        else if (name.equals("valueBoolean")) {
1519          this.value = new BooleanType();
1520          return this.value;
1521        }
1522        else if (name.equals("valueString")) {
1523          this.value = new StringType();
1524          return this.value;
1525        }
1526        else if (name.equals("valueQuantity")) {
1527          this.value = new Quantity();
1528          return this.value;
1529        }
1530        else if (name.equals("valueAttachment")) {
1531          this.value = new Attachment();
1532          return this.value;
1533        }
1534        else if (name.equals("valueReference")) {
1535          this.value = new Reference();
1536          return this.value;
1537        }
1538        else if (name.equals("reason")) {
1539          this.reason = new Coding();
1540          return this.reason;
1541        }
1542        else
1543          return super.addChild(name);
1544      }
1545
1546      public SupportingInformationComponent copy() {
1547        SupportingInformationComponent dst = new SupportingInformationComponent();
1548        copyValues(dst);
1549        return dst;
1550      }
1551
1552      public void copyValues(SupportingInformationComponent dst) {
1553        super.copyValues(dst);
1554        dst.sequence = sequence == null ? null : sequence.copy();
1555        dst.category = category == null ? null : category.copy();
1556        dst.code = code == null ? null : code.copy();
1557        dst.timing = timing == null ? null : timing.copy();
1558        dst.value = value == null ? null : value.copy();
1559        dst.reason = reason == null ? null : reason.copy();
1560      }
1561
1562      @Override
1563      public boolean equalsDeep(Base other_) {
1564        if (!super.equalsDeep(other_))
1565          return false;
1566        if (!(other_ instanceof SupportingInformationComponent))
1567          return false;
1568        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1569        return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true) && compareDeep(code, o.code, true)
1570           && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true) && compareDeep(reason, o.reason, true)
1571          ;
1572      }
1573
1574      @Override
1575      public boolean equalsShallow(Base other_) {
1576        if (!super.equalsShallow(other_))
1577          return false;
1578        if (!(other_ instanceof SupportingInformationComponent))
1579          return false;
1580        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1581        return compareValues(sequence, o.sequence, true);
1582      }
1583
1584      public boolean isEmpty() {
1585        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code
1586          , timing, value, reason);
1587      }
1588
1589  public String fhirType() {
1590    return "ExplanationOfBenefit.supportingInfo";
1591
1592  }
1593
1594  }
1595
1596    @Block()
1597    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
1598        /**
1599         * A number to uniquely identify diagnosis entries.
1600         */
1601        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1602        @Description(shortDefinition="Diagnosis instance identifier", formalDefinition="A number to uniquely identify diagnosis entries." )
1603        protected PositiveIntType sequence;
1604
1605        /**
1606         * The nature of illness or problem in a coded form or as a reference to an external defined Condition.
1607         */
1608        @Child(name = "diagnosis", type = {CodeableConcept.class, Condition.class}, order=2, min=1, max=1, modifier=false, summary=false)
1609        @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." )
1610        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10")
1611        protected DataType diagnosis;
1612
1613        /**
1614         * When the condition was observed or the relative ranking.
1615         */
1616        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1617        @Description(shortDefinition="Timing or nature of the diagnosis", formalDefinition="When the condition was observed or the relative ranking." )
1618        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosistype")
1619        protected List<CodeableConcept> type;
1620
1621        /**
1622         * Indication of whether the diagnosis was present on admission to a facility.
1623         */
1624        @Child(name = "onAdmission", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1625        @Description(shortDefinition="Present on admission", formalDefinition="Indication of whether the diagnosis was present on admission to a facility." )
1626        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosis-on-admission")
1627        protected CodeableConcept onAdmission;
1628
1629        /**
1630         * 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.
1631         */
1632        @Child(name = "packageCode", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1633        @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." )
1634        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
1635        protected CodeableConcept packageCode;
1636
1637        private static final long serialVersionUID = 550515328L;
1638
1639    /**
1640     * Constructor
1641     */
1642      public DiagnosisComponent() {
1643        super();
1644      }
1645
1646    /**
1647     * Constructor
1648     */
1649      public DiagnosisComponent(int sequence, DataType diagnosis) {
1650        super();
1651        this.setSequence(sequence);
1652        this.setDiagnosis(diagnosis);
1653      }
1654
1655        /**
1656         * @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
1657         */
1658        public PositiveIntType getSequenceElement() { 
1659          if (this.sequence == null)
1660            if (Configuration.errorOnAutoCreate())
1661              throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
1662            else if (Configuration.doAutoCreate())
1663              this.sequence = new PositiveIntType(); // bb
1664          return this.sequence;
1665        }
1666
1667        public boolean hasSequenceElement() { 
1668          return this.sequence != null && !this.sequence.isEmpty();
1669        }
1670
1671        public boolean hasSequence() { 
1672          return this.sequence != null && !this.sequence.isEmpty();
1673        }
1674
1675        /**
1676         * @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
1677         */
1678        public DiagnosisComponent setSequenceElement(PositiveIntType value) { 
1679          this.sequence = value;
1680          return this;
1681        }
1682
1683        /**
1684         * @return A number to uniquely identify diagnosis entries.
1685         */
1686        public int getSequence() { 
1687          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1688        }
1689
1690        /**
1691         * @param value A number to uniquely identify diagnosis entries.
1692         */
1693        public DiagnosisComponent setSequence(int value) { 
1694            if (this.sequence == null)
1695              this.sequence = new PositiveIntType();
1696            this.sequence.setValue(value);
1697          return this;
1698        }
1699
1700        /**
1701         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1702         */
1703        public DataType getDiagnosis() { 
1704          return this.diagnosis;
1705        }
1706
1707        /**
1708         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1709         */
1710        public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException { 
1711          if (this.diagnosis == null)
1712            this.diagnosis = new CodeableConcept();
1713          if (!(this.diagnosis instanceof CodeableConcept))
1714            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1715          return (CodeableConcept) this.diagnosis;
1716        }
1717
1718        public boolean hasDiagnosisCodeableConcept() { 
1719          return this != null && this.diagnosis instanceof CodeableConcept;
1720        }
1721
1722        /**
1723         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1724         */
1725        public Reference getDiagnosisReference() throws FHIRException { 
1726          if (this.diagnosis == null)
1727            this.diagnosis = new Reference();
1728          if (!(this.diagnosis instanceof Reference))
1729            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1730          return (Reference) this.diagnosis;
1731        }
1732
1733        public boolean hasDiagnosisReference() { 
1734          return this != null && this.diagnosis instanceof Reference;
1735        }
1736
1737        public boolean hasDiagnosis() { 
1738          return this.diagnosis != null && !this.diagnosis.isEmpty();
1739        }
1740
1741        /**
1742         * @param value {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1743         */
1744        public DiagnosisComponent setDiagnosis(DataType value) { 
1745          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1746            throw new Error("Not the right type for ExplanationOfBenefit.diagnosis.diagnosis[x]: "+value.fhirType());
1747          this.diagnosis = value;
1748          return this;
1749        }
1750
1751        /**
1752         * @return {@link #type} (When the condition was observed or the relative ranking.)
1753         */
1754        public List<CodeableConcept> getType() { 
1755          if (this.type == null)
1756            this.type = new ArrayList<CodeableConcept>();
1757          return this.type;
1758        }
1759
1760        /**
1761         * @return Returns a reference to <code>this</code> for easy method chaining
1762         */
1763        public DiagnosisComponent setType(List<CodeableConcept> theType) { 
1764          this.type = theType;
1765          return this;
1766        }
1767
1768        public boolean hasType() { 
1769          if (this.type == null)
1770            return false;
1771          for (CodeableConcept item : this.type)
1772            if (!item.isEmpty())
1773              return true;
1774          return false;
1775        }
1776
1777        public CodeableConcept addType() { //3
1778          CodeableConcept t = new CodeableConcept();
1779          if (this.type == null)
1780            this.type = new ArrayList<CodeableConcept>();
1781          this.type.add(t);
1782          return t;
1783        }
1784
1785        public DiagnosisComponent addType(CodeableConcept t) { //3
1786          if (t == null)
1787            return this;
1788          if (this.type == null)
1789            this.type = new ArrayList<CodeableConcept>();
1790          this.type.add(t);
1791          return this;
1792        }
1793
1794        /**
1795         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
1796         */
1797        public CodeableConcept getTypeFirstRep() { 
1798          if (getType().isEmpty()) {
1799            addType();
1800          }
1801          return getType().get(0);
1802        }
1803
1804        /**
1805         * @return {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
1806         */
1807        public CodeableConcept getOnAdmission() { 
1808          if (this.onAdmission == null)
1809            if (Configuration.errorOnAutoCreate())
1810              throw new Error("Attempt to auto-create DiagnosisComponent.onAdmission");
1811            else if (Configuration.doAutoCreate())
1812              this.onAdmission = new CodeableConcept(); // cc
1813          return this.onAdmission;
1814        }
1815
1816        public boolean hasOnAdmission() { 
1817          return this.onAdmission != null && !this.onAdmission.isEmpty();
1818        }
1819
1820        /**
1821         * @param value {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
1822         */
1823        public DiagnosisComponent setOnAdmission(CodeableConcept value) { 
1824          this.onAdmission = value;
1825          return this;
1826        }
1827
1828        /**
1829         * @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.)
1830         */
1831        public CodeableConcept getPackageCode() { 
1832          if (this.packageCode == null)
1833            if (Configuration.errorOnAutoCreate())
1834              throw new Error("Attempt to auto-create DiagnosisComponent.packageCode");
1835            else if (Configuration.doAutoCreate())
1836              this.packageCode = new CodeableConcept(); // cc
1837          return this.packageCode;
1838        }
1839
1840        public boolean hasPackageCode() { 
1841          return this.packageCode != null && !this.packageCode.isEmpty();
1842        }
1843
1844        /**
1845         * @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.)
1846         */
1847        public DiagnosisComponent setPackageCode(CodeableConcept value) { 
1848          this.packageCode = value;
1849          return this;
1850        }
1851
1852        protected void listChildren(List<Property> children) {
1853          super.listChildren(children);
1854          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence));
1855          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));
1856          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
1857          children.add(new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission));
1858          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));
1859        }
1860
1861        @Override
1862        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1863          switch (_hash) {
1864          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence);
1865          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);
1866          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);
1867          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);
1868          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);
1869          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
1870          case -3386134: /*onAdmission*/  return new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission);
1871          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);
1872          default: return super.getNamedProperty(_hash, _name, _checkValid);
1873          }
1874
1875        }
1876
1877      @Override
1878      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1879        switch (hash) {
1880        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1881        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // DataType
1882        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
1883        case -3386134: /*onAdmission*/ return this.onAdmission == null ? new Base[0] : new Base[] {this.onAdmission}; // CodeableConcept
1884        case 908444499: /*packageCode*/ return this.packageCode == null ? new Base[0] : new Base[] {this.packageCode}; // CodeableConcept
1885        default: return super.getProperty(hash, name, checkValid);
1886        }
1887
1888      }
1889
1890      @Override
1891      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1892        switch (hash) {
1893        case 1349547969: // sequence
1894          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1895          return value;
1896        case 1196993265: // diagnosis
1897          this.diagnosis = TypeConvertor.castToType(value); // DataType
1898          return value;
1899        case 3575610: // type
1900          this.getType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1901          return value;
1902        case -3386134: // onAdmission
1903          this.onAdmission = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1904          return value;
1905        case 908444499: // packageCode
1906          this.packageCode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1907          return value;
1908        default: return super.setProperty(hash, name, value);
1909        }
1910
1911      }
1912
1913      @Override
1914      public Base setProperty(String name, Base value) throws FHIRException {
1915        if (name.equals("sequence")) {
1916          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
1917        } else if (name.equals("diagnosis[x]")) {
1918          this.diagnosis = TypeConvertor.castToType(value); // DataType
1919        } else if (name.equals("type")) {
1920          this.getType().add(TypeConvertor.castToCodeableConcept(value));
1921        } else if (name.equals("onAdmission")) {
1922          this.onAdmission = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1923        } else if (name.equals("packageCode")) {
1924          this.packageCode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1925        } else
1926          return super.setProperty(name, value);
1927        return value;
1928      }
1929
1930      @Override
1931      public Base makeProperty(int hash, String name) throws FHIRException {
1932        switch (hash) {
1933        case 1349547969:  return getSequenceElement();
1934        case -1487009809:  return getDiagnosis();
1935        case 1196993265:  return getDiagnosis();
1936        case 3575610:  return addType(); 
1937        case -3386134:  return getOnAdmission();
1938        case 908444499:  return getPackageCode();
1939        default: return super.makeProperty(hash, name);
1940        }
1941
1942      }
1943
1944      @Override
1945      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1946        switch (hash) {
1947        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1948        case 1196993265: /*diagnosis*/ return new String[] {"CodeableConcept", "Reference"};
1949        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1950        case -3386134: /*onAdmission*/ return new String[] {"CodeableConcept"};
1951        case 908444499: /*packageCode*/ return new String[] {"CodeableConcept"};
1952        default: return super.getTypesForProperty(hash, name);
1953        }
1954
1955      }
1956
1957      @Override
1958      public Base addChild(String name) throws FHIRException {
1959        if (name.equals("sequence")) {
1960          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.diagnosis.sequence");
1961        }
1962        else if (name.equals("diagnosisCodeableConcept")) {
1963          this.diagnosis = new CodeableConcept();
1964          return this.diagnosis;
1965        }
1966        else if (name.equals("diagnosisReference")) {
1967          this.diagnosis = new Reference();
1968          return this.diagnosis;
1969        }
1970        else if (name.equals("type")) {
1971          return addType();
1972        }
1973        else if (name.equals("onAdmission")) {
1974          this.onAdmission = new CodeableConcept();
1975          return this.onAdmission;
1976        }
1977        else if (name.equals("packageCode")) {
1978          this.packageCode = new CodeableConcept();
1979          return this.packageCode;
1980        }
1981        else
1982          return super.addChild(name);
1983      }
1984
1985      public DiagnosisComponent copy() {
1986        DiagnosisComponent dst = new DiagnosisComponent();
1987        copyValues(dst);
1988        return dst;
1989      }
1990
1991      public void copyValues(DiagnosisComponent dst) {
1992        super.copyValues(dst);
1993        dst.sequence = sequence == null ? null : sequence.copy();
1994        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
1995        if (type != null) {
1996          dst.type = new ArrayList<CodeableConcept>();
1997          for (CodeableConcept i : type)
1998            dst.type.add(i.copy());
1999        };
2000        dst.onAdmission = onAdmission == null ? null : onAdmission.copy();
2001        dst.packageCode = packageCode == null ? null : packageCode.copy();
2002      }
2003
2004      @Override
2005      public boolean equalsDeep(Base other_) {
2006        if (!super.equalsDeep(other_))
2007          return false;
2008        if (!(other_ instanceof DiagnosisComponent))
2009          return false;
2010        DiagnosisComponent o = (DiagnosisComponent) other_;
2011        return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(type, o.type, true)
2012           && compareDeep(onAdmission, o.onAdmission, true) && compareDeep(packageCode, o.packageCode, true)
2013          ;
2014      }
2015
2016      @Override
2017      public boolean equalsShallow(Base other_) {
2018        if (!super.equalsShallow(other_))
2019          return false;
2020        if (!(other_ instanceof DiagnosisComponent))
2021          return false;
2022        DiagnosisComponent o = (DiagnosisComponent) other_;
2023        return compareValues(sequence, o.sequence, true);
2024      }
2025
2026      public boolean isEmpty() {
2027        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type
2028          , onAdmission, packageCode);
2029      }
2030
2031  public String fhirType() {
2032    return "ExplanationOfBenefit.diagnosis";
2033
2034  }
2035
2036  }
2037
2038    @Block()
2039    public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
2040        /**
2041         * A number to uniquely identify procedure entries.
2042         */
2043        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2044        @Description(shortDefinition="Procedure instance identifier", formalDefinition="A number to uniquely identify procedure entries." )
2045        protected PositiveIntType sequence;
2046
2047        /**
2048         * When the condition was observed or the relative ranking.
2049         */
2050        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2051        @Description(shortDefinition="Category of Procedure", formalDefinition="When the condition was observed or the relative ranking." )
2052        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-procedure-type")
2053        protected List<CodeableConcept> type;
2054
2055        /**
2056         * Date and optionally time the procedure was performed.
2057         */
2058        @Child(name = "date", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2059        @Description(shortDefinition="When the procedure was performed", formalDefinition="Date and optionally time the procedure was performed." )
2060        protected DateTimeType date;
2061
2062        /**
2063         * The code or reference to a Procedure resource which identifies the clinical intervention performed.
2064         */
2065        @Child(name = "procedure", type = {CodeableConcept.class, Procedure.class}, order=4, min=1, max=1, modifier=false, summary=false)
2066        @Description(shortDefinition="Specific clinical procedure", formalDefinition="The code or reference to a Procedure resource which identifies the clinical intervention performed." )
2067        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10-procedures")
2068        protected DataType procedure;
2069
2070        /**
2071         * Unique Device Identifiers associated with this line item.
2072         */
2073        @Child(name = "udi", type = {Device.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2074        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
2075        protected List<Reference> udi;
2076
2077        private static final long serialVersionUID = 1165684715L;
2078
2079    /**
2080     * Constructor
2081     */
2082      public ProcedureComponent() {
2083        super();
2084      }
2085
2086    /**
2087     * Constructor
2088     */
2089      public ProcedureComponent(int sequence, DataType procedure) {
2090        super();
2091        this.setSequence(sequence);
2092        this.setProcedure(procedure);
2093      }
2094
2095        /**
2096         * @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
2097         */
2098        public PositiveIntType getSequenceElement() { 
2099          if (this.sequence == null)
2100            if (Configuration.errorOnAutoCreate())
2101              throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2102            else if (Configuration.doAutoCreate())
2103              this.sequence = new PositiveIntType(); // bb
2104          return this.sequence;
2105        }
2106
2107        public boolean hasSequenceElement() { 
2108          return this.sequence != null && !this.sequence.isEmpty();
2109        }
2110
2111        public boolean hasSequence() { 
2112          return this.sequence != null && !this.sequence.isEmpty();
2113        }
2114
2115        /**
2116         * @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
2117         */
2118        public ProcedureComponent setSequenceElement(PositiveIntType value) { 
2119          this.sequence = value;
2120          return this;
2121        }
2122
2123        /**
2124         * @return A number to uniquely identify procedure entries.
2125         */
2126        public int getSequence() { 
2127          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2128        }
2129
2130        /**
2131         * @param value A number to uniquely identify procedure entries.
2132         */
2133        public ProcedureComponent setSequence(int value) { 
2134            if (this.sequence == null)
2135              this.sequence = new PositiveIntType();
2136            this.sequence.setValue(value);
2137          return this;
2138        }
2139
2140        /**
2141         * @return {@link #type} (When the condition was observed or the relative ranking.)
2142         */
2143        public List<CodeableConcept> getType() { 
2144          if (this.type == null)
2145            this.type = new ArrayList<CodeableConcept>();
2146          return this.type;
2147        }
2148
2149        /**
2150         * @return Returns a reference to <code>this</code> for easy method chaining
2151         */
2152        public ProcedureComponent setType(List<CodeableConcept> theType) { 
2153          this.type = theType;
2154          return this;
2155        }
2156
2157        public boolean hasType() { 
2158          if (this.type == null)
2159            return false;
2160          for (CodeableConcept item : this.type)
2161            if (!item.isEmpty())
2162              return true;
2163          return false;
2164        }
2165
2166        public CodeableConcept addType() { //3
2167          CodeableConcept t = new CodeableConcept();
2168          if (this.type == null)
2169            this.type = new ArrayList<CodeableConcept>();
2170          this.type.add(t);
2171          return t;
2172        }
2173
2174        public ProcedureComponent addType(CodeableConcept t) { //3
2175          if (t == null)
2176            return this;
2177          if (this.type == null)
2178            this.type = new ArrayList<CodeableConcept>();
2179          this.type.add(t);
2180          return this;
2181        }
2182
2183        /**
2184         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
2185         */
2186        public CodeableConcept getTypeFirstRep() { 
2187          if (getType().isEmpty()) {
2188            addType();
2189          }
2190          return getType().get(0);
2191        }
2192
2193        /**
2194         * @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
2195         */
2196        public DateTimeType getDateElement() { 
2197          if (this.date == null)
2198            if (Configuration.errorOnAutoCreate())
2199              throw new Error("Attempt to auto-create ProcedureComponent.date");
2200            else if (Configuration.doAutoCreate())
2201              this.date = new DateTimeType(); // bb
2202          return this.date;
2203        }
2204
2205        public boolean hasDateElement() { 
2206          return this.date != null && !this.date.isEmpty();
2207        }
2208
2209        public boolean hasDate() { 
2210          return this.date != null && !this.date.isEmpty();
2211        }
2212
2213        /**
2214         * @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
2215         */
2216        public ProcedureComponent setDateElement(DateTimeType value) { 
2217          this.date = value;
2218          return this;
2219        }
2220
2221        /**
2222         * @return Date and optionally time the procedure was performed.
2223         */
2224        public Date getDate() { 
2225          return this.date == null ? null : this.date.getValue();
2226        }
2227
2228        /**
2229         * @param value Date and optionally time the procedure was performed.
2230         */
2231        public ProcedureComponent setDate(Date value) { 
2232          if (value == null)
2233            this.date = null;
2234          else {
2235            if (this.date == null)
2236              this.date = new DateTimeType();
2237            this.date.setValue(value);
2238          }
2239          return this;
2240        }
2241
2242        /**
2243         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2244         */
2245        public DataType getProcedure() { 
2246          return this.procedure;
2247        }
2248
2249        /**
2250         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2251         */
2252        public CodeableConcept getProcedureCodeableConcept() throws FHIRException { 
2253          if (this.procedure == null)
2254            this.procedure = new CodeableConcept();
2255          if (!(this.procedure instanceof CodeableConcept))
2256            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.procedure.getClass().getName()+" was encountered");
2257          return (CodeableConcept) this.procedure;
2258        }
2259
2260        public boolean hasProcedureCodeableConcept() { 
2261          return this != null && this.procedure instanceof CodeableConcept;
2262        }
2263
2264        /**
2265         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2266         */
2267        public Reference getProcedureReference() throws FHIRException { 
2268          if (this.procedure == null)
2269            this.procedure = new Reference();
2270          if (!(this.procedure instanceof Reference))
2271            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.procedure.getClass().getName()+" was encountered");
2272          return (Reference) this.procedure;
2273        }
2274
2275        public boolean hasProcedureReference() { 
2276          return this != null && this.procedure instanceof Reference;
2277        }
2278
2279        public boolean hasProcedure() { 
2280          return this.procedure != null && !this.procedure.isEmpty();
2281        }
2282
2283        /**
2284         * @param value {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2285         */
2286        public ProcedureComponent setProcedure(DataType value) { 
2287          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2288            throw new Error("Not the right type for ExplanationOfBenefit.procedure.procedure[x]: "+value.fhirType());
2289          this.procedure = value;
2290          return this;
2291        }
2292
2293        /**
2294         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
2295         */
2296        public List<Reference> getUdi() { 
2297          if (this.udi == null)
2298            this.udi = new ArrayList<Reference>();
2299          return this.udi;
2300        }
2301
2302        /**
2303         * @return Returns a reference to <code>this</code> for easy method chaining
2304         */
2305        public ProcedureComponent setUdi(List<Reference> theUdi) { 
2306          this.udi = theUdi;
2307          return this;
2308        }
2309
2310        public boolean hasUdi() { 
2311          if (this.udi == null)
2312            return false;
2313          for (Reference item : this.udi)
2314            if (!item.isEmpty())
2315              return true;
2316          return false;
2317        }
2318
2319        public Reference addUdi() { //3
2320          Reference t = new Reference();
2321          if (this.udi == null)
2322            this.udi = new ArrayList<Reference>();
2323          this.udi.add(t);
2324          return t;
2325        }
2326
2327        public ProcedureComponent addUdi(Reference t) { //3
2328          if (t == null)
2329            return this;
2330          if (this.udi == null)
2331            this.udi = new ArrayList<Reference>();
2332          this.udi.add(t);
2333          return this;
2334        }
2335
2336        /**
2337         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
2338         */
2339        public Reference getUdiFirstRep() { 
2340          if (getUdi().isEmpty()) {
2341            addUdi();
2342          }
2343          return getUdi().get(0);
2344        }
2345
2346        protected void listChildren(List<Property> children) {
2347          super.listChildren(children);
2348          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence));
2349          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
2350          children.add(new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date));
2351          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));
2352          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
2353        }
2354
2355        @Override
2356        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2357          switch (_hash) {
2358          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence);
2359          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2360          case 3076014: /*date*/  return new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date);
2361          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);
2362          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);
2363          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);
2364          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);
2365          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
2366          default: return super.getNamedProperty(_hash, _name, _checkValid);
2367          }
2368
2369        }
2370
2371      @Override
2372      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2373        switch (hash) {
2374        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2375        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2376        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2377        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // DataType
2378        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
2379        default: return super.getProperty(hash, name, checkValid);
2380        }
2381
2382      }
2383
2384      @Override
2385      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2386        switch (hash) {
2387        case 1349547969: // sequence
2388          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
2389          return value;
2390        case 3575610: // type
2391          this.getType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2392          return value;
2393        case 3076014: // date
2394          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
2395          return value;
2396        case -1095204141: // procedure
2397          this.procedure = TypeConvertor.castToType(value); // DataType
2398          return value;
2399        case 115642: // udi
2400          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
2401          return value;
2402        default: return super.setProperty(hash, name, value);
2403        }
2404
2405      }
2406
2407      @Override
2408      public Base setProperty(String name, Base value) throws FHIRException {
2409        if (name.equals("sequence")) {
2410          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
2411        } else if (name.equals("type")) {
2412          this.getType().add(TypeConvertor.castToCodeableConcept(value));
2413        } else if (name.equals("date")) {
2414          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
2415        } else if (name.equals("procedure[x]")) {
2416          this.procedure = TypeConvertor.castToType(value); // DataType
2417        } else if (name.equals("udi")) {
2418          this.getUdi().add(TypeConvertor.castToReference(value));
2419        } else
2420          return super.setProperty(name, value);
2421        return value;
2422      }
2423
2424      @Override
2425      public Base makeProperty(int hash, String name) throws FHIRException {
2426        switch (hash) {
2427        case 1349547969:  return getSequenceElement();
2428        case 3575610:  return addType(); 
2429        case 3076014:  return getDateElement();
2430        case 1640074445:  return getProcedure();
2431        case -1095204141:  return getProcedure();
2432        case 115642:  return addUdi(); 
2433        default: return super.makeProperty(hash, name);
2434        }
2435
2436      }
2437
2438      @Override
2439      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2440        switch (hash) {
2441        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2442        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2443        case 3076014: /*date*/ return new String[] {"dateTime"};
2444        case -1095204141: /*procedure*/ return new String[] {"CodeableConcept", "Reference"};
2445        case 115642: /*udi*/ return new String[] {"Reference"};
2446        default: return super.getTypesForProperty(hash, name);
2447        }
2448
2449      }
2450
2451      @Override
2452      public Base addChild(String name) throws FHIRException {
2453        if (name.equals("sequence")) {
2454          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedure.sequence");
2455        }
2456        else if (name.equals("type")) {
2457          return addType();
2458        }
2459        else if (name.equals("date")) {
2460          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedure.date");
2461        }
2462        else if (name.equals("procedureCodeableConcept")) {
2463          this.procedure = new CodeableConcept();
2464          return this.procedure;
2465        }
2466        else if (name.equals("procedureReference")) {
2467          this.procedure = new Reference();
2468          return this.procedure;
2469        }
2470        else if (name.equals("udi")) {
2471          return addUdi();
2472        }
2473        else
2474          return super.addChild(name);
2475      }
2476
2477      public ProcedureComponent copy() {
2478        ProcedureComponent dst = new ProcedureComponent();
2479        copyValues(dst);
2480        return dst;
2481      }
2482
2483      public void copyValues(ProcedureComponent dst) {
2484        super.copyValues(dst);
2485        dst.sequence = sequence == null ? null : sequence.copy();
2486        if (type != null) {
2487          dst.type = new ArrayList<CodeableConcept>();
2488          for (CodeableConcept i : type)
2489            dst.type.add(i.copy());
2490        };
2491        dst.date = date == null ? null : date.copy();
2492        dst.procedure = procedure == null ? null : procedure.copy();
2493        if (udi != null) {
2494          dst.udi = new ArrayList<Reference>();
2495          for (Reference i : udi)
2496            dst.udi.add(i.copy());
2497        };
2498      }
2499
2500      @Override
2501      public boolean equalsDeep(Base other_) {
2502        if (!super.equalsDeep(other_))
2503          return false;
2504        if (!(other_ instanceof ProcedureComponent))
2505          return false;
2506        ProcedureComponent o = (ProcedureComponent) other_;
2507        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(date, o.date, true)
2508           && compareDeep(procedure, o.procedure, true) && compareDeep(udi, o.udi, true);
2509      }
2510
2511      @Override
2512      public boolean equalsShallow(Base other_) {
2513        if (!super.equalsShallow(other_))
2514          return false;
2515        if (!(other_ instanceof ProcedureComponent))
2516          return false;
2517        ProcedureComponent o = (ProcedureComponent) other_;
2518        return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
2519      }
2520
2521      public boolean isEmpty() {
2522        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, date, procedure
2523          , udi);
2524      }
2525
2526  public String fhirType() {
2527    return "ExplanationOfBenefit.procedure";
2528
2529  }
2530
2531  }
2532
2533    @Block()
2534    public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
2535        /**
2536         * A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2537         */
2538        @Child(name = "focal", type = {BooleanType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2539        @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." )
2540        protected BooleanType focal;
2541
2542        /**
2543         * 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.
2544         */
2545        @Child(name = "coverage", type = {Coverage.class}, order=2, min=1, max=1, modifier=false, summary=true)
2546        @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." )
2547        protected Reference coverage;
2548
2549        /**
2550         * 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.
2551         */
2552        @Child(name = "preAuthRef", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2553        @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." )
2554        protected List<StringType> preAuthRef;
2555
2556        private static final long serialVersionUID = 1519900285L;
2557
2558    /**
2559     * Constructor
2560     */
2561      public InsuranceComponent() {
2562        super();
2563      }
2564
2565    /**
2566     * Constructor
2567     */
2568      public InsuranceComponent(boolean focal, Reference coverage) {
2569        super();
2570        this.setFocal(focal);
2571        this.setCoverage(coverage);
2572      }
2573
2574        /**
2575         * @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
2576         */
2577        public BooleanType getFocalElement() { 
2578          if (this.focal == null)
2579            if (Configuration.errorOnAutoCreate())
2580              throw new Error("Attempt to auto-create InsuranceComponent.focal");
2581            else if (Configuration.doAutoCreate())
2582              this.focal = new BooleanType(); // bb
2583          return this.focal;
2584        }
2585
2586        public boolean hasFocalElement() { 
2587          return this.focal != null && !this.focal.isEmpty();
2588        }
2589
2590        public boolean hasFocal() { 
2591          return this.focal != null && !this.focal.isEmpty();
2592        }
2593
2594        /**
2595         * @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
2596         */
2597        public InsuranceComponent setFocalElement(BooleanType value) { 
2598          this.focal = value;
2599          return this;
2600        }
2601
2602        /**
2603         * @return A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2604         */
2605        public boolean getFocal() { 
2606          return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
2607        }
2608
2609        /**
2610         * @param value A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2611         */
2612        public InsuranceComponent setFocal(boolean value) { 
2613            if (this.focal == null)
2614              this.focal = new BooleanType();
2615            this.focal.setValue(value);
2616          return this;
2617        }
2618
2619        /**
2620         * @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.)
2621         */
2622        public Reference getCoverage() { 
2623          if (this.coverage == null)
2624            if (Configuration.errorOnAutoCreate())
2625              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2626            else if (Configuration.doAutoCreate())
2627              this.coverage = new Reference(); // cc
2628          return this.coverage;
2629        }
2630
2631        public boolean hasCoverage() { 
2632          return this.coverage != null && !this.coverage.isEmpty();
2633        }
2634
2635        /**
2636         * @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.)
2637         */
2638        public InsuranceComponent setCoverage(Reference value) { 
2639          this.coverage = value;
2640          return this;
2641        }
2642
2643        /**
2644         * @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.)
2645         */
2646        public List<StringType> getPreAuthRef() { 
2647          if (this.preAuthRef == null)
2648            this.preAuthRef = new ArrayList<StringType>();
2649          return this.preAuthRef;
2650        }
2651
2652        /**
2653         * @return Returns a reference to <code>this</code> for easy method chaining
2654         */
2655        public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) { 
2656          this.preAuthRef = thePreAuthRef;
2657          return this;
2658        }
2659
2660        public boolean hasPreAuthRef() { 
2661          if (this.preAuthRef == null)
2662            return false;
2663          for (StringType item : this.preAuthRef)
2664            if (!item.isEmpty())
2665              return true;
2666          return false;
2667        }
2668
2669        /**
2670         * @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.)
2671         */
2672        public StringType addPreAuthRefElement() {//2 
2673          StringType t = new StringType();
2674          if (this.preAuthRef == null)
2675            this.preAuthRef = new ArrayList<StringType>();
2676          this.preAuthRef.add(t);
2677          return t;
2678        }
2679
2680        /**
2681         * @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.)
2682         */
2683        public InsuranceComponent addPreAuthRef(String value) { //1
2684          StringType t = new StringType();
2685          t.setValue(value);
2686          if (this.preAuthRef == null)
2687            this.preAuthRef = new ArrayList<StringType>();
2688          this.preAuthRef.add(t);
2689          return this;
2690        }
2691
2692        /**
2693         * @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.)
2694         */
2695        public boolean hasPreAuthRef(String value) { 
2696          if (this.preAuthRef == null)
2697            return false;
2698          for (StringType v : this.preAuthRef)
2699            if (v.getValue().equals(value)) // string
2700              return true;
2701          return false;
2702        }
2703
2704        protected void listChildren(List<Property> children) {
2705          super.listChildren(children);
2706          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));
2707          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));
2708          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));
2709        }
2710
2711        @Override
2712        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2713          switch (_hash) {
2714          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);
2715          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);
2716          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);
2717          default: return super.getNamedProperty(_hash, _name, _checkValid);
2718          }
2719
2720        }
2721
2722      @Override
2723      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2724        switch (hash) {
2725        case 97604197: /*focal*/ return this.focal == null ? new Base[0] : new Base[] {this.focal}; // BooleanType
2726        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
2727        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
2728        default: return super.getProperty(hash, name, checkValid);
2729        }
2730
2731      }
2732
2733      @Override
2734      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2735        switch (hash) {
2736        case 97604197: // focal
2737          this.focal = TypeConvertor.castToBoolean(value); // BooleanType
2738          return value;
2739        case -351767064: // coverage
2740          this.coverage = TypeConvertor.castToReference(value); // Reference
2741          return value;
2742        case 522246568: // preAuthRef
2743          this.getPreAuthRef().add(TypeConvertor.castToString(value)); // StringType
2744          return value;
2745        default: return super.setProperty(hash, name, value);
2746        }
2747
2748      }
2749
2750      @Override
2751      public Base setProperty(String name, Base value) throws FHIRException {
2752        if (name.equals("focal")) {
2753          this.focal = TypeConvertor.castToBoolean(value); // BooleanType
2754        } else if (name.equals("coverage")) {
2755          this.coverage = TypeConvertor.castToReference(value); // Reference
2756        } else if (name.equals("preAuthRef")) {
2757          this.getPreAuthRef().add(TypeConvertor.castToString(value));
2758        } else
2759          return super.setProperty(name, value);
2760        return value;
2761      }
2762
2763      @Override
2764      public Base makeProperty(int hash, String name) throws FHIRException {
2765        switch (hash) {
2766        case 97604197:  return getFocalElement();
2767        case -351767064:  return getCoverage();
2768        case 522246568:  return addPreAuthRefElement();
2769        default: return super.makeProperty(hash, name);
2770        }
2771
2772      }
2773
2774      @Override
2775      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2776        switch (hash) {
2777        case 97604197: /*focal*/ return new String[] {"boolean"};
2778        case -351767064: /*coverage*/ return new String[] {"Reference"};
2779        case 522246568: /*preAuthRef*/ return new String[] {"string"};
2780        default: return super.getTypesForProperty(hash, name);
2781        }
2782
2783      }
2784
2785      @Override
2786      public Base addChild(String name) throws FHIRException {
2787        if (name.equals("focal")) {
2788          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.insurance.focal");
2789        }
2790        else if (name.equals("coverage")) {
2791          this.coverage = new Reference();
2792          return this.coverage;
2793        }
2794        else if (name.equals("preAuthRef")) {
2795          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.insurance.preAuthRef");
2796        }
2797        else
2798          return super.addChild(name);
2799      }
2800
2801      public InsuranceComponent copy() {
2802        InsuranceComponent dst = new InsuranceComponent();
2803        copyValues(dst);
2804        return dst;
2805      }
2806
2807      public void copyValues(InsuranceComponent dst) {
2808        super.copyValues(dst);
2809        dst.focal = focal == null ? null : focal.copy();
2810        dst.coverage = coverage == null ? null : coverage.copy();
2811        if (preAuthRef != null) {
2812          dst.preAuthRef = new ArrayList<StringType>();
2813          for (StringType i : preAuthRef)
2814            dst.preAuthRef.add(i.copy());
2815        };
2816      }
2817
2818      @Override
2819      public boolean equalsDeep(Base other_) {
2820        if (!super.equalsDeep(other_))
2821          return false;
2822        if (!(other_ instanceof InsuranceComponent))
2823          return false;
2824        InsuranceComponent o = (InsuranceComponent) other_;
2825        return compareDeep(focal, o.focal, true) && compareDeep(coverage, o.coverage, true) && compareDeep(preAuthRef, o.preAuthRef, true)
2826          ;
2827      }
2828
2829      @Override
2830      public boolean equalsShallow(Base other_) {
2831        if (!super.equalsShallow(other_))
2832          return false;
2833        if (!(other_ instanceof InsuranceComponent))
2834          return false;
2835        InsuranceComponent o = (InsuranceComponent) other_;
2836        return compareValues(focal, o.focal, true) && compareValues(preAuthRef, o.preAuthRef, true);
2837      }
2838
2839      public boolean isEmpty() {
2840        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(focal, coverage, preAuthRef
2841          );
2842      }
2843
2844  public String fhirType() {
2845    return "ExplanationOfBenefit.insurance";
2846
2847  }
2848
2849  }
2850
2851    @Block()
2852    public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
2853        /**
2854         * Date of an accident event  related to the products and services contained in the claim.
2855         */
2856        @Child(name = "date", type = {DateType.class}, order=1, min=0, max=1, modifier=false, summary=false)
2857        @Description(shortDefinition="When the incident occurred", formalDefinition="Date of an accident event  related to the products and services contained in the claim." )
2858        protected DateType date;
2859
2860        /**
2861         * The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.
2862         */
2863        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
2864        @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." )
2865        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActIncidentCode")
2866        protected CodeableConcept type;
2867
2868        /**
2869         * The physical location of the accident event.
2870         */
2871        @Child(name = "location", type = {Address.class, Location.class}, order=3, min=0, max=1, modifier=false, summary=false)
2872        @Description(shortDefinition="Where the event occurred", formalDefinition="The physical location of the accident event." )
2873        protected DataType location;
2874
2875        private static final long serialVersionUID = 11882722L;
2876
2877    /**
2878     * Constructor
2879     */
2880      public AccidentComponent() {
2881        super();
2882      }
2883
2884        /**
2885         * @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
2886         */
2887        public DateType getDateElement() { 
2888          if (this.date == null)
2889            if (Configuration.errorOnAutoCreate())
2890              throw new Error("Attempt to auto-create AccidentComponent.date");
2891            else if (Configuration.doAutoCreate())
2892              this.date = new DateType(); // bb
2893          return this.date;
2894        }
2895
2896        public boolean hasDateElement() { 
2897          return this.date != null && !this.date.isEmpty();
2898        }
2899
2900        public boolean hasDate() { 
2901          return this.date != null && !this.date.isEmpty();
2902        }
2903
2904        /**
2905         * @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
2906         */
2907        public AccidentComponent setDateElement(DateType value) { 
2908          this.date = value;
2909          return this;
2910        }
2911
2912        /**
2913         * @return Date of an accident event  related to the products and services contained in the claim.
2914         */
2915        public Date getDate() { 
2916          return this.date == null ? null : this.date.getValue();
2917        }
2918
2919        /**
2920         * @param value Date of an accident event  related to the products and services contained in the claim.
2921         */
2922        public AccidentComponent setDate(Date value) { 
2923          if (value == null)
2924            this.date = null;
2925          else {
2926            if (this.date == null)
2927              this.date = new DateType();
2928            this.date.setValue(value);
2929          }
2930          return this;
2931        }
2932
2933        /**
2934         * @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.)
2935         */
2936        public CodeableConcept getType() { 
2937          if (this.type == null)
2938            if (Configuration.errorOnAutoCreate())
2939              throw new Error("Attempt to auto-create AccidentComponent.type");
2940            else if (Configuration.doAutoCreate())
2941              this.type = new CodeableConcept(); // cc
2942          return this.type;
2943        }
2944
2945        public boolean hasType() { 
2946          return this.type != null && !this.type.isEmpty();
2947        }
2948
2949        /**
2950         * @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.)
2951         */
2952        public AccidentComponent setType(CodeableConcept value) { 
2953          this.type = value;
2954          return this;
2955        }
2956
2957        /**
2958         * @return {@link #location} (The physical location of the accident event.)
2959         */
2960        public DataType getLocation() { 
2961          return this.location;
2962        }
2963
2964        /**
2965         * @return {@link #location} (The physical location of the accident event.)
2966         */
2967        public Address getLocationAddress() throws FHIRException { 
2968          if (this.location == null)
2969            this.location = new Address();
2970          if (!(this.location instanceof Address))
2971            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
2972          return (Address) this.location;
2973        }
2974
2975        public boolean hasLocationAddress() { 
2976          return this != null && this.location instanceof Address;
2977        }
2978
2979        /**
2980         * @return {@link #location} (The physical location of the accident event.)
2981         */
2982        public Reference getLocationReference() throws FHIRException { 
2983          if (this.location == null)
2984            this.location = new Reference();
2985          if (!(this.location instanceof Reference))
2986            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
2987          return (Reference) this.location;
2988        }
2989
2990        public boolean hasLocationReference() { 
2991          return this != null && this.location instanceof Reference;
2992        }
2993
2994        public boolean hasLocation() { 
2995          return this.location != null && !this.location.isEmpty();
2996        }
2997
2998        /**
2999         * @param value {@link #location} (The physical location of the accident event.)
3000         */
3001        public AccidentComponent setLocation(DataType value) { 
3002          if (value != null && !(value instanceof Address || value instanceof Reference))
3003            throw new Error("Not the right type for ExplanationOfBenefit.accident.location[x]: "+value.fhirType());
3004          this.location = value;
3005          return this;
3006        }
3007
3008        protected void listChildren(List<Property> children) {
3009          super.listChildren(children);
3010          children.add(new Property("date", "date", "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date));
3011          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));
3012          children.add(new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location));
3013        }
3014
3015        @Override
3016        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3017          switch (_hash) {
3018          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);
3019          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);
3020          case 552316075: /*location[x]*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3021          case 1901043637: /*location*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3022          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address", "The physical location of the accident event.", 0, 1, location);
3023          case 755866390: /*locationReference*/  return new Property("location[x]", "Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3024          default: return super.getNamedProperty(_hash, _name, _checkValid);
3025          }
3026
3027        }
3028
3029      @Override
3030      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3031        switch (hash) {
3032        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
3033        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3034        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // DataType
3035        default: return super.getProperty(hash, name, checkValid);
3036        }
3037
3038      }
3039
3040      @Override
3041      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3042        switch (hash) {
3043        case 3076014: // date
3044          this.date = TypeConvertor.castToDate(value); // DateType
3045          return value;
3046        case 3575610: // type
3047          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3048          return value;
3049        case 1901043637: // location
3050          this.location = TypeConvertor.castToType(value); // DataType
3051          return value;
3052        default: return super.setProperty(hash, name, value);
3053        }
3054
3055      }
3056
3057      @Override
3058      public Base setProperty(String name, Base value) throws FHIRException {
3059        if (name.equals("date")) {
3060          this.date = TypeConvertor.castToDate(value); // DateType
3061        } else if (name.equals("type")) {
3062          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3063        } else if (name.equals("location[x]")) {
3064          this.location = TypeConvertor.castToType(value); // DataType
3065        } else
3066          return super.setProperty(name, value);
3067        return value;
3068      }
3069
3070      @Override
3071      public Base makeProperty(int hash, String name) throws FHIRException {
3072        switch (hash) {
3073        case 3076014:  return getDateElement();
3074        case 3575610:  return getType();
3075        case 552316075:  return getLocation();
3076        case 1901043637:  return getLocation();
3077        default: return super.makeProperty(hash, name);
3078        }
3079
3080      }
3081
3082      @Override
3083      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3084        switch (hash) {
3085        case 3076014: /*date*/ return new String[] {"date"};
3086        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3087        case 1901043637: /*location*/ return new String[] {"Address", "Reference"};
3088        default: return super.getTypesForProperty(hash, name);
3089        }
3090
3091      }
3092
3093      @Override
3094      public Base addChild(String name) throws FHIRException {
3095        if (name.equals("date")) {
3096          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.accident.date");
3097        }
3098        else if (name.equals("type")) {
3099          this.type = new CodeableConcept();
3100          return this.type;
3101        }
3102        else if (name.equals("locationAddress")) {
3103          this.location = new Address();
3104          return this.location;
3105        }
3106        else if (name.equals("locationReference")) {
3107          this.location = new Reference();
3108          return this.location;
3109        }
3110        else
3111          return super.addChild(name);
3112      }
3113
3114      public AccidentComponent copy() {
3115        AccidentComponent dst = new AccidentComponent();
3116        copyValues(dst);
3117        return dst;
3118      }
3119
3120      public void copyValues(AccidentComponent dst) {
3121        super.copyValues(dst);
3122        dst.date = date == null ? null : date.copy();
3123        dst.type = type == null ? null : type.copy();
3124        dst.location = location == null ? null : location.copy();
3125      }
3126
3127      @Override
3128      public boolean equalsDeep(Base other_) {
3129        if (!super.equalsDeep(other_))
3130          return false;
3131        if (!(other_ instanceof AccidentComponent))
3132          return false;
3133        AccidentComponent o = (AccidentComponent) other_;
3134        return compareDeep(date, o.date, true) && compareDeep(type, o.type, true) && compareDeep(location, o.location, true)
3135          ;
3136      }
3137
3138      @Override
3139      public boolean equalsShallow(Base other_) {
3140        if (!super.equalsShallow(other_))
3141          return false;
3142        if (!(other_ instanceof AccidentComponent))
3143          return false;
3144        AccidentComponent o = (AccidentComponent) other_;
3145        return compareValues(date, o.date, true);
3146      }
3147
3148      public boolean isEmpty() {
3149        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
3150      }
3151
3152  public String fhirType() {
3153    return "ExplanationOfBenefit.accident";
3154
3155  }
3156
3157  }
3158
3159    @Block()
3160    public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
3161        /**
3162         * A number to uniquely identify item entries.
3163         */
3164        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
3165        @Description(shortDefinition="Item instance identifier", formalDefinition="A number to uniquely identify item entries." )
3166        protected PositiveIntType sequence;
3167
3168        /**
3169         * Care team members related to this service or product.
3170         */
3171        @Child(name = "careTeamSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3172        @Description(shortDefinition="Applicable care team members", formalDefinition="Care team members related to this service or product." )
3173        protected List<PositiveIntType> careTeamSequence;
3174
3175        /**
3176         * Diagnoses applicable for this service or product.
3177         */
3178        @Child(name = "diagnosisSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3179        @Description(shortDefinition="Applicable diagnoses", formalDefinition="Diagnoses applicable for this service or product." )
3180        protected List<PositiveIntType> diagnosisSequence;
3181
3182        /**
3183         * Procedures applicable for this service or product.
3184         */
3185        @Child(name = "procedureSequence", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3186        @Description(shortDefinition="Applicable procedures", formalDefinition="Procedures applicable for this service or product." )
3187        protected List<PositiveIntType> procedureSequence;
3188
3189        /**
3190         * Exceptions, special conditions and supporting information applicable for this service or product.
3191         */
3192        @Child(name = "informationSequence", type = {PositiveIntType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3193        @Description(shortDefinition="Applicable exception and supporting information", formalDefinition="Exceptions, special conditions and supporting information applicable for this service or product." )
3194        protected List<PositiveIntType> informationSequence;
3195
3196        /**
3197         * The type of revenue or cost center providing the product and/or service.
3198         */
3199        @Child(name = "revenue", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
3200        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
3201        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
3202        protected CodeableConcept revenue;
3203
3204        /**
3205         * Code to identify the general type of benefits under which products and services are provided.
3206         */
3207        @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
3208        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
3209        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
3210        protected CodeableConcept category;
3211
3212        /**
3213         * 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.
3214         */
3215        @Child(name = "productOrService", type = {CodeableConcept.class}, order=8, min=1, max=1, modifier=false, summary=false)
3216        @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." )
3217        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
3218        protected CodeableConcept productOrService;
3219
3220        /**
3221         * Item typification or modifiers codes to convey additional context for the product or service.
3222         */
3223        @Child(name = "modifier", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3224        @Description(shortDefinition="Product or service billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
3225        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
3226        protected List<CodeableConcept> modifier;
3227
3228        /**
3229         * Identifies the program under which this may be recovered.
3230         */
3231        @Child(name = "programCode", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3232        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
3233        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
3234        protected List<CodeableConcept> programCode;
3235
3236        /**
3237         * The date or dates when the service or product was supplied, performed or completed.
3238         */
3239        @Child(name = "serviced", type = {DateType.class, Period.class}, order=11, min=0, max=1, modifier=false, summary=false)
3240        @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." )
3241        protected DataType serviced;
3242
3243        /**
3244         * Where the product or service was provided.
3245         */
3246        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
3247        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
3248        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
3249        protected DataType location;
3250
3251        /**
3252         * The number of repetitions of a service or product.
3253         */
3254        @Child(name = "quantity", type = {Quantity.class}, order=13, min=0, max=1, modifier=false, summary=false)
3255        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
3256        protected Quantity quantity;
3257
3258        /**
3259         * 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.
3260         */
3261        @Child(name = "unitPrice", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
3262        @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." )
3263        protected Money unitPrice;
3264
3265        /**
3266         * 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.
3267         */
3268        @Child(name = "factor", type = {DecimalType.class}, order=15, min=0, max=1, modifier=false, summary=false)
3269        @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." )
3270        protected DecimalType factor;
3271
3272        /**
3273         * The quantity times the unit price for an additional service or product or charge.
3274         */
3275        @Child(name = "net", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=false)
3276        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
3277        protected Money net;
3278
3279        /**
3280         * Unique Device Identifiers associated with this line item.
3281         */
3282        @Child(name = "udi", type = {Device.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3283        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
3284        protected List<Reference> udi;
3285
3286        /**
3287         * Physical service site on the patient (limb, tooth, etc.).
3288         */
3289        @Child(name = "bodySite", type = {CodeableConcept.class}, order=18, min=0, max=1, modifier=false, summary=false)
3290        @Description(shortDefinition="Anatomical location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
3291        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
3292        protected CodeableConcept bodySite;
3293
3294        /**
3295         * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
3296         */
3297        @Child(name = "subSite", type = {CodeableConcept.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3298        @Description(shortDefinition="Anatomical sub-location", formalDefinition="A region or surface of the bodySite, e.g. limb region or tooth surface(s)." )
3299        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
3300        protected List<CodeableConcept> subSite;
3301
3302        /**
3303         * A billed item may include goods or services provided in multiple encounters.
3304         */
3305        @Child(name = "encounter", type = {Encounter.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3306        @Description(shortDefinition="Encounters related to this billed item", formalDefinition="A billed item may include goods or services provided in multiple encounters." )
3307        protected List<Reference> encounter;
3308
3309        /**
3310         * The numbers associated with notes below which apply to the adjudication of this item.
3311         */
3312        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3313        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
3314        protected List<PositiveIntType> noteNumber;
3315
3316        /**
3317         * 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.
3318         */
3319        @Child(name = "adjudication", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3320        @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." )
3321        protected List<AdjudicationComponent> adjudication;
3322
3323        /**
3324         * Second-tier of goods and services.
3325         */
3326        @Child(name = "detail", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3327        @Description(shortDefinition="Additional items", formalDefinition="Second-tier of goods and services." )
3328        protected List<DetailComponent> detail;
3329
3330        private static final long serialVersionUID = -1350957145L;
3331
3332    /**
3333     * Constructor
3334     */
3335      public ItemComponent() {
3336        super();
3337      }
3338
3339    /**
3340     * Constructor
3341     */
3342      public ItemComponent(int sequence, CodeableConcept productOrService) {
3343        super();
3344        this.setSequence(sequence);
3345        this.setProductOrService(productOrService);
3346      }
3347
3348        /**
3349         * @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
3350         */
3351        public PositiveIntType getSequenceElement() { 
3352          if (this.sequence == null)
3353            if (Configuration.errorOnAutoCreate())
3354              throw new Error("Attempt to auto-create ItemComponent.sequence");
3355            else if (Configuration.doAutoCreate())
3356              this.sequence = new PositiveIntType(); // bb
3357          return this.sequence;
3358        }
3359
3360        public boolean hasSequenceElement() { 
3361          return this.sequence != null && !this.sequence.isEmpty();
3362        }
3363
3364        public boolean hasSequence() { 
3365          return this.sequence != null && !this.sequence.isEmpty();
3366        }
3367
3368        /**
3369         * @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
3370         */
3371        public ItemComponent setSequenceElement(PositiveIntType value) { 
3372          this.sequence = value;
3373          return this;
3374        }
3375
3376        /**
3377         * @return A number to uniquely identify item entries.
3378         */
3379        public int getSequence() { 
3380          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3381        }
3382
3383        /**
3384         * @param value A number to uniquely identify item entries.
3385         */
3386        public ItemComponent setSequence(int value) { 
3387            if (this.sequence == null)
3388              this.sequence = new PositiveIntType();
3389            this.sequence.setValue(value);
3390          return this;
3391        }
3392
3393        /**
3394         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3395         */
3396        public List<PositiveIntType> getCareTeamSequence() { 
3397          if (this.careTeamSequence == null)
3398            this.careTeamSequence = new ArrayList<PositiveIntType>();
3399          return this.careTeamSequence;
3400        }
3401
3402        /**
3403         * @return Returns a reference to <code>this</code> for easy method chaining
3404         */
3405        public ItemComponent setCareTeamSequence(List<PositiveIntType> theCareTeamSequence) { 
3406          this.careTeamSequence = theCareTeamSequence;
3407          return this;
3408        }
3409
3410        public boolean hasCareTeamSequence() { 
3411          if (this.careTeamSequence == null)
3412            return false;
3413          for (PositiveIntType item : this.careTeamSequence)
3414            if (!item.isEmpty())
3415              return true;
3416          return false;
3417        }
3418
3419        /**
3420         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3421         */
3422        public PositiveIntType addCareTeamSequenceElement() {//2 
3423          PositiveIntType t = new PositiveIntType();
3424          if (this.careTeamSequence == null)
3425            this.careTeamSequence = new ArrayList<PositiveIntType>();
3426          this.careTeamSequence.add(t);
3427          return t;
3428        }
3429
3430        /**
3431         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3432         */
3433        public ItemComponent addCareTeamSequence(int value) { //1
3434          PositiveIntType t = new PositiveIntType();
3435          t.setValue(value);
3436          if (this.careTeamSequence == null)
3437            this.careTeamSequence = new ArrayList<PositiveIntType>();
3438          this.careTeamSequence.add(t);
3439          return this;
3440        }
3441
3442        /**
3443         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3444         */
3445        public boolean hasCareTeamSequence(int value) { 
3446          if (this.careTeamSequence == null)
3447            return false;
3448          for (PositiveIntType v : this.careTeamSequence)
3449            if (v.getValue().equals(value)) // positiveInt
3450              return true;
3451          return false;
3452        }
3453
3454        /**
3455         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3456         */
3457        public List<PositiveIntType> getDiagnosisSequence() { 
3458          if (this.diagnosisSequence == null)
3459            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3460          return this.diagnosisSequence;
3461        }
3462
3463        /**
3464         * @return Returns a reference to <code>this</code> for easy method chaining
3465         */
3466        public ItemComponent setDiagnosisSequence(List<PositiveIntType> theDiagnosisSequence) { 
3467          this.diagnosisSequence = theDiagnosisSequence;
3468          return this;
3469        }
3470
3471        public boolean hasDiagnosisSequence() { 
3472          if (this.diagnosisSequence == null)
3473            return false;
3474          for (PositiveIntType item : this.diagnosisSequence)
3475            if (!item.isEmpty())
3476              return true;
3477          return false;
3478        }
3479
3480        /**
3481         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3482         */
3483        public PositiveIntType addDiagnosisSequenceElement() {//2 
3484          PositiveIntType t = new PositiveIntType();
3485          if (this.diagnosisSequence == null)
3486            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3487          this.diagnosisSequence.add(t);
3488          return t;
3489        }
3490
3491        /**
3492         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3493         */
3494        public ItemComponent addDiagnosisSequence(int value) { //1
3495          PositiveIntType t = new PositiveIntType();
3496          t.setValue(value);
3497          if (this.diagnosisSequence == null)
3498            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3499          this.diagnosisSequence.add(t);
3500          return this;
3501        }
3502
3503        /**
3504         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3505         */
3506        public boolean hasDiagnosisSequence(int value) { 
3507          if (this.diagnosisSequence == null)
3508            return false;
3509          for (PositiveIntType v : this.diagnosisSequence)
3510            if (v.getValue().equals(value)) // positiveInt
3511              return true;
3512          return false;
3513        }
3514
3515        /**
3516         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3517         */
3518        public List<PositiveIntType> getProcedureSequence() { 
3519          if (this.procedureSequence == null)
3520            this.procedureSequence = new ArrayList<PositiveIntType>();
3521          return this.procedureSequence;
3522        }
3523
3524        /**
3525         * @return Returns a reference to <code>this</code> for easy method chaining
3526         */
3527        public ItemComponent setProcedureSequence(List<PositiveIntType> theProcedureSequence) { 
3528          this.procedureSequence = theProcedureSequence;
3529          return this;
3530        }
3531
3532        public boolean hasProcedureSequence() { 
3533          if (this.procedureSequence == null)
3534            return false;
3535          for (PositiveIntType item : this.procedureSequence)
3536            if (!item.isEmpty())
3537              return true;
3538          return false;
3539        }
3540
3541        /**
3542         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3543         */
3544        public PositiveIntType addProcedureSequenceElement() {//2 
3545          PositiveIntType t = new PositiveIntType();
3546          if (this.procedureSequence == null)
3547            this.procedureSequence = new ArrayList<PositiveIntType>();
3548          this.procedureSequence.add(t);
3549          return t;
3550        }
3551
3552        /**
3553         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3554         */
3555        public ItemComponent addProcedureSequence(int value) { //1
3556          PositiveIntType t = new PositiveIntType();
3557          t.setValue(value);
3558          if (this.procedureSequence == null)
3559            this.procedureSequence = new ArrayList<PositiveIntType>();
3560          this.procedureSequence.add(t);
3561          return this;
3562        }
3563
3564        /**
3565         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3566         */
3567        public boolean hasProcedureSequence(int value) { 
3568          if (this.procedureSequence == null)
3569            return false;
3570          for (PositiveIntType v : this.procedureSequence)
3571            if (v.getValue().equals(value)) // positiveInt
3572              return true;
3573          return false;
3574        }
3575
3576        /**
3577         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3578         */
3579        public List<PositiveIntType> getInformationSequence() { 
3580          if (this.informationSequence == null)
3581            this.informationSequence = new ArrayList<PositiveIntType>();
3582          return this.informationSequence;
3583        }
3584
3585        /**
3586         * @return Returns a reference to <code>this</code> for easy method chaining
3587         */
3588        public ItemComponent setInformationSequence(List<PositiveIntType> theInformationSequence) { 
3589          this.informationSequence = theInformationSequence;
3590          return this;
3591        }
3592
3593        public boolean hasInformationSequence() { 
3594          if (this.informationSequence == null)
3595            return false;
3596          for (PositiveIntType item : this.informationSequence)
3597            if (!item.isEmpty())
3598              return true;
3599          return false;
3600        }
3601
3602        /**
3603         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3604         */
3605        public PositiveIntType addInformationSequenceElement() {//2 
3606          PositiveIntType t = new PositiveIntType();
3607          if (this.informationSequence == null)
3608            this.informationSequence = new ArrayList<PositiveIntType>();
3609          this.informationSequence.add(t);
3610          return t;
3611        }
3612
3613        /**
3614         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3615         */
3616        public ItemComponent addInformationSequence(int value) { //1
3617          PositiveIntType t = new PositiveIntType();
3618          t.setValue(value);
3619          if (this.informationSequence == null)
3620            this.informationSequence = new ArrayList<PositiveIntType>();
3621          this.informationSequence.add(t);
3622          return this;
3623        }
3624
3625        /**
3626         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3627         */
3628        public boolean hasInformationSequence(int value) { 
3629          if (this.informationSequence == null)
3630            return false;
3631          for (PositiveIntType v : this.informationSequence)
3632            if (v.getValue().equals(value)) // positiveInt
3633              return true;
3634          return false;
3635        }
3636
3637        /**
3638         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3639         */
3640        public CodeableConcept getRevenue() { 
3641          if (this.revenue == null)
3642            if (Configuration.errorOnAutoCreate())
3643              throw new Error("Attempt to auto-create ItemComponent.revenue");
3644            else if (Configuration.doAutoCreate())
3645              this.revenue = new CodeableConcept(); // cc
3646          return this.revenue;
3647        }
3648
3649        public boolean hasRevenue() { 
3650          return this.revenue != null && !this.revenue.isEmpty();
3651        }
3652
3653        /**
3654         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3655         */
3656        public ItemComponent setRevenue(CodeableConcept value) { 
3657          this.revenue = value;
3658          return this;
3659        }
3660
3661        /**
3662         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
3663         */
3664        public CodeableConcept getCategory() { 
3665          if (this.category == null)
3666            if (Configuration.errorOnAutoCreate())
3667              throw new Error("Attempt to auto-create ItemComponent.category");
3668            else if (Configuration.doAutoCreate())
3669              this.category = new CodeableConcept(); // cc
3670          return this.category;
3671        }
3672
3673        public boolean hasCategory() { 
3674          return this.category != null && !this.category.isEmpty();
3675        }
3676
3677        /**
3678         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
3679         */
3680        public ItemComponent setCategory(CodeableConcept value) { 
3681          this.category = value;
3682          return this;
3683        }
3684
3685        /**
3686         * @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.)
3687         */
3688        public CodeableConcept getProductOrService() { 
3689          if (this.productOrService == null)
3690            if (Configuration.errorOnAutoCreate())
3691              throw new Error("Attempt to auto-create ItemComponent.productOrService");
3692            else if (Configuration.doAutoCreate())
3693              this.productOrService = new CodeableConcept(); // cc
3694          return this.productOrService;
3695        }
3696
3697        public boolean hasProductOrService() { 
3698          return this.productOrService != null && !this.productOrService.isEmpty();
3699        }
3700
3701        /**
3702         * @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.)
3703         */
3704        public ItemComponent setProductOrService(CodeableConcept value) { 
3705          this.productOrService = value;
3706          return this;
3707        }
3708
3709        /**
3710         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
3711         */
3712        public List<CodeableConcept> getModifier() { 
3713          if (this.modifier == null)
3714            this.modifier = new ArrayList<CodeableConcept>();
3715          return this.modifier;
3716        }
3717
3718        /**
3719         * @return Returns a reference to <code>this</code> for easy method chaining
3720         */
3721        public ItemComponent setModifier(List<CodeableConcept> theModifier) { 
3722          this.modifier = theModifier;
3723          return this;
3724        }
3725
3726        public boolean hasModifier() { 
3727          if (this.modifier == null)
3728            return false;
3729          for (CodeableConcept item : this.modifier)
3730            if (!item.isEmpty())
3731              return true;
3732          return false;
3733        }
3734
3735        public CodeableConcept addModifier() { //3
3736          CodeableConcept t = new CodeableConcept();
3737          if (this.modifier == null)
3738            this.modifier = new ArrayList<CodeableConcept>();
3739          this.modifier.add(t);
3740          return t;
3741        }
3742
3743        public ItemComponent addModifier(CodeableConcept t) { //3
3744          if (t == null)
3745            return this;
3746          if (this.modifier == null)
3747            this.modifier = new ArrayList<CodeableConcept>();
3748          this.modifier.add(t);
3749          return this;
3750        }
3751
3752        /**
3753         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
3754         */
3755        public CodeableConcept getModifierFirstRep() { 
3756          if (getModifier().isEmpty()) {
3757            addModifier();
3758          }
3759          return getModifier().get(0);
3760        }
3761
3762        /**
3763         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
3764         */
3765        public List<CodeableConcept> getProgramCode() { 
3766          if (this.programCode == null)
3767            this.programCode = new ArrayList<CodeableConcept>();
3768          return this.programCode;
3769        }
3770
3771        /**
3772         * @return Returns a reference to <code>this</code> for easy method chaining
3773         */
3774        public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
3775          this.programCode = theProgramCode;
3776          return this;
3777        }
3778
3779        public boolean hasProgramCode() { 
3780          if (this.programCode == null)
3781            return false;
3782          for (CodeableConcept item : this.programCode)
3783            if (!item.isEmpty())
3784              return true;
3785          return false;
3786        }
3787
3788        public CodeableConcept addProgramCode() { //3
3789          CodeableConcept t = new CodeableConcept();
3790          if (this.programCode == null)
3791            this.programCode = new ArrayList<CodeableConcept>();
3792          this.programCode.add(t);
3793          return t;
3794        }
3795
3796        public ItemComponent addProgramCode(CodeableConcept t) { //3
3797          if (t == null)
3798            return this;
3799          if (this.programCode == null)
3800            this.programCode = new ArrayList<CodeableConcept>();
3801          this.programCode.add(t);
3802          return this;
3803        }
3804
3805        /**
3806         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
3807         */
3808        public CodeableConcept getProgramCodeFirstRep() { 
3809          if (getProgramCode().isEmpty()) {
3810            addProgramCode();
3811          }
3812          return getProgramCode().get(0);
3813        }
3814
3815        /**
3816         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3817         */
3818        public DataType getServiced() { 
3819          return this.serviced;
3820        }
3821
3822        /**
3823         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3824         */
3825        public DateType getServicedDateType() throws FHIRException { 
3826          if (this.serviced == null)
3827            this.serviced = new DateType();
3828          if (!(this.serviced instanceof DateType))
3829            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
3830          return (DateType) this.serviced;
3831        }
3832
3833        public boolean hasServicedDateType() { 
3834          return this != null && this.serviced instanceof DateType;
3835        }
3836
3837        /**
3838         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3839         */
3840        public Period getServicedPeriod() throws FHIRException { 
3841          if (this.serviced == null)
3842            this.serviced = new Period();
3843          if (!(this.serviced instanceof Period))
3844            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
3845          return (Period) this.serviced;
3846        }
3847
3848        public boolean hasServicedPeriod() { 
3849          return this != null && this.serviced instanceof Period;
3850        }
3851
3852        public boolean hasServiced() { 
3853          return this.serviced != null && !this.serviced.isEmpty();
3854        }
3855
3856        /**
3857         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3858         */
3859        public ItemComponent setServiced(DataType value) { 
3860          if (value != null && !(value instanceof DateType || value instanceof Period))
3861            throw new Error("Not the right type for ExplanationOfBenefit.item.serviced[x]: "+value.fhirType());
3862          this.serviced = value;
3863          return this;
3864        }
3865
3866        /**
3867         * @return {@link #location} (Where the product or service was provided.)
3868         */
3869        public DataType getLocation() { 
3870          return this.location;
3871        }
3872
3873        /**
3874         * @return {@link #location} (Where the product or service was provided.)
3875         */
3876        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
3877          if (this.location == null)
3878            this.location = new CodeableConcept();
3879          if (!(this.location instanceof CodeableConcept))
3880            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
3881          return (CodeableConcept) this.location;
3882        }
3883
3884        public boolean hasLocationCodeableConcept() { 
3885          return this != null && this.location instanceof CodeableConcept;
3886        }
3887
3888        /**
3889         * @return {@link #location} (Where the product or service was provided.)
3890         */
3891        public Address getLocationAddress() throws FHIRException { 
3892          if (this.location == null)
3893            this.location = new Address();
3894          if (!(this.location instanceof Address))
3895            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
3896          return (Address) this.location;
3897        }
3898
3899        public boolean hasLocationAddress() { 
3900          return this != null && this.location instanceof Address;
3901        }
3902
3903        /**
3904         * @return {@link #location} (Where the product or service was provided.)
3905         */
3906        public Reference getLocationReference() throws FHIRException { 
3907          if (this.location == null)
3908            this.location = new Reference();
3909          if (!(this.location instanceof Reference))
3910            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
3911          return (Reference) this.location;
3912        }
3913
3914        public boolean hasLocationReference() { 
3915          return this != null && this.location instanceof Reference;
3916        }
3917
3918        public boolean hasLocation() { 
3919          return this.location != null && !this.location.isEmpty();
3920        }
3921
3922        /**
3923         * @param value {@link #location} (Where the product or service was provided.)
3924         */
3925        public ItemComponent setLocation(DataType value) { 
3926          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
3927            throw new Error("Not the right type for ExplanationOfBenefit.item.location[x]: "+value.fhirType());
3928          this.location = value;
3929          return this;
3930        }
3931
3932        /**
3933         * @return {@link #quantity} (The number of repetitions of a service or product.)
3934         */
3935        public Quantity getQuantity() { 
3936          if (this.quantity == null)
3937            if (Configuration.errorOnAutoCreate())
3938              throw new Error("Attempt to auto-create ItemComponent.quantity");
3939            else if (Configuration.doAutoCreate())
3940              this.quantity = new Quantity(); // cc
3941          return this.quantity;
3942        }
3943
3944        public boolean hasQuantity() { 
3945          return this.quantity != null && !this.quantity.isEmpty();
3946        }
3947
3948        /**
3949         * @param value {@link #quantity} (The number of repetitions of a service or product.)
3950         */
3951        public ItemComponent setQuantity(Quantity value) { 
3952          this.quantity = value;
3953          return this;
3954        }
3955
3956        /**
3957         * @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.)
3958         */
3959        public Money getUnitPrice() { 
3960          if (this.unitPrice == null)
3961            if (Configuration.errorOnAutoCreate())
3962              throw new Error("Attempt to auto-create ItemComponent.unitPrice");
3963            else if (Configuration.doAutoCreate())
3964              this.unitPrice = new Money(); // cc
3965          return this.unitPrice;
3966        }
3967
3968        public boolean hasUnitPrice() { 
3969          return this.unitPrice != null && !this.unitPrice.isEmpty();
3970        }
3971
3972        /**
3973         * @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.)
3974         */
3975        public ItemComponent setUnitPrice(Money value) { 
3976          this.unitPrice = value;
3977          return this;
3978        }
3979
3980        /**
3981         * @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
3982         */
3983        public DecimalType getFactorElement() { 
3984          if (this.factor == null)
3985            if (Configuration.errorOnAutoCreate())
3986              throw new Error("Attempt to auto-create ItemComponent.factor");
3987            else if (Configuration.doAutoCreate())
3988              this.factor = new DecimalType(); // bb
3989          return this.factor;
3990        }
3991
3992        public boolean hasFactorElement() { 
3993          return this.factor != null && !this.factor.isEmpty();
3994        }
3995
3996        public boolean hasFactor() { 
3997          return this.factor != null && !this.factor.isEmpty();
3998        }
3999
4000        /**
4001         * @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
4002         */
4003        public ItemComponent setFactorElement(DecimalType value) { 
4004          this.factor = value;
4005          return this;
4006        }
4007
4008        /**
4009         * @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.
4010         */
4011        public BigDecimal getFactor() { 
4012          return this.factor == null ? null : this.factor.getValue();
4013        }
4014
4015        /**
4016         * @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.
4017         */
4018        public ItemComponent setFactor(BigDecimal value) { 
4019          if (value == null)
4020            this.factor = null;
4021          else {
4022            if (this.factor == null)
4023              this.factor = new DecimalType();
4024            this.factor.setValue(value);
4025          }
4026          return this;
4027        }
4028
4029        /**
4030         * @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.
4031         */
4032        public ItemComponent setFactor(long value) { 
4033              this.factor = new DecimalType();
4034            this.factor.setValue(value);
4035          return this;
4036        }
4037
4038        /**
4039         * @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.
4040         */
4041        public ItemComponent setFactor(double value) { 
4042              this.factor = new DecimalType();
4043            this.factor.setValue(value);
4044          return this;
4045        }
4046
4047        /**
4048         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4049         */
4050        public Money getNet() { 
4051          if (this.net == null)
4052            if (Configuration.errorOnAutoCreate())
4053              throw new Error("Attempt to auto-create ItemComponent.net");
4054            else if (Configuration.doAutoCreate())
4055              this.net = new Money(); // cc
4056          return this.net;
4057        }
4058
4059        public boolean hasNet() { 
4060          return this.net != null && !this.net.isEmpty();
4061        }
4062
4063        /**
4064         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4065         */
4066        public ItemComponent setNet(Money value) { 
4067          this.net = value;
4068          return this;
4069        }
4070
4071        /**
4072         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
4073         */
4074        public List<Reference> getUdi() { 
4075          if (this.udi == null)
4076            this.udi = new ArrayList<Reference>();
4077          return this.udi;
4078        }
4079
4080        /**
4081         * @return Returns a reference to <code>this</code> for easy method chaining
4082         */
4083        public ItemComponent setUdi(List<Reference> theUdi) { 
4084          this.udi = theUdi;
4085          return this;
4086        }
4087
4088        public boolean hasUdi() { 
4089          if (this.udi == null)
4090            return false;
4091          for (Reference item : this.udi)
4092            if (!item.isEmpty())
4093              return true;
4094          return false;
4095        }
4096
4097        public Reference addUdi() { //3
4098          Reference t = new Reference();
4099          if (this.udi == null)
4100            this.udi = new ArrayList<Reference>();
4101          this.udi.add(t);
4102          return t;
4103        }
4104
4105        public ItemComponent addUdi(Reference t) { //3
4106          if (t == null)
4107            return this;
4108          if (this.udi == null)
4109            this.udi = new ArrayList<Reference>();
4110          this.udi.add(t);
4111          return this;
4112        }
4113
4114        /**
4115         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
4116         */
4117        public Reference getUdiFirstRep() { 
4118          if (getUdi().isEmpty()) {
4119            addUdi();
4120          }
4121          return getUdi().get(0);
4122        }
4123
4124        /**
4125         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4126         */
4127        public CodeableConcept getBodySite() { 
4128          if (this.bodySite == null)
4129            if (Configuration.errorOnAutoCreate())
4130              throw new Error("Attempt to auto-create ItemComponent.bodySite");
4131            else if (Configuration.doAutoCreate())
4132              this.bodySite = new CodeableConcept(); // cc
4133          return this.bodySite;
4134        }
4135
4136        public boolean hasBodySite() { 
4137          return this.bodySite != null && !this.bodySite.isEmpty();
4138        }
4139
4140        /**
4141         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4142         */
4143        public ItemComponent setBodySite(CodeableConcept value) { 
4144          this.bodySite = value;
4145          return this;
4146        }
4147
4148        /**
4149         * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb region or tooth surface(s).)
4150         */
4151        public List<CodeableConcept> getSubSite() { 
4152          if (this.subSite == null)
4153            this.subSite = new ArrayList<CodeableConcept>();
4154          return this.subSite;
4155        }
4156
4157        /**
4158         * @return Returns a reference to <code>this</code> for easy method chaining
4159         */
4160        public ItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
4161          this.subSite = theSubSite;
4162          return this;
4163        }
4164
4165        public boolean hasSubSite() { 
4166          if (this.subSite == null)
4167            return false;
4168          for (CodeableConcept item : this.subSite)
4169            if (!item.isEmpty())
4170              return true;
4171          return false;
4172        }
4173
4174        public CodeableConcept addSubSite() { //3
4175          CodeableConcept t = new CodeableConcept();
4176          if (this.subSite == null)
4177            this.subSite = new ArrayList<CodeableConcept>();
4178          this.subSite.add(t);
4179          return t;
4180        }
4181
4182        public ItemComponent addSubSite(CodeableConcept t) { //3
4183          if (t == null)
4184            return this;
4185          if (this.subSite == null)
4186            this.subSite = new ArrayList<CodeableConcept>();
4187          this.subSite.add(t);
4188          return this;
4189        }
4190
4191        /**
4192         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist {3}
4193         */
4194        public CodeableConcept getSubSiteFirstRep() { 
4195          if (getSubSite().isEmpty()) {
4196            addSubSite();
4197          }
4198          return getSubSite().get(0);
4199        }
4200
4201        /**
4202         * @return {@link #encounter} (A billed item may include goods or services provided in multiple encounters.)
4203         */
4204        public List<Reference> getEncounter() { 
4205          if (this.encounter == null)
4206            this.encounter = new ArrayList<Reference>();
4207          return this.encounter;
4208        }
4209
4210        /**
4211         * @return Returns a reference to <code>this</code> for easy method chaining
4212         */
4213        public ItemComponent setEncounter(List<Reference> theEncounter) { 
4214          this.encounter = theEncounter;
4215          return this;
4216        }
4217
4218        public boolean hasEncounter() { 
4219          if (this.encounter == null)
4220            return false;
4221          for (Reference item : this.encounter)
4222            if (!item.isEmpty())
4223              return true;
4224          return false;
4225        }
4226
4227        public Reference addEncounter() { //3
4228          Reference t = new Reference();
4229          if (this.encounter == null)
4230            this.encounter = new ArrayList<Reference>();
4231          this.encounter.add(t);
4232          return t;
4233        }
4234
4235        public ItemComponent addEncounter(Reference t) { //3
4236          if (t == null)
4237            return this;
4238          if (this.encounter == null)
4239            this.encounter = new ArrayList<Reference>();
4240          this.encounter.add(t);
4241          return this;
4242        }
4243
4244        /**
4245         * @return The first repetition of repeating field {@link #encounter}, creating it if it does not already exist {3}
4246         */
4247        public Reference getEncounterFirstRep() { 
4248          if (getEncounter().isEmpty()) {
4249            addEncounter();
4250          }
4251          return getEncounter().get(0);
4252        }
4253
4254        /**
4255         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4256         */
4257        public List<PositiveIntType> getNoteNumber() { 
4258          if (this.noteNumber == null)
4259            this.noteNumber = new ArrayList<PositiveIntType>();
4260          return this.noteNumber;
4261        }
4262
4263        /**
4264         * @return Returns a reference to <code>this</code> for easy method chaining
4265         */
4266        public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
4267          this.noteNumber = theNoteNumber;
4268          return this;
4269        }
4270
4271        public boolean hasNoteNumber() { 
4272          if (this.noteNumber == null)
4273            return false;
4274          for (PositiveIntType item : this.noteNumber)
4275            if (!item.isEmpty())
4276              return true;
4277          return false;
4278        }
4279
4280        /**
4281         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4282         */
4283        public PositiveIntType addNoteNumberElement() {//2 
4284          PositiveIntType t = new PositiveIntType();
4285          if (this.noteNumber == null)
4286            this.noteNumber = new ArrayList<PositiveIntType>();
4287          this.noteNumber.add(t);
4288          return t;
4289        }
4290
4291        /**
4292         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4293         */
4294        public ItemComponent addNoteNumber(int value) { //1
4295          PositiveIntType t = new PositiveIntType();
4296          t.setValue(value);
4297          if (this.noteNumber == null)
4298            this.noteNumber = new ArrayList<PositiveIntType>();
4299          this.noteNumber.add(t);
4300          return this;
4301        }
4302
4303        /**
4304         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4305         */
4306        public boolean hasNoteNumber(int value) { 
4307          if (this.noteNumber == null)
4308            return false;
4309          for (PositiveIntType v : this.noteNumber)
4310            if (v.getValue().equals(value)) // positiveInt
4311              return true;
4312          return false;
4313        }
4314
4315        /**
4316         * @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.)
4317         */
4318        public List<AdjudicationComponent> getAdjudication() { 
4319          if (this.adjudication == null)
4320            this.adjudication = new ArrayList<AdjudicationComponent>();
4321          return this.adjudication;
4322        }
4323
4324        /**
4325         * @return Returns a reference to <code>this</code> for easy method chaining
4326         */
4327        public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
4328          this.adjudication = theAdjudication;
4329          return this;
4330        }
4331
4332        public boolean hasAdjudication() { 
4333          if (this.adjudication == null)
4334            return false;
4335          for (AdjudicationComponent item : this.adjudication)
4336            if (!item.isEmpty())
4337              return true;
4338          return false;
4339        }
4340
4341        public AdjudicationComponent addAdjudication() { //3
4342          AdjudicationComponent t = new AdjudicationComponent();
4343          if (this.adjudication == null)
4344            this.adjudication = new ArrayList<AdjudicationComponent>();
4345          this.adjudication.add(t);
4346          return t;
4347        }
4348
4349        public ItemComponent addAdjudication(AdjudicationComponent t) { //3
4350          if (t == null)
4351            return this;
4352          if (this.adjudication == null)
4353            this.adjudication = new ArrayList<AdjudicationComponent>();
4354          this.adjudication.add(t);
4355          return this;
4356        }
4357
4358        /**
4359         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
4360         */
4361        public AdjudicationComponent getAdjudicationFirstRep() { 
4362          if (getAdjudication().isEmpty()) {
4363            addAdjudication();
4364          }
4365          return getAdjudication().get(0);
4366        }
4367
4368        /**
4369         * @return {@link #detail} (Second-tier of goods and services.)
4370         */
4371        public List<DetailComponent> getDetail() { 
4372          if (this.detail == null)
4373            this.detail = new ArrayList<DetailComponent>();
4374          return this.detail;
4375        }
4376
4377        /**
4378         * @return Returns a reference to <code>this</code> for easy method chaining
4379         */
4380        public ItemComponent setDetail(List<DetailComponent> theDetail) { 
4381          this.detail = theDetail;
4382          return this;
4383        }
4384
4385        public boolean hasDetail() { 
4386          if (this.detail == null)
4387            return false;
4388          for (DetailComponent item : this.detail)
4389            if (!item.isEmpty())
4390              return true;
4391          return false;
4392        }
4393
4394        public DetailComponent addDetail() { //3
4395          DetailComponent t = new DetailComponent();
4396          if (this.detail == null)
4397            this.detail = new ArrayList<DetailComponent>();
4398          this.detail.add(t);
4399          return t;
4400        }
4401
4402        public ItemComponent addDetail(DetailComponent t) { //3
4403          if (t == null)
4404            return this;
4405          if (this.detail == null)
4406            this.detail = new ArrayList<DetailComponent>();
4407          this.detail.add(t);
4408          return this;
4409        }
4410
4411        /**
4412         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist {3}
4413         */
4414        public DetailComponent getDetailFirstRep() { 
4415          if (getDetail().isEmpty()) {
4416            addDetail();
4417          }
4418          return getDetail().get(0);
4419        }
4420
4421        protected void listChildren(List<Property> children) {
4422          super.listChildren(children);
4423          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence));
4424          children.add(new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence));
4425          children.add(new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence));
4426          children.add(new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence));
4427          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));
4428          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
4429          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
4430          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));
4431          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));
4432          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
4433          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));
4434          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location));
4435          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
4436          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));
4437          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));
4438          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
4439          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
4440          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
4441          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));
4442          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));
4443          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));
4444          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));
4445          children.add(new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
4446        }
4447
4448        @Override
4449        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4450          switch (_hash) {
4451          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence);
4452          case 1070083823: /*careTeamSequence*/  return new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence);
4453          case -909769262: /*diagnosisSequence*/  return new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence);
4454          case -808920140: /*procedureSequence*/  return new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence);
4455          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);
4456          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
4457          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);
4458          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);
4459          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);
4460          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
4461          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);
4462          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);
4463          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);
4464          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);
4465          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4466          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4467          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept", "Where the product or service was provided.", 0, 1, location);
4468          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address", "Where the product or service was provided.", 0, 1, location);
4469          case 755866390: /*locationReference*/  return new Property("location[x]", "Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4470          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
4471          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);
4472          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);
4473          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);
4474          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
4475          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
4476          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);
4477          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);
4478          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);
4479          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);
4480          case -1335224239: /*detail*/  return new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail);
4481          default: return super.getNamedProperty(_hash, _name, _checkValid);
4482          }
4483
4484        }
4485
4486      @Override
4487      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4488        switch (hash) {
4489        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
4490        case 1070083823: /*careTeamSequence*/ return this.careTeamSequence == null ? new Base[0] : this.careTeamSequence.toArray(new Base[this.careTeamSequence.size()]); // PositiveIntType
4491        case -909769262: /*diagnosisSequence*/ return this.diagnosisSequence == null ? new Base[0] : this.diagnosisSequence.toArray(new Base[this.diagnosisSequence.size()]); // PositiveIntType
4492        case -808920140: /*procedureSequence*/ return this.procedureSequence == null ? new Base[0] : this.procedureSequence.toArray(new Base[this.procedureSequence.size()]); // PositiveIntType
4493        case -702585587: /*informationSequence*/ return this.informationSequence == null ? new Base[0] : this.informationSequence.toArray(new Base[this.informationSequence.size()]); // PositiveIntType
4494        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
4495        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4496        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
4497        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
4498        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
4499        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // DataType
4500        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // DataType
4501        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
4502        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
4503        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
4504        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
4505        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
4506        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
4507        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
4508        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
4509        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
4510        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
4511        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
4512        default: return super.getProperty(hash, name, checkValid);
4513        }
4514
4515      }
4516
4517      @Override
4518      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4519        switch (hash) {
4520        case 1349547969: // sequence
4521          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
4522          return value;
4523        case 1070083823: // careTeamSequence
4524          this.getCareTeamSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4525          return value;
4526        case -909769262: // diagnosisSequence
4527          this.getDiagnosisSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4528          return value;
4529        case -808920140: // procedureSequence
4530          this.getProcedureSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4531          return value;
4532        case -702585587: // informationSequence
4533          this.getInformationSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4534          return value;
4535        case 1099842588: // revenue
4536          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4537          return value;
4538        case 50511102: // category
4539          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4540          return value;
4541        case 1957227299: // productOrService
4542          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4543          return value;
4544        case -615513385: // modifier
4545          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4546          return value;
4547        case 1010065041: // programCode
4548          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4549          return value;
4550        case 1379209295: // serviced
4551          this.serviced = TypeConvertor.castToType(value); // DataType
4552          return value;
4553        case 1901043637: // location
4554          this.location = TypeConvertor.castToType(value); // DataType
4555          return value;
4556        case -1285004149: // quantity
4557          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
4558          return value;
4559        case -486196699: // unitPrice
4560          this.unitPrice = TypeConvertor.castToMoney(value); // Money
4561          return value;
4562        case -1282148017: // factor
4563          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
4564          return value;
4565        case 108957: // net
4566          this.net = TypeConvertor.castToMoney(value); // Money
4567          return value;
4568        case 115642: // udi
4569          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
4570          return value;
4571        case 1702620169: // bodySite
4572          this.bodySite = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4573          return value;
4574        case -1868566105: // subSite
4575          this.getSubSite().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4576          return value;
4577        case 1524132147: // encounter
4578          this.getEncounter().add(TypeConvertor.castToReference(value)); // Reference
4579          return value;
4580        case -1110033957: // noteNumber
4581          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
4582          return value;
4583        case -231349275: // adjudication
4584          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
4585          return value;
4586        case -1335224239: // detail
4587          this.getDetail().add((DetailComponent) value); // DetailComponent
4588          return value;
4589        default: return super.setProperty(hash, name, value);
4590        }
4591
4592      }
4593
4594      @Override
4595      public Base setProperty(String name, Base value) throws FHIRException {
4596        if (name.equals("sequence")) {
4597          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
4598        } else if (name.equals("careTeamSequence")) {
4599          this.getCareTeamSequence().add(TypeConvertor.castToPositiveInt(value));
4600        } else if (name.equals("diagnosisSequence")) {
4601          this.getDiagnosisSequence().add(TypeConvertor.castToPositiveInt(value));
4602        } else if (name.equals("procedureSequence")) {
4603          this.getProcedureSequence().add(TypeConvertor.castToPositiveInt(value));
4604        } else if (name.equals("informationSequence")) {
4605          this.getInformationSequence().add(TypeConvertor.castToPositiveInt(value));
4606        } else if (name.equals("revenue")) {
4607          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4608        } else if (name.equals("category")) {
4609          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4610        } else if (name.equals("productOrService")) {
4611          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4612        } else if (name.equals("modifier")) {
4613          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
4614        } else if (name.equals("programCode")) {
4615          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value));
4616        } else if (name.equals("serviced[x]")) {
4617          this.serviced = TypeConvertor.castToType(value); // DataType
4618        } else if (name.equals("location[x]")) {
4619          this.location = TypeConvertor.castToType(value); // DataType
4620        } else if (name.equals("quantity")) {
4621          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
4622        } else if (name.equals("unitPrice")) {
4623          this.unitPrice = TypeConvertor.castToMoney(value); // Money
4624        } else if (name.equals("factor")) {
4625          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
4626        } else if (name.equals("net")) {
4627          this.net = TypeConvertor.castToMoney(value); // Money
4628        } else if (name.equals("udi")) {
4629          this.getUdi().add(TypeConvertor.castToReference(value));
4630        } else if (name.equals("bodySite")) {
4631          this.bodySite = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4632        } else if (name.equals("subSite")) {
4633          this.getSubSite().add(TypeConvertor.castToCodeableConcept(value));
4634        } else if (name.equals("encounter")) {
4635          this.getEncounter().add(TypeConvertor.castToReference(value));
4636        } else if (name.equals("noteNumber")) {
4637          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
4638        } else if (name.equals("adjudication")) {
4639          this.getAdjudication().add((AdjudicationComponent) value);
4640        } else if (name.equals("detail")) {
4641          this.getDetail().add((DetailComponent) value);
4642        } else
4643          return super.setProperty(name, value);
4644        return value;
4645      }
4646
4647      @Override
4648      public Base makeProperty(int hash, String name) throws FHIRException {
4649        switch (hash) {
4650        case 1349547969:  return getSequenceElement();
4651        case 1070083823:  return addCareTeamSequenceElement();
4652        case -909769262:  return addDiagnosisSequenceElement();
4653        case -808920140:  return addProcedureSequenceElement();
4654        case -702585587:  return addInformationSequenceElement();
4655        case 1099842588:  return getRevenue();
4656        case 50511102:  return getCategory();
4657        case 1957227299:  return getProductOrService();
4658        case -615513385:  return addModifier(); 
4659        case 1010065041:  return addProgramCode(); 
4660        case -1927922223:  return getServiced();
4661        case 1379209295:  return getServiced();
4662        case 552316075:  return getLocation();
4663        case 1901043637:  return getLocation();
4664        case -1285004149:  return getQuantity();
4665        case -486196699:  return getUnitPrice();
4666        case -1282148017:  return getFactorElement();
4667        case 108957:  return getNet();
4668        case 115642:  return addUdi(); 
4669        case 1702620169:  return getBodySite();
4670        case -1868566105:  return addSubSite(); 
4671        case 1524132147:  return addEncounter(); 
4672        case -1110033957:  return addNoteNumberElement();
4673        case -231349275:  return addAdjudication(); 
4674        case -1335224239:  return addDetail(); 
4675        default: return super.makeProperty(hash, name);
4676        }
4677
4678      }
4679
4680      @Override
4681      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4682        switch (hash) {
4683        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
4684        case 1070083823: /*careTeamSequence*/ return new String[] {"positiveInt"};
4685        case -909769262: /*diagnosisSequence*/ return new String[] {"positiveInt"};
4686        case -808920140: /*procedureSequence*/ return new String[] {"positiveInt"};
4687        case -702585587: /*informationSequence*/ return new String[] {"positiveInt"};
4688        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
4689        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
4690        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
4691        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
4692        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
4693        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
4694        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
4695        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
4696        case -486196699: /*unitPrice*/ return new String[] {"Money"};
4697        case -1282148017: /*factor*/ return new String[] {"decimal"};
4698        case 108957: /*net*/ return new String[] {"Money"};
4699        case 115642: /*udi*/ return new String[] {"Reference"};
4700        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
4701        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
4702        case 1524132147: /*encounter*/ return new String[] {"Reference"};
4703        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
4704        case -231349275: /*adjudication*/ return new String[] {};
4705        case -1335224239: /*detail*/ return new String[] {};
4706        default: return super.getTypesForProperty(hash, name);
4707        }
4708
4709      }
4710
4711      @Override
4712      public Base addChild(String name) throws FHIRException {
4713        if (name.equals("sequence")) {
4714          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.sequence");
4715        }
4716        else if (name.equals("careTeamSequence")) {
4717          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.careTeamSequence");
4718        }
4719        else if (name.equals("diagnosisSequence")) {
4720          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.diagnosisSequence");
4721        }
4722        else if (name.equals("procedureSequence")) {
4723          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.procedureSequence");
4724        }
4725        else if (name.equals("informationSequence")) {
4726          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.informationSequence");
4727        }
4728        else if (name.equals("revenue")) {
4729          this.revenue = new CodeableConcept();
4730          return this.revenue;
4731        }
4732        else if (name.equals("category")) {
4733          this.category = new CodeableConcept();
4734          return this.category;
4735        }
4736        else if (name.equals("productOrService")) {
4737          this.productOrService = new CodeableConcept();
4738          return this.productOrService;
4739        }
4740        else if (name.equals("modifier")) {
4741          return addModifier();
4742        }
4743        else if (name.equals("programCode")) {
4744          return addProgramCode();
4745        }
4746        else if (name.equals("servicedDate")) {
4747          this.serviced = new DateType();
4748          return this.serviced;
4749        }
4750        else if (name.equals("servicedPeriod")) {
4751          this.serviced = new Period();
4752          return this.serviced;
4753        }
4754        else if (name.equals("locationCodeableConcept")) {
4755          this.location = new CodeableConcept();
4756          return this.location;
4757        }
4758        else if (name.equals("locationAddress")) {
4759          this.location = new Address();
4760          return this.location;
4761        }
4762        else if (name.equals("locationReference")) {
4763          this.location = new Reference();
4764          return this.location;
4765        }
4766        else if (name.equals("quantity")) {
4767          this.quantity = new Quantity();
4768          return this.quantity;
4769        }
4770        else if (name.equals("unitPrice")) {
4771          this.unitPrice = new Money();
4772          return this.unitPrice;
4773        }
4774        else if (name.equals("factor")) {
4775          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.factor");
4776        }
4777        else if (name.equals("net")) {
4778          this.net = new Money();
4779          return this.net;
4780        }
4781        else if (name.equals("udi")) {
4782          return addUdi();
4783        }
4784        else if (name.equals("bodySite")) {
4785          this.bodySite = new CodeableConcept();
4786          return this.bodySite;
4787        }
4788        else if (name.equals("subSite")) {
4789          return addSubSite();
4790        }
4791        else if (name.equals("encounter")) {
4792          return addEncounter();
4793        }
4794        else if (name.equals("noteNumber")) {
4795          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.noteNumber");
4796        }
4797        else if (name.equals("adjudication")) {
4798          return addAdjudication();
4799        }
4800        else if (name.equals("detail")) {
4801          return addDetail();
4802        }
4803        else
4804          return super.addChild(name);
4805      }
4806
4807      public ItemComponent copy() {
4808        ItemComponent dst = new ItemComponent();
4809        copyValues(dst);
4810        return dst;
4811      }
4812
4813      public void copyValues(ItemComponent dst) {
4814        super.copyValues(dst);
4815        dst.sequence = sequence == null ? null : sequence.copy();
4816        if (careTeamSequence != null) {
4817          dst.careTeamSequence = new ArrayList<PositiveIntType>();
4818          for (PositiveIntType i : careTeamSequence)
4819            dst.careTeamSequence.add(i.copy());
4820        };
4821        if (diagnosisSequence != null) {
4822          dst.diagnosisSequence = new ArrayList<PositiveIntType>();
4823          for (PositiveIntType i : diagnosisSequence)
4824            dst.diagnosisSequence.add(i.copy());
4825        };
4826        if (procedureSequence != null) {
4827          dst.procedureSequence = new ArrayList<PositiveIntType>();
4828          for (PositiveIntType i : procedureSequence)
4829            dst.procedureSequence.add(i.copy());
4830        };
4831        if (informationSequence != null) {
4832          dst.informationSequence = new ArrayList<PositiveIntType>();
4833          for (PositiveIntType i : informationSequence)
4834            dst.informationSequence.add(i.copy());
4835        };
4836        dst.revenue = revenue == null ? null : revenue.copy();
4837        dst.category = category == null ? null : category.copy();
4838        dst.productOrService = productOrService == null ? null : productOrService.copy();
4839        if (modifier != null) {
4840          dst.modifier = new ArrayList<CodeableConcept>();
4841          for (CodeableConcept i : modifier)
4842            dst.modifier.add(i.copy());
4843        };
4844        if (programCode != null) {
4845          dst.programCode = new ArrayList<CodeableConcept>();
4846          for (CodeableConcept i : programCode)
4847            dst.programCode.add(i.copy());
4848        };
4849        dst.serviced = serviced == null ? null : serviced.copy();
4850        dst.location = location == null ? null : location.copy();
4851        dst.quantity = quantity == null ? null : quantity.copy();
4852        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
4853        dst.factor = factor == null ? null : factor.copy();
4854        dst.net = net == null ? null : net.copy();
4855        if (udi != null) {
4856          dst.udi = new ArrayList<Reference>();
4857          for (Reference i : udi)
4858            dst.udi.add(i.copy());
4859        };
4860        dst.bodySite = bodySite == null ? null : bodySite.copy();
4861        if (subSite != null) {
4862          dst.subSite = new ArrayList<CodeableConcept>();
4863          for (CodeableConcept i : subSite)
4864            dst.subSite.add(i.copy());
4865        };
4866        if (encounter != null) {
4867          dst.encounter = new ArrayList<Reference>();
4868          for (Reference i : encounter)
4869            dst.encounter.add(i.copy());
4870        };
4871        if (noteNumber != null) {
4872          dst.noteNumber = new ArrayList<PositiveIntType>();
4873          for (PositiveIntType i : noteNumber)
4874            dst.noteNumber.add(i.copy());
4875        };
4876        if (adjudication != null) {
4877          dst.adjudication = new ArrayList<AdjudicationComponent>();
4878          for (AdjudicationComponent i : adjudication)
4879            dst.adjudication.add(i.copy());
4880        };
4881        if (detail != null) {
4882          dst.detail = new ArrayList<DetailComponent>();
4883          for (DetailComponent i : detail)
4884            dst.detail.add(i.copy());
4885        };
4886      }
4887
4888      @Override
4889      public boolean equalsDeep(Base other_) {
4890        if (!super.equalsDeep(other_))
4891          return false;
4892        if (!(other_ instanceof ItemComponent))
4893          return false;
4894        ItemComponent o = (ItemComponent) other_;
4895        return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamSequence, o.careTeamSequence, true)
4896           && compareDeep(diagnosisSequence, o.diagnosisSequence, true) && compareDeep(procedureSequence, o.procedureSequence, true)
4897           && compareDeep(informationSequence, o.informationSequence, true) && compareDeep(revenue, o.revenue, true)
4898           && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
4899           && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true)
4900           && compareDeep(location, o.location, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
4901           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
4902           && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true) && compareDeep(encounter, o.encounter, true)
4903           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
4904           && compareDeep(detail, o.detail, true);
4905      }
4906
4907      @Override
4908      public boolean equalsShallow(Base other_) {
4909        if (!super.equalsShallow(other_))
4910          return false;
4911        if (!(other_ instanceof ItemComponent))
4912          return false;
4913        ItemComponent o = (ItemComponent) other_;
4914        return compareValues(sequence, o.sequence, true) && compareValues(careTeamSequence, o.careTeamSequence, true)
4915           && compareValues(diagnosisSequence, o.diagnosisSequence, true) && compareValues(procedureSequence, o.procedureSequence, true)
4916           && compareValues(informationSequence, o.informationSequence, true) && compareValues(factor, o.factor, true)
4917           && compareValues(noteNumber, o.noteNumber, true);
4918      }
4919
4920      public boolean isEmpty() {
4921        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamSequence
4922          , diagnosisSequence, procedureSequence, informationSequence, revenue, category, productOrService
4923          , modifier, programCode, serviced, location, quantity, unitPrice, factor, net
4924          , udi, bodySite, subSite, encounter, noteNumber, adjudication, detail);
4925      }
4926
4927  public String fhirType() {
4928    return "ExplanationOfBenefit.item";
4929
4930  }
4931
4932  }
4933
4934    @Block()
4935    public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
4936        /**
4937         * 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.
4938         */
4939        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
4940        @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." )
4941        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
4942        protected CodeableConcept category;
4943
4944        /**
4945         * A code supporting the understanding of the adjudication result and explaining variance from expected amount.
4946         */
4947        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
4948        @Description(shortDefinition="Explanation of adjudication outcome", formalDefinition="A code supporting the understanding of the adjudication result and explaining variance from expected amount." )
4949        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-reason")
4950        protected CodeableConcept reason;
4951
4952        /**
4953         * Monetary amount associated with the category.
4954         */
4955        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
4956        @Description(shortDefinition="Monetary amount", formalDefinition="Monetary amount associated with the category." )
4957        protected Money amount;
4958
4959        /**
4960         * A non-monetary value associated with the category. Mutually exclusive to the amount element above.
4961         */
4962        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
4963        @Description(shortDefinition="Non-monitary value", formalDefinition="A non-monetary value associated with the category. Mutually exclusive to the amount element above." )
4964        protected DecimalType value;
4965
4966        private static final long serialVersionUID = 1559898786L;
4967
4968    /**
4969     * Constructor
4970     */
4971      public AdjudicationComponent() {
4972        super();
4973      }
4974
4975    /**
4976     * Constructor
4977     */
4978      public AdjudicationComponent(CodeableConcept category) {
4979        super();
4980        this.setCategory(category);
4981      }
4982
4983        /**
4984         * @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.)
4985         */
4986        public CodeableConcept getCategory() { 
4987          if (this.category == null)
4988            if (Configuration.errorOnAutoCreate())
4989              throw new Error("Attempt to auto-create AdjudicationComponent.category");
4990            else if (Configuration.doAutoCreate())
4991              this.category = new CodeableConcept(); // cc
4992          return this.category;
4993        }
4994
4995        public boolean hasCategory() { 
4996          return this.category != null && !this.category.isEmpty();
4997        }
4998
4999        /**
5000         * @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.)
5001         */
5002        public AdjudicationComponent setCategory(CodeableConcept value) { 
5003          this.category = value;
5004          return this;
5005        }
5006
5007        /**
5008         * @return {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
5009         */
5010        public CodeableConcept getReason() { 
5011          if (this.reason == null)
5012            if (Configuration.errorOnAutoCreate())
5013              throw new Error("Attempt to auto-create AdjudicationComponent.reason");
5014            else if (Configuration.doAutoCreate())
5015              this.reason = new CodeableConcept(); // cc
5016          return this.reason;
5017        }
5018
5019        public boolean hasReason() { 
5020          return this.reason != null && !this.reason.isEmpty();
5021        }
5022
5023        /**
5024         * @param value {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
5025         */
5026        public AdjudicationComponent setReason(CodeableConcept value) { 
5027          this.reason = value;
5028          return this;
5029        }
5030
5031        /**
5032         * @return {@link #amount} (Monetary amount associated with the category.)
5033         */
5034        public Money getAmount() { 
5035          if (this.amount == null)
5036            if (Configuration.errorOnAutoCreate())
5037              throw new Error("Attempt to auto-create AdjudicationComponent.amount");
5038            else if (Configuration.doAutoCreate())
5039              this.amount = new Money(); // cc
5040          return this.amount;
5041        }
5042
5043        public boolean hasAmount() { 
5044          return this.amount != null && !this.amount.isEmpty();
5045        }
5046
5047        /**
5048         * @param value {@link #amount} (Monetary amount associated with the category.)
5049         */
5050        public AdjudicationComponent setAmount(Money value) { 
5051          this.amount = value;
5052          return this;
5053        }
5054
5055        /**
5056         * @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
5057         */
5058        public DecimalType getValueElement() { 
5059          if (this.value == null)
5060            if (Configuration.errorOnAutoCreate())
5061              throw new Error("Attempt to auto-create AdjudicationComponent.value");
5062            else if (Configuration.doAutoCreate())
5063              this.value = new DecimalType(); // bb
5064          return this.value;
5065        }
5066
5067        public boolean hasValueElement() { 
5068          return this.value != null && !this.value.isEmpty();
5069        }
5070
5071        public boolean hasValue() { 
5072          return this.value != null && !this.value.isEmpty();
5073        }
5074
5075        /**
5076         * @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
5077         */
5078        public AdjudicationComponent setValueElement(DecimalType value) { 
5079          this.value = value;
5080          return this;
5081        }
5082
5083        /**
5084         * @return A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5085         */
5086        public BigDecimal getValue() { 
5087          return this.value == null ? null : this.value.getValue();
5088        }
5089
5090        /**
5091         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5092         */
5093        public AdjudicationComponent setValue(BigDecimal value) { 
5094          if (value == null)
5095            this.value = null;
5096          else {
5097            if (this.value == null)
5098              this.value = new DecimalType();
5099            this.value.setValue(value);
5100          }
5101          return this;
5102        }
5103
5104        /**
5105         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5106         */
5107        public AdjudicationComponent setValue(long value) { 
5108              this.value = new DecimalType();
5109            this.value.setValue(value);
5110          return this;
5111        }
5112
5113        /**
5114         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5115         */
5116        public AdjudicationComponent setValue(double value) { 
5117              this.value = new DecimalType();
5118            this.value.setValue(value);
5119          return this;
5120        }
5121
5122        protected void listChildren(List<Property> children) {
5123          super.listChildren(children);
5124          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));
5125          children.add(new Property("reason", "CodeableConcept", "A code supporting the understanding of the adjudication result and explaining variance from expected amount.", 0, 1, reason));
5126          children.add(new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount));
5127          children.add(new Property("value", "decimal", "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1, value));
5128        }
5129
5130        @Override
5131        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5132          switch (_hash) {
5133          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);
5134          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);
5135          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount);
5136          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);
5137          default: return super.getNamedProperty(_hash, _name, _checkValid);
5138          }
5139
5140        }
5141
5142      @Override
5143      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5144        switch (hash) {
5145        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
5146        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
5147        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
5148        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
5149        default: return super.getProperty(hash, name, checkValid);
5150        }
5151
5152      }
5153
5154      @Override
5155      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5156        switch (hash) {
5157        case 50511102: // category
5158          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5159          return value;
5160        case -934964668: // reason
5161          this.reason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5162          return value;
5163        case -1413853096: // amount
5164          this.amount = TypeConvertor.castToMoney(value); // Money
5165          return value;
5166        case 111972721: // value
5167          this.value = TypeConvertor.castToDecimal(value); // DecimalType
5168          return value;
5169        default: return super.setProperty(hash, name, value);
5170        }
5171
5172      }
5173
5174      @Override
5175      public Base setProperty(String name, Base value) throws FHIRException {
5176        if (name.equals("category")) {
5177          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5178        } else if (name.equals("reason")) {
5179          this.reason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5180        } else if (name.equals("amount")) {
5181          this.amount = TypeConvertor.castToMoney(value); // Money
5182        } else if (name.equals("value")) {
5183          this.value = TypeConvertor.castToDecimal(value); // DecimalType
5184        } else
5185          return super.setProperty(name, value);
5186        return value;
5187      }
5188
5189      @Override
5190      public Base makeProperty(int hash, String name) throws FHIRException {
5191        switch (hash) {
5192        case 50511102:  return getCategory();
5193        case -934964668:  return getReason();
5194        case -1413853096:  return getAmount();
5195        case 111972721:  return getValueElement();
5196        default: return super.makeProperty(hash, name);
5197        }
5198
5199      }
5200
5201      @Override
5202      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5203        switch (hash) {
5204        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5205        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
5206        case -1413853096: /*amount*/ return new String[] {"Money"};
5207        case 111972721: /*value*/ return new String[] {"decimal"};
5208        default: return super.getTypesForProperty(hash, name);
5209        }
5210
5211      }
5212
5213      @Override
5214      public Base addChild(String name) throws FHIRException {
5215        if (name.equals("category")) {
5216          this.category = new CodeableConcept();
5217          return this.category;
5218        }
5219        else if (name.equals("reason")) {
5220          this.reason = new CodeableConcept();
5221          return this.reason;
5222        }
5223        else if (name.equals("amount")) {
5224          this.amount = new Money();
5225          return this.amount;
5226        }
5227        else if (name.equals("value")) {
5228          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.adjudication.value");
5229        }
5230        else
5231          return super.addChild(name);
5232      }
5233
5234      public AdjudicationComponent copy() {
5235        AdjudicationComponent dst = new AdjudicationComponent();
5236        copyValues(dst);
5237        return dst;
5238      }
5239
5240      public void copyValues(AdjudicationComponent dst) {
5241        super.copyValues(dst);
5242        dst.category = category == null ? null : category.copy();
5243        dst.reason = reason == null ? null : reason.copy();
5244        dst.amount = amount == null ? null : amount.copy();
5245        dst.value = value == null ? null : value.copy();
5246      }
5247
5248      @Override
5249      public boolean equalsDeep(Base other_) {
5250        if (!super.equalsDeep(other_))
5251          return false;
5252        if (!(other_ instanceof AdjudicationComponent))
5253          return false;
5254        AdjudicationComponent o = (AdjudicationComponent) other_;
5255        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
5256           && compareDeep(value, o.value, true);
5257      }
5258
5259      @Override
5260      public boolean equalsShallow(Base other_) {
5261        if (!super.equalsShallow(other_))
5262          return false;
5263        if (!(other_ instanceof AdjudicationComponent))
5264          return false;
5265        AdjudicationComponent o = (AdjudicationComponent) other_;
5266        return compareValues(value, o.value, true);
5267      }
5268
5269      public boolean isEmpty() {
5270        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount
5271          , value);
5272      }
5273
5274  public String fhirType() {
5275    return "ExplanationOfBenefit.item.adjudication";
5276
5277  }
5278
5279  }
5280
5281    @Block()
5282    public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
5283        /**
5284         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5285         */
5286        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
5287        @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." )
5288        protected PositiveIntType sequence;
5289
5290        /**
5291         * The type of revenue or cost center providing the product and/or service.
5292         */
5293        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5294        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
5295        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
5296        protected CodeableConcept revenue;
5297
5298        /**
5299         * Code to identify the general type of benefits under which products and services are provided.
5300         */
5301        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
5302        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
5303        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
5304        protected CodeableConcept category;
5305
5306        /**
5307         * 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.
5308         */
5309        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
5310        @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." )
5311        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
5312        protected CodeableConcept productOrService;
5313
5314        /**
5315         * Item typification or modifiers codes to convey additional context for the product or service.
5316         */
5317        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5318        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
5319        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
5320        protected List<CodeableConcept> modifier;
5321
5322        /**
5323         * Identifies the program under which this may be recovered.
5324         */
5325        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5326        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
5327        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
5328        protected List<CodeableConcept> programCode;
5329
5330        /**
5331         * The number of repetitions of a service or product.
5332         */
5333        @Child(name = "quantity", type = {Quantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
5334        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
5335        protected Quantity quantity;
5336
5337        /**
5338         * 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.
5339         */
5340        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
5341        @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." )
5342        protected Money unitPrice;
5343
5344        /**
5345         * 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.
5346         */
5347        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
5348        @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." )
5349        protected DecimalType factor;
5350
5351        /**
5352         * The quantity times the unit price for an additional service or product or charge.
5353         */
5354        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
5355        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
5356        protected Money net;
5357
5358        /**
5359         * Unique Device Identifiers associated with this line item.
5360         */
5361        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5362        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
5363        protected List<Reference> udi;
5364
5365        /**
5366         * The numbers associated with notes below which apply to the adjudication of this item.
5367         */
5368        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5369        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
5370        protected List<PositiveIntType> noteNumber;
5371
5372        /**
5373         * The adjudication results.
5374         */
5375        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5376        @Description(shortDefinition="Detail level adjudication details", formalDefinition="The adjudication results." )
5377        protected List<AdjudicationComponent> adjudication;
5378
5379        /**
5380         * Third-tier of goods and services.
5381         */
5382        @Child(name = "subDetail", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5383        @Description(shortDefinition="Additional items", formalDefinition="Third-tier of goods and services." )
5384        protected List<SubDetailComponent> subDetail;
5385
5386        private static final long serialVersionUID = -318460001L;
5387
5388    /**
5389     * Constructor
5390     */
5391      public DetailComponent() {
5392        super();
5393      }
5394
5395    /**
5396     * Constructor
5397     */
5398      public DetailComponent(int sequence, CodeableConcept productOrService) {
5399        super();
5400        this.setSequence(sequence);
5401        this.setProductOrService(productOrService);
5402      }
5403
5404        /**
5405         * @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
5406         */
5407        public PositiveIntType getSequenceElement() { 
5408          if (this.sequence == null)
5409            if (Configuration.errorOnAutoCreate())
5410              throw new Error("Attempt to auto-create DetailComponent.sequence");
5411            else if (Configuration.doAutoCreate())
5412              this.sequence = new PositiveIntType(); // bb
5413          return this.sequence;
5414        }
5415
5416        public boolean hasSequenceElement() { 
5417          return this.sequence != null && !this.sequence.isEmpty();
5418        }
5419
5420        public boolean hasSequence() { 
5421          return this.sequence != null && !this.sequence.isEmpty();
5422        }
5423
5424        /**
5425         * @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
5426         */
5427        public DetailComponent setSequenceElement(PositiveIntType value) { 
5428          this.sequence = value;
5429          return this;
5430        }
5431
5432        /**
5433         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5434         */
5435        public int getSequence() { 
5436          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
5437        }
5438
5439        /**
5440         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5441         */
5442        public DetailComponent setSequence(int value) { 
5443            if (this.sequence == null)
5444              this.sequence = new PositiveIntType();
5445            this.sequence.setValue(value);
5446          return this;
5447        }
5448
5449        /**
5450         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5451         */
5452        public CodeableConcept getRevenue() { 
5453          if (this.revenue == null)
5454            if (Configuration.errorOnAutoCreate())
5455              throw new Error("Attempt to auto-create DetailComponent.revenue");
5456            else if (Configuration.doAutoCreate())
5457              this.revenue = new CodeableConcept(); // cc
5458          return this.revenue;
5459        }
5460
5461        public boolean hasRevenue() { 
5462          return this.revenue != null && !this.revenue.isEmpty();
5463        }
5464
5465        /**
5466         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5467         */
5468        public DetailComponent setRevenue(CodeableConcept value) { 
5469          this.revenue = value;
5470          return this;
5471        }
5472
5473        /**
5474         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5475         */
5476        public CodeableConcept getCategory() { 
5477          if (this.category == null)
5478            if (Configuration.errorOnAutoCreate())
5479              throw new Error("Attempt to auto-create DetailComponent.category");
5480            else if (Configuration.doAutoCreate())
5481              this.category = new CodeableConcept(); // cc
5482          return this.category;
5483        }
5484
5485        public boolean hasCategory() { 
5486          return this.category != null && !this.category.isEmpty();
5487        }
5488
5489        /**
5490         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5491         */
5492        public DetailComponent setCategory(CodeableConcept value) { 
5493          this.category = value;
5494          return this;
5495        }
5496
5497        /**
5498         * @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.)
5499         */
5500        public CodeableConcept getProductOrService() { 
5501          if (this.productOrService == null)
5502            if (Configuration.errorOnAutoCreate())
5503              throw new Error("Attempt to auto-create DetailComponent.productOrService");
5504            else if (Configuration.doAutoCreate())
5505              this.productOrService = new CodeableConcept(); // cc
5506          return this.productOrService;
5507        }
5508
5509        public boolean hasProductOrService() { 
5510          return this.productOrService != null && !this.productOrService.isEmpty();
5511        }
5512
5513        /**
5514         * @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.)
5515         */
5516        public DetailComponent setProductOrService(CodeableConcept value) { 
5517          this.productOrService = value;
5518          return this;
5519        }
5520
5521        /**
5522         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
5523         */
5524        public List<CodeableConcept> getModifier() { 
5525          if (this.modifier == null)
5526            this.modifier = new ArrayList<CodeableConcept>();
5527          return this.modifier;
5528        }
5529
5530        /**
5531         * @return Returns a reference to <code>this</code> for easy method chaining
5532         */
5533        public DetailComponent setModifier(List<CodeableConcept> theModifier) { 
5534          this.modifier = theModifier;
5535          return this;
5536        }
5537
5538        public boolean hasModifier() { 
5539          if (this.modifier == null)
5540            return false;
5541          for (CodeableConcept item : this.modifier)
5542            if (!item.isEmpty())
5543              return true;
5544          return false;
5545        }
5546
5547        public CodeableConcept addModifier() { //3
5548          CodeableConcept t = new CodeableConcept();
5549          if (this.modifier == null)
5550            this.modifier = new ArrayList<CodeableConcept>();
5551          this.modifier.add(t);
5552          return t;
5553        }
5554
5555        public DetailComponent addModifier(CodeableConcept t) { //3
5556          if (t == null)
5557            return this;
5558          if (this.modifier == null)
5559            this.modifier = new ArrayList<CodeableConcept>();
5560          this.modifier.add(t);
5561          return this;
5562        }
5563
5564        /**
5565         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
5566         */
5567        public CodeableConcept getModifierFirstRep() { 
5568          if (getModifier().isEmpty()) {
5569            addModifier();
5570          }
5571          return getModifier().get(0);
5572        }
5573
5574        /**
5575         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
5576         */
5577        public List<CodeableConcept> getProgramCode() { 
5578          if (this.programCode == null)
5579            this.programCode = new ArrayList<CodeableConcept>();
5580          return this.programCode;
5581        }
5582
5583        /**
5584         * @return Returns a reference to <code>this</code> for easy method chaining
5585         */
5586        public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
5587          this.programCode = theProgramCode;
5588          return this;
5589        }
5590
5591        public boolean hasProgramCode() { 
5592          if (this.programCode == null)
5593            return false;
5594          for (CodeableConcept item : this.programCode)
5595            if (!item.isEmpty())
5596              return true;
5597          return false;
5598        }
5599
5600        public CodeableConcept addProgramCode() { //3
5601          CodeableConcept t = new CodeableConcept();
5602          if (this.programCode == null)
5603            this.programCode = new ArrayList<CodeableConcept>();
5604          this.programCode.add(t);
5605          return t;
5606        }
5607
5608        public DetailComponent addProgramCode(CodeableConcept t) { //3
5609          if (t == null)
5610            return this;
5611          if (this.programCode == null)
5612            this.programCode = new ArrayList<CodeableConcept>();
5613          this.programCode.add(t);
5614          return this;
5615        }
5616
5617        /**
5618         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
5619         */
5620        public CodeableConcept getProgramCodeFirstRep() { 
5621          if (getProgramCode().isEmpty()) {
5622            addProgramCode();
5623          }
5624          return getProgramCode().get(0);
5625        }
5626
5627        /**
5628         * @return {@link #quantity} (The number of repetitions of a service or product.)
5629         */
5630        public Quantity getQuantity() { 
5631          if (this.quantity == null)
5632            if (Configuration.errorOnAutoCreate())
5633              throw new Error("Attempt to auto-create DetailComponent.quantity");
5634            else if (Configuration.doAutoCreate())
5635              this.quantity = new Quantity(); // cc
5636          return this.quantity;
5637        }
5638
5639        public boolean hasQuantity() { 
5640          return this.quantity != null && !this.quantity.isEmpty();
5641        }
5642
5643        /**
5644         * @param value {@link #quantity} (The number of repetitions of a service or product.)
5645         */
5646        public DetailComponent setQuantity(Quantity value) { 
5647          this.quantity = value;
5648          return this;
5649        }
5650
5651        /**
5652         * @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.)
5653         */
5654        public Money getUnitPrice() { 
5655          if (this.unitPrice == null)
5656            if (Configuration.errorOnAutoCreate())
5657              throw new Error("Attempt to auto-create DetailComponent.unitPrice");
5658            else if (Configuration.doAutoCreate())
5659              this.unitPrice = new Money(); // cc
5660          return this.unitPrice;
5661        }
5662
5663        public boolean hasUnitPrice() { 
5664          return this.unitPrice != null && !this.unitPrice.isEmpty();
5665        }
5666
5667        /**
5668         * @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.)
5669         */
5670        public DetailComponent setUnitPrice(Money value) { 
5671          this.unitPrice = value;
5672          return this;
5673        }
5674
5675        /**
5676         * @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
5677         */
5678        public DecimalType getFactorElement() { 
5679          if (this.factor == null)
5680            if (Configuration.errorOnAutoCreate())
5681              throw new Error("Attempt to auto-create DetailComponent.factor");
5682            else if (Configuration.doAutoCreate())
5683              this.factor = new DecimalType(); // bb
5684          return this.factor;
5685        }
5686
5687        public boolean hasFactorElement() { 
5688          return this.factor != null && !this.factor.isEmpty();
5689        }
5690
5691        public boolean hasFactor() { 
5692          return this.factor != null && !this.factor.isEmpty();
5693        }
5694
5695        /**
5696         * @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
5697         */
5698        public DetailComponent setFactorElement(DecimalType value) { 
5699          this.factor = value;
5700          return this;
5701        }
5702
5703        /**
5704         * @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.
5705         */
5706        public BigDecimal getFactor() { 
5707          return this.factor == null ? null : this.factor.getValue();
5708        }
5709
5710        /**
5711         * @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.
5712         */
5713        public DetailComponent setFactor(BigDecimal value) { 
5714          if (value == null)
5715            this.factor = null;
5716          else {
5717            if (this.factor == null)
5718              this.factor = new DecimalType();
5719            this.factor.setValue(value);
5720          }
5721          return this;
5722        }
5723
5724        /**
5725         * @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.
5726         */
5727        public DetailComponent setFactor(long value) { 
5728              this.factor = new DecimalType();
5729            this.factor.setValue(value);
5730          return this;
5731        }
5732
5733        /**
5734         * @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.
5735         */
5736        public DetailComponent setFactor(double value) { 
5737              this.factor = new DecimalType();
5738            this.factor.setValue(value);
5739          return this;
5740        }
5741
5742        /**
5743         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
5744         */
5745        public Money getNet() { 
5746          if (this.net == null)
5747            if (Configuration.errorOnAutoCreate())
5748              throw new Error("Attempt to auto-create DetailComponent.net");
5749            else if (Configuration.doAutoCreate())
5750              this.net = new Money(); // cc
5751          return this.net;
5752        }
5753
5754        public boolean hasNet() { 
5755          return this.net != null && !this.net.isEmpty();
5756        }
5757
5758        /**
5759         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
5760         */
5761        public DetailComponent setNet(Money value) { 
5762          this.net = value;
5763          return this;
5764        }
5765
5766        /**
5767         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
5768         */
5769        public List<Reference> getUdi() { 
5770          if (this.udi == null)
5771            this.udi = new ArrayList<Reference>();
5772          return this.udi;
5773        }
5774
5775        /**
5776         * @return Returns a reference to <code>this</code> for easy method chaining
5777         */
5778        public DetailComponent setUdi(List<Reference> theUdi) { 
5779          this.udi = theUdi;
5780          return this;
5781        }
5782
5783        public boolean hasUdi() { 
5784          if (this.udi == null)
5785            return false;
5786          for (Reference item : this.udi)
5787            if (!item.isEmpty())
5788              return true;
5789          return false;
5790        }
5791
5792        public Reference addUdi() { //3
5793          Reference t = new Reference();
5794          if (this.udi == null)
5795            this.udi = new ArrayList<Reference>();
5796          this.udi.add(t);
5797          return t;
5798        }
5799
5800        public DetailComponent addUdi(Reference t) { //3
5801          if (t == null)
5802            return this;
5803          if (this.udi == null)
5804            this.udi = new ArrayList<Reference>();
5805          this.udi.add(t);
5806          return this;
5807        }
5808
5809        /**
5810         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
5811         */
5812        public Reference getUdiFirstRep() { 
5813          if (getUdi().isEmpty()) {
5814            addUdi();
5815          }
5816          return getUdi().get(0);
5817        }
5818
5819        /**
5820         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
5821         */
5822        public List<PositiveIntType> getNoteNumber() { 
5823          if (this.noteNumber == null)
5824            this.noteNumber = new ArrayList<PositiveIntType>();
5825          return this.noteNumber;
5826        }
5827
5828        /**
5829         * @return Returns a reference to <code>this</code> for easy method chaining
5830         */
5831        public DetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
5832          this.noteNumber = theNoteNumber;
5833          return this;
5834        }
5835
5836        public boolean hasNoteNumber() { 
5837          if (this.noteNumber == null)
5838            return false;
5839          for (PositiveIntType item : this.noteNumber)
5840            if (!item.isEmpty())
5841              return true;
5842          return false;
5843        }
5844
5845        /**
5846         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
5847         */
5848        public PositiveIntType addNoteNumberElement() {//2 
5849          PositiveIntType t = new PositiveIntType();
5850          if (this.noteNumber == null)
5851            this.noteNumber = new ArrayList<PositiveIntType>();
5852          this.noteNumber.add(t);
5853          return t;
5854        }
5855
5856        /**
5857         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
5858         */
5859        public DetailComponent addNoteNumber(int value) { //1
5860          PositiveIntType t = new PositiveIntType();
5861          t.setValue(value);
5862          if (this.noteNumber == null)
5863            this.noteNumber = new ArrayList<PositiveIntType>();
5864          this.noteNumber.add(t);
5865          return this;
5866        }
5867
5868        /**
5869         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
5870         */
5871        public boolean hasNoteNumber(int value) { 
5872          if (this.noteNumber == null)
5873            return false;
5874          for (PositiveIntType v : this.noteNumber)
5875            if (v.getValue().equals(value)) // positiveInt
5876              return true;
5877          return false;
5878        }
5879
5880        /**
5881         * @return {@link #adjudication} (The adjudication results.)
5882         */
5883        public List<AdjudicationComponent> getAdjudication() { 
5884          if (this.adjudication == null)
5885            this.adjudication = new ArrayList<AdjudicationComponent>();
5886          return this.adjudication;
5887        }
5888
5889        /**
5890         * @return Returns a reference to <code>this</code> for easy method chaining
5891         */
5892        public DetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
5893          this.adjudication = theAdjudication;
5894          return this;
5895        }
5896
5897        public boolean hasAdjudication() { 
5898          if (this.adjudication == null)
5899            return false;
5900          for (AdjudicationComponent item : this.adjudication)
5901            if (!item.isEmpty())
5902              return true;
5903          return false;
5904        }
5905
5906        public AdjudicationComponent addAdjudication() { //3
5907          AdjudicationComponent t = new AdjudicationComponent();
5908          if (this.adjudication == null)
5909            this.adjudication = new ArrayList<AdjudicationComponent>();
5910          this.adjudication.add(t);
5911          return t;
5912        }
5913
5914        public DetailComponent addAdjudication(AdjudicationComponent t) { //3
5915          if (t == null)
5916            return this;
5917          if (this.adjudication == null)
5918            this.adjudication = new ArrayList<AdjudicationComponent>();
5919          this.adjudication.add(t);
5920          return this;
5921        }
5922
5923        /**
5924         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
5925         */
5926        public AdjudicationComponent getAdjudicationFirstRep() { 
5927          if (getAdjudication().isEmpty()) {
5928            addAdjudication();
5929          }
5930          return getAdjudication().get(0);
5931        }
5932
5933        /**
5934         * @return {@link #subDetail} (Third-tier of goods and services.)
5935         */
5936        public List<SubDetailComponent> getSubDetail() { 
5937          if (this.subDetail == null)
5938            this.subDetail = new ArrayList<SubDetailComponent>();
5939          return this.subDetail;
5940        }
5941
5942        /**
5943         * @return Returns a reference to <code>this</code> for easy method chaining
5944         */
5945        public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) { 
5946          this.subDetail = theSubDetail;
5947          return this;
5948        }
5949
5950        public boolean hasSubDetail() { 
5951          if (this.subDetail == null)
5952            return false;
5953          for (SubDetailComponent item : this.subDetail)
5954            if (!item.isEmpty())
5955              return true;
5956          return false;
5957        }
5958
5959        public SubDetailComponent addSubDetail() { //3
5960          SubDetailComponent t = new SubDetailComponent();
5961          if (this.subDetail == null)
5962            this.subDetail = new ArrayList<SubDetailComponent>();
5963          this.subDetail.add(t);
5964          return t;
5965        }
5966
5967        public DetailComponent addSubDetail(SubDetailComponent t) { //3
5968          if (t == null)
5969            return this;
5970          if (this.subDetail == null)
5971            this.subDetail = new ArrayList<SubDetailComponent>();
5972          this.subDetail.add(t);
5973          return this;
5974        }
5975
5976        /**
5977         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist {3}
5978         */
5979        public SubDetailComponent getSubDetailFirstRep() { 
5980          if (getSubDetail().isEmpty()) {
5981            addSubDetail();
5982          }
5983          return getSubDetail().get(0);
5984        }
5985
5986        protected void listChildren(List<Property> children) {
5987          super.listChildren(children);
5988          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));
5989          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
5990          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
5991          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));
5992          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));
5993          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
5994          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
5995          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));
5996          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));
5997          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
5998          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
5999          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));
6000          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6001          children.add(new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
6002        }
6003
6004        @Override
6005        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6006          switch (_hash) {
6007          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);
6008          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
6009          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);
6010          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);
6011          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);
6012          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
6013          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
6014          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);
6015          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);
6016          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);
6017          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
6018          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);
6019          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
6020          case -828829007: /*subDetail*/  return new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
6021          default: return super.getNamedProperty(_hash, _name, _checkValid);
6022          }
6023
6024        }
6025
6026      @Override
6027      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6028        switch (hash) {
6029        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
6030        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
6031        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
6032        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
6033        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
6034        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
6035        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
6036        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6037        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6038        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6039        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
6040        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
6041        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
6042        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
6043        default: return super.getProperty(hash, name, checkValid);
6044        }
6045
6046      }
6047
6048      @Override
6049      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6050        switch (hash) {
6051        case 1349547969: // sequence
6052          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
6053          return value;
6054        case 1099842588: // revenue
6055          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6056          return value;
6057        case 50511102: // category
6058          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6059          return value;
6060        case 1957227299: // productOrService
6061          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6062          return value;
6063        case -615513385: // modifier
6064          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
6065          return value;
6066        case 1010065041: // programCode
6067          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
6068          return value;
6069        case -1285004149: // quantity
6070          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
6071          return value;
6072        case -486196699: // unitPrice
6073          this.unitPrice = TypeConvertor.castToMoney(value); // Money
6074          return value;
6075        case -1282148017: // factor
6076          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
6077          return value;
6078        case 108957: // net
6079          this.net = TypeConvertor.castToMoney(value); // Money
6080          return value;
6081        case 115642: // udi
6082          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
6083          return value;
6084        case -1110033957: // noteNumber
6085          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
6086          return value;
6087        case -231349275: // adjudication
6088          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
6089          return value;
6090        case -828829007: // subDetail
6091          this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
6092          return value;
6093        default: return super.setProperty(hash, name, value);
6094        }
6095
6096      }
6097
6098      @Override
6099      public Base setProperty(String name, Base value) throws FHIRException {
6100        if (name.equals("sequence")) {
6101          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
6102        } else if (name.equals("revenue")) {
6103          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6104        } else if (name.equals("category")) {
6105          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6106        } else if (name.equals("productOrService")) {
6107          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
6108        } else if (name.equals("modifier")) {
6109          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
6110        } else if (name.equals("programCode")) {
6111          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value));
6112        } else if (name.equals("quantity")) {
6113          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
6114        } else if (name.equals("unitPrice")) {
6115          this.unitPrice = TypeConvertor.castToMoney(value); // Money
6116        } else if (name.equals("factor")) {
6117          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
6118        } else if (name.equals("net")) {
6119          this.net = TypeConvertor.castToMoney(value); // Money
6120        } else if (name.equals("udi")) {
6121          this.getUdi().add(TypeConvertor.castToReference(value));
6122        } else if (name.equals("noteNumber")) {
6123          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
6124        } else if (name.equals("adjudication")) {
6125          this.getAdjudication().add((AdjudicationComponent) value);
6126        } else if (name.equals("subDetail")) {
6127          this.getSubDetail().add((SubDetailComponent) value);
6128        } else
6129          return super.setProperty(name, value);
6130        return value;
6131      }
6132
6133      @Override
6134      public Base makeProperty(int hash, String name) throws FHIRException {
6135        switch (hash) {
6136        case 1349547969:  return getSequenceElement();
6137        case 1099842588:  return getRevenue();
6138        case 50511102:  return getCategory();
6139        case 1957227299:  return getProductOrService();
6140        case -615513385:  return addModifier(); 
6141        case 1010065041:  return addProgramCode(); 
6142        case -1285004149:  return getQuantity();
6143        case -486196699:  return getUnitPrice();
6144        case -1282148017:  return getFactorElement();
6145        case 108957:  return getNet();
6146        case 115642:  return addUdi(); 
6147        case -1110033957:  return addNoteNumberElement();
6148        case -231349275:  return addAdjudication(); 
6149        case -828829007:  return addSubDetail(); 
6150        default: return super.makeProperty(hash, name);
6151        }
6152
6153      }
6154
6155      @Override
6156      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6157        switch (hash) {
6158        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
6159        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
6160        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
6161        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
6162        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
6163        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
6164        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
6165        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6166        case -1282148017: /*factor*/ return new String[] {"decimal"};
6167        case 108957: /*net*/ return new String[] {"Money"};
6168        case 115642: /*udi*/ return new String[] {"Reference"};
6169        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
6170        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
6171        case -828829007: /*subDetail*/ return new String[] {};
6172        default: return super.getTypesForProperty(hash, name);
6173        }
6174
6175      }
6176
6177      @Override
6178      public Base addChild(String name) throws FHIRException {
6179        if (name.equals("sequence")) {
6180          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.sequence");
6181        }
6182        else if (name.equals("revenue")) {
6183          this.revenue = new CodeableConcept();
6184          return this.revenue;
6185        }
6186        else if (name.equals("category")) {
6187          this.category = new CodeableConcept();
6188          return this.category;
6189        }
6190        else if (name.equals("productOrService")) {
6191          this.productOrService = new CodeableConcept();
6192          return this.productOrService;
6193        }
6194        else if (name.equals("modifier")) {
6195          return addModifier();
6196        }
6197        else if (name.equals("programCode")) {
6198          return addProgramCode();
6199        }
6200        else if (name.equals("quantity")) {
6201          this.quantity = new Quantity();
6202          return this.quantity;
6203        }
6204        else if (name.equals("unitPrice")) {
6205          this.unitPrice = new Money();
6206          return this.unitPrice;
6207        }
6208        else if (name.equals("factor")) {
6209          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.factor");
6210        }
6211        else if (name.equals("net")) {
6212          this.net = new Money();
6213          return this.net;
6214        }
6215        else if (name.equals("udi")) {
6216          return addUdi();
6217        }
6218        else if (name.equals("noteNumber")) {
6219          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.noteNumber");
6220        }
6221        else if (name.equals("adjudication")) {
6222          return addAdjudication();
6223        }
6224        else if (name.equals("subDetail")) {
6225          return addSubDetail();
6226        }
6227        else
6228          return super.addChild(name);
6229      }
6230
6231      public DetailComponent copy() {
6232        DetailComponent dst = new DetailComponent();
6233        copyValues(dst);
6234        return dst;
6235      }
6236
6237      public void copyValues(DetailComponent dst) {
6238        super.copyValues(dst);
6239        dst.sequence = sequence == null ? null : sequence.copy();
6240        dst.revenue = revenue == null ? null : revenue.copy();
6241        dst.category = category == null ? null : category.copy();
6242        dst.productOrService = productOrService == null ? null : productOrService.copy();
6243        if (modifier != null) {
6244          dst.modifier = new ArrayList<CodeableConcept>();
6245          for (CodeableConcept i : modifier)
6246            dst.modifier.add(i.copy());
6247        };
6248        if (programCode != null) {
6249          dst.programCode = new ArrayList<CodeableConcept>();
6250          for (CodeableConcept i : programCode)
6251            dst.programCode.add(i.copy());
6252        };
6253        dst.quantity = quantity == null ? null : quantity.copy();
6254        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6255        dst.factor = factor == null ? null : factor.copy();
6256        dst.net = net == null ? null : net.copy();
6257        if (udi != null) {
6258          dst.udi = new ArrayList<Reference>();
6259          for (Reference i : udi)
6260            dst.udi.add(i.copy());
6261        };
6262        if (noteNumber != null) {
6263          dst.noteNumber = new ArrayList<PositiveIntType>();
6264          for (PositiveIntType i : noteNumber)
6265            dst.noteNumber.add(i.copy());
6266        };
6267        if (adjudication != null) {
6268          dst.adjudication = new ArrayList<AdjudicationComponent>();
6269          for (AdjudicationComponent i : adjudication)
6270            dst.adjudication.add(i.copy());
6271        };
6272        if (subDetail != null) {
6273          dst.subDetail = new ArrayList<SubDetailComponent>();
6274          for (SubDetailComponent i : subDetail)
6275            dst.subDetail.add(i.copy());
6276        };
6277      }
6278
6279      @Override
6280      public boolean equalsDeep(Base other_) {
6281        if (!super.equalsDeep(other_))
6282          return false;
6283        if (!(other_ instanceof DetailComponent))
6284          return false;
6285        DetailComponent o = (DetailComponent) other_;
6286        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
6287           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
6288           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
6289           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
6290           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
6291           && compareDeep(subDetail, o.subDetail, true);
6292      }
6293
6294      @Override
6295      public boolean equalsShallow(Base other_) {
6296        if (!super.equalsShallow(other_))
6297          return false;
6298        if (!(other_ instanceof DetailComponent))
6299          return false;
6300        DetailComponent o = (DetailComponent) other_;
6301        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
6302          ;
6303      }
6304
6305      public boolean isEmpty() {
6306        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
6307          , productOrService, modifier, programCode, quantity, unitPrice, factor, net, udi
6308          , noteNumber, adjudication, subDetail);
6309      }
6310
6311  public String fhirType() {
6312    return "ExplanationOfBenefit.item.detail";
6313
6314  }
6315
6316  }
6317
6318    @Block()
6319    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
6320        /**
6321         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6322         */
6323        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
6324        @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." )
6325        protected PositiveIntType sequence;
6326
6327        /**
6328         * The type of revenue or cost center providing the product and/or service.
6329         */
6330        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
6331        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
6332        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
6333        protected CodeableConcept revenue;
6334
6335        /**
6336         * Code to identify the general type of benefits under which products and services are provided.
6337         */
6338        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
6339        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
6340        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
6341        protected CodeableConcept category;
6342
6343        /**
6344         * 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.
6345         */
6346        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
6347        @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." )
6348        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
6349        protected CodeableConcept productOrService;
6350
6351        /**
6352         * Item typification or modifiers codes to convey additional context for the product or service.
6353         */
6354        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6355        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
6356        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
6357        protected List<CodeableConcept> modifier;
6358
6359        /**
6360         * Identifies the program under which this may be recovered.
6361         */
6362        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6363        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
6364        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
6365        protected List<CodeableConcept> programCode;
6366
6367        /**
6368         * The number of repetitions of a service or product.
6369         */
6370        @Child(name = "quantity", type = {Quantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
6371        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
6372        protected Quantity quantity;
6373
6374        /**
6375         * 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.
6376         */
6377        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
6378        @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." )
6379        protected Money unitPrice;
6380
6381        /**
6382         * 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.
6383         */
6384        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
6385        @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." )
6386        protected DecimalType factor;
6387
6388        /**
6389         * The quantity times the unit price for an additional service or product or charge.
6390         */
6391        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
6392        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
6393        protected Money net;
6394
6395        /**
6396         * Unique Device Identifiers associated with this line item.
6397         */
6398        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6399        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
6400        protected List<Reference> udi;
6401
6402        /**
6403         * The numbers associated with notes below which apply to the adjudication of this item.
6404         */
6405        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6406        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
6407        protected List<PositiveIntType> noteNumber;
6408
6409        /**
6410         * The adjudication results.
6411         */
6412        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6413        @Description(shortDefinition="Subdetail level adjudication details", formalDefinition="The adjudication results." )
6414        protected List<AdjudicationComponent> adjudication;
6415
6416        private static final long serialVersionUID = -579551678L;
6417
6418    /**
6419     * Constructor
6420     */
6421      public SubDetailComponent() {
6422        super();
6423      }
6424
6425    /**
6426     * Constructor
6427     */
6428      public SubDetailComponent(int sequence, CodeableConcept productOrService) {
6429        super();
6430        this.setSequence(sequence);
6431        this.setProductOrService(productOrService);
6432      }
6433
6434        /**
6435         * @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
6436         */
6437        public PositiveIntType getSequenceElement() { 
6438          if (this.sequence == null)
6439            if (Configuration.errorOnAutoCreate())
6440              throw new Error("Attempt to auto-create SubDetailComponent.sequence");
6441            else if (Configuration.doAutoCreate())
6442              this.sequence = new PositiveIntType(); // bb
6443          return this.sequence;
6444        }
6445
6446        public boolean hasSequenceElement() { 
6447          return this.sequence != null && !this.sequence.isEmpty();
6448        }
6449
6450        public boolean hasSequence() { 
6451          return this.sequence != null && !this.sequence.isEmpty();
6452        }
6453
6454        /**
6455         * @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
6456         */
6457        public SubDetailComponent setSequenceElement(PositiveIntType value) { 
6458          this.sequence = value;
6459          return this;
6460        }
6461
6462        /**
6463         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6464         */
6465        public int getSequence() { 
6466          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
6467        }
6468
6469        /**
6470         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6471         */
6472        public SubDetailComponent setSequence(int value) { 
6473            if (this.sequence == null)
6474              this.sequence = new PositiveIntType();
6475            this.sequence.setValue(value);
6476          return this;
6477        }
6478
6479        /**
6480         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
6481         */
6482        public CodeableConcept getRevenue() { 
6483          if (this.revenue == null)
6484            if (Configuration.errorOnAutoCreate())
6485              throw new Error("Attempt to auto-create SubDetailComponent.revenue");
6486            else if (Configuration.doAutoCreate())
6487              this.revenue = new CodeableConcept(); // cc
6488          return this.revenue;
6489        }
6490
6491        public boolean hasRevenue() { 
6492          return this.revenue != null && !this.revenue.isEmpty();
6493        }
6494
6495        /**
6496         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
6497         */
6498        public SubDetailComponent setRevenue(CodeableConcept value) { 
6499          this.revenue = value;
6500          return this;
6501        }
6502
6503        /**
6504         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
6505         */
6506        public CodeableConcept getCategory() { 
6507          if (this.category == null)
6508            if (Configuration.errorOnAutoCreate())
6509              throw new Error("Attempt to auto-create SubDetailComponent.category");
6510            else if (Configuration.doAutoCreate())
6511              this.category = new CodeableConcept(); // cc
6512          return this.category;
6513        }
6514
6515        public boolean hasCategory() { 
6516          return this.category != null && !this.category.isEmpty();
6517        }
6518
6519        /**
6520         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
6521         */
6522        public SubDetailComponent setCategory(CodeableConcept value) { 
6523          this.category = value;
6524          return this;
6525        }
6526
6527        /**
6528         * @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.)
6529         */
6530        public CodeableConcept getProductOrService() { 
6531          if (this.productOrService == null)
6532            if (Configuration.errorOnAutoCreate())
6533              throw new Error("Attempt to auto-create SubDetailComponent.productOrService");
6534            else if (Configuration.doAutoCreate())
6535              this.productOrService = new CodeableConcept(); // cc
6536          return this.productOrService;
6537        }
6538
6539        public boolean hasProductOrService() { 
6540          return this.productOrService != null && !this.productOrService.isEmpty();
6541        }
6542
6543        /**
6544         * @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.)
6545         */
6546        public SubDetailComponent setProductOrService(CodeableConcept value) { 
6547          this.productOrService = value;
6548          return this;
6549        }
6550
6551        /**
6552         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
6553         */
6554        public List<CodeableConcept> getModifier() { 
6555          if (this.modifier == null)
6556            this.modifier = new ArrayList<CodeableConcept>();
6557          return this.modifier;
6558        }
6559
6560        /**
6561         * @return Returns a reference to <code>this</code> for easy method chaining
6562         */
6563        public SubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
6564          this.modifier = theModifier;
6565          return this;
6566        }
6567
6568        public boolean hasModifier() { 
6569          if (this.modifier == null)
6570            return false;
6571          for (CodeableConcept item : this.modifier)
6572            if (!item.isEmpty())
6573              return true;
6574          return false;
6575        }
6576
6577        public CodeableConcept addModifier() { //3
6578          CodeableConcept t = new CodeableConcept();
6579          if (this.modifier == null)
6580            this.modifier = new ArrayList<CodeableConcept>();
6581          this.modifier.add(t);
6582          return t;
6583        }
6584
6585        public SubDetailComponent addModifier(CodeableConcept t) { //3
6586          if (t == null)
6587            return this;
6588          if (this.modifier == null)
6589            this.modifier = new ArrayList<CodeableConcept>();
6590          this.modifier.add(t);
6591          return this;
6592        }
6593
6594        /**
6595         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
6596         */
6597        public CodeableConcept getModifierFirstRep() { 
6598          if (getModifier().isEmpty()) {
6599            addModifier();
6600          }
6601          return getModifier().get(0);
6602        }
6603
6604        /**
6605         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
6606         */
6607        public List<CodeableConcept> getProgramCode() { 
6608          if (this.programCode == null)
6609            this.programCode = new ArrayList<CodeableConcept>();
6610          return this.programCode;
6611        }
6612
6613        /**
6614         * @return Returns a reference to <code>this</code> for easy method chaining
6615         */
6616        public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
6617          this.programCode = theProgramCode;
6618          return this;
6619        }
6620
6621        public boolean hasProgramCode() { 
6622          if (this.programCode == null)
6623            return false;
6624          for (CodeableConcept item : this.programCode)
6625            if (!item.isEmpty())
6626              return true;
6627          return false;
6628        }
6629
6630        public CodeableConcept addProgramCode() { //3
6631          CodeableConcept t = new CodeableConcept();
6632          if (this.programCode == null)
6633            this.programCode = new ArrayList<CodeableConcept>();
6634          this.programCode.add(t);
6635          return t;
6636        }
6637
6638        public SubDetailComponent addProgramCode(CodeableConcept t) { //3
6639          if (t == null)
6640            return this;
6641          if (this.programCode == null)
6642            this.programCode = new ArrayList<CodeableConcept>();
6643          this.programCode.add(t);
6644          return this;
6645        }
6646
6647        /**
6648         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
6649         */
6650        public CodeableConcept getProgramCodeFirstRep() { 
6651          if (getProgramCode().isEmpty()) {
6652            addProgramCode();
6653          }
6654          return getProgramCode().get(0);
6655        }
6656
6657        /**
6658         * @return {@link #quantity} (The number of repetitions of a service or product.)
6659         */
6660        public Quantity getQuantity() { 
6661          if (this.quantity == null)
6662            if (Configuration.errorOnAutoCreate())
6663              throw new Error("Attempt to auto-create SubDetailComponent.quantity");
6664            else if (Configuration.doAutoCreate())
6665              this.quantity = new Quantity(); // cc
6666          return this.quantity;
6667        }
6668
6669        public boolean hasQuantity() { 
6670          return this.quantity != null && !this.quantity.isEmpty();
6671        }
6672
6673        /**
6674         * @param value {@link #quantity} (The number of repetitions of a service or product.)
6675         */
6676        public SubDetailComponent setQuantity(Quantity value) { 
6677          this.quantity = value;
6678          return this;
6679        }
6680
6681        /**
6682         * @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.)
6683         */
6684        public Money getUnitPrice() { 
6685          if (this.unitPrice == null)
6686            if (Configuration.errorOnAutoCreate())
6687              throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
6688            else if (Configuration.doAutoCreate())
6689              this.unitPrice = new Money(); // cc
6690          return this.unitPrice;
6691        }
6692
6693        public boolean hasUnitPrice() { 
6694          return this.unitPrice != null && !this.unitPrice.isEmpty();
6695        }
6696
6697        /**
6698         * @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.)
6699         */
6700        public SubDetailComponent setUnitPrice(Money value) { 
6701          this.unitPrice = value;
6702          return this;
6703        }
6704
6705        /**
6706         * @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
6707         */
6708        public DecimalType getFactorElement() { 
6709          if (this.factor == null)
6710            if (Configuration.errorOnAutoCreate())
6711              throw new Error("Attempt to auto-create SubDetailComponent.factor");
6712            else if (Configuration.doAutoCreate())
6713              this.factor = new DecimalType(); // bb
6714          return this.factor;
6715        }
6716
6717        public boolean hasFactorElement() { 
6718          return this.factor != null && !this.factor.isEmpty();
6719        }
6720
6721        public boolean hasFactor() { 
6722          return this.factor != null && !this.factor.isEmpty();
6723        }
6724
6725        /**
6726         * @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
6727         */
6728        public SubDetailComponent setFactorElement(DecimalType value) { 
6729          this.factor = value;
6730          return this;
6731        }
6732
6733        /**
6734         * @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.
6735         */
6736        public BigDecimal getFactor() { 
6737          return this.factor == null ? null : this.factor.getValue();
6738        }
6739
6740        /**
6741         * @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.
6742         */
6743        public SubDetailComponent setFactor(BigDecimal value) { 
6744          if (value == null)
6745            this.factor = null;
6746          else {
6747            if (this.factor == null)
6748              this.factor = new DecimalType();
6749            this.factor.setValue(value);
6750          }
6751          return this;
6752        }
6753
6754        /**
6755         * @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.
6756         */
6757        public SubDetailComponent setFactor(long value) { 
6758              this.factor = new DecimalType();
6759            this.factor.setValue(value);
6760          return this;
6761        }
6762
6763        /**
6764         * @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.
6765         */
6766        public SubDetailComponent setFactor(double value) { 
6767              this.factor = new DecimalType();
6768            this.factor.setValue(value);
6769          return this;
6770        }
6771
6772        /**
6773         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
6774         */
6775        public Money getNet() { 
6776          if (this.net == null)
6777            if (Configuration.errorOnAutoCreate())
6778              throw new Error("Attempt to auto-create SubDetailComponent.net");
6779            else if (Configuration.doAutoCreate())
6780              this.net = new Money(); // cc
6781          return this.net;
6782        }
6783
6784        public boolean hasNet() { 
6785          return this.net != null && !this.net.isEmpty();
6786        }
6787
6788        /**
6789         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
6790         */
6791        public SubDetailComponent setNet(Money value) { 
6792          this.net = value;
6793          return this;
6794        }
6795
6796        /**
6797         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
6798         */
6799        public List<Reference> getUdi() { 
6800          if (this.udi == null)
6801            this.udi = new ArrayList<Reference>();
6802          return this.udi;
6803        }
6804
6805        /**
6806         * @return Returns a reference to <code>this</code> for easy method chaining
6807         */
6808        public SubDetailComponent setUdi(List<Reference> theUdi) { 
6809          this.udi = theUdi;
6810          return this;
6811        }
6812
6813        public boolean hasUdi() { 
6814          if (this.udi == null)
6815            return false;
6816          for (Reference item : this.udi)
6817            if (!item.isEmpty())
6818              return true;
6819          return false;
6820        }
6821
6822        public Reference addUdi() { //3
6823          Reference t = new Reference();
6824          if (this.udi == null)
6825            this.udi = new ArrayList<Reference>();
6826          this.udi.add(t);
6827          return t;
6828        }
6829
6830        public SubDetailComponent addUdi(Reference t) { //3
6831          if (t == null)
6832            return this;
6833          if (this.udi == null)
6834            this.udi = new ArrayList<Reference>();
6835          this.udi.add(t);
6836          return this;
6837        }
6838
6839        /**
6840         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist {3}
6841         */
6842        public Reference getUdiFirstRep() { 
6843          if (getUdi().isEmpty()) {
6844            addUdi();
6845          }
6846          return getUdi().get(0);
6847        }
6848
6849        /**
6850         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6851         */
6852        public List<PositiveIntType> getNoteNumber() { 
6853          if (this.noteNumber == null)
6854            this.noteNumber = new ArrayList<PositiveIntType>();
6855          return this.noteNumber;
6856        }
6857
6858        /**
6859         * @return Returns a reference to <code>this</code> for easy method chaining
6860         */
6861        public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
6862          this.noteNumber = theNoteNumber;
6863          return this;
6864        }
6865
6866        public boolean hasNoteNumber() { 
6867          if (this.noteNumber == null)
6868            return false;
6869          for (PositiveIntType item : this.noteNumber)
6870            if (!item.isEmpty())
6871              return true;
6872          return false;
6873        }
6874
6875        /**
6876         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6877         */
6878        public PositiveIntType addNoteNumberElement() {//2 
6879          PositiveIntType t = new PositiveIntType();
6880          if (this.noteNumber == null)
6881            this.noteNumber = new ArrayList<PositiveIntType>();
6882          this.noteNumber.add(t);
6883          return t;
6884        }
6885
6886        /**
6887         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6888         */
6889        public SubDetailComponent addNoteNumber(int value) { //1
6890          PositiveIntType t = new PositiveIntType();
6891          t.setValue(value);
6892          if (this.noteNumber == null)
6893            this.noteNumber = new ArrayList<PositiveIntType>();
6894          this.noteNumber.add(t);
6895          return this;
6896        }
6897
6898        /**
6899         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6900         */
6901        public boolean hasNoteNumber(int value) { 
6902          if (this.noteNumber == null)
6903            return false;
6904          for (PositiveIntType v : this.noteNumber)
6905            if (v.getValue().equals(value)) // positiveInt
6906              return true;
6907          return false;
6908        }
6909
6910        /**
6911         * @return {@link #adjudication} (The adjudication results.)
6912         */
6913        public List<AdjudicationComponent> getAdjudication() { 
6914          if (this.adjudication == null)
6915            this.adjudication = new ArrayList<AdjudicationComponent>();
6916          return this.adjudication;
6917        }
6918
6919        /**
6920         * @return Returns a reference to <code>this</code> for easy method chaining
6921         */
6922        public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
6923          this.adjudication = theAdjudication;
6924          return this;
6925        }
6926
6927        public boolean hasAdjudication() { 
6928          if (this.adjudication == null)
6929            return false;
6930          for (AdjudicationComponent item : this.adjudication)
6931            if (!item.isEmpty())
6932              return true;
6933          return false;
6934        }
6935
6936        public AdjudicationComponent addAdjudication() { //3
6937          AdjudicationComponent t = new AdjudicationComponent();
6938          if (this.adjudication == null)
6939            this.adjudication = new ArrayList<AdjudicationComponent>();
6940          this.adjudication.add(t);
6941          return t;
6942        }
6943
6944        public SubDetailComponent addAdjudication(AdjudicationComponent t) { //3
6945          if (t == null)
6946            return this;
6947          if (this.adjudication == null)
6948            this.adjudication = new ArrayList<AdjudicationComponent>();
6949          this.adjudication.add(t);
6950          return this;
6951        }
6952
6953        /**
6954         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
6955         */
6956        public AdjudicationComponent getAdjudicationFirstRep() { 
6957          if (getAdjudication().isEmpty()) {
6958            addAdjudication();
6959          }
6960          return getAdjudication().get(0);
6961        }
6962
6963        protected void listChildren(List<Property> children) {
6964          super.listChildren(children);
6965          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));
6966          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
6967          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
6968          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));
6969          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));
6970          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
6971          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
6972          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));
6973          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));
6974          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
6975          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
6976          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));
6977          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6978        }
6979
6980        @Override
6981        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6982          switch (_hash) {
6983          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);
6984          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
6985          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);
6986          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);
6987          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);
6988          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
6989          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
6990          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);
6991          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);
6992          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);
6993          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
6994          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);
6995          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
6996          default: return super.getNamedProperty(_hash, _name, _checkValid);
6997          }
6998
6999        }
7000
7001      @Override
7002      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7003        switch (hash) {
7004        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
7005        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
7006        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
7007        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
7008        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7009        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
7010        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
7011        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
7012        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
7013        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
7014        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
7015        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
7016        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
7017        default: return super.getProperty(hash, name, checkValid);
7018        }
7019
7020      }
7021
7022      @Override
7023      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7024        switch (hash) {
7025        case 1349547969: // sequence
7026          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
7027          return value;
7028        case 1099842588: // revenue
7029          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7030          return value;
7031        case 50511102: // category
7032          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7033          return value;
7034        case 1957227299: // productOrService
7035          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7036          return value;
7037        case -615513385: // modifier
7038          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
7039          return value;
7040        case 1010065041: // programCode
7041          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
7042          return value;
7043        case -1285004149: // quantity
7044          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
7045          return value;
7046        case -486196699: // unitPrice
7047          this.unitPrice = TypeConvertor.castToMoney(value); // Money
7048          return value;
7049        case -1282148017: // factor
7050          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
7051          return value;
7052        case 108957: // net
7053          this.net = TypeConvertor.castToMoney(value); // Money
7054          return value;
7055        case 115642: // udi
7056          this.getUdi().add(TypeConvertor.castToReference(value)); // Reference
7057          return value;
7058        case -1110033957: // noteNumber
7059          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
7060          return value;
7061        case -231349275: // adjudication
7062          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7063          return value;
7064        default: return super.setProperty(hash, name, value);
7065        }
7066
7067      }
7068
7069      @Override
7070      public Base setProperty(String name, Base value) throws FHIRException {
7071        if (name.equals("sequence")) {
7072          this.sequence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
7073        } else if (name.equals("revenue")) {
7074          this.revenue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7075        } else if (name.equals("category")) {
7076          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7077        } else if (name.equals("productOrService")) {
7078          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
7079        } else if (name.equals("modifier")) {
7080          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
7081        } else if (name.equals("programCode")) {
7082          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value));
7083        } else if (name.equals("quantity")) {
7084          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
7085        } else if (name.equals("unitPrice")) {
7086          this.unitPrice = TypeConvertor.castToMoney(value); // Money
7087        } else if (name.equals("factor")) {
7088          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
7089        } else if (name.equals("net")) {
7090          this.net = TypeConvertor.castToMoney(value); // Money
7091        } else if (name.equals("udi")) {
7092          this.getUdi().add(TypeConvertor.castToReference(value));
7093        } else if (name.equals("noteNumber")) {
7094          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
7095        } else if (name.equals("adjudication")) {
7096          this.getAdjudication().add((AdjudicationComponent) value);
7097        } else
7098          return super.setProperty(name, value);
7099        return value;
7100      }
7101
7102      @Override
7103      public Base makeProperty(int hash, String name) throws FHIRException {
7104        switch (hash) {
7105        case 1349547969:  return getSequenceElement();
7106        case 1099842588:  return getRevenue();
7107        case 50511102:  return getCategory();
7108        case 1957227299:  return getProductOrService();
7109        case -615513385:  return addModifier(); 
7110        case 1010065041:  return addProgramCode(); 
7111        case -1285004149:  return getQuantity();
7112        case -486196699:  return getUnitPrice();
7113        case -1282148017:  return getFactorElement();
7114        case 108957:  return getNet();
7115        case 115642:  return addUdi(); 
7116        case -1110033957:  return addNoteNumberElement();
7117        case -231349275:  return addAdjudication(); 
7118        default: return super.makeProperty(hash, name);
7119        }
7120
7121      }
7122
7123      @Override
7124      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7125        switch (hash) {
7126        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
7127        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
7128        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
7129        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
7130        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
7131        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
7132        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
7133        case -486196699: /*unitPrice*/ return new String[] {"Money"};
7134        case -1282148017: /*factor*/ return new String[] {"decimal"};
7135        case 108957: /*net*/ return new String[] {"Money"};
7136        case 115642: /*udi*/ return new String[] {"Reference"};
7137        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
7138        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
7139        default: return super.getTypesForProperty(hash, name);
7140        }
7141
7142      }
7143
7144      @Override
7145      public Base addChild(String name) throws FHIRException {
7146        if (name.equals("sequence")) {
7147          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.subDetail.sequence");
7148        }
7149        else if (name.equals("revenue")) {
7150          this.revenue = new CodeableConcept();
7151          return this.revenue;
7152        }
7153        else if (name.equals("category")) {
7154          this.category = new CodeableConcept();
7155          return this.category;
7156        }
7157        else if (name.equals("productOrService")) {
7158          this.productOrService = new CodeableConcept();
7159          return this.productOrService;
7160        }
7161        else if (name.equals("modifier")) {
7162          return addModifier();
7163        }
7164        else if (name.equals("programCode")) {
7165          return addProgramCode();
7166        }
7167        else if (name.equals("quantity")) {
7168          this.quantity = new Quantity();
7169          return this.quantity;
7170        }
7171        else if (name.equals("unitPrice")) {
7172          this.unitPrice = new Money();
7173          return this.unitPrice;
7174        }
7175        else if (name.equals("factor")) {
7176          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.subDetail.factor");
7177        }
7178        else if (name.equals("net")) {
7179          this.net = new Money();
7180          return this.net;
7181        }
7182        else if (name.equals("udi")) {
7183          return addUdi();
7184        }
7185        else if (name.equals("noteNumber")) {
7186          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.item.detail.subDetail.noteNumber");
7187        }
7188        else if (name.equals("adjudication")) {
7189          return addAdjudication();
7190        }
7191        else
7192          return super.addChild(name);
7193      }
7194
7195      public SubDetailComponent copy() {
7196        SubDetailComponent dst = new SubDetailComponent();
7197        copyValues(dst);
7198        return dst;
7199      }
7200
7201      public void copyValues(SubDetailComponent dst) {
7202        super.copyValues(dst);
7203        dst.sequence = sequence == null ? null : sequence.copy();
7204        dst.revenue = revenue == null ? null : revenue.copy();
7205        dst.category = category == null ? null : category.copy();
7206        dst.productOrService = productOrService == null ? null : productOrService.copy();
7207        if (modifier != null) {
7208          dst.modifier = new ArrayList<CodeableConcept>();
7209          for (CodeableConcept i : modifier)
7210            dst.modifier.add(i.copy());
7211        };
7212        if (programCode != null) {
7213          dst.programCode = new ArrayList<CodeableConcept>();
7214          for (CodeableConcept i : programCode)
7215            dst.programCode.add(i.copy());
7216        };
7217        dst.quantity = quantity == null ? null : quantity.copy();
7218        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7219        dst.factor = factor == null ? null : factor.copy();
7220        dst.net = net == null ? null : net.copy();
7221        if (udi != null) {
7222          dst.udi = new ArrayList<Reference>();
7223          for (Reference i : udi)
7224            dst.udi.add(i.copy());
7225        };
7226        if (noteNumber != null) {
7227          dst.noteNumber = new ArrayList<PositiveIntType>();
7228          for (PositiveIntType i : noteNumber)
7229            dst.noteNumber.add(i.copy());
7230        };
7231        if (adjudication != null) {
7232          dst.adjudication = new ArrayList<AdjudicationComponent>();
7233          for (AdjudicationComponent i : adjudication)
7234            dst.adjudication.add(i.copy());
7235        };
7236      }
7237
7238      @Override
7239      public boolean equalsDeep(Base other_) {
7240        if (!super.equalsDeep(other_))
7241          return false;
7242        if (!(other_ instanceof SubDetailComponent))
7243          return false;
7244        SubDetailComponent o = (SubDetailComponent) other_;
7245        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
7246           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
7247           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
7248           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
7249           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
7250          ;
7251      }
7252
7253      @Override
7254      public boolean equalsShallow(Base other_) {
7255        if (!super.equalsShallow(other_))
7256          return false;
7257        if (!(other_ instanceof SubDetailComponent))
7258          return false;
7259        SubDetailComponent o = (SubDetailComponent) other_;
7260        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
7261          ;
7262      }
7263
7264      public boolean isEmpty() {
7265        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
7266          , productOrService, modifier, programCode, quantity, unitPrice, factor, net, udi
7267          , noteNumber, adjudication);
7268      }
7269
7270  public String fhirType() {
7271    return "ExplanationOfBenefit.item.detail.subDetail";
7272
7273  }
7274
7275  }
7276
7277    @Block()
7278    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
7279        /**
7280         * Claim items which this service line is intended to replace.
7281         */
7282        @Child(name = "itemSequence", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7283        @Description(shortDefinition="Item sequence number", formalDefinition="Claim items which this service line is intended to replace." )
7284        protected List<PositiveIntType> itemSequence;
7285
7286        /**
7287         * The sequence number of the details within the claim item which this line is intended to replace.
7288         */
7289        @Child(name = "detailSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7290        @Description(shortDefinition="Detail sequence number", formalDefinition="The sequence number of the details within the claim item which this line is intended to replace." )
7291        protected List<PositiveIntType> detailSequence;
7292
7293        /**
7294         * The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.
7295         */
7296        @Child(name = "subDetailSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7297        @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." )
7298        protected List<PositiveIntType> subDetailSequence;
7299
7300        /**
7301         * The providers who are authorized for the services rendered to the patient.
7302         */
7303        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7304        @Description(shortDefinition="Authorized providers", formalDefinition="The providers who are authorized for the services rendered to the patient." )
7305        protected List<Reference> provider;
7306
7307        /**
7308         * 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.
7309         */
7310        @Child(name = "productOrService", type = {CodeableConcept.class}, order=5, min=1, max=1, modifier=false, summary=false)
7311        @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." )
7312        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
7313        protected CodeableConcept productOrService;
7314
7315        /**
7316         * Item typification or modifiers codes to convey additional context for the product or service.
7317         */
7318        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7319        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
7320        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
7321        protected List<CodeableConcept> modifier;
7322
7323        /**
7324         * Identifies the program under which this may be recovered.
7325         */
7326        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7327        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
7328        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
7329        protected List<CodeableConcept> programCode;
7330
7331        /**
7332         * The date or dates when the service or product was supplied, performed or completed.
7333         */
7334        @Child(name = "serviced", type = {DateType.class, Period.class}, order=8, min=0, max=1, modifier=false, summary=false)
7335        @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." )
7336        protected DataType serviced;
7337
7338        /**
7339         * Where the product or service was provided.
7340         */
7341        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=9, min=0, max=1, modifier=false, summary=false)
7342        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
7343        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
7344        protected DataType location;
7345
7346        /**
7347         * The number of repetitions of a service or product.
7348         */
7349        @Child(name = "quantity", type = {Quantity.class}, order=10, min=0, max=1, modifier=false, summary=false)
7350        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
7351        protected Quantity quantity;
7352
7353        /**
7354         * 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.
7355         */
7356        @Child(name = "unitPrice", type = {Money.class}, order=11, min=0, max=1, modifier=false, summary=false)
7357        @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." )
7358        protected Money unitPrice;
7359
7360        /**
7361         * 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.
7362         */
7363        @Child(name = "factor", type = {DecimalType.class}, order=12, min=0, max=1, modifier=false, summary=false)
7364        @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." )
7365        protected DecimalType factor;
7366
7367        /**
7368         * The quantity times the unit price for an additional service or product or charge.
7369         */
7370        @Child(name = "net", type = {Money.class}, order=13, min=0, max=1, modifier=false, summary=false)
7371        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
7372        protected Money net;
7373
7374        /**
7375         * Physical service site on the patient (limb, tooth, etc.).
7376         */
7377        @Child(name = "bodySite", type = {CodeableConcept.class}, order=14, min=0, max=1, modifier=false, summary=false)
7378        @Description(shortDefinition="Anatomical location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
7379        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
7380        protected CodeableConcept bodySite;
7381
7382        /**
7383         * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
7384         */
7385        @Child(name = "subSite", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7386        @Description(shortDefinition="Anatomical sub-location", formalDefinition="A region or surface of the bodySite, e.g. limb region or tooth surface(s)." )
7387        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
7388        protected List<CodeableConcept> subSite;
7389
7390        /**
7391         * The numbers associated with notes below which apply to the adjudication of this item.
7392         */
7393        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7394        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
7395        protected List<PositiveIntType> noteNumber;
7396
7397        /**
7398         * The adjudication results.
7399         */
7400        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7401        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
7402        protected List<AdjudicationComponent> adjudication;
7403
7404        /**
7405         * The second-tier service adjudications for payor added services.
7406         */
7407        @Child(name = "detail", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7408        @Description(shortDefinition="Insurer added line items", formalDefinition="The second-tier service adjudications for payor added services." )
7409        protected List<AddedItemDetailComponent> detail;
7410
7411        private static final long serialVersionUID = 2055842184L;
7412
7413    /**
7414     * Constructor
7415     */
7416      public AddedItemComponent() {
7417        super();
7418      }
7419
7420    /**
7421     * Constructor
7422     */
7423      public AddedItemComponent(CodeableConcept productOrService) {
7424        super();
7425        this.setProductOrService(productOrService);
7426      }
7427
7428        /**
7429         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
7430         */
7431        public List<PositiveIntType> getItemSequence() { 
7432          if (this.itemSequence == null)
7433            this.itemSequence = new ArrayList<PositiveIntType>();
7434          return this.itemSequence;
7435        }
7436
7437        /**
7438         * @return Returns a reference to <code>this</code> for easy method chaining
7439         */
7440        public AddedItemComponent setItemSequence(List<PositiveIntType> theItemSequence) { 
7441          this.itemSequence = theItemSequence;
7442          return this;
7443        }
7444
7445        public boolean hasItemSequence() { 
7446          if (this.itemSequence == null)
7447            return false;
7448          for (PositiveIntType item : this.itemSequence)
7449            if (!item.isEmpty())
7450              return true;
7451          return false;
7452        }
7453
7454        /**
7455         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
7456         */
7457        public PositiveIntType addItemSequenceElement() {//2 
7458          PositiveIntType t = new PositiveIntType();
7459          if (this.itemSequence == null)
7460            this.itemSequence = new ArrayList<PositiveIntType>();
7461          this.itemSequence.add(t);
7462          return t;
7463        }
7464
7465        /**
7466         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
7467         */
7468        public AddedItemComponent addItemSequence(int value) { //1
7469          PositiveIntType t = new PositiveIntType();
7470          t.setValue(value);
7471          if (this.itemSequence == null)
7472            this.itemSequence = new ArrayList<PositiveIntType>();
7473          this.itemSequence.add(t);
7474          return this;
7475        }
7476
7477        /**
7478         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
7479         */
7480        public boolean hasItemSequence(int value) { 
7481          if (this.itemSequence == null)
7482            return false;
7483          for (PositiveIntType v : this.itemSequence)
7484            if (v.getValue().equals(value)) // positiveInt
7485              return true;
7486          return false;
7487        }
7488
7489        /**
7490         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7491         */
7492        public List<PositiveIntType> getDetailSequence() { 
7493          if (this.detailSequence == null)
7494            this.detailSequence = new ArrayList<PositiveIntType>();
7495          return this.detailSequence;
7496        }
7497
7498        /**
7499         * @return Returns a reference to <code>this</code> for easy method chaining
7500         */
7501        public AddedItemComponent setDetailSequence(List<PositiveIntType> theDetailSequence) { 
7502          this.detailSequence = theDetailSequence;
7503          return this;
7504        }
7505
7506        public boolean hasDetailSequence() { 
7507          if (this.detailSequence == null)
7508            return false;
7509          for (PositiveIntType item : this.detailSequence)
7510            if (!item.isEmpty())
7511              return true;
7512          return false;
7513        }
7514
7515        /**
7516         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7517         */
7518        public PositiveIntType addDetailSequenceElement() {//2 
7519          PositiveIntType t = new PositiveIntType();
7520          if (this.detailSequence == null)
7521            this.detailSequence = new ArrayList<PositiveIntType>();
7522          this.detailSequence.add(t);
7523          return t;
7524        }
7525
7526        /**
7527         * @param value {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7528         */
7529        public AddedItemComponent addDetailSequence(int value) { //1
7530          PositiveIntType t = new PositiveIntType();
7531          t.setValue(value);
7532          if (this.detailSequence == null)
7533            this.detailSequence = new ArrayList<PositiveIntType>();
7534          this.detailSequence.add(t);
7535          return this;
7536        }
7537
7538        /**
7539         * @param value {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7540         */
7541        public boolean hasDetailSequence(int value) { 
7542          if (this.detailSequence == null)
7543            return false;
7544          for (PositiveIntType v : this.detailSequence)
7545            if (v.getValue().equals(value)) // positiveInt
7546              return true;
7547          return false;
7548        }
7549
7550        /**
7551         * @return {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
7552         */
7553        public List<PositiveIntType> getSubDetailSequence() { 
7554          if (this.subDetailSequence == null)
7555            this.subDetailSequence = new ArrayList<PositiveIntType>();
7556          return this.subDetailSequence;
7557        }
7558
7559        /**
7560         * @return Returns a reference to <code>this</code> for easy method chaining
7561         */
7562        public AddedItemComponent setSubDetailSequence(List<PositiveIntType> theSubDetailSequence) { 
7563          this.subDetailSequence = theSubDetailSequence;
7564          return this;
7565        }
7566
7567        public boolean hasSubDetailSequence() { 
7568          if (this.subDetailSequence == null)
7569            return false;
7570          for (PositiveIntType item : this.subDetailSequence)
7571            if (!item.isEmpty())
7572              return true;
7573          return false;
7574        }
7575
7576        /**
7577         * @return {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
7578         */
7579        public PositiveIntType addSubDetailSequenceElement() {//2 
7580          PositiveIntType t = new PositiveIntType();
7581          if (this.subDetailSequence == null)
7582            this.subDetailSequence = new ArrayList<PositiveIntType>();
7583          this.subDetailSequence.add(t);
7584          return t;
7585        }
7586
7587        /**
7588         * @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.)
7589         */
7590        public AddedItemComponent addSubDetailSequence(int value) { //1
7591          PositiveIntType t = new PositiveIntType();
7592          t.setValue(value);
7593          if (this.subDetailSequence == null)
7594            this.subDetailSequence = new ArrayList<PositiveIntType>();
7595          this.subDetailSequence.add(t);
7596          return this;
7597        }
7598
7599        /**
7600         * @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.)
7601         */
7602        public boolean hasSubDetailSequence(int value) { 
7603          if (this.subDetailSequence == null)
7604            return false;
7605          for (PositiveIntType v : this.subDetailSequence)
7606            if (v.getValue().equals(value)) // positiveInt
7607              return true;
7608          return false;
7609        }
7610
7611        /**
7612         * @return {@link #provider} (The providers who are authorized for the services rendered to the patient.)
7613         */
7614        public List<Reference> getProvider() { 
7615          if (this.provider == null)
7616            this.provider = new ArrayList<Reference>();
7617          return this.provider;
7618        }
7619
7620        /**
7621         * @return Returns a reference to <code>this</code> for easy method chaining
7622         */
7623        public AddedItemComponent setProvider(List<Reference> theProvider) { 
7624          this.provider = theProvider;
7625          return this;
7626        }
7627
7628        public boolean hasProvider() { 
7629          if (this.provider == null)
7630            return false;
7631          for (Reference item : this.provider)
7632            if (!item.isEmpty())
7633              return true;
7634          return false;
7635        }
7636
7637        public Reference addProvider() { //3
7638          Reference t = new Reference();
7639          if (this.provider == null)
7640            this.provider = new ArrayList<Reference>();
7641          this.provider.add(t);
7642          return t;
7643        }
7644
7645        public AddedItemComponent addProvider(Reference t) { //3
7646          if (t == null)
7647            return this;
7648          if (this.provider == null)
7649            this.provider = new ArrayList<Reference>();
7650          this.provider.add(t);
7651          return this;
7652        }
7653
7654        /**
7655         * @return The first repetition of repeating field {@link #provider}, creating it if it does not already exist {3}
7656         */
7657        public Reference getProviderFirstRep() { 
7658          if (getProvider().isEmpty()) {
7659            addProvider();
7660          }
7661          return getProvider().get(0);
7662        }
7663
7664        /**
7665         * @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.)
7666         */
7667        public CodeableConcept getProductOrService() { 
7668          if (this.productOrService == null)
7669            if (Configuration.errorOnAutoCreate())
7670              throw new Error("Attempt to auto-create AddedItemComponent.productOrService");
7671            else if (Configuration.doAutoCreate())
7672              this.productOrService = new CodeableConcept(); // cc
7673          return this.productOrService;
7674        }
7675
7676        public boolean hasProductOrService() { 
7677          return this.productOrService != null && !this.productOrService.isEmpty();
7678        }
7679
7680        /**
7681         * @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.)
7682         */
7683        public AddedItemComponent setProductOrService(CodeableConcept value) { 
7684          this.productOrService = value;
7685          return this;
7686        }
7687
7688        /**
7689         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
7690         */
7691        public List<CodeableConcept> getModifier() { 
7692          if (this.modifier == null)
7693            this.modifier = new ArrayList<CodeableConcept>();
7694          return this.modifier;
7695        }
7696
7697        /**
7698         * @return Returns a reference to <code>this</code> for easy method chaining
7699         */
7700        public AddedItemComponent setModifier(List<CodeableConcept> theModifier) { 
7701          this.modifier = theModifier;
7702          return this;
7703        }
7704
7705        public boolean hasModifier() { 
7706          if (this.modifier == null)
7707            return false;
7708          for (CodeableConcept item : this.modifier)
7709            if (!item.isEmpty())
7710              return true;
7711          return false;
7712        }
7713
7714        public CodeableConcept addModifier() { //3
7715          CodeableConcept t = new CodeableConcept();
7716          if (this.modifier == null)
7717            this.modifier = new ArrayList<CodeableConcept>();
7718          this.modifier.add(t);
7719          return t;
7720        }
7721
7722        public AddedItemComponent addModifier(CodeableConcept t) { //3
7723          if (t == null)
7724            return this;
7725          if (this.modifier == null)
7726            this.modifier = new ArrayList<CodeableConcept>();
7727          this.modifier.add(t);
7728          return this;
7729        }
7730
7731        /**
7732         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
7733         */
7734        public CodeableConcept getModifierFirstRep() { 
7735          if (getModifier().isEmpty()) {
7736            addModifier();
7737          }
7738          return getModifier().get(0);
7739        }
7740
7741        /**
7742         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
7743         */
7744        public List<CodeableConcept> getProgramCode() { 
7745          if (this.programCode == null)
7746            this.programCode = new ArrayList<CodeableConcept>();
7747          return this.programCode;
7748        }
7749
7750        /**
7751         * @return Returns a reference to <code>this</code> for easy method chaining
7752         */
7753        public AddedItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
7754          this.programCode = theProgramCode;
7755          return this;
7756        }
7757
7758        public boolean hasProgramCode() { 
7759          if (this.programCode == null)
7760            return false;
7761          for (CodeableConcept item : this.programCode)
7762            if (!item.isEmpty())
7763              return true;
7764          return false;
7765        }
7766
7767        public CodeableConcept addProgramCode() { //3
7768          CodeableConcept t = new CodeableConcept();
7769          if (this.programCode == null)
7770            this.programCode = new ArrayList<CodeableConcept>();
7771          this.programCode.add(t);
7772          return t;
7773        }
7774
7775        public AddedItemComponent addProgramCode(CodeableConcept t) { //3
7776          if (t == null)
7777            return this;
7778          if (this.programCode == null)
7779            this.programCode = new ArrayList<CodeableConcept>();
7780          this.programCode.add(t);
7781          return this;
7782        }
7783
7784        /**
7785         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist {3}
7786         */
7787        public CodeableConcept getProgramCodeFirstRep() { 
7788          if (getProgramCode().isEmpty()) {
7789            addProgramCode();
7790          }
7791          return getProgramCode().get(0);
7792        }
7793
7794        /**
7795         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
7796         */
7797        public DataType getServiced() { 
7798          return this.serviced;
7799        }
7800
7801        /**
7802         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
7803         */
7804        public DateType getServicedDateType() throws FHIRException { 
7805          if (this.serviced == null)
7806            this.serviced = new DateType();
7807          if (!(this.serviced instanceof DateType))
7808            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
7809          return (DateType) this.serviced;
7810        }
7811
7812        public boolean hasServicedDateType() { 
7813          return this != null && this.serviced instanceof DateType;
7814        }
7815
7816        /**
7817         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
7818         */
7819        public Period getServicedPeriod() throws FHIRException { 
7820          if (this.serviced == null)
7821            this.serviced = new Period();
7822          if (!(this.serviced instanceof Period))
7823            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
7824          return (Period) this.serviced;
7825        }
7826
7827        public boolean hasServicedPeriod() { 
7828          return this != null && this.serviced instanceof Period;
7829        }
7830
7831        public boolean hasServiced() { 
7832          return this.serviced != null && !this.serviced.isEmpty();
7833        }
7834
7835        /**
7836         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
7837         */
7838        public AddedItemComponent setServiced(DataType value) { 
7839          if (value != null && !(value instanceof DateType || value instanceof Period))
7840            throw new Error("Not the right type for ExplanationOfBenefit.addItem.serviced[x]: "+value.fhirType());
7841          this.serviced = value;
7842          return this;
7843        }
7844
7845        /**
7846         * @return {@link #location} (Where the product or service was provided.)
7847         */
7848        public DataType getLocation() { 
7849          return this.location;
7850        }
7851
7852        /**
7853         * @return {@link #location} (Where the product or service was provided.)
7854         */
7855        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
7856          if (this.location == null)
7857            this.location = new CodeableConcept();
7858          if (!(this.location instanceof CodeableConcept))
7859            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
7860          return (CodeableConcept) this.location;
7861        }
7862
7863        public boolean hasLocationCodeableConcept() { 
7864          return this != null && this.location instanceof CodeableConcept;
7865        }
7866
7867        /**
7868         * @return {@link #location} (Where the product or service was provided.)
7869         */
7870        public Address getLocationAddress() throws FHIRException { 
7871          if (this.location == null)
7872            this.location = new Address();
7873          if (!(this.location instanceof Address))
7874            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
7875          return (Address) this.location;
7876        }
7877
7878        public boolean hasLocationAddress() { 
7879          return this != null && this.location instanceof Address;
7880        }
7881
7882        /**
7883         * @return {@link #location} (Where the product or service was provided.)
7884         */
7885        public Reference getLocationReference() throws FHIRException { 
7886          if (this.location == null)
7887            this.location = new Reference();
7888          if (!(this.location instanceof Reference))
7889            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
7890          return (Reference) this.location;
7891        }
7892
7893        public boolean hasLocationReference() { 
7894          return this != null && this.location instanceof Reference;
7895        }
7896
7897        public boolean hasLocation() { 
7898          return this.location != null && !this.location.isEmpty();
7899        }
7900
7901        /**
7902         * @param value {@link #location} (Where the product or service was provided.)
7903         */
7904        public AddedItemComponent setLocation(DataType value) { 
7905          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
7906            throw new Error("Not the right type for ExplanationOfBenefit.addItem.location[x]: "+value.fhirType());
7907          this.location = value;
7908          return this;
7909        }
7910
7911        /**
7912         * @return {@link #quantity} (The number of repetitions of a service or product.)
7913         */
7914        public Quantity getQuantity() { 
7915          if (this.quantity == null)
7916            if (Configuration.errorOnAutoCreate())
7917              throw new Error("Attempt to auto-create AddedItemComponent.quantity");
7918            else if (Configuration.doAutoCreate())
7919              this.quantity = new Quantity(); // cc
7920          return this.quantity;
7921        }
7922
7923        public boolean hasQuantity() { 
7924          return this.quantity != null && !this.quantity.isEmpty();
7925        }
7926
7927        /**
7928         * @param value {@link #quantity} (The number of repetitions of a service or product.)
7929         */
7930        public AddedItemComponent setQuantity(Quantity value) { 
7931          this.quantity = value;
7932          return this;
7933        }
7934
7935        /**
7936         * @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.)
7937         */
7938        public Money getUnitPrice() { 
7939          if (this.unitPrice == null)
7940            if (Configuration.errorOnAutoCreate())
7941              throw new Error("Attempt to auto-create AddedItemComponent.unitPrice");
7942            else if (Configuration.doAutoCreate())
7943              this.unitPrice = new Money(); // cc
7944          return this.unitPrice;
7945        }
7946
7947        public boolean hasUnitPrice() { 
7948          return this.unitPrice != null && !this.unitPrice.isEmpty();
7949        }
7950
7951        /**
7952         * @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.)
7953         */
7954        public AddedItemComponent setUnitPrice(Money value) { 
7955          this.unitPrice = value;
7956          return this;
7957        }
7958
7959        /**
7960         * @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
7961         */
7962        public DecimalType getFactorElement() { 
7963          if (this.factor == null)
7964            if (Configuration.errorOnAutoCreate())
7965              throw new Error("Attempt to auto-create AddedItemComponent.factor");
7966            else if (Configuration.doAutoCreate())
7967              this.factor = new DecimalType(); // bb
7968          return this.factor;
7969        }
7970
7971        public boolean hasFactorElement() { 
7972          return this.factor != null && !this.factor.isEmpty();
7973        }
7974
7975        public boolean hasFactor() { 
7976          return this.factor != null && !this.factor.isEmpty();
7977        }
7978
7979        /**
7980         * @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
7981         */
7982        public AddedItemComponent setFactorElement(DecimalType value) { 
7983          this.factor = value;
7984          return this;
7985        }
7986
7987        /**
7988         * @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.
7989         */
7990        public BigDecimal getFactor() { 
7991          return this.factor == null ? null : this.factor.getValue();
7992        }
7993
7994        /**
7995         * @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.
7996         */
7997        public AddedItemComponent setFactor(BigDecimal value) { 
7998          if (value == null)
7999            this.factor = null;
8000          else {
8001            if (this.factor == null)
8002              this.factor = new DecimalType();
8003            this.factor.setValue(value);
8004          }
8005          return this;
8006        }
8007
8008        /**
8009         * @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.
8010         */
8011        public AddedItemComponent setFactor(long value) { 
8012              this.factor = new DecimalType();
8013            this.factor.setValue(value);
8014          return this;
8015        }
8016
8017        /**
8018         * @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.
8019         */
8020        public AddedItemComponent setFactor(double value) { 
8021              this.factor = new DecimalType();
8022            this.factor.setValue(value);
8023          return this;
8024        }
8025
8026        /**
8027         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8028         */
8029        public Money getNet() { 
8030          if (this.net == null)
8031            if (Configuration.errorOnAutoCreate())
8032              throw new Error("Attempt to auto-create AddedItemComponent.net");
8033            else if (Configuration.doAutoCreate())
8034              this.net = new Money(); // cc
8035          return this.net;
8036        }
8037
8038        public boolean hasNet() { 
8039          return this.net != null && !this.net.isEmpty();
8040        }
8041
8042        /**
8043         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8044         */
8045        public AddedItemComponent setNet(Money value) { 
8046          this.net = value;
8047          return this;
8048        }
8049
8050        /**
8051         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
8052         */
8053        public CodeableConcept getBodySite() { 
8054          if (this.bodySite == null)
8055            if (Configuration.errorOnAutoCreate())
8056              throw new Error("Attempt to auto-create AddedItemComponent.bodySite");
8057            else if (Configuration.doAutoCreate())
8058              this.bodySite = new CodeableConcept(); // cc
8059          return this.bodySite;
8060        }
8061
8062        public boolean hasBodySite() { 
8063          return this.bodySite != null && !this.bodySite.isEmpty();
8064        }
8065
8066        /**
8067         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
8068         */
8069        public AddedItemComponent setBodySite(CodeableConcept value) { 
8070          this.bodySite = value;
8071          return this;
8072        }
8073
8074        /**
8075         * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb region or tooth surface(s).)
8076         */
8077        public List<CodeableConcept> getSubSite() { 
8078          if (this.subSite == null)
8079            this.subSite = new ArrayList<CodeableConcept>();
8080          return this.subSite;
8081        }
8082
8083        /**
8084         * @return Returns a reference to <code>this</code> for easy method chaining
8085         */
8086        public AddedItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
8087          this.subSite = theSubSite;
8088          return this;
8089        }
8090
8091        public boolean hasSubSite() { 
8092          if (this.subSite == null)
8093            return false;
8094          for (CodeableConcept item : this.subSite)
8095            if (!item.isEmpty())
8096              return true;
8097          return false;
8098        }
8099
8100        public CodeableConcept addSubSite() { //3
8101          CodeableConcept t = new CodeableConcept();
8102          if (this.subSite == null)
8103            this.subSite = new ArrayList<CodeableConcept>();
8104          this.subSite.add(t);
8105          return t;
8106        }
8107
8108        public AddedItemComponent addSubSite(CodeableConcept t) { //3
8109          if (t == null)
8110            return this;
8111          if (this.subSite == null)
8112            this.subSite = new ArrayList<CodeableConcept>();
8113          this.subSite.add(t);
8114          return this;
8115        }
8116
8117        /**
8118         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist {3}
8119         */
8120        public CodeableConcept getSubSiteFirstRep() { 
8121          if (getSubSite().isEmpty()) {
8122            addSubSite();
8123          }
8124          return getSubSite().get(0);
8125        }
8126
8127        /**
8128         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8129         */
8130        public List<PositiveIntType> getNoteNumber() { 
8131          if (this.noteNumber == null)
8132            this.noteNumber = new ArrayList<PositiveIntType>();
8133          return this.noteNumber;
8134        }
8135
8136        /**
8137         * @return Returns a reference to <code>this</code> for easy method chaining
8138         */
8139        public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
8140          this.noteNumber = theNoteNumber;
8141          return this;
8142        }
8143
8144        public boolean hasNoteNumber() { 
8145          if (this.noteNumber == null)
8146            return false;
8147          for (PositiveIntType item : this.noteNumber)
8148            if (!item.isEmpty())
8149              return true;
8150          return false;
8151        }
8152
8153        /**
8154         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8155         */
8156        public PositiveIntType addNoteNumberElement() {//2 
8157          PositiveIntType t = new PositiveIntType();
8158          if (this.noteNumber == null)
8159            this.noteNumber = new ArrayList<PositiveIntType>();
8160          this.noteNumber.add(t);
8161          return t;
8162        }
8163
8164        /**
8165         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8166         */
8167        public AddedItemComponent addNoteNumber(int value) { //1
8168          PositiveIntType t = new PositiveIntType();
8169          t.setValue(value);
8170          if (this.noteNumber == null)
8171            this.noteNumber = new ArrayList<PositiveIntType>();
8172          this.noteNumber.add(t);
8173          return this;
8174        }
8175
8176        /**
8177         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8178         */
8179        public boolean hasNoteNumber(int value) { 
8180          if (this.noteNumber == null)
8181            return false;
8182          for (PositiveIntType v : this.noteNumber)
8183            if (v.getValue().equals(value)) // positiveInt
8184              return true;
8185          return false;
8186        }
8187
8188        /**
8189         * @return {@link #adjudication} (The adjudication results.)
8190         */
8191        public List<AdjudicationComponent> getAdjudication() { 
8192          if (this.adjudication == null)
8193            this.adjudication = new ArrayList<AdjudicationComponent>();
8194          return this.adjudication;
8195        }
8196
8197        /**
8198         * @return Returns a reference to <code>this</code> for easy method chaining
8199         */
8200        public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
8201          this.adjudication = theAdjudication;
8202          return this;
8203        }
8204
8205        public boolean hasAdjudication() { 
8206          if (this.adjudication == null)
8207            return false;
8208          for (AdjudicationComponent item : this.adjudication)
8209            if (!item.isEmpty())
8210              return true;
8211          return false;
8212        }
8213
8214        public AdjudicationComponent addAdjudication() { //3
8215          AdjudicationComponent t = new AdjudicationComponent();
8216          if (this.adjudication == null)
8217            this.adjudication = new ArrayList<AdjudicationComponent>();
8218          this.adjudication.add(t);
8219          return t;
8220        }
8221
8222        public AddedItemComponent addAdjudication(AdjudicationComponent t) { //3
8223          if (t == null)
8224            return this;
8225          if (this.adjudication == null)
8226            this.adjudication = new ArrayList<AdjudicationComponent>();
8227          this.adjudication.add(t);
8228          return this;
8229        }
8230
8231        /**
8232         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
8233         */
8234        public AdjudicationComponent getAdjudicationFirstRep() { 
8235          if (getAdjudication().isEmpty()) {
8236            addAdjudication();
8237          }
8238          return getAdjudication().get(0);
8239        }
8240
8241        /**
8242         * @return {@link #detail} (The second-tier service adjudications for payor added services.)
8243         */
8244        public List<AddedItemDetailComponent> getDetail() { 
8245          if (this.detail == null)
8246            this.detail = new ArrayList<AddedItemDetailComponent>();
8247          return this.detail;
8248        }
8249
8250        /**
8251         * @return Returns a reference to <code>this</code> for easy method chaining
8252         */
8253        public AddedItemComponent setDetail(List<AddedItemDetailComponent> theDetail) { 
8254          this.detail = theDetail;
8255          return this;
8256        }
8257
8258        public boolean hasDetail() { 
8259          if (this.detail == null)
8260            return false;
8261          for (AddedItemDetailComponent item : this.detail)
8262            if (!item.isEmpty())
8263              return true;
8264          return false;
8265        }
8266
8267        public AddedItemDetailComponent addDetail() { //3
8268          AddedItemDetailComponent t = new AddedItemDetailComponent();
8269          if (this.detail == null)
8270            this.detail = new ArrayList<AddedItemDetailComponent>();
8271          this.detail.add(t);
8272          return t;
8273        }
8274
8275        public AddedItemComponent addDetail(AddedItemDetailComponent t) { //3
8276          if (t == null)
8277            return this;
8278          if (this.detail == null)
8279            this.detail = new ArrayList<AddedItemDetailComponent>();
8280          this.detail.add(t);
8281          return this;
8282        }
8283
8284        /**
8285         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist {3}
8286         */
8287        public AddedItemDetailComponent getDetailFirstRep() { 
8288          if (getDetail().isEmpty()) {
8289            addDetail();
8290          }
8291          return getDetail().get(0);
8292        }
8293
8294        protected void listChildren(List<Property> children) {
8295          super.listChildren(children);
8296          children.add(new Property("itemSequence", "positiveInt", "Claim items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, itemSequence));
8297          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));
8298          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));
8299          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));
8300          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));
8301          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));
8302          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
8303          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));
8304          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location));
8305          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
8306          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));
8307          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));
8308          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
8309          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
8310          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));
8311          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));
8312          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
8313          children.add(new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail));
8314        }
8315
8316        @Override
8317        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8318          switch (_hash) {
8319          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);
8320          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);
8321          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);
8322          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);
8323          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);
8324          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);
8325          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
8326          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);
8327          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);
8328          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);
8329          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);
8330          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8331          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8332          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept", "Where the product or service was provided.", 0, 1, location);
8333          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address", "Where the product or service was provided.", 0, 1, location);
8334          case 755866390: /*locationReference*/  return new Property("location[x]", "Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8335          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
8336          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);
8337          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);
8338          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);
8339          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
8340          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);
8341          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);
8342          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
8343          case -1335224239: /*detail*/  return new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail);
8344          default: return super.getNamedProperty(_hash, _name, _checkValid);
8345          }
8346
8347        }
8348
8349      @Override
8350      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8351        switch (hash) {
8352        case 1977979892: /*itemSequence*/ return this.itemSequence == null ? new Base[0] : this.itemSequence.toArray(new Base[this.itemSequence.size()]); // PositiveIntType
8353        case 1321472818: /*detailSequence*/ return this.detailSequence == null ? new Base[0] : this.detailSequence.toArray(new Base[this.detailSequence.size()]); // PositiveIntType
8354        case -855462510: /*subDetailSequence*/ return this.subDetailSequence == null ? new Base[0] : this.subDetailSequence.toArray(new Base[this.subDetailSequence.size()]); // PositiveIntType
8355        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : this.provider.toArray(new Base[this.provider.size()]); // Reference
8356        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
8357        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
8358        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
8359        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // DataType
8360        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // DataType
8361        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
8362        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
8363        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
8364        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
8365        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
8366        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
8367        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
8368        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
8369        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemDetailComponent
8370        default: return super.getProperty(hash, name, checkValid);
8371        }
8372
8373      }
8374
8375      @Override
8376      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8377        switch (hash) {
8378        case 1977979892: // itemSequence
8379          this.getItemSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
8380          return value;
8381        case 1321472818: // detailSequence
8382          this.getDetailSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
8383          return value;
8384        case -855462510: // subDetailSequence
8385          this.getSubDetailSequence().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
8386          return value;
8387        case -987494927: // provider
8388          this.getProvider().add(TypeConvertor.castToReference(value)); // Reference
8389          return value;
8390        case 1957227299: // productOrService
8391          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
8392          return value;
8393        case -615513385: // modifier
8394          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
8395          return value;
8396        case 1010065041: // programCode
8397          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
8398          return value;
8399        case 1379209295: // serviced
8400          this.serviced = TypeConvertor.castToType(value); // DataType
8401          return value;
8402        case 1901043637: // location
8403          this.location = TypeConvertor.castToType(value); // DataType
8404          return value;
8405        case -1285004149: // quantity
8406          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
8407          return value;
8408        case -486196699: // unitPrice
8409          this.unitPrice = TypeConvertor.castToMoney(value); // Money
8410          return value;
8411        case -1282148017: // factor
8412          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
8413          return value;
8414        case 108957: // net
8415          this.net = TypeConvertor.castToMoney(value); // Money
8416          return value;
8417        case 1702620169: // bodySite
8418          this.bodySite = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
8419          return value;
8420        case -1868566105: // subSite
8421          this.getSubSite().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
8422          return value;
8423        case -1110033957: // noteNumber
8424          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
8425          return value;
8426        case -231349275: // adjudication
8427          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
8428          return value;
8429        case -1335224239: // detail
8430          this.getDetail().add((AddedItemDetailComponent) value); // AddedItemDetailComponent
8431          return value;
8432        default: return super.setProperty(hash, name, value);
8433        }
8434
8435      }
8436
8437      @Override
8438      public Base setProperty(String name, Base value) throws FHIRException {
8439        if (name.equals("itemSequence")) {
8440          this.getItemSequence().add(TypeConvertor.castToPositiveInt(value));
8441        } else if (name.equals("detailSequence")) {
8442          this.getDetailSequence().add(TypeConvertor.castToPositiveInt(value));
8443        } else if (name.equals("subDetailSequence")) {
8444          this.getSubDetailSequence().add(TypeConvertor.castToPositiveInt(value));
8445        } else if (name.equals("provider")) {
8446          this.getProvider().add(TypeConvertor.castToReference(value));
8447        } else if (name.equals("productOrService")) {
8448          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
8449        } else if (name.equals("modifier")) {
8450          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
8451        } else if (name.equals("programCode")) {
8452          this.getProgramCode().add(TypeConvertor.castToCodeableConcept(value));
8453        } else if (name.equals("serviced[x]")) {
8454          this.serviced = TypeConvertor.castToType(value); // DataType
8455        } else if (name.equals("location[x]")) {
8456          this.location = TypeConvertor.castToType(value); // DataType
8457        } else if (name.equals("quantity")) {
8458          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
8459        } else if (name.equals("unitPrice")) {
8460          this.unitPrice = TypeConvertor.castToMoney(value); // Money
8461        } else if (name.equals("factor")) {
8462          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
8463        } else if (name.equals("net")) {
8464          this.net = TypeConvertor.castToMoney(value); // Money
8465        } else if (name.equals("bodySite")) {
8466          this.bodySite = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
8467        } else if (name.equals("subSite")) {
8468          this.getSubSite().add(TypeConvertor.castToCodeableConcept(value));
8469        } else if (name.equals("noteNumber")) {
8470          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
8471        } else if (name.equals("adjudication")) {
8472          this.getAdjudication().add((AdjudicationComponent) value);
8473        } else if (name.equals("detail")) {
8474          this.getDetail().add((AddedItemDetailComponent) value);
8475        } else
8476          return super.setProperty(name, value);
8477        return value;
8478      }
8479
8480      @Override
8481      public Base makeProperty(int hash, String name) throws FHIRException {
8482        switch (hash) {
8483        case 1977979892:  return addItemSequenceElement();
8484        case 1321472818:  return addDetailSequenceElement();
8485        case -855462510:  return addSubDetailSequenceElement();
8486        case -987494927:  return addProvider(); 
8487        case 1957227299:  return getProductOrService();
8488        case -615513385:  return addModifier(); 
8489        case 1010065041:  return addProgramCode(); 
8490        case -1927922223:  return getServiced();
8491        case 1379209295:  return getServiced();
8492        case 552316075:  return getLocation();
8493        case 1901043637:  return getLocation();
8494        case -1285004149:  return getQuantity();
8495        case -486196699:  return getUnitPrice();
8496        case -1282148017:  return getFactorElement();
8497        case 108957:  return getNet();
8498        case 1702620169:  return getBodySite();
8499        case -1868566105:  return addSubSite(); 
8500        case -1110033957:  return addNoteNumberElement();
8501        case -231349275:  return addAdjudication(); 
8502        case -1335224239:  return addDetail(); 
8503        default: return super.makeProperty(hash, name);
8504        }
8505
8506      }
8507
8508      @Override
8509      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8510        switch (hash) {
8511        case 1977979892: /*itemSequence*/ return new String[] {"positiveInt"};
8512        case 1321472818: /*detailSequence*/ return new String[] {"positiveInt"};
8513        case -855462510: /*subDetailSequence*/ return new String[] {"positiveInt"};
8514        case -987494927: /*provider*/ return new String[] {"Reference"};
8515        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
8516        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
8517        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
8518        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
8519        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
8520        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
8521        case -486196699: /*unitPrice*/ return new String[] {"Money"};
8522        case -1282148017: /*factor*/ return new String[] {"decimal"};
8523        case 108957: /*net*/ return new String[] {"Money"};
8524        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
8525        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
8526        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
8527        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
8528        case -1335224239: /*detail*/ return new String[] {};
8529        default: return super.getTypesForProperty(hash, name);
8530        }
8531
8532      }
8533
8534      @Override
8535      public Base addChild(String name) throws FHIRException {
8536        if (name.equals("itemSequence")) {
8537          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.itemSequence");
8538        }
8539        else if (name.equals("detailSequence")) {
8540          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detailSequence");
8541        }
8542        else if (name.equals("subDetailSequence")) {
8543          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.subDetailSequence");
8544        }
8545        else if (name.equals("provider")) {
8546          return addProvider();
8547        }
8548        else if (name.equals("productOrService")) {
8549          this.productOrService = new CodeableConcept();
8550          return this.productOrService;
8551        }
8552        else if (name.equals("modifier")) {
8553          return addModifier();
8554        }
8555        else if (name.equals("programCode")) {
8556          return addProgramCode();
8557        }
8558        else if (name.equals("servicedDate")) {
8559          this.serviced = new DateType();
8560          return this.serviced;
8561        }
8562        else if (name.equals("servicedPeriod")) {
8563          this.serviced = new Period();
8564          return this.serviced;
8565        }
8566        else if (name.equals("locationCodeableConcept")) {
8567          this.location = new CodeableConcept();
8568          return this.location;
8569        }
8570        else if (name.equals("locationAddress")) {
8571          this.location = new Address();
8572          return this.location;
8573        }
8574        else if (name.equals("locationReference")) {
8575          this.location = new Reference();
8576          return this.location;
8577        }
8578        else if (name.equals("quantity")) {
8579          this.quantity = new Quantity();
8580          return this.quantity;
8581        }
8582        else if (name.equals("unitPrice")) {
8583          this.unitPrice = new Money();
8584          return this.unitPrice;
8585        }
8586        else if (name.equals("factor")) {
8587          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.factor");
8588        }
8589        else if (name.equals("net")) {
8590          this.net = new Money();
8591          return this.net;
8592        }
8593        else if (name.equals("bodySite")) {
8594          this.bodySite = new CodeableConcept();
8595          return this.bodySite;
8596        }
8597        else if (name.equals("subSite")) {
8598          return addSubSite();
8599        }
8600        else if (name.equals("noteNumber")) {
8601          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.noteNumber");
8602        }
8603        else if (name.equals("adjudication")) {
8604          return addAdjudication();
8605        }
8606        else if (name.equals("detail")) {
8607          return addDetail();
8608        }
8609        else
8610          return super.addChild(name);
8611      }
8612
8613      public AddedItemComponent copy() {
8614        AddedItemComponent dst = new AddedItemComponent();
8615        copyValues(dst);
8616        return dst;
8617      }
8618
8619      public void copyValues(AddedItemComponent dst) {
8620        super.copyValues(dst);
8621        if (itemSequence != null) {
8622          dst.itemSequence = new ArrayList<PositiveIntType>();
8623          for (PositiveIntType i : itemSequence)
8624            dst.itemSequence.add(i.copy());
8625        };
8626        if (detailSequence != null) {
8627          dst.detailSequence = new ArrayList<PositiveIntType>();
8628          for (PositiveIntType i : detailSequence)
8629            dst.detailSequence.add(i.copy());
8630        };
8631        if (subDetailSequence != null) {
8632          dst.subDetailSequence = new ArrayList<PositiveIntType>();
8633          for (PositiveIntType i : subDetailSequence)
8634            dst.subDetailSequence.add(i.copy());
8635        };
8636        if (provider != null) {
8637          dst.provider = new ArrayList<Reference>();
8638          for (Reference i : provider)
8639            dst.provider.add(i.copy());
8640        };
8641        dst.productOrService = productOrService == null ? null : productOrService.copy();
8642        if (modifier != null) {
8643          dst.modifier = new ArrayList<CodeableConcept>();
8644          for (CodeableConcept i : modifier)
8645            dst.modifier.add(i.copy());
8646        };
8647        if (programCode != null) {
8648          dst.programCode = new ArrayList<CodeableConcept>();
8649          for (CodeableConcept i : programCode)
8650            dst.programCode.add(i.copy());
8651        };
8652        dst.serviced = serviced == null ? null : serviced.copy();
8653        dst.location = location == null ? null : location.copy();
8654        dst.quantity = quantity == null ? null : quantity.copy();
8655        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
8656        dst.factor = factor == null ? null : factor.copy();
8657        dst.net = net == null ? null : net.copy();
8658        dst.bodySite = bodySite == null ? null : bodySite.copy();
8659        if (subSite != null) {
8660          dst.subSite = new ArrayList<CodeableConcept>();
8661          for (CodeableConcept i : subSite)
8662            dst.subSite.add(i.copy());
8663        };
8664        if (noteNumber != null) {
8665          dst.noteNumber = new ArrayList<PositiveIntType>();
8666          for (PositiveIntType i : noteNumber)
8667            dst.noteNumber.add(i.copy());
8668        };
8669        if (adjudication != null) {
8670          dst.adjudication = new ArrayList<AdjudicationComponent>();
8671          for (AdjudicationComponent i : adjudication)
8672            dst.adjudication.add(i.copy());
8673        };
8674        if (detail != null) {
8675          dst.detail = new ArrayList<AddedItemDetailComponent>();
8676          for (AddedItemDetailComponent i : detail)
8677            dst.detail.add(i.copy());
8678        };
8679      }
8680
8681      @Override
8682      public boolean equalsDeep(Base other_) {
8683        if (!super.equalsDeep(other_))
8684          return false;
8685        if (!(other_ instanceof AddedItemComponent))
8686          return false;
8687        AddedItemComponent o = (AddedItemComponent) other_;
8688        return compareDeep(itemSequence, o.itemSequence, true) && compareDeep(detailSequence, o.detailSequence, true)
8689           && compareDeep(subDetailSequence, o.subDetailSequence, true) && compareDeep(provider, o.provider, true)
8690           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
8691           && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
8692           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
8693           && compareDeep(net, o.net, true) && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true)
8694           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
8695           && compareDeep(detail, o.detail, true);
8696      }
8697
8698      @Override
8699      public boolean equalsShallow(Base other_) {
8700        if (!super.equalsShallow(other_))
8701          return false;
8702        if (!(other_ instanceof AddedItemComponent))
8703          return false;
8704        AddedItemComponent o = (AddedItemComponent) other_;
8705        return compareValues(itemSequence, o.itemSequence, true) && compareValues(detailSequence, o.detailSequence, true)
8706           && compareValues(subDetailSequence, o.subDetailSequence, true) && compareValues(factor, o.factor, true)
8707           && compareValues(noteNumber, o.noteNumber, true);
8708      }
8709
8710      public boolean isEmpty() {
8711        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(itemSequence, detailSequence
8712          , subDetailSequence, provider, productOrService, modifier, programCode, serviced
8713          , location, quantity, unitPrice, factor, net, bodySite, subSite, noteNumber
8714          , adjudication, detail);
8715      }
8716
8717  public String fhirType() {
8718    return "ExplanationOfBenefit.addItem";
8719
8720  }
8721
8722  }
8723
8724    @Block()
8725    public static class AddedItemDetailComponent extends BackboneElement implements IBaseBackboneElement {
8726        /**
8727         * 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.
8728         */
8729        @Child(name = "productOrService", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
8730        @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." )
8731        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
8732        protected CodeableConcept productOrService;
8733
8734        /**
8735         * Item typification or modifiers codes to convey additional context for the product or service.
8736         */
8737        @Child(name = "modifier", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8738        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
8739        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
8740        protected List<CodeableConcept> modifier;
8741
8742        /**
8743         * The number of repetitions of a service or product.
8744         */
8745        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
8746        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
8747        protected Quantity quantity;
8748
8749        /**
8750         * 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.
8751         */
8752        @Child(name = "unitPrice", type = {Money.class}, order=4, min=0, max=1, modifier=false, summary=false)
8753        @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." )
8754        protected Money unitPrice;
8755
8756        /**
8757         * 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.
8758         */
8759        @Child(name = "factor", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=false)
8760        @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." )
8761        protected DecimalType factor;
8762
8763        /**
8764         * The quantity times the unit price for an additional service or product or charge.
8765         */
8766        @Child(name = "net", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
8767        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
8768        protected Money net;
8769
8770        /**
8771         * The numbers associated with notes below which apply to the adjudication of this item.
8772         */
8773        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8774        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
8775        protected List<PositiveIntType> noteNumber;
8776
8777        /**
8778         * The adjudication results.
8779         */
8780        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8781        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
8782        protected List<AdjudicationComponent> adjudication;
8783
8784        /**
8785         * The third-tier service adjudications for payor added services.
8786         */
8787        @Child(name = "subDetail", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8788        @Description(shortDefinition="Insurer added line items", formalDefinition="The third-tier service adjudications for payor added services." )
8789        protected List<AddedItemDetailSubDetailComponent> subDetail;
8790
8791        private static final long serialVersionUID = 295910869L;
8792
8793    /**
8794     * Constructor
8795     */
8796      public AddedItemDetailComponent() {
8797        super();
8798      }
8799
8800    /**
8801     * Constructor
8802     */
8803      public AddedItemDetailComponent(CodeableConcept productOrService) {
8804        super();
8805        this.setProductOrService(productOrService);
8806      }
8807
8808        /**
8809         * @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.)
8810         */
8811        public CodeableConcept getProductOrService() { 
8812          if (this.productOrService == null)
8813            if (Configuration.errorOnAutoCreate())
8814              throw new Error("Attempt to auto-create AddedItemDetailComponent.productOrService");
8815            else if (Configuration.doAutoCreate())
8816              this.productOrService = new CodeableConcept(); // cc
8817          return this.productOrService;
8818        }
8819
8820        public boolean hasProductOrService() { 
8821          return this.productOrService != null && !this.productOrService.isEmpty();
8822        }
8823
8824        /**
8825         * @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.)
8826         */
8827        public AddedItemDetailComponent setProductOrService(CodeableConcept value) { 
8828          this.productOrService = value;
8829          return this;
8830        }
8831
8832        /**
8833         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
8834         */
8835        public List<CodeableConcept> getModifier() { 
8836          if (this.modifier == null)
8837            this.modifier = new ArrayList<CodeableConcept>();
8838          return this.modifier;
8839        }
8840
8841        /**
8842         * @return Returns a reference to <code>this</code> for easy method chaining
8843         */
8844        public AddedItemDetailComponent setModifier(List<CodeableConcept> theModifier) { 
8845          this.modifier = theModifier;
8846          return this;
8847        }
8848
8849        public boolean hasModifier() { 
8850          if (this.modifier == null)
8851            return false;
8852          for (CodeableConcept item : this.modifier)
8853            if (!item.isEmpty())
8854              return true;
8855          return false;
8856        }
8857
8858        public CodeableConcept addModifier() { //3
8859          CodeableConcept t = new CodeableConcept();
8860          if (this.modifier == null)
8861            this.modifier = new ArrayList<CodeableConcept>();
8862          this.modifier.add(t);
8863          return t;
8864        }
8865
8866        public AddedItemDetailComponent addModifier(CodeableConcept t) { //3
8867          if (t == null)
8868            return this;
8869          if (this.modifier == null)
8870            this.modifier = new ArrayList<CodeableConcept>();
8871          this.modifier.add(t);
8872          return this;
8873        }
8874
8875        /**
8876         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
8877         */
8878        public CodeableConcept getModifierFirstRep() { 
8879          if (getModifier().isEmpty()) {
8880            addModifier();
8881          }
8882          return getModifier().get(0);
8883        }
8884
8885        /**
8886         * @return {@link #quantity} (The number of repetitions of a service or product.)
8887         */
8888        public Quantity getQuantity() { 
8889          if (this.quantity == null)
8890            if (Configuration.errorOnAutoCreate())
8891              throw new Error("Attempt to auto-create AddedItemDetailComponent.quantity");
8892            else if (Configuration.doAutoCreate())
8893              this.quantity = new Quantity(); // cc
8894          return this.quantity;
8895        }
8896
8897        public boolean hasQuantity() { 
8898          return this.quantity != null && !this.quantity.isEmpty();
8899        }
8900
8901        /**
8902         * @param value {@link #quantity} (The number of repetitions of a service or product.)
8903         */
8904        public AddedItemDetailComponent setQuantity(Quantity value) { 
8905          this.quantity = value;
8906          return this;
8907        }
8908
8909        /**
8910         * @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.)
8911         */
8912        public Money getUnitPrice() { 
8913          if (this.unitPrice == null)
8914            if (Configuration.errorOnAutoCreate())
8915              throw new Error("Attempt to auto-create AddedItemDetailComponent.unitPrice");
8916            else if (Configuration.doAutoCreate())
8917              this.unitPrice = new Money(); // cc
8918          return this.unitPrice;
8919        }
8920
8921        public boolean hasUnitPrice() { 
8922          return this.unitPrice != null && !this.unitPrice.isEmpty();
8923        }
8924
8925        /**
8926         * @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.)
8927         */
8928        public AddedItemDetailComponent setUnitPrice(Money value) { 
8929          this.unitPrice = value;
8930          return this;
8931        }
8932
8933        /**
8934         * @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
8935         */
8936        public DecimalType getFactorElement() { 
8937          if (this.factor == null)
8938            if (Configuration.errorOnAutoCreate())
8939              throw new Error("Attempt to auto-create AddedItemDetailComponent.factor");
8940            else if (Configuration.doAutoCreate())
8941              this.factor = new DecimalType(); // bb
8942          return this.factor;
8943        }
8944
8945        public boolean hasFactorElement() { 
8946          return this.factor != null && !this.factor.isEmpty();
8947        }
8948
8949        public boolean hasFactor() { 
8950          return this.factor != null && !this.factor.isEmpty();
8951        }
8952
8953        /**
8954         * @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
8955         */
8956        public AddedItemDetailComponent setFactorElement(DecimalType value) { 
8957          this.factor = value;
8958          return this;
8959        }
8960
8961        /**
8962         * @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.
8963         */
8964        public BigDecimal getFactor() { 
8965          return this.factor == null ? null : this.factor.getValue();
8966        }
8967
8968        /**
8969         * @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.
8970         */
8971        public AddedItemDetailComponent setFactor(BigDecimal value) { 
8972          if (value == null)
8973            this.factor = null;
8974          else {
8975            if (this.factor == null)
8976              this.factor = new DecimalType();
8977            this.factor.setValue(value);
8978          }
8979          return this;
8980        }
8981
8982        /**
8983         * @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.
8984         */
8985        public AddedItemDetailComponent setFactor(long value) { 
8986              this.factor = new DecimalType();
8987            this.factor.setValue(value);
8988          return this;
8989        }
8990
8991        /**
8992         * @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.
8993         */
8994        public AddedItemDetailComponent setFactor(double value) { 
8995              this.factor = new DecimalType();
8996            this.factor.setValue(value);
8997          return this;
8998        }
8999
9000        /**
9001         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9002         */
9003        public Money getNet() { 
9004          if (this.net == null)
9005            if (Configuration.errorOnAutoCreate())
9006              throw new Error("Attempt to auto-create AddedItemDetailComponent.net");
9007            else if (Configuration.doAutoCreate())
9008              this.net = new Money(); // cc
9009          return this.net;
9010        }
9011
9012        public boolean hasNet() { 
9013          return this.net != null && !this.net.isEmpty();
9014        }
9015
9016        /**
9017         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9018         */
9019        public AddedItemDetailComponent setNet(Money value) { 
9020          this.net = value;
9021          return this;
9022        }
9023
9024        /**
9025         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9026         */
9027        public List<PositiveIntType> getNoteNumber() { 
9028          if (this.noteNumber == null)
9029            this.noteNumber = new ArrayList<PositiveIntType>();
9030          return this.noteNumber;
9031        }
9032
9033        /**
9034         * @return Returns a reference to <code>this</code> for easy method chaining
9035         */
9036        public AddedItemDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
9037          this.noteNumber = theNoteNumber;
9038          return this;
9039        }
9040
9041        public boolean hasNoteNumber() { 
9042          if (this.noteNumber == null)
9043            return false;
9044          for (PositiveIntType item : this.noteNumber)
9045            if (!item.isEmpty())
9046              return true;
9047          return false;
9048        }
9049
9050        /**
9051         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9052         */
9053        public PositiveIntType addNoteNumberElement() {//2 
9054          PositiveIntType t = new PositiveIntType();
9055          if (this.noteNumber == null)
9056            this.noteNumber = new ArrayList<PositiveIntType>();
9057          this.noteNumber.add(t);
9058          return t;
9059        }
9060
9061        /**
9062         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9063         */
9064        public AddedItemDetailComponent addNoteNumber(int value) { //1
9065          PositiveIntType t = new PositiveIntType();
9066          t.setValue(value);
9067          if (this.noteNumber == null)
9068            this.noteNumber = new ArrayList<PositiveIntType>();
9069          this.noteNumber.add(t);
9070          return this;
9071        }
9072
9073        /**
9074         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9075         */
9076        public boolean hasNoteNumber(int value) { 
9077          if (this.noteNumber == null)
9078            return false;
9079          for (PositiveIntType v : this.noteNumber)
9080            if (v.getValue().equals(value)) // positiveInt
9081              return true;
9082          return false;
9083        }
9084
9085        /**
9086         * @return {@link #adjudication} (The adjudication results.)
9087         */
9088        public List<AdjudicationComponent> getAdjudication() { 
9089          if (this.adjudication == null)
9090            this.adjudication = new ArrayList<AdjudicationComponent>();
9091          return this.adjudication;
9092        }
9093
9094        /**
9095         * @return Returns a reference to <code>this</code> for easy method chaining
9096         */
9097        public AddedItemDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
9098          this.adjudication = theAdjudication;
9099          return this;
9100        }
9101
9102        public boolean hasAdjudication() { 
9103          if (this.adjudication == null)
9104            return false;
9105          for (AdjudicationComponent item : this.adjudication)
9106            if (!item.isEmpty())
9107              return true;
9108          return false;
9109        }
9110
9111        public AdjudicationComponent addAdjudication() { //3
9112          AdjudicationComponent t = new AdjudicationComponent();
9113          if (this.adjudication == null)
9114            this.adjudication = new ArrayList<AdjudicationComponent>();
9115          this.adjudication.add(t);
9116          return t;
9117        }
9118
9119        public AddedItemDetailComponent addAdjudication(AdjudicationComponent t) { //3
9120          if (t == null)
9121            return this;
9122          if (this.adjudication == null)
9123            this.adjudication = new ArrayList<AdjudicationComponent>();
9124          this.adjudication.add(t);
9125          return this;
9126        }
9127
9128        /**
9129         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
9130         */
9131        public AdjudicationComponent getAdjudicationFirstRep() { 
9132          if (getAdjudication().isEmpty()) {
9133            addAdjudication();
9134          }
9135          return getAdjudication().get(0);
9136        }
9137
9138        /**
9139         * @return {@link #subDetail} (The third-tier service adjudications for payor added services.)
9140         */
9141        public List<AddedItemDetailSubDetailComponent> getSubDetail() { 
9142          if (this.subDetail == null)
9143            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9144          return this.subDetail;
9145        }
9146
9147        /**
9148         * @return Returns a reference to <code>this</code> for easy method chaining
9149         */
9150        public AddedItemDetailComponent setSubDetail(List<AddedItemDetailSubDetailComponent> theSubDetail) { 
9151          this.subDetail = theSubDetail;
9152          return this;
9153        }
9154
9155        public boolean hasSubDetail() { 
9156          if (this.subDetail == null)
9157            return false;
9158          for (AddedItemDetailSubDetailComponent item : this.subDetail)
9159            if (!item.isEmpty())
9160              return true;
9161          return false;
9162        }
9163
9164        public AddedItemDetailSubDetailComponent addSubDetail() { //3
9165          AddedItemDetailSubDetailComponent t = new AddedItemDetailSubDetailComponent();
9166          if (this.subDetail == null)
9167            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9168          this.subDetail.add(t);
9169          return t;
9170        }
9171
9172        public AddedItemDetailComponent addSubDetail(AddedItemDetailSubDetailComponent t) { //3
9173          if (t == null)
9174            return this;
9175          if (this.subDetail == null)
9176            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9177          this.subDetail.add(t);
9178          return this;
9179        }
9180
9181        /**
9182         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist {3}
9183         */
9184        public AddedItemDetailSubDetailComponent getSubDetailFirstRep() { 
9185          if (getSubDetail().isEmpty()) {
9186            addSubDetail();
9187          }
9188          return getSubDetail().get(0);
9189        }
9190
9191        protected void listChildren(List<Property> children) {
9192          super.listChildren(children);
9193          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));
9194          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));
9195          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
9196          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));
9197          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));
9198          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
9199          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));
9200          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
9201          children.add(new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
9202        }
9203
9204        @Override
9205        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9206          switch (_hash) {
9207          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);
9208          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);
9209          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
9210          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);
9211          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);
9212          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);
9213          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);
9214          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
9215          case -828829007: /*subDetail*/  return new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
9216          default: return super.getNamedProperty(_hash, _name, _checkValid);
9217          }
9218
9219        }
9220
9221      @Override
9222      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9223        switch (hash) {
9224        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
9225        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
9226        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
9227        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
9228        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
9229        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
9230        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
9231        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
9232        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // AddedItemDetailSubDetailComponent
9233        default: return super.getProperty(hash, name, checkValid);
9234        }
9235
9236      }
9237
9238      @Override
9239      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9240        switch (hash) {
9241        case 1957227299: // productOrService
9242          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9243          return value;
9244        case -615513385: // modifier
9245          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
9246          return value;
9247        case -1285004149: // quantity
9248          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
9249          return value;
9250        case -486196699: // unitPrice
9251          this.unitPrice = TypeConvertor.castToMoney(value); // Money
9252          return value;
9253        case -1282148017: // factor
9254          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
9255          return value;
9256        case 108957: // net
9257          this.net = TypeConvertor.castToMoney(value); // Money
9258          return value;
9259        case -1110033957: // noteNumber
9260          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
9261          return value;
9262        case -231349275: // adjudication
9263          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
9264          return value;
9265        case -828829007: // subDetail
9266          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value); // AddedItemDetailSubDetailComponent
9267          return value;
9268        default: return super.setProperty(hash, name, value);
9269        }
9270
9271      }
9272
9273      @Override
9274      public Base setProperty(String name, Base value) throws FHIRException {
9275        if (name.equals("productOrService")) {
9276          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9277        } else if (name.equals("modifier")) {
9278          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
9279        } else if (name.equals("quantity")) {
9280          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
9281        } else if (name.equals("unitPrice")) {
9282          this.unitPrice = TypeConvertor.castToMoney(value); // Money
9283        } else if (name.equals("factor")) {
9284          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
9285        } else if (name.equals("net")) {
9286          this.net = TypeConvertor.castToMoney(value); // Money
9287        } else if (name.equals("noteNumber")) {
9288          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
9289        } else if (name.equals("adjudication")) {
9290          this.getAdjudication().add((AdjudicationComponent) value);
9291        } else if (name.equals("subDetail")) {
9292          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value);
9293        } else
9294          return super.setProperty(name, value);
9295        return value;
9296      }
9297
9298      @Override
9299      public Base makeProperty(int hash, String name) throws FHIRException {
9300        switch (hash) {
9301        case 1957227299:  return getProductOrService();
9302        case -615513385:  return addModifier(); 
9303        case -1285004149:  return getQuantity();
9304        case -486196699:  return getUnitPrice();
9305        case -1282148017:  return getFactorElement();
9306        case 108957:  return getNet();
9307        case -1110033957:  return addNoteNumberElement();
9308        case -231349275:  return addAdjudication(); 
9309        case -828829007:  return addSubDetail(); 
9310        default: return super.makeProperty(hash, name);
9311        }
9312
9313      }
9314
9315      @Override
9316      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9317        switch (hash) {
9318        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
9319        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
9320        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
9321        case -486196699: /*unitPrice*/ return new String[] {"Money"};
9322        case -1282148017: /*factor*/ return new String[] {"decimal"};
9323        case 108957: /*net*/ return new String[] {"Money"};
9324        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
9325        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
9326        case -828829007: /*subDetail*/ return new String[] {};
9327        default: return super.getTypesForProperty(hash, name);
9328        }
9329
9330      }
9331
9332      @Override
9333      public Base addChild(String name) throws FHIRException {
9334        if (name.equals("productOrService")) {
9335          this.productOrService = new CodeableConcept();
9336          return this.productOrService;
9337        }
9338        else if (name.equals("modifier")) {
9339          return addModifier();
9340        }
9341        else if (name.equals("quantity")) {
9342          this.quantity = new Quantity();
9343          return this.quantity;
9344        }
9345        else if (name.equals("unitPrice")) {
9346          this.unitPrice = new Money();
9347          return this.unitPrice;
9348        }
9349        else if (name.equals("factor")) {
9350          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detail.factor");
9351        }
9352        else if (name.equals("net")) {
9353          this.net = new Money();
9354          return this.net;
9355        }
9356        else if (name.equals("noteNumber")) {
9357          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detail.noteNumber");
9358        }
9359        else if (name.equals("adjudication")) {
9360          return addAdjudication();
9361        }
9362        else if (name.equals("subDetail")) {
9363          return addSubDetail();
9364        }
9365        else
9366          return super.addChild(name);
9367      }
9368
9369      public AddedItemDetailComponent copy() {
9370        AddedItemDetailComponent dst = new AddedItemDetailComponent();
9371        copyValues(dst);
9372        return dst;
9373      }
9374
9375      public void copyValues(AddedItemDetailComponent dst) {
9376        super.copyValues(dst);
9377        dst.productOrService = productOrService == null ? null : productOrService.copy();
9378        if (modifier != null) {
9379          dst.modifier = new ArrayList<CodeableConcept>();
9380          for (CodeableConcept i : modifier)
9381            dst.modifier.add(i.copy());
9382        };
9383        dst.quantity = quantity == null ? null : quantity.copy();
9384        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
9385        dst.factor = factor == null ? null : factor.copy();
9386        dst.net = net == null ? null : net.copy();
9387        if (noteNumber != null) {
9388          dst.noteNumber = new ArrayList<PositiveIntType>();
9389          for (PositiveIntType i : noteNumber)
9390            dst.noteNumber.add(i.copy());
9391        };
9392        if (adjudication != null) {
9393          dst.adjudication = new ArrayList<AdjudicationComponent>();
9394          for (AdjudicationComponent i : adjudication)
9395            dst.adjudication.add(i.copy());
9396        };
9397        if (subDetail != null) {
9398          dst.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9399          for (AddedItemDetailSubDetailComponent i : subDetail)
9400            dst.subDetail.add(i.copy());
9401        };
9402      }
9403
9404      @Override
9405      public boolean equalsDeep(Base other_) {
9406        if (!super.equalsDeep(other_))
9407          return false;
9408        if (!(other_ instanceof AddedItemDetailComponent))
9409          return false;
9410        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
9411        return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
9412           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
9413           && compareDeep(net, o.net, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
9414           && compareDeep(subDetail, o.subDetail, true);
9415      }
9416
9417      @Override
9418      public boolean equalsShallow(Base other_) {
9419        if (!super.equalsShallow(other_))
9420          return false;
9421        if (!(other_ instanceof AddedItemDetailComponent))
9422          return false;
9423        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
9424        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
9425      }
9426
9427      public boolean isEmpty() {
9428        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier
9429          , quantity, unitPrice, factor, net, noteNumber, adjudication, subDetail);
9430      }
9431
9432  public String fhirType() {
9433    return "ExplanationOfBenefit.addItem.detail";
9434
9435  }
9436
9437  }
9438
9439    @Block()
9440    public static class AddedItemDetailSubDetailComponent extends BackboneElement implements IBaseBackboneElement {
9441        /**
9442         * 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.
9443         */
9444        @Child(name = "productOrService", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9445        @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." )
9446        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
9447        protected CodeableConcept productOrService;
9448
9449        /**
9450         * Item typification or modifiers codes to convey additional context for the product or service.
9451         */
9452        @Child(name = "modifier", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9453        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
9454        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
9455        protected List<CodeableConcept> modifier;
9456
9457        /**
9458         * The number of repetitions of a service or product.
9459         */
9460        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
9461        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
9462        protected Quantity quantity;
9463
9464        /**
9465         * 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.
9466         */
9467        @Child(name = "unitPrice", type = {Money.class}, order=4, min=0, max=1, modifier=false, summary=false)
9468        @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." )
9469        protected Money unitPrice;
9470
9471        /**
9472         * 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.
9473         */
9474        @Child(name = "factor", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=false)
9475        @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." )
9476        protected DecimalType factor;
9477
9478        /**
9479         * The quantity times the unit price for an additional service or product or charge.
9480         */
9481        @Child(name = "net", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
9482        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
9483        protected Money net;
9484
9485        /**
9486         * The numbers associated with notes below which apply to the adjudication of this item.
9487         */
9488        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9489        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
9490        protected List<PositiveIntType> noteNumber;
9491
9492        /**
9493         * The adjudication results.
9494         */
9495        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9496        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
9497        protected List<AdjudicationComponent> adjudication;
9498
9499        private static final long serialVersionUID = 1301363592L;
9500
9501    /**
9502     * Constructor
9503     */
9504      public AddedItemDetailSubDetailComponent() {
9505        super();
9506      }
9507
9508    /**
9509     * Constructor
9510     */
9511      public AddedItemDetailSubDetailComponent(CodeableConcept productOrService) {
9512        super();
9513        this.setProductOrService(productOrService);
9514      }
9515
9516        /**
9517         * @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.)
9518         */
9519        public CodeableConcept getProductOrService() { 
9520          if (this.productOrService == null)
9521            if (Configuration.errorOnAutoCreate())
9522              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.productOrService");
9523            else if (Configuration.doAutoCreate())
9524              this.productOrService = new CodeableConcept(); // cc
9525          return this.productOrService;
9526        }
9527
9528        public boolean hasProductOrService() { 
9529          return this.productOrService != null && !this.productOrService.isEmpty();
9530        }
9531
9532        /**
9533         * @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.)
9534         */
9535        public AddedItemDetailSubDetailComponent setProductOrService(CodeableConcept value) { 
9536          this.productOrService = value;
9537          return this;
9538        }
9539
9540        /**
9541         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
9542         */
9543        public List<CodeableConcept> getModifier() { 
9544          if (this.modifier == null)
9545            this.modifier = new ArrayList<CodeableConcept>();
9546          return this.modifier;
9547        }
9548
9549        /**
9550         * @return Returns a reference to <code>this</code> for easy method chaining
9551         */
9552        public AddedItemDetailSubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
9553          this.modifier = theModifier;
9554          return this;
9555        }
9556
9557        public boolean hasModifier() { 
9558          if (this.modifier == null)
9559            return false;
9560          for (CodeableConcept item : this.modifier)
9561            if (!item.isEmpty())
9562              return true;
9563          return false;
9564        }
9565
9566        public CodeableConcept addModifier() { //3
9567          CodeableConcept t = new CodeableConcept();
9568          if (this.modifier == null)
9569            this.modifier = new ArrayList<CodeableConcept>();
9570          this.modifier.add(t);
9571          return t;
9572        }
9573
9574        public AddedItemDetailSubDetailComponent addModifier(CodeableConcept t) { //3
9575          if (t == null)
9576            return this;
9577          if (this.modifier == null)
9578            this.modifier = new ArrayList<CodeableConcept>();
9579          this.modifier.add(t);
9580          return this;
9581        }
9582
9583        /**
9584         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist {3}
9585         */
9586        public CodeableConcept getModifierFirstRep() { 
9587          if (getModifier().isEmpty()) {
9588            addModifier();
9589          }
9590          return getModifier().get(0);
9591        }
9592
9593        /**
9594         * @return {@link #quantity} (The number of repetitions of a service or product.)
9595         */
9596        public Quantity getQuantity() { 
9597          if (this.quantity == null)
9598            if (Configuration.errorOnAutoCreate())
9599              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.quantity");
9600            else if (Configuration.doAutoCreate())
9601              this.quantity = new Quantity(); // cc
9602          return this.quantity;
9603        }
9604
9605        public boolean hasQuantity() { 
9606          return this.quantity != null && !this.quantity.isEmpty();
9607        }
9608
9609        /**
9610         * @param value {@link #quantity} (The number of repetitions of a service or product.)
9611         */
9612        public AddedItemDetailSubDetailComponent setQuantity(Quantity value) { 
9613          this.quantity = value;
9614          return this;
9615        }
9616
9617        /**
9618         * @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.)
9619         */
9620        public Money getUnitPrice() { 
9621          if (this.unitPrice == null)
9622            if (Configuration.errorOnAutoCreate())
9623              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.unitPrice");
9624            else if (Configuration.doAutoCreate())
9625              this.unitPrice = new Money(); // cc
9626          return this.unitPrice;
9627        }
9628
9629        public boolean hasUnitPrice() { 
9630          return this.unitPrice != null && !this.unitPrice.isEmpty();
9631        }
9632
9633        /**
9634         * @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.)
9635         */
9636        public AddedItemDetailSubDetailComponent setUnitPrice(Money value) { 
9637          this.unitPrice = value;
9638          return this;
9639        }
9640
9641        /**
9642         * @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
9643         */
9644        public DecimalType getFactorElement() { 
9645          if (this.factor == null)
9646            if (Configuration.errorOnAutoCreate())
9647              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.factor");
9648            else if (Configuration.doAutoCreate())
9649              this.factor = new DecimalType(); // bb
9650          return this.factor;
9651        }
9652
9653        public boolean hasFactorElement() { 
9654          return this.factor != null && !this.factor.isEmpty();
9655        }
9656
9657        public boolean hasFactor() { 
9658          return this.factor != null && !this.factor.isEmpty();
9659        }
9660
9661        /**
9662         * @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
9663         */
9664        public AddedItemDetailSubDetailComponent setFactorElement(DecimalType value) { 
9665          this.factor = value;
9666          return this;
9667        }
9668
9669        /**
9670         * @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.
9671         */
9672        public BigDecimal getFactor() { 
9673          return this.factor == null ? null : this.factor.getValue();
9674        }
9675
9676        /**
9677         * @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.
9678         */
9679        public AddedItemDetailSubDetailComponent setFactor(BigDecimal value) { 
9680          if (value == null)
9681            this.factor = null;
9682          else {
9683            if (this.factor == null)
9684              this.factor = new DecimalType();
9685            this.factor.setValue(value);
9686          }
9687          return this;
9688        }
9689
9690        /**
9691         * @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.
9692         */
9693        public AddedItemDetailSubDetailComponent setFactor(long value) { 
9694              this.factor = new DecimalType();
9695            this.factor.setValue(value);
9696          return this;
9697        }
9698
9699        /**
9700         * @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.
9701         */
9702        public AddedItemDetailSubDetailComponent setFactor(double value) { 
9703              this.factor = new DecimalType();
9704            this.factor.setValue(value);
9705          return this;
9706        }
9707
9708        /**
9709         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9710         */
9711        public Money getNet() { 
9712          if (this.net == null)
9713            if (Configuration.errorOnAutoCreate())
9714              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.net");
9715            else if (Configuration.doAutoCreate())
9716              this.net = new Money(); // cc
9717          return this.net;
9718        }
9719
9720        public boolean hasNet() { 
9721          return this.net != null && !this.net.isEmpty();
9722        }
9723
9724        /**
9725         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9726         */
9727        public AddedItemDetailSubDetailComponent setNet(Money value) { 
9728          this.net = value;
9729          return this;
9730        }
9731
9732        /**
9733         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9734         */
9735        public List<PositiveIntType> getNoteNumber() { 
9736          if (this.noteNumber == null)
9737            this.noteNumber = new ArrayList<PositiveIntType>();
9738          return this.noteNumber;
9739        }
9740
9741        /**
9742         * @return Returns a reference to <code>this</code> for easy method chaining
9743         */
9744        public AddedItemDetailSubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
9745          this.noteNumber = theNoteNumber;
9746          return this;
9747        }
9748
9749        public boolean hasNoteNumber() { 
9750          if (this.noteNumber == null)
9751            return false;
9752          for (PositiveIntType item : this.noteNumber)
9753            if (!item.isEmpty())
9754              return true;
9755          return false;
9756        }
9757
9758        /**
9759         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9760         */
9761        public PositiveIntType addNoteNumberElement() {//2 
9762          PositiveIntType t = new PositiveIntType();
9763          if (this.noteNumber == null)
9764            this.noteNumber = new ArrayList<PositiveIntType>();
9765          this.noteNumber.add(t);
9766          return t;
9767        }
9768
9769        /**
9770         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9771         */
9772        public AddedItemDetailSubDetailComponent addNoteNumber(int value) { //1
9773          PositiveIntType t = new PositiveIntType();
9774          t.setValue(value);
9775          if (this.noteNumber == null)
9776            this.noteNumber = new ArrayList<PositiveIntType>();
9777          this.noteNumber.add(t);
9778          return this;
9779        }
9780
9781        /**
9782         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9783         */
9784        public boolean hasNoteNumber(int value) { 
9785          if (this.noteNumber == null)
9786            return false;
9787          for (PositiveIntType v : this.noteNumber)
9788            if (v.getValue().equals(value)) // positiveInt
9789              return true;
9790          return false;
9791        }
9792
9793        /**
9794         * @return {@link #adjudication} (The adjudication results.)
9795         */
9796        public List<AdjudicationComponent> getAdjudication() { 
9797          if (this.adjudication == null)
9798            this.adjudication = new ArrayList<AdjudicationComponent>();
9799          return this.adjudication;
9800        }
9801
9802        /**
9803         * @return Returns a reference to <code>this</code> for easy method chaining
9804         */
9805        public AddedItemDetailSubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
9806          this.adjudication = theAdjudication;
9807          return this;
9808        }
9809
9810        public boolean hasAdjudication() { 
9811          if (this.adjudication == null)
9812            return false;
9813          for (AdjudicationComponent item : this.adjudication)
9814            if (!item.isEmpty())
9815              return true;
9816          return false;
9817        }
9818
9819        public AdjudicationComponent addAdjudication() { //3
9820          AdjudicationComponent t = new AdjudicationComponent();
9821          if (this.adjudication == null)
9822            this.adjudication = new ArrayList<AdjudicationComponent>();
9823          this.adjudication.add(t);
9824          return t;
9825        }
9826
9827        public AddedItemDetailSubDetailComponent addAdjudication(AdjudicationComponent t) { //3
9828          if (t == null)
9829            return this;
9830          if (this.adjudication == null)
9831            this.adjudication = new ArrayList<AdjudicationComponent>();
9832          this.adjudication.add(t);
9833          return this;
9834        }
9835
9836        /**
9837         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
9838         */
9839        public AdjudicationComponent getAdjudicationFirstRep() { 
9840          if (getAdjudication().isEmpty()) {
9841            addAdjudication();
9842          }
9843          return getAdjudication().get(0);
9844        }
9845
9846        protected void listChildren(List<Property> children) {
9847          super.listChildren(children);
9848          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));
9849          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));
9850          children.add(new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity));
9851          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));
9852          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));
9853          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
9854          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));
9855          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
9856        }
9857
9858        @Override
9859        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9860          switch (_hash) {
9861          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);
9862          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);
9863          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The number of repetitions of a service or product.", 0, 1, quantity);
9864          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);
9865          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);
9866          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);
9867          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);
9868          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
9869          default: return super.getNamedProperty(_hash, _name, _checkValid);
9870          }
9871
9872        }
9873
9874      @Override
9875      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9876        switch (hash) {
9877        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
9878        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
9879        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
9880        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
9881        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
9882        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
9883        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
9884        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
9885        default: return super.getProperty(hash, name, checkValid);
9886        }
9887
9888      }
9889
9890      @Override
9891      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9892        switch (hash) {
9893        case 1957227299: // productOrService
9894          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9895          return value;
9896        case -615513385: // modifier
9897          this.getModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
9898          return value;
9899        case -1285004149: // quantity
9900          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
9901          return value;
9902        case -486196699: // unitPrice
9903          this.unitPrice = TypeConvertor.castToMoney(value); // Money
9904          return value;
9905        case -1282148017: // factor
9906          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
9907          return value;
9908        case 108957: // net
9909          this.net = TypeConvertor.castToMoney(value); // Money
9910          return value;
9911        case -1110033957: // noteNumber
9912          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value)); // PositiveIntType
9913          return value;
9914        case -231349275: // adjudication
9915          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
9916          return value;
9917        default: return super.setProperty(hash, name, value);
9918        }
9919
9920      }
9921
9922      @Override
9923      public Base setProperty(String name, Base value) throws FHIRException {
9924        if (name.equals("productOrService")) {
9925          this.productOrService = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
9926        } else if (name.equals("modifier")) {
9927          this.getModifier().add(TypeConvertor.castToCodeableConcept(value));
9928        } else if (name.equals("quantity")) {
9929          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
9930        } else if (name.equals("unitPrice")) {
9931          this.unitPrice = TypeConvertor.castToMoney(value); // Money
9932        } else if (name.equals("factor")) {
9933          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
9934        } else if (name.equals("net")) {
9935          this.net = TypeConvertor.castToMoney(value); // Money
9936        } else if (name.equals("noteNumber")) {
9937          this.getNoteNumber().add(TypeConvertor.castToPositiveInt(value));
9938        } else if (name.equals("adjudication")) {
9939          this.getAdjudication().add((AdjudicationComponent) value);
9940        } else
9941          return super.setProperty(name, value);
9942        return value;
9943      }
9944
9945      @Override
9946      public Base makeProperty(int hash, String name) throws FHIRException {
9947        switch (hash) {
9948        case 1957227299:  return getProductOrService();
9949        case -615513385:  return addModifier(); 
9950        case -1285004149:  return getQuantity();
9951        case -486196699:  return getUnitPrice();
9952        case -1282148017:  return getFactorElement();
9953        case 108957:  return getNet();
9954        case -1110033957:  return addNoteNumberElement();
9955        case -231349275:  return addAdjudication(); 
9956        default: return super.makeProperty(hash, name);
9957        }
9958
9959      }
9960
9961      @Override
9962      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9963        switch (hash) {
9964        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
9965        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
9966        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
9967        case -486196699: /*unitPrice*/ return new String[] {"Money"};
9968        case -1282148017: /*factor*/ return new String[] {"decimal"};
9969        case 108957: /*net*/ return new String[] {"Money"};
9970        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
9971        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
9972        default: return super.getTypesForProperty(hash, name);
9973        }
9974
9975      }
9976
9977      @Override
9978      public Base addChild(String name) throws FHIRException {
9979        if (name.equals("productOrService")) {
9980          this.productOrService = new CodeableConcept();
9981          return this.productOrService;
9982        }
9983        else if (name.equals("modifier")) {
9984          return addModifier();
9985        }
9986        else if (name.equals("quantity")) {
9987          this.quantity = new Quantity();
9988          return this.quantity;
9989        }
9990        else if (name.equals("unitPrice")) {
9991          this.unitPrice = new Money();
9992          return this.unitPrice;
9993        }
9994        else if (name.equals("factor")) {
9995          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detail.subDetail.factor");
9996        }
9997        else if (name.equals("net")) {
9998          this.net = new Money();
9999          return this.net;
10000        }
10001        else if (name.equals("noteNumber")) {
10002          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.addItem.detail.subDetail.noteNumber");
10003        }
10004        else if (name.equals("adjudication")) {
10005          return addAdjudication();
10006        }
10007        else
10008          return super.addChild(name);
10009      }
10010
10011      public AddedItemDetailSubDetailComponent copy() {
10012        AddedItemDetailSubDetailComponent dst = new AddedItemDetailSubDetailComponent();
10013        copyValues(dst);
10014        return dst;
10015      }
10016
10017      public void copyValues(AddedItemDetailSubDetailComponent dst) {
10018        super.copyValues(dst);
10019        dst.productOrService = productOrService == null ? null : productOrService.copy();
10020        if (modifier != null) {
10021          dst.modifier = new ArrayList<CodeableConcept>();
10022          for (CodeableConcept i : modifier)
10023            dst.modifier.add(i.copy());
10024        };
10025        dst.quantity = quantity == null ? null : quantity.copy();
10026        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
10027        dst.factor = factor == null ? null : factor.copy();
10028        dst.net = net == null ? null : net.copy();
10029        if (noteNumber != null) {
10030          dst.noteNumber = new ArrayList<PositiveIntType>();
10031          for (PositiveIntType i : noteNumber)
10032            dst.noteNumber.add(i.copy());
10033        };
10034        if (adjudication != null) {
10035          dst.adjudication = new ArrayList<AdjudicationComponent>();
10036          for (AdjudicationComponent i : adjudication)
10037            dst.adjudication.add(i.copy());
10038        };
10039      }
10040
10041      @Override
10042      public boolean equalsDeep(Base other_) {
10043        if (!super.equalsDeep(other_))
10044          return false;
10045        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
10046          return false;
10047        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
10048        return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
10049           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
10050           && compareDeep(net, o.net, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
10051          ;
10052      }
10053
10054      @Override
10055      public boolean equalsShallow(Base other_) {
10056        if (!super.equalsShallow(other_))
10057          return false;
10058        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
10059          return false;
10060        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
10061        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
10062      }
10063
10064      public boolean isEmpty() {
10065        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier
10066          , quantity, unitPrice, factor, net, noteNumber, adjudication);
10067      }
10068
10069  public String fhirType() {
10070    return "ExplanationOfBenefit.addItem.detail.subDetail";
10071
10072  }
10073
10074  }
10075
10076    @Block()
10077    public static class TotalComponent extends BackboneElement implements IBaseBackboneElement {
10078        /**
10079         * 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.
10080         */
10081        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
10082        @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." )
10083        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
10084        protected CodeableConcept category;
10085
10086        /**
10087         * Monetary total amount associated with the category.
10088         */
10089        @Child(name = "amount", type = {Money.class}, order=2, min=1, max=1, modifier=false, summary=true)
10090        @Description(shortDefinition="Financial total for the category", formalDefinition="Monetary total amount associated with the category." )
10091        protected Money amount;
10092
10093        private static final long serialVersionUID = 2012310309L;
10094
10095    /**
10096     * Constructor
10097     */
10098      public TotalComponent() {
10099        super();
10100      }
10101
10102    /**
10103     * Constructor
10104     */
10105      public TotalComponent(CodeableConcept category, Money amount) {
10106        super();
10107        this.setCategory(category);
10108        this.setAmount(amount);
10109      }
10110
10111        /**
10112         * @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.)
10113         */
10114        public CodeableConcept getCategory() { 
10115          if (this.category == null)
10116            if (Configuration.errorOnAutoCreate())
10117              throw new Error("Attempt to auto-create TotalComponent.category");
10118            else if (Configuration.doAutoCreate())
10119              this.category = new CodeableConcept(); // cc
10120          return this.category;
10121        }
10122
10123        public boolean hasCategory() { 
10124          return this.category != null && !this.category.isEmpty();
10125        }
10126
10127        /**
10128         * @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.)
10129         */
10130        public TotalComponent setCategory(CodeableConcept value) { 
10131          this.category = value;
10132          return this;
10133        }
10134
10135        /**
10136         * @return {@link #amount} (Monetary total amount associated with the category.)
10137         */
10138        public Money getAmount() { 
10139          if (this.amount == null)
10140            if (Configuration.errorOnAutoCreate())
10141              throw new Error("Attempt to auto-create TotalComponent.amount");
10142            else if (Configuration.doAutoCreate())
10143              this.amount = new Money(); // cc
10144          return this.amount;
10145        }
10146
10147        public boolean hasAmount() { 
10148          return this.amount != null && !this.amount.isEmpty();
10149        }
10150
10151        /**
10152         * @param value {@link #amount} (Monetary total amount associated with the category.)
10153         */
10154        public TotalComponent setAmount(Money value) { 
10155          this.amount = value;
10156          return this;
10157        }
10158
10159        protected void listChildren(List<Property> children) {
10160          super.listChildren(children);
10161          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));
10162          children.add(new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount));
10163        }
10164
10165        @Override
10166        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10167          switch (_hash) {
10168          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);
10169          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount);
10170          default: return super.getNamedProperty(_hash, _name, _checkValid);
10171          }
10172
10173        }
10174
10175      @Override
10176      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10177        switch (hash) {
10178        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
10179        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
10180        default: return super.getProperty(hash, name, checkValid);
10181        }
10182
10183      }
10184
10185      @Override
10186      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10187        switch (hash) {
10188        case 50511102: // category
10189          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10190          return value;
10191        case -1413853096: // amount
10192          this.amount = TypeConvertor.castToMoney(value); // Money
10193          return value;
10194        default: return super.setProperty(hash, name, value);
10195        }
10196
10197      }
10198
10199      @Override
10200      public Base setProperty(String name, Base value) throws FHIRException {
10201        if (name.equals("category")) {
10202          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10203        } else if (name.equals("amount")) {
10204          this.amount = TypeConvertor.castToMoney(value); // Money
10205        } else
10206          return super.setProperty(name, value);
10207        return value;
10208      }
10209
10210      @Override
10211      public Base makeProperty(int hash, String name) throws FHIRException {
10212        switch (hash) {
10213        case 50511102:  return getCategory();
10214        case -1413853096:  return getAmount();
10215        default: return super.makeProperty(hash, name);
10216        }
10217
10218      }
10219
10220      @Override
10221      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10222        switch (hash) {
10223        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
10224        case -1413853096: /*amount*/ return new String[] {"Money"};
10225        default: return super.getTypesForProperty(hash, name);
10226        }
10227
10228      }
10229
10230      @Override
10231      public Base addChild(String name) throws FHIRException {
10232        if (name.equals("category")) {
10233          this.category = new CodeableConcept();
10234          return this.category;
10235        }
10236        else if (name.equals("amount")) {
10237          this.amount = new Money();
10238          return this.amount;
10239        }
10240        else
10241          return super.addChild(name);
10242      }
10243
10244      public TotalComponent copy() {
10245        TotalComponent dst = new TotalComponent();
10246        copyValues(dst);
10247        return dst;
10248      }
10249
10250      public void copyValues(TotalComponent dst) {
10251        super.copyValues(dst);
10252        dst.category = category == null ? null : category.copy();
10253        dst.amount = amount == null ? null : amount.copy();
10254      }
10255
10256      @Override
10257      public boolean equalsDeep(Base other_) {
10258        if (!super.equalsDeep(other_))
10259          return false;
10260        if (!(other_ instanceof TotalComponent))
10261          return false;
10262        TotalComponent o = (TotalComponent) other_;
10263        return compareDeep(category, o.category, true) && compareDeep(amount, o.amount, true);
10264      }
10265
10266      @Override
10267      public boolean equalsShallow(Base other_) {
10268        if (!super.equalsShallow(other_))
10269          return false;
10270        if (!(other_ instanceof TotalComponent))
10271          return false;
10272        TotalComponent o = (TotalComponent) other_;
10273        return true;
10274      }
10275
10276      public boolean isEmpty() {
10277        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, amount);
10278      }
10279
10280  public String fhirType() {
10281    return "ExplanationOfBenefit.total";
10282
10283  }
10284
10285  }
10286
10287    @Block()
10288    public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
10289        /**
10290         * Whether this represents partial or complete payment of the benefits payable.
10291         */
10292        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
10293        @Description(shortDefinition="Partial or complete payment", formalDefinition="Whether this represents partial or complete payment of the benefits payable." )
10294        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-paymenttype")
10295        protected CodeableConcept type;
10296
10297        /**
10298         * Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.
10299         */
10300        @Child(name = "adjustment", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
10301        @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." )
10302        protected Money adjustment;
10303
10304        /**
10305         * Reason for the payment adjustment.
10306         */
10307        @Child(name = "adjustmentReason", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
10308        @Description(shortDefinition="Explanation for the variance", formalDefinition="Reason for the payment adjustment." )
10309        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
10310        protected CodeableConcept adjustmentReason;
10311
10312        /**
10313         * Estimated date the payment will be issued or the actual issue date of payment.
10314         */
10315        @Child(name = "date", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=false)
10316        @Description(shortDefinition="Expected date of payment", formalDefinition="Estimated date the payment will be issued or the actual issue date of payment." )
10317        protected DateType date;
10318
10319        /**
10320         * Benefits payable less any payment adjustment.
10321         */
10322        @Child(name = "amount", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
10323        @Description(shortDefinition="Payable amount after adjustment", formalDefinition="Benefits payable less any payment adjustment." )
10324        protected Money amount;
10325
10326        /**
10327         * Issuer's unique identifier for the payment instrument.
10328         */
10329        @Child(name = "identifier", type = {Identifier.class}, order=6, min=0, max=1, modifier=false, summary=false)
10330        @Description(shortDefinition="Business identifier for the payment", formalDefinition="Issuer's unique identifier for the payment instrument." )
10331        protected Identifier identifier;
10332
10333        private static final long serialVersionUID = 1539906026L;
10334
10335    /**
10336     * Constructor
10337     */
10338      public PaymentComponent() {
10339        super();
10340      }
10341
10342        /**
10343         * @return {@link #type} (Whether this represents partial or complete payment of the benefits payable.)
10344         */
10345        public CodeableConcept getType() { 
10346          if (this.type == null)
10347            if (Configuration.errorOnAutoCreate())
10348              throw new Error("Attempt to auto-create PaymentComponent.type");
10349            else if (Configuration.doAutoCreate())
10350              this.type = new CodeableConcept(); // cc
10351          return this.type;
10352        }
10353
10354        public boolean hasType() { 
10355          return this.type != null && !this.type.isEmpty();
10356        }
10357
10358        /**
10359         * @param value {@link #type} (Whether this represents partial or complete payment of the benefits payable.)
10360         */
10361        public PaymentComponent setType(CodeableConcept value) { 
10362          this.type = value;
10363          return this;
10364        }
10365
10366        /**
10367         * @return {@link #adjustment} (Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.)
10368         */
10369        public Money getAdjustment() { 
10370          if (this.adjustment == null)
10371            if (Configuration.errorOnAutoCreate())
10372              throw new Error("Attempt to auto-create PaymentComponent.adjustment");
10373            else if (Configuration.doAutoCreate())
10374              this.adjustment = new Money(); // cc
10375          return this.adjustment;
10376        }
10377
10378        public boolean hasAdjustment() { 
10379          return this.adjustment != null && !this.adjustment.isEmpty();
10380        }
10381
10382        /**
10383         * @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.)
10384         */
10385        public PaymentComponent setAdjustment(Money value) { 
10386          this.adjustment = value;
10387          return this;
10388        }
10389
10390        /**
10391         * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
10392         */
10393        public CodeableConcept getAdjustmentReason() { 
10394          if (this.adjustmentReason == null)
10395            if (Configuration.errorOnAutoCreate())
10396              throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
10397            else if (Configuration.doAutoCreate())
10398              this.adjustmentReason = new CodeableConcept(); // cc
10399          return this.adjustmentReason;
10400        }
10401
10402        public boolean hasAdjustmentReason() { 
10403          return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
10404        }
10405
10406        /**
10407         * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
10408         */
10409        public PaymentComponent setAdjustmentReason(CodeableConcept value) { 
10410          this.adjustmentReason = value;
10411          return this;
10412        }
10413
10414        /**
10415         * @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
10416         */
10417        public DateType getDateElement() { 
10418          if (this.date == null)
10419            if (Configuration.errorOnAutoCreate())
10420              throw new Error("Attempt to auto-create PaymentComponent.date");
10421            else if (Configuration.doAutoCreate())
10422              this.date = new DateType(); // bb
10423          return this.date;
10424        }
10425
10426        public boolean hasDateElement() { 
10427          return this.date != null && !this.date.isEmpty();
10428        }
10429
10430        public boolean hasDate() { 
10431          return this.date != null && !this.date.isEmpty();
10432        }
10433
10434        /**
10435         * @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
10436         */
10437        public PaymentComponent setDateElement(DateType value) { 
10438          this.date = value;
10439          return this;
10440        }
10441
10442        /**
10443         * @return Estimated date the payment will be issued or the actual issue date of payment.
10444         */
10445        public Date getDate() { 
10446          return this.date == null ? null : this.date.getValue();
10447        }
10448
10449        /**
10450         * @param value Estimated date the payment will be issued or the actual issue date of payment.
10451         */
10452        public PaymentComponent setDate(Date value) { 
10453          if (value == null)
10454            this.date = null;
10455          else {
10456            if (this.date == null)
10457              this.date = new DateType();
10458            this.date.setValue(value);
10459          }
10460          return this;
10461        }
10462
10463        /**
10464         * @return {@link #amount} (Benefits payable less any payment adjustment.)
10465         */
10466        public Money getAmount() { 
10467          if (this.amount == null)
10468            if (Configuration.errorOnAutoCreate())
10469              throw new Error("Attempt to auto-create PaymentComponent.amount");
10470            else if (Configuration.doAutoCreate())
10471              this.amount = new Money(); // cc
10472          return this.amount;
10473        }
10474
10475        public boolean hasAmount() { 
10476          return this.amount != null && !this.amount.isEmpty();
10477        }
10478
10479        /**
10480         * @param value {@link #amount} (Benefits payable less any payment adjustment.)
10481         */
10482        public PaymentComponent setAmount(Money value) { 
10483          this.amount = value;
10484          return this;
10485        }
10486
10487        /**
10488         * @return {@link #identifier} (Issuer's unique identifier for the payment instrument.)
10489         */
10490        public Identifier getIdentifier() { 
10491          if (this.identifier == null)
10492            if (Configuration.errorOnAutoCreate())
10493              throw new Error("Attempt to auto-create PaymentComponent.identifier");
10494            else if (Configuration.doAutoCreate())
10495              this.identifier = new Identifier(); // cc
10496          return this.identifier;
10497        }
10498
10499        public boolean hasIdentifier() { 
10500          return this.identifier != null && !this.identifier.isEmpty();
10501        }
10502
10503        /**
10504         * @param value {@link #identifier} (Issuer's unique identifier for the payment instrument.)
10505         */
10506        public PaymentComponent setIdentifier(Identifier value) { 
10507          this.identifier = value;
10508          return this;
10509        }
10510
10511        protected void listChildren(List<Property> children) {
10512          super.listChildren(children);
10513          children.add(new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type));
10514          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));
10515          children.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason));
10516          children.add(new Property("date", "date", "Estimated date the payment will be issued or the actual issue date of payment.", 0, 1, date));
10517          children.add(new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount));
10518          children.add(new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0, 1, identifier));
10519        }
10520
10521        @Override
10522        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10523          switch (_hash) {
10524          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type);
10525          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);
10526          case -1255938543: /*adjustmentReason*/  return new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason);
10527          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);
10528          case -1413853096: /*amount*/  return new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount);
10529          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0, 1, identifier);
10530          default: return super.getNamedProperty(_hash, _name, _checkValid);
10531          }
10532
10533        }
10534
10535      @Override
10536      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10537        switch (hash) {
10538        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
10539        case 1977085293: /*adjustment*/ return this.adjustment == null ? new Base[0] : new Base[] {this.adjustment}; // Money
10540        case -1255938543: /*adjustmentReason*/ return this.adjustmentReason == null ? new Base[0] : new Base[] {this.adjustmentReason}; // CodeableConcept
10541        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
10542        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
10543        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
10544        default: return super.getProperty(hash, name, checkValid);
10545        }
10546
10547      }
10548
10549      @Override
10550      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10551        switch (hash) {
10552        case 3575610: // type
10553          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10554          return value;
10555        case 1977085293: // adjustment
10556          this.adjustment = TypeConvertor.castToMoney(value); // Money
10557          return value;
10558        case -1255938543: // adjustmentReason
10559          this.adjustmentReason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10560          return value;
10561        case 3076014: // date
10562          this.date = TypeConvertor.castToDate(value); // DateType
10563          return value;
10564        case -1413853096: // amount
10565          this.amount = TypeConvertor.castToMoney(value); // Money
10566          return value;
10567        case -1618432855: // identifier
10568          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
10569          return value;
10570        default: return super.setProperty(hash, name, value);
10571        }
10572
10573      }
10574
10575      @Override
10576      public Base setProperty(String name, Base value) throws FHIRException {
10577        if (name.equals("type")) {
10578          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10579        } else if (name.equals("adjustment")) {
10580          this.adjustment = TypeConvertor.castToMoney(value); // Money
10581        } else if (name.equals("adjustmentReason")) {
10582          this.adjustmentReason = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10583        } else if (name.equals("date")) {
10584          this.date = TypeConvertor.castToDate(value); // DateType
10585        } else if (name.equals("amount")) {
10586          this.amount = TypeConvertor.castToMoney(value); // Money
10587        } else if (name.equals("identifier")) {
10588          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
10589        } else
10590          return super.setProperty(name, value);
10591        return value;
10592      }
10593
10594      @Override
10595      public Base makeProperty(int hash, String name) throws FHIRException {
10596        switch (hash) {
10597        case 3575610:  return getType();
10598        case 1977085293:  return getAdjustment();
10599        case -1255938543:  return getAdjustmentReason();
10600        case 3076014:  return getDateElement();
10601        case -1413853096:  return getAmount();
10602        case -1618432855:  return getIdentifier();
10603        default: return super.makeProperty(hash, name);
10604        }
10605
10606      }
10607
10608      @Override
10609      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10610        switch (hash) {
10611        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
10612        case 1977085293: /*adjustment*/ return new String[] {"Money"};
10613        case -1255938543: /*adjustmentReason*/ return new String[] {"CodeableConcept"};
10614        case 3076014: /*date*/ return new String[] {"date"};
10615        case -1413853096: /*amount*/ return new String[] {"Money"};
10616        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
10617        default: return super.getTypesForProperty(hash, name);
10618        }
10619
10620      }
10621
10622      @Override
10623      public Base addChild(String name) throws FHIRException {
10624        if (name.equals("type")) {
10625          this.type = new CodeableConcept();
10626          return this.type;
10627        }
10628        else if (name.equals("adjustment")) {
10629          this.adjustment = new Money();
10630          return this.adjustment;
10631        }
10632        else if (name.equals("adjustmentReason")) {
10633          this.adjustmentReason = new CodeableConcept();
10634          return this.adjustmentReason;
10635        }
10636        else if (name.equals("date")) {
10637          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.payment.date");
10638        }
10639        else if (name.equals("amount")) {
10640          this.amount = new Money();
10641          return this.amount;
10642        }
10643        else if (name.equals("identifier")) {
10644          this.identifier = new Identifier();
10645          return this.identifier;
10646        }
10647        else
10648          return super.addChild(name);
10649      }
10650
10651      public PaymentComponent copy() {
10652        PaymentComponent dst = new PaymentComponent();
10653        copyValues(dst);
10654        return dst;
10655      }
10656
10657      public void copyValues(PaymentComponent dst) {
10658        super.copyValues(dst);
10659        dst.type = type == null ? null : type.copy();
10660        dst.adjustment = adjustment == null ? null : adjustment.copy();
10661        dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
10662        dst.date = date == null ? null : date.copy();
10663        dst.amount = amount == null ? null : amount.copy();
10664        dst.identifier = identifier == null ? null : identifier.copy();
10665      }
10666
10667      @Override
10668      public boolean equalsDeep(Base other_) {
10669        if (!super.equalsDeep(other_))
10670          return false;
10671        if (!(other_ instanceof PaymentComponent))
10672          return false;
10673        PaymentComponent o = (PaymentComponent) other_;
10674        return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true) && compareDeep(adjustmentReason, o.adjustmentReason, true)
10675           && compareDeep(date, o.date, true) && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true)
10676          ;
10677      }
10678
10679      @Override
10680      public boolean equalsShallow(Base other_) {
10681        if (!super.equalsShallow(other_))
10682          return false;
10683        if (!(other_ instanceof PaymentComponent))
10684          return false;
10685        PaymentComponent o = (PaymentComponent) other_;
10686        return compareValues(date, o.date, true);
10687      }
10688
10689      public boolean isEmpty() {
10690        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason
10691          , date, amount, identifier);
10692      }
10693
10694  public String fhirType() {
10695    return "ExplanationOfBenefit.payment";
10696
10697  }
10698
10699  }
10700
10701    @Block()
10702    public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
10703        /**
10704         * A number to uniquely identify a note entry.
10705         */
10706        @Child(name = "number", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
10707        @Description(shortDefinition="Note instance identifier", formalDefinition="A number to uniquely identify a note entry." )
10708        protected PositiveIntType number;
10709
10710        /**
10711         * The business purpose of the note text.
10712         */
10713        @Child(name = "type", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
10714        @Description(shortDefinition="display | print | printoper", formalDefinition="The business purpose of the note text." )
10715        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/note-type")
10716        protected Enumeration<NoteType> type;
10717
10718        /**
10719         * The explanation or description associated with the processing.
10720         */
10721        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
10722        @Description(shortDefinition="Note explanatory text", formalDefinition="The explanation or description associated with the processing." )
10723        protected StringType text;
10724
10725        /**
10726         * A code to define the language used in the text of the note.
10727         */
10728        @Child(name = "language", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
10729        @Description(shortDefinition="Language of the text", formalDefinition="A code to define the language used in the text of the note." )
10730        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
10731        protected CodeableConcept language;
10732
10733        private static final long serialVersionUID = -385184277L;
10734
10735    /**
10736     * Constructor
10737     */
10738      public NoteComponent() {
10739        super();
10740      }
10741
10742        /**
10743         * @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
10744         */
10745        public PositiveIntType getNumberElement() { 
10746          if (this.number == null)
10747            if (Configuration.errorOnAutoCreate())
10748              throw new Error("Attempt to auto-create NoteComponent.number");
10749            else if (Configuration.doAutoCreate())
10750              this.number = new PositiveIntType(); // bb
10751          return this.number;
10752        }
10753
10754        public boolean hasNumberElement() { 
10755          return this.number != null && !this.number.isEmpty();
10756        }
10757
10758        public boolean hasNumber() { 
10759          return this.number != null && !this.number.isEmpty();
10760        }
10761
10762        /**
10763         * @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
10764         */
10765        public NoteComponent setNumberElement(PositiveIntType value) { 
10766          this.number = value;
10767          return this;
10768        }
10769
10770        /**
10771         * @return A number to uniquely identify a note entry.
10772         */
10773        public int getNumber() { 
10774          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
10775        }
10776
10777        /**
10778         * @param value A number to uniquely identify a note entry.
10779         */
10780        public NoteComponent setNumber(int value) { 
10781            if (this.number == null)
10782              this.number = new PositiveIntType();
10783            this.number.setValue(value);
10784          return this;
10785        }
10786
10787        /**
10788         * @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
10789         */
10790        public Enumeration<NoteType> getTypeElement() { 
10791          if (this.type == null)
10792            if (Configuration.errorOnAutoCreate())
10793              throw new Error("Attempt to auto-create NoteComponent.type");
10794            else if (Configuration.doAutoCreate())
10795              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory()); // bb
10796          return this.type;
10797        }
10798
10799        public boolean hasTypeElement() { 
10800          return this.type != null && !this.type.isEmpty();
10801        }
10802
10803        public boolean hasType() { 
10804          return this.type != null && !this.type.isEmpty();
10805        }
10806
10807        /**
10808         * @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
10809         */
10810        public NoteComponent setTypeElement(Enumeration<NoteType> value) { 
10811          this.type = value;
10812          return this;
10813        }
10814
10815        /**
10816         * @return The business purpose of the note text.
10817         */
10818        public NoteType getType() { 
10819          return this.type == null ? null : this.type.getValue();
10820        }
10821
10822        /**
10823         * @param value The business purpose of the note text.
10824         */
10825        public NoteComponent setType(NoteType value) { 
10826          if (value == null)
10827            this.type = null;
10828          else {
10829            if (this.type == null)
10830              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory());
10831            this.type.setValue(value);
10832          }
10833          return this;
10834        }
10835
10836        /**
10837         * @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
10838         */
10839        public StringType getTextElement() { 
10840          if (this.text == null)
10841            if (Configuration.errorOnAutoCreate())
10842              throw new Error("Attempt to auto-create NoteComponent.text");
10843            else if (Configuration.doAutoCreate())
10844              this.text = new StringType(); // bb
10845          return this.text;
10846        }
10847
10848        public boolean hasTextElement() { 
10849          return this.text != null && !this.text.isEmpty();
10850        }
10851
10852        public boolean hasText() { 
10853          return this.text != null && !this.text.isEmpty();
10854        }
10855
10856        /**
10857         * @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
10858         */
10859        public NoteComponent setTextElement(StringType value) { 
10860          this.text = value;
10861          return this;
10862        }
10863
10864        /**
10865         * @return The explanation or description associated with the processing.
10866         */
10867        public String getText() { 
10868          return this.text == null ? null : this.text.getValue();
10869        }
10870
10871        /**
10872         * @param value The explanation or description associated with the processing.
10873         */
10874        public NoteComponent setText(String value) { 
10875          if (Utilities.noString(value))
10876            this.text = null;
10877          else {
10878            if (this.text == null)
10879              this.text = new StringType();
10880            this.text.setValue(value);
10881          }
10882          return this;
10883        }
10884
10885        /**
10886         * @return {@link #language} (A code to define the language used in the text of the note.)
10887         */
10888        public CodeableConcept getLanguage() { 
10889          if (this.language == null)
10890            if (Configuration.errorOnAutoCreate())
10891              throw new Error("Attempt to auto-create NoteComponent.language");
10892            else if (Configuration.doAutoCreate())
10893              this.language = new CodeableConcept(); // cc
10894          return this.language;
10895        }
10896
10897        public boolean hasLanguage() { 
10898          return this.language != null && !this.language.isEmpty();
10899        }
10900
10901        /**
10902         * @param value {@link #language} (A code to define the language used in the text of the note.)
10903         */
10904        public NoteComponent setLanguage(CodeableConcept value) { 
10905          this.language = value;
10906          return this;
10907        }
10908
10909        protected void listChildren(List<Property> children) {
10910          super.listChildren(children);
10911          children.add(new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number));
10912          children.add(new Property("type", "code", "The business purpose of the note text.", 0, 1, type));
10913          children.add(new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text));
10914          children.add(new Property("language", "CodeableConcept", "A code to define the language used in the text of the note.", 0, 1, language));
10915        }
10916
10917        @Override
10918        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10919          switch (_hash) {
10920          case -1034364087: /*number*/  return new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number);
10921          case 3575610: /*type*/  return new Property("type", "code", "The business purpose of the note text.", 0, 1, type);
10922          case 3556653: /*text*/  return new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text);
10923          case -1613589672: /*language*/  return new Property("language", "CodeableConcept", "A code to define the language used in the text of the note.", 0, 1, language);
10924          default: return super.getNamedProperty(_hash, _name, _checkValid);
10925          }
10926
10927        }
10928
10929      @Override
10930      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10931        switch (hash) {
10932        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // PositiveIntType
10933        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<NoteType>
10934        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
10935        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeableConcept
10936        default: return super.getProperty(hash, name, checkValid);
10937        }
10938
10939      }
10940
10941      @Override
10942      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10943        switch (hash) {
10944        case -1034364087: // number
10945          this.number = TypeConvertor.castToPositiveInt(value); // PositiveIntType
10946          return value;
10947        case 3575610: // type
10948          value = new NoteTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
10949          this.type = (Enumeration) value; // Enumeration<NoteType>
10950          return value;
10951        case 3556653: // text
10952          this.text = TypeConvertor.castToString(value); // StringType
10953          return value;
10954        case -1613589672: // language
10955          this.language = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10956          return value;
10957        default: return super.setProperty(hash, name, value);
10958        }
10959
10960      }
10961
10962      @Override
10963      public Base setProperty(String name, Base value) throws FHIRException {
10964        if (name.equals("number")) {
10965          this.number = TypeConvertor.castToPositiveInt(value); // PositiveIntType
10966        } else if (name.equals("type")) {
10967          value = new NoteTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
10968          this.type = (Enumeration) value; // Enumeration<NoteType>
10969        } else if (name.equals("text")) {
10970          this.text = TypeConvertor.castToString(value); // StringType
10971        } else if (name.equals("language")) {
10972          this.language = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
10973        } else
10974          return super.setProperty(name, value);
10975        return value;
10976      }
10977
10978      @Override
10979      public Base makeProperty(int hash, String name) throws FHIRException {
10980        switch (hash) {
10981        case -1034364087:  return getNumberElement();
10982        case 3575610:  return getTypeElement();
10983        case 3556653:  return getTextElement();
10984        case -1613589672:  return getLanguage();
10985        default: return super.makeProperty(hash, name);
10986        }
10987
10988      }
10989
10990      @Override
10991      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10992        switch (hash) {
10993        case -1034364087: /*number*/ return new String[] {"positiveInt"};
10994        case 3575610: /*type*/ return new String[] {"code"};
10995        case 3556653: /*text*/ return new String[] {"string"};
10996        case -1613589672: /*language*/ return new String[] {"CodeableConcept"};
10997        default: return super.getTypesForProperty(hash, name);
10998        }
10999
11000      }
11001
11002      @Override
11003      public Base addChild(String name) throws FHIRException {
11004        if (name.equals("number")) {
11005          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.processNote.number");
11006        }
11007        else if (name.equals("type")) {
11008          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.processNote.type");
11009        }
11010        else if (name.equals("text")) {
11011          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.processNote.text");
11012        }
11013        else if (name.equals("language")) {
11014          this.language = new CodeableConcept();
11015          return this.language;
11016        }
11017        else
11018          return super.addChild(name);
11019      }
11020
11021      public NoteComponent copy() {
11022        NoteComponent dst = new NoteComponent();
11023        copyValues(dst);
11024        return dst;
11025      }
11026
11027      public void copyValues(NoteComponent dst) {
11028        super.copyValues(dst);
11029        dst.number = number == null ? null : number.copy();
11030        dst.type = type == null ? null : type.copy();
11031        dst.text = text == null ? null : text.copy();
11032        dst.language = language == null ? null : language.copy();
11033      }
11034
11035      @Override
11036      public boolean equalsDeep(Base other_) {
11037        if (!super.equalsDeep(other_))
11038          return false;
11039        if (!(other_ instanceof NoteComponent))
11040          return false;
11041        NoteComponent o = (NoteComponent) other_;
11042        return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
11043           && compareDeep(language, o.language, true);
11044      }
11045
11046      @Override
11047      public boolean equalsShallow(Base other_) {
11048        if (!super.equalsShallow(other_))
11049          return false;
11050        if (!(other_ instanceof NoteComponent))
11051          return false;
11052        NoteComponent o = (NoteComponent) other_;
11053        return compareValues(number, o.number, true) && compareValues(type, o.type, true) && compareValues(text, o.text, true)
11054          ;
11055      }
11056
11057      public boolean isEmpty() {
11058        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language
11059          );
11060      }
11061
11062  public String fhirType() {
11063    return "ExplanationOfBenefit.processNote";
11064
11065  }
11066
11067  }
11068
11069    @Block()
11070    public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
11071        /**
11072         * Code to identify the general type of benefits under which products and services are provided.
11073         */
11074        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
11075        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
11076        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
11077        protected CodeableConcept category;
11078
11079        /**
11080         * 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.
11081         */
11082        @Child(name = "excluded", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
11083        @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." )
11084        protected BooleanType excluded;
11085
11086        /**
11087         * A short name or tag for the benefit.
11088         */
11089        @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
11090        @Description(shortDefinition="Short name for the benefit", formalDefinition="A short name or tag for the benefit." )
11091        protected StringType name;
11092
11093        /**
11094         * A richer description of the benefit or services covered.
11095         */
11096        @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
11097        @Description(shortDefinition="Description of the benefit or services covered", formalDefinition="A richer description of the benefit or services covered." )
11098        protected StringType description;
11099
11100        /**
11101         * Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.
11102         */
11103        @Child(name = "network", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
11104        @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." )
11105        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-network")
11106        protected CodeableConcept network;
11107
11108        /**
11109         * Indicates if the benefits apply to an individual or to the family.
11110         */
11111        @Child(name = "unit", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
11112        @Description(shortDefinition="Individual or family", formalDefinition="Indicates if the benefits apply to an individual or to the family." )
11113        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-unit")
11114        protected CodeableConcept unit;
11115
11116        /**
11117         * The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.
11118         */
11119        @Child(name = "term", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
11120        @Description(shortDefinition="Annual or lifetime", formalDefinition="The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'." )
11121        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-term")
11122        protected CodeableConcept term;
11123
11124        /**
11125         * Benefits Used to date.
11126         */
11127        @Child(name = "financial", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
11128        @Description(shortDefinition="Benefit Summary", formalDefinition="Benefits Used to date." )
11129        protected List<BenefitComponent> financial;
11130
11131        private static final long serialVersionUID = -1889655824L;
11132
11133    /**
11134     * Constructor
11135     */
11136      public BenefitBalanceComponent() {
11137        super();
11138      }
11139
11140    /**
11141     * Constructor
11142     */
11143      public BenefitBalanceComponent(CodeableConcept category) {
11144        super();
11145        this.setCategory(category);
11146      }
11147
11148        /**
11149         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
11150         */
11151        public CodeableConcept getCategory() { 
11152          if (this.category == null)
11153            if (Configuration.errorOnAutoCreate())
11154              throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
11155            else if (Configuration.doAutoCreate())
11156              this.category = new CodeableConcept(); // cc
11157          return this.category;
11158        }
11159
11160        public boolean hasCategory() { 
11161          return this.category != null && !this.category.isEmpty();
11162        }
11163
11164        /**
11165         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
11166         */
11167        public BenefitBalanceComponent setCategory(CodeableConcept value) { 
11168          this.category = value;
11169          return this;
11170        }
11171
11172        /**
11173         * @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
11174         */
11175        public BooleanType getExcludedElement() { 
11176          if (this.excluded == null)
11177            if (Configuration.errorOnAutoCreate())
11178              throw new Error("Attempt to auto-create BenefitBalanceComponent.excluded");
11179            else if (Configuration.doAutoCreate())
11180              this.excluded = new BooleanType(); // bb
11181          return this.excluded;
11182        }
11183
11184        public boolean hasExcludedElement() { 
11185          return this.excluded != null && !this.excluded.isEmpty();
11186        }
11187
11188        public boolean hasExcluded() { 
11189          return this.excluded != null && !this.excluded.isEmpty();
11190        }
11191
11192        /**
11193         * @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
11194         */
11195        public BenefitBalanceComponent setExcludedElement(BooleanType value) { 
11196          this.excluded = value;
11197          return this;
11198        }
11199
11200        /**
11201         * @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.
11202         */
11203        public boolean getExcluded() { 
11204          return this.excluded == null || this.excluded.isEmpty() ? false : this.excluded.getValue();
11205        }
11206
11207        /**
11208         * @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.
11209         */
11210        public BenefitBalanceComponent setExcluded(boolean value) { 
11211            if (this.excluded == null)
11212              this.excluded = new BooleanType();
11213            this.excluded.setValue(value);
11214          return this;
11215        }
11216
11217        /**
11218         * @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
11219         */
11220        public StringType getNameElement() { 
11221          if (this.name == null)
11222            if (Configuration.errorOnAutoCreate())
11223              throw new Error("Attempt to auto-create BenefitBalanceComponent.name");
11224            else if (Configuration.doAutoCreate())
11225              this.name = new StringType(); // bb
11226          return this.name;
11227        }
11228
11229        public boolean hasNameElement() { 
11230          return this.name != null && !this.name.isEmpty();
11231        }
11232
11233        public boolean hasName() { 
11234          return this.name != null && !this.name.isEmpty();
11235        }
11236
11237        /**
11238         * @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
11239         */
11240        public BenefitBalanceComponent setNameElement(StringType value) { 
11241          this.name = value;
11242          return this;
11243        }
11244
11245        /**
11246         * @return A short name or tag for the benefit.
11247         */
11248        public String getName() { 
11249          return this.name == null ? null : this.name.getValue();
11250        }
11251
11252        /**
11253         * @param value A short name or tag for the benefit.
11254         */
11255        public BenefitBalanceComponent setName(String value) { 
11256          if (Utilities.noString(value))
11257            this.name = null;
11258          else {
11259            if (this.name == null)
11260              this.name = new StringType();
11261            this.name.setValue(value);
11262          }
11263          return this;
11264        }
11265
11266        /**
11267         * @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
11268         */
11269        public StringType getDescriptionElement() { 
11270          if (this.description == null)
11271            if (Configuration.errorOnAutoCreate())
11272              throw new Error("Attempt to auto-create BenefitBalanceComponent.description");
11273            else if (Configuration.doAutoCreate())
11274              this.description = new StringType(); // bb
11275          return this.description;
11276        }
11277
11278        public boolean hasDescriptionElement() { 
11279          return this.description != null && !this.description.isEmpty();
11280        }
11281
11282        public boolean hasDescription() { 
11283          return this.description != null && !this.description.isEmpty();
11284        }
11285
11286        /**
11287         * @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
11288         */
11289        public BenefitBalanceComponent setDescriptionElement(StringType value) { 
11290          this.description = value;
11291          return this;
11292        }
11293
11294        /**
11295         * @return A richer description of the benefit or services covered.
11296         */
11297        public String getDescription() { 
11298          return this.description == null ? null : this.description.getValue();
11299        }
11300
11301        /**
11302         * @param value A richer description of the benefit or services covered.
11303         */
11304        public BenefitBalanceComponent setDescription(String value) { 
11305          if (Utilities.noString(value))
11306            this.description = null;
11307          else {
11308            if (this.description == null)
11309              this.description = new StringType();
11310            this.description.setValue(value);
11311          }
11312          return this;
11313        }
11314
11315        /**
11316         * @return {@link #network} (Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.)
11317         */
11318        public CodeableConcept getNetwork() { 
11319          if (this.network == null)
11320            if (Configuration.errorOnAutoCreate())
11321              throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
11322            else if (Configuration.doAutoCreate())
11323              this.network = new CodeableConcept(); // cc
11324          return this.network;
11325        }
11326
11327        public boolean hasNetwork() { 
11328          return this.network != null && !this.network.isEmpty();
11329        }
11330
11331        /**
11332         * @param value {@link #network} (Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.)
11333         */
11334        public BenefitBalanceComponent setNetwork(CodeableConcept value) { 
11335          this.network = value;
11336          return this;
11337        }
11338
11339        /**
11340         * @return {@link #unit} (Indicates if the benefits apply to an individual or to the family.)
11341         */
11342        public CodeableConcept getUnit() { 
11343          if (this.unit == null)
11344            if (Configuration.errorOnAutoCreate())
11345              throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
11346            else if (Configuration.doAutoCreate())
11347              this.unit = new CodeableConcept(); // cc
11348          return this.unit;
11349        }
11350
11351        public boolean hasUnit() { 
11352          return this.unit != null && !this.unit.isEmpty();
11353        }
11354
11355        /**
11356         * @param value {@link #unit} (Indicates if the benefits apply to an individual or to the family.)
11357         */
11358        public BenefitBalanceComponent setUnit(CodeableConcept value) { 
11359          this.unit = value;
11360          return this;
11361        }
11362
11363        /**
11364         * @return {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.)
11365         */
11366        public CodeableConcept getTerm() { 
11367          if (this.term == null)
11368            if (Configuration.errorOnAutoCreate())
11369              throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
11370            else if (Configuration.doAutoCreate())
11371              this.term = new CodeableConcept(); // cc
11372          return this.term;
11373        }
11374
11375        public boolean hasTerm() { 
11376          return this.term != null && !this.term.isEmpty();
11377        }
11378
11379        /**
11380         * @param value {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.)
11381         */
11382        public BenefitBalanceComponent setTerm(CodeableConcept value) { 
11383          this.term = value;
11384          return this;
11385        }
11386
11387        /**
11388         * @return {@link #financial} (Benefits Used to date.)
11389         */
11390        public List<BenefitComponent> getFinancial() { 
11391          if (this.financial == null)
11392            this.financial = new ArrayList<BenefitComponent>();
11393          return this.financial;
11394        }
11395
11396        /**
11397         * @return Returns a reference to <code>this</code> for easy method chaining
11398         */
11399        public BenefitBalanceComponent setFinancial(List<BenefitComponent> theFinancial) { 
11400          this.financial = theFinancial;
11401          return this;
11402        }
11403
11404        public boolean hasFinancial() { 
11405          if (this.financial == null)
11406            return false;
11407          for (BenefitComponent item : this.financial)
11408            if (!item.isEmpty())
11409              return true;
11410          return false;
11411        }
11412
11413        public BenefitComponent addFinancial() { //3
11414          BenefitComponent t = new BenefitComponent();
11415          if (this.financial == null)
11416            this.financial = new ArrayList<BenefitComponent>();
11417          this.financial.add(t);
11418          return t;
11419        }
11420
11421        public BenefitBalanceComponent addFinancial(BenefitComponent t) { //3
11422          if (t == null)
11423            return this;
11424          if (this.financial == null)
11425            this.financial = new ArrayList<BenefitComponent>();
11426          this.financial.add(t);
11427          return this;
11428        }
11429
11430        /**
11431         * @return The first repetition of repeating field {@link #financial}, creating it if it does not already exist {3}
11432         */
11433        public BenefitComponent getFinancialFirstRep() { 
11434          if (getFinancial().isEmpty()) {
11435            addFinancial();
11436          }
11437          return getFinancial().get(0);
11438        }
11439
11440        protected void listChildren(List<Property> children) {
11441          super.listChildren(children);
11442          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
11443          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));
11444          children.add(new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name));
11445          children.add(new Property("description", "string", "A richer description of the benefit or services covered.", 0, 1, description));
11446          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));
11447          children.add(new Property("unit", "CodeableConcept", "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit));
11448          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));
11449          children.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
11450        }
11451
11452        @Override
11453        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11454          switch (_hash) {
11455          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);
11456          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);
11457          case 3373707: /*name*/  return new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name);
11458          case -1724546052: /*description*/  return new Property("description", "string", "A richer description of the benefit or services covered.", 0, 1, description);
11459          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);
11460          case 3594628: /*unit*/  return new Property("unit", "CodeableConcept", "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit);
11461          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);
11462          case 357555337: /*financial*/  return new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial);
11463          default: return super.getNamedProperty(_hash, _name, _checkValid);
11464          }
11465
11466        }
11467
11468      @Override
11469      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11470        switch (hash) {
11471        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
11472        case 1994055114: /*excluded*/ return this.excluded == null ? new Base[0] : new Base[] {this.excluded}; // BooleanType
11473        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
11474        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
11475        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // CodeableConcept
11476        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // CodeableConcept
11477        case 3556460: /*term*/ return this.term == null ? new Base[0] : new Base[] {this.term}; // CodeableConcept
11478        case 357555337: /*financial*/ return this.financial == null ? new Base[0] : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
11479        default: return super.getProperty(hash, name, checkValid);
11480        }
11481
11482      }
11483
11484      @Override
11485      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11486        switch (hash) {
11487        case 50511102: // category
11488          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11489          return value;
11490        case 1994055114: // excluded
11491          this.excluded = TypeConvertor.castToBoolean(value); // BooleanType
11492          return value;
11493        case 3373707: // name
11494          this.name = TypeConvertor.castToString(value); // StringType
11495          return value;
11496        case -1724546052: // description
11497          this.description = TypeConvertor.castToString(value); // StringType
11498          return value;
11499        case 1843485230: // network
11500          this.network = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11501          return value;
11502        case 3594628: // unit
11503          this.unit = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11504          return value;
11505        case 3556460: // term
11506          this.term = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11507          return value;
11508        case 357555337: // financial
11509          this.getFinancial().add((BenefitComponent) value); // BenefitComponent
11510          return value;
11511        default: return super.setProperty(hash, name, value);
11512        }
11513
11514      }
11515
11516      @Override
11517      public Base setProperty(String name, Base value) throws FHIRException {
11518        if (name.equals("category")) {
11519          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11520        } else if (name.equals("excluded")) {
11521          this.excluded = TypeConvertor.castToBoolean(value); // BooleanType
11522        } else if (name.equals("name")) {
11523          this.name = TypeConvertor.castToString(value); // StringType
11524        } else if (name.equals("description")) {
11525          this.description = TypeConvertor.castToString(value); // StringType
11526        } else if (name.equals("network")) {
11527          this.network = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11528        } else if (name.equals("unit")) {
11529          this.unit = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11530        } else if (name.equals("term")) {
11531          this.term = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11532        } else if (name.equals("financial")) {
11533          this.getFinancial().add((BenefitComponent) value);
11534        } else
11535          return super.setProperty(name, value);
11536        return value;
11537      }
11538
11539      @Override
11540      public Base makeProperty(int hash, String name) throws FHIRException {
11541        switch (hash) {
11542        case 50511102:  return getCategory();
11543        case 1994055114:  return getExcludedElement();
11544        case 3373707:  return getNameElement();
11545        case -1724546052:  return getDescriptionElement();
11546        case 1843485230:  return getNetwork();
11547        case 3594628:  return getUnit();
11548        case 3556460:  return getTerm();
11549        case 357555337:  return addFinancial(); 
11550        default: return super.makeProperty(hash, name);
11551        }
11552
11553      }
11554
11555      @Override
11556      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11557        switch (hash) {
11558        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
11559        case 1994055114: /*excluded*/ return new String[] {"boolean"};
11560        case 3373707: /*name*/ return new String[] {"string"};
11561        case -1724546052: /*description*/ return new String[] {"string"};
11562        case 1843485230: /*network*/ return new String[] {"CodeableConcept"};
11563        case 3594628: /*unit*/ return new String[] {"CodeableConcept"};
11564        case 3556460: /*term*/ return new String[] {"CodeableConcept"};
11565        case 357555337: /*financial*/ return new String[] {};
11566        default: return super.getTypesForProperty(hash, name);
11567        }
11568
11569      }
11570
11571      @Override
11572      public Base addChild(String name) throws FHIRException {
11573        if (name.equals("category")) {
11574          this.category = new CodeableConcept();
11575          return this.category;
11576        }
11577        else if (name.equals("excluded")) {
11578          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.benefitBalance.excluded");
11579        }
11580        else if (name.equals("name")) {
11581          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.benefitBalance.name");
11582        }
11583        else if (name.equals("description")) {
11584          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.benefitBalance.description");
11585        }
11586        else if (name.equals("network")) {
11587          this.network = new CodeableConcept();
11588          return this.network;
11589        }
11590        else if (name.equals("unit")) {
11591          this.unit = new CodeableConcept();
11592          return this.unit;
11593        }
11594        else if (name.equals("term")) {
11595          this.term = new CodeableConcept();
11596          return this.term;
11597        }
11598        else if (name.equals("financial")) {
11599          return addFinancial();
11600        }
11601        else
11602          return super.addChild(name);
11603      }
11604
11605      public BenefitBalanceComponent copy() {
11606        BenefitBalanceComponent dst = new BenefitBalanceComponent();
11607        copyValues(dst);
11608        return dst;
11609      }
11610
11611      public void copyValues(BenefitBalanceComponent dst) {
11612        super.copyValues(dst);
11613        dst.category = category == null ? null : category.copy();
11614        dst.excluded = excluded == null ? null : excluded.copy();
11615        dst.name = name == null ? null : name.copy();
11616        dst.description = description == null ? null : description.copy();
11617        dst.network = network == null ? null : network.copy();
11618        dst.unit = unit == null ? null : unit.copy();
11619        dst.term = term == null ? null : term.copy();
11620        if (financial != null) {
11621          dst.financial = new ArrayList<BenefitComponent>();
11622          for (BenefitComponent i : financial)
11623            dst.financial.add(i.copy());
11624        };
11625      }
11626
11627      @Override
11628      public boolean equalsDeep(Base other_) {
11629        if (!super.equalsDeep(other_))
11630          return false;
11631        if (!(other_ instanceof BenefitBalanceComponent))
11632          return false;
11633        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
11634        return compareDeep(category, o.category, true) && compareDeep(excluded, o.excluded, true) && compareDeep(name, o.name, true)
11635           && compareDeep(description, o.description, true) && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true)
11636           && compareDeep(term, o.term, true) && compareDeep(financial, o.financial, true);
11637      }
11638
11639      @Override
11640      public boolean equalsShallow(Base other_) {
11641        if (!super.equalsShallow(other_))
11642          return false;
11643        if (!(other_ instanceof BenefitBalanceComponent))
11644          return false;
11645        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
11646        return compareValues(excluded, o.excluded, true) && compareValues(name, o.name, true) && compareValues(description, o.description, true)
11647          ;
11648      }
11649
11650      public boolean isEmpty() {
11651        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, excluded, name
11652          , description, network, unit, term, financial);
11653      }
11654
11655  public String fhirType() {
11656    return "ExplanationOfBenefit.benefitBalance";
11657
11658  }
11659
11660  }
11661
11662    @Block()
11663    public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
11664        /**
11665         * Classification of benefit being provided.
11666         */
11667        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
11668        @Description(shortDefinition="Benefit classification", formalDefinition="Classification of benefit being provided." )
11669        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-type")
11670        protected CodeableConcept type;
11671
11672        /**
11673         * The quantity of the benefit which is permitted under the coverage.
11674         */
11675        @Child(name = "allowed", type = {UnsignedIntType.class, StringType.class, Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
11676        @Description(shortDefinition="Benefits allowed", formalDefinition="The quantity of the benefit which is permitted under the coverage." )
11677        protected DataType allowed;
11678
11679        /**
11680         * The quantity of the benefit which have been consumed to date.
11681         */
11682        @Child(name = "used", type = {UnsignedIntType.class, Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
11683        @Description(shortDefinition="Benefits used", formalDefinition="The quantity of the benefit which have been consumed to date." )
11684        protected DataType used;
11685
11686        private static final long serialVersionUID = 1900247614L;
11687
11688    /**
11689     * Constructor
11690     */
11691      public BenefitComponent() {
11692        super();
11693      }
11694
11695    /**
11696     * Constructor
11697     */
11698      public BenefitComponent(CodeableConcept type) {
11699        super();
11700        this.setType(type);
11701      }
11702
11703        /**
11704         * @return {@link #type} (Classification of benefit being provided.)
11705         */
11706        public CodeableConcept getType() { 
11707          if (this.type == null)
11708            if (Configuration.errorOnAutoCreate())
11709              throw new Error("Attempt to auto-create BenefitComponent.type");
11710            else if (Configuration.doAutoCreate())
11711              this.type = new CodeableConcept(); // cc
11712          return this.type;
11713        }
11714
11715        public boolean hasType() { 
11716          return this.type != null && !this.type.isEmpty();
11717        }
11718
11719        /**
11720         * @param value {@link #type} (Classification of benefit being provided.)
11721         */
11722        public BenefitComponent setType(CodeableConcept value) { 
11723          this.type = value;
11724          return this;
11725        }
11726
11727        /**
11728         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
11729         */
11730        public DataType getAllowed() { 
11731          return this.allowed;
11732        }
11733
11734        /**
11735         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
11736         */
11737        public UnsignedIntType getAllowedUnsignedIntType() throws FHIRException { 
11738          if (this.allowed == null)
11739            this.allowed = new UnsignedIntType();
11740          if (!(this.allowed instanceof UnsignedIntType))
11741            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.allowed.getClass().getName()+" was encountered");
11742          return (UnsignedIntType) this.allowed;
11743        }
11744
11745        public boolean hasAllowedUnsignedIntType() { 
11746          return this != null && this.allowed instanceof UnsignedIntType;
11747        }
11748
11749        /**
11750         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
11751         */
11752        public StringType getAllowedStringType() throws FHIRException { 
11753          if (this.allowed == null)
11754            this.allowed = new StringType();
11755          if (!(this.allowed instanceof StringType))
11756            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.allowed.getClass().getName()+" was encountered");
11757          return (StringType) this.allowed;
11758        }
11759
11760        public boolean hasAllowedStringType() { 
11761          return this != null && this.allowed instanceof StringType;
11762        }
11763
11764        /**
11765         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
11766         */
11767        public Money getAllowedMoney() throws FHIRException { 
11768          if (this.allowed == null)
11769            this.allowed = new Money();
11770          if (!(this.allowed instanceof Money))
11771            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.allowed.getClass().getName()+" was encountered");
11772          return (Money) this.allowed;
11773        }
11774
11775        public boolean hasAllowedMoney() { 
11776          return this != null && this.allowed instanceof Money;
11777        }
11778
11779        public boolean hasAllowed() { 
11780          return this.allowed != null && !this.allowed.isEmpty();
11781        }
11782
11783        /**
11784         * @param value {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
11785         */
11786        public BenefitComponent setAllowed(DataType value) { 
11787          if (value != null && !(value instanceof UnsignedIntType || value instanceof StringType || value instanceof Money))
11788            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.allowed[x]: "+value.fhirType());
11789          this.allowed = value;
11790          return this;
11791        }
11792
11793        /**
11794         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
11795         */
11796        public DataType getUsed() { 
11797          return this.used;
11798        }
11799
11800        /**
11801         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
11802         */
11803        public UnsignedIntType getUsedUnsignedIntType() throws FHIRException { 
11804          if (this.used == null)
11805            this.used = new UnsignedIntType();
11806          if (!(this.used instanceof UnsignedIntType))
11807            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.used.getClass().getName()+" was encountered");
11808          return (UnsignedIntType) this.used;
11809        }
11810
11811        public boolean hasUsedUnsignedIntType() { 
11812          return this != null && this.used instanceof UnsignedIntType;
11813        }
11814
11815        /**
11816         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
11817         */
11818        public Money getUsedMoney() throws FHIRException { 
11819          if (this.used == null)
11820            this.used = new Money();
11821          if (!(this.used instanceof Money))
11822            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.used.getClass().getName()+" was encountered");
11823          return (Money) this.used;
11824        }
11825
11826        public boolean hasUsedMoney() { 
11827          return this != null && this.used instanceof Money;
11828        }
11829
11830        public boolean hasUsed() { 
11831          return this.used != null && !this.used.isEmpty();
11832        }
11833
11834        /**
11835         * @param value {@link #used} (The quantity of the benefit which have been consumed to date.)
11836         */
11837        public BenefitComponent setUsed(DataType value) { 
11838          if (value != null && !(value instanceof UnsignedIntType || value instanceof Money))
11839            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.used[x]: "+value.fhirType());
11840          this.used = value;
11841          return this;
11842        }
11843
11844        protected void listChildren(List<Property> children) {
11845          super.listChildren(children);
11846          children.add(new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type));
11847          children.add(new Property("allowed[x]", "unsignedInt|string|Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed));
11848          children.add(new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used));
11849        }
11850
11851        @Override
11852        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11853          switch (_hash) {
11854          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type);
11855          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);
11856          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);
11857          case 1668802034: /*allowedUnsignedInt*/  return new Property("allowed[x]", "unsignedInt", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
11858          case -2135265319: /*allowedString*/  return new Property("allowed[x]", "string", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
11859          case -351668232: /*allowedMoney*/  return new Property("allowed[x]", "Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
11860          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);
11861          case 3599293: /*used*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
11862          case 1252740285: /*usedUnsignedInt*/  return new Property("used[x]", "unsignedInt", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
11863          case -78048509: /*usedMoney*/  return new Property("used[x]", "Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
11864          default: return super.getNamedProperty(_hash, _name, _checkValid);
11865          }
11866
11867        }
11868
11869      @Override
11870      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11871        switch (hash) {
11872        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
11873        case -911343192: /*allowed*/ return this.allowed == null ? new Base[0] : new Base[] {this.allowed}; // DataType
11874        case 3599293: /*used*/ return this.used == null ? new Base[0] : new Base[] {this.used}; // DataType
11875        default: return super.getProperty(hash, name, checkValid);
11876        }
11877
11878      }
11879
11880      @Override
11881      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11882        switch (hash) {
11883        case 3575610: // type
11884          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11885          return value;
11886        case -911343192: // allowed
11887          this.allowed = TypeConvertor.castToType(value); // DataType
11888          return value;
11889        case 3599293: // used
11890          this.used = TypeConvertor.castToType(value); // DataType
11891          return value;
11892        default: return super.setProperty(hash, name, value);
11893        }
11894
11895      }
11896
11897      @Override
11898      public Base setProperty(String name, Base value) throws FHIRException {
11899        if (name.equals("type")) {
11900          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
11901        } else if (name.equals("allowed[x]")) {
11902          this.allowed = TypeConvertor.castToType(value); // DataType
11903        } else if (name.equals("used[x]")) {
11904          this.used = TypeConvertor.castToType(value); // DataType
11905        } else
11906          return super.setProperty(name, value);
11907        return value;
11908      }
11909
11910      @Override
11911      public Base makeProperty(int hash, String name) throws FHIRException {
11912        switch (hash) {
11913        case 3575610:  return getType();
11914        case -1336663592:  return getAllowed();
11915        case -911343192:  return getAllowed();
11916        case -147553373:  return getUsed();
11917        case 3599293:  return getUsed();
11918        default: return super.makeProperty(hash, name);
11919        }
11920
11921      }
11922
11923      @Override
11924      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11925        switch (hash) {
11926        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
11927        case -911343192: /*allowed*/ return new String[] {"unsignedInt", "string", "Money"};
11928        case 3599293: /*used*/ return new String[] {"unsignedInt", "Money"};
11929        default: return super.getTypesForProperty(hash, name);
11930        }
11931
11932      }
11933
11934      @Override
11935      public Base addChild(String name) throws FHIRException {
11936        if (name.equals("type")) {
11937          this.type = new CodeableConcept();
11938          return this.type;
11939        }
11940        else if (name.equals("allowedUnsignedInt")) {
11941          this.allowed = new UnsignedIntType();
11942          return this.allowed;
11943        }
11944        else if (name.equals("allowedString")) {
11945          this.allowed = new StringType();
11946          return this.allowed;
11947        }
11948        else if (name.equals("allowedMoney")) {
11949          this.allowed = new Money();
11950          return this.allowed;
11951        }
11952        else if (name.equals("usedUnsignedInt")) {
11953          this.used = new UnsignedIntType();
11954          return this.used;
11955        }
11956        else if (name.equals("usedMoney")) {
11957          this.used = new Money();
11958          return this.used;
11959        }
11960        else
11961          return super.addChild(name);
11962      }
11963
11964      public BenefitComponent copy() {
11965        BenefitComponent dst = new BenefitComponent();
11966        copyValues(dst);
11967        return dst;
11968      }
11969
11970      public void copyValues(BenefitComponent dst) {
11971        super.copyValues(dst);
11972        dst.type = type == null ? null : type.copy();
11973        dst.allowed = allowed == null ? null : allowed.copy();
11974        dst.used = used == null ? null : used.copy();
11975      }
11976
11977      @Override
11978      public boolean equalsDeep(Base other_) {
11979        if (!super.equalsDeep(other_))
11980          return false;
11981        if (!(other_ instanceof BenefitComponent))
11982          return false;
11983        BenefitComponent o = (BenefitComponent) other_;
11984        return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true) && compareDeep(used, o.used, true)
11985          ;
11986      }
11987
11988      @Override
11989      public boolean equalsShallow(Base other_) {
11990        if (!super.equalsShallow(other_))
11991          return false;
11992        if (!(other_ instanceof BenefitComponent))
11993          return false;
11994        BenefitComponent o = (BenefitComponent) other_;
11995        return true;
11996      }
11997
11998      public boolean isEmpty() {
11999        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed, used);
12000      }
12001
12002  public String fhirType() {
12003    return "ExplanationOfBenefit.benefitBalance.financial";
12004
12005  }
12006
12007  }
12008
12009    /**
12010     * A unique identifier assigned to this explanation of benefit.
12011     */
12012    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12013    @Description(shortDefinition="Business Identifier for the resource", formalDefinition="A unique identifier assigned to this explanation of benefit." )
12014    protected List<Identifier> identifier;
12015
12016    /**
12017     * The status of the resource instance.
12018     */
12019    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
12020    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
12021    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/explanationofbenefit-status")
12022    protected Enumeration<ExplanationOfBenefitStatus> status;
12023
12024    /**
12025     * The category of claim, e.g. oral, pharmacy, vision, institutional, professional.
12026     */
12027    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
12028    @Description(shortDefinition="Category or discipline", formalDefinition="The category of claim, e.g. oral, pharmacy, vision, institutional, professional." )
12029    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-type")
12030    protected CodeableConcept type;
12031
12032    /**
12033     * A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.
12034     */
12035    @Child(name = "subType", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
12036    @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." )
12037    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-subtype")
12038    protected CodeableConcept subType;
12039
12040    /**
12041     * 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.
12042     */
12043    @Child(name = "use", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
12044    @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." )
12045    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-use")
12046    protected Enumeration<Use> use;
12047
12048    /**
12049     * 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.
12050     */
12051    @Child(name = "patient", type = {Patient.class}, order=5, min=1, max=1, modifier=false, summary=true)
12052    @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." )
12053    protected Reference patient;
12054
12055    /**
12056     * The period for which charges are being submitted.
12057     */
12058    @Child(name = "billablePeriod", type = {Period.class}, order=6, min=0, max=1, modifier=false, summary=true)
12059    @Description(shortDefinition="Relevant time frame for the claim", formalDefinition="The period for which charges are being submitted." )
12060    protected Period billablePeriod;
12061
12062    /**
12063     * The date this resource was created.
12064     */
12065    @Child(name = "created", type = {DateTimeType.class}, order=7, min=1, max=1, modifier=false, summary=true)
12066    @Description(shortDefinition="Response creation date", formalDefinition="The date this resource was created." )
12067    protected DateTimeType created;
12068
12069    /**
12070     * Individual who created the claim, predetermination or preauthorization.
12071     */
12072    @Child(name = "enterer", type = {Practitioner.class, PractitionerRole.class}, order=8, min=0, max=1, modifier=false, summary=false)
12073    @Description(shortDefinition="Author of the claim", formalDefinition="Individual who created the claim, predetermination or preauthorization." )
12074    protected Reference enterer;
12075
12076    /**
12077     * The party responsible for authorization, adjudication and reimbursement.
12078     */
12079    @Child(name = "insurer", type = {Organization.class}, order=9, min=1, max=1, modifier=false, summary=true)
12080    @Description(shortDefinition="Party responsible for reimbursement", formalDefinition="The party responsible for authorization, adjudication and reimbursement." )
12081    protected Reference insurer;
12082
12083    /**
12084     * The provider which is responsible for the claim, predetermination or preauthorization.
12085     */
12086    @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=10, min=1, max=1, modifier=false, summary=true)
12087    @Description(shortDefinition="Party responsible for the claim", formalDefinition="The provider which is responsible for the claim, predetermination or preauthorization." )
12088    protected Reference provider;
12089
12090    /**
12091     * The provider-required urgency of processing the request. Typical values include: stat, routine deferred.
12092     */
12093    @Child(name = "priority", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=false)
12094    @Description(shortDefinition="Desired processing urgency", formalDefinition="The provider-required urgency of processing the request. Typical values include: stat, routine deferred." )
12095    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/CodeSystem/processpriority")
12096    protected CodeableConcept priority;
12097
12098    /**
12099     * A code to indicate whether and for whom funds are to be reserved for future claims.
12100     */
12101    @Child(name = "fundsReserveRequested", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
12102    @Description(shortDefinition="For whom to reserve funds", formalDefinition="A code to indicate whether and for whom funds are to be reserved for future claims." )
12103    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fundsreserve")
12104    protected CodeableConcept fundsReserveRequested;
12105
12106    /**
12107     * A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.
12108     */
12109    @Child(name = "fundsReserve", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
12110    @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." )
12111    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fundsreserve")
12112    protected CodeableConcept fundsReserve;
12113
12114    /**
12115     * Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.
12116     */
12117    @Child(name = "related", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12118    @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." )
12119    protected List<RelatedClaimComponent> related;
12120
12121    /**
12122     * Prescription to support the dispensing of pharmacy, device or vision products.
12123     */
12124    @Child(name = "prescription", type = {MedicationRequest.class, VisionPrescription.class}, order=15, min=0, max=1, modifier=false, summary=false)
12125    @Description(shortDefinition="Prescription authorizing services or products", formalDefinition="Prescription to support the dispensing of pharmacy, device or vision products." )
12126    protected Reference prescription;
12127
12128    /**
12129     * Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.
12130     */
12131    @Child(name = "originalPrescription", type = {MedicationRequest.class}, order=16, min=0, max=1, modifier=false, summary=false)
12132    @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." )
12133    protected Reference originalPrescription;
12134
12135    /**
12136     * The party to be reimbursed for cost of the products and services according to the terms of the policy.
12137     */
12138    @Child(name = "payee", type = {}, order=17, min=0, max=1, modifier=false, summary=false)
12139    @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." )
12140    protected PayeeComponent payee;
12141
12142    /**
12143     * A reference to a referral resource.
12144     */
12145    @Child(name = "referral", type = {ServiceRequest.class}, order=18, min=0, max=1, modifier=false, summary=false)
12146    @Description(shortDefinition="Treatment Referral", formalDefinition="A reference to a referral resource." )
12147    protected Reference referral;
12148
12149    /**
12150     * Facility where the services were provided.
12151     */
12152    @Child(name = "facility", type = {Location.class}, order=19, min=0, max=1, modifier=false, summary=false)
12153    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
12154    protected Reference facility;
12155
12156    /**
12157     * The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.
12158     */
12159    @Child(name = "claim", type = {Claim.class}, order=20, min=0, max=1, modifier=false, summary=false)
12160    @Description(shortDefinition="Claim reference", formalDefinition="The business identifier for the instance of the adjudication request: claim predetermination or preauthorization." )
12161    protected Reference claim;
12162
12163    /**
12164     * The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.
12165     */
12166    @Child(name = "claimResponse", type = {ClaimResponse.class}, order=21, min=0, max=1, modifier=false, summary=false)
12167    @Description(shortDefinition="Claim response reference", formalDefinition="The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response." )
12168    protected Reference claimResponse;
12169
12170    /**
12171     * The outcome of the claim, predetermination, or preauthorization processing.
12172     */
12173    @Child(name = "outcome", type = {CodeType.class}, order=22, min=1, max=1, modifier=false, summary=true)
12174    @Description(shortDefinition="queued | complete | error | partial", formalDefinition="The outcome of the claim, predetermination, or preauthorization processing." )
12175    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/remittance-outcome")
12176    protected Enumeration<ClaimProcessingCodes> outcome;
12177
12178    /**
12179     * A human readable description of the status of the adjudication.
12180     */
12181    @Child(name = "disposition", type = {StringType.class}, order=23, min=0, max=1, modifier=false, summary=false)
12182    @Description(shortDefinition="Disposition Message", formalDefinition="A human readable description of the status of the adjudication." )
12183    protected StringType disposition;
12184
12185    /**
12186     * Reference from the Insurer which is used in later communications which refers to this adjudication.
12187     */
12188    @Child(name = "preAuthRef", type = {StringType.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12189    @Description(shortDefinition="Preauthorization reference", formalDefinition="Reference from the Insurer which is used in later communications which refers to this adjudication." )
12190    protected List<StringType> preAuthRef;
12191
12192    /**
12193     * The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.
12194     */
12195    @Child(name = "preAuthRefPeriod", type = {Period.class}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12196    @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." )
12197    protected List<Period> preAuthRefPeriod;
12198
12199    /**
12200     * The members of the team who provided the products and services.
12201     */
12202    @Child(name = "careTeam", type = {}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12203    @Description(shortDefinition="Care Team members", formalDefinition="The members of the team who provided the products and services." )
12204    protected List<CareTeamComponent> careTeam;
12205
12206    /**
12207     * Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.
12208     */
12209    @Child(name = "supportingInfo", type = {}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12210    @Description(shortDefinition="Supporting information", formalDefinition="Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues." )
12211    protected List<SupportingInformationComponent> supportingInfo;
12212
12213    /**
12214     * Information about diagnoses relevant to the claim items.
12215     */
12216    @Child(name = "diagnosis", type = {}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12217    @Description(shortDefinition="Pertinent diagnosis information", formalDefinition="Information about diagnoses relevant to the claim items." )
12218    protected List<DiagnosisComponent> diagnosis;
12219
12220    /**
12221     * Procedures performed on the patient relevant to the billing items with the claim.
12222     */
12223    @Child(name = "procedure", type = {}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12224    @Description(shortDefinition="Clinical procedures performed", formalDefinition="Procedures performed on the patient relevant to the billing items with the claim." )
12225    protected List<ProcedureComponent> procedure;
12226
12227    /**
12228     * This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
12229     */
12230    @Child(name = "precedence", type = {PositiveIntType.class}, order=30, min=0, max=1, modifier=false, summary=false)
12231    @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." )
12232    protected PositiveIntType precedence;
12233
12234    /**
12235     * Financial instruments for reimbursement for the health care products and services specified on the claim.
12236     */
12237    @Child(name = "insurance", type = {}, order=31, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
12238    @Description(shortDefinition="Patient insurance information", formalDefinition="Financial instruments for reimbursement for the health care products and services specified on the claim." )
12239    protected List<InsuranceComponent> insurance;
12240
12241    /**
12242     * Details of a accident which resulted in injuries which required the products and services listed in the claim.
12243     */
12244    @Child(name = "accident", type = {}, order=32, min=0, max=1, modifier=false, summary=false)
12245    @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." )
12246    protected AccidentComponent accident;
12247
12248    /**
12249     * 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.
12250     */
12251    @Child(name = "item", type = {}, order=33, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12252    @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." )
12253    protected List<ItemComponent> item;
12254
12255    /**
12256     * The first-tier service adjudications for payor added product or service lines.
12257     */
12258    @Child(name = "addItem", type = {}, order=34, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12259    @Description(shortDefinition="Insurer added line items", formalDefinition="The first-tier service adjudications for payor added product or service lines." )
12260    protected List<AddedItemComponent> addItem;
12261
12262    /**
12263     * The adjudication results which are presented at the header level rather than at the line-item or add-item levels.
12264     */
12265    @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=35, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12266    @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." )
12267    protected List<AdjudicationComponent> adjudication;
12268
12269    /**
12270     * Categorized monetary totals for the adjudication.
12271     */
12272    @Child(name = "total", type = {}, order=36, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
12273    @Description(shortDefinition="Adjudication totals", formalDefinition="Categorized monetary totals for the adjudication." )
12274    protected List<TotalComponent> total;
12275
12276    /**
12277     * Payment details for the adjudication of the claim.
12278     */
12279    @Child(name = "payment", type = {}, order=37, min=0, max=1, modifier=false, summary=false)
12280    @Description(shortDefinition="Payment Details", formalDefinition="Payment details for the adjudication of the claim." )
12281    protected PaymentComponent payment;
12282
12283    /**
12284     * A code for the form to be used for printing the content.
12285     */
12286    @Child(name = "formCode", type = {CodeableConcept.class}, order=38, min=0, max=1, modifier=false, summary=false)
12287    @Description(shortDefinition="Printed form identifier", formalDefinition="A code for the form to be used for printing the content." )
12288    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/forms")
12289    protected CodeableConcept formCode;
12290
12291    /**
12292     * The actual form, by reference or inclusion, for printing the content or an EOB.
12293     */
12294    @Child(name = "form", type = {Attachment.class}, order=39, min=0, max=1, modifier=false, summary=false)
12295    @Description(shortDefinition="Printed reference or actual form", formalDefinition="The actual form, by reference or inclusion, for printing the content or an EOB." )
12296    protected Attachment form;
12297
12298    /**
12299     * A note that describes or explains adjudication results in a human readable form.
12300     */
12301    @Child(name = "processNote", type = {}, order=40, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12302    @Description(shortDefinition="Note concerning adjudication", formalDefinition="A note that describes or explains adjudication results in a human readable form." )
12303    protected List<NoteComponent> processNote;
12304
12305    /**
12306     * The term of the benefits documented in this response.
12307     */
12308    @Child(name = "benefitPeriod", type = {Period.class}, order=41, min=0, max=1, modifier=false, summary=false)
12309    @Description(shortDefinition="When the benefits are applicable", formalDefinition="The term of the benefits documented in this response." )
12310    protected Period benefitPeriod;
12311
12312    /**
12313     * Balance by Benefit Category.
12314     */
12315    @Child(name = "benefitBalance", type = {}, order=42, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12316    @Description(shortDefinition="Balance by Benefit Category", formalDefinition="Balance by Benefit Category." )
12317    protected List<BenefitBalanceComponent> benefitBalance;
12318
12319    private static final long serialVersionUID = -1934679453L;
12320
12321  /**
12322   * Constructor
12323   */
12324    public ExplanationOfBenefit() {
12325      super();
12326    }
12327
12328  /**
12329   * Constructor
12330   */
12331    public ExplanationOfBenefit(ExplanationOfBenefitStatus status, CodeableConcept type, Use use, Reference patient, Date created, Reference insurer, Reference provider, ClaimProcessingCodes outcome, InsuranceComponent insurance) {
12332      super();
12333      this.setStatus(status);
12334      this.setType(type);
12335      this.setUse(use);
12336      this.setPatient(patient);
12337      this.setCreated(created);
12338      this.setInsurer(insurer);
12339      this.setProvider(provider);
12340      this.setOutcome(outcome);
12341      this.addInsurance(insurance);
12342    }
12343
12344    /**
12345     * @return {@link #identifier} (A unique identifier assigned to this explanation of benefit.)
12346     */
12347    public List<Identifier> getIdentifier() { 
12348      if (this.identifier == null)
12349        this.identifier = new ArrayList<Identifier>();
12350      return this.identifier;
12351    }
12352
12353    /**
12354     * @return Returns a reference to <code>this</code> for easy method chaining
12355     */
12356    public ExplanationOfBenefit setIdentifier(List<Identifier> theIdentifier) { 
12357      this.identifier = theIdentifier;
12358      return this;
12359    }
12360
12361    public boolean hasIdentifier() { 
12362      if (this.identifier == null)
12363        return false;
12364      for (Identifier item : this.identifier)
12365        if (!item.isEmpty())
12366          return true;
12367      return false;
12368    }
12369
12370    public Identifier addIdentifier() { //3
12371      Identifier t = new Identifier();
12372      if (this.identifier == null)
12373        this.identifier = new ArrayList<Identifier>();
12374      this.identifier.add(t);
12375      return t;
12376    }
12377
12378    public ExplanationOfBenefit addIdentifier(Identifier t) { //3
12379      if (t == null)
12380        return this;
12381      if (this.identifier == null)
12382        this.identifier = new ArrayList<Identifier>();
12383      this.identifier.add(t);
12384      return this;
12385    }
12386
12387    /**
12388     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
12389     */
12390    public Identifier getIdentifierFirstRep() { 
12391      if (getIdentifier().isEmpty()) {
12392        addIdentifier();
12393      }
12394      return getIdentifier().get(0);
12395    }
12396
12397    /**
12398     * @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
12399     */
12400    public Enumeration<ExplanationOfBenefitStatus> getStatusElement() { 
12401      if (this.status == null)
12402        if (Configuration.errorOnAutoCreate())
12403          throw new Error("Attempt to auto-create ExplanationOfBenefit.status");
12404        else if (Configuration.doAutoCreate())
12405          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory()); // bb
12406      return this.status;
12407    }
12408
12409    public boolean hasStatusElement() { 
12410      return this.status != null && !this.status.isEmpty();
12411    }
12412
12413    public boolean hasStatus() { 
12414      return this.status != null && !this.status.isEmpty();
12415    }
12416
12417    /**
12418     * @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
12419     */
12420    public ExplanationOfBenefit setStatusElement(Enumeration<ExplanationOfBenefitStatus> value) { 
12421      this.status = value;
12422      return this;
12423    }
12424
12425    /**
12426     * @return The status of the resource instance.
12427     */
12428    public ExplanationOfBenefitStatus getStatus() { 
12429      return this.status == null ? null : this.status.getValue();
12430    }
12431
12432    /**
12433     * @param value The status of the resource instance.
12434     */
12435    public ExplanationOfBenefit setStatus(ExplanationOfBenefitStatus value) { 
12436        if (this.status == null)
12437          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory());
12438        this.status.setValue(value);
12439      return this;
12440    }
12441
12442    /**
12443     * @return {@link #type} (The category of claim, e.g. oral, pharmacy, vision, institutional, professional.)
12444     */
12445    public CodeableConcept getType() { 
12446      if (this.type == null)
12447        if (Configuration.errorOnAutoCreate())
12448          throw new Error("Attempt to auto-create ExplanationOfBenefit.type");
12449        else if (Configuration.doAutoCreate())
12450          this.type = new CodeableConcept(); // cc
12451      return this.type;
12452    }
12453
12454    public boolean hasType() { 
12455      return this.type != null && !this.type.isEmpty();
12456    }
12457
12458    /**
12459     * @param value {@link #type} (The category of claim, e.g. oral, pharmacy, vision, institutional, professional.)
12460     */
12461    public ExplanationOfBenefit setType(CodeableConcept value) { 
12462      this.type = value;
12463      return this;
12464    }
12465
12466    /**
12467     * @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.)
12468     */
12469    public CodeableConcept getSubType() { 
12470      if (this.subType == null)
12471        if (Configuration.errorOnAutoCreate())
12472          throw new Error("Attempt to auto-create ExplanationOfBenefit.subType");
12473        else if (Configuration.doAutoCreate())
12474          this.subType = new CodeableConcept(); // cc
12475      return this.subType;
12476    }
12477
12478    public boolean hasSubType() { 
12479      return this.subType != null && !this.subType.isEmpty();
12480    }
12481
12482    /**
12483     * @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.)
12484     */
12485    public ExplanationOfBenefit setSubType(CodeableConcept value) { 
12486      this.subType = value;
12487      return this;
12488    }
12489
12490    /**
12491     * @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
12492     */
12493    public Enumeration<Use> getUseElement() { 
12494      if (this.use == null)
12495        if (Configuration.errorOnAutoCreate())
12496          throw new Error("Attempt to auto-create ExplanationOfBenefit.use");
12497        else if (Configuration.doAutoCreate())
12498          this.use = new Enumeration<Use>(new UseEnumFactory()); // bb
12499      return this.use;
12500    }
12501
12502    public boolean hasUseElement() { 
12503      return this.use != null && !this.use.isEmpty();
12504    }
12505
12506    public boolean hasUse() { 
12507      return this.use != null && !this.use.isEmpty();
12508    }
12509
12510    /**
12511     * @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
12512     */
12513    public ExplanationOfBenefit setUseElement(Enumeration<Use> value) { 
12514      this.use = value;
12515      return this;
12516    }
12517
12518    /**
12519     * @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.
12520     */
12521    public Use getUse() { 
12522      return this.use == null ? null : this.use.getValue();
12523    }
12524
12525    /**
12526     * @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.
12527     */
12528    public ExplanationOfBenefit setUse(Use value) { 
12529        if (this.use == null)
12530          this.use = new Enumeration<Use>(new UseEnumFactory());
12531        this.use.setValue(value);
12532      return this;
12533    }
12534
12535    /**
12536     * @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.)
12537     */
12538    public Reference getPatient() { 
12539      if (this.patient == null)
12540        if (Configuration.errorOnAutoCreate())
12541          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
12542        else if (Configuration.doAutoCreate())
12543          this.patient = new Reference(); // cc
12544      return this.patient;
12545    }
12546
12547    public boolean hasPatient() { 
12548      return this.patient != null && !this.patient.isEmpty();
12549    }
12550
12551    /**
12552     * @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.)
12553     */
12554    public ExplanationOfBenefit setPatient(Reference value) { 
12555      this.patient = value;
12556      return this;
12557    }
12558
12559    /**
12560     * @return {@link #billablePeriod} (The period for which charges are being submitted.)
12561     */
12562    public Period getBillablePeriod() { 
12563      if (this.billablePeriod == null)
12564        if (Configuration.errorOnAutoCreate())
12565          throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
12566        else if (Configuration.doAutoCreate())
12567          this.billablePeriod = new Period(); // cc
12568      return this.billablePeriod;
12569    }
12570
12571    public boolean hasBillablePeriod() { 
12572      return this.billablePeriod != null && !this.billablePeriod.isEmpty();
12573    }
12574
12575    /**
12576     * @param value {@link #billablePeriod} (The period for which charges are being submitted.)
12577     */
12578    public ExplanationOfBenefit setBillablePeriod(Period value) { 
12579      this.billablePeriod = value;
12580      return this;
12581    }
12582
12583    /**
12584     * @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
12585     */
12586    public DateTimeType getCreatedElement() { 
12587      if (this.created == null)
12588        if (Configuration.errorOnAutoCreate())
12589          throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
12590        else if (Configuration.doAutoCreate())
12591          this.created = new DateTimeType(); // bb
12592      return this.created;
12593    }
12594
12595    public boolean hasCreatedElement() { 
12596      return this.created != null && !this.created.isEmpty();
12597    }
12598
12599    public boolean hasCreated() { 
12600      return this.created != null && !this.created.isEmpty();
12601    }
12602
12603    /**
12604     * @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
12605     */
12606    public ExplanationOfBenefit setCreatedElement(DateTimeType value) { 
12607      this.created = value;
12608      return this;
12609    }
12610
12611    /**
12612     * @return The date this resource was created.
12613     */
12614    public Date getCreated() { 
12615      return this.created == null ? null : this.created.getValue();
12616    }
12617
12618    /**
12619     * @param value The date this resource was created.
12620     */
12621    public ExplanationOfBenefit setCreated(Date value) { 
12622        if (this.created == null)
12623          this.created = new DateTimeType();
12624        this.created.setValue(value);
12625      return this;
12626    }
12627
12628    /**
12629     * @return {@link #enterer} (Individual who created the claim, predetermination or preauthorization.)
12630     */
12631    public Reference getEnterer() { 
12632      if (this.enterer == null)
12633        if (Configuration.errorOnAutoCreate())
12634          throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
12635        else if (Configuration.doAutoCreate())
12636          this.enterer = new Reference(); // cc
12637      return this.enterer;
12638    }
12639
12640    public boolean hasEnterer() { 
12641      return this.enterer != null && !this.enterer.isEmpty();
12642    }
12643
12644    /**
12645     * @param value {@link #enterer} (Individual who created the claim, predetermination or preauthorization.)
12646     */
12647    public ExplanationOfBenefit setEnterer(Reference value) { 
12648      this.enterer = value;
12649      return this;
12650    }
12651
12652    /**
12653     * @return {@link #insurer} (The party responsible for authorization, adjudication and reimbursement.)
12654     */
12655    public Reference getInsurer() { 
12656      if (this.insurer == null)
12657        if (Configuration.errorOnAutoCreate())
12658          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
12659        else if (Configuration.doAutoCreate())
12660          this.insurer = new Reference(); // cc
12661      return this.insurer;
12662    }
12663
12664    public boolean hasInsurer() { 
12665      return this.insurer != null && !this.insurer.isEmpty();
12666    }
12667
12668    /**
12669     * @param value {@link #insurer} (The party responsible for authorization, adjudication and reimbursement.)
12670     */
12671    public ExplanationOfBenefit setInsurer(Reference value) { 
12672      this.insurer = value;
12673      return this;
12674    }
12675
12676    /**
12677     * @return {@link #provider} (The provider which is responsible for the claim, predetermination or preauthorization.)
12678     */
12679    public Reference getProvider() { 
12680      if (this.provider == null)
12681        if (Configuration.errorOnAutoCreate())
12682          throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
12683        else if (Configuration.doAutoCreate())
12684          this.provider = new Reference(); // cc
12685      return this.provider;
12686    }
12687
12688    public boolean hasProvider() { 
12689      return this.provider != null && !this.provider.isEmpty();
12690    }
12691
12692    /**
12693     * @param value {@link #provider} (The provider which is responsible for the claim, predetermination or preauthorization.)
12694     */
12695    public ExplanationOfBenefit setProvider(Reference value) { 
12696      this.provider = value;
12697      return this;
12698    }
12699
12700    /**
12701     * @return {@link #priority} (The provider-required urgency of processing the request. Typical values include: stat, routine deferred.)
12702     */
12703    public CodeableConcept getPriority() { 
12704      if (this.priority == null)
12705        if (Configuration.errorOnAutoCreate())
12706          throw new Error("Attempt to auto-create ExplanationOfBenefit.priority");
12707        else if (Configuration.doAutoCreate())
12708          this.priority = new CodeableConcept(); // cc
12709      return this.priority;
12710    }
12711
12712    public boolean hasPriority() { 
12713      return this.priority != null && !this.priority.isEmpty();
12714    }
12715
12716    /**
12717     * @param value {@link #priority} (The provider-required urgency of processing the request. Typical values include: stat, routine deferred.)
12718     */
12719    public ExplanationOfBenefit setPriority(CodeableConcept value) { 
12720      this.priority = value;
12721      return this;
12722    }
12723
12724    /**
12725     * @return {@link #fundsReserveRequested} (A code to indicate whether and for whom funds are to be reserved for future claims.)
12726     */
12727    public CodeableConcept getFundsReserveRequested() { 
12728      if (this.fundsReserveRequested == null)
12729        if (Configuration.errorOnAutoCreate())
12730          throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserveRequested");
12731        else if (Configuration.doAutoCreate())
12732          this.fundsReserveRequested = new CodeableConcept(); // cc
12733      return this.fundsReserveRequested;
12734    }
12735
12736    public boolean hasFundsReserveRequested() { 
12737      return this.fundsReserveRequested != null && !this.fundsReserveRequested.isEmpty();
12738    }
12739
12740    /**
12741     * @param value {@link #fundsReserveRequested} (A code to indicate whether and for whom funds are to be reserved for future claims.)
12742     */
12743    public ExplanationOfBenefit setFundsReserveRequested(CodeableConcept value) { 
12744      this.fundsReserveRequested = value;
12745      return this;
12746    }
12747
12748    /**
12749     * @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.)
12750     */
12751    public CodeableConcept getFundsReserve() { 
12752      if (this.fundsReserve == null)
12753        if (Configuration.errorOnAutoCreate())
12754          throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserve");
12755        else if (Configuration.doAutoCreate())
12756          this.fundsReserve = new CodeableConcept(); // cc
12757      return this.fundsReserve;
12758    }
12759
12760    public boolean hasFundsReserve() { 
12761      return this.fundsReserve != null && !this.fundsReserve.isEmpty();
12762    }
12763
12764    /**
12765     * @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.)
12766     */
12767    public ExplanationOfBenefit setFundsReserve(CodeableConcept value) { 
12768      this.fundsReserve = value;
12769      return this;
12770    }
12771
12772    /**
12773     * @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.)
12774     */
12775    public List<RelatedClaimComponent> getRelated() { 
12776      if (this.related == null)
12777        this.related = new ArrayList<RelatedClaimComponent>();
12778      return this.related;
12779    }
12780
12781    /**
12782     * @return Returns a reference to <code>this</code> for easy method chaining
12783     */
12784    public ExplanationOfBenefit setRelated(List<RelatedClaimComponent> theRelated) { 
12785      this.related = theRelated;
12786      return this;
12787    }
12788
12789    public boolean hasRelated() { 
12790      if (this.related == null)
12791        return false;
12792      for (RelatedClaimComponent item : this.related)
12793        if (!item.isEmpty())
12794          return true;
12795      return false;
12796    }
12797
12798    public RelatedClaimComponent addRelated() { //3
12799      RelatedClaimComponent t = new RelatedClaimComponent();
12800      if (this.related == null)
12801        this.related = new ArrayList<RelatedClaimComponent>();
12802      this.related.add(t);
12803      return t;
12804    }
12805
12806    public ExplanationOfBenefit addRelated(RelatedClaimComponent t) { //3
12807      if (t == null)
12808        return this;
12809      if (this.related == null)
12810        this.related = new ArrayList<RelatedClaimComponent>();
12811      this.related.add(t);
12812      return this;
12813    }
12814
12815    /**
12816     * @return The first repetition of repeating field {@link #related}, creating it if it does not already exist {3}
12817     */
12818    public RelatedClaimComponent getRelatedFirstRep() { 
12819      if (getRelated().isEmpty()) {
12820        addRelated();
12821      }
12822      return getRelated().get(0);
12823    }
12824
12825    /**
12826     * @return {@link #prescription} (Prescription to support the dispensing of pharmacy, device or vision products.)
12827     */
12828    public Reference getPrescription() { 
12829      if (this.prescription == null)
12830        if (Configuration.errorOnAutoCreate())
12831          throw new Error("Attempt to auto-create ExplanationOfBenefit.prescription");
12832        else if (Configuration.doAutoCreate())
12833          this.prescription = new Reference(); // cc
12834      return this.prescription;
12835    }
12836
12837    public boolean hasPrescription() { 
12838      return this.prescription != null && !this.prescription.isEmpty();
12839    }
12840
12841    /**
12842     * @param value {@link #prescription} (Prescription to support the dispensing of pharmacy, device or vision products.)
12843     */
12844    public ExplanationOfBenefit setPrescription(Reference value) { 
12845      this.prescription = value;
12846      return this;
12847    }
12848
12849    /**
12850     * @return {@link #originalPrescription} (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
12851     */
12852    public Reference getOriginalPrescription() { 
12853      if (this.originalPrescription == null)
12854        if (Configuration.errorOnAutoCreate())
12855          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
12856        else if (Configuration.doAutoCreate())
12857          this.originalPrescription = new Reference(); // cc
12858      return this.originalPrescription;
12859    }
12860
12861    public boolean hasOriginalPrescription() { 
12862      return this.originalPrescription != null && !this.originalPrescription.isEmpty();
12863    }
12864
12865    /**
12866     * @param value {@link #originalPrescription} (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
12867     */
12868    public ExplanationOfBenefit setOriginalPrescription(Reference value) { 
12869      this.originalPrescription = value;
12870      return this;
12871    }
12872
12873    /**
12874     * @return {@link #payee} (The party to be reimbursed for cost of the products and services according to the terms of the policy.)
12875     */
12876    public PayeeComponent getPayee() { 
12877      if (this.payee == null)
12878        if (Configuration.errorOnAutoCreate())
12879          throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
12880        else if (Configuration.doAutoCreate())
12881          this.payee = new PayeeComponent(); // cc
12882      return this.payee;
12883    }
12884
12885    public boolean hasPayee() { 
12886      return this.payee != null && !this.payee.isEmpty();
12887    }
12888
12889    /**
12890     * @param value {@link #payee} (The party to be reimbursed for cost of the products and services according to the terms of the policy.)
12891     */
12892    public ExplanationOfBenefit setPayee(PayeeComponent value) { 
12893      this.payee = value;
12894      return this;
12895    }
12896
12897    /**
12898     * @return {@link #referral} (A reference to a referral resource.)
12899     */
12900    public Reference getReferral() { 
12901      if (this.referral == null)
12902        if (Configuration.errorOnAutoCreate())
12903          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
12904        else if (Configuration.doAutoCreate())
12905          this.referral = new Reference(); // cc
12906      return this.referral;
12907    }
12908
12909    public boolean hasReferral() { 
12910      return this.referral != null && !this.referral.isEmpty();
12911    }
12912
12913    /**
12914     * @param value {@link #referral} (A reference to a referral resource.)
12915     */
12916    public ExplanationOfBenefit setReferral(Reference value) { 
12917      this.referral = value;
12918      return this;
12919    }
12920
12921    /**
12922     * @return {@link #facility} (Facility where the services were provided.)
12923     */
12924    public Reference getFacility() { 
12925      if (this.facility == null)
12926        if (Configuration.errorOnAutoCreate())
12927          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
12928        else if (Configuration.doAutoCreate())
12929          this.facility = new Reference(); // cc
12930      return this.facility;
12931    }
12932
12933    public boolean hasFacility() { 
12934      return this.facility != null && !this.facility.isEmpty();
12935    }
12936
12937    /**
12938     * @param value {@link #facility} (Facility where the services were provided.)
12939     */
12940    public ExplanationOfBenefit setFacility(Reference value) { 
12941      this.facility = value;
12942      return this;
12943    }
12944
12945    /**
12946     * @return {@link #claim} (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
12947     */
12948    public Reference getClaim() { 
12949      if (this.claim == null)
12950        if (Configuration.errorOnAutoCreate())
12951          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
12952        else if (Configuration.doAutoCreate())
12953          this.claim = new Reference(); // cc
12954      return this.claim;
12955    }
12956
12957    public boolean hasClaim() { 
12958      return this.claim != null && !this.claim.isEmpty();
12959    }
12960
12961    /**
12962     * @param value {@link #claim} (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
12963     */
12964    public ExplanationOfBenefit setClaim(Reference value) { 
12965      this.claim = value;
12966      return this;
12967    }
12968
12969    /**
12970     * @return {@link #claimResponse} (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
12971     */
12972    public Reference getClaimResponse() { 
12973      if (this.claimResponse == null)
12974        if (Configuration.errorOnAutoCreate())
12975          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
12976        else if (Configuration.doAutoCreate())
12977          this.claimResponse = new Reference(); // cc
12978      return this.claimResponse;
12979    }
12980
12981    public boolean hasClaimResponse() { 
12982      return this.claimResponse != null && !this.claimResponse.isEmpty();
12983    }
12984
12985    /**
12986     * @param value {@link #claimResponse} (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
12987     */
12988    public ExplanationOfBenefit setClaimResponse(Reference value) { 
12989      this.claimResponse = value;
12990      return this;
12991    }
12992
12993    /**
12994     * @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
12995     */
12996    public Enumeration<ClaimProcessingCodes> getOutcomeElement() { 
12997      if (this.outcome == null)
12998        if (Configuration.errorOnAutoCreate())
12999          throw new Error("Attempt to auto-create ExplanationOfBenefit.outcome");
13000        else if (Configuration.doAutoCreate())
13001          this.outcome = new Enumeration<ClaimProcessingCodes>(new ClaimProcessingCodesEnumFactory()); // bb
13002      return this.outcome;
13003    }
13004
13005    public boolean hasOutcomeElement() { 
13006      return this.outcome != null && !this.outcome.isEmpty();
13007    }
13008
13009    public boolean hasOutcome() { 
13010      return this.outcome != null && !this.outcome.isEmpty();
13011    }
13012
13013    /**
13014     * @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
13015     */
13016    public ExplanationOfBenefit setOutcomeElement(Enumeration<ClaimProcessingCodes> value) { 
13017      this.outcome = value;
13018      return this;
13019    }
13020
13021    /**
13022     * @return The outcome of the claim, predetermination, or preauthorization processing.
13023     */
13024    public ClaimProcessingCodes getOutcome() { 
13025      return this.outcome == null ? null : this.outcome.getValue();
13026    }
13027
13028    /**
13029     * @param value The outcome of the claim, predetermination, or preauthorization processing.
13030     */
13031    public ExplanationOfBenefit setOutcome(ClaimProcessingCodes value) { 
13032        if (this.outcome == null)
13033          this.outcome = new Enumeration<ClaimProcessingCodes>(new ClaimProcessingCodesEnumFactory());
13034        this.outcome.setValue(value);
13035      return this;
13036    }
13037
13038    /**
13039     * @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
13040     */
13041    public StringType getDispositionElement() { 
13042      if (this.disposition == null)
13043        if (Configuration.errorOnAutoCreate())
13044          throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
13045        else if (Configuration.doAutoCreate())
13046          this.disposition = new StringType(); // bb
13047      return this.disposition;
13048    }
13049
13050    public boolean hasDispositionElement() { 
13051      return this.disposition != null && !this.disposition.isEmpty();
13052    }
13053
13054    public boolean hasDisposition() { 
13055      return this.disposition != null && !this.disposition.isEmpty();
13056    }
13057
13058    /**
13059     * @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
13060     */
13061    public ExplanationOfBenefit setDispositionElement(StringType value) { 
13062      this.disposition = value;
13063      return this;
13064    }
13065
13066    /**
13067     * @return A human readable description of the status of the adjudication.
13068     */
13069    public String getDisposition() { 
13070      return this.disposition == null ? null : this.disposition.getValue();
13071    }
13072
13073    /**
13074     * @param value A human readable description of the status of the adjudication.
13075     */
13076    public ExplanationOfBenefit setDisposition(String value) { 
13077      if (Utilities.noString(value))
13078        this.disposition = null;
13079      else {
13080        if (this.disposition == null)
13081          this.disposition = new StringType();
13082        this.disposition.setValue(value);
13083      }
13084      return this;
13085    }
13086
13087    /**
13088     * @return {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13089     */
13090    public List<StringType> getPreAuthRef() { 
13091      if (this.preAuthRef == null)
13092        this.preAuthRef = new ArrayList<StringType>();
13093      return this.preAuthRef;
13094    }
13095
13096    /**
13097     * @return Returns a reference to <code>this</code> for easy method chaining
13098     */
13099    public ExplanationOfBenefit setPreAuthRef(List<StringType> thePreAuthRef) { 
13100      this.preAuthRef = thePreAuthRef;
13101      return this;
13102    }
13103
13104    public boolean hasPreAuthRef() { 
13105      if (this.preAuthRef == null)
13106        return false;
13107      for (StringType item : this.preAuthRef)
13108        if (!item.isEmpty())
13109          return true;
13110      return false;
13111    }
13112
13113    /**
13114     * @return {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13115     */
13116    public StringType addPreAuthRefElement() {//2 
13117      StringType t = new StringType();
13118      if (this.preAuthRef == null)
13119        this.preAuthRef = new ArrayList<StringType>();
13120      this.preAuthRef.add(t);
13121      return t;
13122    }
13123
13124    /**
13125     * @param value {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13126     */
13127    public ExplanationOfBenefit addPreAuthRef(String value) { //1
13128      StringType t = new StringType();
13129      t.setValue(value);
13130      if (this.preAuthRef == null)
13131        this.preAuthRef = new ArrayList<StringType>();
13132      this.preAuthRef.add(t);
13133      return this;
13134    }
13135
13136    /**
13137     * @param value {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13138     */
13139    public boolean hasPreAuthRef(String value) { 
13140      if (this.preAuthRef == null)
13141        return false;
13142      for (StringType v : this.preAuthRef)
13143        if (v.getValue().equals(value)) // string
13144          return true;
13145      return false;
13146    }
13147
13148    /**
13149     * @return {@link #preAuthRefPeriod} (The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.)
13150     */
13151    public List<Period> getPreAuthRefPeriod() { 
13152      if (this.preAuthRefPeriod == null)
13153        this.preAuthRefPeriod = new ArrayList<Period>();
13154      return this.preAuthRefPeriod;
13155    }
13156
13157    /**
13158     * @return Returns a reference to <code>this</code> for easy method chaining
13159     */
13160    public ExplanationOfBenefit setPreAuthRefPeriod(List<Period> thePreAuthRefPeriod) { 
13161      this.preAuthRefPeriod = thePreAuthRefPeriod;
13162      return this;
13163    }
13164
13165    public boolean hasPreAuthRefPeriod() { 
13166      if (this.preAuthRefPeriod == null)
13167        return false;
13168      for (Period item : this.preAuthRefPeriod)
13169        if (!item.isEmpty())
13170          return true;
13171      return false;
13172    }
13173
13174    public Period addPreAuthRefPeriod() { //3
13175      Period t = new Period();
13176      if (this.preAuthRefPeriod == null)
13177        this.preAuthRefPeriod = new ArrayList<Period>();
13178      this.preAuthRefPeriod.add(t);
13179      return t;
13180    }
13181
13182    public ExplanationOfBenefit addPreAuthRefPeriod(Period t) { //3
13183      if (t == null)
13184        return this;
13185      if (this.preAuthRefPeriod == null)
13186        this.preAuthRefPeriod = new ArrayList<Period>();
13187      this.preAuthRefPeriod.add(t);
13188      return this;
13189    }
13190
13191    /**
13192     * @return The first repetition of repeating field {@link #preAuthRefPeriod}, creating it if it does not already exist {3}
13193     */
13194    public Period getPreAuthRefPeriodFirstRep() { 
13195      if (getPreAuthRefPeriod().isEmpty()) {
13196        addPreAuthRefPeriod();
13197      }
13198      return getPreAuthRefPeriod().get(0);
13199    }
13200
13201    /**
13202     * @return {@link #careTeam} (The members of the team who provided the products and services.)
13203     */
13204    public List<CareTeamComponent> getCareTeam() { 
13205      if (this.careTeam == null)
13206        this.careTeam = new ArrayList<CareTeamComponent>();
13207      return this.careTeam;
13208    }
13209
13210    /**
13211     * @return Returns a reference to <code>this</code> for easy method chaining
13212     */
13213    public ExplanationOfBenefit setCareTeam(List<CareTeamComponent> theCareTeam) { 
13214      this.careTeam = theCareTeam;
13215      return this;
13216    }
13217
13218    public boolean hasCareTeam() { 
13219      if (this.careTeam == null)
13220        return false;
13221      for (CareTeamComponent item : this.careTeam)
13222        if (!item.isEmpty())
13223          return true;
13224      return false;
13225    }
13226
13227    public CareTeamComponent addCareTeam() { //3
13228      CareTeamComponent t = new CareTeamComponent();
13229      if (this.careTeam == null)
13230        this.careTeam = new ArrayList<CareTeamComponent>();
13231      this.careTeam.add(t);
13232      return t;
13233    }
13234
13235    public ExplanationOfBenefit addCareTeam(CareTeamComponent t) { //3
13236      if (t == null)
13237        return this;
13238      if (this.careTeam == null)
13239        this.careTeam = new ArrayList<CareTeamComponent>();
13240      this.careTeam.add(t);
13241      return this;
13242    }
13243
13244    /**
13245     * @return The first repetition of repeating field {@link #careTeam}, creating it if it does not already exist {3}
13246     */
13247    public CareTeamComponent getCareTeamFirstRep() { 
13248      if (getCareTeam().isEmpty()) {
13249        addCareTeam();
13250      }
13251      return getCareTeam().get(0);
13252    }
13253
13254    /**
13255     * @return {@link #supportingInfo} (Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.)
13256     */
13257    public List<SupportingInformationComponent> getSupportingInfo() { 
13258      if (this.supportingInfo == null)
13259        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13260      return this.supportingInfo;
13261    }
13262
13263    /**
13264     * @return Returns a reference to <code>this</code> for easy method chaining
13265     */
13266    public ExplanationOfBenefit setSupportingInfo(List<SupportingInformationComponent> theSupportingInfo) { 
13267      this.supportingInfo = theSupportingInfo;
13268      return this;
13269    }
13270
13271    public boolean hasSupportingInfo() { 
13272      if (this.supportingInfo == null)
13273        return false;
13274      for (SupportingInformationComponent item : this.supportingInfo)
13275        if (!item.isEmpty())
13276          return true;
13277      return false;
13278    }
13279
13280    public SupportingInformationComponent addSupportingInfo() { //3
13281      SupportingInformationComponent t = new SupportingInformationComponent();
13282      if (this.supportingInfo == null)
13283        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13284      this.supportingInfo.add(t);
13285      return t;
13286    }
13287
13288    public ExplanationOfBenefit addSupportingInfo(SupportingInformationComponent t) { //3
13289      if (t == null)
13290        return this;
13291      if (this.supportingInfo == null)
13292        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13293      this.supportingInfo.add(t);
13294      return this;
13295    }
13296
13297    /**
13298     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist {3}
13299     */
13300    public SupportingInformationComponent getSupportingInfoFirstRep() { 
13301      if (getSupportingInfo().isEmpty()) {
13302        addSupportingInfo();
13303      }
13304      return getSupportingInfo().get(0);
13305    }
13306
13307    /**
13308     * @return {@link #diagnosis} (Information about diagnoses relevant to the claim items.)
13309     */
13310    public List<DiagnosisComponent> getDiagnosis() { 
13311      if (this.diagnosis == null)
13312        this.diagnosis = new ArrayList<DiagnosisComponent>();
13313      return this.diagnosis;
13314    }
13315
13316    /**
13317     * @return Returns a reference to <code>this</code> for easy method chaining
13318     */
13319    public ExplanationOfBenefit setDiagnosis(List<DiagnosisComponent> theDiagnosis) { 
13320      this.diagnosis = theDiagnosis;
13321      return this;
13322    }
13323
13324    public boolean hasDiagnosis() { 
13325      if (this.diagnosis == null)
13326        return false;
13327      for (DiagnosisComponent item : this.diagnosis)
13328        if (!item.isEmpty())
13329          return true;
13330      return false;
13331    }
13332
13333    public DiagnosisComponent addDiagnosis() { //3
13334      DiagnosisComponent t = new DiagnosisComponent();
13335      if (this.diagnosis == null)
13336        this.diagnosis = new ArrayList<DiagnosisComponent>();
13337      this.diagnosis.add(t);
13338      return t;
13339    }
13340
13341    public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { //3
13342      if (t == null)
13343        return this;
13344      if (this.diagnosis == null)
13345        this.diagnosis = new ArrayList<DiagnosisComponent>();
13346      this.diagnosis.add(t);
13347      return this;
13348    }
13349
13350    /**
13351     * @return The first repetition of repeating field {@link #diagnosis}, creating it if it does not already exist {3}
13352     */
13353    public DiagnosisComponent getDiagnosisFirstRep() { 
13354      if (getDiagnosis().isEmpty()) {
13355        addDiagnosis();
13356      }
13357      return getDiagnosis().get(0);
13358    }
13359
13360    /**
13361     * @return {@link #procedure} (Procedures performed on the patient relevant to the billing items with the claim.)
13362     */
13363    public List<ProcedureComponent> getProcedure() { 
13364      if (this.procedure == null)
13365        this.procedure = new ArrayList<ProcedureComponent>();
13366      return this.procedure;
13367    }
13368
13369    /**
13370     * @return Returns a reference to <code>this</code> for easy method chaining
13371     */
13372    public ExplanationOfBenefit setProcedure(List<ProcedureComponent> theProcedure) { 
13373      this.procedure = theProcedure;
13374      return this;
13375    }
13376
13377    public boolean hasProcedure() { 
13378      if (this.procedure == null)
13379        return false;
13380      for (ProcedureComponent item : this.procedure)
13381        if (!item.isEmpty())
13382          return true;
13383      return false;
13384    }
13385
13386    public ProcedureComponent addProcedure() { //3
13387      ProcedureComponent t = new ProcedureComponent();
13388      if (this.procedure == null)
13389        this.procedure = new ArrayList<ProcedureComponent>();
13390      this.procedure.add(t);
13391      return t;
13392    }
13393
13394    public ExplanationOfBenefit addProcedure(ProcedureComponent t) { //3
13395      if (t == null)
13396        return this;
13397      if (this.procedure == null)
13398        this.procedure = new ArrayList<ProcedureComponent>();
13399      this.procedure.add(t);
13400      return this;
13401    }
13402
13403    /**
13404     * @return The first repetition of repeating field {@link #procedure}, creating it if it does not already exist {3}
13405     */
13406    public ProcedureComponent getProcedureFirstRep() { 
13407      if (getProcedure().isEmpty()) {
13408        addProcedure();
13409      }
13410      return getProcedure().get(0);
13411    }
13412
13413    /**
13414     * @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
13415     */
13416    public PositiveIntType getPrecedenceElement() { 
13417      if (this.precedence == null)
13418        if (Configuration.errorOnAutoCreate())
13419          throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
13420        else if (Configuration.doAutoCreate())
13421          this.precedence = new PositiveIntType(); // bb
13422      return this.precedence;
13423    }
13424
13425    public boolean hasPrecedenceElement() { 
13426      return this.precedence != null && !this.precedence.isEmpty();
13427    }
13428
13429    public boolean hasPrecedence() { 
13430      return this.precedence != null && !this.precedence.isEmpty();
13431    }
13432
13433    /**
13434     * @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
13435     */
13436    public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) { 
13437      this.precedence = value;
13438      return this;
13439    }
13440
13441    /**
13442     * @return This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
13443     */
13444    public int getPrecedence() { 
13445      return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
13446    }
13447
13448    /**
13449     * @param value This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
13450     */
13451    public ExplanationOfBenefit setPrecedence(int value) { 
13452        if (this.precedence == null)
13453          this.precedence = new PositiveIntType();
13454        this.precedence.setValue(value);
13455      return this;
13456    }
13457
13458    /**
13459     * @return {@link #insurance} (Financial instruments for reimbursement for the health care products and services specified on the claim.)
13460     */
13461    public List<InsuranceComponent> getInsurance() { 
13462      if (this.insurance == null)
13463        this.insurance = new ArrayList<InsuranceComponent>();
13464      return this.insurance;
13465    }
13466
13467    /**
13468     * @return Returns a reference to <code>this</code> for easy method chaining
13469     */
13470    public ExplanationOfBenefit setInsurance(List<InsuranceComponent> theInsurance) { 
13471      this.insurance = theInsurance;
13472      return this;
13473    }
13474
13475    public boolean hasInsurance() { 
13476      if (this.insurance == null)
13477        return false;
13478      for (InsuranceComponent item : this.insurance)
13479        if (!item.isEmpty())
13480          return true;
13481      return false;
13482    }
13483
13484    public InsuranceComponent addInsurance() { //3
13485      InsuranceComponent t = new InsuranceComponent();
13486      if (this.insurance == null)
13487        this.insurance = new ArrayList<InsuranceComponent>();
13488      this.insurance.add(t);
13489      return t;
13490    }
13491
13492    public ExplanationOfBenefit addInsurance(InsuranceComponent t) { //3
13493      if (t == null)
13494        return this;
13495      if (this.insurance == null)
13496        this.insurance = new ArrayList<InsuranceComponent>();
13497      this.insurance.add(t);
13498      return this;
13499    }
13500
13501    /**
13502     * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist {3}
13503     */
13504    public InsuranceComponent getInsuranceFirstRep() { 
13505      if (getInsurance().isEmpty()) {
13506        addInsurance();
13507      }
13508      return getInsurance().get(0);
13509    }
13510
13511    /**
13512     * @return {@link #accident} (Details of a accident which resulted in injuries which required the products and services listed in the claim.)
13513     */
13514    public AccidentComponent getAccident() { 
13515      if (this.accident == null)
13516        if (Configuration.errorOnAutoCreate())
13517          throw new Error("Attempt to auto-create ExplanationOfBenefit.accident");
13518        else if (Configuration.doAutoCreate())
13519          this.accident = new AccidentComponent(); // cc
13520      return this.accident;
13521    }
13522
13523    public boolean hasAccident() { 
13524      return this.accident != null && !this.accident.isEmpty();
13525    }
13526
13527    /**
13528     * @param value {@link #accident} (Details of a accident which resulted in injuries which required the products and services listed in the claim.)
13529     */
13530    public ExplanationOfBenefit setAccident(AccidentComponent value) { 
13531      this.accident = value;
13532      return this;
13533    }
13534
13535    /**
13536     * @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.)
13537     */
13538    public List<ItemComponent> getItem() { 
13539      if (this.item == null)
13540        this.item = new ArrayList<ItemComponent>();
13541      return this.item;
13542    }
13543
13544    /**
13545     * @return Returns a reference to <code>this</code> for easy method chaining
13546     */
13547    public ExplanationOfBenefit setItem(List<ItemComponent> theItem) { 
13548      this.item = theItem;
13549      return this;
13550    }
13551
13552    public boolean hasItem() { 
13553      if (this.item == null)
13554        return false;
13555      for (ItemComponent item : this.item)
13556        if (!item.isEmpty())
13557          return true;
13558      return false;
13559    }
13560
13561    public ItemComponent addItem() { //3
13562      ItemComponent t = new ItemComponent();
13563      if (this.item == null)
13564        this.item = new ArrayList<ItemComponent>();
13565      this.item.add(t);
13566      return t;
13567    }
13568
13569    public ExplanationOfBenefit addItem(ItemComponent t) { //3
13570      if (t == null)
13571        return this;
13572      if (this.item == null)
13573        this.item = new ArrayList<ItemComponent>();
13574      this.item.add(t);
13575      return this;
13576    }
13577
13578    /**
13579     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist {3}
13580     */
13581    public ItemComponent getItemFirstRep() { 
13582      if (getItem().isEmpty()) {
13583        addItem();
13584      }
13585      return getItem().get(0);
13586    }
13587
13588    /**
13589     * @return {@link #addItem} (The first-tier service adjudications for payor added product or service lines.)
13590     */
13591    public List<AddedItemComponent> getAddItem() { 
13592      if (this.addItem == null)
13593        this.addItem = new ArrayList<AddedItemComponent>();
13594      return this.addItem;
13595    }
13596
13597    /**
13598     * @return Returns a reference to <code>this</code> for easy method chaining
13599     */
13600    public ExplanationOfBenefit setAddItem(List<AddedItemComponent> theAddItem) { 
13601      this.addItem = theAddItem;
13602      return this;
13603    }
13604
13605    public boolean hasAddItem() { 
13606      if (this.addItem == null)
13607        return false;
13608      for (AddedItemComponent item : this.addItem)
13609        if (!item.isEmpty())
13610          return true;
13611      return false;
13612    }
13613
13614    public AddedItemComponent addAddItem() { //3
13615      AddedItemComponent t = new AddedItemComponent();
13616      if (this.addItem == null)
13617        this.addItem = new ArrayList<AddedItemComponent>();
13618      this.addItem.add(t);
13619      return t;
13620    }
13621
13622    public ExplanationOfBenefit addAddItem(AddedItemComponent t) { //3
13623      if (t == null)
13624        return this;
13625      if (this.addItem == null)
13626        this.addItem = new ArrayList<AddedItemComponent>();
13627      this.addItem.add(t);
13628      return this;
13629    }
13630
13631    /**
13632     * @return The first repetition of repeating field {@link #addItem}, creating it if it does not already exist {3}
13633     */
13634    public AddedItemComponent getAddItemFirstRep() { 
13635      if (getAddItem().isEmpty()) {
13636        addAddItem();
13637      }
13638      return getAddItem().get(0);
13639    }
13640
13641    /**
13642     * @return {@link #adjudication} (The adjudication results which are presented at the header level rather than at the line-item or add-item levels.)
13643     */
13644    public List<AdjudicationComponent> getAdjudication() { 
13645      if (this.adjudication == null)
13646        this.adjudication = new ArrayList<AdjudicationComponent>();
13647      return this.adjudication;
13648    }
13649
13650    /**
13651     * @return Returns a reference to <code>this</code> for easy method chaining
13652     */
13653    public ExplanationOfBenefit setAdjudication(List<AdjudicationComponent> theAdjudication) { 
13654      this.adjudication = theAdjudication;
13655      return this;
13656    }
13657
13658    public boolean hasAdjudication() { 
13659      if (this.adjudication == null)
13660        return false;
13661      for (AdjudicationComponent item : this.adjudication)
13662        if (!item.isEmpty())
13663          return true;
13664      return false;
13665    }
13666
13667    public AdjudicationComponent addAdjudication() { //3
13668      AdjudicationComponent t = new AdjudicationComponent();
13669      if (this.adjudication == null)
13670        this.adjudication = new ArrayList<AdjudicationComponent>();
13671      this.adjudication.add(t);
13672      return t;
13673    }
13674
13675    public ExplanationOfBenefit addAdjudication(AdjudicationComponent t) { //3
13676      if (t == null)
13677        return this;
13678      if (this.adjudication == null)
13679        this.adjudication = new ArrayList<AdjudicationComponent>();
13680      this.adjudication.add(t);
13681      return this;
13682    }
13683
13684    /**
13685     * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist {3}
13686     */
13687    public AdjudicationComponent getAdjudicationFirstRep() { 
13688      if (getAdjudication().isEmpty()) {
13689        addAdjudication();
13690      }
13691      return getAdjudication().get(0);
13692    }
13693
13694    /**
13695     * @return {@link #total} (Categorized monetary totals for the adjudication.)
13696     */
13697    public List<TotalComponent> getTotal() { 
13698      if (this.total == null)
13699        this.total = new ArrayList<TotalComponent>();
13700      return this.total;
13701    }
13702
13703    /**
13704     * @return Returns a reference to <code>this</code> for easy method chaining
13705     */
13706    public ExplanationOfBenefit setTotal(List<TotalComponent> theTotal) { 
13707      this.total = theTotal;
13708      return this;
13709    }
13710
13711    public boolean hasTotal() { 
13712      if (this.total == null)
13713        return false;
13714      for (TotalComponent item : this.total)
13715        if (!item.isEmpty())
13716          return true;
13717      return false;
13718    }
13719
13720    public TotalComponent addTotal() { //3
13721      TotalComponent t = new TotalComponent();
13722      if (this.total == null)
13723        this.total = new ArrayList<TotalComponent>();
13724      this.total.add(t);
13725      return t;
13726    }
13727
13728    public ExplanationOfBenefit addTotal(TotalComponent t) { //3
13729      if (t == null)
13730        return this;
13731      if (this.total == null)
13732        this.total = new ArrayList<TotalComponent>();
13733      this.total.add(t);
13734      return this;
13735    }
13736
13737    /**
13738     * @return The first repetition of repeating field {@link #total}, creating it if it does not already exist {3}
13739     */
13740    public TotalComponent getTotalFirstRep() { 
13741      if (getTotal().isEmpty()) {
13742        addTotal();
13743      }
13744      return getTotal().get(0);
13745    }
13746
13747    /**
13748     * @return {@link #payment} (Payment details for the adjudication of the claim.)
13749     */
13750    public PaymentComponent getPayment() { 
13751      if (this.payment == null)
13752        if (Configuration.errorOnAutoCreate())
13753          throw new Error("Attempt to auto-create ExplanationOfBenefit.payment");
13754        else if (Configuration.doAutoCreate())
13755          this.payment = new PaymentComponent(); // cc
13756      return this.payment;
13757    }
13758
13759    public boolean hasPayment() { 
13760      return this.payment != null && !this.payment.isEmpty();
13761    }
13762
13763    /**
13764     * @param value {@link #payment} (Payment details for the adjudication of the claim.)
13765     */
13766    public ExplanationOfBenefit setPayment(PaymentComponent value) { 
13767      this.payment = value;
13768      return this;
13769    }
13770
13771    /**
13772     * @return {@link #formCode} (A code for the form to be used for printing the content.)
13773     */
13774    public CodeableConcept getFormCode() { 
13775      if (this.formCode == null)
13776        if (Configuration.errorOnAutoCreate())
13777          throw new Error("Attempt to auto-create ExplanationOfBenefit.formCode");
13778        else if (Configuration.doAutoCreate())
13779          this.formCode = new CodeableConcept(); // cc
13780      return this.formCode;
13781    }
13782
13783    public boolean hasFormCode() { 
13784      return this.formCode != null && !this.formCode.isEmpty();
13785    }
13786
13787    /**
13788     * @param value {@link #formCode} (A code for the form to be used for printing the content.)
13789     */
13790    public ExplanationOfBenefit setFormCode(CodeableConcept value) { 
13791      this.formCode = value;
13792      return this;
13793    }
13794
13795    /**
13796     * @return {@link #form} (The actual form, by reference or inclusion, for printing the content or an EOB.)
13797     */
13798    public Attachment getForm() { 
13799      if (this.form == null)
13800        if (Configuration.errorOnAutoCreate())
13801          throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
13802        else if (Configuration.doAutoCreate())
13803          this.form = new Attachment(); // cc
13804      return this.form;
13805    }
13806
13807    public boolean hasForm() { 
13808      return this.form != null && !this.form.isEmpty();
13809    }
13810
13811    /**
13812     * @param value {@link #form} (The actual form, by reference or inclusion, for printing the content or an EOB.)
13813     */
13814    public ExplanationOfBenefit setForm(Attachment value) { 
13815      this.form = value;
13816      return this;
13817    }
13818
13819    /**
13820     * @return {@link #processNote} (A note that describes or explains adjudication results in a human readable form.)
13821     */
13822    public List<NoteComponent> getProcessNote() { 
13823      if (this.processNote == null)
13824        this.processNote = new ArrayList<NoteComponent>();
13825      return this.processNote;
13826    }
13827
13828    /**
13829     * @return Returns a reference to <code>this</code> for easy method chaining
13830     */
13831    public ExplanationOfBenefit setProcessNote(List<NoteComponent> theProcessNote) { 
13832      this.processNote = theProcessNote;
13833      return this;
13834    }
13835
13836    public boolean hasProcessNote() { 
13837      if (this.processNote == null)
13838        return false;
13839      for (NoteComponent item : this.processNote)
13840        if (!item.isEmpty())
13841          return true;
13842      return false;
13843    }
13844
13845    public NoteComponent addProcessNote() { //3
13846      NoteComponent t = new NoteComponent();
13847      if (this.processNote == null)
13848        this.processNote = new ArrayList<NoteComponent>();
13849      this.processNote.add(t);
13850      return t;
13851    }
13852
13853    public ExplanationOfBenefit addProcessNote(NoteComponent t) { //3
13854      if (t == null)
13855        return this;
13856      if (this.processNote == null)
13857        this.processNote = new ArrayList<NoteComponent>();
13858      this.processNote.add(t);
13859      return this;
13860    }
13861
13862    /**
13863     * @return The first repetition of repeating field {@link #processNote}, creating it if it does not already exist {3}
13864     */
13865    public NoteComponent getProcessNoteFirstRep() { 
13866      if (getProcessNote().isEmpty()) {
13867        addProcessNote();
13868      }
13869      return getProcessNote().get(0);
13870    }
13871
13872    /**
13873     * @return {@link #benefitPeriod} (The term of the benefits documented in this response.)
13874     */
13875    public Period getBenefitPeriod() { 
13876      if (this.benefitPeriod == null)
13877        if (Configuration.errorOnAutoCreate())
13878          throw new Error("Attempt to auto-create ExplanationOfBenefit.benefitPeriod");
13879        else if (Configuration.doAutoCreate())
13880          this.benefitPeriod = new Period(); // cc
13881      return this.benefitPeriod;
13882    }
13883
13884    public boolean hasBenefitPeriod() { 
13885      return this.benefitPeriod != null && !this.benefitPeriod.isEmpty();
13886    }
13887
13888    /**
13889     * @param value {@link #benefitPeriod} (The term of the benefits documented in this response.)
13890     */
13891    public ExplanationOfBenefit setBenefitPeriod(Period value) { 
13892      this.benefitPeriod = value;
13893      return this;
13894    }
13895
13896    /**
13897     * @return {@link #benefitBalance} (Balance by Benefit Category.)
13898     */
13899    public List<BenefitBalanceComponent> getBenefitBalance() { 
13900      if (this.benefitBalance == null)
13901        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
13902      return this.benefitBalance;
13903    }
13904
13905    /**
13906     * @return Returns a reference to <code>this</code> for easy method chaining
13907     */
13908    public ExplanationOfBenefit setBenefitBalance(List<BenefitBalanceComponent> theBenefitBalance) { 
13909      this.benefitBalance = theBenefitBalance;
13910      return this;
13911    }
13912
13913    public boolean hasBenefitBalance() { 
13914      if (this.benefitBalance == null)
13915        return false;
13916      for (BenefitBalanceComponent item : this.benefitBalance)
13917        if (!item.isEmpty())
13918          return true;
13919      return false;
13920    }
13921
13922    public BenefitBalanceComponent addBenefitBalance() { //3
13923      BenefitBalanceComponent t = new BenefitBalanceComponent();
13924      if (this.benefitBalance == null)
13925        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
13926      this.benefitBalance.add(t);
13927      return t;
13928    }
13929
13930    public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { //3
13931      if (t == null)
13932        return this;
13933      if (this.benefitBalance == null)
13934        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
13935      this.benefitBalance.add(t);
13936      return this;
13937    }
13938
13939    /**
13940     * @return The first repetition of repeating field {@link #benefitBalance}, creating it if it does not already exist {3}
13941     */
13942    public BenefitBalanceComponent getBenefitBalanceFirstRep() { 
13943      if (getBenefitBalance().isEmpty()) {
13944        addBenefitBalance();
13945      }
13946      return getBenefitBalance().get(0);
13947    }
13948
13949      protected void listChildren(List<Property> children) {
13950        super.listChildren(children);
13951        children.add(new Property("identifier", "Identifier", "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier));
13952        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
13953        children.add(new Property("type", "CodeableConcept", "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type));
13954        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));
13955        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));
13956        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));
13957        children.add(new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1, billablePeriod));
13958        children.add(new Property("created", "dateTime", "The date this resource was created.", 0, 1, created));
13959        children.add(new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer));
13960        children.add(new Property("insurer", "Reference(Organization)", "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer));
13961        children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider));
13962        children.add(new Property("priority", "CodeableConcept", "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.", 0, 1, priority));
13963        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));
13964        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));
13965        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));
13966        children.add(new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription));
13967        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));
13968        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));
13969        children.add(new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral));
13970        children.add(new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility));
13971        children.add(new Property("claim", "Reference(Claim)", "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.", 0, 1, claim));
13972        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));
13973        children.add(new Property("outcome", "code", "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome));
13974        children.add(new Property("disposition", "string", "A human readable description of the status of the adjudication.", 0, 1, disposition));
13975        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));
13976        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));
13977        children.add(new Property("careTeam", "", "The members of the team who provided the products and services.", 0, java.lang.Integer.MAX_VALUE, careTeam));
13978        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));
13979        children.add(new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
13980        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));
13981        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));
13982        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));
13983        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));
13984        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));
13985        children.add(new Property("addItem", "", "The first-tier service adjudications for payor added product or service lines.", 0, java.lang.Integer.MAX_VALUE, addItem));
13986        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));
13987        children.add(new Property("total", "", "Categorized monetary totals for the adjudication.", 0, java.lang.Integer.MAX_VALUE, total));
13988        children.add(new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment));
13989        children.add(new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.", 0, 1, formCode));
13990        children.add(new Property("form", "Attachment", "The actual form, by reference or inclusion, for printing the content or an EOB.", 0, 1, form));
13991        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));
13992        children.add(new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1, benefitPeriod));
13993        children.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance));
13994      }
13995
13996      @Override
13997      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
13998        switch (_hash) {
13999        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier);
14000        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
14001        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type);
14002        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);
14003        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);
14004        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);
14005        case -332066046: /*billablePeriod*/  return new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1, billablePeriod);
14006        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date this resource was created.", 0, 1, created);
14007        case -1591951995: /*enterer*/  return new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer);
14008        case 1957615864: /*insurer*/  return new Property("insurer", "Reference(Organization)", "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer);
14009        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);
14010        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);
14011        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);
14012        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);
14013        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);
14014        case 460301338: /*prescription*/  return new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription);
14015        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);
14016        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);
14017        case -722568291: /*referral*/  return new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral);
14018        case 501116579: /*facility*/  return new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility);
14019        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);
14020        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);
14021        case -1106507950: /*outcome*/  return new Property("outcome", "code", "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome);
14022        case 583380919: /*disposition*/  return new Property("disposition", "string", "A human readable description of the status of the adjudication.", 0, 1, disposition);
14023        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);
14024        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);
14025        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);
14026        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);
14027        case 1196993265: /*diagnosis*/  return new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0, java.lang.Integer.MAX_VALUE, diagnosis);
14028        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);
14029        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);
14030        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);
14031        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);
14032        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);
14033        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);
14034        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);
14035        case 110549828: /*total*/  return new Property("total", "", "Categorized monetary totals for the adjudication.", 0, java.lang.Integer.MAX_VALUE, total);
14036        case -786681338: /*payment*/  return new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment);
14037        case 473181393: /*formCode*/  return new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.", 0, 1, formCode);
14038        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);
14039        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);
14040        case -407369416: /*benefitPeriod*/  return new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1, benefitPeriod);
14041        case 596003397: /*benefitBalance*/  return new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance);
14042        default: return super.getNamedProperty(_hash, _name, _checkValid);
14043        }
14044
14045      }
14046
14047      @Override
14048      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
14049        switch (hash) {
14050        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
14051        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ExplanationOfBenefitStatus>
14052        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
14053        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
14054        case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<Use>
14055        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
14056        case -332066046: /*billablePeriod*/ return this.billablePeriod == null ? new Base[0] : new Base[] {this.billablePeriod}; // Period
14057        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
14058        case -1591951995: /*enterer*/ return this.enterer == null ? new Base[0] : new Base[] {this.enterer}; // Reference
14059        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
14060        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
14061        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
14062        case -1688904576: /*fundsReserveRequested*/ return this.fundsReserveRequested == null ? new Base[0] : new Base[] {this.fundsReserveRequested}; // CodeableConcept
14063        case 1314609806: /*fundsReserve*/ return this.fundsReserve == null ? new Base[0] : new Base[] {this.fundsReserve}; // CodeableConcept
14064        case 1090493483: /*related*/ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimComponent
14065        case 460301338: /*prescription*/ return this.prescription == null ? new Base[0] : new Base[] {this.prescription}; // Reference
14066        case -1814015861: /*originalPrescription*/ return this.originalPrescription == null ? new Base[0] : new Base[] {this.originalPrescription}; // Reference
14067        case 106443592: /*payee*/ return this.payee == null ? new Base[0] : new Base[] {this.payee}; // PayeeComponent
14068        case -722568291: /*referral*/ return this.referral == null ? new Base[0] : new Base[] {this.referral}; // Reference
14069        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Reference
14070        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
14071        case 689513629: /*claimResponse*/ return this.claimResponse == null ? new Base[0] : new Base[] {this.claimResponse}; // Reference
14072        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // Enumeration<ClaimProcessingCodes>
14073        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
14074        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
14075        case -1262920311: /*preAuthRefPeriod*/ return this.preAuthRefPeriod == null ? new Base[0] : this.preAuthRefPeriod.toArray(new Base[this.preAuthRefPeriod.size()]); // Period
14076        case -7323378: /*careTeam*/ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // CareTeamComponent
14077        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // SupportingInformationComponent
14078        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
14079        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
14080        case 159695370: /*precedence*/ return this.precedence == null ? new Base[0] : new Base[] {this.precedence}; // PositiveIntType
14081        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // InsuranceComponent
14082        case -2143202801: /*accident*/ return this.accident == null ? new Base[0] : new Base[] {this.accident}; // AccidentComponent
14083        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
14084        case -1148899500: /*addItem*/ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
14085        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
14086        case 110549828: /*total*/ return this.total == null ? new Base[0] : this.total.toArray(new Base[this.total.size()]); // TotalComponent
14087        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // PaymentComponent
14088        case 473181393: /*formCode*/ return this.formCode == null ? new Base[0] : new Base[] {this.formCode}; // CodeableConcept
14089        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // Attachment
14090        case 202339073: /*processNote*/ return this.processNote == null ? new Base[0] : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
14091        case -407369416: /*benefitPeriod*/ return this.benefitPeriod == null ? new Base[0] : new Base[] {this.benefitPeriod}; // Period
14092        case 596003397: /*benefitBalance*/ return this.benefitBalance == null ? new Base[0] : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
14093        default: return super.getProperty(hash, name, checkValid);
14094        }
14095
14096      }
14097
14098      @Override
14099      public Base setProperty(int hash, String name, Base value) throws FHIRException {
14100        switch (hash) {
14101        case -1618432855: // identifier
14102          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
14103          return value;
14104        case -892481550: // status
14105          value = new ExplanationOfBenefitStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
14106          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
14107          return value;
14108        case 3575610: // type
14109          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14110          return value;
14111        case -1868521062: // subType
14112          this.subType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14113          return value;
14114        case 116103: // use
14115          value = new UseEnumFactory().fromType(TypeConvertor.castToCode(value));
14116          this.use = (Enumeration) value; // Enumeration<Use>
14117          return value;
14118        case -791418107: // patient
14119          this.patient = TypeConvertor.castToReference(value); // Reference
14120          return value;
14121        case -332066046: // billablePeriod
14122          this.billablePeriod = TypeConvertor.castToPeriod(value); // Period
14123          return value;
14124        case 1028554472: // created
14125          this.created = TypeConvertor.castToDateTime(value); // DateTimeType
14126          return value;
14127        case -1591951995: // enterer
14128          this.enterer = TypeConvertor.castToReference(value); // Reference
14129          return value;
14130        case 1957615864: // insurer
14131          this.insurer = TypeConvertor.castToReference(value); // Reference
14132          return value;
14133        case -987494927: // provider
14134          this.provider = TypeConvertor.castToReference(value); // Reference
14135          return value;
14136        case -1165461084: // priority
14137          this.priority = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14138          return value;
14139        case -1688904576: // fundsReserveRequested
14140          this.fundsReserveRequested = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14141          return value;
14142        case 1314609806: // fundsReserve
14143          this.fundsReserve = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14144          return value;
14145        case 1090493483: // related
14146          this.getRelated().add((RelatedClaimComponent) value); // RelatedClaimComponent
14147          return value;
14148        case 460301338: // prescription
14149          this.prescription = TypeConvertor.castToReference(value); // Reference
14150          return value;
14151        case -1814015861: // originalPrescription
14152          this.originalPrescription = TypeConvertor.castToReference(value); // Reference
14153          return value;
14154        case 106443592: // payee
14155          this.payee = (PayeeComponent) value; // PayeeComponent
14156          return value;
14157        case -722568291: // referral
14158          this.referral = TypeConvertor.castToReference(value); // Reference
14159          return value;
14160        case 501116579: // facility
14161          this.facility = TypeConvertor.castToReference(value); // Reference
14162          return value;
14163        case 94742588: // claim
14164          this.claim = TypeConvertor.castToReference(value); // Reference
14165          return value;
14166        case 689513629: // claimResponse
14167          this.claimResponse = TypeConvertor.castToReference(value); // Reference
14168          return value;
14169        case -1106507950: // outcome
14170          value = new ClaimProcessingCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
14171          this.outcome = (Enumeration) value; // Enumeration<ClaimProcessingCodes>
14172          return value;
14173        case 583380919: // disposition
14174          this.disposition = TypeConvertor.castToString(value); // StringType
14175          return value;
14176        case 522246568: // preAuthRef
14177          this.getPreAuthRef().add(TypeConvertor.castToString(value)); // StringType
14178          return value;
14179        case -1262920311: // preAuthRefPeriod
14180          this.getPreAuthRefPeriod().add(TypeConvertor.castToPeriod(value)); // Period
14181          return value;
14182        case -7323378: // careTeam
14183          this.getCareTeam().add((CareTeamComponent) value); // CareTeamComponent
14184          return value;
14185        case 1922406657: // supportingInfo
14186          this.getSupportingInfo().add((SupportingInformationComponent) value); // SupportingInformationComponent
14187          return value;
14188        case 1196993265: // diagnosis
14189          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
14190          return value;
14191        case -1095204141: // procedure
14192          this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
14193          return value;
14194        case 159695370: // precedence
14195          this.precedence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
14196          return value;
14197        case 73049818: // insurance
14198          this.getInsurance().add((InsuranceComponent) value); // InsuranceComponent
14199          return value;
14200        case -2143202801: // accident
14201          this.accident = (AccidentComponent) value; // AccidentComponent
14202          return value;
14203        case 3242771: // item
14204          this.getItem().add((ItemComponent) value); // ItemComponent
14205          return value;
14206        case -1148899500: // addItem
14207          this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
14208          return value;
14209        case -231349275: // adjudication
14210          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
14211          return value;
14212        case 110549828: // total
14213          this.getTotal().add((TotalComponent) value); // TotalComponent
14214          return value;
14215        case -786681338: // payment
14216          this.payment = (PaymentComponent) value; // PaymentComponent
14217          return value;
14218        case 473181393: // formCode
14219          this.formCode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14220          return value;
14221        case 3148996: // form
14222          this.form = TypeConvertor.castToAttachment(value); // Attachment
14223          return value;
14224        case 202339073: // processNote
14225          this.getProcessNote().add((NoteComponent) value); // NoteComponent
14226          return value;
14227        case -407369416: // benefitPeriod
14228          this.benefitPeriod = TypeConvertor.castToPeriod(value); // Period
14229          return value;
14230        case 596003397: // benefitBalance
14231          this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
14232          return value;
14233        default: return super.setProperty(hash, name, value);
14234        }
14235
14236      }
14237
14238      @Override
14239      public Base setProperty(String name, Base value) throws FHIRException {
14240        if (name.equals("identifier")) {
14241          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
14242        } else if (name.equals("status")) {
14243          value = new ExplanationOfBenefitStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
14244          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
14245        } else if (name.equals("type")) {
14246          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14247        } else if (name.equals("subType")) {
14248          this.subType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14249        } else if (name.equals("use")) {
14250          value = new UseEnumFactory().fromType(TypeConvertor.castToCode(value));
14251          this.use = (Enumeration) value; // Enumeration<Use>
14252        } else if (name.equals("patient")) {
14253          this.patient = TypeConvertor.castToReference(value); // Reference
14254        } else if (name.equals("billablePeriod")) {
14255          this.billablePeriod = TypeConvertor.castToPeriod(value); // Period
14256        } else if (name.equals("created")) {
14257          this.created = TypeConvertor.castToDateTime(value); // DateTimeType
14258        } else if (name.equals("enterer")) {
14259          this.enterer = TypeConvertor.castToReference(value); // Reference
14260        } else if (name.equals("insurer")) {
14261          this.insurer = TypeConvertor.castToReference(value); // Reference
14262        } else if (name.equals("provider")) {
14263          this.provider = TypeConvertor.castToReference(value); // Reference
14264        } else if (name.equals("priority")) {
14265          this.priority = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14266        } else if (name.equals("fundsReserveRequested")) {
14267          this.fundsReserveRequested = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14268        } else if (name.equals("fundsReserve")) {
14269          this.fundsReserve = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14270        } else if (name.equals("related")) {
14271          this.getRelated().add((RelatedClaimComponent) value);
14272        } else if (name.equals("prescription")) {
14273          this.prescription = TypeConvertor.castToReference(value); // Reference
14274        } else if (name.equals("originalPrescription")) {
14275          this.originalPrescription = TypeConvertor.castToReference(value); // Reference
14276        } else if (name.equals("payee")) {
14277          this.payee = (PayeeComponent) value; // PayeeComponent
14278        } else if (name.equals("referral")) {
14279          this.referral = TypeConvertor.castToReference(value); // Reference
14280        } else if (name.equals("facility")) {
14281          this.facility = TypeConvertor.castToReference(value); // Reference
14282        } else if (name.equals("claim")) {
14283          this.claim = TypeConvertor.castToReference(value); // Reference
14284        } else if (name.equals("claimResponse")) {
14285          this.claimResponse = TypeConvertor.castToReference(value); // Reference
14286        } else if (name.equals("outcome")) {
14287          value = new ClaimProcessingCodesEnumFactory().fromType(TypeConvertor.castToCode(value));
14288          this.outcome = (Enumeration) value; // Enumeration<ClaimProcessingCodes>
14289        } else if (name.equals("disposition")) {
14290          this.disposition = TypeConvertor.castToString(value); // StringType
14291        } else if (name.equals("preAuthRef")) {
14292          this.getPreAuthRef().add(TypeConvertor.castToString(value));
14293        } else if (name.equals("preAuthRefPeriod")) {
14294          this.getPreAuthRefPeriod().add(TypeConvertor.castToPeriod(value));
14295        } else if (name.equals("careTeam")) {
14296          this.getCareTeam().add((CareTeamComponent) value);
14297        } else if (name.equals("supportingInfo")) {
14298          this.getSupportingInfo().add((SupportingInformationComponent) value);
14299        } else if (name.equals("diagnosis")) {
14300          this.getDiagnosis().add((DiagnosisComponent) value);
14301        } else if (name.equals("procedure")) {
14302          this.getProcedure().add((ProcedureComponent) value);
14303        } else if (name.equals("precedence")) {
14304          this.precedence = TypeConvertor.castToPositiveInt(value); // PositiveIntType
14305        } else if (name.equals("insurance")) {
14306          this.getInsurance().add((InsuranceComponent) value);
14307        } else if (name.equals("accident")) {
14308          this.accident = (AccidentComponent) value; // AccidentComponent
14309        } else if (name.equals("item")) {
14310          this.getItem().add((ItemComponent) value);
14311        } else if (name.equals("addItem")) {
14312          this.getAddItem().add((AddedItemComponent) value);
14313        } else if (name.equals("adjudication")) {
14314          this.getAdjudication().add((AdjudicationComponent) value);
14315        } else if (name.equals("total")) {
14316          this.getTotal().add((TotalComponent) value);
14317        } else if (name.equals("payment")) {
14318          this.payment = (PaymentComponent) value; // PaymentComponent
14319        } else if (name.equals("formCode")) {
14320          this.formCode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
14321        } else if (name.equals("form")) {
14322          this.form = TypeConvertor.castToAttachment(value); // Attachment
14323        } else if (name.equals("processNote")) {
14324          this.getProcessNote().add((NoteComponent) value);
14325        } else if (name.equals("benefitPeriod")) {
14326          this.benefitPeriod = TypeConvertor.castToPeriod(value); // Period
14327        } else if (name.equals("benefitBalance")) {
14328          this.getBenefitBalance().add((BenefitBalanceComponent) value);
14329        } else
14330          return super.setProperty(name, value);
14331        return value;
14332      }
14333
14334      @Override
14335      public Base makeProperty(int hash, String name) throws FHIRException {
14336        switch (hash) {
14337        case -1618432855:  return addIdentifier(); 
14338        case -892481550:  return getStatusElement();
14339        case 3575610:  return getType();
14340        case -1868521062:  return getSubType();
14341        case 116103:  return getUseElement();
14342        case -791418107:  return getPatient();
14343        case -332066046:  return getBillablePeriod();
14344        case 1028554472:  return getCreatedElement();
14345        case -1591951995:  return getEnterer();
14346        case 1957615864:  return getInsurer();
14347        case -987494927:  return getProvider();
14348        case -1165461084:  return getPriority();
14349        case -1688904576:  return getFundsReserveRequested();
14350        case 1314609806:  return getFundsReserve();
14351        case 1090493483:  return addRelated(); 
14352        case 460301338:  return getPrescription();
14353        case -1814015861:  return getOriginalPrescription();
14354        case 106443592:  return getPayee();
14355        case -722568291:  return getReferral();
14356        case 501116579:  return getFacility();
14357        case 94742588:  return getClaim();
14358        case 689513629:  return getClaimResponse();
14359        case -1106507950:  return getOutcomeElement();
14360        case 583380919:  return getDispositionElement();
14361        case 522246568:  return addPreAuthRefElement();
14362        case -1262920311:  return addPreAuthRefPeriod(); 
14363        case -7323378:  return addCareTeam(); 
14364        case 1922406657:  return addSupportingInfo(); 
14365        case 1196993265:  return addDiagnosis(); 
14366        case -1095204141:  return addProcedure(); 
14367        case 159695370:  return getPrecedenceElement();
14368        case 73049818:  return addInsurance(); 
14369        case -2143202801:  return getAccident();
14370        case 3242771:  return addItem(); 
14371        case -1148899500:  return addAddItem(); 
14372        case -231349275:  return addAdjudication(); 
14373        case 110549828:  return addTotal(); 
14374        case -786681338:  return getPayment();
14375        case 473181393:  return getFormCode();
14376        case 3148996:  return getForm();
14377        case 202339073:  return addProcessNote(); 
14378        case -407369416:  return getBenefitPeriod();
14379        case 596003397:  return addBenefitBalance(); 
14380        default: return super.makeProperty(hash, name);
14381        }
14382
14383      }
14384
14385      @Override
14386      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
14387        switch (hash) {
14388        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
14389        case -892481550: /*status*/ return new String[] {"code"};
14390        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
14391        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
14392        case 116103: /*use*/ return new String[] {"code"};
14393        case -791418107: /*patient*/ return new String[] {"Reference"};
14394        case -332066046: /*billablePeriod*/ return new String[] {"Period"};
14395        case 1028554472: /*created*/ return new String[] {"dateTime"};
14396        case -1591951995: /*enterer*/ return new String[] {"Reference"};
14397        case 1957615864: /*insurer*/ return new String[] {"Reference"};
14398        case -987494927: /*provider*/ return new String[] {"Reference"};
14399        case -1165461084: /*priority*/ return new String[] {"CodeableConcept"};
14400        case -1688904576: /*fundsReserveRequested*/ return new String[] {"CodeableConcept"};
14401        case 1314609806: /*fundsReserve*/ return new String[] {"CodeableConcept"};
14402        case 1090493483: /*related*/ return new String[] {};
14403        case 460301338: /*prescription*/ return new String[] {"Reference"};
14404        case -1814015861: /*originalPrescription*/ return new String[] {"Reference"};
14405        case 106443592: /*payee*/ return new String[] {};
14406        case -722568291: /*referral*/ return new String[] {"Reference"};
14407        case 501116579: /*facility*/ return new String[] {"Reference"};
14408        case 94742588: /*claim*/ return new String[] {"Reference"};
14409        case 689513629: /*claimResponse*/ return new String[] {"Reference"};
14410        case -1106507950: /*outcome*/ return new String[] {"code"};
14411        case 583380919: /*disposition*/ return new String[] {"string"};
14412        case 522246568: /*preAuthRef*/ return new String[] {"string"};
14413        case -1262920311: /*preAuthRefPeriod*/ return new String[] {"Period"};
14414        case -7323378: /*careTeam*/ return new String[] {};
14415        case 1922406657: /*supportingInfo*/ return new String[] {};
14416        case 1196993265: /*diagnosis*/ return new String[] {};
14417        case -1095204141: /*procedure*/ return new String[] {};
14418        case 159695370: /*precedence*/ return new String[] {"positiveInt"};
14419        case 73049818: /*insurance*/ return new String[] {};
14420        case -2143202801: /*accident*/ return new String[] {};
14421        case 3242771: /*item*/ return new String[] {};
14422        case -1148899500: /*addItem*/ return new String[] {};
14423        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
14424        case 110549828: /*total*/ return new String[] {};
14425        case -786681338: /*payment*/ return new String[] {};
14426        case 473181393: /*formCode*/ return new String[] {"CodeableConcept"};
14427        case 3148996: /*form*/ return new String[] {"Attachment"};
14428        case 202339073: /*processNote*/ return new String[] {};
14429        case -407369416: /*benefitPeriod*/ return new String[] {"Period"};
14430        case 596003397: /*benefitBalance*/ return new String[] {};
14431        default: return super.getTypesForProperty(hash, name);
14432        }
14433
14434      }
14435
14436      @Override
14437      public Base addChild(String name) throws FHIRException {
14438        if (name.equals("identifier")) {
14439          return addIdentifier();
14440        }
14441        else if (name.equals("status")) {
14442          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.status");
14443        }
14444        else if (name.equals("type")) {
14445          this.type = new CodeableConcept();
14446          return this.type;
14447        }
14448        else if (name.equals("subType")) {
14449          this.subType = new CodeableConcept();
14450          return this.subType;
14451        }
14452        else if (name.equals("use")) {
14453          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.use");
14454        }
14455        else if (name.equals("patient")) {
14456          this.patient = new Reference();
14457          return this.patient;
14458        }
14459        else if (name.equals("billablePeriod")) {
14460          this.billablePeriod = new Period();
14461          return this.billablePeriod;
14462        }
14463        else if (name.equals("created")) {
14464          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.created");
14465        }
14466        else if (name.equals("enterer")) {
14467          this.enterer = new Reference();
14468          return this.enterer;
14469        }
14470        else if (name.equals("insurer")) {
14471          this.insurer = new Reference();
14472          return this.insurer;
14473        }
14474        else if (name.equals("provider")) {
14475          this.provider = new Reference();
14476          return this.provider;
14477        }
14478        else if (name.equals("priority")) {
14479          this.priority = new CodeableConcept();
14480          return this.priority;
14481        }
14482        else if (name.equals("fundsReserveRequested")) {
14483          this.fundsReserveRequested = new CodeableConcept();
14484          return this.fundsReserveRequested;
14485        }
14486        else if (name.equals("fundsReserve")) {
14487          this.fundsReserve = new CodeableConcept();
14488          return this.fundsReserve;
14489        }
14490        else if (name.equals("related")) {
14491          return addRelated();
14492        }
14493        else if (name.equals("prescription")) {
14494          this.prescription = new Reference();
14495          return this.prescription;
14496        }
14497        else if (name.equals("originalPrescription")) {
14498          this.originalPrescription = new Reference();
14499          return this.originalPrescription;
14500        }
14501        else if (name.equals("payee")) {
14502          this.payee = new PayeeComponent();
14503          return this.payee;
14504        }
14505        else if (name.equals("referral")) {
14506          this.referral = new Reference();
14507          return this.referral;
14508        }
14509        else if (name.equals("facility")) {
14510          this.facility = new Reference();
14511          return this.facility;
14512        }
14513        else if (name.equals("claim")) {
14514          this.claim = new Reference();
14515          return this.claim;
14516        }
14517        else if (name.equals("claimResponse")) {
14518          this.claimResponse = new Reference();
14519          return this.claimResponse;
14520        }
14521        else if (name.equals("outcome")) {
14522          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.outcome");
14523        }
14524        else if (name.equals("disposition")) {
14525          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.disposition");
14526        }
14527        else if (name.equals("preAuthRef")) {
14528          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
14529        }
14530        else if (name.equals("preAuthRefPeriod")) {
14531          return addPreAuthRefPeriod();
14532        }
14533        else if (name.equals("careTeam")) {
14534          return addCareTeam();
14535        }
14536        else if (name.equals("supportingInfo")) {
14537          return addSupportingInfo();
14538        }
14539        else if (name.equals("diagnosis")) {
14540          return addDiagnosis();
14541        }
14542        else if (name.equals("procedure")) {
14543          return addProcedure();
14544        }
14545        else if (name.equals("precedence")) {
14546          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.precedence");
14547        }
14548        else if (name.equals("insurance")) {
14549          return addInsurance();
14550        }
14551        else if (name.equals("accident")) {
14552          this.accident = new AccidentComponent();
14553          return this.accident;
14554        }
14555        else if (name.equals("item")) {
14556          return addItem();
14557        }
14558        else if (name.equals("addItem")) {
14559          return addAddItem();
14560        }
14561        else if (name.equals("adjudication")) {
14562          return addAdjudication();
14563        }
14564        else if (name.equals("total")) {
14565          return addTotal();
14566        }
14567        else if (name.equals("payment")) {
14568          this.payment = new PaymentComponent();
14569          return this.payment;
14570        }
14571        else if (name.equals("formCode")) {
14572          this.formCode = new CodeableConcept();
14573          return this.formCode;
14574        }
14575        else if (name.equals("form")) {
14576          this.form = new Attachment();
14577          return this.form;
14578        }
14579        else if (name.equals("processNote")) {
14580          return addProcessNote();
14581        }
14582        else if (name.equals("benefitPeriod")) {
14583          this.benefitPeriod = new Period();
14584          return this.benefitPeriod;
14585        }
14586        else if (name.equals("benefitBalance")) {
14587          return addBenefitBalance();
14588        }
14589        else
14590          return super.addChild(name);
14591      }
14592
14593  public String fhirType() {
14594    return "ExplanationOfBenefit";
14595
14596  }
14597
14598      public ExplanationOfBenefit copy() {
14599        ExplanationOfBenefit dst = new ExplanationOfBenefit();
14600        copyValues(dst);
14601        return dst;
14602      }
14603
14604      public void copyValues(ExplanationOfBenefit dst) {
14605        super.copyValues(dst);
14606        if (identifier != null) {
14607          dst.identifier = new ArrayList<Identifier>();
14608          for (Identifier i : identifier)
14609            dst.identifier.add(i.copy());
14610        };
14611        dst.status = status == null ? null : status.copy();
14612        dst.type = type == null ? null : type.copy();
14613        dst.subType = subType == null ? null : subType.copy();
14614        dst.use = use == null ? null : use.copy();
14615        dst.patient = patient == null ? null : patient.copy();
14616        dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
14617        dst.created = created == null ? null : created.copy();
14618        dst.enterer = enterer == null ? null : enterer.copy();
14619        dst.insurer = insurer == null ? null : insurer.copy();
14620        dst.provider = provider == null ? null : provider.copy();
14621        dst.priority = priority == null ? null : priority.copy();
14622        dst.fundsReserveRequested = fundsReserveRequested == null ? null : fundsReserveRequested.copy();
14623        dst.fundsReserve = fundsReserve == null ? null : fundsReserve.copy();
14624        if (related != null) {
14625          dst.related = new ArrayList<RelatedClaimComponent>();
14626          for (RelatedClaimComponent i : related)
14627            dst.related.add(i.copy());
14628        };
14629        dst.prescription = prescription == null ? null : prescription.copy();
14630        dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
14631        dst.payee = payee == null ? null : payee.copy();
14632        dst.referral = referral == null ? null : referral.copy();
14633        dst.facility = facility == null ? null : facility.copy();
14634        dst.claim = claim == null ? null : claim.copy();
14635        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
14636        dst.outcome = outcome == null ? null : outcome.copy();
14637        dst.disposition = disposition == null ? null : disposition.copy();
14638        if (preAuthRef != null) {
14639          dst.preAuthRef = new ArrayList<StringType>();
14640          for (StringType i : preAuthRef)
14641            dst.preAuthRef.add(i.copy());
14642        };
14643        if (preAuthRefPeriod != null) {
14644          dst.preAuthRefPeriod = new ArrayList<Period>();
14645          for (Period i : preAuthRefPeriod)
14646            dst.preAuthRefPeriod.add(i.copy());
14647        };
14648        if (careTeam != null) {
14649          dst.careTeam = new ArrayList<CareTeamComponent>();
14650          for (CareTeamComponent i : careTeam)
14651            dst.careTeam.add(i.copy());
14652        };
14653        if (supportingInfo != null) {
14654          dst.supportingInfo = new ArrayList<SupportingInformationComponent>();
14655          for (SupportingInformationComponent i : supportingInfo)
14656            dst.supportingInfo.add(i.copy());
14657        };
14658        if (diagnosis != null) {
14659          dst.diagnosis = new ArrayList<DiagnosisComponent>();
14660          for (DiagnosisComponent i : diagnosis)
14661            dst.diagnosis.add(i.copy());
14662        };
14663        if (procedure != null) {
14664          dst.procedure = new ArrayList<ProcedureComponent>();
14665          for (ProcedureComponent i : procedure)
14666            dst.procedure.add(i.copy());
14667        };
14668        dst.precedence = precedence == null ? null : precedence.copy();
14669        if (insurance != null) {
14670          dst.insurance = new ArrayList<InsuranceComponent>();
14671          for (InsuranceComponent i : insurance)
14672            dst.insurance.add(i.copy());
14673        };
14674        dst.accident = accident == null ? null : accident.copy();
14675        if (item != null) {
14676          dst.item = new ArrayList<ItemComponent>();
14677          for (ItemComponent i : item)
14678            dst.item.add(i.copy());
14679        };
14680        if (addItem != null) {
14681          dst.addItem = new ArrayList<AddedItemComponent>();
14682          for (AddedItemComponent i : addItem)
14683            dst.addItem.add(i.copy());
14684        };
14685        if (adjudication != null) {
14686          dst.adjudication = new ArrayList<AdjudicationComponent>();
14687          for (AdjudicationComponent i : adjudication)
14688            dst.adjudication.add(i.copy());
14689        };
14690        if (total != null) {
14691          dst.total = new ArrayList<TotalComponent>();
14692          for (TotalComponent i : total)
14693            dst.total.add(i.copy());
14694        };
14695        dst.payment = payment == null ? null : payment.copy();
14696        dst.formCode = formCode == null ? null : formCode.copy();
14697        dst.form = form == null ? null : form.copy();
14698        if (processNote != null) {
14699          dst.processNote = new ArrayList<NoteComponent>();
14700          for (NoteComponent i : processNote)
14701            dst.processNote.add(i.copy());
14702        };
14703        dst.benefitPeriod = benefitPeriod == null ? null : benefitPeriod.copy();
14704        if (benefitBalance != null) {
14705          dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14706          for (BenefitBalanceComponent i : benefitBalance)
14707            dst.benefitBalance.add(i.copy());
14708        };
14709      }
14710
14711      protected ExplanationOfBenefit typedCopy() {
14712        return copy();
14713      }
14714
14715      @Override
14716      public boolean equalsDeep(Base other_) {
14717        if (!super.equalsDeep(other_))
14718          return false;
14719        if (!(other_ instanceof ExplanationOfBenefit))
14720          return false;
14721        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
14722        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
14723           && compareDeep(subType, o.subType, true) && compareDeep(use, o.use, true) && compareDeep(patient, o.patient, true)
14724           && compareDeep(billablePeriod, o.billablePeriod, true) && compareDeep(created, o.created, true)
14725           && compareDeep(enterer, o.enterer, true) && compareDeep(insurer, o.insurer, true) && compareDeep(provider, o.provider, true)
14726           && compareDeep(priority, o.priority, true) && compareDeep(fundsReserveRequested, o.fundsReserveRequested, true)
14727           && compareDeep(fundsReserve, o.fundsReserve, true) && compareDeep(related, o.related, true) && compareDeep(prescription, o.prescription, true)
14728           && compareDeep(originalPrescription, o.originalPrescription, true) && compareDeep(payee, o.payee, true)
14729           && compareDeep(referral, o.referral, true) && compareDeep(facility, o.facility, true) && compareDeep(claim, o.claim, true)
14730           && compareDeep(claimResponse, o.claimResponse, true) && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true)
14731           && compareDeep(preAuthRef, o.preAuthRef, true) && compareDeep(preAuthRefPeriod, o.preAuthRefPeriod, true)
14732           && compareDeep(careTeam, o.careTeam, true) && compareDeep(supportingInfo, o.supportingInfo, true)
14733           && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true) && compareDeep(precedence, o.precedence, true)
14734           && compareDeep(insurance, o.insurance, true) && compareDeep(accident, o.accident, true) && compareDeep(item, o.item, true)
14735           && compareDeep(addItem, o.addItem, true) && compareDeep(adjudication, o.adjudication, true) && compareDeep(total, o.total, true)
14736           && compareDeep(payment, o.payment, true) && compareDeep(formCode, o.formCode, true) && compareDeep(form, o.form, true)
14737           && compareDeep(processNote, o.processNote, true) && compareDeep(benefitPeriod, o.benefitPeriod, true)
14738           && compareDeep(benefitBalance, o.benefitBalance, true);
14739      }
14740
14741      @Override
14742      public boolean equalsShallow(Base other_) {
14743        if (!super.equalsShallow(other_))
14744          return false;
14745        if (!(other_ instanceof ExplanationOfBenefit))
14746          return false;
14747        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
14748        return compareValues(status, o.status, true) && compareValues(use, o.use, true) && compareValues(created, o.created, true)
14749           && compareValues(outcome, o.outcome, true) && compareValues(disposition, o.disposition, true) && compareValues(preAuthRef, o.preAuthRef, true)
14750           && compareValues(precedence, o.precedence, true);
14751      }
14752
14753      public boolean isEmpty() {
14754        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
14755          , subType, use, patient, billablePeriod, created, enterer, insurer, provider
14756          , priority, fundsReserveRequested, fundsReserve, related, prescription, originalPrescription
14757          , payee, referral, facility, claim, claimResponse, outcome, disposition, preAuthRef
14758          , preAuthRefPeriod, careTeam, supportingInfo, diagnosis, procedure, precedence, insurance
14759          , accident, item, addItem, adjudication, total, payment, formCode, form, processNote
14760          , benefitPeriod, benefitBalance);
14761      }
14762
14763  @Override
14764  public ResourceType getResourceType() {
14765    return ResourceType.ExplanationOfBenefit;
14766   }
14767
14768 /**
14769   * Search parameter: <b>care-team</b>
14770   * <p>
14771   * Description: <b>Member of the CareTeam</b><br>
14772   * Type: <b>reference</b><br>
14773   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
14774   * </p>
14775   */
14776  @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 } )
14777  public static final String SP_CARE_TEAM = "care-team";
14778 /**
14779   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
14780   * <p>
14781   * Description: <b>Member of the CareTeam</b><br>
14782   * Type: <b>reference</b><br>
14783   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
14784   * </p>
14785   */
14786  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CARE_TEAM);
14787
14788/**
14789   * Constant for fluent queries to be used to add include statements. Specifies
14790   * the path value of "<b>ExplanationOfBenefit:care-team</b>".
14791   */
14792  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:care-team").toLocked();
14793
14794 /**
14795   * Search parameter: <b>claim</b>
14796   * <p>
14797   * Description: <b>The reference to the claim</b><br>
14798   * Type: <b>reference</b><br>
14799   * Path: <b>ExplanationOfBenefit.claim</b><br>
14800   * </p>
14801   */
14802  @SearchParamDefinition(name="claim", path="ExplanationOfBenefit.claim", description="The reference to the claim", type="reference", target={Claim.class } )
14803  public static final String SP_CLAIM = "claim";
14804 /**
14805   * <b>Fluent Client</b> search parameter constant for <b>claim</b>
14806   * <p>
14807   * Description: <b>The reference to the claim</b><br>
14808   * Type: <b>reference</b><br>
14809   * Path: <b>ExplanationOfBenefit.claim</b><br>
14810   * </p>
14811   */
14812  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CLAIM);
14813
14814/**
14815   * Constant for fluent queries to be used to add include statements. Specifies
14816   * the path value of "<b>ExplanationOfBenefit:claim</b>".
14817   */
14818  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:claim").toLocked();
14819
14820 /**
14821   * Search parameter: <b>coverage</b>
14822   * <p>
14823   * Description: <b>The plan under which the claim was adjudicated</b><br>
14824   * Type: <b>reference</b><br>
14825   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
14826   * </p>
14827   */
14828  @SearchParamDefinition(name="coverage", path="ExplanationOfBenefit.insurance.coverage", description="The plan under which the claim was adjudicated", type="reference", target={Coverage.class } )
14829  public static final String SP_COVERAGE = "coverage";
14830 /**
14831   * <b>Fluent Client</b> search parameter constant for <b>coverage</b>
14832   * <p>
14833   * Description: <b>The plan under which the claim was adjudicated</b><br>
14834   * Type: <b>reference</b><br>
14835   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
14836   * </p>
14837   */
14838  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COVERAGE);
14839
14840/**
14841   * Constant for fluent queries to be used to add include statements. Specifies
14842   * the path value of "<b>ExplanationOfBenefit:coverage</b>".
14843   */
14844  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:coverage").toLocked();
14845
14846 /**
14847   * Search parameter: <b>created</b>
14848   * <p>
14849   * Description: <b>The creation date for the EOB</b><br>
14850   * Type: <b>date</b><br>
14851   * Path: <b>ExplanationOfBenefit.created</b><br>
14852   * </p>
14853   */
14854  @SearchParamDefinition(name="created", path="ExplanationOfBenefit.created", description="The creation date for the EOB", type="date" )
14855  public static final String SP_CREATED = "created";
14856 /**
14857   * <b>Fluent Client</b> search parameter constant for <b>created</b>
14858   * <p>
14859   * Description: <b>The creation date for the EOB</b><br>
14860   * Type: <b>date</b><br>
14861   * Path: <b>ExplanationOfBenefit.created</b><br>
14862   * </p>
14863   */
14864  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
14865
14866 /**
14867   * Search parameter: <b>detail-udi</b>
14868   * <p>
14869   * Description: <b>UDI associated with a line item detail product or service</b><br>
14870   * Type: <b>reference</b><br>
14871   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
14872   * </p>
14873   */
14874  @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 } )
14875  public static final String SP_DETAIL_UDI = "detail-udi";
14876 /**
14877   * <b>Fluent Client</b> search parameter constant for <b>detail-udi</b>
14878   * <p>
14879   * Description: <b>UDI associated with a line item detail product or service</b><br>
14880   * Type: <b>reference</b><br>
14881   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
14882   * </p>
14883   */
14884  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DETAIL_UDI);
14885
14886/**
14887   * Constant for fluent queries to be used to add include statements. Specifies
14888   * the path value of "<b>ExplanationOfBenefit:detail-udi</b>".
14889   */
14890  public static final ca.uhn.fhir.model.api.Include INCLUDE_DETAIL_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:detail-udi").toLocked();
14891
14892 /**
14893   * Search parameter: <b>disposition</b>
14894   * <p>
14895   * Description: <b>The contents of the disposition message</b><br>
14896   * Type: <b>string</b><br>
14897   * Path: <b>ExplanationOfBenefit.disposition</b><br>
14898   * </p>
14899   */
14900  @SearchParamDefinition(name="disposition", path="ExplanationOfBenefit.disposition", description="The contents of the disposition message", type="string" )
14901  public static final String SP_DISPOSITION = "disposition";
14902 /**
14903   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
14904   * <p>
14905   * Description: <b>The contents of the disposition message</b><br>
14906   * Type: <b>string</b><br>
14907   * Path: <b>ExplanationOfBenefit.disposition</b><br>
14908   * </p>
14909   */
14910  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
14911
14912 /**
14913   * Search parameter: <b>encounter</b>
14914   * <p>
14915   * Description: <b>Encounters associated with a billed line item</b><br>
14916   * Type: <b>reference</b><br>
14917   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
14918   * </p>
14919   */
14920  @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 } )
14921  public static final String SP_ENCOUNTER = "encounter";
14922 /**
14923   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
14924   * <p>
14925   * Description: <b>Encounters associated with a billed line item</b><br>
14926   * Type: <b>reference</b><br>
14927   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
14928   * </p>
14929   */
14930  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
14931
14932/**
14933   * Constant for fluent queries to be used to add include statements. Specifies
14934   * the path value of "<b>ExplanationOfBenefit:encounter</b>".
14935   */
14936  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:encounter").toLocked();
14937
14938 /**
14939   * Search parameter: <b>enterer</b>
14940   * <p>
14941   * Description: <b>The party responsible for the entry of the Claim</b><br>
14942   * Type: <b>reference</b><br>
14943   * Path: <b>ExplanationOfBenefit.enterer</b><br>
14944   * </p>
14945   */
14946  @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 } )
14947  public static final String SP_ENTERER = "enterer";
14948 /**
14949   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
14950   * <p>
14951   * Description: <b>The party responsible for the entry of the Claim</b><br>
14952   * Type: <b>reference</b><br>
14953   * Path: <b>ExplanationOfBenefit.enterer</b><br>
14954   * </p>
14955   */
14956  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTERER);
14957
14958/**
14959   * Constant for fluent queries to be used to add include statements. Specifies
14960   * the path value of "<b>ExplanationOfBenefit:enterer</b>".
14961   */
14962  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:enterer").toLocked();
14963
14964 /**
14965   * Search parameter: <b>facility</b>
14966   * <p>
14967   * Description: <b>Facility responsible for the goods and services</b><br>
14968   * Type: <b>reference</b><br>
14969   * Path: <b>ExplanationOfBenefit.facility</b><br>
14970   * </p>
14971   */
14972  @SearchParamDefinition(name="facility", path="ExplanationOfBenefit.facility", description="Facility responsible for the goods and services", type="reference", target={Location.class } )
14973  public static final String SP_FACILITY = "facility";
14974 /**
14975   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
14976   * <p>
14977   * Description: <b>Facility responsible for the goods and services</b><br>
14978   * Type: <b>reference</b><br>
14979   * Path: <b>ExplanationOfBenefit.facility</b><br>
14980   * </p>
14981   */
14982  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITY);
14983
14984/**
14985   * Constant for fluent queries to be used to add include statements. Specifies
14986   * the path value of "<b>ExplanationOfBenefit:facility</b>".
14987   */
14988  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:facility").toLocked();
14989
14990 /**
14991   * Search parameter: <b>identifier</b>
14992   * <p>
14993   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
14994   * Type: <b>token</b><br>
14995   * Path: <b>ExplanationOfBenefit.identifier</b><br>
14996   * </p>
14997   */
14998  @SearchParamDefinition(name="identifier", path="ExplanationOfBenefit.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
14999  public static final String SP_IDENTIFIER = "identifier";
15000 /**
15001   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
15002   * <p>
15003   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
15004   * Type: <b>token</b><br>
15005   * Path: <b>ExplanationOfBenefit.identifier</b><br>
15006   * </p>
15007   */
15008  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
15009
15010 /**
15011   * Search parameter: <b>item-udi</b>
15012   * <p>
15013   * Description: <b>UDI associated with a line item product or service</b><br>
15014   * Type: <b>reference</b><br>
15015   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
15016   * </p>
15017   */
15018  @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 } )
15019  public static final String SP_ITEM_UDI = "item-udi";
15020 /**
15021   * <b>Fluent Client</b> search parameter constant for <b>item-udi</b>
15022   * <p>
15023   * Description: <b>UDI associated with a line item product or service</b><br>
15024   * Type: <b>reference</b><br>
15025   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
15026   * </p>
15027   */
15028  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ITEM_UDI);
15029
15030/**
15031   * Constant for fluent queries to be used to add include statements. Specifies
15032   * the path value of "<b>ExplanationOfBenefit:item-udi</b>".
15033   */
15034  public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:item-udi").toLocked();
15035
15036 /**
15037   * Search parameter: <b>patient</b>
15038   * <p>
15039   * Description: <b>The reference to the patient</b><br>
15040   * Type: <b>reference</b><br>
15041   * Path: <b>ExplanationOfBenefit.patient</b><br>
15042   * </p>
15043   */
15044  @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 } )
15045  public static final String SP_PATIENT = "patient";
15046 /**
15047   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
15048   * <p>
15049   * Description: <b>The reference to the patient</b><br>
15050   * Type: <b>reference</b><br>
15051   * Path: <b>ExplanationOfBenefit.patient</b><br>
15052   * </p>
15053   */
15054  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
15055
15056/**
15057   * Constant for fluent queries to be used to add include statements. Specifies
15058   * the path value of "<b>ExplanationOfBenefit:patient</b>".
15059   */
15060  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:patient").toLocked();
15061
15062 /**
15063   * Search parameter: <b>payee</b>
15064   * <p>
15065   * Description: <b>The party receiving any payment for the Claim</b><br>
15066   * Type: <b>reference</b><br>
15067   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
15068   * </p>
15069   */
15070  @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 } )
15071  public static final String SP_PAYEE = "payee";
15072 /**
15073   * <b>Fluent Client</b> search parameter constant for <b>payee</b>
15074   * <p>
15075   * Description: <b>The party receiving any payment for the Claim</b><br>
15076   * Type: <b>reference</b><br>
15077   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
15078   * </p>
15079   */
15080  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PAYEE);
15081
15082/**
15083   * Constant for fluent queries to be used to add include statements. Specifies
15084   * the path value of "<b>ExplanationOfBenefit:payee</b>".
15085   */
15086  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYEE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:payee").toLocked();
15087
15088 /**
15089   * Search parameter: <b>procedure-udi</b>
15090   * <p>
15091   * Description: <b>UDI associated with a procedure</b><br>
15092   * Type: <b>reference</b><br>
15093   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
15094   * </p>
15095   */
15096  @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 } )
15097  public static final String SP_PROCEDURE_UDI = "procedure-udi";
15098 /**
15099   * <b>Fluent Client</b> search parameter constant for <b>procedure-udi</b>
15100   * <p>
15101   * Description: <b>UDI associated with a procedure</b><br>
15102   * Type: <b>reference</b><br>
15103   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
15104   * </p>
15105   */
15106  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROCEDURE_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROCEDURE_UDI);
15107
15108/**
15109   * Constant for fluent queries to be used to add include statements. Specifies
15110   * the path value of "<b>ExplanationOfBenefit:procedure-udi</b>".
15111   */
15112  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROCEDURE_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:procedure-udi").toLocked();
15113
15114 /**
15115   * Search parameter: <b>provider</b>
15116   * <p>
15117   * Description: <b>The reference to the provider</b><br>
15118   * Type: <b>reference</b><br>
15119   * Path: <b>ExplanationOfBenefit.provider</b><br>
15120   * </p>
15121   */
15122  @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 } )
15123  public static final String SP_PROVIDER = "provider";
15124 /**
15125   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
15126   * <p>
15127   * Description: <b>The reference to the provider</b><br>
15128   * Type: <b>reference</b><br>
15129   * Path: <b>ExplanationOfBenefit.provider</b><br>
15130   * </p>
15131   */
15132  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
15133
15134/**
15135   * Constant for fluent queries to be used to add include statements. Specifies
15136   * the path value of "<b>ExplanationOfBenefit:provider</b>".
15137   */
15138  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:provider").toLocked();
15139
15140 /**
15141   * Search parameter: <b>status</b>
15142   * <p>
15143   * Description: <b>Status of the instance</b><br>
15144   * Type: <b>token</b><br>
15145   * Path: <b>ExplanationOfBenefit.status</b><br>
15146   * </p>
15147   */
15148  @SearchParamDefinition(name="status", path="ExplanationOfBenefit.status", description="Status of the instance", type="token" )
15149  public static final String SP_STATUS = "status";
15150 /**
15151   * <b>Fluent Client</b> search parameter constant for <b>status</b>
15152   * <p>
15153   * Description: <b>Status of the instance</b><br>
15154   * Type: <b>token</b><br>
15155   * Path: <b>ExplanationOfBenefit.status</b><br>
15156   * </p>
15157   */
15158  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
15159
15160 /**
15161   * Search parameter: <b>subdetail-udi</b>
15162   * <p>
15163   * Description: <b>UDI associated with a line item detail subdetail product or service</b><br>
15164   * Type: <b>reference</b><br>
15165   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
15166   * </p>
15167   */
15168  @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 } )
15169  public static final String SP_SUBDETAIL_UDI = "subdetail-udi";
15170 /**
15171   * <b>Fluent Client</b> search parameter constant for <b>subdetail-udi</b>
15172   * <p>
15173   * Description: <b>UDI associated with a line item detail subdetail product or service</b><br>
15174   * Type: <b>reference</b><br>
15175   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
15176   * </p>
15177   */
15178  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBDETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBDETAIL_UDI);
15179
15180/**
15181   * Constant for fluent queries to be used to add include statements. Specifies
15182   * the path value of "<b>ExplanationOfBenefit:subdetail-udi</b>".
15183   */
15184  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBDETAIL_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:subdetail-udi").toLocked();
15185
15186
15187}
15188