001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import java.math.*;
040import org.hl7.fhir.utilities.Utilities;
041import org.hl7.fhir.r4.model.Enumerations.*;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import ca.uhn.fhir.model.api.annotation.Child;
045import ca.uhn.fhir.model.api.annotation.ChildOrder;
046import ca.uhn.fhir.model.api.annotation.Description;
047import ca.uhn.fhir.model.api.annotation.Block;
048import org.hl7.fhir.instance.model.api.*;
049import org.hl7.fhir.exceptions.FHIRException;
050/**
051 * 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.
052 */
053@ResourceDef(name="ExplanationOfBenefit", profile="http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit")
054public class ExplanationOfBenefit extends DomainResource {
055
056    public enum ExplanationOfBenefitStatus {
057        /**
058         * The resource instance is currently in-force.
059         */
060        ACTIVE, 
061        /**
062         * The resource instance is withdrawn, rescinded or reversed.
063         */
064        CANCELLED, 
065        /**
066         * A new resource instance the contents of which is not complete.
067         */
068        DRAFT, 
069        /**
070         * The resource instance was entered in error.
071         */
072        ENTEREDINERROR, 
073        /**
074         * added to help the parsers with the generic types
075         */
076        NULL;
077        public static ExplanationOfBenefitStatus fromCode(String codeString) throws FHIRException {
078            if (codeString == null || "".equals(codeString))
079                return null;
080        if ("active".equals(codeString))
081          return ACTIVE;
082        if ("cancelled".equals(codeString))
083          return CANCELLED;
084        if ("draft".equals(codeString))
085          return DRAFT;
086        if ("entered-in-error".equals(codeString))
087          return ENTEREDINERROR;
088        if (Configuration.isAcceptInvalidEnums())
089          return null;
090        else
091          throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
092        }
093        public String toCode() {
094          switch (this) {
095            case ACTIVE: return "active";
096            case CANCELLED: return "cancelled";
097            case DRAFT: return "draft";
098            case ENTEREDINERROR: return "entered-in-error";
099            case NULL: return null;
100            default: return "?";
101          }
102        }
103        public String getSystem() {
104          switch (this) {
105            case ACTIVE: return "http://hl7.org/fhir/explanationofbenefit-status";
106            case CANCELLED: return "http://hl7.org/fhir/explanationofbenefit-status";
107            case DRAFT: return "http://hl7.org/fhir/explanationofbenefit-status";
108            case ENTEREDINERROR: return "http://hl7.org/fhir/explanationofbenefit-status";
109            case NULL: return null;
110            default: return "?";
111          }
112        }
113        public String getDefinition() {
114          switch (this) {
115            case ACTIVE: return "The resource instance is currently in-force.";
116            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
117            case DRAFT: return "A new resource instance the contents of which is not complete.";
118            case ENTEREDINERROR: return "The resource instance was entered in error.";
119            case NULL: return null;
120            default: return "?";
121          }
122        }
123        public String getDisplay() {
124          switch (this) {
125            case ACTIVE: return "Active";
126            case CANCELLED: return "Cancelled";
127            case DRAFT: return "Draft";
128            case ENTEREDINERROR: return "Entered In Error";
129            case NULL: return null;
130            default: return "?";
131          }
132        }
133    }
134
135  public static class ExplanationOfBenefitStatusEnumFactory implements EnumFactory<ExplanationOfBenefitStatus> {
136    public ExplanationOfBenefitStatus fromCode(String codeString) throws IllegalArgumentException {
137      if (codeString == null || "".equals(codeString))
138            if (codeString == null || "".equals(codeString))
139                return null;
140        if ("active".equals(codeString))
141          return ExplanationOfBenefitStatus.ACTIVE;
142        if ("cancelled".equals(codeString))
143          return ExplanationOfBenefitStatus.CANCELLED;
144        if ("draft".equals(codeString))
145          return ExplanationOfBenefitStatus.DRAFT;
146        if ("entered-in-error".equals(codeString))
147          return ExplanationOfBenefitStatus.ENTEREDINERROR;
148        throw new IllegalArgumentException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
149        }
150        public Enumeration<ExplanationOfBenefitStatus> fromType(Base code) throws FHIRException {
151          if (code == null)
152            return null;
153          if (code.isEmpty())
154            return new Enumeration<ExplanationOfBenefitStatus>(this);
155          String codeString = ((PrimitiveType) code).asStringValue();
156          if (codeString == null || "".equals(codeString))
157            return null;
158        if ("active".equals(codeString))
159          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ACTIVE);
160        if ("cancelled".equals(codeString))
161          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.CANCELLED);
162        if ("draft".equals(codeString))
163          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.DRAFT);
164        if ("entered-in-error".equals(codeString))
165          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ENTEREDINERROR);
166        throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
167        }
168    public String toCode(ExplanationOfBenefitStatus code) {
169      if (code == ExplanationOfBenefitStatus.ACTIVE)
170        return "active";
171      if (code == ExplanationOfBenefitStatus.CANCELLED)
172        return "cancelled";
173      if (code == ExplanationOfBenefitStatus.DRAFT)
174        return "draft";
175      if (code == ExplanationOfBenefitStatus.ENTEREDINERROR)
176        return "entered-in-error";
177      return "?";
178      }
179    public String toSystem(ExplanationOfBenefitStatus code) {
180      return code.getSystem();
181      }
182    }
183
184    public enum Use {
185        /**
186         * The treatment is complete and this represents a Claim for the services.
187         */
188        CLAIM, 
189        /**
190         * The treatment is proposed and this represents a Pre-authorization for the services.
191         */
192        PREAUTHORIZATION, 
193        /**
194         * The treatment is proposed and this represents a Pre-determination for the services.
195         */
196        PREDETERMINATION, 
197        /**
198         * added to help the parsers with the generic types
199         */
200        NULL;
201        public static Use fromCode(String codeString) throws FHIRException {
202            if (codeString == null || "".equals(codeString))
203                return null;
204        if ("claim".equals(codeString))
205          return CLAIM;
206        if ("preauthorization".equals(codeString))
207          return PREAUTHORIZATION;
208        if ("predetermination".equals(codeString))
209          return PREDETERMINATION;
210        if (Configuration.isAcceptInvalidEnums())
211          return null;
212        else
213          throw new FHIRException("Unknown Use code '"+codeString+"'");
214        }
215        public String toCode() {
216          switch (this) {
217            case CLAIM: return "claim";
218            case PREAUTHORIZATION: return "preauthorization";
219            case PREDETERMINATION: return "predetermination";
220            case NULL: return null;
221            default: return "?";
222          }
223        }
224        public String getSystem() {
225          switch (this) {
226            case CLAIM: return "http://hl7.org/fhir/claim-use";
227            case PREAUTHORIZATION: return "http://hl7.org/fhir/claim-use";
228            case PREDETERMINATION: return "http://hl7.org/fhir/claim-use";
229            case NULL: return null;
230            default: return "?";
231          }
232        }
233        public String getDefinition() {
234          switch (this) {
235            case CLAIM: return "The treatment is complete and this represents a Claim for the services.";
236            case PREAUTHORIZATION: return "The treatment is proposed and this represents a Pre-authorization for the services.";
237            case PREDETERMINATION: return "The treatment is proposed and this represents a Pre-determination for the services.";
238            case NULL: return null;
239            default: return "?";
240          }
241        }
242        public String getDisplay() {
243          switch (this) {
244            case CLAIM: return "Claim";
245            case PREAUTHORIZATION: return "Preauthorization";
246            case PREDETERMINATION: return "Predetermination";
247            case NULL: return null;
248            default: return "?";
249          }
250        }
251    }
252
253  public static class UseEnumFactory implements EnumFactory<Use> {
254    public Use fromCode(String codeString) throws IllegalArgumentException {
255      if (codeString == null || "".equals(codeString))
256            if (codeString == null || "".equals(codeString))
257                return null;
258        if ("claim".equals(codeString))
259          return Use.CLAIM;
260        if ("preauthorization".equals(codeString))
261          return Use.PREAUTHORIZATION;
262        if ("predetermination".equals(codeString))
263          return Use.PREDETERMINATION;
264        throw new IllegalArgumentException("Unknown Use code '"+codeString+"'");
265        }
266        public Enumeration<Use> fromType(Base code) throws FHIRException {
267          if (code == null)
268            return null;
269          if (code.isEmpty())
270            return new Enumeration<Use>(this);
271          String codeString = ((PrimitiveType) code).asStringValue();
272          if (codeString == null || "".equals(codeString))
273            return null;
274        if ("claim".equals(codeString))
275          return new Enumeration<Use>(this, Use.CLAIM);
276        if ("preauthorization".equals(codeString))
277          return new Enumeration<Use>(this, Use.PREAUTHORIZATION);
278        if ("predetermination".equals(codeString))
279          return new Enumeration<Use>(this, Use.PREDETERMINATION);
280        throw new FHIRException("Unknown Use code '"+codeString+"'");
281        }
282    public String toCode(Use code) {
283      if (code == Use.CLAIM)
284        return "claim";
285      if (code == Use.PREAUTHORIZATION)
286        return "preauthorization";
287      if (code == Use.PREDETERMINATION)
288        return "predetermination";
289      return "?";
290      }
291    public String toSystem(Use code) {
292      return code.getSystem();
293      }
294    }
295
296    public enum RemittanceOutcome {
297        /**
298         * The Claim/Pre-authorization/Pre-determination has been received but processing has not begun.
299         */
300        QUEUED, 
301        /**
302         * The processing has completed without errors
303         */
304        COMPLETE, 
305        /**
306         * One or more errors have been detected in the Claim
307         */
308        ERROR, 
309        /**
310         * No errors have been detected in the Claim and some of the adjudication has been performed.
311         */
312        PARTIAL, 
313        /**
314         * added to help the parsers with the generic types
315         */
316        NULL;
317        public static RemittanceOutcome fromCode(String codeString) throws FHIRException {
318            if (codeString == null || "".equals(codeString))
319                return null;
320        if ("queued".equals(codeString))
321          return QUEUED;
322        if ("complete".equals(codeString))
323          return COMPLETE;
324        if ("error".equals(codeString))
325          return ERROR;
326        if ("partial".equals(codeString))
327          return PARTIAL;
328        if (Configuration.isAcceptInvalidEnums())
329          return null;
330        else
331          throw new FHIRException("Unknown RemittanceOutcome code '"+codeString+"'");
332        }
333        public String toCode() {
334          switch (this) {
335            case QUEUED: return "queued";
336            case COMPLETE: return "complete";
337            case ERROR: return "error";
338            case PARTIAL: return "partial";
339            case NULL: return null;
340            default: return "?";
341          }
342        }
343        public String getSystem() {
344          switch (this) {
345            case QUEUED: return "http://hl7.org/fhir/remittance-outcome";
346            case COMPLETE: return "http://hl7.org/fhir/remittance-outcome";
347            case ERROR: return "http://hl7.org/fhir/remittance-outcome";
348            case PARTIAL: return "http://hl7.org/fhir/remittance-outcome";
349            case NULL: return null;
350            default: return "?";
351          }
352        }
353        public String getDefinition() {
354          switch (this) {
355            case QUEUED: return "The Claim/Pre-authorization/Pre-determination has been received but processing has not begun.";
356            case COMPLETE: return "The processing has completed without errors";
357            case ERROR: return "One or more errors have been detected in the Claim";
358            case PARTIAL: return "No errors have been detected in the Claim and some of the adjudication has been performed.";
359            case NULL: return null;
360            default: return "?";
361          }
362        }
363        public String getDisplay() {
364          switch (this) {
365            case QUEUED: return "Queued";
366            case COMPLETE: return "Processing Complete";
367            case ERROR: return "Error";
368            case PARTIAL: return "Partial Processing";
369            case NULL: return null;
370            default: return "?";
371          }
372        }
373    }
374
375  public static class RemittanceOutcomeEnumFactory implements EnumFactory<RemittanceOutcome> {
376    public RemittanceOutcome fromCode(String codeString) throws IllegalArgumentException {
377      if (codeString == null || "".equals(codeString))
378            if (codeString == null || "".equals(codeString))
379                return null;
380        if ("queued".equals(codeString))
381          return RemittanceOutcome.QUEUED;
382        if ("complete".equals(codeString))
383          return RemittanceOutcome.COMPLETE;
384        if ("error".equals(codeString))
385          return RemittanceOutcome.ERROR;
386        if ("partial".equals(codeString))
387          return RemittanceOutcome.PARTIAL;
388        throw new IllegalArgumentException("Unknown RemittanceOutcome code '"+codeString+"'");
389        }
390        public Enumeration<RemittanceOutcome> fromType(Base code) throws FHIRException {
391          if (code == null)
392            return null;
393          if (code.isEmpty())
394            return new Enumeration<RemittanceOutcome>(this);
395          String codeString = ((PrimitiveType) code).asStringValue();
396          if (codeString == null || "".equals(codeString))
397            return null;
398        if ("queued".equals(codeString))
399          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.QUEUED);
400        if ("complete".equals(codeString))
401          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.COMPLETE);
402        if ("error".equals(codeString))
403          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.ERROR);
404        if ("partial".equals(codeString))
405          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.PARTIAL);
406        throw new FHIRException("Unknown RemittanceOutcome code '"+codeString+"'");
407        }
408    public String toCode(RemittanceOutcome code) {
409      if (code == RemittanceOutcome.QUEUED)
410        return "queued";
411      if (code == RemittanceOutcome.COMPLETE)
412        return "complete";
413      if (code == RemittanceOutcome.ERROR)
414        return "error";
415      if (code == RemittanceOutcome.PARTIAL)
416        return "partial";
417      return "?";
418      }
419    public String toSystem(RemittanceOutcome code) {
420      return code.getSystem();
421      }
422    }
423
424    @Block()
425    public static class RelatedClaimComponent extends BackboneElement implements IBaseBackboneElement {
426        /**
427         * Reference to a related claim.
428         */
429        @Child(name = "claim", type = {Claim.class}, order=1, min=0, max=1, modifier=false, summary=false)
430        @Description(shortDefinition="Reference to the related claim", formalDefinition="Reference to a related claim." )
431        protected Reference claim;
432
433        /**
434         * The actual object that is the target of the reference (Reference to a related claim.)
435         */
436        protected Claim claimTarget;
437
438        /**
439         * A code to convey how the claims are related.
440         */
441        @Child(name = "relationship", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
442        @Description(shortDefinition="How the reference claim is related", formalDefinition="A code to convey how the claims are related." )
443        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-claim-relationship")
444        protected CodeableConcept relationship;
445
446        /**
447         * An alternate organizational reference to the case or file to which this particular claim pertains.
448         */
449        @Child(name = "reference", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=false)
450        @Description(shortDefinition="File or case reference", formalDefinition="An alternate organizational reference to the case or file to which this particular claim pertains." )
451        protected Identifier reference;
452
453        private static final long serialVersionUID = -379338905L;
454
455    /**
456     * Constructor
457     */
458      public RelatedClaimComponent() {
459        super();
460      }
461
462        /**
463         * @return {@link #claim} (Reference to a related claim.)
464         */
465        public Reference getClaim() { 
466          if (this.claim == null)
467            if (Configuration.errorOnAutoCreate())
468              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
469            else if (Configuration.doAutoCreate())
470              this.claim = new Reference(); // cc
471          return this.claim;
472        }
473
474        public boolean hasClaim() { 
475          return this.claim != null && !this.claim.isEmpty();
476        }
477
478        /**
479         * @param value {@link #claim} (Reference to a related claim.)
480         */
481        public RelatedClaimComponent setClaim(Reference value) { 
482          this.claim = value;
483          return this;
484        }
485
486        /**
487         * @return {@link #claim} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Reference to a related claim.)
488         */
489        public Claim getClaimTarget() { 
490          if (this.claimTarget == null)
491            if (Configuration.errorOnAutoCreate())
492              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
493            else if (Configuration.doAutoCreate())
494              this.claimTarget = new Claim(); // aa
495          return this.claimTarget;
496        }
497
498        /**
499         * @param value {@link #claim} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Reference to a related claim.)
500         */
501        public RelatedClaimComponent setClaimTarget(Claim value) { 
502          this.claimTarget = value;
503          return this;
504        }
505
506        /**
507         * @return {@link #relationship} (A code to convey how the claims are related.)
508         */
509        public CodeableConcept getRelationship() { 
510          if (this.relationship == null)
511            if (Configuration.errorOnAutoCreate())
512              throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
513            else if (Configuration.doAutoCreate())
514              this.relationship = new CodeableConcept(); // cc
515          return this.relationship;
516        }
517
518        public boolean hasRelationship() { 
519          return this.relationship != null && !this.relationship.isEmpty();
520        }
521
522        /**
523         * @param value {@link #relationship} (A code to convey how the claims are related.)
524         */
525        public RelatedClaimComponent setRelationship(CodeableConcept value) { 
526          this.relationship = value;
527          return this;
528        }
529
530        /**
531         * @return {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
532         */
533        public Identifier getReference() { 
534          if (this.reference == null)
535            if (Configuration.errorOnAutoCreate())
536              throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
537            else if (Configuration.doAutoCreate())
538              this.reference = new Identifier(); // cc
539          return this.reference;
540        }
541
542        public boolean hasReference() { 
543          return this.reference != null && !this.reference.isEmpty();
544        }
545
546        /**
547         * @param value {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
548         */
549        public RelatedClaimComponent setReference(Identifier value) { 
550          this.reference = value;
551          return this;
552        }
553
554        protected void listChildren(List<Property> children) {
555          super.listChildren(children);
556          children.add(new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim));
557          children.add(new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship));
558          children.add(new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1, reference));
559        }
560
561        @Override
562        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
563          switch (_hash) {
564          case 94742588: /*claim*/  return new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim);
565          case -261851592: /*relationship*/  return new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship);
566          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);
567          default: return super.getNamedProperty(_hash, _name, _checkValid);
568          }
569
570        }
571
572      @Override
573      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
574        switch (hash) {
575        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
576        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
577        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Identifier
578        default: return super.getProperty(hash, name, checkValid);
579        }
580
581      }
582
583      @Override
584      public Base setProperty(int hash, String name, Base value) throws FHIRException {
585        switch (hash) {
586        case 94742588: // claim
587          this.claim = castToReference(value); // Reference
588          return value;
589        case -261851592: // relationship
590          this.relationship = castToCodeableConcept(value); // CodeableConcept
591          return value;
592        case -925155509: // reference
593          this.reference = castToIdentifier(value); // Identifier
594          return value;
595        default: return super.setProperty(hash, name, value);
596        }
597
598      }
599
600      @Override
601      public Base setProperty(String name, Base value) throws FHIRException {
602        if (name.equals("claim")) {
603          this.claim = castToReference(value); // Reference
604        } else if (name.equals("relationship")) {
605          this.relationship = castToCodeableConcept(value); // CodeableConcept
606        } else if (name.equals("reference")) {
607          this.reference = castToIdentifier(value); // Identifier
608        } else
609          return super.setProperty(name, value);
610        return value;
611      }
612
613      @Override
614      public Base makeProperty(int hash, String name) throws FHIRException {
615        switch (hash) {
616        case 94742588:  return getClaim(); 
617        case -261851592:  return getRelationship(); 
618        case -925155509:  return getReference(); 
619        default: return super.makeProperty(hash, name);
620        }
621
622      }
623
624      @Override
625      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
626        switch (hash) {
627        case 94742588: /*claim*/ return new String[] {"Reference"};
628        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
629        case -925155509: /*reference*/ return new String[] {"Identifier"};
630        default: return super.getTypesForProperty(hash, name);
631        }
632
633      }
634
635      @Override
636      public Base addChild(String name) throws FHIRException {
637        if (name.equals("claim")) {
638          this.claim = new Reference();
639          return this.claim;
640        }
641        else if (name.equals("relationship")) {
642          this.relationship = new CodeableConcept();
643          return this.relationship;
644        }
645        else if (name.equals("reference")) {
646          this.reference = new Identifier();
647          return this.reference;
648        }
649        else
650          return super.addChild(name);
651      }
652
653      public RelatedClaimComponent copy() {
654        RelatedClaimComponent dst = new RelatedClaimComponent();
655        copyValues(dst);
656        return dst;
657      }
658
659      public void copyValues(RelatedClaimComponent dst) {
660        super.copyValues(dst);
661        dst.claim = claim == null ? null : claim.copy();
662        dst.relationship = relationship == null ? null : relationship.copy();
663        dst.reference = reference == null ? null : reference.copy();
664      }
665
666      @Override
667      public boolean equalsDeep(Base other_) {
668        if (!super.equalsDeep(other_))
669          return false;
670        if (!(other_ instanceof RelatedClaimComponent))
671          return false;
672        RelatedClaimComponent o = (RelatedClaimComponent) other_;
673        return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true) && compareDeep(reference, o.reference, true)
674          ;
675      }
676
677      @Override
678      public boolean equalsShallow(Base other_) {
679        if (!super.equalsShallow(other_))
680          return false;
681        if (!(other_ instanceof RelatedClaimComponent))
682          return false;
683        RelatedClaimComponent o = (RelatedClaimComponent) other_;
684        return true;
685      }
686
687      public boolean isEmpty() {
688        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference
689          );
690      }
691
692  public String fhirType() {
693    return "ExplanationOfBenefit.related";
694
695  }
696
697  }
698
699    @Block()
700    public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
701        /**
702         * Type of Party to be reimbursed: Subscriber, provider, other.
703         */
704        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
705        @Description(shortDefinition="Category of recipient", formalDefinition="Type of Party to be reimbursed: Subscriber, provider, other." )
706        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payeetype")
707        protected CodeableConcept type;
708
709        /**
710         * Reference to the individual or organization to whom any payment will be made.
711         */
712        @Child(name = "party", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, RelatedPerson.class}, order=2, min=0, max=1, modifier=false, summary=false)
713        @Description(shortDefinition="Recipient reference", formalDefinition="Reference to the individual or organization to whom any payment will be made." )
714        protected Reference party;
715
716        /**
717         * The actual object that is the target of the reference (Reference to the individual or organization to whom any payment will be made.)
718         */
719        protected Resource partyTarget;
720
721        private static final long serialVersionUID = 1609484699L;
722
723    /**
724     * Constructor
725     */
726      public PayeeComponent() {
727        super();
728      }
729
730        /**
731         * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
732         */
733        public CodeableConcept getType() { 
734          if (this.type == null)
735            if (Configuration.errorOnAutoCreate())
736              throw new Error("Attempt to auto-create PayeeComponent.type");
737            else if (Configuration.doAutoCreate())
738              this.type = new CodeableConcept(); // cc
739          return this.type;
740        }
741
742        public boolean hasType() { 
743          return this.type != null && !this.type.isEmpty();
744        }
745
746        /**
747         * @param value {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
748         */
749        public PayeeComponent setType(CodeableConcept value) { 
750          this.type = value;
751          return this;
752        }
753
754        /**
755         * @return {@link #party} (Reference to the individual or organization to whom any payment will be made.)
756         */
757        public Reference getParty() { 
758          if (this.party == null)
759            if (Configuration.errorOnAutoCreate())
760              throw new Error("Attempt to auto-create PayeeComponent.party");
761            else if (Configuration.doAutoCreate())
762              this.party = new Reference(); // cc
763          return this.party;
764        }
765
766        public boolean hasParty() { 
767          return this.party != null && !this.party.isEmpty();
768        }
769
770        /**
771         * @param value {@link #party} (Reference to the individual or organization to whom any payment will be made.)
772         */
773        public PayeeComponent setParty(Reference value) { 
774          this.party = value;
775          return this;
776        }
777
778        /**
779         * @return {@link #party} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Reference to the individual or organization to whom any payment will be made.)
780         */
781        public Resource getPartyTarget() { 
782          return this.partyTarget;
783        }
784
785        /**
786         * @param value {@link #party} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Reference to the individual or organization to whom any payment will be made.)
787         */
788        public PayeeComponent setPartyTarget(Resource value) { 
789          this.partyTarget = value;
790          return this;
791        }
792
793        protected void listChildren(List<Property> children) {
794          super.listChildren(children);
795          children.add(new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type));
796          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));
797        }
798
799        @Override
800        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
801          switch (_hash) {
802          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type);
803          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);
804          default: return super.getNamedProperty(_hash, _name, _checkValid);
805          }
806
807        }
808
809      @Override
810      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
811        switch (hash) {
812        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
813        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
814        default: return super.getProperty(hash, name, checkValid);
815        }
816
817      }
818
819      @Override
820      public Base setProperty(int hash, String name, Base value) throws FHIRException {
821        switch (hash) {
822        case 3575610: // type
823          this.type = castToCodeableConcept(value); // CodeableConcept
824          return value;
825        case 106437350: // party
826          this.party = castToReference(value); // Reference
827          return value;
828        default: return super.setProperty(hash, name, value);
829        }
830
831      }
832
833      @Override
834      public Base setProperty(String name, Base value) throws FHIRException {
835        if (name.equals("type")) {
836          this.type = castToCodeableConcept(value); // CodeableConcept
837        } else if (name.equals("party")) {
838          this.party = castToReference(value); // Reference
839        } else
840          return super.setProperty(name, value);
841        return value;
842      }
843
844      @Override
845      public Base makeProperty(int hash, String name) throws FHIRException {
846        switch (hash) {
847        case 3575610:  return getType(); 
848        case 106437350:  return getParty(); 
849        default: return super.makeProperty(hash, name);
850        }
851
852      }
853
854      @Override
855      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
856        switch (hash) {
857        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
858        case 106437350: /*party*/ return new String[] {"Reference"};
859        default: return super.getTypesForProperty(hash, name);
860        }
861
862      }
863
864      @Override
865      public Base addChild(String name) throws FHIRException {
866        if (name.equals("type")) {
867          this.type = new CodeableConcept();
868          return this.type;
869        }
870        else if (name.equals("party")) {
871          this.party = new Reference();
872          return this.party;
873        }
874        else
875          return super.addChild(name);
876      }
877
878      public PayeeComponent copy() {
879        PayeeComponent dst = new PayeeComponent();
880        copyValues(dst);
881        return dst;
882      }
883
884      public void copyValues(PayeeComponent dst) {
885        super.copyValues(dst);
886        dst.type = type == null ? null : type.copy();
887        dst.party = party == null ? null : party.copy();
888      }
889
890      @Override
891      public boolean equalsDeep(Base other_) {
892        if (!super.equalsDeep(other_))
893          return false;
894        if (!(other_ instanceof PayeeComponent))
895          return false;
896        PayeeComponent o = (PayeeComponent) other_;
897        return compareDeep(type, o.type, true) && compareDeep(party, o.party, true);
898      }
899
900      @Override
901      public boolean equalsShallow(Base other_) {
902        if (!super.equalsShallow(other_))
903          return false;
904        if (!(other_ instanceof PayeeComponent))
905          return false;
906        PayeeComponent o = (PayeeComponent) other_;
907        return true;
908      }
909
910      public boolean isEmpty() {
911        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party);
912      }
913
914  public String fhirType() {
915    return "ExplanationOfBenefit.payee";
916
917  }
918
919  }
920
921    @Block()
922    public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
923        /**
924         * A number to uniquely identify care team entries.
925         */
926        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
927        @Description(shortDefinition="Order of care team", formalDefinition="A number to uniquely identify care team entries." )
928        protected PositiveIntType sequence;
929
930        /**
931         * Member of the team who provided the product or service.
932         */
933        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=2, min=1, max=1, modifier=false, summary=false)
934        @Description(shortDefinition="Practitioner or organization", formalDefinition="Member of the team who provided the product or service." )
935        protected Reference provider;
936
937        /**
938         * The actual object that is the target of the reference (Member of the team who provided the product or service.)
939         */
940        protected Resource providerTarget;
941
942        /**
943         * The party who is billing and/or responsible for the claimed products or services.
944         */
945        @Child(name = "responsible", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
946        @Description(shortDefinition="Indicator of the lead practitioner", formalDefinition="The party who is billing and/or responsible for the claimed products or services." )
947        protected BooleanType responsible;
948
949        /**
950         * The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.
951         */
952        @Child(name = "role", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
953        @Description(shortDefinition="Function within the team", formalDefinition="The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team." )
954        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-careteamrole")
955        protected CodeableConcept role;
956
957        /**
958         * The qualification of the practitioner which is applicable for this service.
959         */
960        @Child(name = "qualification", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
961        @Description(shortDefinition="Practitioner credential or specialization", formalDefinition="The qualification of the practitioner which is applicable for this service." )
962        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provider-qualification")
963        protected CodeableConcept qualification;
964
965        private static final long serialVersionUID = 1758966968L;
966
967    /**
968     * Constructor
969     */
970      public CareTeamComponent() {
971        super();
972      }
973
974    /**
975     * Constructor
976     */
977      public CareTeamComponent(PositiveIntType sequence, Reference provider) {
978        super();
979        this.sequence = sequence;
980        this.provider = provider;
981      }
982
983        /**
984         * @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
985         */
986        public PositiveIntType getSequenceElement() { 
987          if (this.sequence == null)
988            if (Configuration.errorOnAutoCreate())
989              throw new Error("Attempt to auto-create CareTeamComponent.sequence");
990            else if (Configuration.doAutoCreate())
991              this.sequence = new PositiveIntType(); // bb
992          return this.sequence;
993        }
994
995        public boolean hasSequenceElement() { 
996          return this.sequence != null && !this.sequence.isEmpty();
997        }
998
999        public boolean hasSequence() { 
1000          return this.sequence != null && !this.sequence.isEmpty();
1001        }
1002
1003        /**
1004         * @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
1005         */
1006        public CareTeamComponent setSequenceElement(PositiveIntType value) { 
1007          this.sequence = value;
1008          return this;
1009        }
1010
1011        /**
1012         * @return A number to uniquely identify care team entries.
1013         */
1014        public int getSequence() { 
1015          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1016        }
1017
1018        /**
1019         * @param value A number to uniquely identify care team entries.
1020         */
1021        public CareTeamComponent setSequence(int value) { 
1022            if (this.sequence == null)
1023              this.sequence = new PositiveIntType();
1024            this.sequence.setValue(value);
1025          return this;
1026        }
1027
1028        /**
1029         * @return {@link #provider} (Member of the team who provided the product or service.)
1030         */
1031        public Reference getProvider() { 
1032          if (this.provider == null)
1033            if (Configuration.errorOnAutoCreate())
1034              throw new Error("Attempt to auto-create CareTeamComponent.provider");
1035            else if (Configuration.doAutoCreate())
1036              this.provider = new Reference(); // cc
1037          return this.provider;
1038        }
1039
1040        public boolean hasProvider() { 
1041          return this.provider != null && !this.provider.isEmpty();
1042        }
1043
1044        /**
1045         * @param value {@link #provider} (Member of the team who provided the product or service.)
1046         */
1047        public CareTeamComponent setProvider(Reference value) { 
1048          this.provider = value;
1049          return this;
1050        }
1051
1052        /**
1053         * @return {@link #provider} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Member of the team who provided the product or service.)
1054         */
1055        public Resource getProviderTarget() { 
1056          return this.providerTarget;
1057        }
1058
1059        /**
1060         * @param value {@link #provider} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Member of the team who provided the product or service.)
1061         */
1062        public CareTeamComponent setProviderTarget(Resource value) { 
1063          this.providerTarget = value;
1064          return this;
1065        }
1066
1067        /**
1068         * @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
1069         */
1070        public BooleanType getResponsibleElement() { 
1071          if (this.responsible == null)
1072            if (Configuration.errorOnAutoCreate())
1073              throw new Error("Attempt to auto-create CareTeamComponent.responsible");
1074            else if (Configuration.doAutoCreate())
1075              this.responsible = new BooleanType(); // bb
1076          return this.responsible;
1077        }
1078
1079        public boolean hasResponsibleElement() { 
1080          return this.responsible != null && !this.responsible.isEmpty();
1081        }
1082
1083        public boolean hasResponsible() { 
1084          return this.responsible != null && !this.responsible.isEmpty();
1085        }
1086
1087        /**
1088         * @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
1089         */
1090        public CareTeamComponent setResponsibleElement(BooleanType value) { 
1091          this.responsible = value;
1092          return this;
1093        }
1094
1095        /**
1096         * @return The party who is billing and/or responsible for the claimed products or services.
1097         */
1098        public boolean getResponsible() { 
1099          return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
1100        }
1101
1102        /**
1103         * @param value The party who is billing and/or responsible for the claimed products or services.
1104         */
1105        public CareTeamComponent setResponsible(boolean value) { 
1106            if (this.responsible == null)
1107              this.responsible = new BooleanType();
1108            this.responsible.setValue(value);
1109          return this;
1110        }
1111
1112        /**
1113         * @return {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.)
1114         */
1115        public CodeableConcept getRole() { 
1116          if (this.role == null)
1117            if (Configuration.errorOnAutoCreate())
1118              throw new Error("Attempt to auto-create CareTeamComponent.role");
1119            else if (Configuration.doAutoCreate())
1120              this.role = new CodeableConcept(); // cc
1121          return this.role;
1122        }
1123
1124        public boolean hasRole() { 
1125          return this.role != null && !this.role.isEmpty();
1126        }
1127
1128        /**
1129         * @param value {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.)
1130         */
1131        public CareTeamComponent setRole(CodeableConcept value) { 
1132          this.role = value;
1133          return this;
1134        }
1135
1136        /**
1137         * @return {@link #qualification} (The qualification of the practitioner which is applicable for this service.)
1138         */
1139        public CodeableConcept getQualification() { 
1140          if (this.qualification == null)
1141            if (Configuration.errorOnAutoCreate())
1142              throw new Error("Attempt to auto-create CareTeamComponent.qualification");
1143            else if (Configuration.doAutoCreate())
1144              this.qualification = new CodeableConcept(); // cc
1145          return this.qualification;
1146        }
1147
1148        public boolean hasQualification() { 
1149          return this.qualification != null && !this.qualification.isEmpty();
1150        }
1151
1152        /**
1153         * @param value {@link #qualification} (The qualification of the practitioner which is applicable for this service.)
1154         */
1155        public CareTeamComponent setQualification(CodeableConcept value) { 
1156          this.qualification = value;
1157          return this;
1158        }
1159
1160        protected void listChildren(List<Property> children) {
1161          super.listChildren(children);
1162          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence));
1163          children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "Member of the team who provided the product or service.", 0, 1, provider));
1164          children.add(new Property("responsible", "boolean", "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible));
1165          children.add(new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1, role));
1166          children.add(new Property("qualification", "CodeableConcept", "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification));
1167        }
1168
1169        @Override
1170        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1171          switch (_hash) {
1172          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence);
1173          case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "Member of the team who provided the product or service.", 0, 1, provider);
1174          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);
1175          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1, role);
1176          case -631333393: /*qualification*/  return new Property("qualification", "CodeableConcept", "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification);
1177          default: return super.getNamedProperty(_hash, _name, _checkValid);
1178          }
1179
1180        }
1181
1182      @Override
1183      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1184        switch (hash) {
1185        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1186        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
1187        case 1847674614: /*responsible*/ return this.responsible == null ? new Base[0] : new Base[] {this.responsible}; // BooleanType
1188        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
1189        case -631333393: /*qualification*/ return this.qualification == null ? new Base[0] : new Base[] {this.qualification}; // CodeableConcept
1190        default: return super.getProperty(hash, name, checkValid);
1191        }
1192
1193      }
1194
1195      @Override
1196      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1197        switch (hash) {
1198        case 1349547969: // sequence
1199          this.sequence = castToPositiveInt(value); // PositiveIntType
1200          return value;
1201        case -987494927: // provider
1202          this.provider = castToReference(value); // Reference
1203          return value;
1204        case 1847674614: // responsible
1205          this.responsible = castToBoolean(value); // BooleanType
1206          return value;
1207        case 3506294: // role
1208          this.role = castToCodeableConcept(value); // CodeableConcept
1209          return value;
1210        case -631333393: // qualification
1211          this.qualification = castToCodeableConcept(value); // CodeableConcept
1212          return value;
1213        default: return super.setProperty(hash, name, value);
1214        }
1215
1216      }
1217
1218      @Override
1219      public Base setProperty(String name, Base value) throws FHIRException {
1220        if (name.equals("sequence")) {
1221          this.sequence = castToPositiveInt(value); // PositiveIntType
1222        } else if (name.equals("provider")) {
1223          this.provider = castToReference(value); // Reference
1224        } else if (name.equals("responsible")) {
1225          this.responsible = castToBoolean(value); // BooleanType
1226        } else if (name.equals("role")) {
1227          this.role = castToCodeableConcept(value); // CodeableConcept
1228        } else if (name.equals("qualification")) {
1229          this.qualification = castToCodeableConcept(value); // CodeableConcept
1230        } else
1231          return super.setProperty(name, value);
1232        return value;
1233      }
1234
1235      @Override
1236      public Base makeProperty(int hash, String name) throws FHIRException {
1237        switch (hash) {
1238        case 1349547969:  return getSequenceElement();
1239        case -987494927:  return getProvider(); 
1240        case 1847674614:  return getResponsibleElement();
1241        case 3506294:  return getRole(); 
1242        case -631333393:  return getQualification(); 
1243        default: return super.makeProperty(hash, name);
1244        }
1245
1246      }
1247
1248      @Override
1249      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1250        switch (hash) {
1251        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1252        case -987494927: /*provider*/ return new String[] {"Reference"};
1253        case 1847674614: /*responsible*/ return new String[] {"boolean"};
1254        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
1255        case -631333393: /*qualification*/ return new String[] {"CodeableConcept"};
1256        default: return super.getTypesForProperty(hash, name);
1257        }
1258
1259      }
1260
1261      @Override
1262      public Base addChild(String name) throws FHIRException {
1263        if (name.equals("sequence")) {
1264          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1265        }
1266        else if (name.equals("provider")) {
1267          this.provider = new Reference();
1268          return this.provider;
1269        }
1270        else if (name.equals("responsible")) {
1271          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.responsible");
1272        }
1273        else if (name.equals("role")) {
1274          this.role = new CodeableConcept();
1275          return this.role;
1276        }
1277        else if (name.equals("qualification")) {
1278          this.qualification = new CodeableConcept();
1279          return this.qualification;
1280        }
1281        else
1282          return super.addChild(name);
1283      }
1284
1285      public CareTeamComponent copy() {
1286        CareTeamComponent dst = new CareTeamComponent();
1287        copyValues(dst);
1288        return dst;
1289      }
1290
1291      public void copyValues(CareTeamComponent dst) {
1292        super.copyValues(dst);
1293        dst.sequence = sequence == null ? null : sequence.copy();
1294        dst.provider = provider == null ? null : provider.copy();
1295        dst.responsible = responsible == null ? null : responsible.copy();
1296        dst.role = role == null ? null : role.copy();
1297        dst.qualification = qualification == null ? null : qualification.copy();
1298      }
1299
1300      @Override
1301      public boolean equalsDeep(Base other_) {
1302        if (!super.equalsDeep(other_))
1303          return false;
1304        if (!(other_ instanceof CareTeamComponent))
1305          return false;
1306        CareTeamComponent o = (CareTeamComponent) other_;
1307        return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true) && compareDeep(responsible, o.responsible, true)
1308           && compareDeep(role, o.role, true) && compareDeep(qualification, o.qualification, true);
1309      }
1310
1311      @Override
1312      public boolean equalsShallow(Base other_) {
1313        if (!super.equalsShallow(other_))
1314          return false;
1315        if (!(other_ instanceof CareTeamComponent))
1316          return false;
1317        CareTeamComponent o = (CareTeamComponent) other_;
1318        return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true)
1319          ;
1320      }
1321
1322      public boolean isEmpty() {
1323        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible
1324          , role, qualification);
1325      }
1326
1327  public String fhirType() {
1328    return "ExplanationOfBenefit.careTeam";
1329
1330  }
1331
1332  }
1333
1334    @Block()
1335    public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
1336        /**
1337         * A number to uniquely identify supporting information entries.
1338         */
1339        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1340        @Description(shortDefinition="Information instance identifier", formalDefinition="A number to uniquely identify supporting information entries." )
1341        protected PositiveIntType sequence;
1342
1343        /**
1344         * The general class of the information supplied: information; exception; accident, employment; onset, etc.
1345         */
1346        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
1347        @Description(shortDefinition="Classification of the supplied information", formalDefinition="The general class of the information supplied: information; exception; accident, employment; onset, etc." )
1348        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-informationcategory")
1349        protected CodeableConcept category;
1350
1351        /**
1352         * System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.
1353         */
1354        @Child(name = "code", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1355        @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." )
1356        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-exception")
1357        protected CodeableConcept code;
1358
1359        /**
1360         * The date when or period to which this information refers.
1361         */
1362        @Child(name = "timing", type = {DateType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
1363        @Description(shortDefinition="When it occurred", formalDefinition="The date when or period to which this information refers." )
1364        protected Type timing;
1365
1366        /**
1367         * Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.
1368         */
1369        @Child(name = "value", type = {BooleanType.class, StringType.class, Quantity.class, Attachment.class, Reference.class}, order=5, min=0, max=1, modifier=false, summary=false)
1370        @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." )
1371        protected Type value;
1372
1373        /**
1374         * Provides the reason in the situation where a reason code is required in addition to the content.
1375         */
1376        @Child(name = "reason", type = {Coding.class}, order=6, min=0, max=1, modifier=false, summary=false)
1377        @Description(shortDefinition="Explanation for the information", formalDefinition="Provides the reason in the situation where a reason code is required in addition to the content." )
1378        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/missing-tooth-reason")
1379        protected Coding reason;
1380
1381        private static final long serialVersionUID = -410136661L;
1382
1383    /**
1384     * Constructor
1385     */
1386      public SupportingInformationComponent() {
1387        super();
1388      }
1389
1390    /**
1391     * Constructor
1392     */
1393      public SupportingInformationComponent(PositiveIntType sequence, CodeableConcept category) {
1394        super();
1395        this.sequence = sequence;
1396        this.category = category;
1397      }
1398
1399        /**
1400         * @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
1401         */
1402        public PositiveIntType getSequenceElement() { 
1403          if (this.sequence == null)
1404            if (Configuration.errorOnAutoCreate())
1405              throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
1406            else if (Configuration.doAutoCreate())
1407              this.sequence = new PositiveIntType(); // bb
1408          return this.sequence;
1409        }
1410
1411        public boolean hasSequenceElement() { 
1412          return this.sequence != null && !this.sequence.isEmpty();
1413        }
1414
1415        public boolean hasSequence() { 
1416          return this.sequence != null && !this.sequence.isEmpty();
1417        }
1418
1419        /**
1420         * @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
1421         */
1422        public SupportingInformationComponent setSequenceElement(PositiveIntType value) { 
1423          this.sequence = value;
1424          return this;
1425        }
1426
1427        /**
1428         * @return A number to uniquely identify supporting information entries.
1429         */
1430        public int getSequence() { 
1431          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1432        }
1433
1434        /**
1435         * @param value A number to uniquely identify supporting information entries.
1436         */
1437        public SupportingInformationComponent setSequence(int value) { 
1438            if (this.sequence == null)
1439              this.sequence = new PositiveIntType();
1440            this.sequence.setValue(value);
1441          return this;
1442        }
1443
1444        /**
1445         * @return {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1446         */
1447        public CodeableConcept getCategory() { 
1448          if (this.category == null)
1449            if (Configuration.errorOnAutoCreate())
1450              throw new Error("Attempt to auto-create SupportingInformationComponent.category");
1451            else if (Configuration.doAutoCreate())
1452              this.category = new CodeableConcept(); // cc
1453          return this.category;
1454        }
1455
1456        public boolean hasCategory() { 
1457          return this.category != null && !this.category.isEmpty();
1458        }
1459
1460        /**
1461         * @param value {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1462         */
1463        public SupportingInformationComponent setCategory(CodeableConcept value) { 
1464          this.category = value;
1465          return this;
1466        }
1467
1468        /**
1469         * @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.)
1470         */
1471        public CodeableConcept getCode() { 
1472          if (this.code == null)
1473            if (Configuration.errorOnAutoCreate())
1474              throw new Error("Attempt to auto-create SupportingInformationComponent.code");
1475            else if (Configuration.doAutoCreate())
1476              this.code = new CodeableConcept(); // cc
1477          return this.code;
1478        }
1479
1480        public boolean hasCode() { 
1481          return this.code != null && !this.code.isEmpty();
1482        }
1483
1484        /**
1485         * @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.)
1486         */
1487        public SupportingInformationComponent setCode(CodeableConcept value) { 
1488          this.code = value;
1489          return this;
1490        }
1491
1492        /**
1493         * @return {@link #timing} (The date when or period to which this information refers.)
1494         */
1495        public Type getTiming() { 
1496          return this.timing;
1497        }
1498
1499        /**
1500         * @return {@link #timing} (The date when or period to which this information refers.)
1501         */
1502        public DateType getTimingDateType() throws FHIRException { 
1503          if (this.timing == null)
1504            this.timing = new DateType();
1505          if (!(this.timing instanceof DateType))
1506            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.timing.getClass().getName()+" was encountered");
1507          return (DateType) this.timing;
1508        }
1509
1510        public boolean hasTimingDateType() { 
1511          return this != null && this.timing instanceof DateType;
1512        }
1513
1514        /**
1515         * @return {@link #timing} (The date when or period to which this information refers.)
1516         */
1517        public Period getTimingPeriod() throws FHIRException { 
1518          if (this.timing == null)
1519            this.timing = new Period();
1520          if (!(this.timing instanceof Period))
1521            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
1522          return (Period) this.timing;
1523        }
1524
1525        public boolean hasTimingPeriod() { 
1526          return this != null && this.timing instanceof Period;
1527        }
1528
1529        public boolean hasTiming() { 
1530          return this.timing != null && !this.timing.isEmpty();
1531        }
1532
1533        /**
1534         * @param value {@link #timing} (The date when or period to which this information refers.)
1535         */
1536        public SupportingInformationComponent setTiming(Type value) { 
1537          if (value != null && !(value instanceof DateType || value instanceof Period))
1538            throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.timing[x]: "+value.fhirType());
1539          this.timing = value;
1540          return this;
1541        }
1542
1543        /**
1544         * @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.)
1545         */
1546        public Type getValue() { 
1547          return this.value;
1548        }
1549
1550        /**
1551         * @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.)
1552         */
1553        public BooleanType getValueBooleanType() throws FHIRException { 
1554          if (this.value == null)
1555            this.value = new BooleanType();
1556          if (!(this.value instanceof BooleanType))
1557            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
1558          return (BooleanType) this.value;
1559        }
1560
1561        public boolean hasValueBooleanType() { 
1562          return this != null && this.value instanceof BooleanType;
1563        }
1564
1565        /**
1566         * @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.)
1567         */
1568        public StringType getValueStringType() throws FHIRException { 
1569          if (this.value == null)
1570            this.value = new StringType();
1571          if (!(this.value instanceof StringType))
1572            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
1573          return (StringType) this.value;
1574        }
1575
1576        public boolean hasValueStringType() { 
1577          return this != null && this.value instanceof StringType;
1578        }
1579
1580        /**
1581         * @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.)
1582         */
1583        public Quantity getValueQuantity() throws FHIRException { 
1584          if (this.value == null)
1585            this.value = new Quantity();
1586          if (!(this.value instanceof Quantity))
1587            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
1588          return (Quantity) this.value;
1589        }
1590
1591        public boolean hasValueQuantity() { 
1592          return this != null && this.value instanceof Quantity;
1593        }
1594
1595        /**
1596         * @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.)
1597         */
1598        public Attachment getValueAttachment() throws FHIRException { 
1599          if (this.value == null)
1600            this.value = new Attachment();
1601          if (!(this.value instanceof Attachment))
1602            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
1603          return (Attachment) this.value;
1604        }
1605
1606        public boolean hasValueAttachment() { 
1607          return this != null && this.value instanceof Attachment;
1608        }
1609
1610        /**
1611         * @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.)
1612         */
1613        public Reference getValueReference() throws FHIRException { 
1614          if (this.value == null)
1615            this.value = new Reference();
1616          if (!(this.value instanceof Reference))
1617            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
1618          return (Reference) this.value;
1619        }
1620
1621        public boolean hasValueReference() { 
1622          return this != null && this.value instanceof Reference;
1623        }
1624
1625        public boolean hasValue() { 
1626          return this.value != null && !this.value.isEmpty();
1627        }
1628
1629        /**
1630         * @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.)
1631         */
1632        public SupportingInformationComponent setValue(Type value) { 
1633          if (value != null && !(value instanceof BooleanType || value instanceof StringType || value instanceof Quantity || value instanceof Attachment || value instanceof Reference))
1634            throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.value[x]: "+value.fhirType());
1635          this.value = value;
1636          return this;
1637        }
1638
1639        /**
1640         * @return {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1641         */
1642        public Coding getReason() { 
1643          if (this.reason == null)
1644            if (Configuration.errorOnAutoCreate())
1645              throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1646            else if (Configuration.doAutoCreate())
1647              this.reason = new Coding(); // cc
1648          return this.reason;
1649        }
1650
1651        public boolean hasReason() { 
1652          return this.reason != null && !this.reason.isEmpty();
1653        }
1654
1655        /**
1656         * @param value {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1657         */
1658        public SupportingInformationComponent setReason(Coding value) { 
1659          this.reason = value;
1660          return this;
1661        }
1662
1663        protected void listChildren(List<Property> children) {
1664          super.listChildren(children);
1665          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence));
1666          children.add(new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category));
1667          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));
1668          children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing));
1669          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));
1670          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));
1671        }
1672
1673        @Override
1674        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1675          switch (_hash) {
1676          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence);
1677          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category);
1678          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);
1679          case 164632566: /*timing[x]*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1680          case -873664438: /*timing*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1681          case 807935768: /*timingDate*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1682          case -615615829: /*timingPeriod*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1683          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);
1684          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);
1685          case 733421943: /*valueBoolean*/  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);
1686          case -1424603934: /*valueString*/  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);
1687          case -2029823716: /*valueQuantity*/  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);
1688          case -475566732: /*valueAttachment*/  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);
1689          case 1755241690: /*valueReference*/  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);
1690          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);
1691          default: return super.getNamedProperty(_hash, _name, _checkValid);
1692          }
1693
1694        }
1695
1696      @Override
1697      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1698        switch (hash) {
1699        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1700        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1701        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1702        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Type
1703        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
1704        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
1705        default: return super.getProperty(hash, name, checkValid);
1706        }
1707
1708      }
1709
1710      @Override
1711      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1712        switch (hash) {
1713        case 1349547969: // sequence
1714          this.sequence = castToPositiveInt(value); // PositiveIntType
1715          return value;
1716        case 50511102: // category
1717          this.category = castToCodeableConcept(value); // CodeableConcept
1718          return value;
1719        case 3059181: // code
1720          this.code = castToCodeableConcept(value); // CodeableConcept
1721          return value;
1722        case -873664438: // timing
1723          this.timing = castToType(value); // Type
1724          return value;
1725        case 111972721: // value
1726          this.value = castToType(value); // Type
1727          return value;
1728        case -934964668: // reason
1729          this.reason = castToCoding(value); // Coding
1730          return value;
1731        default: return super.setProperty(hash, name, value);
1732        }
1733
1734      }
1735
1736      @Override
1737      public Base setProperty(String name, Base value) throws FHIRException {
1738        if (name.equals("sequence")) {
1739          this.sequence = castToPositiveInt(value); // PositiveIntType
1740        } else if (name.equals("category")) {
1741          this.category = castToCodeableConcept(value); // CodeableConcept
1742        } else if (name.equals("code")) {
1743          this.code = castToCodeableConcept(value); // CodeableConcept
1744        } else if (name.equals("timing[x]")) {
1745          this.timing = castToType(value); // Type
1746        } else if (name.equals("value[x]")) {
1747          this.value = castToType(value); // Type
1748        } else if (name.equals("reason")) {
1749          this.reason = castToCoding(value); // Coding
1750        } else
1751          return super.setProperty(name, value);
1752        return value;
1753      }
1754
1755      @Override
1756      public Base makeProperty(int hash, String name) throws FHIRException {
1757        switch (hash) {
1758        case 1349547969:  return getSequenceElement();
1759        case 50511102:  return getCategory(); 
1760        case 3059181:  return getCode(); 
1761        case 164632566:  return getTiming(); 
1762        case -873664438:  return getTiming(); 
1763        case -1410166417:  return getValue(); 
1764        case 111972721:  return getValue(); 
1765        case -934964668:  return getReason(); 
1766        default: return super.makeProperty(hash, name);
1767        }
1768
1769      }
1770
1771      @Override
1772      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1773        switch (hash) {
1774        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1775        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1776        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1777        case -873664438: /*timing*/ return new String[] {"date", "Period"};
1778        case 111972721: /*value*/ return new String[] {"boolean", "string", "Quantity", "Attachment", "Reference"};
1779        case -934964668: /*reason*/ return new String[] {"Coding"};
1780        default: return super.getTypesForProperty(hash, name);
1781        }
1782
1783      }
1784
1785      @Override
1786      public Base addChild(String name) throws FHIRException {
1787        if (name.equals("sequence")) {
1788          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1789        }
1790        else if (name.equals("category")) {
1791          this.category = new CodeableConcept();
1792          return this.category;
1793        }
1794        else if (name.equals("code")) {
1795          this.code = new CodeableConcept();
1796          return this.code;
1797        }
1798        else if (name.equals("timingDate")) {
1799          this.timing = new DateType();
1800          return this.timing;
1801        }
1802        else if (name.equals("timingPeriod")) {
1803          this.timing = new Period();
1804          return this.timing;
1805        }
1806        else if (name.equals("valueBoolean")) {
1807          this.value = new BooleanType();
1808          return this.value;
1809        }
1810        else if (name.equals("valueString")) {
1811          this.value = new StringType();
1812          return this.value;
1813        }
1814        else if (name.equals("valueQuantity")) {
1815          this.value = new Quantity();
1816          return this.value;
1817        }
1818        else if (name.equals("valueAttachment")) {
1819          this.value = new Attachment();
1820          return this.value;
1821        }
1822        else if (name.equals("valueReference")) {
1823          this.value = new Reference();
1824          return this.value;
1825        }
1826        else if (name.equals("reason")) {
1827          this.reason = new Coding();
1828          return this.reason;
1829        }
1830        else
1831          return super.addChild(name);
1832      }
1833
1834      public SupportingInformationComponent copy() {
1835        SupportingInformationComponent dst = new SupportingInformationComponent();
1836        copyValues(dst);
1837        return dst;
1838      }
1839
1840      public void copyValues(SupportingInformationComponent dst) {
1841        super.copyValues(dst);
1842        dst.sequence = sequence == null ? null : sequence.copy();
1843        dst.category = category == null ? null : category.copy();
1844        dst.code = code == null ? null : code.copy();
1845        dst.timing = timing == null ? null : timing.copy();
1846        dst.value = value == null ? null : value.copy();
1847        dst.reason = reason == null ? null : reason.copy();
1848      }
1849
1850      @Override
1851      public boolean equalsDeep(Base other_) {
1852        if (!super.equalsDeep(other_))
1853          return false;
1854        if (!(other_ instanceof SupportingInformationComponent))
1855          return false;
1856        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1857        return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true) && compareDeep(code, o.code, true)
1858           && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true) && compareDeep(reason, o.reason, true)
1859          ;
1860      }
1861
1862      @Override
1863      public boolean equalsShallow(Base other_) {
1864        if (!super.equalsShallow(other_))
1865          return false;
1866        if (!(other_ instanceof SupportingInformationComponent))
1867          return false;
1868        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1869        return compareValues(sequence, o.sequence, true);
1870      }
1871
1872      public boolean isEmpty() {
1873        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code
1874          , timing, value, reason);
1875      }
1876
1877  public String fhirType() {
1878    return "ExplanationOfBenefit.supportingInfo";
1879
1880  }
1881
1882  }
1883
1884    @Block()
1885    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
1886        /**
1887         * A number to uniquely identify diagnosis entries.
1888         */
1889        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1890        @Description(shortDefinition="Diagnosis instance identifier", formalDefinition="A number to uniquely identify diagnosis entries." )
1891        protected PositiveIntType sequence;
1892
1893        /**
1894         * The nature of illness or problem in a coded form or as a reference to an external defined Condition.
1895         */
1896        @Child(name = "diagnosis", type = {CodeableConcept.class, Condition.class}, order=2, min=1, max=1, modifier=false, summary=false)
1897        @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." )
1898        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10")
1899        protected Type diagnosis;
1900
1901        /**
1902         * When the condition was observed or the relative ranking.
1903         */
1904        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1905        @Description(shortDefinition="Timing or nature of the diagnosis", formalDefinition="When the condition was observed or the relative ranking." )
1906        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosistype")
1907        protected List<CodeableConcept> type;
1908
1909        /**
1910         * Indication of whether the diagnosis was present on admission to a facility.
1911         */
1912        @Child(name = "onAdmission", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1913        @Description(shortDefinition="Present on admission", formalDefinition="Indication of whether the diagnosis was present on admission to a facility." )
1914        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosis-on-admission")
1915        protected CodeableConcept onAdmission;
1916
1917        /**
1918         * 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.
1919         */
1920        @Child(name = "packageCode", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1921        @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." )
1922        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
1923        protected CodeableConcept packageCode;
1924
1925        private static final long serialVersionUID = 2120593974L;
1926
1927    /**
1928     * Constructor
1929     */
1930      public DiagnosisComponent() {
1931        super();
1932      }
1933
1934    /**
1935     * Constructor
1936     */
1937      public DiagnosisComponent(PositiveIntType sequence, Type diagnosis) {
1938        super();
1939        this.sequence = sequence;
1940        this.diagnosis = diagnosis;
1941      }
1942
1943        /**
1944         * @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
1945         */
1946        public PositiveIntType getSequenceElement() { 
1947          if (this.sequence == null)
1948            if (Configuration.errorOnAutoCreate())
1949              throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
1950            else if (Configuration.doAutoCreate())
1951              this.sequence = new PositiveIntType(); // bb
1952          return this.sequence;
1953        }
1954
1955        public boolean hasSequenceElement() { 
1956          return this.sequence != null && !this.sequence.isEmpty();
1957        }
1958
1959        public boolean hasSequence() { 
1960          return this.sequence != null && !this.sequence.isEmpty();
1961        }
1962
1963        /**
1964         * @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
1965         */
1966        public DiagnosisComponent setSequenceElement(PositiveIntType value) { 
1967          this.sequence = value;
1968          return this;
1969        }
1970
1971        /**
1972         * @return A number to uniquely identify diagnosis entries.
1973         */
1974        public int getSequence() { 
1975          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1976        }
1977
1978        /**
1979         * @param value A number to uniquely identify diagnosis entries.
1980         */
1981        public DiagnosisComponent setSequence(int value) { 
1982            if (this.sequence == null)
1983              this.sequence = new PositiveIntType();
1984            this.sequence.setValue(value);
1985          return this;
1986        }
1987
1988        /**
1989         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1990         */
1991        public Type getDiagnosis() { 
1992          return this.diagnosis;
1993        }
1994
1995        /**
1996         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1997         */
1998        public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException { 
1999          if (this.diagnosis == null)
2000            this.diagnosis = new CodeableConcept();
2001          if (!(this.diagnosis instanceof CodeableConcept))
2002            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
2003          return (CodeableConcept) this.diagnosis;
2004        }
2005
2006        public boolean hasDiagnosisCodeableConcept() { 
2007          return this != null && this.diagnosis instanceof CodeableConcept;
2008        }
2009
2010        /**
2011         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
2012         */
2013        public Reference getDiagnosisReference() throws FHIRException { 
2014          if (this.diagnosis == null)
2015            this.diagnosis = new Reference();
2016          if (!(this.diagnosis instanceof Reference))
2017            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
2018          return (Reference) this.diagnosis;
2019        }
2020
2021        public boolean hasDiagnosisReference() { 
2022          return this != null && this.diagnosis instanceof Reference;
2023        }
2024
2025        public boolean hasDiagnosis() { 
2026          return this.diagnosis != null && !this.diagnosis.isEmpty();
2027        }
2028
2029        /**
2030         * @param value {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
2031         */
2032        public DiagnosisComponent setDiagnosis(Type value) { 
2033          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2034            throw new Error("Not the right type for ExplanationOfBenefit.diagnosis.diagnosis[x]: "+value.fhirType());
2035          this.diagnosis = value;
2036          return this;
2037        }
2038
2039        /**
2040         * @return {@link #type} (When the condition was observed or the relative ranking.)
2041         */
2042        public List<CodeableConcept> getType() { 
2043          if (this.type == null)
2044            this.type = new ArrayList<CodeableConcept>();
2045          return this.type;
2046        }
2047
2048        /**
2049         * @return Returns a reference to <code>this</code> for easy method chaining
2050         */
2051        public DiagnosisComponent setType(List<CodeableConcept> theType) { 
2052          this.type = theType;
2053          return this;
2054        }
2055
2056        public boolean hasType() { 
2057          if (this.type == null)
2058            return false;
2059          for (CodeableConcept item : this.type)
2060            if (!item.isEmpty())
2061              return true;
2062          return false;
2063        }
2064
2065        public CodeableConcept addType() { //3
2066          CodeableConcept t = new CodeableConcept();
2067          if (this.type == null)
2068            this.type = new ArrayList<CodeableConcept>();
2069          this.type.add(t);
2070          return t;
2071        }
2072
2073        public DiagnosisComponent addType(CodeableConcept t) { //3
2074          if (t == null)
2075            return this;
2076          if (this.type == null)
2077            this.type = new ArrayList<CodeableConcept>();
2078          this.type.add(t);
2079          return this;
2080        }
2081
2082        /**
2083         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
2084         */
2085        public CodeableConcept getTypeFirstRep() { 
2086          if (getType().isEmpty()) {
2087            addType();
2088          }
2089          return getType().get(0);
2090        }
2091
2092        /**
2093         * @return {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
2094         */
2095        public CodeableConcept getOnAdmission() { 
2096          if (this.onAdmission == null)
2097            if (Configuration.errorOnAutoCreate())
2098              throw new Error("Attempt to auto-create DiagnosisComponent.onAdmission");
2099            else if (Configuration.doAutoCreate())
2100              this.onAdmission = new CodeableConcept(); // cc
2101          return this.onAdmission;
2102        }
2103
2104        public boolean hasOnAdmission() { 
2105          return this.onAdmission != null && !this.onAdmission.isEmpty();
2106        }
2107
2108        /**
2109         * @param value {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
2110         */
2111        public DiagnosisComponent setOnAdmission(CodeableConcept value) { 
2112          this.onAdmission = value;
2113          return this;
2114        }
2115
2116        /**
2117         * @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.)
2118         */
2119        public CodeableConcept getPackageCode() { 
2120          if (this.packageCode == null)
2121            if (Configuration.errorOnAutoCreate())
2122              throw new Error("Attempt to auto-create DiagnosisComponent.packageCode");
2123            else if (Configuration.doAutoCreate())
2124              this.packageCode = new CodeableConcept(); // cc
2125          return this.packageCode;
2126        }
2127
2128        public boolean hasPackageCode() { 
2129          return this.packageCode != null && !this.packageCode.isEmpty();
2130        }
2131
2132        /**
2133         * @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.)
2134         */
2135        public DiagnosisComponent setPackageCode(CodeableConcept value) { 
2136          this.packageCode = value;
2137          return this;
2138        }
2139
2140        protected void listChildren(List<Property> children) {
2141          super.listChildren(children);
2142          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence));
2143          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));
2144          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
2145          children.add(new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission));
2146          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));
2147        }
2148
2149        @Override
2150        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2151          switch (_hash) {
2152          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence);
2153          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);
2154          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);
2155          case 277781616: /*diagnosisCodeableConcept*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis);
2156          case 2050454362: /*diagnosisReference*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis);
2157          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2158          case -3386134: /*onAdmission*/  return new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission);
2159          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);
2160          default: return super.getNamedProperty(_hash, _name, _checkValid);
2161          }
2162
2163        }
2164
2165      @Override
2166      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2167        switch (hash) {
2168        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2169        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // Type
2170        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2171        case -3386134: /*onAdmission*/ return this.onAdmission == null ? new Base[0] : new Base[] {this.onAdmission}; // CodeableConcept
2172        case 908444499: /*packageCode*/ return this.packageCode == null ? new Base[0] : new Base[] {this.packageCode}; // CodeableConcept
2173        default: return super.getProperty(hash, name, checkValid);
2174        }
2175
2176      }
2177
2178      @Override
2179      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2180        switch (hash) {
2181        case 1349547969: // sequence
2182          this.sequence = castToPositiveInt(value); // PositiveIntType
2183          return value;
2184        case 1196993265: // diagnosis
2185          this.diagnosis = castToType(value); // Type
2186          return value;
2187        case 3575610: // type
2188          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
2189          return value;
2190        case -3386134: // onAdmission
2191          this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2192          return value;
2193        case 908444499: // packageCode
2194          this.packageCode = castToCodeableConcept(value); // CodeableConcept
2195          return value;
2196        default: return super.setProperty(hash, name, value);
2197        }
2198
2199      }
2200
2201      @Override
2202      public Base setProperty(String name, Base value) throws FHIRException {
2203        if (name.equals("sequence")) {
2204          this.sequence = castToPositiveInt(value); // PositiveIntType
2205        } else if (name.equals("diagnosis[x]")) {
2206          this.diagnosis = castToType(value); // Type
2207        } else if (name.equals("type")) {
2208          this.getType().add(castToCodeableConcept(value));
2209        } else if (name.equals("onAdmission")) {
2210          this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2211        } else if (name.equals("packageCode")) {
2212          this.packageCode = castToCodeableConcept(value); // CodeableConcept
2213        } else
2214          return super.setProperty(name, value);
2215        return value;
2216      }
2217
2218      @Override
2219      public Base makeProperty(int hash, String name) throws FHIRException {
2220        switch (hash) {
2221        case 1349547969:  return getSequenceElement();
2222        case -1487009809:  return getDiagnosis(); 
2223        case 1196993265:  return getDiagnosis(); 
2224        case 3575610:  return addType(); 
2225        case -3386134:  return getOnAdmission(); 
2226        case 908444499:  return getPackageCode(); 
2227        default: return super.makeProperty(hash, name);
2228        }
2229
2230      }
2231
2232      @Override
2233      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2234        switch (hash) {
2235        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2236        case 1196993265: /*diagnosis*/ return new String[] {"CodeableConcept", "Reference"};
2237        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2238        case -3386134: /*onAdmission*/ return new String[] {"CodeableConcept"};
2239        case 908444499: /*packageCode*/ return new String[] {"CodeableConcept"};
2240        default: return super.getTypesForProperty(hash, name);
2241        }
2242
2243      }
2244
2245      @Override
2246      public Base addChild(String name) throws FHIRException {
2247        if (name.equals("sequence")) {
2248          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
2249        }
2250        else if (name.equals("diagnosisCodeableConcept")) {
2251          this.diagnosis = new CodeableConcept();
2252          return this.diagnosis;
2253        }
2254        else if (name.equals("diagnosisReference")) {
2255          this.diagnosis = new Reference();
2256          return this.diagnosis;
2257        }
2258        else if (name.equals("type")) {
2259          return addType();
2260        }
2261        else if (name.equals("onAdmission")) {
2262          this.onAdmission = new CodeableConcept();
2263          return this.onAdmission;
2264        }
2265        else if (name.equals("packageCode")) {
2266          this.packageCode = new CodeableConcept();
2267          return this.packageCode;
2268        }
2269        else
2270          return super.addChild(name);
2271      }
2272
2273      public DiagnosisComponent copy() {
2274        DiagnosisComponent dst = new DiagnosisComponent();
2275        copyValues(dst);
2276        return dst;
2277      }
2278
2279      public void copyValues(DiagnosisComponent dst) {
2280        super.copyValues(dst);
2281        dst.sequence = sequence == null ? null : sequence.copy();
2282        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
2283        if (type != null) {
2284          dst.type = new ArrayList<CodeableConcept>();
2285          for (CodeableConcept i : type)
2286            dst.type.add(i.copy());
2287        };
2288        dst.onAdmission = onAdmission == null ? null : onAdmission.copy();
2289        dst.packageCode = packageCode == null ? null : packageCode.copy();
2290      }
2291
2292      @Override
2293      public boolean equalsDeep(Base other_) {
2294        if (!super.equalsDeep(other_))
2295          return false;
2296        if (!(other_ instanceof DiagnosisComponent))
2297          return false;
2298        DiagnosisComponent o = (DiagnosisComponent) other_;
2299        return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(type, o.type, true)
2300           && compareDeep(onAdmission, o.onAdmission, true) && compareDeep(packageCode, o.packageCode, true)
2301          ;
2302      }
2303
2304      @Override
2305      public boolean equalsShallow(Base other_) {
2306        if (!super.equalsShallow(other_))
2307          return false;
2308        if (!(other_ instanceof DiagnosisComponent))
2309          return false;
2310        DiagnosisComponent o = (DiagnosisComponent) other_;
2311        return compareValues(sequence, o.sequence, true);
2312      }
2313
2314      public boolean isEmpty() {
2315        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type
2316          , onAdmission, packageCode);
2317      }
2318
2319  public String fhirType() {
2320    return "ExplanationOfBenefit.diagnosis";
2321
2322  }
2323
2324  }
2325
2326    @Block()
2327    public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
2328        /**
2329         * A number to uniquely identify procedure entries.
2330         */
2331        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2332        @Description(shortDefinition="Procedure instance identifier", formalDefinition="A number to uniquely identify procedure entries." )
2333        protected PositiveIntType sequence;
2334
2335        /**
2336         * When the condition was observed or the relative ranking.
2337         */
2338        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2339        @Description(shortDefinition="Category of Procedure", formalDefinition="When the condition was observed or the relative ranking." )
2340        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-procedure-type")
2341        protected List<CodeableConcept> type;
2342
2343        /**
2344         * Date and optionally time the procedure was performed.
2345         */
2346        @Child(name = "date", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2347        @Description(shortDefinition="When the procedure was performed", formalDefinition="Date and optionally time the procedure was performed." )
2348        protected DateTimeType date;
2349
2350        /**
2351         * The code or reference to a Procedure resource which identifies the clinical intervention performed.
2352         */
2353        @Child(name = "procedure", type = {CodeableConcept.class, Procedure.class}, order=4, min=1, max=1, modifier=false, summary=false)
2354        @Description(shortDefinition="Specific clinical procedure", formalDefinition="The code or reference to a Procedure resource which identifies the clinical intervention performed." )
2355        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10-procedures")
2356        protected Type procedure;
2357
2358        /**
2359         * Unique Device Identifiers associated with this line item.
2360         */
2361        @Child(name = "udi", type = {Device.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2362        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
2363        protected List<Reference> udi;
2364        /**
2365         * The actual objects that are the target of the reference (Unique Device Identifiers associated with this line item.)
2366         */
2367        protected List<Device> udiTarget;
2368
2369
2370        private static final long serialVersionUID = 935341852L;
2371
2372    /**
2373     * Constructor
2374     */
2375      public ProcedureComponent() {
2376        super();
2377      }
2378
2379    /**
2380     * Constructor
2381     */
2382      public ProcedureComponent(PositiveIntType sequence, Type procedure) {
2383        super();
2384        this.sequence = sequence;
2385        this.procedure = procedure;
2386      }
2387
2388        /**
2389         * @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
2390         */
2391        public PositiveIntType getSequenceElement() { 
2392          if (this.sequence == null)
2393            if (Configuration.errorOnAutoCreate())
2394              throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2395            else if (Configuration.doAutoCreate())
2396              this.sequence = new PositiveIntType(); // bb
2397          return this.sequence;
2398        }
2399
2400        public boolean hasSequenceElement() { 
2401          return this.sequence != null && !this.sequence.isEmpty();
2402        }
2403
2404        public boolean hasSequence() { 
2405          return this.sequence != null && !this.sequence.isEmpty();
2406        }
2407
2408        /**
2409         * @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
2410         */
2411        public ProcedureComponent setSequenceElement(PositiveIntType value) { 
2412          this.sequence = value;
2413          return this;
2414        }
2415
2416        /**
2417         * @return A number to uniquely identify procedure entries.
2418         */
2419        public int getSequence() { 
2420          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2421        }
2422
2423        /**
2424         * @param value A number to uniquely identify procedure entries.
2425         */
2426        public ProcedureComponent setSequence(int value) { 
2427            if (this.sequence == null)
2428              this.sequence = new PositiveIntType();
2429            this.sequence.setValue(value);
2430          return this;
2431        }
2432
2433        /**
2434         * @return {@link #type} (When the condition was observed or the relative ranking.)
2435         */
2436        public List<CodeableConcept> getType() { 
2437          if (this.type == null)
2438            this.type = new ArrayList<CodeableConcept>();
2439          return this.type;
2440        }
2441
2442        /**
2443         * @return Returns a reference to <code>this</code> for easy method chaining
2444         */
2445        public ProcedureComponent setType(List<CodeableConcept> theType) { 
2446          this.type = theType;
2447          return this;
2448        }
2449
2450        public boolean hasType() { 
2451          if (this.type == null)
2452            return false;
2453          for (CodeableConcept item : this.type)
2454            if (!item.isEmpty())
2455              return true;
2456          return false;
2457        }
2458
2459        public CodeableConcept addType() { //3
2460          CodeableConcept t = new CodeableConcept();
2461          if (this.type == null)
2462            this.type = new ArrayList<CodeableConcept>();
2463          this.type.add(t);
2464          return t;
2465        }
2466
2467        public ProcedureComponent addType(CodeableConcept t) { //3
2468          if (t == null)
2469            return this;
2470          if (this.type == null)
2471            this.type = new ArrayList<CodeableConcept>();
2472          this.type.add(t);
2473          return this;
2474        }
2475
2476        /**
2477         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
2478         */
2479        public CodeableConcept getTypeFirstRep() { 
2480          if (getType().isEmpty()) {
2481            addType();
2482          }
2483          return getType().get(0);
2484        }
2485
2486        /**
2487         * @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
2488         */
2489        public DateTimeType getDateElement() { 
2490          if (this.date == null)
2491            if (Configuration.errorOnAutoCreate())
2492              throw new Error("Attempt to auto-create ProcedureComponent.date");
2493            else if (Configuration.doAutoCreate())
2494              this.date = new DateTimeType(); // bb
2495          return this.date;
2496        }
2497
2498        public boolean hasDateElement() { 
2499          return this.date != null && !this.date.isEmpty();
2500        }
2501
2502        public boolean hasDate() { 
2503          return this.date != null && !this.date.isEmpty();
2504        }
2505
2506        /**
2507         * @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
2508         */
2509        public ProcedureComponent setDateElement(DateTimeType value) { 
2510          this.date = value;
2511          return this;
2512        }
2513
2514        /**
2515         * @return Date and optionally time the procedure was performed.
2516         */
2517        public Date getDate() { 
2518          return this.date == null ? null : this.date.getValue();
2519        }
2520
2521        /**
2522         * @param value Date and optionally time the procedure was performed.
2523         */
2524        public ProcedureComponent setDate(Date value) { 
2525          if (value == null)
2526            this.date = null;
2527          else {
2528            if (this.date == null)
2529              this.date = new DateTimeType();
2530            this.date.setValue(value);
2531          }
2532          return this;
2533        }
2534
2535        /**
2536         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2537         */
2538        public Type getProcedure() { 
2539          return this.procedure;
2540        }
2541
2542        /**
2543         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2544         */
2545        public CodeableConcept getProcedureCodeableConcept() throws FHIRException { 
2546          if (this.procedure == null)
2547            this.procedure = new CodeableConcept();
2548          if (!(this.procedure instanceof CodeableConcept))
2549            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.procedure.getClass().getName()+" was encountered");
2550          return (CodeableConcept) this.procedure;
2551        }
2552
2553        public boolean hasProcedureCodeableConcept() { 
2554          return this != null && this.procedure instanceof CodeableConcept;
2555        }
2556
2557        /**
2558         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2559         */
2560        public Reference getProcedureReference() throws FHIRException { 
2561          if (this.procedure == null)
2562            this.procedure = new Reference();
2563          if (!(this.procedure instanceof Reference))
2564            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.procedure.getClass().getName()+" was encountered");
2565          return (Reference) this.procedure;
2566        }
2567
2568        public boolean hasProcedureReference() { 
2569          return this != null && this.procedure instanceof Reference;
2570        }
2571
2572        public boolean hasProcedure() { 
2573          return this.procedure != null && !this.procedure.isEmpty();
2574        }
2575
2576        /**
2577         * @param value {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2578         */
2579        public ProcedureComponent setProcedure(Type value) { 
2580          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2581            throw new Error("Not the right type for ExplanationOfBenefit.procedure.procedure[x]: "+value.fhirType());
2582          this.procedure = value;
2583          return this;
2584        }
2585
2586        /**
2587         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
2588         */
2589        public List<Reference> getUdi() { 
2590          if (this.udi == null)
2591            this.udi = new ArrayList<Reference>();
2592          return this.udi;
2593        }
2594
2595        /**
2596         * @return Returns a reference to <code>this</code> for easy method chaining
2597         */
2598        public ProcedureComponent setUdi(List<Reference> theUdi) { 
2599          this.udi = theUdi;
2600          return this;
2601        }
2602
2603        public boolean hasUdi() { 
2604          if (this.udi == null)
2605            return false;
2606          for (Reference item : this.udi)
2607            if (!item.isEmpty())
2608              return true;
2609          return false;
2610        }
2611
2612        public Reference addUdi() { //3
2613          Reference t = new Reference();
2614          if (this.udi == null)
2615            this.udi = new ArrayList<Reference>();
2616          this.udi.add(t);
2617          return t;
2618        }
2619
2620        public ProcedureComponent addUdi(Reference t) { //3
2621          if (t == null)
2622            return this;
2623          if (this.udi == null)
2624            this.udi = new ArrayList<Reference>();
2625          this.udi.add(t);
2626          return this;
2627        }
2628
2629        /**
2630         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
2631         */
2632        public Reference getUdiFirstRep() { 
2633          if (getUdi().isEmpty()) {
2634            addUdi();
2635          }
2636          return getUdi().get(0);
2637        }
2638
2639        /**
2640         * @deprecated Use Reference#setResource(IBaseResource) instead
2641         */
2642        @Deprecated
2643        public List<Device> getUdiTarget() { 
2644          if (this.udiTarget == null)
2645            this.udiTarget = new ArrayList<Device>();
2646          return this.udiTarget;
2647        }
2648
2649        /**
2650         * @deprecated Use Reference#setResource(IBaseResource) instead
2651         */
2652        @Deprecated
2653        public Device addUdiTarget() { 
2654          Device r = new Device();
2655          if (this.udiTarget == null)
2656            this.udiTarget = new ArrayList<Device>();
2657          this.udiTarget.add(r);
2658          return r;
2659        }
2660
2661        protected void listChildren(List<Property> children) {
2662          super.listChildren(children);
2663          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence));
2664          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
2665          children.add(new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date));
2666          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));
2667          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
2668        }
2669
2670        @Override
2671        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2672          switch (_hash) {
2673          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence);
2674          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2675          case 3076014: /*date*/  return new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date);
2676          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);
2677          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);
2678          case -1284783026: /*procedureCodeableConcept*/  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);
2679          case 881809848: /*procedureReference*/  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);
2680          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
2681          default: return super.getNamedProperty(_hash, _name, _checkValid);
2682          }
2683
2684        }
2685
2686      @Override
2687      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2688        switch (hash) {
2689        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2690        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2691        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2692        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // Type
2693        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
2694        default: return super.getProperty(hash, name, checkValid);
2695        }
2696
2697      }
2698
2699      @Override
2700      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2701        switch (hash) {
2702        case 1349547969: // sequence
2703          this.sequence = castToPositiveInt(value); // PositiveIntType
2704          return value;
2705        case 3575610: // type
2706          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
2707          return value;
2708        case 3076014: // date
2709          this.date = castToDateTime(value); // DateTimeType
2710          return value;
2711        case -1095204141: // procedure
2712          this.procedure = castToType(value); // Type
2713          return value;
2714        case 115642: // udi
2715          this.getUdi().add(castToReference(value)); // Reference
2716          return value;
2717        default: return super.setProperty(hash, name, value);
2718        }
2719
2720      }
2721
2722      @Override
2723      public Base setProperty(String name, Base value) throws FHIRException {
2724        if (name.equals("sequence")) {
2725          this.sequence = castToPositiveInt(value); // PositiveIntType
2726        } else if (name.equals("type")) {
2727          this.getType().add(castToCodeableConcept(value));
2728        } else if (name.equals("date")) {
2729          this.date = castToDateTime(value); // DateTimeType
2730        } else if (name.equals("procedure[x]")) {
2731          this.procedure = castToType(value); // Type
2732        } else if (name.equals("udi")) {
2733          this.getUdi().add(castToReference(value));
2734        } else
2735          return super.setProperty(name, value);
2736        return value;
2737      }
2738
2739      @Override
2740      public Base makeProperty(int hash, String name) throws FHIRException {
2741        switch (hash) {
2742        case 1349547969:  return getSequenceElement();
2743        case 3575610:  return addType(); 
2744        case 3076014:  return getDateElement();
2745        case 1640074445:  return getProcedure(); 
2746        case -1095204141:  return getProcedure(); 
2747        case 115642:  return addUdi(); 
2748        default: return super.makeProperty(hash, name);
2749        }
2750
2751      }
2752
2753      @Override
2754      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2755        switch (hash) {
2756        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2757        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2758        case 3076014: /*date*/ return new String[] {"dateTime"};
2759        case -1095204141: /*procedure*/ return new String[] {"CodeableConcept", "Reference"};
2760        case 115642: /*udi*/ return new String[] {"Reference"};
2761        default: return super.getTypesForProperty(hash, name);
2762        }
2763
2764      }
2765
2766      @Override
2767      public Base addChild(String name) throws FHIRException {
2768        if (name.equals("sequence")) {
2769          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
2770        }
2771        else if (name.equals("type")) {
2772          return addType();
2773        }
2774        else if (name.equals("date")) {
2775          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
2776        }
2777        else if (name.equals("procedureCodeableConcept")) {
2778          this.procedure = new CodeableConcept();
2779          return this.procedure;
2780        }
2781        else if (name.equals("procedureReference")) {
2782          this.procedure = new Reference();
2783          return this.procedure;
2784        }
2785        else if (name.equals("udi")) {
2786          return addUdi();
2787        }
2788        else
2789          return super.addChild(name);
2790      }
2791
2792      public ProcedureComponent copy() {
2793        ProcedureComponent dst = new ProcedureComponent();
2794        copyValues(dst);
2795        return dst;
2796      }
2797
2798      public void copyValues(ProcedureComponent dst) {
2799        super.copyValues(dst);
2800        dst.sequence = sequence == null ? null : sequence.copy();
2801        if (type != null) {
2802          dst.type = new ArrayList<CodeableConcept>();
2803          for (CodeableConcept i : type)
2804            dst.type.add(i.copy());
2805        };
2806        dst.date = date == null ? null : date.copy();
2807        dst.procedure = procedure == null ? null : procedure.copy();
2808        if (udi != null) {
2809          dst.udi = new ArrayList<Reference>();
2810          for (Reference i : udi)
2811            dst.udi.add(i.copy());
2812        };
2813      }
2814
2815      @Override
2816      public boolean equalsDeep(Base other_) {
2817        if (!super.equalsDeep(other_))
2818          return false;
2819        if (!(other_ instanceof ProcedureComponent))
2820          return false;
2821        ProcedureComponent o = (ProcedureComponent) other_;
2822        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(date, o.date, true)
2823           && compareDeep(procedure, o.procedure, true) && compareDeep(udi, o.udi, true);
2824      }
2825
2826      @Override
2827      public boolean equalsShallow(Base other_) {
2828        if (!super.equalsShallow(other_))
2829          return false;
2830        if (!(other_ instanceof ProcedureComponent))
2831          return false;
2832        ProcedureComponent o = (ProcedureComponent) other_;
2833        return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
2834      }
2835
2836      public boolean isEmpty() {
2837        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, date, procedure
2838          , udi);
2839      }
2840
2841  public String fhirType() {
2842    return "ExplanationOfBenefit.procedure";
2843
2844  }
2845
2846  }
2847
2848    @Block()
2849    public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
2850        /**
2851         * A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2852         */
2853        @Child(name = "focal", type = {BooleanType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2854        @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." )
2855        protected BooleanType focal;
2856
2857        /**
2858         * 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.
2859         */
2860        @Child(name = "coverage", type = {Coverage.class}, order=2, min=1, max=1, modifier=false, summary=true)
2861        @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." )
2862        protected Reference coverage;
2863
2864        /**
2865         * The actual object that is the target of the reference (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.)
2866         */
2867        protected Coverage coverageTarget;
2868
2869        /**
2870         * 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.
2871         */
2872        @Child(name = "preAuthRef", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2873        @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." )
2874        protected List<StringType> preAuthRef;
2875
2876        private static final long serialVersionUID = -606383626L;
2877
2878    /**
2879     * Constructor
2880     */
2881      public InsuranceComponent() {
2882        super();
2883      }
2884
2885    /**
2886     * Constructor
2887     */
2888      public InsuranceComponent(BooleanType focal, Reference coverage) {
2889        super();
2890        this.focal = focal;
2891        this.coverage = coverage;
2892      }
2893
2894        /**
2895         * @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
2896         */
2897        public BooleanType getFocalElement() { 
2898          if (this.focal == null)
2899            if (Configuration.errorOnAutoCreate())
2900              throw new Error("Attempt to auto-create InsuranceComponent.focal");
2901            else if (Configuration.doAutoCreate())
2902              this.focal = new BooleanType(); // bb
2903          return this.focal;
2904        }
2905
2906        public boolean hasFocalElement() { 
2907          return this.focal != null && !this.focal.isEmpty();
2908        }
2909
2910        public boolean hasFocal() { 
2911          return this.focal != null && !this.focal.isEmpty();
2912        }
2913
2914        /**
2915         * @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
2916         */
2917        public InsuranceComponent setFocalElement(BooleanType value) { 
2918          this.focal = value;
2919          return this;
2920        }
2921
2922        /**
2923         * @return A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2924         */
2925        public boolean getFocal() { 
2926          return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
2927        }
2928
2929        /**
2930         * @param value A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2931         */
2932        public InsuranceComponent setFocal(boolean value) { 
2933            if (this.focal == null)
2934              this.focal = new BooleanType();
2935            this.focal.setValue(value);
2936          return this;
2937        }
2938
2939        /**
2940         * @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.)
2941         */
2942        public Reference getCoverage() { 
2943          if (this.coverage == null)
2944            if (Configuration.errorOnAutoCreate())
2945              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2946            else if (Configuration.doAutoCreate())
2947              this.coverage = new Reference(); // cc
2948          return this.coverage;
2949        }
2950
2951        public boolean hasCoverage() { 
2952          return this.coverage != null && !this.coverage.isEmpty();
2953        }
2954
2955        /**
2956         * @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.)
2957         */
2958        public InsuranceComponent setCoverage(Reference value) { 
2959          this.coverage = value;
2960          return this;
2961        }
2962
2963        /**
2964         * @return {@link #coverage} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (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.)
2965         */
2966        public Coverage getCoverageTarget() { 
2967          if (this.coverageTarget == null)
2968            if (Configuration.errorOnAutoCreate())
2969              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2970            else if (Configuration.doAutoCreate())
2971              this.coverageTarget = new Coverage(); // aa
2972          return this.coverageTarget;
2973        }
2974
2975        /**
2976         * @param value {@link #coverage} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (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.)
2977         */
2978        public InsuranceComponent setCoverageTarget(Coverage value) { 
2979          this.coverageTarget = value;
2980          return this;
2981        }
2982
2983        /**
2984         * @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.)
2985         */
2986        public List<StringType> getPreAuthRef() { 
2987          if (this.preAuthRef == null)
2988            this.preAuthRef = new ArrayList<StringType>();
2989          return this.preAuthRef;
2990        }
2991
2992        /**
2993         * @return Returns a reference to <code>this</code> for easy method chaining
2994         */
2995        public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) { 
2996          this.preAuthRef = thePreAuthRef;
2997          return this;
2998        }
2999
3000        public boolean hasPreAuthRef() { 
3001          if (this.preAuthRef == null)
3002            return false;
3003          for (StringType item : this.preAuthRef)
3004            if (!item.isEmpty())
3005              return true;
3006          return false;
3007        }
3008
3009        /**
3010         * @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.)
3011         */
3012        public StringType addPreAuthRefElement() {//2 
3013          StringType t = new StringType();
3014          if (this.preAuthRef == null)
3015            this.preAuthRef = new ArrayList<StringType>();
3016          this.preAuthRef.add(t);
3017          return t;
3018        }
3019
3020        /**
3021         * @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.)
3022         */
3023        public InsuranceComponent addPreAuthRef(String value) { //1
3024          StringType t = new StringType();
3025          t.setValue(value);
3026          if (this.preAuthRef == null)
3027            this.preAuthRef = new ArrayList<StringType>();
3028          this.preAuthRef.add(t);
3029          return this;
3030        }
3031
3032        /**
3033         * @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.)
3034         */
3035        public boolean hasPreAuthRef(String value) { 
3036          if (this.preAuthRef == null)
3037            return false;
3038          for (StringType v : this.preAuthRef)
3039            if (v.getValue().equals(value)) // string
3040              return true;
3041          return false;
3042        }
3043
3044        protected void listChildren(List<Property> children) {
3045          super.listChildren(children);
3046          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));
3047          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));
3048          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));
3049        }
3050
3051        @Override
3052        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3053          switch (_hash) {
3054          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);
3055          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);
3056          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);
3057          default: return super.getNamedProperty(_hash, _name, _checkValid);
3058          }
3059
3060        }
3061
3062      @Override
3063      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3064        switch (hash) {
3065        case 97604197: /*focal*/ return this.focal == null ? new Base[0] : new Base[] {this.focal}; // BooleanType
3066        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
3067        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
3068        default: return super.getProperty(hash, name, checkValid);
3069        }
3070
3071      }
3072
3073      @Override
3074      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3075        switch (hash) {
3076        case 97604197: // focal
3077          this.focal = castToBoolean(value); // BooleanType
3078          return value;
3079        case -351767064: // coverage
3080          this.coverage = castToReference(value); // Reference
3081          return value;
3082        case 522246568: // preAuthRef
3083          this.getPreAuthRef().add(castToString(value)); // StringType
3084          return value;
3085        default: return super.setProperty(hash, name, value);
3086        }
3087
3088      }
3089
3090      @Override
3091      public Base setProperty(String name, Base value) throws FHIRException {
3092        if (name.equals("focal")) {
3093          this.focal = castToBoolean(value); // BooleanType
3094        } else if (name.equals("coverage")) {
3095          this.coverage = castToReference(value); // Reference
3096        } else if (name.equals("preAuthRef")) {
3097          this.getPreAuthRef().add(castToString(value));
3098        } else
3099          return super.setProperty(name, value);
3100        return value;
3101      }
3102
3103      @Override
3104      public Base makeProperty(int hash, String name) throws FHIRException {
3105        switch (hash) {
3106        case 97604197:  return getFocalElement();
3107        case -351767064:  return getCoverage(); 
3108        case 522246568:  return addPreAuthRefElement();
3109        default: return super.makeProperty(hash, name);
3110        }
3111
3112      }
3113
3114      @Override
3115      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3116        switch (hash) {
3117        case 97604197: /*focal*/ return new String[] {"boolean"};
3118        case -351767064: /*coverage*/ return new String[] {"Reference"};
3119        case 522246568: /*preAuthRef*/ return new String[] {"string"};
3120        default: return super.getTypesForProperty(hash, name);
3121        }
3122
3123      }
3124
3125      @Override
3126      public Base addChild(String name) throws FHIRException {
3127        if (name.equals("focal")) {
3128          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.focal");
3129        }
3130        else if (name.equals("coverage")) {
3131          this.coverage = new Reference();
3132          return this.coverage;
3133        }
3134        else if (name.equals("preAuthRef")) {
3135          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
3136        }
3137        else
3138          return super.addChild(name);
3139      }
3140
3141      public InsuranceComponent copy() {
3142        InsuranceComponent dst = new InsuranceComponent();
3143        copyValues(dst);
3144        return dst;
3145      }
3146
3147      public void copyValues(InsuranceComponent dst) {
3148        super.copyValues(dst);
3149        dst.focal = focal == null ? null : focal.copy();
3150        dst.coverage = coverage == null ? null : coverage.copy();
3151        if (preAuthRef != null) {
3152          dst.preAuthRef = new ArrayList<StringType>();
3153          for (StringType i : preAuthRef)
3154            dst.preAuthRef.add(i.copy());
3155        };
3156      }
3157
3158      @Override
3159      public boolean equalsDeep(Base other_) {
3160        if (!super.equalsDeep(other_))
3161          return false;
3162        if (!(other_ instanceof InsuranceComponent))
3163          return false;
3164        InsuranceComponent o = (InsuranceComponent) other_;
3165        return compareDeep(focal, o.focal, true) && compareDeep(coverage, o.coverage, true) && compareDeep(preAuthRef, o.preAuthRef, true)
3166          ;
3167      }
3168
3169      @Override
3170      public boolean equalsShallow(Base other_) {
3171        if (!super.equalsShallow(other_))
3172          return false;
3173        if (!(other_ instanceof InsuranceComponent))
3174          return false;
3175        InsuranceComponent o = (InsuranceComponent) other_;
3176        return compareValues(focal, o.focal, true) && compareValues(preAuthRef, o.preAuthRef, true);
3177      }
3178
3179      public boolean isEmpty() {
3180        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(focal, coverage, preAuthRef
3181          );
3182      }
3183
3184  public String fhirType() {
3185    return "ExplanationOfBenefit.insurance";
3186
3187  }
3188
3189  }
3190
3191    @Block()
3192    public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
3193        /**
3194         * Date of an accident event  related to the products and services contained in the claim.
3195         */
3196        @Child(name = "date", type = {DateType.class}, order=1, min=0, max=1, modifier=false, summary=false)
3197        @Description(shortDefinition="When the incident occurred", formalDefinition="Date of an accident event  related to the products and services contained in the claim." )
3198        protected DateType date;
3199
3200        /**
3201         * The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.
3202         */
3203        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
3204        @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." )
3205        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActIncidentCode")
3206        protected CodeableConcept type;
3207
3208        /**
3209         * The physical location of the accident event.
3210         */
3211        @Child(name = "location", type = {Address.class, Location.class}, order=3, min=0, max=1, modifier=false, summary=false)
3212        @Description(shortDefinition="Where the event occurred", formalDefinition="The physical location of the accident event." )
3213        protected Type location;
3214
3215        private static final long serialVersionUID = 622904984L;
3216
3217    /**
3218     * Constructor
3219     */
3220      public AccidentComponent() {
3221        super();
3222      }
3223
3224        /**
3225         * @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
3226         */
3227        public DateType getDateElement() { 
3228          if (this.date == null)
3229            if (Configuration.errorOnAutoCreate())
3230              throw new Error("Attempt to auto-create AccidentComponent.date");
3231            else if (Configuration.doAutoCreate())
3232              this.date = new DateType(); // bb
3233          return this.date;
3234        }
3235
3236        public boolean hasDateElement() { 
3237          return this.date != null && !this.date.isEmpty();
3238        }
3239
3240        public boolean hasDate() { 
3241          return this.date != null && !this.date.isEmpty();
3242        }
3243
3244        /**
3245         * @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
3246         */
3247        public AccidentComponent setDateElement(DateType value) { 
3248          this.date = value;
3249          return this;
3250        }
3251
3252        /**
3253         * @return Date of an accident event  related to the products and services contained in the claim.
3254         */
3255        public Date getDate() { 
3256          return this.date == null ? null : this.date.getValue();
3257        }
3258
3259        /**
3260         * @param value Date of an accident event  related to the products and services contained in the claim.
3261         */
3262        public AccidentComponent setDate(Date value) { 
3263          if (value == null)
3264            this.date = null;
3265          else {
3266            if (this.date == null)
3267              this.date = new DateType();
3268            this.date.setValue(value);
3269          }
3270          return this;
3271        }
3272
3273        /**
3274         * @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.)
3275         */
3276        public CodeableConcept getType() { 
3277          if (this.type == null)
3278            if (Configuration.errorOnAutoCreate())
3279              throw new Error("Attempt to auto-create AccidentComponent.type");
3280            else if (Configuration.doAutoCreate())
3281              this.type = new CodeableConcept(); // cc
3282          return this.type;
3283        }
3284
3285        public boolean hasType() { 
3286          return this.type != null && !this.type.isEmpty();
3287        }
3288
3289        /**
3290         * @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.)
3291         */
3292        public AccidentComponent setType(CodeableConcept value) { 
3293          this.type = value;
3294          return this;
3295        }
3296
3297        /**
3298         * @return {@link #location} (The physical location of the accident event.)
3299         */
3300        public Type getLocation() { 
3301          return this.location;
3302        }
3303
3304        /**
3305         * @return {@link #location} (The physical location of the accident event.)
3306         */
3307        public Address getLocationAddress() throws FHIRException { 
3308          if (this.location == null)
3309            this.location = new Address();
3310          if (!(this.location instanceof Address))
3311            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
3312          return (Address) this.location;
3313        }
3314
3315        public boolean hasLocationAddress() { 
3316          return this != null && this.location instanceof Address;
3317        }
3318
3319        /**
3320         * @return {@link #location} (The physical location of the accident event.)
3321         */
3322        public Reference getLocationReference() throws FHIRException { 
3323          if (this.location == null)
3324            this.location = new Reference();
3325          if (!(this.location instanceof Reference))
3326            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
3327          return (Reference) this.location;
3328        }
3329
3330        public boolean hasLocationReference() { 
3331          return this != null && this.location instanceof Reference;
3332        }
3333
3334        public boolean hasLocation() { 
3335          return this.location != null && !this.location.isEmpty();
3336        }
3337
3338        /**
3339         * @param value {@link #location} (The physical location of the accident event.)
3340         */
3341        public AccidentComponent setLocation(Type value) { 
3342          if (value != null && !(value instanceof Address || value instanceof Reference))
3343            throw new Error("Not the right type for ExplanationOfBenefit.accident.location[x]: "+value.fhirType());
3344          this.location = value;
3345          return this;
3346        }
3347
3348        protected void listChildren(List<Property> children) {
3349          super.listChildren(children);
3350          children.add(new Property("date", "date", "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date));
3351          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));
3352          children.add(new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location));
3353        }
3354
3355        @Override
3356        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3357          switch (_hash) {
3358          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);
3359          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);
3360          case 552316075: /*location[x]*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3361          case 1901043637: /*location*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3362          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3363          case 755866390: /*locationReference*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3364          default: return super.getNamedProperty(_hash, _name, _checkValid);
3365          }
3366
3367        }
3368
3369      @Override
3370      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3371        switch (hash) {
3372        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
3373        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3374        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
3375        default: return super.getProperty(hash, name, checkValid);
3376        }
3377
3378      }
3379
3380      @Override
3381      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3382        switch (hash) {
3383        case 3076014: // date
3384          this.date = castToDate(value); // DateType
3385          return value;
3386        case 3575610: // type
3387          this.type = castToCodeableConcept(value); // CodeableConcept
3388          return value;
3389        case 1901043637: // location
3390          this.location = castToType(value); // Type
3391          return value;
3392        default: return super.setProperty(hash, name, value);
3393        }
3394
3395      }
3396
3397      @Override
3398      public Base setProperty(String name, Base value) throws FHIRException {
3399        if (name.equals("date")) {
3400          this.date = castToDate(value); // DateType
3401        } else if (name.equals("type")) {
3402          this.type = castToCodeableConcept(value); // CodeableConcept
3403        } else if (name.equals("location[x]")) {
3404          this.location = castToType(value); // Type
3405        } else
3406          return super.setProperty(name, value);
3407        return value;
3408      }
3409
3410      @Override
3411      public Base makeProperty(int hash, String name) throws FHIRException {
3412        switch (hash) {
3413        case 3076014:  return getDateElement();
3414        case 3575610:  return getType(); 
3415        case 552316075:  return getLocation(); 
3416        case 1901043637:  return getLocation(); 
3417        default: return super.makeProperty(hash, name);
3418        }
3419
3420      }
3421
3422      @Override
3423      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3424        switch (hash) {
3425        case 3076014: /*date*/ return new String[] {"date"};
3426        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3427        case 1901043637: /*location*/ return new String[] {"Address", "Reference"};
3428        default: return super.getTypesForProperty(hash, name);
3429        }
3430
3431      }
3432
3433      @Override
3434      public Base addChild(String name) throws FHIRException {
3435        if (name.equals("date")) {
3436          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
3437        }
3438        else if (name.equals("type")) {
3439          this.type = new CodeableConcept();
3440          return this.type;
3441        }
3442        else if (name.equals("locationAddress")) {
3443          this.location = new Address();
3444          return this.location;
3445        }
3446        else if (name.equals("locationReference")) {
3447          this.location = new Reference();
3448          return this.location;
3449        }
3450        else
3451          return super.addChild(name);
3452      }
3453
3454      public AccidentComponent copy() {
3455        AccidentComponent dst = new AccidentComponent();
3456        copyValues(dst);
3457        return dst;
3458      }
3459
3460      public void copyValues(AccidentComponent dst) {
3461        super.copyValues(dst);
3462        dst.date = date == null ? null : date.copy();
3463        dst.type = type == null ? null : type.copy();
3464        dst.location = location == null ? null : location.copy();
3465      }
3466
3467      @Override
3468      public boolean equalsDeep(Base other_) {
3469        if (!super.equalsDeep(other_))
3470          return false;
3471        if (!(other_ instanceof AccidentComponent))
3472          return false;
3473        AccidentComponent o = (AccidentComponent) other_;
3474        return compareDeep(date, o.date, true) && compareDeep(type, o.type, true) && compareDeep(location, o.location, true)
3475          ;
3476      }
3477
3478      @Override
3479      public boolean equalsShallow(Base other_) {
3480        if (!super.equalsShallow(other_))
3481          return false;
3482        if (!(other_ instanceof AccidentComponent))
3483          return false;
3484        AccidentComponent o = (AccidentComponent) other_;
3485        return compareValues(date, o.date, true);
3486      }
3487
3488      public boolean isEmpty() {
3489        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
3490      }
3491
3492  public String fhirType() {
3493    return "ExplanationOfBenefit.accident";
3494
3495  }
3496
3497  }
3498
3499    @Block()
3500    public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
3501        /**
3502         * A number to uniquely identify item entries.
3503         */
3504        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
3505        @Description(shortDefinition="Item instance identifier", formalDefinition="A number to uniquely identify item entries." )
3506        protected PositiveIntType sequence;
3507
3508        /**
3509         * Care team members related to this service or product.
3510         */
3511        @Child(name = "careTeamSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3512        @Description(shortDefinition="Applicable care team members", formalDefinition="Care team members related to this service or product." )
3513        protected List<PositiveIntType> careTeamSequence;
3514
3515        /**
3516         * Diagnoses applicable for this service or product.
3517         */
3518        @Child(name = "diagnosisSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3519        @Description(shortDefinition="Applicable diagnoses", formalDefinition="Diagnoses applicable for this service or product." )
3520        protected List<PositiveIntType> diagnosisSequence;
3521
3522        /**
3523         * Procedures applicable for this service or product.
3524         */
3525        @Child(name = "procedureSequence", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3526        @Description(shortDefinition="Applicable procedures", formalDefinition="Procedures applicable for this service or product." )
3527        protected List<PositiveIntType> procedureSequence;
3528
3529        /**
3530         * Exceptions, special conditions and supporting information applicable for this service or product.
3531         */
3532        @Child(name = "informationSequence", type = {PositiveIntType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3533        @Description(shortDefinition="Applicable exception and supporting information", formalDefinition="Exceptions, special conditions and supporting information applicable for this service or product." )
3534        protected List<PositiveIntType> informationSequence;
3535
3536        /**
3537         * The type of revenue or cost center providing the product and/or service.
3538         */
3539        @Child(name = "revenue", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
3540        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
3541        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
3542        protected CodeableConcept revenue;
3543
3544        /**
3545         * Code to identify the general type of benefits under which products and services are provided.
3546         */
3547        @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
3548        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
3549        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
3550        protected CodeableConcept category;
3551
3552        /**
3553         * When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.
3554         */
3555        @Child(name = "productOrService", type = {CodeableConcept.class}, order=8, min=1, max=1, modifier=false, summary=false)
3556        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item." )
3557        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
3558        protected CodeableConcept productOrService;
3559
3560        /**
3561         * Item typification or modifiers codes to convey additional context for the product or service.
3562         */
3563        @Child(name = "modifier", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3564        @Description(shortDefinition="Product or service billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
3565        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
3566        protected List<CodeableConcept> modifier;
3567
3568        /**
3569         * Identifies the program under which this may be recovered.
3570         */
3571        @Child(name = "programCode", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3572        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
3573        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
3574        protected List<CodeableConcept> programCode;
3575
3576        /**
3577         * The date or dates when the service or product was supplied, performed or completed.
3578         */
3579        @Child(name = "serviced", type = {DateType.class, Period.class}, order=11, min=0, max=1, modifier=false, summary=false)
3580        @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." )
3581        protected Type serviced;
3582
3583        /**
3584         * Where the product or service was provided.
3585         */
3586        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
3587        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
3588        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
3589        protected Type location;
3590
3591        /**
3592         * The number of repetitions of a service or product.
3593         */
3594        @Child(name = "quantity", type = {Quantity.class}, order=13, min=0, max=1, modifier=false, summary=false)
3595        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
3596        protected Quantity quantity;
3597
3598        /**
3599         * 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.
3600         */
3601        @Child(name = "unitPrice", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
3602        @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." )
3603        protected Money unitPrice;
3604
3605        /**
3606         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3607         */
3608        @Child(name = "factor", type = {DecimalType.class}, order=15, min=0, max=1, modifier=false, summary=false)
3609        @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." )
3610        protected DecimalType factor;
3611
3612        /**
3613         * The quantity times the unit price for an additional service or product or charge.
3614         */
3615        @Child(name = "net", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=false)
3616        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
3617        protected Money net;
3618
3619        /**
3620         * Unique Device Identifiers associated with this line item.
3621         */
3622        @Child(name = "udi", type = {Device.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3623        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
3624        protected List<Reference> udi;
3625        /**
3626         * The actual objects that are the target of the reference (Unique Device Identifiers associated with this line item.)
3627         */
3628        protected List<Device> udiTarget;
3629
3630
3631        /**
3632         * Physical service site on the patient (limb, tooth, etc.).
3633         */
3634        @Child(name = "bodySite", type = {CodeableConcept.class}, order=18, min=0, max=1, modifier=false, summary=false)
3635        @Description(shortDefinition="Anatomical location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
3636        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
3637        protected CodeableConcept bodySite;
3638
3639        /**
3640         * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
3641         */
3642        @Child(name = "subSite", type = {CodeableConcept.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3643        @Description(shortDefinition="Anatomical sub-location", formalDefinition="A region or surface of the bodySite, e.g. limb region or tooth surface(s)." )
3644        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
3645        protected List<CodeableConcept> subSite;
3646
3647        /**
3648         * A billed item may include goods or services provided in multiple encounters.
3649         */
3650        @Child(name = "encounter", type = {Encounter.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3651        @Description(shortDefinition="Encounters related to this billed item", formalDefinition="A billed item may include goods or services provided in multiple encounters." )
3652        protected List<Reference> encounter;
3653        /**
3654         * The actual objects that are the target of the reference (A billed item may include goods or services provided in multiple encounters.)
3655         */
3656        protected List<Encounter> encounterTarget;
3657
3658
3659        /**
3660         * The numbers associated with notes below which apply to the adjudication of this item.
3661         */
3662        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3663        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
3664        protected List<PositiveIntType> noteNumber;
3665
3666        /**
3667         * 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.
3668         */
3669        @Child(name = "adjudication", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3670        @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." )
3671        protected List<AdjudicationComponent> adjudication;
3672
3673        /**
3674         * Second-tier of goods and services.
3675         */
3676        @Child(name = "detail", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3677        @Description(shortDefinition="Additional items", formalDefinition="Second-tier of goods and services." )
3678        protected List<DetailComponent> detail;
3679
3680        private static final long serialVersionUID = 67419471L;
3681
3682    /**
3683     * Constructor
3684     */
3685      public ItemComponent() {
3686        super();
3687      }
3688
3689    /**
3690     * Constructor
3691     */
3692      public ItemComponent(PositiveIntType sequence, CodeableConcept productOrService) {
3693        super();
3694        this.sequence = sequence;
3695        this.productOrService = productOrService;
3696      }
3697
3698        /**
3699         * @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
3700         */
3701        public PositiveIntType getSequenceElement() { 
3702          if (this.sequence == null)
3703            if (Configuration.errorOnAutoCreate())
3704              throw new Error("Attempt to auto-create ItemComponent.sequence");
3705            else if (Configuration.doAutoCreate())
3706              this.sequence = new PositiveIntType(); // bb
3707          return this.sequence;
3708        }
3709
3710        public boolean hasSequenceElement() { 
3711          return this.sequence != null && !this.sequence.isEmpty();
3712        }
3713
3714        public boolean hasSequence() { 
3715          return this.sequence != null && !this.sequence.isEmpty();
3716        }
3717
3718        /**
3719         * @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
3720         */
3721        public ItemComponent setSequenceElement(PositiveIntType value) { 
3722          this.sequence = value;
3723          return this;
3724        }
3725
3726        /**
3727         * @return A number to uniquely identify item entries.
3728         */
3729        public int getSequence() { 
3730          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3731        }
3732
3733        /**
3734         * @param value A number to uniquely identify item entries.
3735         */
3736        public ItemComponent setSequence(int value) { 
3737            if (this.sequence == null)
3738              this.sequence = new PositiveIntType();
3739            this.sequence.setValue(value);
3740          return this;
3741        }
3742
3743        /**
3744         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3745         */
3746        public List<PositiveIntType> getCareTeamSequence() { 
3747          if (this.careTeamSequence == null)
3748            this.careTeamSequence = new ArrayList<PositiveIntType>();
3749          return this.careTeamSequence;
3750        }
3751
3752        /**
3753         * @return Returns a reference to <code>this</code> for easy method chaining
3754         */
3755        public ItemComponent setCareTeamSequence(List<PositiveIntType> theCareTeamSequence) { 
3756          this.careTeamSequence = theCareTeamSequence;
3757          return this;
3758        }
3759
3760        public boolean hasCareTeamSequence() { 
3761          if (this.careTeamSequence == null)
3762            return false;
3763          for (PositiveIntType item : this.careTeamSequence)
3764            if (!item.isEmpty())
3765              return true;
3766          return false;
3767        }
3768
3769        /**
3770         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3771         */
3772        public PositiveIntType addCareTeamSequenceElement() {//2 
3773          PositiveIntType t = new PositiveIntType();
3774          if (this.careTeamSequence == null)
3775            this.careTeamSequence = new ArrayList<PositiveIntType>();
3776          this.careTeamSequence.add(t);
3777          return t;
3778        }
3779
3780        /**
3781         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3782         */
3783        public ItemComponent addCareTeamSequence(int value) { //1
3784          PositiveIntType t = new PositiveIntType();
3785          t.setValue(value);
3786          if (this.careTeamSequence == null)
3787            this.careTeamSequence = new ArrayList<PositiveIntType>();
3788          this.careTeamSequence.add(t);
3789          return this;
3790        }
3791
3792        /**
3793         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3794         */
3795        public boolean hasCareTeamSequence(int value) { 
3796          if (this.careTeamSequence == null)
3797            return false;
3798          for (PositiveIntType v : this.careTeamSequence)
3799            if (v.getValue().equals(value)) // positiveInt
3800              return true;
3801          return false;
3802        }
3803
3804        /**
3805         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3806         */
3807        public List<PositiveIntType> getDiagnosisSequence() { 
3808          if (this.diagnosisSequence == null)
3809            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3810          return this.diagnosisSequence;
3811        }
3812
3813        /**
3814         * @return Returns a reference to <code>this</code> for easy method chaining
3815         */
3816        public ItemComponent setDiagnosisSequence(List<PositiveIntType> theDiagnosisSequence) { 
3817          this.diagnosisSequence = theDiagnosisSequence;
3818          return this;
3819        }
3820
3821        public boolean hasDiagnosisSequence() { 
3822          if (this.diagnosisSequence == null)
3823            return false;
3824          for (PositiveIntType item : this.diagnosisSequence)
3825            if (!item.isEmpty())
3826              return true;
3827          return false;
3828        }
3829
3830        /**
3831         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3832         */
3833        public PositiveIntType addDiagnosisSequenceElement() {//2 
3834          PositiveIntType t = new PositiveIntType();
3835          if (this.diagnosisSequence == null)
3836            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3837          this.diagnosisSequence.add(t);
3838          return t;
3839        }
3840
3841        /**
3842         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3843         */
3844        public ItemComponent addDiagnosisSequence(int value) { //1
3845          PositiveIntType t = new PositiveIntType();
3846          t.setValue(value);
3847          if (this.diagnosisSequence == null)
3848            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3849          this.diagnosisSequence.add(t);
3850          return this;
3851        }
3852
3853        /**
3854         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3855         */
3856        public boolean hasDiagnosisSequence(int value) { 
3857          if (this.diagnosisSequence == null)
3858            return false;
3859          for (PositiveIntType v : this.diagnosisSequence)
3860            if (v.getValue().equals(value)) // positiveInt
3861              return true;
3862          return false;
3863        }
3864
3865        /**
3866         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3867         */
3868        public List<PositiveIntType> getProcedureSequence() { 
3869          if (this.procedureSequence == null)
3870            this.procedureSequence = new ArrayList<PositiveIntType>();
3871          return this.procedureSequence;
3872        }
3873
3874        /**
3875         * @return Returns a reference to <code>this</code> for easy method chaining
3876         */
3877        public ItemComponent setProcedureSequence(List<PositiveIntType> theProcedureSequence) { 
3878          this.procedureSequence = theProcedureSequence;
3879          return this;
3880        }
3881
3882        public boolean hasProcedureSequence() { 
3883          if (this.procedureSequence == null)
3884            return false;
3885          for (PositiveIntType item : this.procedureSequence)
3886            if (!item.isEmpty())
3887              return true;
3888          return false;
3889        }
3890
3891        /**
3892         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3893         */
3894        public PositiveIntType addProcedureSequenceElement() {//2 
3895          PositiveIntType t = new PositiveIntType();
3896          if (this.procedureSequence == null)
3897            this.procedureSequence = new ArrayList<PositiveIntType>();
3898          this.procedureSequence.add(t);
3899          return t;
3900        }
3901
3902        /**
3903         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3904         */
3905        public ItemComponent addProcedureSequence(int value) { //1
3906          PositiveIntType t = new PositiveIntType();
3907          t.setValue(value);
3908          if (this.procedureSequence == null)
3909            this.procedureSequence = new ArrayList<PositiveIntType>();
3910          this.procedureSequence.add(t);
3911          return this;
3912        }
3913
3914        /**
3915         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3916         */
3917        public boolean hasProcedureSequence(int value) { 
3918          if (this.procedureSequence == null)
3919            return false;
3920          for (PositiveIntType v : this.procedureSequence)
3921            if (v.getValue().equals(value)) // positiveInt
3922              return true;
3923          return false;
3924        }
3925
3926        /**
3927         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3928         */
3929        public List<PositiveIntType> getInformationSequence() { 
3930          if (this.informationSequence == null)
3931            this.informationSequence = new ArrayList<PositiveIntType>();
3932          return this.informationSequence;
3933        }
3934
3935        /**
3936         * @return Returns a reference to <code>this</code> for easy method chaining
3937         */
3938        public ItemComponent setInformationSequence(List<PositiveIntType> theInformationSequence) { 
3939          this.informationSequence = theInformationSequence;
3940          return this;
3941        }
3942
3943        public boolean hasInformationSequence() { 
3944          if (this.informationSequence == null)
3945            return false;
3946          for (PositiveIntType item : this.informationSequence)
3947            if (!item.isEmpty())
3948              return true;
3949          return false;
3950        }
3951
3952        /**
3953         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3954         */
3955        public PositiveIntType addInformationSequenceElement() {//2 
3956          PositiveIntType t = new PositiveIntType();
3957          if (this.informationSequence == null)
3958            this.informationSequence = new ArrayList<PositiveIntType>();
3959          this.informationSequence.add(t);
3960          return t;
3961        }
3962
3963        /**
3964         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3965         */
3966        public ItemComponent addInformationSequence(int value) { //1
3967          PositiveIntType t = new PositiveIntType();
3968          t.setValue(value);
3969          if (this.informationSequence == null)
3970            this.informationSequence = new ArrayList<PositiveIntType>();
3971          this.informationSequence.add(t);
3972          return this;
3973        }
3974
3975        /**
3976         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3977         */
3978        public boolean hasInformationSequence(int value) { 
3979          if (this.informationSequence == null)
3980            return false;
3981          for (PositiveIntType v : this.informationSequence)
3982            if (v.getValue().equals(value)) // positiveInt
3983              return true;
3984          return false;
3985        }
3986
3987        /**
3988         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3989         */
3990        public CodeableConcept getRevenue() { 
3991          if (this.revenue == null)
3992            if (Configuration.errorOnAutoCreate())
3993              throw new Error("Attempt to auto-create ItemComponent.revenue");
3994            else if (Configuration.doAutoCreate())
3995              this.revenue = new CodeableConcept(); // cc
3996          return this.revenue;
3997        }
3998
3999        public boolean hasRevenue() { 
4000          return this.revenue != null && !this.revenue.isEmpty();
4001        }
4002
4003        /**
4004         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
4005         */
4006        public ItemComponent setRevenue(CodeableConcept value) { 
4007          this.revenue = value;
4008          return this;
4009        }
4010
4011        /**
4012         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
4013         */
4014        public CodeableConcept getCategory() { 
4015          if (this.category == null)
4016            if (Configuration.errorOnAutoCreate())
4017              throw new Error("Attempt to auto-create ItemComponent.category");
4018            else if (Configuration.doAutoCreate())
4019              this.category = new CodeableConcept(); // cc
4020          return this.category;
4021        }
4022
4023        public boolean hasCategory() { 
4024          return this.category != null && !this.category.isEmpty();
4025        }
4026
4027        /**
4028         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
4029         */
4030        public ItemComponent setCategory(CodeableConcept value) { 
4031          this.category = value;
4032          return this;
4033        }
4034
4035        /**
4036         * @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.)
4037         */
4038        public CodeableConcept getProductOrService() { 
4039          if (this.productOrService == null)
4040            if (Configuration.errorOnAutoCreate())
4041              throw new Error("Attempt to auto-create ItemComponent.productOrService");
4042            else if (Configuration.doAutoCreate())
4043              this.productOrService = new CodeableConcept(); // cc
4044          return this.productOrService;
4045        }
4046
4047        public boolean hasProductOrService() { 
4048          return this.productOrService != null && !this.productOrService.isEmpty();
4049        }
4050
4051        /**
4052         * @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.)
4053         */
4054        public ItemComponent setProductOrService(CodeableConcept value) { 
4055          this.productOrService = value;
4056          return this;
4057        }
4058
4059        /**
4060         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
4061         */
4062        public List<CodeableConcept> getModifier() { 
4063          if (this.modifier == null)
4064            this.modifier = new ArrayList<CodeableConcept>();
4065          return this.modifier;
4066        }
4067
4068        /**
4069         * @return Returns a reference to <code>this</code> for easy method chaining
4070         */
4071        public ItemComponent setModifier(List<CodeableConcept> theModifier) { 
4072          this.modifier = theModifier;
4073          return this;
4074        }
4075
4076        public boolean hasModifier() { 
4077          if (this.modifier == null)
4078            return false;
4079          for (CodeableConcept item : this.modifier)
4080            if (!item.isEmpty())
4081              return true;
4082          return false;
4083        }
4084
4085        public CodeableConcept addModifier() { //3
4086          CodeableConcept t = new CodeableConcept();
4087          if (this.modifier == null)
4088            this.modifier = new ArrayList<CodeableConcept>();
4089          this.modifier.add(t);
4090          return t;
4091        }
4092
4093        public ItemComponent addModifier(CodeableConcept t) { //3
4094          if (t == null)
4095            return this;
4096          if (this.modifier == null)
4097            this.modifier = new ArrayList<CodeableConcept>();
4098          this.modifier.add(t);
4099          return this;
4100        }
4101
4102        /**
4103         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
4104         */
4105        public CodeableConcept getModifierFirstRep() { 
4106          if (getModifier().isEmpty()) {
4107            addModifier();
4108          }
4109          return getModifier().get(0);
4110        }
4111
4112        /**
4113         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
4114         */
4115        public List<CodeableConcept> getProgramCode() { 
4116          if (this.programCode == null)
4117            this.programCode = new ArrayList<CodeableConcept>();
4118          return this.programCode;
4119        }
4120
4121        /**
4122         * @return Returns a reference to <code>this</code> for easy method chaining
4123         */
4124        public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
4125          this.programCode = theProgramCode;
4126          return this;
4127        }
4128
4129        public boolean hasProgramCode() { 
4130          if (this.programCode == null)
4131            return false;
4132          for (CodeableConcept item : this.programCode)
4133            if (!item.isEmpty())
4134              return true;
4135          return false;
4136        }
4137
4138        public CodeableConcept addProgramCode() { //3
4139          CodeableConcept t = new CodeableConcept();
4140          if (this.programCode == null)
4141            this.programCode = new ArrayList<CodeableConcept>();
4142          this.programCode.add(t);
4143          return t;
4144        }
4145
4146        public ItemComponent addProgramCode(CodeableConcept t) { //3
4147          if (t == null)
4148            return this;
4149          if (this.programCode == null)
4150            this.programCode = new ArrayList<CodeableConcept>();
4151          this.programCode.add(t);
4152          return this;
4153        }
4154
4155        /**
4156         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
4157         */
4158        public CodeableConcept getProgramCodeFirstRep() { 
4159          if (getProgramCode().isEmpty()) {
4160            addProgramCode();
4161          }
4162          return getProgramCode().get(0);
4163        }
4164
4165        /**
4166         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4167         */
4168        public Type getServiced() { 
4169          return this.serviced;
4170        }
4171
4172        /**
4173         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4174         */
4175        public DateType getServicedDateType() throws FHIRException { 
4176          if (this.serviced == null)
4177            this.serviced = new DateType();
4178          if (!(this.serviced instanceof DateType))
4179            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
4180          return (DateType) this.serviced;
4181        }
4182
4183        public boolean hasServicedDateType() { 
4184          return this != null && this.serviced instanceof DateType;
4185        }
4186
4187        /**
4188         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4189         */
4190        public Period getServicedPeriod() throws FHIRException { 
4191          if (this.serviced == null)
4192            this.serviced = new Period();
4193          if (!(this.serviced instanceof Period))
4194            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
4195          return (Period) this.serviced;
4196        }
4197
4198        public boolean hasServicedPeriod() { 
4199          return this != null && this.serviced instanceof Period;
4200        }
4201
4202        public boolean hasServiced() { 
4203          return this.serviced != null && !this.serviced.isEmpty();
4204        }
4205
4206        /**
4207         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4208         */
4209        public ItemComponent setServiced(Type value) { 
4210          if (value != null && !(value instanceof DateType || value instanceof Period))
4211            throw new Error("Not the right type for ExplanationOfBenefit.item.serviced[x]: "+value.fhirType());
4212          this.serviced = value;
4213          return this;
4214        }
4215
4216        /**
4217         * @return {@link #location} (Where the product or service was provided.)
4218         */
4219        public Type getLocation() { 
4220          return this.location;
4221        }
4222
4223        /**
4224         * @return {@link #location} (Where the product or service was provided.)
4225         */
4226        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
4227          if (this.location == null)
4228            this.location = new CodeableConcept();
4229          if (!(this.location instanceof CodeableConcept))
4230            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
4231          return (CodeableConcept) this.location;
4232        }
4233
4234        public boolean hasLocationCodeableConcept() { 
4235          return this != null && this.location instanceof CodeableConcept;
4236        }
4237
4238        /**
4239         * @return {@link #location} (Where the product or service was provided.)
4240         */
4241        public Address getLocationAddress() throws FHIRException { 
4242          if (this.location == null)
4243            this.location = new Address();
4244          if (!(this.location instanceof Address))
4245            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
4246          return (Address) this.location;
4247        }
4248
4249        public boolean hasLocationAddress() { 
4250          return this != null && this.location instanceof Address;
4251        }
4252
4253        /**
4254         * @return {@link #location} (Where the product or service was provided.)
4255         */
4256        public Reference getLocationReference() throws FHIRException { 
4257          if (this.location == null)
4258            this.location = new Reference();
4259          if (!(this.location instanceof Reference))
4260            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
4261          return (Reference) this.location;
4262        }
4263
4264        public boolean hasLocationReference() { 
4265          return this != null && this.location instanceof Reference;
4266        }
4267
4268        public boolean hasLocation() { 
4269          return this.location != null && !this.location.isEmpty();
4270        }
4271
4272        /**
4273         * @param value {@link #location} (Where the product or service was provided.)
4274         */
4275        public ItemComponent setLocation(Type value) { 
4276          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
4277            throw new Error("Not the right type for ExplanationOfBenefit.item.location[x]: "+value.fhirType());
4278          this.location = value;
4279          return this;
4280        }
4281
4282        /**
4283         * @return {@link #quantity} (The number of repetitions of a service or product.)
4284         */
4285        public Quantity getQuantity() { 
4286          if (this.quantity == null)
4287            if (Configuration.errorOnAutoCreate())
4288              throw new Error("Attempt to auto-create ItemComponent.quantity");
4289            else if (Configuration.doAutoCreate())
4290              this.quantity = new Quantity(); // cc
4291          return this.quantity;
4292        }
4293
4294        public boolean hasQuantity() { 
4295          return this.quantity != null && !this.quantity.isEmpty();
4296        }
4297
4298        /**
4299         * @param value {@link #quantity} (The number of repetitions of a service or product.)
4300         */
4301        public ItemComponent setQuantity(Quantity value) { 
4302          this.quantity = value;
4303          return this;
4304        }
4305
4306        /**
4307         * @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.)
4308         */
4309        public Money getUnitPrice() { 
4310          if (this.unitPrice == null)
4311            if (Configuration.errorOnAutoCreate())
4312              throw new Error("Attempt to auto-create ItemComponent.unitPrice");
4313            else if (Configuration.doAutoCreate())
4314              this.unitPrice = new Money(); // cc
4315          return this.unitPrice;
4316        }
4317
4318        public boolean hasUnitPrice() { 
4319          return this.unitPrice != null && !this.unitPrice.isEmpty();
4320        }
4321
4322        /**
4323         * @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.)
4324         */
4325        public ItemComponent setUnitPrice(Money value) { 
4326          this.unitPrice = value;
4327          return this;
4328        }
4329
4330        /**
4331         * @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
4332         */
4333        public DecimalType getFactorElement() { 
4334          if (this.factor == null)
4335            if (Configuration.errorOnAutoCreate())
4336              throw new Error("Attempt to auto-create ItemComponent.factor");
4337            else if (Configuration.doAutoCreate())
4338              this.factor = new DecimalType(); // bb
4339          return this.factor;
4340        }
4341
4342        public boolean hasFactorElement() { 
4343          return this.factor != null && !this.factor.isEmpty();
4344        }
4345
4346        public boolean hasFactor() { 
4347          return this.factor != null && !this.factor.isEmpty();
4348        }
4349
4350        /**
4351         * @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
4352         */
4353        public ItemComponent setFactorElement(DecimalType value) { 
4354          this.factor = value;
4355          return this;
4356        }
4357
4358        /**
4359         * @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.
4360         */
4361        public BigDecimal getFactor() { 
4362          return this.factor == null ? null : this.factor.getValue();
4363        }
4364
4365        /**
4366         * @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.
4367         */
4368        public ItemComponent setFactor(BigDecimal value) { 
4369          if (value == null)
4370            this.factor = null;
4371          else {
4372            if (this.factor == null)
4373              this.factor = new DecimalType();
4374            this.factor.setValue(value);
4375          }
4376          return this;
4377        }
4378
4379        /**
4380         * @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.
4381         */
4382        public ItemComponent setFactor(long value) { 
4383              this.factor = new DecimalType();
4384            this.factor.setValue(value);
4385          return this;
4386        }
4387
4388        /**
4389         * @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.
4390         */
4391        public ItemComponent setFactor(double value) { 
4392              this.factor = new DecimalType();
4393            this.factor.setValue(value);
4394          return this;
4395        }
4396
4397        /**
4398         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4399         */
4400        public Money getNet() { 
4401          if (this.net == null)
4402            if (Configuration.errorOnAutoCreate())
4403              throw new Error("Attempt to auto-create ItemComponent.net");
4404            else if (Configuration.doAutoCreate())
4405              this.net = new Money(); // cc
4406          return this.net;
4407        }
4408
4409        public boolean hasNet() { 
4410          return this.net != null && !this.net.isEmpty();
4411        }
4412
4413        /**
4414         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4415         */
4416        public ItemComponent setNet(Money value) { 
4417          this.net = value;
4418          return this;
4419        }
4420
4421        /**
4422         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
4423         */
4424        public List<Reference> getUdi() { 
4425          if (this.udi == null)
4426            this.udi = new ArrayList<Reference>();
4427          return this.udi;
4428        }
4429
4430        /**
4431         * @return Returns a reference to <code>this</code> for easy method chaining
4432         */
4433        public ItemComponent setUdi(List<Reference> theUdi) { 
4434          this.udi = theUdi;
4435          return this;
4436        }
4437
4438        public boolean hasUdi() { 
4439          if (this.udi == null)
4440            return false;
4441          for (Reference item : this.udi)
4442            if (!item.isEmpty())
4443              return true;
4444          return false;
4445        }
4446
4447        public Reference addUdi() { //3
4448          Reference t = new Reference();
4449          if (this.udi == null)
4450            this.udi = new ArrayList<Reference>();
4451          this.udi.add(t);
4452          return t;
4453        }
4454
4455        public ItemComponent addUdi(Reference t) { //3
4456          if (t == null)
4457            return this;
4458          if (this.udi == null)
4459            this.udi = new ArrayList<Reference>();
4460          this.udi.add(t);
4461          return this;
4462        }
4463
4464        /**
4465         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
4466         */
4467        public Reference getUdiFirstRep() { 
4468          if (getUdi().isEmpty()) {
4469            addUdi();
4470          }
4471          return getUdi().get(0);
4472        }
4473
4474        /**
4475         * @deprecated Use Reference#setResource(IBaseResource) instead
4476         */
4477        @Deprecated
4478        public List<Device> getUdiTarget() { 
4479          if (this.udiTarget == null)
4480            this.udiTarget = new ArrayList<Device>();
4481          return this.udiTarget;
4482        }
4483
4484        /**
4485         * @deprecated Use Reference#setResource(IBaseResource) instead
4486         */
4487        @Deprecated
4488        public Device addUdiTarget() { 
4489          Device r = new Device();
4490          if (this.udiTarget == null)
4491            this.udiTarget = new ArrayList<Device>();
4492          this.udiTarget.add(r);
4493          return r;
4494        }
4495
4496        /**
4497         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4498         */
4499        public CodeableConcept getBodySite() { 
4500          if (this.bodySite == null)
4501            if (Configuration.errorOnAutoCreate())
4502              throw new Error("Attempt to auto-create ItemComponent.bodySite");
4503            else if (Configuration.doAutoCreate())
4504              this.bodySite = new CodeableConcept(); // cc
4505          return this.bodySite;
4506        }
4507
4508        public boolean hasBodySite() { 
4509          return this.bodySite != null && !this.bodySite.isEmpty();
4510        }
4511
4512        /**
4513         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4514         */
4515        public ItemComponent setBodySite(CodeableConcept value) { 
4516          this.bodySite = value;
4517          return this;
4518        }
4519
4520        /**
4521         * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb region or tooth surface(s).)
4522         */
4523        public List<CodeableConcept> getSubSite() { 
4524          if (this.subSite == null)
4525            this.subSite = new ArrayList<CodeableConcept>();
4526          return this.subSite;
4527        }
4528
4529        /**
4530         * @return Returns a reference to <code>this</code> for easy method chaining
4531         */
4532        public ItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
4533          this.subSite = theSubSite;
4534          return this;
4535        }
4536
4537        public boolean hasSubSite() { 
4538          if (this.subSite == null)
4539            return false;
4540          for (CodeableConcept item : this.subSite)
4541            if (!item.isEmpty())
4542              return true;
4543          return false;
4544        }
4545
4546        public CodeableConcept addSubSite() { //3
4547          CodeableConcept t = new CodeableConcept();
4548          if (this.subSite == null)
4549            this.subSite = new ArrayList<CodeableConcept>();
4550          this.subSite.add(t);
4551          return t;
4552        }
4553
4554        public ItemComponent addSubSite(CodeableConcept t) { //3
4555          if (t == null)
4556            return this;
4557          if (this.subSite == null)
4558            this.subSite = new ArrayList<CodeableConcept>();
4559          this.subSite.add(t);
4560          return this;
4561        }
4562
4563        /**
4564         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist
4565         */
4566        public CodeableConcept getSubSiteFirstRep() { 
4567          if (getSubSite().isEmpty()) {
4568            addSubSite();
4569          }
4570          return getSubSite().get(0);
4571        }
4572
4573        /**
4574         * @return {@link #encounter} (A billed item may include goods or services provided in multiple encounters.)
4575         */
4576        public List<Reference> getEncounter() { 
4577          if (this.encounter == null)
4578            this.encounter = new ArrayList<Reference>();
4579          return this.encounter;
4580        }
4581
4582        /**
4583         * @return Returns a reference to <code>this</code> for easy method chaining
4584         */
4585        public ItemComponent setEncounter(List<Reference> theEncounter) { 
4586          this.encounter = theEncounter;
4587          return this;
4588        }
4589
4590        public boolean hasEncounter() { 
4591          if (this.encounter == null)
4592            return false;
4593          for (Reference item : this.encounter)
4594            if (!item.isEmpty())
4595              return true;
4596          return false;
4597        }
4598
4599        public Reference addEncounter() { //3
4600          Reference t = new Reference();
4601          if (this.encounter == null)
4602            this.encounter = new ArrayList<Reference>();
4603          this.encounter.add(t);
4604          return t;
4605        }
4606
4607        public ItemComponent addEncounter(Reference t) { //3
4608          if (t == null)
4609            return this;
4610          if (this.encounter == null)
4611            this.encounter = new ArrayList<Reference>();
4612          this.encounter.add(t);
4613          return this;
4614        }
4615
4616        /**
4617         * @return The first repetition of repeating field {@link #encounter}, creating it if it does not already exist
4618         */
4619        public Reference getEncounterFirstRep() { 
4620          if (getEncounter().isEmpty()) {
4621            addEncounter();
4622          }
4623          return getEncounter().get(0);
4624        }
4625
4626        /**
4627         * @deprecated Use Reference#setResource(IBaseResource) instead
4628         */
4629        @Deprecated
4630        public List<Encounter> getEncounterTarget() { 
4631          if (this.encounterTarget == null)
4632            this.encounterTarget = new ArrayList<Encounter>();
4633          return this.encounterTarget;
4634        }
4635
4636        /**
4637         * @deprecated Use Reference#setResource(IBaseResource) instead
4638         */
4639        @Deprecated
4640        public Encounter addEncounterTarget() { 
4641          Encounter r = new Encounter();
4642          if (this.encounterTarget == null)
4643            this.encounterTarget = new ArrayList<Encounter>();
4644          this.encounterTarget.add(r);
4645          return r;
4646        }
4647
4648        /**
4649         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4650         */
4651        public List<PositiveIntType> getNoteNumber() { 
4652          if (this.noteNumber == null)
4653            this.noteNumber = new ArrayList<PositiveIntType>();
4654          return this.noteNumber;
4655        }
4656
4657        /**
4658         * @return Returns a reference to <code>this</code> for easy method chaining
4659         */
4660        public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
4661          this.noteNumber = theNoteNumber;
4662          return this;
4663        }
4664
4665        public boolean hasNoteNumber() { 
4666          if (this.noteNumber == null)
4667            return false;
4668          for (PositiveIntType item : this.noteNumber)
4669            if (!item.isEmpty())
4670              return true;
4671          return false;
4672        }
4673
4674        /**
4675         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4676         */
4677        public PositiveIntType addNoteNumberElement() {//2 
4678          PositiveIntType t = new PositiveIntType();
4679          if (this.noteNumber == null)
4680            this.noteNumber = new ArrayList<PositiveIntType>();
4681          this.noteNumber.add(t);
4682          return t;
4683        }
4684
4685        /**
4686         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4687         */
4688        public ItemComponent addNoteNumber(int value) { //1
4689          PositiveIntType t = new PositiveIntType();
4690          t.setValue(value);
4691          if (this.noteNumber == null)
4692            this.noteNumber = new ArrayList<PositiveIntType>();
4693          this.noteNumber.add(t);
4694          return this;
4695        }
4696
4697        /**
4698         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4699         */
4700        public boolean hasNoteNumber(int value) { 
4701          if (this.noteNumber == null)
4702            return false;
4703          for (PositiveIntType v : this.noteNumber)
4704            if (v.getValue().equals(value)) // positiveInt
4705              return true;
4706          return false;
4707        }
4708
4709        /**
4710         * @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.)
4711         */
4712        public List<AdjudicationComponent> getAdjudication() { 
4713          if (this.adjudication == null)
4714            this.adjudication = new ArrayList<AdjudicationComponent>();
4715          return this.adjudication;
4716        }
4717
4718        /**
4719         * @return Returns a reference to <code>this</code> for easy method chaining
4720         */
4721        public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
4722          this.adjudication = theAdjudication;
4723          return this;
4724        }
4725
4726        public boolean hasAdjudication() { 
4727          if (this.adjudication == null)
4728            return false;
4729          for (AdjudicationComponent item : this.adjudication)
4730            if (!item.isEmpty())
4731              return true;
4732          return false;
4733        }
4734
4735        public AdjudicationComponent addAdjudication() { //3
4736          AdjudicationComponent t = new AdjudicationComponent();
4737          if (this.adjudication == null)
4738            this.adjudication = new ArrayList<AdjudicationComponent>();
4739          this.adjudication.add(t);
4740          return t;
4741        }
4742
4743        public ItemComponent addAdjudication(AdjudicationComponent t) { //3
4744          if (t == null)
4745            return this;
4746          if (this.adjudication == null)
4747            this.adjudication = new ArrayList<AdjudicationComponent>();
4748          this.adjudication.add(t);
4749          return this;
4750        }
4751
4752        /**
4753         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
4754         */
4755        public AdjudicationComponent getAdjudicationFirstRep() { 
4756          if (getAdjudication().isEmpty()) {
4757            addAdjudication();
4758          }
4759          return getAdjudication().get(0);
4760        }
4761
4762        /**
4763         * @return {@link #detail} (Second-tier of goods and services.)
4764         */
4765        public List<DetailComponent> getDetail() { 
4766          if (this.detail == null)
4767            this.detail = new ArrayList<DetailComponent>();
4768          return this.detail;
4769        }
4770
4771        /**
4772         * @return Returns a reference to <code>this</code> for easy method chaining
4773         */
4774        public ItemComponent setDetail(List<DetailComponent> theDetail) { 
4775          this.detail = theDetail;
4776          return this;
4777        }
4778
4779        public boolean hasDetail() { 
4780          if (this.detail == null)
4781            return false;
4782          for (DetailComponent item : this.detail)
4783            if (!item.isEmpty())
4784              return true;
4785          return false;
4786        }
4787
4788        public DetailComponent addDetail() { //3
4789          DetailComponent t = new DetailComponent();
4790          if (this.detail == null)
4791            this.detail = new ArrayList<DetailComponent>();
4792          this.detail.add(t);
4793          return t;
4794        }
4795
4796        public ItemComponent addDetail(DetailComponent t) { //3
4797          if (t == null)
4798            return this;
4799          if (this.detail == null)
4800            this.detail = new ArrayList<DetailComponent>();
4801          this.detail.add(t);
4802          return this;
4803        }
4804
4805        /**
4806         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
4807         */
4808        public DetailComponent getDetailFirstRep() { 
4809          if (getDetail().isEmpty()) {
4810            addDetail();
4811          }
4812          return getDetail().get(0);
4813        }
4814
4815        protected void listChildren(List<Property> children) {
4816          super.listChildren(children);
4817          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence));
4818          children.add(new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence));
4819          children.add(new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence));
4820          children.add(new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence));
4821          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));
4822          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
4823          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
4824          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));
4825          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));
4826          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
4827          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));
4828          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location));
4829          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
4830          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));
4831          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));
4832          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
4833          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
4834          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
4835          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));
4836          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));
4837          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));
4838          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));
4839          children.add(new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
4840        }
4841
4842        @Override
4843        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4844          switch (_hash) {
4845          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence);
4846          case 1070083823: /*careTeamSequence*/  return new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence);
4847          case -909769262: /*diagnosisSequence*/  return new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence);
4848          case -808920140: /*procedureSequence*/  return new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence);
4849          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);
4850          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
4851          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);
4852          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);
4853          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);
4854          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
4855          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);
4856          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);
4857          case 363246749: /*servicedDate*/  return new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
4858          case 1534966512: /*servicedPeriod*/  return new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
4859          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4860          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4861          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4862          case -1280020865: /*locationAddress*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4863          case 755866390: /*locationReference*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4864          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
4865          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);
4866          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);
4867          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);
4868          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
4869          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
4870          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);
4871          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);
4872          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);
4873          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);
4874          case -1335224239: /*detail*/  return new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail);
4875          default: return super.getNamedProperty(_hash, _name, _checkValid);
4876          }
4877
4878        }
4879
4880      @Override
4881      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4882        switch (hash) {
4883        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
4884        case 1070083823: /*careTeamSequence*/ return this.careTeamSequence == null ? new Base[0] : this.careTeamSequence.toArray(new Base[this.careTeamSequence.size()]); // PositiveIntType
4885        case -909769262: /*diagnosisSequence*/ return this.diagnosisSequence == null ? new Base[0] : this.diagnosisSequence.toArray(new Base[this.diagnosisSequence.size()]); // PositiveIntType
4886        case -808920140: /*procedureSequence*/ return this.procedureSequence == null ? new Base[0] : this.procedureSequence.toArray(new Base[this.procedureSequence.size()]); // PositiveIntType
4887        case -702585587: /*informationSequence*/ return this.informationSequence == null ? new Base[0] : this.informationSequence.toArray(new Base[this.informationSequence.size()]); // PositiveIntType
4888        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
4889        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4890        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
4891        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
4892        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
4893        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
4894        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
4895        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
4896        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
4897        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
4898        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
4899        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
4900        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
4901        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
4902        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
4903        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
4904        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
4905        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
4906        default: return super.getProperty(hash, name, checkValid);
4907        }
4908
4909      }
4910
4911      @Override
4912      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4913        switch (hash) {
4914        case 1349547969: // sequence
4915          this.sequence = castToPositiveInt(value); // PositiveIntType
4916          return value;
4917        case 1070083823: // careTeamSequence
4918          this.getCareTeamSequence().add(castToPositiveInt(value)); // PositiveIntType
4919          return value;
4920        case -909769262: // diagnosisSequence
4921          this.getDiagnosisSequence().add(castToPositiveInt(value)); // PositiveIntType
4922          return value;
4923        case -808920140: // procedureSequence
4924          this.getProcedureSequence().add(castToPositiveInt(value)); // PositiveIntType
4925          return value;
4926        case -702585587: // informationSequence
4927          this.getInformationSequence().add(castToPositiveInt(value)); // PositiveIntType
4928          return value;
4929        case 1099842588: // revenue
4930          this.revenue = castToCodeableConcept(value); // CodeableConcept
4931          return value;
4932        case 50511102: // category
4933          this.category = castToCodeableConcept(value); // CodeableConcept
4934          return value;
4935        case 1957227299: // productOrService
4936          this.productOrService = castToCodeableConcept(value); // CodeableConcept
4937          return value;
4938        case -615513385: // modifier
4939          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
4940          return value;
4941        case 1010065041: // programCode
4942          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
4943          return value;
4944        case 1379209295: // serviced
4945          this.serviced = castToType(value); // Type
4946          return value;
4947        case 1901043637: // location
4948          this.location = castToType(value); // Type
4949          return value;
4950        case -1285004149: // quantity
4951          this.quantity = castToQuantity(value); // Quantity
4952          return value;
4953        case -486196699: // unitPrice
4954          this.unitPrice = castToMoney(value); // Money
4955          return value;
4956        case -1282148017: // factor
4957          this.factor = castToDecimal(value); // DecimalType
4958          return value;
4959        case 108957: // net
4960          this.net = castToMoney(value); // Money
4961          return value;
4962        case 115642: // udi
4963          this.getUdi().add(castToReference(value)); // Reference
4964          return value;
4965        case 1702620169: // bodySite
4966          this.bodySite = castToCodeableConcept(value); // CodeableConcept
4967          return value;
4968        case -1868566105: // subSite
4969          this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
4970          return value;
4971        case 1524132147: // encounter
4972          this.getEncounter().add(castToReference(value)); // Reference
4973          return value;
4974        case -1110033957: // noteNumber
4975          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
4976          return value;
4977        case -231349275: // adjudication
4978          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
4979          return value;
4980        case -1335224239: // detail
4981          this.getDetail().add((DetailComponent) value); // DetailComponent
4982          return value;
4983        default: return super.setProperty(hash, name, value);
4984        }
4985
4986      }
4987
4988      @Override
4989      public Base setProperty(String name, Base value) throws FHIRException {
4990        if (name.equals("sequence")) {
4991          this.sequence = castToPositiveInt(value); // PositiveIntType
4992        } else if (name.equals("careTeamSequence")) {
4993          this.getCareTeamSequence().add(castToPositiveInt(value));
4994        } else if (name.equals("diagnosisSequence")) {
4995          this.getDiagnosisSequence().add(castToPositiveInt(value));
4996        } else if (name.equals("procedureSequence")) {
4997          this.getProcedureSequence().add(castToPositiveInt(value));
4998        } else if (name.equals("informationSequence")) {
4999          this.getInformationSequence().add(castToPositiveInt(value));
5000        } else if (name.equals("revenue")) {
5001          this.revenue = castToCodeableConcept(value); // CodeableConcept
5002        } else if (name.equals("category")) {
5003          this.category = castToCodeableConcept(value); // CodeableConcept
5004        } else if (name.equals("productOrService")) {
5005          this.productOrService = castToCodeableConcept(value); // CodeableConcept
5006        } else if (name.equals("modifier")) {
5007          this.getModifier().add(castToCodeableConcept(value));
5008        } else if (name.equals("programCode")) {
5009          this.getProgramCode().add(castToCodeableConcept(value));
5010        } else if (name.equals("serviced[x]")) {
5011          this.serviced = castToType(value); // Type
5012        } else if (name.equals("location[x]")) {
5013          this.location = castToType(value); // Type
5014        } else if (name.equals("quantity")) {
5015          this.quantity = castToQuantity(value); // Quantity
5016        } else if (name.equals("unitPrice")) {
5017          this.unitPrice = castToMoney(value); // Money
5018        } else if (name.equals("factor")) {
5019          this.factor = castToDecimal(value); // DecimalType
5020        } else if (name.equals("net")) {
5021          this.net = castToMoney(value); // Money
5022        } else if (name.equals("udi")) {
5023          this.getUdi().add(castToReference(value));
5024        } else if (name.equals("bodySite")) {
5025          this.bodySite = castToCodeableConcept(value); // CodeableConcept
5026        } else if (name.equals("subSite")) {
5027          this.getSubSite().add(castToCodeableConcept(value));
5028        } else if (name.equals("encounter")) {
5029          this.getEncounter().add(castToReference(value));
5030        } else if (name.equals("noteNumber")) {
5031          this.getNoteNumber().add(castToPositiveInt(value));
5032        } else if (name.equals("adjudication")) {
5033          this.getAdjudication().add((AdjudicationComponent) value);
5034        } else if (name.equals("detail")) {
5035          this.getDetail().add((DetailComponent) value);
5036        } else
5037          return super.setProperty(name, value);
5038        return value;
5039      }
5040
5041      @Override
5042      public Base makeProperty(int hash, String name) throws FHIRException {
5043        switch (hash) {
5044        case 1349547969:  return getSequenceElement();
5045        case 1070083823:  return addCareTeamSequenceElement();
5046        case -909769262:  return addDiagnosisSequenceElement();
5047        case -808920140:  return addProcedureSequenceElement();
5048        case -702585587:  return addInformationSequenceElement();
5049        case 1099842588:  return getRevenue(); 
5050        case 50511102:  return getCategory(); 
5051        case 1957227299:  return getProductOrService(); 
5052        case -615513385:  return addModifier(); 
5053        case 1010065041:  return addProgramCode(); 
5054        case -1927922223:  return getServiced(); 
5055        case 1379209295:  return getServiced(); 
5056        case 552316075:  return getLocation(); 
5057        case 1901043637:  return getLocation(); 
5058        case -1285004149:  return getQuantity(); 
5059        case -486196699:  return getUnitPrice(); 
5060        case -1282148017:  return getFactorElement();
5061        case 108957:  return getNet(); 
5062        case 115642:  return addUdi(); 
5063        case 1702620169:  return getBodySite(); 
5064        case -1868566105:  return addSubSite(); 
5065        case 1524132147:  return addEncounter(); 
5066        case -1110033957:  return addNoteNumberElement();
5067        case -231349275:  return addAdjudication(); 
5068        case -1335224239:  return addDetail(); 
5069        default: return super.makeProperty(hash, name);
5070        }
5071
5072      }
5073
5074      @Override
5075      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5076        switch (hash) {
5077        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
5078        case 1070083823: /*careTeamSequence*/ return new String[] {"positiveInt"};
5079        case -909769262: /*diagnosisSequence*/ return new String[] {"positiveInt"};
5080        case -808920140: /*procedureSequence*/ return new String[] {"positiveInt"};
5081        case -702585587: /*informationSequence*/ return new String[] {"positiveInt"};
5082        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
5083        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5084        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
5085        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
5086        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
5087        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
5088        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
5089        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
5090        case -486196699: /*unitPrice*/ return new String[] {"Money"};
5091        case -1282148017: /*factor*/ return new String[] {"decimal"};
5092        case 108957: /*net*/ return new String[] {"Money"};
5093        case 115642: /*udi*/ return new String[] {"Reference"};
5094        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
5095        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
5096        case 1524132147: /*encounter*/ return new String[] {"Reference"};
5097        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
5098        case -231349275: /*adjudication*/ return new String[] {};
5099        case -1335224239: /*detail*/ return new String[] {};
5100        default: return super.getTypesForProperty(hash, name);
5101        }
5102
5103      }
5104
5105      @Override
5106      public Base addChild(String name) throws FHIRException {
5107        if (name.equals("sequence")) {
5108          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
5109        }
5110        else if (name.equals("careTeamSequence")) {
5111          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.careTeamSequence");
5112        }
5113        else if (name.equals("diagnosisSequence")) {
5114          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.diagnosisSequence");
5115        }
5116        else if (name.equals("procedureSequence")) {
5117          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedureSequence");
5118        }
5119        else if (name.equals("informationSequence")) {
5120          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.informationSequence");
5121        }
5122        else if (name.equals("revenue")) {
5123          this.revenue = new CodeableConcept();
5124          return this.revenue;
5125        }
5126        else if (name.equals("category")) {
5127          this.category = new CodeableConcept();
5128          return this.category;
5129        }
5130        else if (name.equals("productOrService")) {
5131          this.productOrService = new CodeableConcept();
5132          return this.productOrService;
5133        }
5134        else if (name.equals("modifier")) {
5135          return addModifier();
5136        }
5137        else if (name.equals("programCode")) {
5138          return addProgramCode();
5139        }
5140        else if (name.equals("servicedDate")) {
5141          this.serviced = new DateType();
5142          return this.serviced;
5143        }
5144        else if (name.equals("servicedPeriod")) {
5145          this.serviced = new Period();
5146          return this.serviced;
5147        }
5148        else if (name.equals("locationCodeableConcept")) {
5149          this.location = new CodeableConcept();
5150          return this.location;
5151        }
5152        else if (name.equals("locationAddress")) {
5153          this.location = new Address();
5154          return this.location;
5155        }
5156        else if (name.equals("locationReference")) {
5157          this.location = new Reference();
5158          return this.location;
5159        }
5160        else if (name.equals("quantity")) {
5161          this.quantity = new Quantity();
5162          return this.quantity;
5163        }
5164        else if (name.equals("unitPrice")) {
5165          this.unitPrice = new Money();
5166          return this.unitPrice;
5167        }
5168        else if (name.equals("factor")) {
5169          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
5170        }
5171        else if (name.equals("net")) {
5172          this.net = new Money();
5173          return this.net;
5174        }
5175        else if (name.equals("udi")) {
5176          return addUdi();
5177        }
5178        else if (name.equals("bodySite")) {
5179          this.bodySite = new CodeableConcept();
5180          return this.bodySite;
5181        }
5182        else if (name.equals("subSite")) {
5183          return addSubSite();
5184        }
5185        else if (name.equals("encounter")) {
5186          return addEncounter();
5187        }
5188        else if (name.equals("noteNumber")) {
5189          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
5190        }
5191        else if (name.equals("adjudication")) {
5192          return addAdjudication();
5193        }
5194        else if (name.equals("detail")) {
5195          return addDetail();
5196        }
5197        else
5198          return super.addChild(name);
5199      }
5200
5201      public ItemComponent copy() {
5202        ItemComponent dst = new ItemComponent();
5203        copyValues(dst);
5204        return dst;
5205      }
5206
5207      public void copyValues(ItemComponent dst) {
5208        super.copyValues(dst);
5209        dst.sequence = sequence == null ? null : sequence.copy();
5210        if (careTeamSequence != null) {
5211          dst.careTeamSequence = new ArrayList<PositiveIntType>();
5212          for (PositiveIntType i : careTeamSequence)
5213            dst.careTeamSequence.add(i.copy());
5214        };
5215        if (diagnosisSequence != null) {
5216          dst.diagnosisSequence = new ArrayList<PositiveIntType>();
5217          for (PositiveIntType i : diagnosisSequence)
5218            dst.diagnosisSequence.add(i.copy());
5219        };
5220        if (procedureSequence != null) {
5221          dst.procedureSequence = new ArrayList<PositiveIntType>();
5222          for (PositiveIntType i : procedureSequence)
5223            dst.procedureSequence.add(i.copy());
5224        };
5225        if (informationSequence != null) {
5226          dst.informationSequence = new ArrayList<PositiveIntType>();
5227          for (PositiveIntType i : informationSequence)
5228            dst.informationSequence.add(i.copy());
5229        };
5230        dst.revenue = revenue == null ? null : revenue.copy();
5231        dst.category = category == null ? null : category.copy();
5232        dst.productOrService = productOrService == null ? null : productOrService.copy();
5233        if (modifier != null) {
5234          dst.modifier = new ArrayList<CodeableConcept>();
5235          for (CodeableConcept i : modifier)
5236            dst.modifier.add(i.copy());
5237        };
5238        if (programCode != null) {
5239          dst.programCode = new ArrayList<CodeableConcept>();
5240          for (CodeableConcept i : programCode)
5241            dst.programCode.add(i.copy());
5242        };
5243        dst.serviced = serviced == null ? null : serviced.copy();
5244        dst.location = location == null ? null : location.copy();
5245        dst.quantity = quantity == null ? null : quantity.copy();
5246        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
5247        dst.factor = factor == null ? null : factor.copy();
5248        dst.net = net == null ? null : net.copy();
5249        if (udi != null) {
5250          dst.udi = new ArrayList<Reference>();
5251          for (Reference i : udi)
5252            dst.udi.add(i.copy());
5253        };
5254        dst.bodySite = bodySite == null ? null : bodySite.copy();
5255        if (subSite != null) {
5256          dst.subSite = new ArrayList<CodeableConcept>();
5257          for (CodeableConcept i : subSite)
5258            dst.subSite.add(i.copy());
5259        };
5260        if (encounter != null) {
5261          dst.encounter = new ArrayList<Reference>();
5262          for (Reference i : encounter)
5263            dst.encounter.add(i.copy());
5264        };
5265        if (noteNumber != null) {
5266          dst.noteNumber = new ArrayList<PositiveIntType>();
5267          for (PositiveIntType i : noteNumber)
5268            dst.noteNumber.add(i.copy());
5269        };
5270        if (adjudication != null) {
5271          dst.adjudication = new ArrayList<AdjudicationComponent>();
5272          for (AdjudicationComponent i : adjudication)
5273            dst.adjudication.add(i.copy());
5274        };
5275        if (detail != null) {
5276          dst.detail = new ArrayList<DetailComponent>();
5277          for (DetailComponent i : detail)
5278            dst.detail.add(i.copy());
5279        };
5280      }
5281
5282      @Override
5283      public boolean equalsDeep(Base other_) {
5284        if (!super.equalsDeep(other_))
5285          return false;
5286        if (!(other_ instanceof ItemComponent))
5287          return false;
5288        ItemComponent o = (ItemComponent) other_;
5289        return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamSequence, o.careTeamSequence, true)
5290           && compareDeep(diagnosisSequence, o.diagnosisSequence, true) && compareDeep(procedureSequence, o.procedureSequence, true)
5291           && compareDeep(informationSequence, o.informationSequence, true) && compareDeep(revenue, o.revenue, true)
5292           && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
5293           && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true)
5294           && compareDeep(location, o.location, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
5295           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
5296           && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true) && compareDeep(encounter, o.encounter, true)
5297           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
5298           && compareDeep(detail, o.detail, true);
5299      }
5300
5301      @Override
5302      public boolean equalsShallow(Base other_) {
5303        if (!super.equalsShallow(other_))
5304          return false;
5305        if (!(other_ instanceof ItemComponent))
5306          return false;
5307        ItemComponent o = (ItemComponent) other_;
5308        return compareValues(sequence, o.sequence, true) && compareValues(careTeamSequence, o.careTeamSequence, true)
5309           && compareValues(diagnosisSequence, o.diagnosisSequence, true) && compareValues(procedureSequence, o.procedureSequence, true)
5310           && compareValues(informationSequence, o.informationSequence, true) && compareValues(factor, o.factor, true)
5311           && compareValues(noteNumber, o.noteNumber, true);
5312      }
5313
5314      public boolean isEmpty() {
5315        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamSequence
5316          , diagnosisSequence, procedureSequence, informationSequence, revenue, category, productOrService
5317          , modifier, programCode, serviced, location, quantity, unitPrice, factor, net
5318          , udi, bodySite, subSite, encounter, noteNumber, adjudication, detail);
5319      }
5320
5321  public String fhirType() {
5322    return "ExplanationOfBenefit.item";
5323
5324  }
5325
5326  }
5327
5328    @Block()
5329    public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
5330        /**
5331         * 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.
5332         */
5333        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
5334        @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." )
5335        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
5336        protected CodeableConcept category;
5337
5338        /**
5339         * A code supporting the understanding of the adjudication result and explaining variance from expected amount.
5340         */
5341        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5342        @Description(shortDefinition="Explanation of adjudication outcome", formalDefinition="A code supporting the understanding of the adjudication result and explaining variance from expected amount." )
5343        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-reason")
5344        protected CodeableConcept reason;
5345
5346        /**
5347         * Monetary amount associated with the category.
5348         */
5349        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
5350        @Description(shortDefinition="Monetary amount", formalDefinition="Monetary amount associated with the category." )
5351        protected Money amount;
5352
5353        /**
5354         * A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5355         */
5356        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
5357        @Description(shortDefinition="Non-monitary value", formalDefinition="A non-monetary value associated with the category. Mutually exclusive to the amount element above." )
5358        protected DecimalType value;
5359
5360        private static final long serialVersionUID = 1559898786L;
5361
5362    /**
5363     * Constructor
5364     */
5365      public AdjudicationComponent() {
5366        super();
5367      }
5368
5369    /**
5370     * Constructor
5371     */
5372      public AdjudicationComponent(CodeableConcept category) {
5373        super();
5374        this.category = category;
5375      }
5376
5377        /**
5378         * @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.)
5379         */
5380        public CodeableConcept getCategory() { 
5381          if (this.category == null)
5382            if (Configuration.errorOnAutoCreate())
5383              throw new Error("Attempt to auto-create AdjudicationComponent.category");
5384            else if (Configuration.doAutoCreate())
5385              this.category = new CodeableConcept(); // cc
5386          return this.category;
5387        }
5388
5389        public boolean hasCategory() { 
5390          return this.category != null && !this.category.isEmpty();
5391        }
5392
5393        /**
5394         * @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.)
5395         */
5396        public AdjudicationComponent setCategory(CodeableConcept value) { 
5397          this.category = value;
5398          return this;
5399        }
5400
5401        /**
5402         * @return {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
5403         */
5404        public CodeableConcept getReason() { 
5405          if (this.reason == null)
5406            if (Configuration.errorOnAutoCreate())
5407              throw new Error("Attempt to auto-create AdjudicationComponent.reason");
5408            else if (Configuration.doAutoCreate())
5409              this.reason = new CodeableConcept(); // cc
5410          return this.reason;
5411        }
5412
5413        public boolean hasReason() { 
5414          return this.reason != null && !this.reason.isEmpty();
5415        }
5416
5417        /**
5418         * @param value {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
5419         */
5420        public AdjudicationComponent setReason(CodeableConcept value) { 
5421          this.reason = value;
5422          return this;
5423        }
5424
5425        /**
5426         * @return {@link #amount} (Monetary amount associated with the category.)
5427         */
5428        public Money getAmount() { 
5429          if (this.amount == null)
5430            if (Configuration.errorOnAutoCreate())
5431              throw new Error("Attempt to auto-create AdjudicationComponent.amount");
5432            else if (Configuration.doAutoCreate())
5433              this.amount = new Money(); // cc
5434          return this.amount;
5435        }
5436
5437        public boolean hasAmount() { 
5438          return this.amount != null && !this.amount.isEmpty();
5439        }
5440
5441        /**
5442         * @param value {@link #amount} (Monetary amount associated with the category.)
5443         */
5444        public AdjudicationComponent setAmount(Money value) { 
5445          this.amount = value;
5446          return this;
5447        }
5448
5449        /**
5450         * @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
5451         */
5452        public DecimalType getValueElement() { 
5453          if (this.value == null)
5454            if (Configuration.errorOnAutoCreate())
5455              throw new Error("Attempt to auto-create AdjudicationComponent.value");
5456            else if (Configuration.doAutoCreate())
5457              this.value = new DecimalType(); // bb
5458          return this.value;
5459        }
5460
5461        public boolean hasValueElement() { 
5462          return this.value != null && !this.value.isEmpty();
5463        }
5464
5465        public boolean hasValue() { 
5466          return this.value != null && !this.value.isEmpty();
5467        }
5468
5469        /**
5470         * @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
5471         */
5472        public AdjudicationComponent setValueElement(DecimalType value) { 
5473          this.value = value;
5474          return this;
5475        }
5476
5477        /**
5478         * @return A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5479         */
5480        public BigDecimal getValue() { 
5481          return this.value == null ? null : this.value.getValue();
5482        }
5483
5484        /**
5485         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5486         */
5487        public AdjudicationComponent setValue(BigDecimal value) { 
5488          if (value == null)
5489            this.value = null;
5490          else {
5491            if (this.value == null)
5492              this.value = new DecimalType();
5493            this.value.setValue(value);
5494          }
5495          return this;
5496        }
5497
5498        /**
5499         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5500         */
5501        public AdjudicationComponent setValue(long value) { 
5502              this.value = new DecimalType();
5503            this.value.setValue(value);
5504          return this;
5505        }
5506
5507        /**
5508         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5509         */
5510        public AdjudicationComponent setValue(double value) { 
5511              this.value = new DecimalType();
5512            this.value.setValue(value);
5513          return this;
5514        }
5515
5516        protected void listChildren(List<Property> children) {
5517          super.listChildren(children);
5518          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));
5519          children.add(new Property("reason", "CodeableConcept", "A code supporting the understanding of the adjudication result and explaining variance from expected amount.", 0, 1, reason));
5520          children.add(new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount));
5521          children.add(new Property("value", "decimal", "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1, value));
5522        }
5523
5524        @Override
5525        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5526          switch (_hash) {
5527          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);
5528          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);
5529          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount);
5530          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);
5531          default: return super.getNamedProperty(_hash, _name, _checkValid);
5532          }
5533
5534        }
5535
5536      @Override
5537      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5538        switch (hash) {
5539        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
5540        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
5541        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
5542        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
5543        default: return super.getProperty(hash, name, checkValid);
5544        }
5545
5546      }
5547
5548      @Override
5549      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5550        switch (hash) {
5551        case 50511102: // category
5552          this.category = castToCodeableConcept(value); // CodeableConcept
5553          return value;
5554        case -934964668: // reason
5555          this.reason = castToCodeableConcept(value); // CodeableConcept
5556          return value;
5557        case -1413853096: // amount
5558          this.amount = castToMoney(value); // Money
5559          return value;
5560        case 111972721: // value
5561          this.value = castToDecimal(value); // DecimalType
5562          return value;
5563        default: return super.setProperty(hash, name, value);
5564        }
5565
5566      }
5567
5568      @Override
5569      public Base setProperty(String name, Base value) throws FHIRException {
5570        if (name.equals("category")) {
5571          this.category = castToCodeableConcept(value); // CodeableConcept
5572        } else if (name.equals("reason")) {
5573          this.reason = castToCodeableConcept(value); // CodeableConcept
5574        } else if (name.equals("amount")) {
5575          this.amount = castToMoney(value); // Money
5576        } else if (name.equals("value")) {
5577          this.value = castToDecimal(value); // DecimalType
5578        } else
5579          return super.setProperty(name, value);
5580        return value;
5581      }
5582
5583      @Override
5584      public Base makeProperty(int hash, String name) throws FHIRException {
5585        switch (hash) {
5586        case 50511102:  return getCategory(); 
5587        case -934964668:  return getReason(); 
5588        case -1413853096:  return getAmount(); 
5589        case 111972721:  return getValueElement();
5590        default: return super.makeProperty(hash, name);
5591        }
5592
5593      }
5594
5595      @Override
5596      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5597        switch (hash) {
5598        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5599        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
5600        case -1413853096: /*amount*/ return new String[] {"Money"};
5601        case 111972721: /*value*/ return new String[] {"decimal"};
5602        default: return super.getTypesForProperty(hash, name);
5603        }
5604
5605      }
5606
5607      @Override
5608      public Base addChild(String name) throws FHIRException {
5609        if (name.equals("category")) {
5610          this.category = new CodeableConcept();
5611          return this.category;
5612        }
5613        else if (name.equals("reason")) {
5614          this.reason = new CodeableConcept();
5615          return this.reason;
5616        }
5617        else if (name.equals("amount")) {
5618          this.amount = new Money();
5619          return this.amount;
5620        }
5621        else if (name.equals("value")) {
5622          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
5623        }
5624        else
5625          return super.addChild(name);
5626      }
5627
5628      public AdjudicationComponent copy() {
5629        AdjudicationComponent dst = new AdjudicationComponent();
5630        copyValues(dst);
5631        return dst;
5632      }
5633
5634      public void copyValues(AdjudicationComponent dst) {
5635        super.copyValues(dst);
5636        dst.category = category == null ? null : category.copy();
5637        dst.reason = reason == null ? null : reason.copy();
5638        dst.amount = amount == null ? null : amount.copy();
5639        dst.value = value == null ? null : value.copy();
5640      }
5641
5642      @Override
5643      public boolean equalsDeep(Base other_) {
5644        if (!super.equalsDeep(other_))
5645          return false;
5646        if (!(other_ instanceof AdjudicationComponent))
5647          return false;
5648        AdjudicationComponent o = (AdjudicationComponent) other_;
5649        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
5650           && compareDeep(value, o.value, true);
5651      }
5652
5653      @Override
5654      public boolean equalsShallow(Base other_) {
5655        if (!super.equalsShallow(other_))
5656          return false;
5657        if (!(other_ instanceof AdjudicationComponent))
5658          return false;
5659        AdjudicationComponent o = (AdjudicationComponent) other_;
5660        return compareValues(value, o.value, true);
5661      }
5662
5663      public boolean isEmpty() {
5664        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount
5665          , value);
5666      }
5667
5668  public String fhirType() {
5669    return "ExplanationOfBenefit.item.adjudication";
5670
5671  }
5672
5673  }
5674
5675    @Block()
5676    public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
5677        /**
5678         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5679         */
5680        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
5681        @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." )
5682        protected PositiveIntType sequence;
5683
5684        /**
5685         * The type of revenue or cost center providing the product and/or service.
5686         */
5687        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5688        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
5689        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
5690        protected CodeableConcept revenue;
5691
5692        /**
5693         * Code to identify the general type of benefits under which products and services are provided.
5694         */
5695        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
5696        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
5697        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
5698        protected CodeableConcept category;
5699
5700        /**
5701         * 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.
5702         */
5703        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
5704        @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." )
5705        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
5706        protected CodeableConcept productOrService;
5707
5708        /**
5709         * Item typification or modifiers codes to convey additional context for the product or service.
5710         */
5711        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5712        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
5713        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
5714        protected List<CodeableConcept> modifier;
5715
5716        /**
5717         * Identifies the program under which this may be recovered.
5718         */
5719        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5720        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
5721        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
5722        protected List<CodeableConcept> programCode;
5723
5724        /**
5725         * The number of repetitions of a service or product.
5726         */
5727        @Child(name = "quantity", type = {Quantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
5728        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
5729        protected Quantity quantity;
5730
5731        /**
5732         * 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.
5733         */
5734        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
5735        @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." )
5736        protected Money unitPrice;
5737
5738        /**
5739         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
5740         */
5741        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
5742        @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." )
5743        protected DecimalType factor;
5744
5745        /**
5746         * The quantity times the unit price for an additional service or product or charge.
5747         */
5748        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
5749        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
5750        protected Money net;
5751
5752        /**
5753         * Unique Device Identifiers associated with this line item.
5754         */
5755        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5756        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
5757        protected List<Reference> udi;
5758        /**
5759         * The actual objects that are the target of the reference (Unique Device Identifiers associated with this line item.)
5760         */
5761        protected List<Device> udiTarget;
5762
5763
5764        /**
5765         * The numbers associated with notes below which apply to the adjudication of this item.
5766         */
5767        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5768        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
5769        protected List<PositiveIntType> noteNumber;
5770
5771        /**
5772         * The adjudication results.
5773         */
5774        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5775        @Description(shortDefinition="Detail level adjudication details", formalDefinition="The adjudication results." )
5776        protected List<AdjudicationComponent> adjudication;
5777
5778        /**
5779         * Third-tier of goods and services.
5780         */
5781        @Child(name = "subDetail", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5782        @Description(shortDefinition="Additional items", formalDefinition="Third-tier of goods and services." )
5783        protected List<SubDetailComponent> subDetail;
5784
5785        private static final long serialVersionUID = 225639798L;
5786
5787    /**
5788     * Constructor
5789     */
5790      public DetailComponent() {
5791        super();
5792      }
5793
5794    /**
5795     * Constructor
5796     */
5797      public DetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
5798        super();
5799        this.sequence = sequence;
5800        this.productOrService = productOrService;
5801      }
5802
5803        /**
5804         * @return {@link #sequence} (A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
5805         */
5806        public PositiveIntType getSequenceElement() { 
5807          if (this.sequence == null)
5808            if (Configuration.errorOnAutoCreate())
5809              throw new Error("Attempt to auto-create DetailComponent.sequence");
5810            else if (Configuration.doAutoCreate())
5811              this.sequence = new PositiveIntType(); // bb
5812          return this.sequence;
5813        }
5814
5815        public boolean hasSequenceElement() { 
5816          return this.sequence != null && !this.sequence.isEmpty();
5817        }
5818
5819        public boolean hasSequence() { 
5820          return this.sequence != null && !this.sequence.isEmpty();
5821        }
5822
5823        /**
5824         * @param value {@link #sequence} (A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
5825         */
5826        public DetailComponent setSequenceElement(PositiveIntType value) { 
5827          this.sequence = value;
5828          return this;
5829        }
5830
5831        /**
5832         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5833         */
5834        public int getSequence() { 
5835          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
5836        }
5837
5838        /**
5839         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5840         */
5841        public DetailComponent setSequence(int value) { 
5842            if (this.sequence == null)
5843              this.sequence = new PositiveIntType();
5844            this.sequence.setValue(value);
5845          return this;
5846        }
5847
5848        /**
5849         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5850         */
5851        public CodeableConcept getRevenue() { 
5852          if (this.revenue == null)
5853            if (Configuration.errorOnAutoCreate())
5854              throw new Error("Attempt to auto-create DetailComponent.revenue");
5855            else if (Configuration.doAutoCreate())
5856              this.revenue = new CodeableConcept(); // cc
5857          return this.revenue;
5858        }
5859
5860        public boolean hasRevenue() { 
5861          return this.revenue != null && !this.revenue.isEmpty();
5862        }
5863
5864        /**
5865         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5866         */
5867        public DetailComponent setRevenue(CodeableConcept value) { 
5868          this.revenue = value;
5869          return this;
5870        }
5871
5872        /**
5873         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5874         */
5875        public CodeableConcept getCategory() { 
5876          if (this.category == null)
5877            if (Configuration.errorOnAutoCreate())
5878              throw new Error("Attempt to auto-create DetailComponent.category");
5879            else if (Configuration.doAutoCreate())
5880              this.category = new CodeableConcept(); // cc
5881          return this.category;
5882        }
5883
5884        public boolean hasCategory() { 
5885          return this.category != null && !this.category.isEmpty();
5886        }
5887
5888        /**
5889         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5890         */
5891        public DetailComponent setCategory(CodeableConcept value) { 
5892          this.category = value;
5893          return this;
5894        }
5895
5896        /**
5897         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
5898         */
5899        public CodeableConcept getProductOrService() { 
5900          if (this.productOrService == null)
5901            if (Configuration.errorOnAutoCreate())
5902              throw new Error("Attempt to auto-create DetailComponent.productOrService");
5903            else if (Configuration.doAutoCreate())
5904              this.productOrService = new CodeableConcept(); // cc
5905          return this.productOrService;
5906        }
5907
5908        public boolean hasProductOrService() { 
5909          return this.productOrService != null && !this.productOrService.isEmpty();
5910        }
5911
5912        /**
5913         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
5914         */
5915        public DetailComponent setProductOrService(CodeableConcept value) { 
5916          this.productOrService = value;
5917          return this;
5918        }
5919
5920        /**
5921         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
5922         */
5923        public List<CodeableConcept> getModifier() { 
5924          if (this.modifier == null)
5925            this.modifier = new ArrayList<CodeableConcept>();
5926          return this.modifier;
5927        }
5928
5929        /**
5930         * @return Returns a reference to <code>this</code> for easy method chaining
5931         */
5932        public DetailComponent setModifier(List<CodeableConcept> theModifier) { 
5933          this.modifier = theModifier;
5934          return this;
5935        }
5936
5937        public boolean hasModifier() { 
5938          if (this.modifier == null)
5939            return false;
5940          for (CodeableConcept item : this.modifier)
5941            if (!item.isEmpty())
5942              return true;
5943          return false;
5944        }
5945
5946        public CodeableConcept addModifier() { //3
5947          CodeableConcept t = new CodeableConcept();
5948          if (this.modifier == null)
5949            this.modifier = new ArrayList<CodeableConcept>();
5950          this.modifier.add(t);
5951          return t;
5952        }
5953
5954        public DetailComponent addModifier(CodeableConcept t) { //3
5955          if (t == null)
5956            return this;
5957          if (this.modifier == null)
5958            this.modifier = new ArrayList<CodeableConcept>();
5959          this.modifier.add(t);
5960          return this;
5961        }
5962
5963        /**
5964         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
5965         */
5966        public CodeableConcept getModifierFirstRep() { 
5967          if (getModifier().isEmpty()) {
5968            addModifier();
5969          }
5970          return getModifier().get(0);
5971        }
5972
5973        /**
5974         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
5975         */
5976        public List<CodeableConcept> getProgramCode() { 
5977          if (this.programCode == null)
5978            this.programCode = new ArrayList<CodeableConcept>();
5979          return this.programCode;
5980        }
5981
5982        /**
5983         * @return Returns a reference to <code>this</code> for easy method chaining
5984         */
5985        public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
5986          this.programCode = theProgramCode;
5987          return this;
5988        }
5989
5990        public boolean hasProgramCode() { 
5991          if (this.programCode == null)
5992            return false;
5993          for (CodeableConcept item : this.programCode)
5994            if (!item.isEmpty())
5995              return true;
5996          return false;
5997        }
5998
5999        public CodeableConcept addProgramCode() { //3
6000          CodeableConcept t = new CodeableConcept();
6001          if (this.programCode == null)
6002            this.programCode = new ArrayList<CodeableConcept>();
6003          this.programCode.add(t);
6004          return t;
6005        }
6006
6007        public DetailComponent addProgramCode(CodeableConcept t) { //3
6008          if (t == null)
6009            return this;
6010          if (this.programCode == null)
6011            this.programCode = new ArrayList<CodeableConcept>();
6012          this.programCode.add(t);
6013          return this;
6014        }
6015
6016        /**
6017         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
6018         */
6019        public CodeableConcept getProgramCodeFirstRep() { 
6020          if (getProgramCode().isEmpty()) {
6021            addProgramCode();
6022          }
6023          return getProgramCode().get(0);
6024        }
6025
6026        /**
6027         * @return {@link #quantity} (The number of repetitions of a service or product.)
6028         */
6029        public Quantity getQuantity() { 
6030          if (this.quantity == null)
6031            if (Configuration.errorOnAutoCreate())
6032              throw new Error("Attempt to auto-create DetailComponent.quantity");
6033            else if (Configuration.doAutoCreate())
6034              this.quantity = new Quantity(); // cc
6035          return this.quantity;
6036        }
6037
6038        public boolean hasQuantity() { 
6039          return this.quantity != null && !this.quantity.isEmpty();
6040        }
6041
6042        /**
6043         * @param value {@link #quantity} (The number of repetitions of a service or product.)
6044         */
6045        public DetailComponent setQuantity(Quantity value) { 
6046          this.quantity = value;
6047          return this;
6048        }
6049
6050        /**
6051         * @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.)
6052         */
6053        public Money getUnitPrice() { 
6054          if (this.unitPrice == null)
6055            if (Configuration.errorOnAutoCreate())
6056              throw new Error("Attempt to auto-create DetailComponent.unitPrice");
6057            else if (Configuration.doAutoCreate())
6058              this.unitPrice = new Money(); // cc
6059          return this.unitPrice;
6060        }
6061
6062        public boolean hasUnitPrice() { 
6063          return this.unitPrice != null && !this.unitPrice.isEmpty();
6064        }
6065
6066        /**
6067         * @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.)
6068         */
6069        public DetailComponent setUnitPrice(Money value) { 
6070          this.unitPrice = value;
6071          return this;
6072        }
6073
6074        /**
6075         * @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
6076         */
6077        public DecimalType getFactorElement() { 
6078          if (this.factor == null)
6079            if (Configuration.errorOnAutoCreate())
6080              throw new Error("Attempt to auto-create DetailComponent.factor");
6081            else if (Configuration.doAutoCreate())
6082              this.factor = new DecimalType(); // bb
6083          return this.factor;
6084        }
6085
6086        public boolean hasFactorElement() { 
6087          return this.factor != null && !this.factor.isEmpty();
6088        }
6089
6090        public boolean hasFactor() { 
6091          return this.factor != null && !this.factor.isEmpty();
6092        }
6093
6094        /**
6095         * @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
6096         */
6097        public DetailComponent setFactorElement(DecimalType value) { 
6098          this.factor = value;
6099          return this;
6100        }
6101
6102        /**
6103         * @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.
6104         */
6105        public BigDecimal getFactor() { 
6106          return this.factor == null ? null : this.factor.getValue();
6107        }
6108
6109        /**
6110         * @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.
6111         */
6112        public DetailComponent setFactor(BigDecimal value) { 
6113          if (value == null)
6114            this.factor = null;
6115          else {
6116            if (this.factor == null)
6117              this.factor = new DecimalType();
6118            this.factor.setValue(value);
6119          }
6120          return this;
6121        }
6122
6123        /**
6124         * @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.
6125         */
6126        public DetailComponent setFactor(long value) { 
6127              this.factor = new DecimalType();
6128            this.factor.setValue(value);
6129          return this;
6130        }
6131
6132        /**
6133         * @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.
6134         */
6135        public DetailComponent setFactor(double value) { 
6136              this.factor = new DecimalType();
6137            this.factor.setValue(value);
6138          return this;
6139        }
6140
6141        /**
6142         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
6143         */
6144        public Money getNet() { 
6145          if (this.net == null)
6146            if (Configuration.errorOnAutoCreate())
6147              throw new Error("Attempt to auto-create DetailComponent.net");
6148            else if (Configuration.doAutoCreate())
6149              this.net = new Money(); // cc
6150          return this.net;
6151        }
6152
6153        public boolean hasNet() { 
6154          return this.net != null && !this.net.isEmpty();
6155        }
6156
6157        /**
6158         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
6159         */
6160        public DetailComponent setNet(Money value) { 
6161          this.net = value;
6162          return this;
6163        }
6164
6165        /**
6166         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
6167         */
6168        public List<Reference> getUdi() { 
6169          if (this.udi == null)
6170            this.udi = new ArrayList<Reference>();
6171          return this.udi;
6172        }
6173
6174        /**
6175         * @return Returns a reference to <code>this</code> for easy method chaining
6176         */
6177        public DetailComponent setUdi(List<Reference> theUdi) { 
6178          this.udi = theUdi;
6179          return this;
6180        }
6181
6182        public boolean hasUdi() { 
6183          if (this.udi == null)
6184            return false;
6185          for (Reference item : this.udi)
6186            if (!item.isEmpty())
6187              return true;
6188          return false;
6189        }
6190
6191        public Reference addUdi() { //3
6192          Reference t = new Reference();
6193          if (this.udi == null)
6194            this.udi = new ArrayList<Reference>();
6195          this.udi.add(t);
6196          return t;
6197        }
6198
6199        public DetailComponent addUdi(Reference t) { //3
6200          if (t == null)
6201            return this;
6202          if (this.udi == null)
6203            this.udi = new ArrayList<Reference>();
6204          this.udi.add(t);
6205          return this;
6206        }
6207
6208        /**
6209         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
6210         */
6211        public Reference getUdiFirstRep() { 
6212          if (getUdi().isEmpty()) {
6213            addUdi();
6214          }
6215          return getUdi().get(0);
6216        }
6217
6218        /**
6219         * @deprecated Use Reference#setResource(IBaseResource) instead
6220         */
6221        @Deprecated
6222        public List<Device> getUdiTarget() { 
6223          if (this.udiTarget == null)
6224            this.udiTarget = new ArrayList<Device>();
6225          return this.udiTarget;
6226        }
6227
6228        /**
6229         * @deprecated Use Reference#setResource(IBaseResource) instead
6230         */
6231        @Deprecated
6232        public Device addUdiTarget() { 
6233          Device r = new Device();
6234          if (this.udiTarget == null)
6235            this.udiTarget = new ArrayList<Device>();
6236          this.udiTarget.add(r);
6237          return r;
6238        }
6239
6240        /**
6241         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6242         */
6243        public List<PositiveIntType> getNoteNumber() { 
6244          if (this.noteNumber == null)
6245            this.noteNumber = new ArrayList<PositiveIntType>();
6246          return this.noteNumber;
6247        }
6248
6249        /**
6250         * @return Returns a reference to <code>this</code> for easy method chaining
6251         */
6252        public DetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
6253          this.noteNumber = theNoteNumber;
6254          return this;
6255        }
6256
6257        public boolean hasNoteNumber() { 
6258          if (this.noteNumber == null)
6259            return false;
6260          for (PositiveIntType item : this.noteNumber)
6261            if (!item.isEmpty())
6262              return true;
6263          return false;
6264        }
6265
6266        /**
6267         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6268         */
6269        public PositiveIntType addNoteNumberElement() {//2 
6270          PositiveIntType t = new PositiveIntType();
6271          if (this.noteNumber == null)
6272            this.noteNumber = new ArrayList<PositiveIntType>();
6273          this.noteNumber.add(t);
6274          return t;
6275        }
6276
6277        /**
6278         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6279         */
6280        public DetailComponent addNoteNumber(int value) { //1
6281          PositiveIntType t = new PositiveIntType();
6282          t.setValue(value);
6283          if (this.noteNumber == null)
6284            this.noteNumber = new ArrayList<PositiveIntType>();
6285          this.noteNumber.add(t);
6286          return this;
6287        }
6288
6289        /**
6290         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6291         */
6292        public boolean hasNoteNumber(int value) { 
6293          if (this.noteNumber == null)
6294            return false;
6295          for (PositiveIntType v : this.noteNumber)
6296            if (v.getValue().equals(value)) // positiveInt
6297              return true;
6298          return false;
6299        }
6300
6301        /**
6302         * @return {@link #adjudication} (The adjudication results.)
6303         */
6304        public List<AdjudicationComponent> getAdjudication() { 
6305          if (this.adjudication == null)
6306            this.adjudication = new ArrayList<AdjudicationComponent>();
6307          return this.adjudication;
6308        }
6309
6310        /**
6311         * @return Returns a reference to <code>this</code> for easy method chaining
6312         */
6313        public DetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
6314          this.adjudication = theAdjudication;
6315          return this;
6316        }
6317
6318        public boolean hasAdjudication() { 
6319          if (this.adjudication == null)
6320            return false;
6321          for (AdjudicationComponent item : this.adjudication)
6322            if (!item.isEmpty())
6323              return true;
6324          return false;
6325        }
6326
6327        public AdjudicationComponent addAdjudication() { //3
6328          AdjudicationComponent t = new AdjudicationComponent();
6329          if (this.adjudication == null)
6330            this.adjudication = new ArrayList<AdjudicationComponent>();
6331          this.adjudication.add(t);
6332          return t;
6333        }
6334
6335        public DetailComponent addAdjudication(AdjudicationComponent t) { //3
6336          if (t == null)
6337            return this;
6338          if (this.adjudication == null)
6339            this.adjudication = new ArrayList<AdjudicationComponent>();
6340          this.adjudication.add(t);
6341          return this;
6342        }
6343
6344        /**
6345         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
6346         */
6347        public AdjudicationComponent getAdjudicationFirstRep() { 
6348          if (getAdjudication().isEmpty()) {
6349            addAdjudication();
6350          }
6351          return getAdjudication().get(0);
6352        }
6353
6354        /**
6355         * @return {@link #subDetail} (Third-tier of goods and services.)
6356         */
6357        public List<SubDetailComponent> getSubDetail() { 
6358          if (this.subDetail == null)
6359            this.subDetail = new ArrayList<SubDetailComponent>();
6360          return this.subDetail;
6361        }
6362
6363        /**
6364         * @return Returns a reference to <code>this</code> for easy method chaining
6365         */
6366        public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) { 
6367          this.subDetail = theSubDetail;
6368          return this;
6369        }
6370
6371        public boolean hasSubDetail() { 
6372          if (this.subDetail == null)
6373            return false;
6374          for (SubDetailComponent item : this.subDetail)
6375            if (!item.isEmpty())
6376              return true;
6377          return false;
6378        }
6379
6380        public SubDetailComponent addSubDetail() { //3
6381          SubDetailComponent t = new SubDetailComponent();
6382          if (this.subDetail == null)
6383            this.subDetail = new ArrayList<SubDetailComponent>();
6384          this.subDetail.add(t);
6385          return t;
6386        }
6387
6388        public DetailComponent addSubDetail(SubDetailComponent t) { //3
6389          if (t == null)
6390            return this;
6391          if (this.subDetail == null)
6392            this.subDetail = new ArrayList<SubDetailComponent>();
6393          this.subDetail.add(t);
6394          return this;
6395        }
6396
6397        /**
6398         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist
6399         */
6400        public SubDetailComponent getSubDetailFirstRep() { 
6401          if (getSubDetail().isEmpty()) {
6402            addSubDetail();
6403          }
6404          return getSubDetail().get(0);
6405        }
6406
6407        protected void listChildren(List<Property> children) {
6408          super.listChildren(children);
6409          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));
6410          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
6411          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
6412          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));
6413          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));
6414          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
6415          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
6416          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));
6417          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));
6418          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
6419          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
6420          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));
6421          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6422          children.add(new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
6423        }
6424
6425        @Override
6426        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6427          switch (_hash) {
6428          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);
6429          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
6430          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);
6431          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);
6432          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);
6433          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
6434          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
6435          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);
6436          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);
6437          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);
6438          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
6439          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);
6440          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
6441          case -828829007: /*subDetail*/  return new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
6442          default: return super.getNamedProperty(_hash, _name, _checkValid);
6443          }
6444
6445        }
6446
6447      @Override
6448      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6449        switch (hash) {
6450        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
6451        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
6452        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
6453        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
6454        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
6455        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
6456        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
6457        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6458        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6459        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6460        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
6461        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
6462        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
6463        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
6464        default: return super.getProperty(hash, name, checkValid);
6465        }
6466
6467      }
6468
6469      @Override
6470      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6471        switch (hash) {
6472        case 1349547969: // sequence
6473          this.sequence = castToPositiveInt(value); // PositiveIntType
6474          return value;
6475        case 1099842588: // revenue
6476          this.revenue = castToCodeableConcept(value); // CodeableConcept
6477          return value;
6478        case 50511102: // category
6479          this.category = castToCodeableConcept(value); // CodeableConcept
6480          return value;
6481        case 1957227299: // productOrService
6482          this.productOrService = castToCodeableConcept(value); // CodeableConcept
6483          return value;
6484        case -615513385: // modifier
6485          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
6486          return value;
6487        case 1010065041: // programCode
6488          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
6489          return value;
6490        case -1285004149: // quantity
6491          this.quantity = castToQuantity(value); // Quantity
6492          return value;
6493        case -486196699: // unitPrice
6494          this.unitPrice = castToMoney(value); // Money
6495          return value;
6496        case -1282148017: // factor
6497          this.factor = castToDecimal(value); // DecimalType
6498          return value;
6499        case 108957: // net
6500          this.net = castToMoney(value); // Money
6501          return value;
6502        case 115642: // udi
6503          this.getUdi().add(castToReference(value)); // Reference
6504          return value;
6505        case -1110033957: // noteNumber
6506          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
6507          return value;
6508        case -231349275: // adjudication
6509          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
6510          return value;
6511        case -828829007: // subDetail
6512          this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
6513          return value;
6514        default: return super.setProperty(hash, name, value);
6515        }
6516
6517      }
6518
6519      @Override
6520      public Base setProperty(String name, Base value) throws FHIRException {
6521        if (name.equals("sequence")) {
6522          this.sequence = castToPositiveInt(value); // PositiveIntType
6523        } else if (name.equals("revenue")) {
6524          this.revenue = castToCodeableConcept(value); // CodeableConcept
6525        } else if (name.equals("category")) {
6526          this.category = castToCodeableConcept(value); // CodeableConcept
6527        } else if (name.equals("productOrService")) {
6528          this.productOrService = castToCodeableConcept(value); // CodeableConcept
6529        } else if (name.equals("modifier")) {
6530          this.getModifier().add(castToCodeableConcept(value));
6531        } else if (name.equals("programCode")) {
6532          this.getProgramCode().add(castToCodeableConcept(value));
6533        } else if (name.equals("quantity")) {
6534          this.quantity = castToQuantity(value); // Quantity
6535        } else if (name.equals("unitPrice")) {
6536          this.unitPrice = castToMoney(value); // Money
6537        } else if (name.equals("factor")) {
6538          this.factor = castToDecimal(value); // DecimalType
6539        } else if (name.equals("net")) {
6540          this.net = castToMoney(value); // Money
6541        } else if (name.equals("udi")) {
6542          this.getUdi().add(castToReference(value));
6543        } else if (name.equals("noteNumber")) {
6544          this.getNoteNumber().add(castToPositiveInt(value));
6545        } else if (name.equals("adjudication")) {
6546          this.getAdjudication().add((AdjudicationComponent) value);
6547        } else if (name.equals("subDetail")) {
6548          this.getSubDetail().add((SubDetailComponent) value);
6549        } else
6550          return super.setProperty(name, value);
6551        return value;
6552      }
6553
6554      @Override
6555      public Base makeProperty(int hash, String name) throws FHIRException {
6556        switch (hash) {
6557        case 1349547969:  return getSequenceElement();
6558        case 1099842588:  return getRevenue(); 
6559        case 50511102:  return getCategory(); 
6560        case 1957227299:  return getProductOrService(); 
6561        case -615513385:  return addModifier(); 
6562        case 1010065041:  return addProgramCode(); 
6563        case -1285004149:  return getQuantity(); 
6564        case -486196699:  return getUnitPrice(); 
6565        case -1282148017:  return getFactorElement();
6566        case 108957:  return getNet(); 
6567        case 115642:  return addUdi(); 
6568        case -1110033957:  return addNoteNumberElement();
6569        case -231349275:  return addAdjudication(); 
6570        case -828829007:  return addSubDetail(); 
6571        default: return super.makeProperty(hash, name);
6572        }
6573
6574      }
6575
6576      @Override
6577      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6578        switch (hash) {
6579        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
6580        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
6581        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
6582        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
6583        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
6584        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
6585        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
6586        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6587        case -1282148017: /*factor*/ return new String[] {"decimal"};
6588        case 108957: /*net*/ return new String[] {"Money"};
6589        case 115642: /*udi*/ return new String[] {"Reference"};
6590        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
6591        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
6592        case -828829007: /*subDetail*/ return new String[] {};
6593        default: return super.getTypesForProperty(hash, name);
6594        }
6595
6596      }
6597
6598      @Override
6599      public Base addChild(String name) throws FHIRException {
6600        if (name.equals("sequence")) {
6601          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
6602        }
6603        else if (name.equals("revenue")) {
6604          this.revenue = new CodeableConcept();
6605          return this.revenue;
6606        }
6607        else if (name.equals("category")) {
6608          this.category = new CodeableConcept();
6609          return this.category;
6610        }
6611        else if (name.equals("productOrService")) {
6612          this.productOrService = new CodeableConcept();
6613          return this.productOrService;
6614        }
6615        else if (name.equals("modifier")) {
6616          return addModifier();
6617        }
6618        else if (name.equals("programCode")) {
6619          return addProgramCode();
6620        }
6621        else if (name.equals("quantity")) {
6622          this.quantity = new Quantity();
6623          return this.quantity;
6624        }
6625        else if (name.equals("unitPrice")) {
6626          this.unitPrice = new Money();
6627          return this.unitPrice;
6628        }
6629        else if (name.equals("factor")) {
6630          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
6631        }
6632        else if (name.equals("net")) {
6633          this.net = new Money();
6634          return this.net;
6635        }
6636        else if (name.equals("udi")) {
6637          return addUdi();
6638        }
6639        else if (name.equals("noteNumber")) {
6640          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
6641        }
6642        else if (name.equals("adjudication")) {
6643          return addAdjudication();
6644        }
6645        else if (name.equals("subDetail")) {
6646          return addSubDetail();
6647        }
6648        else
6649          return super.addChild(name);
6650      }
6651
6652      public DetailComponent copy() {
6653        DetailComponent dst = new DetailComponent();
6654        copyValues(dst);
6655        return dst;
6656      }
6657
6658      public void copyValues(DetailComponent dst) {
6659        super.copyValues(dst);
6660        dst.sequence = sequence == null ? null : sequence.copy();
6661        dst.revenue = revenue == null ? null : revenue.copy();
6662        dst.category = category == null ? null : category.copy();
6663        dst.productOrService = productOrService == null ? null : productOrService.copy();
6664        if (modifier != null) {
6665          dst.modifier = new ArrayList<CodeableConcept>();
6666          for (CodeableConcept i : modifier)
6667            dst.modifier.add(i.copy());
6668        };
6669        if (programCode != null) {
6670          dst.programCode = new ArrayList<CodeableConcept>();
6671          for (CodeableConcept i : programCode)
6672            dst.programCode.add(i.copy());
6673        };
6674        dst.quantity = quantity == null ? null : quantity.copy();
6675        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6676        dst.factor = factor == null ? null : factor.copy();
6677        dst.net = net == null ? null : net.copy();
6678        if (udi != null) {
6679          dst.udi = new ArrayList<Reference>();
6680          for (Reference i : udi)
6681            dst.udi.add(i.copy());
6682        };
6683        if (noteNumber != null) {
6684          dst.noteNumber = new ArrayList<PositiveIntType>();
6685          for (PositiveIntType i : noteNumber)
6686            dst.noteNumber.add(i.copy());
6687        };
6688        if (adjudication != null) {
6689          dst.adjudication = new ArrayList<AdjudicationComponent>();
6690          for (AdjudicationComponent i : adjudication)
6691            dst.adjudication.add(i.copy());
6692        };
6693        if (subDetail != null) {
6694          dst.subDetail = new ArrayList<SubDetailComponent>();
6695          for (SubDetailComponent i : subDetail)
6696            dst.subDetail.add(i.copy());
6697        };
6698      }
6699
6700      @Override
6701      public boolean equalsDeep(Base other_) {
6702        if (!super.equalsDeep(other_))
6703          return false;
6704        if (!(other_ instanceof DetailComponent))
6705          return false;
6706        DetailComponent o = (DetailComponent) other_;
6707        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
6708           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
6709           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
6710           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
6711           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
6712           && compareDeep(subDetail, o.subDetail, true);
6713      }
6714
6715      @Override
6716      public boolean equalsShallow(Base other_) {
6717        if (!super.equalsShallow(other_))
6718          return false;
6719        if (!(other_ instanceof DetailComponent))
6720          return false;
6721        DetailComponent o = (DetailComponent) other_;
6722        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
6723          ;
6724      }
6725
6726      public boolean isEmpty() {
6727        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
6728          , productOrService, modifier, programCode, quantity, unitPrice, factor, net, udi
6729          , noteNumber, adjudication, subDetail);
6730      }
6731
6732  public String fhirType() {
6733    return "ExplanationOfBenefit.item.detail";
6734
6735  }
6736
6737  }
6738
6739    @Block()
6740    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
6741        /**
6742         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6743         */
6744        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
6745        @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." )
6746        protected PositiveIntType sequence;
6747
6748        /**
6749         * The type of revenue or cost center providing the product and/or service.
6750         */
6751        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
6752        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
6753        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
6754        protected CodeableConcept revenue;
6755
6756        /**
6757         * Code to identify the general type of benefits under which products and services are provided.
6758         */
6759        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
6760        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
6761        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
6762        protected CodeableConcept category;
6763
6764        /**
6765         * 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.
6766         */
6767        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
6768        @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." )
6769        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
6770        protected CodeableConcept productOrService;
6771
6772        /**
6773         * Item typification or modifiers codes to convey additional context for the product or service.
6774         */
6775        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6776        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
6777        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
6778        protected List<CodeableConcept> modifier;
6779
6780        /**
6781         * Identifies the program under which this may be recovered.
6782         */
6783        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6784        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
6785        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
6786        protected List<CodeableConcept> programCode;
6787
6788        /**
6789         * The number of repetitions of a service or product.
6790         */
6791        @Child(name = "quantity", type = {Quantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
6792        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
6793        protected Quantity quantity;
6794
6795        /**
6796         * 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.
6797         */
6798        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
6799        @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." )
6800        protected Money unitPrice;
6801
6802        /**
6803         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
6804         */
6805        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
6806        @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." )
6807        protected DecimalType factor;
6808
6809        /**
6810         * The quantity times the unit price for an additional service or product or charge.
6811         */
6812        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
6813        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
6814        protected Money net;
6815
6816        /**
6817         * Unique Device Identifiers associated with this line item.
6818         */
6819        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6820        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
6821        protected List<Reference> udi;
6822        /**
6823         * The actual objects that are the target of the reference (Unique Device Identifiers associated with this line item.)
6824         */
6825        protected List<Device> udiTarget;
6826
6827
6828        /**
6829         * The numbers associated with notes below which apply to the adjudication of this item.
6830         */
6831        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6832        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
6833        protected List<PositiveIntType> noteNumber;
6834
6835        /**
6836         * The adjudication results.
6837         */
6838        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6839        @Description(shortDefinition="Subdetail level adjudication details", formalDefinition="The adjudication results." )
6840        protected List<AdjudicationComponent> adjudication;
6841
6842        private static final long serialVersionUID = -996156853L;
6843
6844    /**
6845     * Constructor
6846     */
6847      public SubDetailComponent() {
6848        super();
6849      }
6850
6851    /**
6852     * Constructor
6853     */
6854      public SubDetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
6855        super();
6856        this.sequence = sequence;
6857        this.productOrService = productOrService;
6858      }
6859
6860        /**
6861         * @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
6862         */
6863        public PositiveIntType getSequenceElement() { 
6864          if (this.sequence == null)
6865            if (Configuration.errorOnAutoCreate())
6866              throw new Error("Attempt to auto-create SubDetailComponent.sequence");
6867            else if (Configuration.doAutoCreate())
6868              this.sequence = new PositiveIntType(); // bb
6869          return this.sequence;
6870        }
6871
6872        public boolean hasSequenceElement() { 
6873          return this.sequence != null && !this.sequence.isEmpty();
6874        }
6875
6876        public boolean hasSequence() { 
6877          return this.sequence != null && !this.sequence.isEmpty();
6878        }
6879
6880        /**
6881         * @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
6882         */
6883        public SubDetailComponent setSequenceElement(PositiveIntType value) { 
6884          this.sequence = value;
6885          return this;
6886        }
6887
6888        /**
6889         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6890         */
6891        public int getSequence() { 
6892          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
6893        }
6894
6895        /**
6896         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6897         */
6898        public SubDetailComponent setSequence(int value) { 
6899            if (this.sequence == null)
6900              this.sequence = new PositiveIntType();
6901            this.sequence.setValue(value);
6902          return this;
6903        }
6904
6905        /**
6906         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
6907         */
6908        public CodeableConcept getRevenue() { 
6909          if (this.revenue == null)
6910            if (Configuration.errorOnAutoCreate())
6911              throw new Error("Attempt to auto-create SubDetailComponent.revenue");
6912            else if (Configuration.doAutoCreate())
6913              this.revenue = new CodeableConcept(); // cc
6914          return this.revenue;
6915        }
6916
6917        public boolean hasRevenue() { 
6918          return this.revenue != null && !this.revenue.isEmpty();
6919        }
6920
6921        /**
6922         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
6923         */
6924        public SubDetailComponent setRevenue(CodeableConcept value) { 
6925          this.revenue = value;
6926          return this;
6927        }
6928
6929        /**
6930         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
6931         */
6932        public CodeableConcept getCategory() { 
6933          if (this.category == null)
6934            if (Configuration.errorOnAutoCreate())
6935              throw new Error("Attempt to auto-create SubDetailComponent.category");
6936            else if (Configuration.doAutoCreate())
6937              this.category = new CodeableConcept(); // cc
6938          return this.category;
6939        }
6940
6941        public boolean hasCategory() { 
6942          return this.category != null && !this.category.isEmpty();
6943        }
6944
6945        /**
6946         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
6947         */
6948        public SubDetailComponent setCategory(CodeableConcept value) { 
6949          this.category = value;
6950          return this;
6951        }
6952
6953        /**
6954         * @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.)
6955         */
6956        public CodeableConcept getProductOrService() { 
6957          if (this.productOrService == null)
6958            if (Configuration.errorOnAutoCreate())
6959              throw new Error("Attempt to auto-create SubDetailComponent.productOrService");
6960            else if (Configuration.doAutoCreate())
6961              this.productOrService = new CodeableConcept(); // cc
6962          return this.productOrService;
6963        }
6964
6965        public boolean hasProductOrService() { 
6966          return this.productOrService != null && !this.productOrService.isEmpty();
6967        }
6968
6969        /**
6970         * @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.)
6971         */
6972        public SubDetailComponent setProductOrService(CodeableConcept value) { 
6973          this.productOrService = value;
6974          return this;
6975        }
6976
6977        /**
6978         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
6979         */
6980        public List<CodeableConcept> getModifier() { 
6981          if (this.modifier == null)
6982            this.modifier = new ArrayList<CodeableConcept>();
6983          return this.modifier;
6984        }
6985
6986        /**
6987         * @return Returns a reference to <code>this</code> for easy method chaining
6988         */
6989        public SubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
6990          this.modifier = theModifier;
6991          return this;
6992        }
6993
6994        public boolean hasModifier() { 
6995          if (this.modifier == null)
6996            return false;
6997          for (CodeableConcept item : this.modifier)
6998            if (!item.isEmpty())
6999              return true;
7000          return false;
7001        }
7002
7003        public CodeableConcept addModifier() { //3
7004          CodeableConcept t = new CodeableConcept();
7005          if (this.modifier == null)
7006            this.modifier = new ArrayList<CodeableConcept>();
7007          this.modifier.add(t);
7008          return t;
7009        }
7010
7011        public SubDetailComponent addModifier(CodeableConcept t) { //3
7012          if (t == null)
7013            return this;
7014          if (this.modifier == null)
7015            this.modifier = new ArrayList<CodeableConcept>();
7016          this.modifier.add(t);
7017          return this;
7018        }
7019
7020        /**
7021         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
7022         */
7023        public CodeableConcept getModifierFirstRep() { 
7024          if (getModifier().isEmpty()) {
7025            addModifier();
7026          }
7027          return getModifier().get(0);
7028        }
7029
7030        /**
7031         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
7032         */
7033        public List<CodeableConcept> getProgramCode() { 
7034          if (this.programCode == null)
7035            this.programCode = new ArrayList<CodeableConcept>();
7036          return this.programCode;
7037        }
7038
7039        /**
7040         * @return Returns a reference to <code>this</code> for easy method chaining
7041         */
7042        public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
7043          this.programCode = theProgramCode;
7044          return this;
7045        }
7046
7047        public boolean hasProgramCode() { 
7048          if (this.programCode == null)
7049            return false;
7050          for (CodeableConcept item : this.programCode)
7051            if (!item.isEmpty())
7052              return true;
7053          return false;
7054        }
7055
7056        public CodeableConcept addProgramCode() { //3
7057          CodeableConcept t = new CodeableConcept();
7058          if (this.programCode == null)
7059            this.programCode = new ArrayList<CodeableConcept>();
7060          this.programCode.add(t);
7061          return t;
7062        }
7063
7064        public SubDetailComponent addProgramCode(CodeableConcept t) { //3
7065          if (t == null)
7066            return this;
7067          if (this.programCode == null)
7068            this.programCode = new ArrayList<CodeableConcept>();
7069          this.programCode.add(t);
7070          return this;
7071        }
7072
7073        /**
7074         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
7075         */
7076        public CodeableConcept getProgramCodeFirstRep() { 
7077          if (getProgramCode().isEmpty()) {
7078            addProgramCode();
7079          }
7080          return getProgramCode().get(0);
7081        }
7082
7083        /**
7084         * @return {@link #quantity} (The number of repetitions of a service or product.)
7085         */
7086        public Quantity getQuantity() { 
7087          if (this.quantity == null)
7088            if (Configuration.errorOnAutoCreate())
7089              throw new Error("Attempt to auto-create SubDetailComponent.quantity");
7090            else if (Configuration.doAutoCreate())
7091              this.quantity = new Quantity(); // cc
7092          return this.quantity;
7093        }
7094
7095        public boolean hasQuantity() { 
7096          return this.quantity != null && !this.quantity.isEmpty();
7097        }
7098
7099        /**
7100         * @param value {@link #quantity} (The number of repetitions of a service or product.)
7101         */
7102        public SubDetailComponent setQuantity(Quantity value) { 
7103          this.quantity = value;
7104          return this;
7105        }
7106
7107        /**
7108         * @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.)
7109         */
7110        public Money getUnitPrice() { 
7111          if (this.unitPrice == null)
7112            if (Configuration.errorOnAutoCreate())
7113              throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
7114            else if (Configuration.doAutoCreate())
7115              this.unitPrice = new Money(); // cc
7116          return this.unitPrice;
7117        }
7118
7119        public boolean hasUnitPrice() { 
7120          return this.unitPrice != null && !this.unitPrice.isEmpty();
7121        }
7122
7123        /**
7124         * @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.)
7125         */
7126        public SubDetailComponent setUnitPrice(Money value) { 
7127          this.unitPrice = value;
7128          return this;
7129        }
7130
7131        /**
7132         * @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
7133         */
7134        public DecimalType getFactorElement() { 
7135          if (this.factor == null)
7136            if (Configuration.errorOnAutoCreate())
7137              throw new Error("Attempt to auto-create SubDetailComponent.factor");
7138            else if (Configuration.doAutoCreate())
7139              this.factor = new DecimalType(); // bb
7140          return this.factor;
7141        }
7142
7143        public boolean hasFactorElement() { 
7144          return this.factor != null && !this.factor.isEmpty();
7145        }
7146
7147        public boolean hasFactor() { 
7148          return this.factor != null && !this.factor.isEmpty();
7149        }
7150
7151        /**
7152         * @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
7153         */
7154        public SubDetailComponent setFactorElement(DecimalType value) { 
7155          this.factor = value;
7156          return this;
7157        }
7158
7159        /**
7160         * @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.
7161         */
7162        public BigDecimal getFactor() { 
7163          return this.factor == null ? null : this.factor.getValue();
7164        }
7165
7166        /**
7167         * @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.
7168         */
7169        public SubDetailComponent setFactor(BigDecimal value) { 
7170          if (value == null)
7171            this.factor = null;
7172          else {
7173            if (this.factor == null)
7174              this.factor = new DecimalType();
7175            this.factor.setValue(value);
7176          }
7177          return this;
7178        }
7179
7180        /**
7181         * @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.
7182         */
7183        public SubDetailComponent setFactor(long value) { 
7184              this.factor = new DecimalType();
7185            this.factor.setValue(value);
7186          return this;
7187        }
7188
7189        /**
7190         * @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.
7191         */
7192        public SubDetailComponent setFactor(double value) { 
7193              this.factor = new DecimalType();
7194            this.factor.setValue(value);
7195          return this;
7196        }
7197
7198        /**
7199         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
7200         */
7201        public Money getNet() { 
7202          if (this.net == null)
7203            if (Configuration.errorOnAutoCreate())
7204              throw new Error("Attempt to auto-create SubDetailComponent.net");
7205            else if (Configuration.doAutoCreate())
7206              this.net = new Money(); // cc
7207          return this.net;
7208        }
7209
7210        public boolean hasNet() { 
7211          return this.net != null && !this.net.isEmpty();
7212        }
7213
7214        /**
7215         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
7216         */
7217        public SubDetailComponent setNet(Money value) { 
7218          this.net = value;
7219          return this;
7220        }
7221
7222        /**
7223         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
7224         */
7225        public List<Reference> getUdi() { 
7226          if (this.udi == null)
7227            this.udi = new ArrayList<Reference>();
7228          return this.udi;
7229        }
7230
7231        /**
7232         * @return Returns a reference to <code>this</code> for easy method chaining
7233         */
7234        public SubDetailComponent setUdi(List<Reference> theUdi) { 
7235          this.udi = theUdi;
7236          return this;
7237        }
7238
7239        public boolean hasUdi() { 
7240          if (this.udi == null)
7241            return false;
7242          for (Reference item : this.udi)
7243            if (!item.isEmpty())
7244              return true;
7245          return false;
7246        }
7247
7248        public Reference addUdi() { //3
7249          Reference t = new Reference();
7250          if (this.udi == null)
7251            this.udi = new ArrayList<Reference>();
7252          this.udi.add(t);
7253          return t;
7254        }
7255
7256        public SubDetailComponent addUdi(Reference t) { //3
7257          if (t == null)
7258            return this;
7259          if (this.udi == null)
7260            this.udi = new ArrayList<Reference>();
7261          this.udi.add(t);
7262          return this;
7263        }
7264
7265        /**
7266         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
7267         */
7268        public Reference getUdiFirstRep() { 
7269          if (getUdi().isEmpty()) {
7270            addUdi();
7271          }
7272          return getUdi().get(0);
7273        }
7274
7275        /**
7276         * @deprecated Use Reference#setResource(IBaseResource) instead
7277         */
7278        @Deprecated
7279        public List<Device> getUdiTarget() { 
7280          if (this.udiTarget == null)
7281            this.udiTarget = new ArrayList<Device>();
7282          return this.udiTarget;
7283        }
7284
7285        /**
7286         * @deprecated Use Reference#setResource(IBaseResource) instead
7287         */
7288        @Deprecated
7289        public Device addUdiTarget() { 
7290          Device r = new Device();
7291          if (this.udiTarget == null)
7292            this.udiTarget = new ArrayList<Device>();
7293          this.udiTarget.add(r);
7294          return r;
7295        }
7296
7297        /**
7298         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7299         */
7300        public List<PositiveIntType> getNoteNumber() { 
7301          if (this.noteNumber == null)
7302            this.noteNumber = new ArrayList<PositiveIntType>();
7303          return this.noteNumber;
7304        }
7305
7306        /**
7307         * @return Returns a reference to <code>this</code> for easy method chaining
7308         */
7309        public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
7310          this.noteNumber = theNoteNumber;
7311          return this;
7312        }
7313
7314        public boolean hasNoteNumber() { 
7315          if (this.noteNumber == null)
7316            return false;
7317          for (PositiveIntType item : this.noteNumber)
7318            if (!item.isEmpty())
7319              return true;
7320          return false;
7321        }
7322
7323        /**
7324         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7325         */
7326        public PositiveIntType addNoteNumberElement() {//2 
7327          PositiveIntType t = new PositiveIntType();
7328          if (this.noteNumber == null)
7329            this.noteNumber = new ArrayList<PositiveIntType>();
7330          this.noteNumber.add(t);
7331          return t;
7332        }
7333
7334        /**
7335         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7336         */
7337        public SubDetailComponent addNoteNumber(int value) { //1
7338          PositiveIntType t = new PositiveIntType();
7339          t.setValue(value);
7340          if (this.noteNumber == null)
7341            this.noteNumber = new ArrayList<PositiveIntType>();
7342          this.noteNumber.add(t);
7343          return this;
7344        }
7345
7346        /**
7347         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7348         */
7349        public boolean hasNoteNumber(int value) { 
7350          if (this.noteNumber == null)
7351            return false;
7352          for (PositiveIntType v : this.noteNumber)
7353            if (v.getValue().equals(value)) // positiveInt
7354              return true;
7355          return false;
7356        }
7357
7358        /**
7359         * @return {@link #adjudication} (The adjudication results.)
7360         */
7361        public List<AdjudicationComponent> getAdjudication() { 
7362          if (this.adjudication == null)
7363            this.adjudication = new ArrayList<AdjudicationComponent>();
7364          return this.adjudication;
7365        }
7366
7367        /**
7368         * @return Returns a reference to <code>this</code> for easy method chaining
7369         */
7370        public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
7371          this.adjudication = theAdjudication;
7372          return this;
7373        }
7374
7375        public boolean hasAdjudication() { 
7376          if (this.adjudication == null)
7377            return false;
7378          for (AdjudicationComponent item : this.adjudication)
7379            if (!item.isEmpty())
7380              return true;
7381          return false;
7382        }
7383
7384        public AdjudicationComponent addAdjudication() { //3
7385          AdjudicationComponent t = new AdjudicationComponent();
7386          if (this.adjudication == null)
7387            this.adjudication = new ArrayList<AdjudicationComponent>();
7388          this.adjudication.add(t);
7389          return t;
7390        }
7391
7392        public SubDetailComponent addAdjudication(AdjudicationComponent t) { //3
7393          if (t == null)
7394            return this;
7395          if (this.adjudication == null)
7396            this.adjudication = new ArrayList<AdjudicationComponent>();
7397          this.adjudication.add(t);
7398          return this;
7399        }
7400
7401        /**
7402         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
7403         */
7404        public AdjudicationComponent getAdjudicationFirstRep() { 
7405          if (getAdjudication().isEmpty()) {
7406            addAdjudication();
7407          }
7408          return getAdjudication().get(0);
7409        }
7410
7411        protected void listChildren(List<Property> children) {
7412          super.listChildren(children);
7413          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));
7414          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
7415          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
7416          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));
7417          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));
7418          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
7419          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
7420          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));
7421          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));
7422          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
7423          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
7424          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));
7425          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
7426        }
7427
7428        @Override
7429        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7430          switch (_hash) {
7431          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);
7432          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
7433          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);
7434          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);
7435          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);
7436          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
7437          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
7438          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);
7439          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);
7440          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);
7441          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
7442          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);
7443          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
7444          default: return super.getNamedProperty(_hash, _name, _checkValid);
7445          }
7446
7447        }
7448
7449      @Override
7450      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7451        switch (hash) {
7452        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
7453        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
7454        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
7455        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
7456        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7457        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
7458        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
7459        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
7460        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
7461        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
7462        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
7463        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
7464        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
7465        default: return super.getProperty(hash, name, checkValid);
7466        }
7467
7468      }
7469
7470      @Override
7471      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7472        switch (hash) {
7473        case 1349547969: // sequence
7474          this.sequence = castToPositiveInt(value); // PositiveIntType
7475          return value;
7476        case 1099842588: // revenue
7477          this.revenue = castToCodeableConcept(value); // CodeableConcept
7478          return value;
7479        case 50511102: // category
7480          this.category = castToCodeableConcept(value); // CodeableConcept
7481          return value;
7482        case 1957227299: // productOrService
7483          this.productOrService = castToCodeableConcept(value); // CodeableConcept
7484          return value;
7485        case -615513385: // modifier
7486          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
7487          return value;
7488        case 1010065041: // programCode
7489          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
7490          return value;
7491        case -1285004149: // quantity
7492          this.quantity = castToQuantity(value); // Quantity
7493          return value;
7494        case -486196699: // unitPrice
7495          this.unitPrice = castToMoney(value); // Money
7496          return value;
7497        case -1282148017: // factor
7498          this.factor = castToDecimal(value); // DecimalType
7499          return value;
7500        case 108957: // net
7501          this.net = castToMoney(value); // Money
7502          return value;
7503        case 115642: // udi
7504          this.getUdi().add(castToReference(value)); // Reference
7505          return value;
7506        case -1110033957: // noteNumber
7507          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
7508          return value;
7509        case -231349275: // adjudication
7510          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7511          return value;
7512        default: return super.setProperty(hash, name, value);
7513        }
7514
7515      }
7516
7517      @Override
7518      public Base setProperty(String name, Base value) throws FHIRException {
7519        if (name.equals("sequence")) {
7520          this.sequence = castToPositiveInt(value); // PositiveIntType
7521        } else if (name.equals("revenue")) {
7522          this.revenue = castToCodeableConcept(value); // CodeableConcept
7523        } else if (name.equals("category")) {
7524          this.category = castToCodeableConcept(value); // CodeableConcept
7525        } else if (name.equals("productOrService")) {
7526          this.productOrService = castToCodeableConcept(value); // CodeableConcept
7527        } else if (name.equals("modifier")) {
7528          this.getModifier().add(castToCodeableConcept(value));
7529        } else if (name.equals("programCode")) {
7530          this.getProgramCode().add(castToCodeableConcept(value));
7531        } else if (name.equals("quantity")) {
7532          this.quantity = castToQuantity(value); // Quantity
7533        } else if (name.equals("unitPrice")) {
7534          this.unitPrice = castToMoney(value); // Money
7535        } else if (name.equals("factor")) {
7536          this.factor = castToDecimal(value); // DecimalType
7537        } else if (name.equals("net")) {
7538          this.net = castToMoney(value); // Money
7539        } else if (name.equals("udi")) {
7540          this.getUdi().add(castToReference(value));
7541        } else if (name.equals("noteNumber")) {
7542          this.getNoteNumber().add(castToPositiveInt(value));
7543        } else if (name.equals("adjudication")) {
7544          this.getAdjudication().add((AdjudicationComponent) value);
7545        } else
7546          return super.setProperty(name, value);
7547        return value;
7548      }
7549
7550      @Override
7551      public Base makeProperty(int hash, String name) throws FHIRException {
7552        switch (hash) {
7553        case 1349547969:  return getSequenceElement();
7554        case 1099842588:  return getRevenue(); 
7555        case 50511102:  return getCategory(); 
7556        case 1957227299:  return getProductOrService(); 
7557        case -615513385:  return addModifier(); 
7558        case 1010065041:  return addProgramCode(); 
7559        case -1285004149:  return getQuantity(); 
7560        case -486196699:  return getUnitPrice(); 
7561        case -1282148017:  return getFactorElement();
7562        case 108957:  return getNet(); 
7563        case 115642:  return addUdi(); 
7564        case -1110033957:  return addNoteNumberElement();
7565        case -231349275:  return addAdjudication(); 
7566        default: return super.makeProperty(hash, name);
7567        }
7568
7569      }
7570
7571      @Override
7572      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7573        switch (hash) {
7574        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
7575        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
7576        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
7577        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
7578        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
7579        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
7580        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
7581        case -486196699: /*unitPrice*/ return new String[] {"Money"};
7582        case -1282148017: /*factor*/ return new String[] {"decimal"};
7583        case 108957: /*net*/ return new String[] {"Money"};
7584        case 115642: /*udi*/ return new String[] {"Reference"};
7585        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
7586        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
7587        default: return super.getTypesForProperty(hash, name);
7588        }
7589
7590      }
7591
7592      @Override
7593      public Base addChild(String name) throws FHIRException {
7594        if (name.equals("sequence")) {
7595          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
7596        }
7597        else if (name.equals("revenue")) {
7598          this.revenue = new CodeableConcept();
7599          return this.revenue;
7600        }
7601        else if (name.equals("category")) {
7602          this.category = new CodeableConcept();
7603          return this.category;
7604        }
7605        else if (name.equals("productOrService")) {
7606          this.productOrService = new CodeableConcept();
7607          return this.productOrService;
7608        }
7609        else if (name.equals("modifier")) {
7610          return addModifier();
7611        }
7612        else if (name.equals("programCode")) {
7613          return addProgramCode();
7614        }
7615        else if (name.equals("quantity")) {
7616          this.quantity = new Quantity();
7617          return this.quantity;
7618        }
7619        else if (name.equals("unitPrice")) {
7620          this.unitPrice = new Money();
7621          return this.unitPrice;
7622        }
7623        else if (name.equals("factor")) {
7624          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
7625        }
7626        else if (name.equals("net")) {
7627          this.net = new Money();
7628          return this.net;
7629        }
7630        else if (name.equals("udi")) {
7631          return addUdi();
7632        }
7633        else if (name.equals("noteNumber")) {
7634          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
7635        }
7636        else if (name.equals("adjudication")) {
7637          return addAdjudication();
7638        }
7639        else
7640          return super.addChild(name);
7641      }
7642
7643      public SubDetailComponent copy() {
7644        SubDetailComponent dst = new SubDetailComponent();
7645        copyValues(dst);
7646        return dst;
7647      }
7648
7649      public void copyValues(SubDetailComponent dst) {
7650        super.copyValues(dst);
7651        dst.sequence = sequence == null ? null : sequence.copy();
7652        dst.revenue = revenue == null ? null : revenue.copy();
7653        dst.category = category == null ? null : category.copy();
7654        dst.productOrService = productOrService == null ? null : productOrService.copy();
7655        if (modifier != null) {
7656          dst.modifier = new ArrayList<CodeableConcept>();
7657          for (CodeableConcept i : modifier)
7658            dst.modifier.add(i.copy());
7659        };
7660        if (programCode != null) {
7661          dst.programCode = new ArrayList<CodeableConcept>();
7662          for (CodeableConcept i : programCode)
7663            dst.programCode.add(i.copy());
7664        };
7665        dst.quantity = quantity == null ? null : quantity.copy();
7666        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7667        dst.factor = factor == null ? null : factor.copy();
7668        dst.net = net == null ? null : net.copy();
7669        if (udi != null) {
7670          dst.udi = new ArrayList<Reference>();
7671          for (Reference i : udi)
7672            dst.udi.add(i.copy());
7673        };
7674        if (noteNumber != null) {
7675          dst.noteNumber = new ArrayList<PositiveIntType>();
7676          for (PositiveIntType i : noteNumber)
7677            dst.noteNumber.add(i.copy());
7678        };
7679        if (adjudication != null) {
7680          dst.adjudication = new ArrayList<AdjudicationComponent>();
7681          for (AdjudicationComponent i : adjudication)
7682            dst.adjudication.add(i.copy());
7683        };
7684      }
7685
7686      @Override
7687      public boolean equalsDeep(Base other_) {
7688        if (!super.equalsDeep(other_))
7689          return false;
7690        if (!(other_ instanceof SubDetailComponent))
7691          return false;
7692        SubDetailComponent o = (SubDetailComponent) other_;
7693        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
7694           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
7695           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
7696           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
7697           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
7698          ;
7699      }
7700
7701      @Override
7702      public boolean equalsShallow(Base other_) {
7703        if (!super.equalsShallow(other_))
7704          return false;
7705        if (!(other_ instanceof SubDetailComponent))
7706          return false;
7707        SubDetailComponent o = (SubDetailComponent) other_;
7708        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
7709          ;
7710      }
7711
7712      public boolean isEmpty() {
7713        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
7714          , productOrService, modifier, programCode, quantity, unitPrice, factor, net, udi
7715          , noteNumber, adjudication);
7716      }
7717
7718  public String fhirType() {
7719    return "ExplanationOfBenefit.item.detail.subDetail";
7720
7721  }
7722
7723  }
7724
7725    @Block()
7726    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
7727        /**
7728         * Claim items which this service line is intended to replace.
7729         */
7730        @Child(name = "itemSequence", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7731        @Description(shortDefinition="Item sequence number", formalDefinition="Claim items which this service line is intended to replace." )
7732        protected List<PositiveIntType> itemSequence;
7733
7734        /**
7735         * The sequence number of the details within the claim item which this line is intended to replace.
7736         */
7737        @Child(name = "detailSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7738        @Description(shortDefinition="Detail sequence number", formalDefinition="The sequence number of the details within the claim item which this line is intended to replace." )
7739        protected List<PositiveIntType> detailSequence;
7740
7741        /**
7742         * The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.
7743         */
7744        @Child(name = "subDetailSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7745        @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." )
7746        protected List<PositiveIntType> subDetailSequence;
7747
7748        /**
7749         * The providers who are authorized for the services rendered to the patient.
7750         */
7751        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7752        @Description(shortDefinition="Authorized providers", formalDefinition="The providers who are authorized for the services rendered to the patient." )
7753        protected List<Reference> provider;
7754        /**
7755         * The actual objects that are the target of the reference (The providers who are authorized for the services rendered to the patient.)
7756         */
7757        protected List<Resource> providerTarget;
7758
7759
7760        /**
7761         * 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.
7762         */
7763        @Child(name = "productOrService", type = {CodeableConcept.class}, order=5, min=1, max=1, modifier=false, summary=false)
7764        @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." )
7765        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
7766        protected CodeableConcept productOrService;
7767
7768        /**
7769         * Item typification or modifiers codes to convey additional context for the product or service.
7770         */
7771        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7772        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
7773        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
7774        protected List<CodeableConcept> modifier;
7775
7776        /**
7777         * Identifies the program under which this may be recovered.
7778         */
7779        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7780        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
7781        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
7782        protected List<CodeableConcept> programCode;
7783
7784        /**
7785         * The date or dates when the service or product was supplied, performed or completed.
7786         */
7787        @Child(name = "serviced", type = {DateType.class, Period.class}, order=8, min=0, max=1, modifier=false, summary=false)
7788        @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." )
7789        protected Type serviced;
7790
7791        /**
7792         * Where the product or service was provided.
7793         */
7794        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=9, min=0, max=1, modifier=false, summary=false)
7795        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
7796        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
7797        protected Type location;
7798
7799        /**
7800         * The number of repetitions of a service or product.
7801         */
7802        @Child(name = "quantity", type = {Quantity.class}, order=10, min=0, max=1, modifier=false, summary=false)
7803        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
7804        protected Quantity quantity;
7805
7806        /**
7807         * 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.
7808         */
7809        @Child(name = "unitPrice", type = {Money.class}, order=11, min=0, max=1, modifier=false, summary=false)
7810        @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." )
7811        protected Money unitPrice;
7812
7813        /**
7814         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
7815         */
7816        @Child(name = "factor", type = {DecimalType.class}, order=12, min=0, max=1, modifier=false, summary=false)
7817        @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." )
7818        protected DecimalType factor;
7819
7820        /**
7821         * The quantity times the unit price for an additional service or product or charge.
7822         */
7823        @Child(name = "net", type = {Money.class}, order=13, min=0, max=1, modifier=false, summary=false)
7824        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
7825        protected Money net;
7826
7827        /**
7828         * Physical service site on the patient (limb, tooth, etc.).
7829         */
7830        @Child(name = "bodySite", type = {CodeableConcept.class}, order=14, min=0, max=1, modifier=false, summary=false)
7831        @Description(shortDefinition="Anatomical location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
7832        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
7833        protected CodeableConcept bodySite;
7834
7835        /**
7836         * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
7837         */
7838        @Child(name = "subSite", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7839        @Description(shortDefinition="Anatomical sub-location", formalDefinition="A region or surface of the bodySite, e.g. limb region or tooth surface(s)." )
7840        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
7841        protected List<CodeableConcept> subSite;
7842
7843        /**
7844         * The numbers associated with notes below which apply to the adjudication of this item.
7845         */
7846        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7847        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
7848        protected List<PositiveIntType> noteNumber;
7849
7850        /**
7851         * The adjudication results.
7852         */
7853        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7854        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
7855        protected List<AdjudicationComponent> adjudication;
7856
7857        /**
7858         * The second-tier service adjudications for payor added services.
7859         */
7860        @Child(name = "detail", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7861        @Description(shortDefinition="Insurer added line items", formalDefinition="The second-tier service adjudications for payor added services." )
7862        protected List<AddedItemDetailComponent> detail;
7863
7864        private static final long serialVersionUID = -206524210L;
7865
7866    /**
7867     * Constructor
7868     */
7869      public AddedItemComponent() {
7870        super();
7871      }
7872
7873    /**
7874     * Constructor
7875     */
7876      public AddedItemComponent(CodeableConcept productOrService) {
7877        super();
7878        this.productOrService = productOrService;
7879      }
7880
7881        /**
7882         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
7883         */
7884        public List<PositiveIntType> getItemSequence() { 
7885          if (this.itemSequence == null)
7886            this.itemSequence = new ArrayList<PositiveIntType>();
7887          return this.itemSequence;
7888        }
7889
7890        /**
7891         * @return Returns a reference to <code>this</code> for easy method chaining
7892         */
7893        public AddedItemComponent setItemSequence(List<PositiveIntType> theItemSequence) { 
7894          this.itemSequence = theItemSequence;
7895          return this;
7896        }
7897
7898        public boolean hasItemSequence() { 
7899          if (this.itemSequence == null)
7900            return false;
7901          for (PositiveIntType item : this.itemSequence)
7902            if (!item.isEmpty())
7903              return true;
7904          return false;
7905        }
7906
7907        /**
7908         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
7909         */
7910        public PositiveIntType addItemSequenceElement() {//2 
7911          PositiveIntType t = new PositiveIntType();
7912          if (this.itemSequence == null)
7913            this.itemSequence = new ArrayList<PositiveIntType>();
7914          this.itemSequence.add(t);
7915          return t;
7916        }
7917
7918        /**
7919         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
7920         */
7921        public AddedItemComponent addItemSequence(int value) { //1
7922          PositiveIntType t = new PositiveIntType();
7923          t.setValue(value);
7924          if (this.itemSequence == null)
7925            this.itemSequence = new ArrayList<PositiveIntType>();
7926          this.itemSequence.add(t);
7927          return this;
7928        }
7929
7930        /**
7931         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
7932         */
7933        public boolean hasItemSequence(int value) { 
7934          if (this.itemSequence == null)
7935            return false;
7936          for (PositiveIntType v : this.itemSequence)
7937            if (v.getValue().equals(value)) // positiveInt
7938              return true;
7939          return false;
7940        }
7941
7942        /**
7943         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7944         */
7945        public List<PositiveIntType> getDetailSequence() { 
7946          if (this.detailSequence == null)
7947            this.detailSequence = new ArrayList<PositiveIntType>();
7948          return this.detailSequence;
7949        }
7950
7951        /**
7952         * @return Returns a reference to <code>this</code> for easy method chaining
7953         */
7954        public AddedItemComponent setDetailSequence(List<PositiveIntType> theDetailSequence) { 
7955          this.detailSequence = theDetailSequence;
7956          return this;
7957        }
7958
7959        public boolean hasDetailSequence() { 
7960          if (this.detailSequence == null)
7961            return false;
7962          for (PositiveIntType item : this.detailSequence)
7963            if (!item.isEmpty())
7964              return true;
7965          return false;
7966        }
7967
7968        /**
7969         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7970         */
7971        public PositiveIntType addDetailSequenceElement() {//2 
7972          PositiveIntType t = new PositiveIntType();
7973          if (this.detailSequence == null)
7974            this.detailSequence = new ArrayList<PositiveIntType>();
7975          this.detailSequence.add(t);
7976          return t;
7977        }
7978
7979        /**
7980         * @param value {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7981         */
7982        public AddedItemComponent addDetailSequence(int value) { //1
7983          PositiveIntType t = new PositiveIntType();
7984          t.setValue(value);
7985          if (this.detailSequence == null)
7986            this.detailSequence = new ArrayList<PositiveIntType>();
7987          this.detailSequence.add(t);
7988          return this;
7989        }
7990
7991        /**
7992         * @param value {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7993         */
7994        public boolean hasDetailSequence(int value) { 
7995          if (this.detailSequence == null)
7996            return false;
7997          for (PositiveIntType v : this.detailSequence)
7998            if (v.getValue().equals(value)) // positiveInt
7999              return true;
8000          return false;
8001        }
8002
8003        /**
8004         * @return {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
8005         */
8006        public List<PositiveIntType> getSubDetailSequence() { 
8007          if (this.subDetailSequence == null)
8008            this.subDetailSequence = new ArrayList<PositiveIntType>();
8009          return this.subDetailSequence;
8010        }
8011
8012        /**
8013         * @return Returns a reference to <code>this</code> for easy method chaining
8014         */
8015        public AddedItemComponent setSubDetailSequence(List<PositiveIntType> theSubDetailSequence) { 
8016          this.subDetailSequence = theSubDetailSequence;
8017          return this;
8018        }
8019
8020        public boolean hasSubDetailSequence() { 
8021          if (this.subDetailSequence == null)
8022            return false;
8023          for (PositiveIntType item : this.subDetailSequence)
8024            if (!item.isEmpty())
8025              return true;
8026          return false;
8027        }
8028
8029        /**
8030         * @return {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
8031         */
8032        public PositiveIntType addSubDetailSequenceElement() {//2 
8033          PositiveIntType t = new PositiveIntType();
8034          if (this.subDetailSequence == null)
8035            this.subDetailSequence = new ArrayList<PositiveIntType>();
8036          this.subDetailSequence.add(t);
8037          return t;
8038        }
8039
8040        /**
8041         * @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.)
8042         */
8043        public AddedItemComponent addSubDetailSequence(int value) { //1
8044          PositiveIntType t = new PositiveIntType();
8045          t.setValue(value);
8046          if (this.subDetailSequence == null)
8047            this.subDetailSequence = new ArrayList<PositiveIntType>();
8048          this.subDetailSequence.add(t);
8049          return this;
8050        }
8051
8052        /**
8053         * @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.)
8054         */
8055        public boolean hasSubDetailSequence(int value) { 
8056          if (this.subDetailSequence == null)
8057            return false;
8058          for (PositiveIntType v : this.subDetailSequence)
8059            if (v.getValue().equals(value)) // positiveInt
8060              return true;
8061          return false;
8062        }
8063
8064        /**
8065         * @return {@link #provider} (The providers who are authorized for the services rendered to the patient.)
8066         */
8067        public List<Reference> getProvider() { 
8068          if (this.provider == null)
8069            this.provider = new ArrayList<Reference>();
8070          return this.provider;
8071        }
8072
8073        /**
8074         * @return Returns a reference to <code>this</code> for easy method chaining
8075         */
8076        public AddedItemComponent setProvider(List<Reference> theProvider) { 
8077          this.provider = theProvider;
8078          return this;
8079        }
8080
8081        public boolean hasProvider() { 
8082          if (this.provider == null)
8083            return false;
8084          for (Reference item : this.provider)
8085            if (!item.isEmpty())
8086              return true;
8087          return false;
8088        }
8089
8090        public Reference addProvider() { //3
8091          Reference t = new Reference();
8092          if (this.provider == null)
8093            this.provider = new ArrayList<Reference>();
8094          this.provider.add(t);
8095          return t;
8096        }
8097
8098        public AddedItemComponent addProvider(Reference t) { //3
8099          if (t == null)
8100            return this;
8101          if (this.provider == null)
8102            this.provider = new ArrayList<Reference>();
8103          this.provider.add(t);
8104          return this;
8105        }
8106
8107        /**
8108         * @return The first repetition of repeating field {@link #provider}, creating it if it does not already exist
8109         */
8110        public Reference getProviderFirstRep() { 
8111          if (getProvider().isEmpty()) {
8112            addProvider();
8113          }
8114          return getProvider().get(0);
8115        }
8116
8117        /**
8118         * @deprecated Use Reference#setResource(IBaseResource) instead
8119         */
8120        @Deprecated
8121        public List<Resource> getProviderTarget() { 
8122          if (this.providerTarget == null)
8123            this.providerTarget = new ArrayList<Resource>();
8124          return this.providerTarget;
8125        }
8126
8127        /**
8128         * @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.)
8129         */
8130        public CodeableConcept getProductOrService() { 
8131          if (this.productOrService == null)
8132            if (Configuration.errorOnAutoCreate())
8133              throw new Error("Attempt to auto-create AddedItemComponent.productOrService");
8134            else if (Configuration.doAutoCreate())
8135              this.productOrService = new CodeableConcept(); // cc
8136          return this.productOrService;
8137        }
8138
8139        public boolean hasProductOrService() { 
8140          return this.productOrService != null && !this.productOrService.isEmpty();
8141        }
8142
8143        /**
8144         * @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.)
8145         */
8146        public AddedItemComponent setProductOrService(CodeableConcept value) { 
8147          this.productOrService = value;
8148          return this;
8149        }
8150
8151        /**
8152         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
8153         */
8154        public List<CodeableConcept> getModifier() { 
8155          if (this.modifier == null)
8156            this.modifier = new ArrayList<CodeableConcept>();
8157          return this.modifier;
8158        }
8159
8160        /**
8161         * @return Returns a reference to <code>this</code> for easy method chaining
8162         */
8163        public AddedItemComponent setModifier(List<CodeableConcept> theModifier) { 
8164          this.modifier = theModifier;
8165          return this;
8166        }
8167
8168        public boolean hasModifier() { 
8169          if (this.modifier == null)
8170            return false;
8171          for (CodeableConcept item : this.modifier)
8172            if (!item.isEmpty())
8173              return true;
8174          return false;
8175        }
8176
8177        public CodeableConcept addModifier() { //3
8178          CodeableConcept t = new CodeableConcept();
8179          if (this.modifier == null)
8180            this.modifier = new ArrayList<CodeableConcept>();
8181          this.modifier.add(t);
8182          return t;
8183        }
8184
8185        public AddedItemComponent addModifier(CodeableConcept t) { //3
8186          if (t == null)
8187            return this;
8188          if (this.modifier == null)
8189            this.modifier = new ArrayList<CodeableConcept>();
8190          this.modifier.add(t);
8191          return this;
8192        }
8193
8194        /**
8195         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
8196         */
8197        public CodeableConcept getModifierFirstRep() { 
8198          if (getModifier().isEmpty()) {
8199            addModifier();
8200          }
8201          return getModifier().get(0);
8202        }
8203
8204        /**
8205         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
8206         */
8207        public List<CodeableConcept> getProgramCode() { 
8208          if (this.programCode == null)
8209            this.programCode = new ArrayList<CodeableConcept>();
8210          return this.programCode;
8211        }
8212
8213        /**
8214         * @return Returns a reference to <code>this</code> for easy method chaining
8215         */
8216        public AddedItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
8217          this.programCode = theProgramCode;
8218          return this;
8219        }
8220
8221        public boolean hasProgramCode() { 
8222          if (this.programCode == null)
8223            return false;
8224          for (CodeableConcept item : this.programCode)
8225            if (!item.isEmpty())
8226              return true;
8227          return false;
8228        }
8229
8230        public CodeableConcept addProgramCode() { //3
8231          CodeableConcept t = new CodeableConcept();
8232          if (this.programCode == null)
8233            this.programCode = new ArrayList<CodeableConcept>();
8234          this.programCode.add(t);
8235          return t;
8236        }
8237
8238        public AddedItemComponent addProgramCode(CodeableConcept t) { //3
8239          if (t == null)
8240            return this;
8241          if (this.programCode == null)
8242            this.programCode = new ArrayList<CodeableConcept>();
8243          this.programCode.add(t);
8244          return this;
8245        }
8246
8247        /**
8248         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
8249         */
8250        public CodeableConcept getProgramCodeFirstRep() { 
8251          if (getProgramCode().isEmpty()) {
8252            addProgramCode();
8253          }
8254          return getProgramCode().get(0);
8255        }
8256
8257        /**
8258         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8259         */
8260        public Type getServiced() { 
8261          return this.serviced;
8262        }
8263
8264        /**
8265         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8266         */
8267        public DateType getServicedDateType() throws FHIRException { 
8268          if (this.serviced == null)
8269            this.serviced = new DateType();
8270          if (!(this.serviced instanceof DateType))
8271            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
8272          return (DateType) this.serviced;
8273        }
8274
8275        public boolean hasServicedDateType() { 
8276          return this != null && this.serviced instanceof DateType;
8277        }
8278
8279        /**
8280         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8281         */
8282        public Period getServicedPeriod() throws FHIRException { 
8283          if (this.serviced == null)
8284            this.serviced = new Period();
8285          if (!(this.serviced instanceof Period))
8286            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
8287          return (Period) this.serviced;
8288        }
8289
8290        public boolean hasServicedPeriod() { 
8291          return this != null && this.serviced instanceof Period;
8292        }
8293
8294        public boolean hasServiced() { 
8295          return this.serviced != null && !this.serviced.isEmpty();
8296        }
8297
8298        /**
8299         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8300         */
8301        public AddedItemComponent setServiced(Type value) { 
8302          if (value != null && !(value instanceof DateType || value instanceof Period))
8303            throw new Error("Not the right type for ExplanationOfBenefit.addItem.serviced[x]: "+value.fhirType());
8304          this.serviced = value;
8305          return this;
8306        }
8307
8308        /**
8309         * @return {@link #location} (Where the product or service was provided.)
8310         */
8311        public Type getLocation() { 
8312          return this.location;
8313        }
8314
8315        /**
8316         * @return {@link #location} (Where the product or service was provided.)
8317         */
8318        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
8319          if (this.location == null)
8320            this.location = new CodeableConcept();
8321          if (!(this.location instanceof CodeableConcept))
8322            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
8323          return (CodeableConcept) this.location;
8324        }
8325
8326        public boolean hasLocationCodeableConcept() { 
8327          return this != null && this.location instanceof CodeableConcept;
8328        }
8329
8330        /**
8331         * @return {@link #location} (Where the product or service was provided.)
8332         */
8333        public Address getLocationAddress() throws FHIRException { 
8334          if (this.location == null)
8335            this.location = new Address();
8336          if (!(this.location instanceof Address))
8337            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
8338          return (Address) this.location;
8339        }
8340
8341        public boolean hasLocationAddress() { 
8342          return this != null && this.location instanceof Address;
8343        }
8344
8345        /**
8346         * @return {@link #location} (Where the product or service was provided.)
8347         */
8348        public Reference getLocationReference() throws FHIRException { 
8349          if (this.location == null)
8350            this.location = new Reference();
8351          if (!(this.location instanceof Reference))
8352            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
8353          return (Reference) this.location;
8354        }
8355
8356        public boolean hasLocationReference() { 
8357          return this != null && this.location instanceof Reference;
8358        }
8359
8360        public boolean hasLocation() { 
8361          return this.location != null && !this.location.isEmpty();
8362        }
8363
8364        /**
8365         * @param value {@link #location} (Where the product or service was provided.)
8366         */
8367        public AddedItemComponent setLocation(Type value) { 
8368          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
8369            throw new Error("Not the right type for ExplanationOfBenefit.addItem.location[x]: "+value.fhirType());
8370          this.location = value;
8371          return this;
8372        }
8373
8374        /**
8375         * @return {@link #quantity} (The number of repetitions of a service or product.)
8376         */
8377        public Quantity getQuantity() { 
8378          if (this.quantity == null)
8379            if (Configuration.errorOnAutoCreate())
8380              throw new Error("Attempt to auto-create AddedItemComponent.quantity");
8381            else if (Configuration.doAutoCreate())
8382              this.quantity = new Quantity(); // cc
8383          return this.quantity;
8384        }
8385
8386        public boolean hasQuantity() { 
8387          return this.quantity != null && !this.quantity.isEmpty();
8388        }
8389
8390        /**
8391         * @param value {@link #quantity} (The number of repetitions of a service or product.)
8392         */
8393        public AddedItemComponent setQuantity(Quantity value) { 
8394          this.quantity = value;
8395          return this;
8396        }
8397
8398        /**
8399         * @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.)
8400         */
8401        public Money getUnitPrice() { 
8402          if (this.unitPrice == null)
8403            if (Configuration.errorOnAutoCreate())
8404              throw new Error("Attempt to auto-create AddedItemComponent.unitPrice");
8405            else if (Configuration.doAutoCreate())
8406              this.unitPrice = new Money(); // cc
8407          return this.unitPrice;
8408        }
8409
8410        public boolean hasUnitPrice() { 
8411          return this.unitPrice != null && !this.unitPrice.isEmpty();
8412        }
8413
8414        /**
8415         * @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.)
8416         */
8417        public AddedItemComponent setUnitPrice(Money value) { 
8418          this.unitPrice = value;
8419          return this;
8420        }
8421
8422        /**
8423         * @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
8424         */
8425        public DecimalType getFactorElement() { 
8426          if (this.factor == null)
8427            if (Configuration.errorOnAutoCreate())
8428              throw new Error("Attempt to auto-create AddedItemComponent.factor");
8429            else if (Configuration.doAutoCreate())
8430              this.factor = new DecimalType(); // bb
8431          return this.factor;
8432        }
8433
8434        public boolean hasFactorElement() { 
8435          return this.factor != null && !this.factor.isEmpty();
8436        }
8437
8438        public boolean hasFactor() { 
8439          return this.factor != null && !this.factor.isEmpty();
8440        }
8441
8442        /**
8443         * @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
8444         */
8445        public AddedItemComponent setFactorElement(DecimalType value) { 
8446          this.factor = value;
8447          return this;
8448        }
8449
8450        /**
8451         * @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.
8452         */
8453        public BigDecimal getFactor() { 
8454          return this.factor == null ? null : this.factor.getValue();
8455        }
8456
8457        /**
8458         * @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.
8459         */
8460        public AddedItemComponent setFactor(BigDecimal value) { 
8461          if (value == null)
8462            this.factor = null;
8463          else {
8464            if (this.factor == null)
8465              this.factor = new DecimalType();
8466            this.factor.setValue(value);
8467          }
8468          return this;
8469        }
8470
8471        /**
8472         * @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.
8473         */
8474        public AddedItemComponent setFactor(long value) { 
8475              this.factor = new DecimalType();
8476            this.factor.setValue(value);
8477          return this;
8478        }
8479
8480        /**
8481         * @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.
8482         */
8483        public AddedItemComponent setFactor(double value) { 
8484              this.factor = new DecimalType();
8485            this.factor.setValue(value);
8486          return this;
8487        }
8488
8489        /**
8490         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8491         */
8492        public Money getNet() { 
8493          if (this.net == null)
8494            if (Configuration.errorOnAutoCreate())
8495              throw new Error("Attempt to auto-create AddedItemComponent.net");
8496            else if (Configuration.doAutoCreate())
8497              this.net = new Money(); // cc
8498          return this.net;
8499        }
8500
8501        public boolean hasNet() { 
8502          return this.net != null && !this.net.isEmpty();
8503        }
8504
8505        /**
8506         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8507         */
8508        public AddedItemComponent setNet(Money value) { 
8509          this.net = value;
8510          return this;
8511        }
8512
8513        /**
8514         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
8515         */
8516        public CodeableConcept getBodySite() { 
8517          if (this.bodySite == null)
8518            if (Configuration.errorOnAutoCreate())
8519              throw new Error("Attempt to auto-create AddedItemComponent.bodySite");
8520            else if (Configuration.doAutoCreate())
8521              this.bodySite = new CodeableConcept(); // cc
8522          return this.bodySite;
8523        }
8524
8525        public boolean hasBodySite() { 
8526          return this.bodySite != null && !this.bodySite.isEmpty();
8527        }
8528
8529        /**
8530         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
8531         */
8532        public AddedItemComponent setBodySite(CodeableConcept value) { 
8533          this.bodySite = value;
8534          return this;
8535        }
8536
8537        /**
8538         * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb region or tooth surface(s).)
8539         */
8540        public List<CodeableConcept> getSubSite() { 
8541          if (this.subSite == null)
8542            this.subSite = new ArrayList<CodeableConcept>();
8543          return this.subSite;
8544        }
8545
8546        /**
8547         * @return Returns a reference to <code>this</code> for easy method chaining
8548         */
8549        public AddedItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
8550          this.subSite = theSubSite;
8551          return this;
8552        }
8553
8554        public boolean hasSubSite() { 
8555          if (this.subSite == null)
8556            return false;
8557          for (CodeableConcept item : this.subSite)
8558            if (!item.isEmpty())
8559              return true;
8560          return false;
8561        }
8562
8563        public CodeableConcept addSubSite() { //3
8564          CodeableConcept t = new CodeableConcept();
8565          if (this.subSite == null)
8566            this.subSite = new ArrayList<CodeableConcept>();
8567          this.subSite.add(t);
8568          return t;
8569        }
8570
8571        public AddedItemComponent addSubSite(CodeableConcept t) { //3
8572          if (t == null)
8573            return this;
8574          if (this.subSite == null)
8575            this.subSite = new ArrayList<CodeableConcept>();
8576          this.subSite.add(t);
8577          return this;
8578        }
8579
8580        /**
8581         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist
8582         */
8583        public CodeableConcept getSubSiteFirstRep() { 
8584          if (getSubSite().isEmpty()) {
8585            addSubSite();
8586          }
8587          return getSubSite().get(0);
8588        }
8589
8590        /**
8591         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8592         */
8593        public List<PositiveIntType> getNoteNumber() { 
8594          if (this.noteNumber == null)
8595            this.noteNumber = new ArrayList<PositiveIntType>();
8596          return this.noteNumber;
8597        }
8598
8599        /**
8600         * @return Returns a reference to <code>this</code> for easy method chaining
8601         */
8602        public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
8603          this.noteNumber = theNoteNumber;
8604          return this;
8605        }
8606
8607        public boolean hasNoteNumber() { 
8608          if (this.noteNumber == null)
8609            return false;
8610          for (PositiveIntType item : this.noteNumber)
8611            if (!item.isEmpty())
8612              return true;
8613          return false;
8614        }
8615
8616        /**
8617         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8618         */
8619        public PositiveIntType addNoteNumberElement() {//2 
8620          PositiveIntType t = new PositiveIntType();
8621          if (this.noteNumber == null)
8622            this.noteNumber = new ArrayList<PositiveIntType>();
8623          this.noteNumber.add(t);
8624          return t;
8625        }
8626
8627        /**
8628         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8629         */
8630        public AddedItemComponent addNoteNumber(int value) { //1
8631          PositiveIntType t = new PositiveIntType();
8632          t.setValue(value);
8633          if (this.noteNumber == null)
8634            this.noteNumber = new ArrayList<PositiveIntType>();
8635          this.noteNumber.add(t);
8636          return this;
8637        }
8638
8639        /**
8640         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8641         */
8642        public boolean hasNoteNumber(int value) { 
8643          if (this.noteNumber == null)
8644            return false;
8645          for (PositiveIntType v : this.noteNumber)
8646            if (v.getValue().equals(value)) // positiveInt
8647              return true;
8648          return false;
8649        }
8650
8651        /**
8652         * @return {@link #adjudication} (The adjudication results.)
8653         */
8654        public List<AdjudicationComponent> getAdjudication() { 
8655          if (this.adjudication == null)
8656            this.adjudication = new ArrayList<AdjudicationComponent>();
8657          return this.adjudication;
8658        }
8659
8660        /**
8661         * @return Returns a reference to <code>this</code> for easy method chaining
8662         */
8663        public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
8664          this.adjudication = theAdjudication;
8665          return this;
8666        }
8667
8668        public boolean hasAdjudication() { 
8669          if (this.adjudication == null)
8670            return false;
8671          for (AdjudicationComponent item : this.adjudication)
8672            if (!item.isEmpty())
8673              return true;
8674          return false;
8675        }
8676
8677        public AdjudicationComponent addAdjudication() { //3
8678          AdjudicationComponent t = new AdjudicationComponent();
8679          if (this.adjudication == null)
8680            this.adjudication = new ArrayList<AdjudicationComponent>();
8681          this.adjudication.add(t);
8682          return t;
8683        }
8684
8685        public AddedItemComponent addAdjudication(AdjudicationComponent t) { //3
8686          if (t == null)
8687            return this;
8688          if (this.adjudication == null)
8689            this.adjudication = new ArrayList<AdjudicationComponent>();
8690          this.adjudication.add(t);
8691          return this;
8692        }
8693
8694        /**
8695         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
8696         */
8697        public AdjudicationComponent getAdjudicationFirstRep() { 
8698          if (getAdjudication().isEmpty()) {
8699            addAdjudication();
8700          }
8701          return getAdjudication().get(0);
8702        }
8703
8704        /**
8705         * @return {@link #detail} (The second-tier service adjudications for payor added services.)
8706         */
8707        public List<AddedItemDetailComponent> getDetail() { 
8708          if (this.detail == null)
8709            this.detail = new ArrayList<AddedItemDetailComponent>();
8710          return this.detail;
8711        }
8712
8713        /**
8714         * @return Returns a reference to <code>this</code> for easy method chaining
8715         */
8716        public AddedItemComponent setDetail(List<AddedItemDetailComponent> theDetail) { 
8717          this.detail = theDetail;
8718          return this;
8719        }
8720
8721        public boolean hasDetail() { 
8722          if (this.detail == null)
8723            return false;
8724          for (AddedItemDetailComponent item : this.detail)
8725            if (!item.isEmpty())
8726              return true;
8727          return false;
8728        }
8729
8730        public AddedItemDetailComponent addDetail() { //3
8731          AddedItemDetailComponent t = new AddedItemDetailComponent();
8732          if (this.detail == null)
8733            this.detail = new ArrayList<AddedItemDetailComponent>();
8734          this.detail.add(t);
8735          return t;
8736        }
8737
8738        public AddedItemComponent addDetail(AddedItemDetailComponent t) { //3
8739          if (t == null)
8740            return this;
8741          if (this.detail == null)
8742            this.detail = new ArrayList<AddedItemDetailComponent>();
8743          this.detail.add(t);
8744          return this;
8745        }
8746
8747        /**
8748         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
8749         */
8750        public AddedItemDetailComponent getDetailFirstRep() { 
8751          if (getDetail().isEmpty()) {
8752            addDetail();
8753          }
8754          return getDetail().get(0);
8755        }
8756
8757        protected void listChildren(List<Property> children) {
8758          super.listChildren(children);
8759          children.add(new Property("itemSequence", "positiveInt", "Claim items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, itemSequence));
8760          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));
8761          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));
8762          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));
8763          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));
8764          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));
8765          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
8766          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));
8767          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location));
8768          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
8769          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));
8770          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));
8771          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
8772          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
8773          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));
8774          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));
8775          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
8776          children.add(new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail));
8777        }
8778
8779        @Override
8780        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8781          switch (_hash) {
8782          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);
8783          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);
8784          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);
8785          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);
8786          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);
8787          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);
8788          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
8789          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);
8790          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);
8791          case 363246749: /*servicedDate*/  return new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
8792          case 1534966512: /*servicedPeriod*/  return new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
8793          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8794          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8795          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8796          case -1280020865: /*locationAddress*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8797          case 755866390: /*locationReference*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8798          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
8799          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);
8800          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);
8801          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);
8802          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
8803          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);
8804          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);
8805          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
8806          case -1335224239: /*detail*/  return new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail);
8807          default: return super.getNamedProperty(_hash, _name, _checkValid);
8808          }
8809
8810        }
8811
8812      @Override
8813      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8814        switch (hash) {
8815        case 1977979892: /*itemSequence*/ return this.itemSequence == null ? new Base[0] : this.itemSequence.toArray(new Base[this.itemSequence.size()]); // PositiveIntType
8816        case 1321472818: /*detailSequence*/ return this.detailSequence == null ? new Base[0] : this.detailSequence.toArray(new Base[this.detailSequence.size()]); // PositiveIntType
8817        case -855462510: /*subDetailSequence*/ return this.subDetailSequence == null ? new Base[0] : this.subDetailSequence.toArray(new Base[this.subDetailSequence.size()]); // PositiveIntType
8818        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : this.provider.toArray(new Base[this.provider.size()]); // Reference
8819        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
8820        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
8821        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
8822        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
8823        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
8824        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
8825        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
8826        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
8827        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
8828        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
8829        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
8830        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
8831        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
8832        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemDetailComponent
8833        default: return super.getProperty(hash, name, checkValid);
8834        }
8835
8836      }
8837
8838      @Override
8839      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8840        switch (hash) {
8841        case 1977979892: // itemSequence
8842          this.getItemSequence().add(castToPositiveInt(value)); // PositiveIntType
8843          return value;
8844        case 1321472818: // detailSequence
8845          this.getDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
8846          return value;
8847        case -855462510: // subDetailSequence
8848          this.getSubDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
8849          return value;
8850        case -987494927: // provider
8851          this.getProvider().add(castToReference(value)); // Reference
8852          return value;
8853        case 1957227299: // productOrService
8854          this.productOrService = castToCodeableConcept(value); // CodeableConcept
8855          return value;
8856        case -615513385: // modifier
8857          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
8858          return value;
8859        case 1010065041: // programCode
8860          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
8861          return value;
8862        case 1379209295: // serviced
8863          this.serviced = castToType(value); // Type
8864          return value;
8865        case 1901043637: // location
8866          this.location = castToType(value); // Type
8867          return value;
8868        case -1285004149: // quantity
8869          this.quantity = castToQuantity(value); // Quantity
8870          return value;
8871        case -486196699: // unitPrice
8872          this.unitPrice = castToMoney(value); // Money
8873          return value;
8874        case -1282148017: // factor
8875          this.factor = castToDecimal(value); // DecimalType
8876          return value;
8877        case 108957: // net
8878          this.net = castToMoney(value); // Money
8879          return value;
8880        case 1702620169: // bodySite
8881          this.bodySite = castToCodeableConcept(value); // CodeableConcept
8882          return value;
8883        case -1868566105: // subSite
8884          this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
8885          return value;
8886        case -1110033957: // noteNumber
8887          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
8888          return value;
8889        case -231349275: // adjudication
8890          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
8891          return value;
8892        case -1335224239: // detail
8893          this.getDetail().add((AddedItemDetailComponent) value); // AddedItemDetailComponent
8894          return value;
8895        default: return super.setProperty(hash, name, value);
8896        }
8897
8898      }
8899
8900      @Override
8901      public Base setProperty(String name, Base value) throws FHIRException {
8902        if (name.equals("itemSequence")) {
8903          this.getItemSequence().add(castToPositiveInt(value));
8904        } else if (name.equals("detailSequence")) {
8905          this.getDetailSequence().add(castToPositiveInt(value));
8906        } else if (name.equals("subDetailSequence")) {
8907          this.getSubDetailSequence().add(castToPositiveInt(value));
8908        } else if (name.equals("provider")) {
8909          this.getProvider().add(castToReference(value));
8910        } else if (name.equals("productOrService")) {
8911          this.productOrService = castToCodeableConcept(value); // CodeableConcept
8912        } else if (name.equals("modifier")) {
8913          this.getModifier().add(castToCodeableConcept(value));
8914        } else if (name.equals("programCode")) {
8915          this.getProgramCode().add(castToCodeableConcept(value));
8916        } else if (name.equals("serviced[x]")) {
8917          this.serviced = castToType(value); // Type
8918        } else if (name.equals("location[x]")) {
8919          this.location = castToType(value); // Type
8920        } else if (name.equals("quantity")) {
8921          this.quantity = castToQuantity(value); // Quantity
8922        } else if (name.equals("unitPrice")) {
8923          this.unitPrice = castToMoney(value); // Money
8924        } else if (name.equals("factor")) {
8925          this.factor = castToDecimal(value); // DecimalType
8926        } else if (name.equals("net")) {
8927          this.net = castToMoney(value); // Money
8928        } else if (name.equals("bodySite")) {
8929          this.bodySite = castToCodeableConcept(value); // CodeableConcept
8930        } else if (name.equals("subSite")) {
8931          this.getSubSite().add(castToCodeableConcept(value));
8932        } else if (name.equals("noteNumber")) {
8933          this.getNoteNumber().add(castToPositiveInt(value));
8934        } else if (name.equals("adjudication")) {
8935          this.getAdjudication().add((AdjudicationComponent) value);
8936        } else if (name.equals("detail")) {
8937          this.getDetail().add((AddedItemDetailComponent) value);
8938        } else
8939          return super.setProperty(name, value);
8940        return value;
8941      }
8942
8943      @Override
8944      public Base makeProperty(int hash, String name) throws FHIRException {
8945        switch (hash) {
8946        case 1977979892:  return addItemSequenceElement();
8947        case 1321472818:  return addDetailSequenceElement();
8948        case -855462510:  return addSubDetailSequenceElement();
8949        case -987494927:  return addProvider(); 
8950        case 1957227299:  return getProductOrService(); 
8951        case -615513385:  return addModifier(); 
8952        case 1010065041:  return addProgramCode(); 
8953        case -1927922223:  return getServiced(); 
8954        case 1379209295:  return getServiced(); 
8955        case 552316075:  return getLocation(); 
8956        case 1901043637:  return getLocation(); 
8957        case -1285004149:  return getQuantity(); 
8958        case -486196699:  return getUnitPrice(); 
8959        case -1282148017:  return getFactorElement();
8960        case 108957:  return getNet(); 
8961        case 1702620169:  return getBodySite(); 
8962        case -1868566105:  return addSubSite(); 
8963        case -1110033957:  return addNoteNumberElement();
8964        case -231349275:  return addAdjudication(); 
8965        case -1335224239:  return addDetail(); 
8966        default: return super.makeProperty(hash, name);
8967        }
8968
8969      }
8970
8971      @Override
8972      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8973        switch (hash) {
8974        case 1977979892: /*itemSequence*/ return new String[] {"positiveInt"};
8975        case 1321472818: /*detailSequence*/ return new String[] {"positiveInt"};
8976        case -855462510: /*subDetailSequence*/ return new String[] {"positiveInt"};
8977        case -987494927: /*provider*/ return new String[] {"Reference"};
8978        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
8979        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
8980        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
8981        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
8982        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
8983        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
8984        case -486196699: /*unitPrice*/ return new String[] {"Money"};
8985        case -1282148017: /*factor*/ return new String[] {"decimal"};
8986        case 108957: /*net*/ return new String[] {"Money"};
8987        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
8988        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
8989        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
8990        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
8991        case -1335224239: /*detail*/ return new String[] {};
8992        default: return super.getTypesForProperty(hash, name);
8993        }
8994
8995      }
8996
8997      @Override
8998      public Base addChild(String name) throws FHIRException {
8999        if (name.equals("itemSequence")) {
9000          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.itemSequence");
9001        }
9002        else if (name.equals("detailSequence")) {
9003          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.detailSequence");
9004        }
9005        else if (name.equals("subDetailSequence")) {
9006          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.subDetailSequence");
9007        }
9008        else if (name.equals("provider")) {
9009          return addProvider();
9010        }
9011        else if (name.equals("productOrService")) {
9012          this.productOrService = new CodeableConcept();
9013          return this.productOrService;
9014        }
9015        else if (name.equals("modifier")) {
9016          return addModifier();
9017        }
9018        else if (name.equals("programCode")) {
9019          return addProgramCode();
9020        }
9021        else if (name.equals("servicedDate")) {
9022          this.serviced = new DateType();
9023          return this.serviced;
9024        }
9025        else if (name.equals("servicedPeriod")) {
9026          this.serviced = new Period();
9027          return this.serviced;
9028        }
9029        else if (name.equals("locationCodeableConcept")) {
9030          this.location = new CodeableConcept();
9031          return this.location;
9032        }
9033        else if (name.equals("locationAddress")) {
9034          this.location = new Address();
9035          return this.location;
9036        }
9037        else if (name.equals("locationReference")) {
9038          this.location = new Reference();
9039          return this.location;
9040        }
9041        else if (name.equals("quantity")) {
9042          this.quantity = new Quantity();
9043          return this.quantity;
9044        }
9045        else if (name.equals("unitPrice")) {
9046          this.unitPrice = new Money();
9047          return this.unitPrice;
9048        }
9049        else if (name.equals("factor")) {
9050          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
9051        }
9052        else if (name.equals("net")) {
9053          this.net = new Money();
9054          return this.net;
9055        }
9056        else if (name.equals("bodySite")) {
9057          this.bodySite = new CodeableConcept();
9058          return this.bodySite;
9059        }
9060        else if (name.equals("subSite")) {
9061          return addSubSite();
9062        }
9063        else if (name.equals("noteNumber")) {
9064          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
9065        }
9066        else if (name.equals("adjudication")) {
9067          return addAdjudication();
9068        }
9069        else if (name.equals("detail")) {
9070          return addDetail();
9071        }
9072        else
9073          return super.addChild(name);
9074      }
9075
9076      public AddedItemComponent copy() {
9077        AddedItemComponent dst = new AddedItemComponent();
9078        copyValues(dst);
9079        return dst;
9080      }
9081
9082      public void copyValues(AddedItemComponent dst) {
9083        super.copyValues(dst);
9084        if (itemSequence != null) {
9085          dst.itemSequence = new ArrayList<PositiveIntType>();
9086          for (PositiveIntType i : itemSequence)
9087            dst.itemSequence.add(i.copy());
9088        };
9089        if (detailSequence != null) {
9090          dst.detailSequence = new ArrayList<PositiveIntType>();
9091          for (PositiveIntType i : detailSequence)
9092            dst.detailSequence.add(i.copy());
9093        };
9094        if (subDetailSequence != null) {
9095          dst.subDetailSequence = new ArrayList<PositiveIntType>();
9096          for (PositiveIntType i : subDetailSequence)
9097            dst.subDetailSequence.add(i.copy());
9098        };
9099        if (provider != null) {
9100          dst.provider = new ArrayList<Reference>();
9101          for (Reference i : provider)
9102            dst.provider.add(i.copy());
9103        };
9104        dst.productOrService = productOrService == null ? null : productOrService.copy();
9105        if (modifier != null) {
9106          dst.modifier = new ArrayList<CodeableConcept>();
9107          for (CodeableConcept i : modifier)
9108            dst.modifier.add(i.copy());
9109        };
9110        if (programCode != null) {
9111          dst.programCode = new ArrayList<CodeableConcept>();
9112          for (CodeableConcept i : programCode)
9113            dst.programCode.add(i.copy());
9114        };
9115        dst.serviced = serviced == null ? null : serviced.copy();
9116        dst.location = location == null ? null : location.copy();
9117        dst.quantity = quantity == null ? null : quantity.copy();
9118        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
9119        dst.factor = factor == null ? null : factor.copy();
9120        dst.net = net == null ? null : net.copy();
9121        dst.bodySite = bodySite == null ? null : bodySite.copy();
9122        if (subSite != null) {
9123          dst.subSite = new ArrayList<CodeableConcept>();
9124          for (CodeableConcept i : subSite)
9125            dst.subSite.add(i.copy());
9126        };
9127        if (noteNumber != null) {
9128          dst.noteNumber = new ArrayList<PositiveIntType>();
9129          for (PositiveIntType i : noteNumber)
9130            dst.noteNumber.add(i.copy());
9131        };
9132        if (adjudication != null) {
9133          dst.adjudication = new ArrayList<AdjudicationComponent>();
9134          for (AdjudicationComponent i : adjudication)
9135            dst.adjudication.add(i.copy());
9136        };
9137        if (detail != null) {
9138          dst.detail = new ArrayList<AddedItemDetailComponent>();
9139          for (AddedItemDetailComponent i : detail)
9140            dst.detail.add(i.copy());
9141        };
9142      }
9143
9144      @Override
9145      public boolean equalsDeep(Base other_) {
9146        if (!super.equalsDeep(other_))
9147          return false;
9148        if (!(other_ instanceof AddedItemComponent))
9149          return false;
9150        AddedItemComponent o = (AddedItemComponent) other_;
9151        return compareDeep(itemSequence, o.itemSequence, true) && compareDeep(detailSequence, o.detailSequence, true)
9152           && compareDeep(subDetailSequence, o.subDetailSequence, true) && compareDeep(provider, o.provider, true)
9153           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
9154           && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
9155           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
9156           && compareDeep(net, o.net, true) && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true)
9157           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
9158           && compareDeep(detail, o.detail, true);
9159      }
9160
9161      @Override
9162      public boolean equalsShallow(Base other_) {
9163        if (!super.equalsShallow(other_))
9164          return false;
9165        if (!(other_ instanceof AddedItemComponent))
9166          return false;
9167        AddedItemComponent o = (AddedItemComponent) other_;
9168        return compareValues(itemSequence, o.itemSequence, true) && compareValues(detailSequence, o.detailSequence, true)
9169           && compareValues(subDetailSequence, o.subDetailSequence, true) && compareValues(factor, o.factor, true)
9170           && compareValues(noteNumber, o.noteNumber, true);
9171      }
9172
9173      public boolean isEmpty() {
9174        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(itemSequence, detailSequence
9175          , subDetailSequence, provider, productOrService, modifier, programCode, serviced
9176          , location, quantity, unitPrice, factor, net, bodySite, subSite, noteNumber
9177          , adjudication, detail);
9178      }
9179
9180  public String fhirType() {
9181    return "ExplanationOfBenefit.addItem";
9182
9183  }
9184
9185  }
9186
9187    @Block()
9188    public static class AddedItemDetailComponent extends BackboneElement implements IBaseBackboneElement {
9189        /**
9190         * 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.
9191         */
9192        @Child(name = "productOrService", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9193        @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." )
9194        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
9195        protected CodeableConcept productOrService;
9196
9197        /**
9198         * Item typification or modifiers codes to convey additional context for the product or service.
9199         */
9200        @Child(name = "modifier", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9201        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
9202        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
9203        protected List<CodeableConcept> modifier;
9204
9205        /**
9206         * The number of repetitions of a service or product.
9207         */
9208        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
9209        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
9210        protected Quantity quantity;
9211
9212        /**
9213         * 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.
9214         */
9215        @Child(name = "unitPrice", type = {Money.class}, order=4, min=0, max=1, modifier=false, summary=false)
9216        @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." )
9217        protected Money unitPrice;
9218
9219        /**
9220         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
9221         */
9222        @Child(name = "factor", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=false)
9223        @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." )
9224        protected DecimalType factor;
9225
9226        /**
9227         * The quantity times the unit price for an additional service or product or charge.
9228         */
9229        @Child(name = "net", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
9230        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
9231        protected Money net;
9232
9233        /**
9234         * The numbers associated with notes below which apply to the adjudication of this item.
9235         */
9236        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9237        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
9238        protected List<PositiveIntType> noteNumber;
9239
9240        /**
9241         * The adjudication results.
9242         */
9243        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9244        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
9245        protected List<AdjudicationComponent> adjudication;
9246
9247        /**
9248         * The third-tier service adjudications for payor added services.
9249         */
9250        @Child(name = "subDetail", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9251        @Description(shortDefinition="Insurer added line items", formalDefinition="The third-tier service adjudications for payor added services." )
9252        protected List<AddedItemDetailSubDetailComponent> subDetail;
9253
9254        private static final long serialVersionUID = 295910869L;
9255
9256    /**
9257     * Constructor
9258     */
9259      public AddedItemDetailComponent() {
9260        super();
9261      }
9262
9263    /**
9264     * Constructor
9265     */
9266      public AddedItemDetailComponent(CodeableConcept productOrService) {
9267        super();
9268        this.productOrService = productOrService;
9269      }
9270
9271        /**
9272         * @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.)
9273         */
9274        public CodeableConcept getProductOrService() { 
9275          if (this.productOrService == null)
9276            if (Configuration.errorOnAutoCreate())
9277              throw new Error("Attempt to auto-create AddedItemDetailComponent.productOrService");
9278            else if (Configuration.doAutoCreate())
9279              this.productOrService = new CodeableConcept(); // cc
9280          return this.productOrService;
9281        }
9282
9283        public boolean hasProductOrService() { 
9284          return this.productOrService != null && !this.productOrService.isEmpty();
9285        }
9286
9287        /**
9288         * @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.)
9289         */
9290        public AddedItemDetailComponent setProductOrService(CodeableConcept value) { 
9291          this.productOrService = value;
9292          return this;
9293        }
9294
9295        /**
9296         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
9297         */
9298        public List<CodeableConcept> getModifier() { 
9299          if (this.modifier == null)
9300            this.modifier = new ArrayList<CodeableConcept>();
9301          return this.modifier;
9302        }
9303
9304        /**
9305         * @return Returns a reference to <code>this</code> for easy method chaining
9306         */
9307        public AddedItemDetailComponent setModifier(List<CodeableConcept> theModifier) { 
9308          this.modifier = theModifier;
9309          return this;
9310        }
9311
9312        public boolean hasModifier() { 
9313          if (this.modifier == null)
9314            return false;
9315          for (CodeableConcept item : this.modifier)
9316            if (!item.isEmpty())
9317              return true;
9318          return false;
9319        }
9320
9321        public CodeableConcept addModifier() { //3
9322          CodeableConcept t = new CodeableConcept();
9323          if (this.modifier == null)
9324            this.modifier = new ArrayList<CodeableConcept>();
9325          this.modifier.add(t);
9326          return t;
9327        }
9328
9329        public AddedItemDetailComponent addModifier(CodeableConcept t) { //3
9330          if (t == null)
9331            return this;
9332          if (this.modifier == null)
9333            this.modifier = new ArrayList<CodeableConcept>();
9334          this.modifier.add(t);
9335          return this;
9336        }
9337
9338        /**
9339         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
9340         */
9341        public CodeableConcept getModifierFirstRep() { 
9342          if (getModifier().isEmpty()) {
9343            addModifier();
9344          }
9345          return getModifier().get(0);
9346        }
9347
9348        /**
9349         * @return {@link #quantity} (The number of repetitions of a service or product.)
9350         */
9351        public Quantity getQuantity() { 
9352          if (this.quantity == null)
9353            if (Configuration.errorOnAutoCreate())
9354              throw new Error("Attempt to auto-create AddedItemDetailComponent.quantity");
9355            else if (Configuration.doAutoCreate())
9356              this.quantity = new Quantity(); // cc
9357          return this.quantity;
9358        }
9359
9360        public boolean hasQuantity() { 
9361          return this.quantity != null && !this.quantity.isEmpty();
9362        }
9363
9364        /**
9365         * @param value {@link #quantity} (The number of repetitions of a service or product.)
9366         */
9367        public AddedItemDetailComponent setQuantity(Quantity value) { 
9368          this.quantity = value;
9369          return this;
9370        }
9371
9372        /**
9373         * @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.)
9374         */
9375        public Money getUnitPrice() { 
9376          if (this.unitPrice == null)
9377            if (Configuration.errorOnAutoCreate())
9378              throw new Error("Attempt to auto-create AddedItemDetailComponent.unitPrice");
9379            else if (Configuration.doAutoCreate())
9380              this.unitPrice = new Money(); // cc
9381          return this.unitPrice;
9382        }
9383
9384        public boolean hasUnitPrice() { 
9385          return this.unitPrice != null && !this.unitPrice.isEmpty();
9386        }
9387
9388        /**
9389         * @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.)
9390         */
9391        public AddedItemDetailComponent setUnitPrice(Money value) { 
9392          this.unitPrice = value;
9393          return this;
9394        }
9395
9396        /**
9397         * @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
9398         */
9399        public DecimalType getFactorElement() { 
9400          if (this.factor == null)
9401            if (Configuration.errorOnAutoCreate())
9402              throw new Error("Attempt to auto-create AddedItemDetailComponent.factor");
9403            else if (Configuration.doAutoCreate())
9404              this.factor = new DecimalType(); // bb
9405          return this.factor;
9406        }
9407
9408        public boolean hasFactorElement() { 
9409          return this.factor != null && !this.factor.isEmpty();
9410        }
9411
9412        public boolean hasFactor() { 
9413          return this.factor != null && !this.factor.isEmpty();
9414        }
9415
9416        /**
9417         * @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
9418         */
9419        public AddedItemDetailComponent setFactorElement(DecimalType value) { 
9420          this.factor = value;
9421          return this;
9422        }
9423
9424        /**
9425         * @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.
9426         */
9427        public BigDecimal getFactor() { 
9428          return this.factor == null ? null : this.factor.getValue();
9429        }
9430
9431        /**
9432         * @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.
9433         */
9434        public AddedItemDetailComponent setFactor(BigDecimal value) { 
9435          if (value == null)
9436            this.factor = null;
9437          else {
9438            if (this.factor == null)
9439              this.factor = new DecimalType();
9440            this.factor.setValue(value);
9441          }
9442          return this;
9443        }
9444
9445        /**
9446         * @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.
9447         */
9448        public AddedItemDetailComponent setFactor(long value) { 
9449              this.factor = new DecimalType();
9450            this.factor.setValue(value);
9451          return this;
9452        }
9453
9454        /**
9455         * @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.
9456         */
9457        public AddedItemDetailComponent setFactor(double value) { 
9458              this.factor = new DecimalType();
9459            this.factor.setValue(value);
9460          return this;
9461        }
9462
9463        /**
9464         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9465         */
9466        public Money getNet() { 
9467          if (this.net == null)
9468            if (Configuration.errorOnAutoCreate())
9469              throw new Error("Attempt to auto-create AddedItemDetailComponent.net");
9470            else if (Configuration.doAutoCreate())
9471              this.net = new Money(); // cc
9472          return this.net;
9473        }
9474
9475        public boolean hasNet() { 
9476          return this.net != null && !this.net.isEmpty();
9477        }
9478
9479        /**
9480         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9481         */
9482        public AddedItemDetailComponent setNet(Money value) { 
9483          this.net = value;
9484          return this;
9485        }
9486
9487        /**
9488         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9489         */
9490        public List<PositiveIntType> getNoteNumber() { 
9491          if (this.noteNumber == null)
9492            this.noteNumber = new ArrayList<PositiveIntType>();
9493          return this.noteNumber;
9494        }
9495
9496        /**
9497         * @return Returns a reference to <code>this</code> for easy method chaining
9498         */
9499        public AddedItemDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
9500          this.noteNumber = theNoteNumber;
9501          return this;
9502        }
9503
9504        public boolean hasNoteNumber() { 
9505          if (this.noteNumber == null)
9506            return false;
9507          for (PositiveIntType item : this.noteNumber)
9508            if (!item.isEmpty())
9509              return true;
9510          return false;
9511        }
9512
9513        /**
9514         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9515         */
9516        public PositiveIntType addNoteNumberElement() {//2 
9517          PositiveIntType t = new PositiveIntType();
9518          if (this.noteNumber == null)
9519            this.noteNumber = new ArrayList<PositiveIntType>();
9520          this.noteNumber.add(t);
9521          return t;
9522        }
9523
9524        /**
9525         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9526         */
9527        public AddedItemDetailComponent addNoteNumber(int value) { //1
9528          PositiveIntType t = new PositiveIntType();
9529          t.setValue(value);
9530          if (this.noteNumber == null)
9531            this.noteNumber = new ArrayList<PositiveIntType>();
9532          this.noteNumber.add(t);
9533          return this;
9534        }
9535
9536        /**
9537         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9538         */
9539        public boolean hasNoteNumber(int value) { 
9540          if (this.noteNumber == null)
9541            return false;
9542          for (PositiveIntType v : this.noteNumber)
9543            if (v.getValue().equals(value)) // positiveInt
9544              return true;
9545          return false;
9546        }
9547
9548        /**
9549         * @return {@link #adjudication} (The adjudication results.)
9550         */
9551        public List<AdjudicationComponent> getAdjudication() { 
9552          if (this.adjudication == null)
9553            this.adjudication = new ArrayList<AdjudicationComponent>();
9554          return this.adjudication;
9555        }
9556
9557        /**
9558         * @return Returns a reference to <code>this</code> for easy method chaining
9559         */
9560        public AddedItemDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
9561          this.adjudication = theAdjudication;
9562          return this;
9563        }
9564
9565        public boolean hasAdjudication() { 
9566          if (this.adjudication == null)
9567            return false;
9568          for (AdjudicationComponent item : this.adjudication)
9569            if (!item.isEmpty())
9570              return true;
9571          return false;
9572        }
9573
9574        public AdjudicationComponent addAdjudication() { //3
9575          AdjudicationComponent t = new AdjudicationComponent();
9576          if (this.adjudication == null)
9577            this.adjudication = new ArrayList<AdjudicationComponent>();
9578          this.adjudication.add(t);
9579          return t;
9580        }
9581
9582        public AddedItemDetailComponent addAdjudication(AdjudicationComponent t) { //3
9583          if (t == null)
9584            return this;
9585          if (this.adjudication == null)
9586            this.adjudication = new ArrayList<AdjudicationComponent>();
9587          this.adjudication.add(t);
9588          return this;
9589        }
9590
9591        /**
9592         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
9593         */
9594        public AdjudicationComponent getAdjudicationFirstRep() { 
9595          if (getAdjudication().isEmpty()) {
9596            addAdjudication();
9597          }
9598          return getAdjudication().get(0);
9599        }
9600
9601        /**
9602         * @return {@link #subDetail} (The third-tier service adjudications for payor added services.)
9603         */
9604        public List<AddedItemDetailSubDetailComponent> getSubDetail() { 
9605          if (this.subDetail == null)
9606            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9607          return this.subDetail;
9608        }
9609
9610        /**
9611         * @return Returns a reference to <code>this</code> for easy method chaining
9612         */
9613        public AddedItemDetailComponent setSubDetail(List<AddedItemDetailSubDetailComponent> theSubDetail) { 
9614          this.subDetail = theSubDetail;
9615          return this;
9616        }
9617
9618        public boolean hasSubDetail() { 
9619          if (this.subDetail == null)
9620            return false;
9621          for (AddedItemDetailSubDetailComponent item : this.subDetail)
9622            if (!item.isEmpty())
9623              return true;
9624          return false;
9625        }
9626
9627        public AddedItemDetailSubDetailComponent addSubDetail() { //3
9628          AddedItemDetailSubDetailComponent t = new AddedItemDetailSubDetailComponent();
9629          if (this.subDetail == null)
9630            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9631          this.subDetail.add(t);
9632          return t;
9633        }
9634
9635        public AddedItemDetailComponent addSubDetail(AddedItemDetailSubDetailComponent t) { //3
9636          if (t == null)
9637            return this;
9638          if (this.subDetail == null)
9639            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9640          this.subDetail.add(t);
9641          return this;
9642        }
9643
9644        /**
9645         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist
9646         */
9647        public AddedItemDetailSubDetailComponent getSubDetailFirstRep() { 
9648          if (getSubDetail().isEmpty()) {
9649            addSubDetail();
9650          }
9651          return getSubDetail().get(0);
9652        }
9653
9654        protected void listChildren(List<Property> children) {
9655          super.listChildren(children);
9656          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));
9657          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));
9658          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
9659          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));
9660          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));
9661          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
9662          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));
9663          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
9664          children.add(new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
9665        }
9666
9667        @Override
9668        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9669          switch (_hash) {
9670          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);
9671          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);
9672          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
9673          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);
9674          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);
9675          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);
9676          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);
9677          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
9678          case -828829007: /*subDetail*/  return new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
9679          default: return super.getNamedProperty(_hash, _name, _checkValid);
9680          }
9681
9682        }
9683
9684      @Override
9685      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9686        switch (hash) {
9687        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
9688        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
9689        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
9690        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
9691        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
9692        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
9693        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
9694        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
9695        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // AddedItemDetailSubDetailComponent
9696        default: return super.getProperty(hash, name, checkValid);
9697        }
9698
9699      }
9700
9701      @Override
9702      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9703        switch (hash) {
9704        case 1957227299: // productOrService
9705          this.productOrService = castToCodeableConcept(value); // CodeableConcept
9706          return value;
9707        case -615513385: // modifier
9708          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
9709          return value;
9710        case -1285004149: // quantity
9711          this.quantity = castToQuantity(value); // Quantity
9712          return value;
9713        case -486196699: // unitPrice
9714          this.unitPrice = castToMoney(value); // Money
9715          return value;
9716        case -1282148017: // factor
9717          this.factor = castToDecimal(value); // DecimalType
9718          return value;
9719        case 108957: // net
9720          this.net = castToMoney(value); // Money
9721          return value;
9722        case -1110033957: // noteNumber
9723          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
9724          return value;
9725        case -231349275: // adjudication
9726          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
9727          return value;
9728        case -828829007: // subDetail
9729          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value); // AddedItemDetailSubDetailComponent
9730          return value;
9731        default: return super.setProperty(hash, name, value);
9732        }
9733
9734      }
9735
9736      @Override
9737      public Base setProperty(String name, Base value) throws FHIRException {
9738        if (name.equals("productOrService")) {
9739          this.productOrService = castToCodeableConcept(value); // CodeableConcept
9740        } else if (name.equals("modifier")) {
9741          this.getModifier().add(castToCodeableConcept(value));
9742        } else if (name.equals("quantity")) {
9743          this.quantity = castToQuantity(value); // Quantity
9744        } else if (name.equals("unitPrice")) {
9745          this.unitPrice = castToMoney(value); // Money
9746        } else if (name.equals("factor")) {
9747          this.factor = castToDecimal(value); // DecimalType
9748        } else if (name.equals("net")) {
9749          this.net = castToMoney(value); // Money
9750        } else if (name.equals("noteNumber")) {
9751          this.getNoteNumber().add(castToPositiveInt(value));
9752        } else if (name.equals("adjudication")) {
9753          this.getAdjudication().add((AdjudicationComponent) value);
9754        } else if (name.equals("subDetail")) {
9755          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value);
9756        } else
9757          return super.setProperty(name, value);
9758        return value;
9759      }
9760
9761      @Override
9762      public Base makeProperty(int hash, String name) throws FHIRException {
9763        switch (hash) {
9764        case 1957227299:  return getProductOrService(); 
9765        case -615513385:  return addModifier(); 
9766        case -1285004149:  return getQuantity(); 
9767        case -486196699:  return getUnitPrice(); 
9768        case -1282148017:  return getFactorElement();
9769        case 108957:  return getNet(); 
9770        case -1110033957:  return addNoteNumberElement();
9771        case -231349275:  return addAdjudication(); 
9772        case -828829007:  return addSubDetail(); 
9773        default: return super.makeProperty(hash, name);
9774        }
9775
9776      }
9777
9778      @Override
9779      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9780        switch (hash) {
9781        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
9782        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
9783        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
9784        case -486196699: /*unitPrice*/ return new String[] {"Money"};
9785        case -1282148017: /*factor*/ return new String[] {"decimal"};
9786        case 108957: /*net*/ return new String[] {"Money"};
9787        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
9788        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
9789        case -828829007: /*subDetail*/ return new String[] {};
9790        default: return super.getTypesForProperty(hash, name);
9791        }
9792
9793      }
9794
9795      @Override
9796      public Base addChild(String name) throws FHIRException {
9797        if (name.equals("productOrService")) {
9798          this.productOrService = new CodeableConcept();
9799          return this.productOrService;
9800        }
9801        else if (name.equals("modifier")) {
9802          return addModifier();
9803        }
9804        else if (name.equals("quantity")) {
9805          this.quantity = new Quantity();
9806          return this.quantity;
9807        }
9808        else if (name.equals("unitPrice")) {
9809          this.unitPrice = new Money();
9810          return this.unitPrice;
9811        }
9812        else if (name.equals("factor")) {
9813          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
9814        }
9815        else if (name.equals("net")) {
9816          this.net = new Money();
9817          return this.net;
9818        }
9819        else if (name.equals("noteNumber")) {
9820          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
9821        }
9822        else if (name.equals("adjudication")) {
9823          return addAdjudication();
9824        }
9825        else if (name.equals("subDetail")) {
9826          return addSubDetail();
9827        }
9828        else
9829          return super.addChild(name);
9830      }
9831
9832      public AddedItemDetailComponent copy() {
9833        AddedItemDetailComponent dst = new AddedItemDetailComponent();
9834        copyValues(dst);
9835        return dst;
9836      }
9837
9838      public void copyValues(AddedItemDetailComponent dst) {
9839        super.copyValues(dst);
9840        dst.productOrService = productOrService == null ? null : productOrService.copy();
9841        if (modifier != null) {
9842          dst.modifier = new ArrayList<CodeableConcept>();
9843          for (CodeableConcept i : modifier)
9844            dst.modifier.add(i.copy());
9845        };
9846        dst.quantity = quantity == null ? null : quantity.copy();
9847        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
9848        dst.factor = factor == null ? null : factor.copy();
9849        dst.net = net == null ? null : net.copy();
9850        if (noteNumber != null) {
9851          dst.noteNumber = new ArrayList<PositiveIntType>();
9852          for (PositiveIntType i : noteNumber)
9853            dst.noteNumber.add(i.copy());
9854        };
9855        if (adjudication != null) {
9856          dst.adjudication = new ArrayList<AdjudicationComponent>();
9857          for (AdjudicationComponent i : adjudication)
9858            dst.adjudication.add(i.copy());
9859        };
9860        if (subDetail != null) {
9861          dst.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9862          for (AddedItemDetailSubDetailComponent i : subDetail)
9863            dst.subDetail.add(i.copy());
9864        };
9865      }
9866
9867      @Override
9868      public boolean equalsDeep(Base other_) {
9869        if (!super.equalsDeep(other_))
9870          return false;
9871        if (!(other_ instanceof AddedItemDetailComponent))
9872          return false;
9873        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
9874        return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
9875           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
9876           && compareDeep(net, o.net, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
9877           && compareDeep(subDetail, o.subDetail, true);
9878      }
9879
9880      @Override
9881      public boolean equalsShallow(Base other_) {
9882        if (!super.equalsShallow(other_))
9883          return false;
9884        if (!(other_ instanceof AddedItemDetailComponent))
9885          return false;
9886        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
9887        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
9888      }
9889
9890      public boolean isEmpty() {
9891        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier
9892          , quantity, unitPrice, factor, net, noteNumber, adjudication, subDetail);
9893      }
9894
9895  public String fhirType() {
9896    return "ExplanationOfBenefit.addItem.detail";
9897
9898  }
9899
9900  }
9901
9902    @Block()
9903    public static class AddedItemDetailSubDetailComponent extends BackboneElement implements IBaseBackboneElement {
9904        /**
9905         * 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.
9906         */
9907        @Child(name = "productOrService", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9908        @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." )
9909        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
9910        protected CodeableConcept productOrService;
9911
9912        /**
9913         * Item typification or modifiers codes to convey additional context for the product or service.
9914         */
9915        @Child(name = "modifier", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9916        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
9917        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
9918        protected List<CodeableConcept> modifier;
9919
9920        /**
9921         * The number of repetitions of a service or product.
9922         */
9923        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
9924        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
9925        protected Quantity quantity;
9926
9927        /**
9928         * 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.
9929         */
9930        @Child(name = "unitPrice", type = {Money.class}, order=4, min=0, max=1, modifier=false, summary=false)
9931        @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." )
9932        protected Money unitPrice;
9933
9934        /**
9935         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
9936         */
9937        @Child(name = "factor", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=false)
9938        @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." )
9939        protected DecimalType factor;
9940
9941        /**
9942         * The quantity times the unit price for an additional service or product or charge.
9943         */
9944        @Child(name = "net", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
9945        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
9946        protected Money net;
9947
9948        /**
9949         * The numbers associated with notes below which apply to the adjudication of this item.
9950         */
9951        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9952        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
9953        protected List<PositiveIntType> noteNumber;
9954
9955        /**
9956         * The adjudication results.
9957         */
9958        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9959        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
9960        protected List<AdjudicationComponent> adjudication;
9961
9962        private static final long serialVersionUID = 1301363592L;
9963
9964    /**
9965     * Constructor
9966     */
9967      public AddedItemDetailSubDetailComponent() {
9968        super();
9969      }
9970
9971    /**
9972     * Constructor
9973     */
9974      public AddedItemDetailSubDetailComponent(CodeableConcept productOrService) {
9975        super();
9976        this.productOrService = productOrService;
9977      }
9978
9979        /**
9980         * @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.)
9981         */
9982        public CodeableConcept getProductOrService() { 
9983          if (this.productOrService == null)
9984            if (Configuration.errorOnAutoCreate())
9985              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.productOrService");
9986            else if (Configuration.doAutoCreate())
9987              this.productOrService = new CodeableConcept(); // cc
9988          return this.productOrService;
9989        }
9990
9991        public boolean hasProductOrService() { 
9992          return this.productOrService != null && !this.productOrService.isEmpty();
9993        }
9994
9995        /**
9996         * @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.)
9997         */
9998        public AddedItemDetailSubDetailComponent setProductOrService(CodeableConcept value) { 
9999          this.productOrService = value;
10000          return this;
10001        }
10002
10003        /**
10004         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
10005         */
10006        public List<CodeableConcept> getModifier() { 
10007          if (this.modifier == null)
10008            this.modifier = new ArrayList<CodeableConcept>();
10009          return this.modifier;
10010        }
10011
10012        /**
10013         * @return Returns a reference to <code>this</code> for easy method chaining
10014         */
10015        public AddedItemDetailSubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
10016          this.modifier = theModifier;
10017          return this;
10018        }
10019
10020        public boolean hasModifier() { 
10021          if (this.modifier == null)
10022            return false;
10023          for (CodeableConcept item : this.modifier)
10024            if (!item.isEmpty())
10025              return true;
10026          return false;
10027        }
10028
10029        public CodeableConcept addModifier() { //3
10030          CodeableConcept t = new CodeableConcept();
10031          if (this.modifier == null)
10032            this.modifier = new ArrayList<CodeableConcept>();
10033          this.modifier.add(t);
10034          return t;
10035        }
10036
10037        public AddedItemDetailSubDetailComponent addModifier(CodeableConcept t) { //3
10038          if (t == null)
10039            return this;
10040          if (this.modifier == null)
10041            this.modifier = new ArrayList<CodeableConcept>();
10042          this.modifier.add(t);
10043          return this;
10044        }
10045
10046        /**
10047         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
10048         */
10049        public CodeableConcept getModifierFirstRep() { 
10050          if (getModifier().isEmpty()) {
10051            addModifier();
10052          }
10053          return getModifier().get(0);
10054        }
10055
10056        /**
10057         * @return {@link #quantity} (The number of repetitions of a service or product.)
10058         */
10059        public Quantity getQuantity() { 
10060          if (this.quantity == null)
10061            if (Configuration.errorOnAutoCreate())
10062              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.quantity");
10063            else if (Configuration.doAutoCreate())
10064              this.quantity = new Quantity(); // cc
10065          return this.quantity;
10066        }
10067
10068        public boolean hasQuantity() { 
10069          return this.quantity != null && !this.quantity.isEmpty();
10070        }
10071
10072        /**
10073         * @param value {@link #quantity} (The number of repetitions of a service or product.)
10074         */
10075        public AddedItemDetailSubDetailComponent setQuantity(Quantity value) { 
10076          this.quantity = value;
10077          return this;
10078        }
10079
10080        /**
10081         * @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.)
10082         */
10083        public Money getUnitPrice() { 
10084          if (this.unitPrice == null)
10085            if (Configuration.errorOnAutoCreate())
10086              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.unitPrice");
10087            else if (Configuration.doAutoCreate())
10088              this.unitPrice = new Money(); // cc
10089          return this.unitPrice;
10090        }
10091
10092        public boolean hasUnitPrice() { 
10093          return this.unitPrice != null && !this.unitPrice.isEmpty();
10094        }
10095
10096        /**
10097         * @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.)
10098         */
10099        public AddedItemDetailSubDetailComponent setUnitPrice(Money value) { 
10100          this.unitPrice = value;
10101          return this;
10102        }
10103
10104        /**
10105         * @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
10106         */
10107        public DecimalType getFactorElement() { 
10108          if (this.factor == null)
10109            if (Configuration.errorOnAutoCreate())
10110              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.factor");
10111            else if (Configuration.doAutoCreate())
10112              this.factor = new DecimalType(); // bb
10113          return this.factor;
10114        }
10115
10116        public boolean hasFactorElement() { 
10117          return this.factor != null && !this.factor.isEmpty();
10118        }
10119
10120        public boolean hasFactor() { 
10121          return this.factor != null && !this.factor.isEmpty();
10122        }
10123
10124        /**
10125         * @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
10126         */
10127        public AddedItemDetailSubDetailComponent setFactorElement(DecimalType value) { 
10128          this.factor = value;
10129          return this;
10130        }
10131
10132        /**
10133         * @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.
10134         */
10135        public BigDecimal getFactor() { 
10136          return this.factor == null ? null : this.factor.getValue();
10137        }
10138
10139        /**
10140         * @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.
10141         */
10142        public AddedItemDetailSubDetailComponent setFactor(BigDecimal value) { 
10143          if (value == null)
10144            this.factor = null;
10145          else {
10146            if (this.factor == null)
10147              this.factor = new DecimalType();
10148            this.factor.setValue(value);
10149          }
10150          return this;
10151        }
10152
10153        /**
10154         * @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.
10155         */
10156        public AddedItemDetailSubDetailComponent setFactor(long value) { 
10157              this.factor = new DecimalType();
10158            this.factor.setValue(value);
10159          return this;
10160        }
10161
10162        /**
10163         * @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.
10164         */
10165        public AddedItemDetailSubDetailComponent setFactor(double value) { 
10166              this.factor = new DecimalType();
10167            this.factor.setValue(value);
10168          return this;
10169        }
10170
10171        /**
10172         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
10173         */
10174        public Money getNet() { 
10175          if (this.net == null)
10176            if (Configuration.errorOnAutoCreate())
10177              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.net");
10178            else if (Configuration.doAutoCreate())
10179              this.net = new Money(); // cc
10180          return this.net;
10181        }
10182
10183        public boolean hasNet() { 
10184          return this.net != null && !this.net.isEmpty();
10185        }
10186
10187        /**
10188         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
10189         */
10190        public AddedItemDetailSubDetailComponent setNet(Money value) { 
10191          this.net = value;
10192          return this;
10193        }
10194
10195        /**
10196         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10197         */
10198        public List<PositiveIntType> getNoteNumber() { 
10199          if (this.noteNumber == null)
10200            this.noteNumber = new ArrayList<PositiveIntType>();
10201          return this.noteNumber;
10202        }
10203
10204        /**
10205         * @return Returns a reference to <code>this</code> for easy method chaining
10206         */
10207        public AddedItemDetailSubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
10208          this.noteNumber = theNoteNumber;
10209          return this;
10210        }
10211
10212        public boolean hasNoteNumber() { 
10213          if (this.noteNumber == null)
10214            return false;
10215          for (PositiveIntType item : this.noteNumber)
10216            if (!item.isEmpty())
10217              return true;
10218          return false;
10219        }
10220
10221        /**
10222         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10223         */
10224        public PositiveIntType addNoteNumberElement() {//2 
10225          PositiveIntType t = new PositiveIntType();
10226          if (this.noteNumber == null)
10227            this.noteNumber = new ArrayList<PositiveIntType>();
10228          this.noteNumber.add(t);
10229          return t;
10230        }
10231
10232        /**
10233         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10234         */
10235        public AddedItemDetailSubDetailComponent addNoteNumber(int value) { //1
10236          PositiveIntType t = new PositiveIntType();
10237          t.setValue(value);
10238          if (this.noteNumber == null)
10239            this.noteNumber = new ArrayList<PositiveIntType>();
10240          this.noteNumber.add(t);
10241          return this;
10242        }
10243
10244        /**
10245         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10246         */
10247        public boolean hasNoteNumber(int value) { 
10248          if (this.noteNumber == null)
10249            return false;
10250          for (PositiveIntType v : this.noteNumber)
10251            if (v.getValue().equals(value)) // positiveInt
10252              return true;
10253          return false;
10254        }
10255
10256        /**
10257         * @return {@link #adjudication} (The adjudication results.)
10258         */
10259        public List<AdjudicationComponent> getAdjudication() { 
10260          if (this.adjudication == null)
10261            this.adjudication = new ArrayList<AdjudicationComponent>();
10262          return this.adjudication;
10263        }
10264
10265        /**
10266         * @return Returns a reference to <code>this</code> for easy method chaining
10267         */
10268        public AddedItemDetailSubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
10269          this.adjudication = theAdjudication;
10270          return this;
10271        }
10272
10273        public boolean hasAdjudication() { 
10274          if (this.adjudication == null)
10275            return false;
10276          for (AdjudicationComponent item : this.adjudication)
10277            if (!item.isEmpty())
10278              return true;
10279          return false;
10280        }
10281
10282        public AdjudicationComponent addAdjudication() { //3
10283          AdjudicationComponent t = new AdjudicationComponent();
10284          if (this.adjudication == null)
10285            this.adjudication = new ArrayList<AdjudicationComponent>();
10286          this.adjudication.add(t);
10287          return t;
10288        }
10289
10290        public AddedItemDetailSubDetailComponent addAdjudication(AdjudicationComponent t) { //3
10291          if (t == null)
10292            return this;
10293          if (this.adjudication == null)
10294            this.adjudication = new ArrayList<AdjudicationComponent>();
10295          this.adjudication.add(t);
10296          return this;
10297        }
10298
10299        /**
10300         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
10301         */
10302        public AdjudicationComponent getAdjudicationFirstRep() { 
10303          if (getAdjudication().isEmpty()) {
10304            addAdjudication();
10305          }
10306          return getAdjudication().get(0);
10307        }
10308
10309        protected void listChildren(List<Property> children) {
10310          super.listChildren(children);
10311          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));
10312          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));
10313          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
10314          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));
10315          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));
10316          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
10317          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));
10318          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
10319        }
10320
10321        @Override
10322        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10323          switch (_hash) {
10324          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);
10325          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);
10326          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
10327          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);
10328          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);
10329          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);
10330          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);
10331          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
10332          default: return super.getNamedProperty(_hash, _name, _checkValid);
10333          }
10334
10335        }
10336
10337      @Override
10338      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10339        switch (hash) {
10340        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
10341        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
10342        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
10343        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
10344        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
10345        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
10346        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
10347        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
10348        default: return super.getProperty(hash, name, checkValid);
10349        }
10350
10351      }
10352
10353      @Override
10354      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10355        switch (hash) {
10356        case 1957227299: // productOrService
10357          this.productOrService = castToCodeableConcept(value); // CodeableConcept
10358          return value;
10359        case -615513385: // modifier
10360          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
10361          return value;
10362        case -1285004149: // quantity
10363          this.quantity = castToQuantity(value); // Quantity
10364          return value;
10365        case -486196699: // unitPrice
10366          this.unitPrice = castToMoney(value); // Money
10367          return value;
10368        case -1282148017: // factor
10369          this.factor = castToDecimal(value); // DecimalType
10370          return value;
10371        case 108957: // net
10372          this.net = castToMoney(value); // Money
10373          return value;
10374        case -1110033957: // noteNumber
10375          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
10376          return value;
10377        case -231349275: // adjudication
10378          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
10379          return value;
10380        default: return super.setProperty(hash, name, value);
10381        }
10382
10383      }
10384
10385      @Override
10386      public Base setProperty(String name, Base value) throws FHIRException {
10387        if (name.equals("productOrService")) {
10388          this.productOrService = castToCodeableConcept(value); // CodeableConcept
10389        } else if (name.equals("modifier")) {
10390          this.getModifier().add(castToCodeableConcept(value));
10391        } else if (name.equals("quantity")) {
10392          this.quantity = castToQuantity(value); // Quantity
10393        } else if (name.equals("unitPrice")) {
10394          this.unitPrice = castToMoney(value); // Money
10395        } else if (name.equals("factor")) {
10396          this.factor = castToDecimal(value); // DecimalType
10397        } else if (name.equals("net")) {
10398          this.net = castToMoney(value); // Money
10399        } else if (name.equals("noteNumber")) {
10400          this.getNoteNumber().add(castToPositiveInt(value));
10401        } else if (name.equals("adjudication")) {
10402          this.getAdjudication().add((AdjudicationComponent) value);
10403        } else
10404          return super.setProperty(name, value);
10405        return value;
10406      }
10407
10408      @Override
10409      public Base makeProperty(int hash, String name) throws FHIRException {
10410        switch (hash) {
10411        case 1957227299:  return getProductOrService(); 
10412        case -615513385:  return addModifier(); 
10413        case -1285004149:  return getQuantity(); 
10414        case -486196699:  return getUnitPrice(); 
10415        case -1282148017:  return getFactorElement();
10416        case 108957:  return getNet(); 
10417        case -1110033957:  return addNoteNumberElement();
10418        case -231349275:  return addAdjudication(); 
10419        default: return super.makeProperty(hash, name);
10420        }
10421
10422      }
10423
10424      @Override
10425      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10426        switch (hash) {
10427        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
10428        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
10429        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
10430        case -486196699: /*unitPrice*/ return new String[] {"Money"};
10431        case -1282148017: /*factor*/ return new String[] {"decimal"};
10432        case 108957: /*net*/ return new String[] {"Money"};
10433        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
10434        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
10435        default: return super.getTypesForProperty(hash, name);
10436        }
10437
10438      }
10439
10440      @Override
10441      public Base addChild(String name) throws FHIRException {
10442        if (name.equals("productOrService")) {
10443          this.productOrService = new CodeableConcept();
10444          return this.productOrService;
10445        }
10446        else if (name.equals("modifier")) {
10447          return addModifier();
10448        }
10449        else if (name.equals("quantity")) {
10450          this.quantity = new Quantity();
10451          return this.quantity;
10452        }
10453        else if (name.equals("unitPrice")) {
10454          this.unitPrice = new Money();
10455          return this.unitPrice;
10456        }
10457        else if (name.equals("factor")) {
10458          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
10459        }
10460        else if (name.equals("net")) {
10461          this.net = new Money();
10462          return this.net;
10463        }
10464        else if (name.equals("noteNumber")) {
10465          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
10466        }
10467        else if (name.equals("adjudication")) {
10468          return addAdjudication();
10469        }
10470        else
10471          return super.addChild(name);
10472      }
10473
10474      public AddedItemDetailSubDetailComponent copy() {
10475        AddedItemDetailSubDetailComponent dst = new AddedItemDetailSubDetailComponent();
10476        copyValues(dst);
10477        return dst;
10478      }
10479
10480      public void copyValues(AddedItemDetailSubDetailComponent dst) {
10481        super.copyValues(dst);
10482        dst.productOrService = productOrService == null ? null : productOrService.copy();
10483        if (modifier != null) {
10484          dst.modifier = new ArrayList<CodeableConcept>();
10485          for (CodeableConcept i : modifier)
10486            dst.modifier.add(i.copy());
10487        };
10488        dst.quantity = quantity == null ? null : quantity.copy();
10489        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
10490        dst.factor = factor == null ? null : factor.copy();
10491        dst.net = net == null ? null : net.copy();
10492        if (noteNumber != null) {
10493          dst.noteNumber = new ArrayList<PositiveIntType>();
10494          for (PositiveIntType i : noteNumber)
10495            dst.noteNumber.add(i.copy());
10496        };
10497        if (adjudication != null) {
10498          dst.adjudication = new ArrayList<AdjudicationComponent>();
10499          for (AdjudicationComponent i : adjudication)
10500            dst.adjudication.add(i.copy());
10501        };
10502      }
10503
10504      @Override
10505      public boolean equalsDeep(Base other_) {
10506        if (!super.equalsDeep(other_))
10507          return false;
10508        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
10509          return false;
10510        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
10511        return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
10512           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
10513           && compareDeep(net, o.net, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
10514          ;
10515      }
10516
10517      @Override
10518      public boolean equalsShallow(Base other_) {
10519        if (!super.equalsShallow(other_))
10520          return false;
10521        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
10522          return false;
10523        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
10524        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
10525      }
10526
10527      public boolean isEmpty() {
10528        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier
10529          , quantity, unitPrice, factor, net, noteNumber, adjudication);
10530      }
10531
10532  public String fhirType() {
10533    return "ExplanationOfBenefit.addItem.detail.subDetail";
10534
10535  }
10536
10537  }
10538
10539    @Block()
10540    public static class TotalComponent extends BackboneElement implements IBaseBackboneElement {
10541        /**
10542         * 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.
10543         */
10544        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
10545        @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." )
10546        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
10547        protected CodeableConcept category;
10548
10549        /**
10550         * Monetary total amount associated with the category.
10551         */
10552        @Child(name = "amount", type = {Money.class}, order=2, min=1, max=1, modifier=false, summary=true)
10553        @Description(shortDefinition="Financial total for the category", formalDefinition="Monetary total amount associated with the category." )
10554        protected Money amount;
10555
10556        private static final long serialVersionUID = 2012310309L;
10557
10558    /**
10559     * Constructor
10560     */
10561      public TotalComponent() {
10562        super();
10563      }
10564
10565    /**
10566     * Constructor
10567     */
10568      public TotalComponent(CodeableConcept category, Money amount) {
10569        super();
10570        this.category = category;
10571        this.amount = amount;
10572      }
10573
10574        /**
10575         * @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.)
10576         */
10577        public CodeableConcept getCategory() { 
10578          if (this.category == null)
10579            if (Configuration.errorOnAutoCreate())
10580              throw new Error("Attempt to auto-create TotalComponent.category");
10581            else if (Configuration.doAutoCreate())
10582              this.category = new CodeableConcept(); // cc
10583          return this.category;
10584        }
10585
10586        public boolean hasCategory() { 
10587          return this.category != null && !this.category.isEmpty();
10588        }
10589
10590        /**
10591         * @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.)
10592         */
10593        public TotalComponent setCategory(CodeableConcept value) { 
10594          this.category = value;
10595          return this;
10596        }
10597
10598        /**
10599         * @return {@link #amount} (Monetary total amount associated with the category.)
10600         */
10601        public Money getAmount() { 
10602          if (this.amount == null)
10603            if (Configuration.errorOnAutoCreate())
10604              throw new Error("Attempt to auto-create TotalComponent.amount");
10605            else if (Configuration.doAutoCreate())
10606              this.amount = new Money(); // cc
10607          return this.amount;
10608        }
10609
10610        public boolean hasAmount() { 
10611          return this.amount != null && !this.amount.isEmpty();
10612        }
10613
10614        /**
10615         * @param value {@link #amount} (Monetary total amount associated with the category.)
10616         */
10617        public TotalComponent setAmount(Money value) { 
10618          this.amount = value;
10619          return this;
10620        }
10621
10622        protected void listChildren(List<Property> children) {
10623          super.listChildren(children);
10624          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));
10625          children.add(new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount));
10626        }
10627
10628        @Override
10629        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10630          switch (_hash) {
10631          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);
10632          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount);
10633          default: return super.getNamedProperty(_hash, _name, _checkValid);
10634          }
10635
10636        }
10637
10638      @Override
10639      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10640        switch (hash) {
10641        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
10642        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
10643        default: return super.getProperty(hash, name, checkValid);
10644        }
10645
10646      }
10647
10648      @Override
10649      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10650        switch (hash) {
10651        case 50511102: // category
10652          this.category = castToCodeableConcept(value); // CodeableConcept
10653          return value;
10654        case -1413853096: // amount
10655          this.amount = castToMoney(value); // Money
10656          return value;
10657        default: return super.setProperty(hash, name, value);
10658        }
10659
10660      }
10661
10662      @Override
10663      public Base setProperty(String name, Base value) throws FHIRException {
10664        if (name.equals("category")) {
10665          this.category = castToCodeableConcept(value); // CodeableConcept
10666        } else if (name.equals("amount")) {
10667          this.amount = castToMoney(value); // Money
10668        } else
10669          return super.setProperty(name, value);
10670        return value;
10671      }
10672
10673      @Override
10674      public Base makeProperty(int hash, String name) throws FHIRException {
10675        switch (hash) {
10676        case 50511102:  return getCategory(); 
10677        case -1413853096:  return getAmount(); 
10678        default: return super.makeProperty(hash, name);
10679        }
10680
10681      }
10682
10683      @Override
10684      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10685        switch (hash) {
10686        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
10687        case -1413853096: /*amount*/ return new String[] {"Money"};
10688        default: return super.getTypesForProperty(hash, name);
10689        }
10690
10691      }
10692
10693      @Override
10694      public Base addChild(String name) throws FHIRException {
10695        if (name.equals("category")) {
10696          this.category = new CodeableConcept();
10697          return this.category;
10698        }
10699        else if (name.equals("amount")) {
10700          this.amount = new Money();
10701          return this.amount;
10702        }
10703        else
10704          return super.addChild(name);
10705      }
10706
10707      public TotalComponent copy() {
10708        TotalComponent dst = new TotalComponent();
10709        copyValues(dst);
10710        return dst;
10711      }
10712
10713      public void copyValues(TotalComponent dst) {
10714        super.copyValues(dst);
10715        dst.category = category == null ? null : category.copy();
10716        dst.amount = amount == null ? null : amount.copy();
10717      }
10718
10719      @Override
10720      public boolean equalsDeep(Base other_) {
10721        if (!super.equalsDeep(other_))
10722          return false;
10723        if (!(other_ instanceof TotalComponent))
10724          return false;
10725        TotalComponent o = (TotalComponent) other_;
10726        return compareDeep(category, o.category, true) && compareDeep(amount, o.amount, true);
10727      }
10728
10729      @Override
10730      public boolean equalsShallow(Base other_) {
10731        if (!super.equalsShallow(other_))
10732          return false;
10733        if (!(other_ instanceof TotalComponent))
10734          return false;
10735        TotalComponent o = (TotalComponent) other_;
10736        return true;
10737      }
10738
10739      public boolean isEmpty() {
10740        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, amount);
10741      }
10742
10743  public String fhirType() {
10744    return "ExplanationOfBenefit.total";
10745
10746  }
10747
10748  }
10749
10750    @Block()
10751    public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
10752        /**
10753         * Whether this represents partial or complete payment of the benefits payable.
10754         */
10755        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
10756        @Description(shortDefinition="Partial or complete payment", formalDefinition="Whether this represents partial or complete payment of the benefits payable." )
10757        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-paymenttype")
10758        protected CodeableConcept type;
10759
10760        /**
10761         * Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.
10762         */
10763        @Child(name = "adjustment", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
10764        @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." )
10765        protected Money adjustment;
10766
10767        /**
10768         * Reason for the payment adjustment.
10769         */
10770        @Child(name = "adjustmentReason", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
10771        @Description(shortDefinition="Explanation for the variance", formalDefinition="Reason for the payment adjustment." )
10772        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
10773        protected CodeableConcept adjustmentReason;
10774
10775        /**
10776         * Estimated date the payment will be issued or the actual issue date of payment.
10777         */
10778        @Child(name = "date", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=false)
10779        @Description(shortDefinition="Expected date of payment", formalDefinition="Estimated date the payment will be issued or the actual issue date of payment." )
10780        protected DateType date;
10781
10782        /**
10783         * Benefits payable less any payment adjustment.
10784         */
10785        @Child(name = "amount", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
10786        @Description(shortDefinition="Payable amount after adjustment", formalDefinition="Benefits payable less any payment adjustment." )
10787        protected Money amount;
10788
10789        /**
10790         * Issuer's unique identifier for the payment instrument.
10791         */
10792        @Child(name = "identifier", type = {Identifier.class}, order=6, min=0, max=1, modifier=false, summary=false)
10793        @Description(shortDefinition="Business identifier for the payment", formalDefinition="Issuer's unique identifier for the payment instrument." )
10794        protected Identifier identifier;
10795
10796        private static final long serialVersionUID = 1539906026L;
10797
10798    /**
10799     * Constructor
10800     */
10801      public PaymentComponent() {
10802        super();
10803      }
10804
10805        /**
10806         * @return {@link #type} (Whether this represents partial or complete payment of the benefits payable.)
10807         */
10808        public CodeableConcept getType() { 
10809          if (this.type == null)
10810            if (Configuration.errorOnAutoCreate())
10811              throw new Error("Attempt to auto-create PaymentComponent.type");
10812            else if (Configuration.doAutoCreate())
10813              this.type = new CodeableConcept(); // cc
10814          return this.type;
10815        }
10816
10817        public boolean hasType() { 
10818          return this.type != null && !this.type.isEmpty();
10819        }
10820
10821        /**
10822         * @param value {@link #type} (Whether this represents partial or complete payment of the benefits payable.)
10823         */
10824        public PaymentComponent setType(CodeableConcept value) { 
10825          this.type = value;
10826          return this;
10827        }
10828
10829        /**
10830         * @return {@link #adjustment} (Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.)
10831         */
10832        public Money getAdjustment() { 
10833          if (this.adjustment == null)
10834            if (Configuration.errorOnAutoCreate())
10835              throw new Error("Attempt to auto-create PaymentComponent.adjustment");
10836            else if (Configuration.doAutoCreate())
10837              this.adjustment = new Money(); // cc
10838          return this.adjustment;
10839        }
10840
10841        public boolean hasAdjustment() { 
10842          return this.adjustment != null && !this.adjustment.isEmpty();
10843        }
10844
10845        /**
10846         * @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.)
10847         */
10848        public PaymentComponent setAdjustment(Money value) { 
10849          this.adjustment = value;
10850          return this;
10851        }
10852
10853        /**
10854         * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
10855         */
10856        public CodeableConcept getAdjustmentReason() { 
10857          if (this.adjustmentReason == null)
10858            if (Configuration.errorOnAutoCreate())
10859              throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
10860            else if (Configuration.doAutoCreate())
10861              this.adjustmentReason = new CodeableConcept(); // cc
10862          return this.adjustmentReason;
10863        }
10864
10865        public boolean hasAdjustmentReason() { 
10866          return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
10867        }
10868
10869        /**
10870         * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
10871         */
10872        public PaymentComponent setAdjustmentReason(CodeableConcept value) { 
10873          this.adjustmentReason = value;
10874          return this;
10875        }
10876
10877        /**
10878         * @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
10879         */
10880        public DateType getDateElement() { 
10881          if (this.date == null)
10882            if (Configuration.errorOnAutoCreate())
10883              throw new Error("Attempt to auto-create PaymentComponent.date");
10884            else if (Configuration.doAutoCreate())
10885              this.date = new DateType(); // bb
10886          return this.date;
10887        }
10888
10889        public boolean hasDateElement() { 
10890          return this.date != null && !this.date.isEmpty();
10891        }
10892
10893        public boolean hasDate() { 
10894          return this.date != null && !this.date.isEmpty();
10895        }
10896
10897        /**
10898         * @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
10899         */
10900        public PaymentComponent setDateElement(DateType value) { 
10901          this.date = value;
10902          return this;
10903        }
10904
10905        /**
10906         * @return Estimated date the payment will be issued or the actual issue date of payment.
10907         */
10908        public Date getDate() { 
10909          return this.date == null ? null : this.date.getValue();
10910        }
10911
10912        /**
10913         * @param value Estimated date the payment will be issued or the actual issue date of payment.
10914         */
10915        public PaymentComponent setDate(Date value) { 
10916          if (value == null)
10917            this.date = null;
10918          else {
10919            if (this.date == null)
10920              this.date = new DateType();
10921            this.date.setValue(value);
10922          }
10923          return this;
10924        }
10925
10926        /**
10927         * @return {@link #amount} (Benefits payable less any payment adjustment.)
10928         */
10929        public Money getAmount() { 
10930          if (this.amount == null)
10931            if (Configuration.errorOnAutoCreate())
10932              throw new Error("Attempt to auto-create PaymentComponent.amount");
10933            else if (Configuration.doAutoCreate())
10934              this.amount = new Money(); // cc
10935          return this.amount;
10936        }
10937
10938        public boolean hasAmount() { 
10939          return this.amount != null && !this.amount.isEmpty();
10940        }
10941
10942        /**
10943         * @param value {@link #amount} (Benefits payable less any payment adjustment.)
10944         */
10945        public PaymentComponent setAmount(Money value) { 
10946          this.amount = value;
10947          return this;
10948        }
10949
10950        /**
10951         * @return {@link #identifier} (Issuer's unique identifier for the payment instrument.)
10952         */
10953        public Identifier getIdentifier() { 
10954          if (this.identifier == null)
10955            if (Configuration.errorOnAutoCreate())
10956              throw new Error("Attempt to auto-create PaymentComponent.identifier");
10957            else if (Configuration.doAutoCreate())
10958              this.identifier = new Identifier(); // cc
10959          return this.identifier;
10960        }
10961
10962        public boolean hasIdentifier() { 
10963          return this.identifier != null && !this.identifier.isEmpty();
10964        }
10965
10966        /**
10967         * @param value {@link #identifier} (Issuer's unique identifier for the payment instrument.)
10968         */
10969        public PaymentComponent setIdentifier(Identifier value) { 
10970          this.identifier = value;
10971          return this;
10972        }
10973
10974        protected void listChildren(List<Property> children) {
10975          super.listChildren(children);
10976          children.add(new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type));
10977          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));
10978          children.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason));
10979          children.add(new Property("date", "date", "Estimated date the payment will be issued or the actual issue date of payment.", 0, 1, date));
10980          children.add(new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount));
10981          children.add(new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0, 1, identifier));
10982        }
10983
10984        @Override
10985        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10986          switch (_hash) {
10987          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type);
10988          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);
10989          case -1255938543: /*adjustmentReason*/  return new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason);
10990          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);
10991          case -1413853096: /*amount*/  return new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount);
10992          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0, 1, identifier);
10993          default: return super.getNamedProperty(_hash, _name, _checkValid);
10994          }
10995
10996        }
10997
10998      @Override
10999      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11000        switch (hash) {
11001        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
11002        case 1977085293: /*adjustment*/ return this.adjustment == null ? new Base[0] : new Base[] {this.adjustment}; // Money
11003        case -1255938543: /*adjustmentReason*/ return this.adjustmentReason == null ? new Base[0] : new Base[] {this.adjustmentReason}; // CodeableConcept
11004        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
11005        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
11006        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
11007        default: return super.getProperty(hash, name, checkValid);
11008        }
11009
11010      }
11011
11012      @Override
11013      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11014        switch (hash) {
11015        case 3575610: // type
11016          this.type = castToCodeableConcept(value); // CodeableConcept
11017          return value;
11018        case 1977085293: // adjustment
11019          this.adjustment = castToMoney(value); // Money
11020          return value;
11021        case -1255938543: // adjustmentReason
11022          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
11023          return value;
11024        case 3076014: // date
11025          this.date = castToDate(value); // DateType
11026          return value;
11027        case -1413853096: // amount
11028          this.amount = castToMoney(value); // Money
11029          return value;
11030        case -1618432855: // identifier
11031          this.identifier = castToIdentifier(value); // Identifier
11032          return value;
11033        default: return super.setProperty(hash, name, value);
11034        }
11035
11036      }
11037
11038      @Override
11039      public Base setProperty(String name, Base value) throws FHIRException {
11040        if (name.equals("type")) {
11041          this.type = castToCodeableConcept(value); // CodeableConcept
11042        } else if (name.equals("adjustment")) {
11043          this.adjustment = castToMoney(value); // Money
11044        } else if (name.equals("adjustmentReason")) {
11045          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
11046        } else if (name.equals("date")) {
11047          this.date = castToDate(value); // DateType
11048        } else if (name.equals("amount")) {
11049          this.amount = castToMoney(value); // Money
11050        } else if (name.equals("identifier")) {
11051          this.identifier = castToIdentifier(value); // Identifier
11052        } else
11053          return super.setProperty(name, value);
11054        return value;
11055      }
11056
11057      @Override
11058      public Base makeProperty(int hash, String name) throws FHIRException {
11059        switch (hash) {
11060        case 3575610:  return getType(); 
11061        case 1977085293:  return getAdjustment(); 
11062        case -1255938543:  return getAdjustmentReason(); 
11063        case 3076014:  return getDateElement();
11064        case -1413853096:  return getAmount(); 
11065        case -1618432855:  return getIdentifier(); 
11066        default: return super.makeProperty(hash, name);
11067        }
11068
11069      }
11070
11071      @Override
11072      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11073        switch (hash) {
11074        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
11075        case 1977085293: /*adjustment*/ return new String[] {"Money"};
11076        case -1255938543: /*adjustmentReason*/ return new String[] {"CodeableConcept"};
11077        case 3076014: /*date*/ return new String[] {"date"};
11078        case -1413853096: /*amount*/ return new String[] {"Money"};
11079        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
11080        default: return super.getTypesForProperty(hash, name);
11081        }
11082
11083      }
11084
11085      @Override
11086      public Base addChild(String name) throws FHIRException {
11087        if (name.equals("type")) {
11088          this.type = new CodeableConcept();
11089          return this.type;
11090        }
11091        else if (name.equals("adjustment")) {
11092          this.adjustment = new Money();
11093          return this.adjustment;
11094        }
11095        else if (name.equals("adjustmentReason")) {
11096          this.adjustmentReason = new CodeableConcept();
11097          return this.adjustmentReason;
11098        }
11099        else if (name.equals("date")) {
11100          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
11101        }
11102        else if (name.equals("amount")) {
11103          this.amount = new Money();
11104          return this.amount;
11105        }
11106        else if (name.equals("identifier")) {
11107          this.identifier = new Identifier();
11108          return this.identifier;
11109        }
11110        else
11111          return super.addChild(name);
11112      }
11113
11114      public PaymentComponent copy() {
11115        PaymentComponent dst = new PaymentComponent();
11116        copyValues(dst);
11117        return dst;
11118      }
11119
11120      public void copyValues(PaymentComponent dst) {
11121        super.copyValues(dst);
11122        dst.type = type == null ? null : type.copy();
11123        dst.adjustment = adjustment == null ? null : adjustment.copy();
11124        dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
11125        dst.date = date == null ? null : date.copy();
11126        dst.amount = amount == null ? null : amount.copy();
11127        dst.identifier = identifier == null ? null : identifier.copy();
11128      }
11129
11130      @Override
11131      public boolean equalsDeep(Base other_) {
11132        if (!super.equalsDeep(other_))
11133          return false;
11134        if (!(other_ instanceof PaymentComponent))
11135          return false;
11136        PaymentComponent o = (PaymentComponent) other_;
11137        return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true) && compareDeep(adjustmentReason, o.adjustmentReason, true)
11138           && compareDeep(date, o.date, true) && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true)
11139          ;
11140      }
11141
11142      @Override
11143      public boolean equalsShallow(Base other_) {
11144        if (!super.equalsShallow(other_))
11145          return false;
11146        if (!(other_ instanceof PaymentComponent))
11147          return false;
11148        PaymentComponent o = (PaymentComponent) other_;
11149        return compareValues(date, o.date, true);
11150      }
11151
11152      public boolean isEmpty() {
11153        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason
11154          , date, amount, identifier);
11155      }
11156
11157  public String fhirType() {
11158    return "ExplanationOfBenefit.payment";
11159
11160  }
11161
11162  }
11163
11164    @Block()
11165    public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
11166        /**
11167         * A number to uniquely identify a note entry.
11168         */
11169        @Child(name = "number", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
11170        @Description(shortDefinition="Note instance identifier", formalDefinition="A number to uniquely identify a note entry." )
11171        protected PositiveIntType number;
11172
11173        /**
11174         * The business purpose of the note text.
11175         */
11176        @Child(name = "type", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
11177        @Description(shortDefinition="display | print | printoper", formalDefinition="The business purpose of the note text." )
11178        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/note-type")
11179        protected Enumeration<NoteType> type;
11180
11181        /**
11182         * The explanation or description associated with the processing.
11183         */
11184        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
11185        @Description(shortDefinition="Note explanatory text", formalDefinition="The explanation or description associated with the processing." )
11186        protected StringType text;
11187
11188        /**
11189         * A code to define the language used in the text of the note.
11190         */
11191        @Child(name = "language", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
11192        @Description(shortDefinition="Language of the text", formalDefinition="A code to define the language used in the text of the note." )
11193        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
11194        protected CodeableConcept language;
11195
11196        private static final long serialVersionUID = -385184277L;
11197
11198    /**
11199     * Constructor
11200     */
11201      public NoteComponent() {
11202        super();
11203      }
11204
11205        /**
11206         * @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
11207         */
11208        public PositiveIntType getNumberElement() { 
11209          if (this.number == null)
11210            if (Configuration.errorOnAutoCreate())
11211              throw new Error("Attempt to auto-create NoteComponent.number");
11212            else if (Configuration.doAutoCreate())
11213              this.number = new PositiveIntType(); // bb
11214          return this.number;
11215        }
11216
11217        public boolean hasNumberElement() { 
11218          return this.number != null && !this.number.isEmpty();
11219        }
11220
11221        public boolean hasNumber() { 
11222          return this.number != null && !this.number.isEmpty();
11223        }
11224
11225        /**
11226         * @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
11227         */
11228        public NoteComponent setNumberElement(PositiveIntType value) { 
11229          this.number = value;
11230          return this;
11231        }
11232
11233        /**
11234         * @return A number to uniquely identify a note entry.
11235         */
11236        public int getNumber() { 
11237          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
11238        }
11239
11240        /**
11241         * @param value A number to uniquely identify a note entry.
11242         */
11243        public NoteComponent setNumber(int value) { 
11244            if (this.number == null)
11245              this.number = new PositiveIntType();
11246            this.number.setValue(value);
11247          return this;
11248        }
11249
11250        /**
11251         * @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
11252         */
11253        public Enumeration<NoteType> getTypeElement() { 
11254          if (this.type == null)
11255            if (Configuration.errorOnAutoCreate())
11256              throw new Error("Attempt to auto-create NoteComponent.type");
11257            else if (Configuration.doAutoCreate())
11258              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory()); // bb
11259          return this.type;
11260        }
11261
11262        public boolean hasTypeElement() { 
11263          return this.type != null && !this.type.isEmpty();
11264        }
11265
11266        public boolean hasType() { 
11267          return this.type != null && !this.type.isEmpty();
11268        }
11269
11270        /**
11271         * @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
11272         */
11273        public NoteComponent setTypeElement(Enumeration<NoteType> value) { 
11274          this.type = value;
11275          return this;
11276        }
11277
11278        /**
11279         * @return The business purpose of the note text.
11280         */
11281        public NoteType getType() { 
11282          return this.type == null ? null : this.type.getValue();
11283        }
11284
11285        /**
11286         * @param value The business purpose of the note text.
11287         */
11288        public NoteComponent setType(NoteType value) { 
11289          if (value == null)
11290            this.type = null;
11291          else {
11292            if (this.type == null)
11293              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory());
11294            this.type.setValue(value);
11295          }
11296          return this;
11297        }
11298
11299        /**
11300         * @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
11301         */
11302        public StringType getTextElement() { 
11303          if (this.text == null)
11304            if (Configuration.errorOnAutoCreate())
11305              throw new Error("Attempt to auto-create NoteComponent.text");
11306            else if (Configuration.doAutoCreate())
11307              this.text = new StringType(); // bb
11308          return this.text;
11309        }
11310
11311        public boolean hasTextElement() { 
11312          return this.text != null && !this.text.isEmpty();
11313        }
11314
11315        public boolean hasText() { 
11316          return this.text != null && !this.text.isEmpty();
11317        }
11318
11319        /**
11320         * @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
11321         */
11322        public NoteComponent setTextElement(StringType value) { 
11323          this.text = value;
11324          return this;
11325        }
11326
11327        /**
11328         * @return The explanation or description associated with the processing.
11329         */
11330        public String getText() { 
11331          return this.text == null ? null : this.text.getValue();
11332        }
11333
11334        /**
11335         * @param value The explanation or description associated with the processing.
11336         */
11337        public NoteComponent setText(String value) { 
11338          if (Utilities.noString(value))
11339            this.text = null;
11340          else {
11341            if (this.text == null)
11342              this.text = new StringType();
11343            this.text.setValue(value);
11344          }
11345          return this;
11346        }
11347
11348        /**
11349         * @return {@link #language} (A code to define the language used in the text of the note.)
11350         */
11351        public CodeableConcept getLanguage() { 
11352          if (this.language == null)
11353            if (Configuration.errorOnAutoCreate())
11354              throw new Error("Attempt to auto-create NoteComponent.language");
11355            else if (Configuration.doAutoCreate())
11356              this.language = new CodeableConcept(); // cc
11357          return this.language;
11358        }
11359
11360        public boolean hasLanguage() { 
11361          return this.language != null && !this.language.isEmpty();
11362        }
11363
11364        /**
11365         * @param value {@link #language} (A code to define the language used in the text of the note.)
11366         */
11367        public NoteComponent setLanguage(CodeableConcept value) { 
11368          this.language = value;
11369          return this;
11370        }
11371
11372        protected void listChildren(List<Property> children) {
11373          super.listChildren(children);
11374          children.add(new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number));
11375          children.add(new Property("type", "code", "The business purpose of the note text.", 0, 1, type));
11376          children.add(new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text));
11377          children.add(new Property("language", "CodeableConcept", "A code to define the language used in the text of the note.", 0, 1, language));
11378        }
11379
11380        @Override
11381        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11382          switch (_hash) {
11383          case -1034364087: /*number*/  return new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number);
11384          case 3575610: /*type*/  return new Property("type", "code", "The business purpose of the note text.", 0, 1, type);
11385          case 3556653: /*text*/  return new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text);
11386          case -1613589672: /*language*/  return new Property("language", "CodeableConcept", "A code to define the language used in the text of the note.", 0, 1, language);
11387          default: return super.getNamedProperty(_hash, _name, _checkValid);
11388          }
11389
11390        }
11391
11392      @Override
11393      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11394        switch (hash) {
11395        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // PositiveIntType
11396        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<NoteType>
11397        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
11398        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeableConcept
11399        default: return super.getProperty(hash, name, checkValid);
11400        }
11401
11402      }
11403
11404      @Override
11405      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11406        switch (hash) {
11407        case -1034364087: // number
11408          this.number = castToPositiveInt(value); // PositiveIntType
11409          return value;
11410        case 3575610: // type
11411          value = new NoteTypeEnumFactory().fromType(castToCode(value));
11412          this.type = (Enumeration) value; // Enumeration<NoteType>
11413          return value;
11414        case 3556653: // text
11415          this.text = castToString(value); // StringType
11416          return value;
11417        case -1613589672: // language
11418          this.language = castToCodeableConcept(value); // CodeableConcept
11419          return value;
11420        default: return super.setProperty(hash, name, value);
11421        }
11422
11423      }
11424
11425      @Override
11426      public Base setProperty(String name, Base value) throws FHIRException {
11427        if (name.equals("number")) {
11428          this.number = castToPositiveInt(value); // PositiveIntType
11429        } else if (name.equals("type")) {
11430          value = new NoteTypeEnumFactory().fromType(castToCode(value));
11431          this.type = (Enumeration) value; // Enumeration<NoteType>
11432        } else if (name.equals("text")) {
11433          this.text = castToString(value); // StringType
11434        } else if (name.equals("language")) {
11435          this.language = castToCodeableConcept(value); // CodeableConcept
11436        } else
11437          return super.setProperty(name, value);
11438        return value;
11439      }
11440
11441      @Override
11442      public Base makeProperty(int hash, String name) throws FHIRException {
11443        switch (hash) {
11444        case -1034364087:  return getNumberElement();
11445        case 3575610:  return getTypeElement();
11446        case 3556653:  return getTextElement();
11447        case -1613589672:  return getLanguage(); 
11448        default: return super.makeProperty(hash, name);
11449        }
11450
11451      }
11452
11453      @Override
11454      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11455        switch (hash) {
11456        case -1034364087: /*number*/ return new String[] {"positiveInt"};
11457        case 3575610: /*type*/ return new String[] {"code"};
11458        case 3556653: /*text*/ return new String[] {"string"};
11459        case -1613589672: /*language*/ return new String[] {"CodeableConcept"};
11460        default: return super.getTypesForProperty(hash, name);
11461        }
11462
11463      }
11464
11465      @Override
11466      public Base addChild(String name) throws FHIRException {
11467        if (name.equals("number")) {
11468          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.number");
11469        }
11470        else if (name.equals("type")) {
11471          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.type");
11472        }
11473        else if (name.equals("text")) {
11474          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.text");
11475        }
11476        else if (name.equals("language")) {
11477          this.language = new CodeableConcept();
11478          return this.language;
11479        }
11480        else
11481          return super.addChild(name);
11482      }
11483
11484      public NoteComponent copy() {
11485        NoteComponent dst = new NoteComponent();
11486        copyValues(dst);
11487        return dst;
11488      }
11489
11490      public void copyValues(NoteComponent dst) {
11491        super.copyValues(dst);
11492        dst.number = number == null ? null : number.copy();
11493        dst.type = type == null ? null : type.copy();
11494        dst.text = text == null ? null : text.copy();
11495        dst.language = language == null ? null : language.copy();
11496      }
11497
11498      @Override
11499      public boolean equalsDeep(Base other_) {
11500        if (!super.equalsDeep(other_))
11501          return false;
11502        if (!(other_ instanceof NoteComponent))
11503          return false;
11504        NoteComponent o = (NoteComponent) other_;
11505        return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
11506           && compareDeep(language, o.language, true);
11507      }
11508
11509      @Override
11510      public boolean equalsShallow(Base other_) {
11511        if (!super.equalsShallow(other_))
11512          return false;
11513        if (!(other_ instanceof NoteComponent))
11514          return false;
11515        NoteComponent o = (NoteComponent) other_;
11516        return compareValues(number, o.number, true) && compareValues(type, o.type, true) && compareValues(text, o.text, true)
11517          ;
11518      }
11519
11520      public boolean isEmpty() {
11521        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language
11522          );
11523      }
11524
11525  public String fhirType() {
11526    return "ExplanationOfBenefit.processNote";
11527
11528  }
11529
11530  }
11531
11532    @Block()
11533    public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
11534        /**
11535         * Code to identify the general type of benefits under which products and services are provided.
11536         */
11537        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
11538        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
11539        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
11540        protected CodeableConcept category;
11541
11542        /**
11543         * 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.
11544         */
11545        @Child(name = "excluded", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
11546        @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." )
11547        protected BooleanType excluded;
11548
11549        /**
11550         * A short name or tag for the benefit.
11551         */
11552        @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
11553        @Description(shortDefinition="Short name for the benefit", formalDefinition="A short name or tag for the benefit." )
11554        protected StringType name;
11555
11556        /**
11557         * A richer description of the benefit or services covered.
11558         */
11559        @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
11560        @Description(shortDefinition="Description of the benefit or services covered", formalDefinition="A richer description of the benefit or services covered." )
11561        protected StringType description;
11562
11563        /**
11564         * Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.
11565         */
11566        @Child(name = "network", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
11567        @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." )
11568        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-network")
11569        protected CodeableConcept network;
11570
11571        /**
11572         * Indicates if the benefits apply to an individual or to the family.
11573         */
11574        @Child(name = "unit", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
11575        @Description(shortDefinition="Individual or family", formalDefinition="Indicates if the benefits apply to an individual or to the family." )
11576        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-unit")
11577        protected CodeableConcept unit;
11578
11579        /**
11580         * The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.
11581         */
11582        @Child(name = "term", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
11583        @Description(shortDefinition="Annual or lifetime", formalDefinition="The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'." )
11584        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-term")
11585        protected CodeableConcept term;
11586
11587        /**
11588         * Benefits Used to date.
11589         */
11590        @Child(name = "financial", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
11591        @Description(shortDefinition="Benefit Summary", formalDefinition="Benefits Used to date." )
11592        protected List<BenefitComponent> financial;
11593
11594        private static final long serialVersionUID = -1889655824L;
11595
11596    /**
11597     * Constructor
11598     */
11599      public BenefitBalanceComponent() {
11600        super();
11601      }
11602
11603    /**
11604     * Constructor
11605     */
11606      public BenefitBalanceComponent(CodeableConcept category) {
11607        super();
11608        this.category = category;
11609      }
11610
11611        /**
11612         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
11613         */
11614        public CodeableConcept getCategory() { 
11615          if (this.category == null)
11616            if (Configuration.errorOnAutoCreate())
11617              throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
11618            else if (Configuration.doAutoCreate())
11619              this.category = new CodeableConcept(); // cc
11620          return this.category;
11621        }
11622
11623        public boolean hasCategory() { 
11624          return this.category != null && !this.category.isEmpty();
11625        }
11626
11627        /**
11628         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
11629         */
11630        public BenefitBalanceComponent setCategory(CodeableConcept value) { 
11631          this.category = value;
11632          return this;
11633        }
11634
11635        /**
11636         * @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
11637         */
11638        public BooleanType getExcludedElement() { 
11639          if (this.excluded == null)
11640            if (Configuration.errorOnAutoCreate())
11641              throw new Error("Attempt to auto-create BenefitBalanceComponent.excluded");
11642            else if (Configuration.doAutoCreate())
11643              this.excluded = new BooleanType(); // bb
11644          return this.excluded;
11645        }
11646
11647        public boolean hasExcludedElement() { 
11648          return this.excluded != null && !this.excluded.isEmpty();
11649        }
11650
11651        public boolean hasExcluded() { 
11652          return this.excluded != null && !this.excluded.isEmpty();
11653        }
11654
11655        /**
11656         * @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
11657         */
11658        public BenefitBalanceComponent setExcludedElement(BooleanType value) { 
11659          this.excluded = value;
11660          return this;
11661        }
11662
11663        /**
11664         * @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.
11665         */
11666        public boolean getExcluded() { 
11667          return this.excluded == null || this.excluded.isEmpty() ? false : this.excluded.getValue();
11668        }
11669
11670        /**
11671         * @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.
11672         */
11673        public BenefitBalanceComponent setExcluded(boolean value) { 
11674            if (this.excluded == null)
11675              this.excluded = new BooleanType();
11676            this.excluded.setValue(value);
11677          return this;
11678        }
11679
11680        /**
11681         * @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
11682         */
11683        public StringType getNameElement() { 
11684          if (this.name == null)
11685            if (Configuration.errorOnAutoCreate())
11686              throw new Error("Attempt to auto-create BenefitBalanceComponent.name");
11687            else if (Configuration.doAutoCreate())
11688              this.name = new StringType(); // bb
11689          return this.name;
11690        }
11691
11692        public boolean hasNameElement() { 
11693          return this.name != null && !this.name.isEmpty();
11694        }
11695
11696        public boolean hasName() { 
11697          return this.name != null && !this.name.isEmpty();
11698        }
11699
11700        /**
11701         * @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
11702         */
11703        public BenefitBalanceComponent setNameElement(StringType value) { 
11704          this.name = value;
11705          return this;
11706        }
11707
11708        /**
11709         * @return A short name or tag for the benefit.
11710         */
11711        public String getName() { 
11712          return this.name == null ? null : this.name.getValue();
11713        }
11714
11715        /**
11716         * @param value A short name or tag for the benefit.
11717         */
11718        public BenefitBalanceComponent setName(String value) { 
11719          if (Utilities.noString(value))
11720            this.name = null;
11721          else {
11722            if (this.name == null)
11723              this.name = new StringType();
11724            this.name.setValue(value);
11725          }
11726          return this;
11727        }
11728
11729        /**
11730         * @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
11731         */
11732        public StringType getDescriptionElement() { 
11733          if (this.description == null)
11734            if (Configuration.errorOnAutoCreate())
11735              throw new Error("Attempt to auto-create BenefitBalanceComponent.description");
11736            else if (Configuration.doAutoCreate())
11737              this.description = new StringType(); // bb
11738          return this.description;
11739        }
11740
11741        public boolean hasDescriptionElement() { 
11742          return this.description != null && !this.description.isEmpty();
11743        }
11744
11745        public boolean hasDescription() { 
11746          return this.description != null && !this.description.isEmpty();
11747        }
11748
11749        /**
11750         * @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
11751         */
11752        public BenefitBalanceComponent setDescriptionElement(StringType value) { 
11753          this.description = value;
11754          return this;
11755        }
11756
11757        /**
11758         * @return A richer description of the benefit or services covered.
11759         */
11760        public String getDescription() { 
11761          return this.description == null ? null : this.description.getValue();
11762        }
11763
11764        /**
11765         * @param value A richer description of the benefit or services covered.
11766         */
11767        public BenefitBalanceComponent setDescription(String value) { 
11768          if (Utilities.noString(value))
11769            this.description = null;
11770          else {
11771            if (this.description == null)
11772              this.description = new StringType();
11773            this.description.setValue(value);
11774          }
11775          return this;
11776        }
11777
11778        /**
11779         * @return {@link #network} (Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.)
11780         */
11781        public CodeableConcept getNetwork() { 
11782          if (this.network == null)
11783            if (Configuration.errorOnAutoCreate())
11784              throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
11785            else if (Configuration.doAutoCreate())
11786              this.network = new CodeableConcept(); // cc
11787          return this.network;
11788        }
11789
11790        public boolean hasNetwork() { 
11791          return this.network != null && !this.network.isEmpty();
11792        }
11793
11794        /**
11795         * @param value {@link #network} (Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.)
11796         */
11797        public BenefitBalanceComponent setNetwork(CodeableConcept value) { 
11798          this.network = value;
11799          return this;
11800        }
11801
11802        /**
11803         * @return {@link #unit} (Indicates if the benefits apply to an individual or to the family.)
11804         */
11805        public CodeableConcept getUnit() { 
11806          if (this.unit == null)
11807            if (Configuration.errorOnAutoCreate())
11808              throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
11809            else if (Configuration.doAutoCreate())
11810              this.unit = new CodeableConcept(); // cc
11811          return this.unit;
11812        }
11813
11814        public boolean hasUnit() { 
11815          return this.unit != null && !this.unit.isEmpty();
11816        }
11817
11818        /**
11819         * @param value {@link #unit} (Indicates if the benefits apply to an individual or to the family.)
11820         */
11821        public BenefitBalanceComponent setUnit(CodeableConcept value) { 
11822          this.unit = value;
11823          return this;
11824        }
11825
11826        /**
11827         * @return {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.)
11828         */
11829        public CodeableConcept getTerm() { 
11830          if (this.term == null)
11831            if (Configuration.errorOnAutoCreate())
11832              throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
11833            else if (Configuration.doAutoCreate())
11834              this.term = new CodeableConcept(); // cc
11835          return this.term;
11836        }
11837
11838        public boolean hasTerm() { 
11839          return this.term != null && !this.term.isEmpty();
11840        }
11841
11842        /**
11843         * @param value {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.)
11844         */
11845        public BenefitBalanceComponent setTerm(CodeableConcept value) { 
11846          this.term = value;
11847          return this;
11848        }
11849
11850        /**
11851         * @return {@link #financial} (Benefits Used to date.)
11852         */
11853        public List<BenefitComponent> getFinancial() { 
11854          if (this.financial == null)
11855            this.financial = new ArrayList<BenefitComponent>();
11856          return this.financial;
11857        }
11858
11859        /**
11860         * @return Returns a reference to <code>this</code> for easy method chaining
11861         */
11862        public BenefitBalanceComponent setFinancial(List<BenefitComponent> theFinancial) { 
11863          this.financial = theFinancial;
11864          return this;
11865        }
11866
11867        public boolean hasFinancial() { 
11868          if (this.financial == null)
11869            return false;
11870          for (BenefitComponent item : this.financial)
11871            if (!item.isEmpty())
11872              return true;
11873          return false;
11874        }
11875
11876        public BenefitComponent addFinancial() { //3
11877          BenefitComponent t = new BenefitComponent();
11878          if (this.financial == null)
11879            this.financial = new ArrayList<BenefitComponent>();
11880          this.financial.add(t);
11881          return t;
11882        }
11883
11884        public BenefitBalanceComponent addFinancial(BenefitComponent t) { //3
11885          if (t == null)
11886            return this;
11887          if (this.financial == null)
11888            this.financial = new ArrayList<BenefitComponent>();
11889          this.financial.add(t);
11890          return this;
11891        }
11892
11893        /**
11894         * @return The first repetition of repeating field {@link #financial}, creating it if it does not already exist
11895         */
11896        public BenefitComponent getFinancialFirstRep() { 
11897          if (getFinancial().isEmpty()) {
11898            addFinancial();
11899          }
11900          return getFinancial().get(0);
11901        }
11902
11903        protected void listChildren(List<Property> children) {
11904          super.listChildren(children);
11905          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
11906          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));
11907          children.add(new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name));
11908          children.add(new Property("description", "string", "A richer description of the benefit or services covered.", 0, 1, description));
11909          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));
11910          children.add(new Property("unit", "CodeableConcept", "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit));
11911          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));
11912          children.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
11913        }
11914
11915        @Override
11916        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11917          switch (_hash) {
11918          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);
11919          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);
11920          case 3373707: /*name*/  return new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name);
11921          case -1724546052: /*description*/  return new Property("description", "string", "A richer description of the benefit or services covered.", 0, 1, description);
11922          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);
11923          case 3594628: /*unit*/  return new Property("unit", "CodeableConcept", "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit);
11924          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);
11925          case 357555337: /*financial*/  return new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial);
11926          default: return super.getNamedProperty(_hash, _name, _checkValid);
11927          }
11928
11929        }
11930
11931      @Override
11932      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11933        switch (hash) {
11934        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
11935        case 1994055114: /*excluded*/ return this.excluded == null ? new Base[0] : new Base[] {this.excluded}; // BooleanType
11936        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
11937        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
11938        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // CodeableConcept
11939        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // CodeableConcept
11940        case 3556460: /*term*/ return this.term == null ? new Base[0] : new Base[] {this.term}; // CodeableConcept
11941        case 357555337: /*financial*/ return this.financial == null ? new Base[0] : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
11942        default: return super.getProperty(hash, name, checkValid);
11943        }
11944
11945      }
11946
11947      @Override
11948      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11949        switch (hash) {
11950        case 50511102: // category
11951          this.category = castToCodeableConcept(value); // CodeableConcept
11952          return value;
11953        case 1994055114: // excluded
11954          this.excluded = castToBoolean(value); // BooleanType
11955          return value;
11956        case 3373707: // name
11957          this.name = castToString(value); // StringType
11958          return value;
11959        case -1724546052: // description
11960          this.description = castToString(value); // StringType
11961          return value;
11962        case 1843485230: // network
11963          this.network = castToCodeableConcept(value); // CodeableConcept
11964          return value;
11965        case 3594628: // unit
11966          this.unit = castToCodeableConcept(value); // CodeableConcept
11967          return value;
11968        case 3556460: // term
11969          this.term = castToCodeableConcept(value); // CodeableConcept
11970          return value;
11971        case 357555337: // financial
11972          this.getFinancial().add((BenefitComponent) value); // BenefitComponent
11973          return value;
11974        default: return super.setProperty(hash, name, value);
11975        }
11976
11977      }
11978
11979      @Override
11980      public Base setProperty(String name, Base value) throws FHIRException {
11981        if (name.equals("category")) {
11982          this.category = castToCodeableConcept(value); // CodeableConcept
11983        } else if (name.equals("excluded")) {
11984          this.excluded = castToBoolean(value); // BooleanType
11985        } else if (name.equals("name")) {
11986          this.name = castToString(value); // StringType
11987        } else if (name.equals("description")) {
11988          this.description = castToString(value); // StringType
11989        } else if (name.equals("network")) {
11990          this.network = castToCodeableConcept(value); // CodeableConcept
11991        } else if (name.equals("unit")) {
11992          this.unit = castToCodeableConcept(value); // CodeableConcept
11993        } else if (name.equals("term")) {
11994          this.term = castToCodeableConcept(value); // CodeableConcept
11995        } else if (name.equals("financial")) {
11996          this.getFinancial().add((BenefitComponent) value);
11997        } else
11998          return super.setProperty(name, value);
11999        return value;
12000      }
12001
12002      @Override
12003      public Base makeProperty(int hash, String name) throws FHIRException {
12004        switch (hash) {
12005        case 50511102:  return getCategory(); 
12006        case 1994055114:  return getExcludedElement();
12007        case 3373707:  return getNameElement();
12008        case -1724546052:  return getDescriptionElement();
12009        case 1843485230:  return getNetwork(); 
12010        case 3594628:  return getUnit(); 
12011        case 3556460:  return getTerm(); 
12012        case 357555337:  return addFinancial(); 
12013        default: return super.makeProperty(hash, name);
12014        }
12015
12016      }
12017
12018      @Override
12019      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12020        switch (hash) {
12021        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
12022        case 1994055114: /*excluded*/ return new String[] {"boolean"};
12023        case 3373707: /*name*/ return new String[] {"string"};
12024        case -1724546052: /*description*/ return new String[] {"string"};
12025        case 1843485230: /*network*/ return new String[] {"CodeableConcept"};
12026        case 3594628: /*unit*/ return new String[] {"CodeableConcept"};
12027        case 3556460: /*term*/ return new String[] {"CodeableConcept"};
12028        case 357555337: /*financial*/ return new String[] {};
12029        default: return super.getTypesForProperty(hash, name);
12030        }
12031
12032      }
12033
12034      @Override
12035      public Base addChild(String name) throws FHIRException {
12036        if (name.equals("category")) {
12037          this.category = new CodeableConcept();
12038          return this.category;
12039        }
12040        else if (name.equals("excluded")) {
12041          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.excluded");
12042        }
12043        else if (name.equals("name")) {
12044          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.name");
12045        }
12046        else if (name.equals("description")) {
12047          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.description");
12048        }
12049        else if (name.equals("network")) {
12050          this.network = new CodeableConcept();
12051          return this.network;
12052        }
12053        else if (name.equals("unit")) {
12054          this.unit = new CodeableConcept();
12055          return this.unit;
12056        }
12057        else if (name.equals("term")) {
12058          this.term = new CodeableConcept();
12059          return this.term;
12060        }
12061        else if (name.equals("financial")) {
12062          return addFinancial();
12063        }
12064        else
12065          return super.addChild(name);
12066      }
12067
12068      public BenefitBalanceComponent copy() {
12069        BenefitBalanceComponent dst = new BenefitBalanceComponent();
12070        copyValues(dst);
12071        return dst;
12072      }
12073
12074      public void copyValues(BenefitBalanceComponent dst) {
12075        super.copyValues(dst);
12076        dst.category = category == null ? null : category.copy();
12077        dst.excluded = excluded == null ? null : excluded.copy();
12078        dst.name = name == null ? null : name.copy();
12079        dst.description = description == null ? null : description.copy();
12080        dst.network = network == null ? null : network.copy();
12081        dst.unit = unit == null ? null : unit.copy();
12082        dst.term = term == null ? null : term.copy();
12083        if (financial != null) {
12084          dst.financial = new ArrayList<BenefitComponent>();
12085          for (BenefitComponent i : financial)
12086            dst.financial.add(i.copy());
12087        };
12088      }
12089
12090      @Override
12091      public boolean equalsDeep(Base other_) {
12092        if (!super.equalsDeep(other_))
12093          return false;
12094        if (!(other_ instanceof BenefitBalanceComponent))
12095          return false;
12096        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
12097        return compareDeep(category, o.category, true) && compareDeep(excluded, o.excluded, true) && compareDeep(name, o.name, true)
12098           && compareDeep(description, o.description, true) && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true)
12099           && compareDeep(term, o.term, true) && compareDeep(financial, o.financial, true);
12100      }
12101
12102      @Override
12103      public boolean equalsShallow(Base other_) {
12104        if (!super.equalsShallow(other_))
12105          return false;
12106        if (!(other_ instanceof BenefitBalanceComponent))
12107          return false;
12108        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
12109        return compareValues(excluded, o.excluded, true) && compareValues(name, o.name, true) && compareValues(description, o.description, true)
12110          ;
12111      }
12112
12113      public boolean isEmpty() {
12114        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, excluded, name
12115          , description, network, unit, term, financial);
12116      }
12117
12118  public String fhirType() {
12119    return "ExplanationOfBenefit.benefitBalance";
12120
12121  }
12122
12123  }
12124
12125    @Block()
12126    public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
12127        /**
12128         * Classification of benefit being provided.
12129         */
12130        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
12131        @Description(shortDefinition="Benefit classification", formalDefinition="Classification of benefit being provided." )
12132        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-type")
12133        protected CodeableConcept type;
12134
12135        /**
12136         * The quantity of the benefit which is permitted under the coverage.
12137         */
12138        @Child(name = "allowed", type = {UnsignedIntType.class, StringType.class, Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
12139        @Description(shortDefinition="Benefits allowed", formalDefinition="The quantity of the benefit which is permitted under the coverage." )
12140        protected Type allowed;
12141
12142        /**
12143         * The quantity of the benefit which have been consumed to date.
12144         */
12145        @Child(name = "used", type = {UnsignedIntType.class, Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
12146        @Description(shortDefinition="Benefits used", formalDefinition="The quantity of the benefit which have been consumed to date." )
12147        protected Type used;
12148
12149        private static final long serialVersionUID = -1506285314L;
12150
12151    /**
12152     * Constructor
12153     */
12154      public BenefitComponent() {
12155        super();
12156      }
12157
12158    /**
12159     * Constructor
12160     */
12161      public BenefitComponent(CodeableConcept type) {
12162        super();
12163        this.type = type;
12164      }
12165
12166        /**
12167         * @return {@link #type} (Classification of benefit being provided.)
12168         */
12169        public CodeableConcept getType() { 
12170          if (this.type == null)
12171            if (Configuration.errorOnAutoCreate())
12172              throw new Error("Attempt to auto-create BenefitComponent.type");
12173            else if (Configuration.doAutoCreate())
12174              this.type = new CodeableConcept(); // cc
12175          return this.type;
12176        }
12177
12178        public boolean hasType() { 
12179          return this.type != null && !this.type.isEmpty();
12180        }
12181
12182        /**
12183         * @param value {@link #type} (Classification of benefit being provided.)
12184         */
12185        public BenefitComponent setType(CodeableConcept value) { 
12186          this.type = value;
12187          return this;
12188        }
12189
12190        /**
12191         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12192         */
12193        public Type getAllowed() { 
12194          return this.allowed;
12195        }
12196
12197        /**
12198         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12199         */
12200        public UnsignedIntType getAllowedUnsignedIntType() throws FHIRException { 
12201          if (this.allowed == null)
12202            this.allowed = new UnsignedIntType();
12203          if (!(this.allowed instanceof UnsignedIntType))
12204            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.allowed.getClass().getName()+" was encountered");
12205          return (UnsignedIntType) this.allowed;
12206        }
12207
12208        public boolean hasAllowedUnsignedIntType() { 
12209          return this != null && this.allowed instanceof UnsignedIntType;
12210        }
12211
12212        /**
12213         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12214         */
12215        public StringType getAllowedStringType() throws FHIRException { 
12216          if (this.allowed == null)
12217            this.allowed = new StringType();
12218          if (!(this.allowed instanceof StringType))
12219            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.allowed.getClass().getName()+" was encountered");
12220          return (StringType) this.allowed;
12221        }
12222
12223        public boolean hasAllowedStringType() { 
12224          return this != null && this.allowed instanceof StringType;
12225        }
12226
12227        /**
12228         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12229         */
12230        public Money getAllowedMoney() throws FHIRException { 
12231          if (this.allowed == null)
12232            this.allowed = new Money();
12233          if (!(this.allowed instanceof Money))
12234            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.allowed.getClass().getName()+" was encountered");
12235          return (Money) this.allowed;
12236        }
12237
12238        public boolean hasAllowedMoney() { 
12239          return this != null && this.allowed instanceof Money;
12240        }
12241
12242        public boolean hasAllowed() { 
12243          return this.allowed != null && !this.allowed.isEmpty();
12244        }
12245
12246        /**
12247         * @param value {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12248         */
12249        public BenefitComponent setAllowed(Type value) { 
12250          if (value != null && !(value instanceof UnsignedIntType || value instanceof StringType || value instanceof Money))
12251            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.allowed[x]: "+value.fhirType());
12252          this.allowed = value;
12253          return this;
12254        }
12255
12256        /**
12257         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
12258         */
12259        public Type getUsed() { 
12260          return this.used;
12261        }
12262
12263        /**
12264         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
12265         */
12266        public UnsignedIntType getUsedUnsignedIntType() throws FHIRException { 
12267          if (this.used == null)
12268            this.used = new UnsignedIntType();
12269          if (!(this.used instanceof UnsignedIntType))
12270            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.used.getClass().getName()+" was encountered");
12271          return (UnsignedIntType) this.used;
12272        }
12273
12274        public boolean hasUsedUnsignedIntType() { 
12275          return this != null && this.used instanceof UnsignedIntType;
12276        }
12277
12278        /**
12279         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
12280         */
12281        public Money getUsedMoney() throws FHIRException { 
12282          if (this.used == null)
12283            this.used = new Money();
12284          if (!(this.used instanceof Money))
12285            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.used.getClass().getName()+" was encountered");
12286          return (Money) this.used;
12287        }
12288
12289        public boolean hasUsedMoney() { 
12290          return this != null && this.used instanceof Money;
12291        }
12292
12293        public boolean hasUsed() { 
12294          return this.used != null && !this.used.isEmpty();
12295        }
12296
12297        /**
12298         * @param value {@link #used} (The quantity of the benefit which have been consumed to date.)
12299         */
12300        public BenefitComponent setUsed(Type value) { 
12301          if (value != null && !(value instanceof UnsignedIntType || value instanceof Money))
12302            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.used[x]: "+value.fhirType());
12303          this.used = value;
12304          return this;
12305        }
12306
12307        protected void listChildren(List<Property> children) {
12308          super.listChildren(children);
12309          children.add(new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type));
12310          children.add(new Property("allowed[x]", "unsignedInt|string|Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed));
12311          children.add(new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used));
12312        }
12313
12314        @Override
12315        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
12316          switch (_hash) {
12317          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type);
12318          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);
12319          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);
12320          case 1668802034: /*allowedUnsignedInt*/  return new Property("allowed[x]", "unsignedInt|string|Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
12321          case -2135265319: /*allowedString*/  return new Property("allowed[x]", "unsignedInt|string|Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
12322          case -351668232: /*allowedMoney*/  return new Property("allowed[x]", "unsignedInt|string|Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
12323          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);
12324          case 3599293: /*used*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
12325          case 1252740285: /*usedUnsignedInt*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
12326          case -78048509: /*usedMoney*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
12327          default: return super.getNamedProperty(_hash, _name, _checkValid);
12328          }
12329
12330        }
12331
12332      @Override
12333      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
12334        switch (hash) {
12335        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
12336        case -911343192: /*allowed*/ return this.allowed == null ? new Base[0] : new Base[] {this.allowed}; // Type
12337        case 3599293: /*used*/ return this.used == null ? new Base[0] : new Base[] {this.used}; // Type
12338        default: return super.getProperty(hash, name, checkValid);
12339        }
12340
12341      }
12342
12343      @Override
12344      public Base setProperty(int hash, String name, Base value) throws FHIRException {
12345        switch (hash) {
12346        case 3575610: // type
12347          this.type = castToCodeableConcept(value); // CodeableConcept
12348          return value;
12349        case -911343192: // allowed
12350          this.allowed = castToType(value); // Type
12351          return value;
12352        case 3599293: // used
12353          this.used = castToType(value); // Type
12354          return value;
12355        default: return super.setProperty(hash, name, value);
12356        }
12357
12358      }
12359
12360      @Override
12361      public Base setProperty(String name, Base value) throws FHIRException {
12362        if (name.equals("type")) {
12363          this.type = castToCodeableConcept(value); // CodeableConcept
12364        } else if (name.equals("allowed[x]")) {
12365          this.allowed = castToType(value); // Type
12366        } else if (name.equals("used[x]")) {
12367          this.used = castToType(value); // Type
12368        } else
12369          return super.setProperty(name, value);
12370        return value;
12371      }
12372
12373      @Override
12374      public Base makeProperty(int hash, String name) throws FHIRException {
12375        switch (hash) {
12376        case 3575610:  return getType(); 
12377        case -1336663592:  return getAllowed(); 
12378        case -911343192:  return getAllowed(); 
12379        case -147553373:  return getUsed(); 
12380        case 3599293:  return getUsed(); 
12381        default: return super.makeProperty(hash, name);
12382        }
12383
12384      }
12385
12386      @Override
12387      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12388        switch (hash) {
12389        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
12390        case -911343192: /*allowed*/ return new String[] {"unsignedInt", "string", "Money"};
12391        case 3599293: /*used*/ return new String[] {"unsignedInt", "Money"};
12392        default: return super.getTypesForProperty(hash, name);
12393        }
12394
12395      }
12396
12397      @Override
12398      public Base addChild(String name) throws FHIRException {
12399        if (name.equals("type")) {
12400          this.type = new CodeableConcept();
12401          return this.type;
12402        }
12403        else if (name.equals("allowedUnsignedInt")) {
12404          this.allowed = new UnsignedIntType();
12405          return this.allowed;
12406        }
12407        else if (name.equals("allowedString")) {
12408          this.allowed = new StringType();
12409          return this.allowed;
12410        }
12411        else if (name.equals("allowedMoney")) {
12412          this.allowed = new Money();
12413          return this.allowed;
12414        }
12415        else if (name.equals("usedUnsignedInt")) {
12416          this.used = new UnsignedIntType();
12417          return this.used;
12418        }
12419        else if (name.equals("usedMoney")) {
12420          this.used = new Money();
12421          return this.used;
12422        }
12423        else
12424          return super.addChild(name);
12425      }
12426
12427      public BenefitComponent copy() {
12428        BenefitComponent dst = new BenefitComponent();
12429        copyValues(dst);
12430        return dst;
12431      }
12432
12433      public void copyValues(BenefitComponent dst) {
12434        super.copyValues(dst);
12435        dst.type = type == null ? null : type.copy();
12436        dst.allowed = allowed == null ? null : allowed.copy();
12437        dst.used = used == null ? null : used.copy();
12438      }
12439
12440      @Override
12441      public boolean equalsDeep(Base other_) {
12442        if (!super.equalsDeep(other_))
12443          return false;
12444        if (!(other_ instanceof BenefitComponent))
12445          return false;
12446        BenefitComponent o = (BenefitComponent) other_;
12447        return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true) && compareDeep(used, o.used, true)
12448          ;
12449      }
12450
12451      @Override
12452      public boolean equalsShallow(Base other_) {
12453        if (!super.equalsShallow(other_))
12454          return false;
12455        if (!(other_ instanceof BenefitComponent))
12456          return false;
12457        BenefitComponent o = (BenefitComponent) other_;
12458        return true;
12459      }
12460
12461      public boolean isEmpty() {
12462        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed, used);
12463      }
12464
12465  public String fhirType() {
12466    return "ExplanationOfBenefit.benefitBalance.financial";
12467
12468  }
12469
12470  }
12471
12472    /**
12473     * A unique identifier assigned to this explanation of benefit.
12474     */
12475    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12476    @Description(shortDefinition="Business Identifier for the resource", formalDefinition="A unique identifier assigned to this explanation of benefit." )
12477    protected List<Identifier> identifier;
12478
12479    /**
12480     * The status of the resource instance.
12481     */
12482    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
12483    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
12484    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/explanationofbenefit-status")
12485    protected Enumeration<ExplanationOfBenefitStatus> status;
12486
12487    /**
12488     * The category of claim, e.g. oral, pharmacy, vision, institutional, professional.
12489     */
12490    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
12491    @Description(shortDefinition="Category or discipline", formalDefinition="The category of claim, e.g. oral, pharmacy, vision, institutional, professional." )
12492    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-type")
12493    protected CodeableConcept type;
12494
12495    /**
12496     * A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.
12497     */
12498    @Child(name = "subType", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
12499    @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." )
12500    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-subtype")
12501    protected CodeableConcept subType;
12502
12503    /**
12504     * 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.
12505     */
12506    @Child(name = "use", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
12507    @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." )
12508    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-use")
12509    protected Enumeration<Use> use;
12510
12511    /**
12512     * 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.
12513     */
12514    @Child(name = "patient", type = {Patient.class}, order=5, min=1, max=1, modifier=false, summary=true)
12515    @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." )
12516    protected Reference patient;
12517
12518    /**
12519     * The actual object that is the target of the reference (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.)
12520     */
12521    protected Patient patientTarget;
12522
12523    /**
12524     * The period for which charges are being submitted.
12525     */
12526    @Child(name = "billablePeriod", type = {Period.class}, order=6, min=0, max=1, modifier=false, summary=true)
12527    @Description(shortDefinition="Relevant time frame for the claim", formalDefinition="The period for which charges are being submitted." )
12528    protected Period billablePeriod;
12529
12530    /**
12531     * The date this resource was created.
12532     */
12533    @Child(name = "created", type = {DateTimeType.class}, order=7, min=1, max=1, modifier=false, summary=true)
12534    @Description(shortDefinition="Response creation date", formalDefinition="The date this resource was created." )
12535    protected DateTimeType created;
12536
12537    /**
12538     * Individual who created the claim, predetermination or preauthorization.
12539     */
12540    @Child(name = "enterer", type = {Practitioner.class, PractitionerRole.class}, order=8, min=0, max=1, modifier=false, summary=false)
12541    @Description(shortDefinition="Author of the claim", formalDefinition="Individual who created the claim, predetermination or preauthorization." )
12542    protected Reference enterer;
12543
12544    /**
12545     * The actual object that is the target of the reference (Individual who created the claim, predetermination or preauthorization.)
12546     */
12547    protected Resource entererTarget;
12548
12549    /**
12550     * The party responsible for authorization, adjudication and reimbursement.
12551     */
12552    @Child(name = "insurer", type = {Organization.class}, order=9, min=1, max=1, modifier=false, summary=true)
12553    @Description(shortDefinition="Party responsible for reimbursement", formalDefinition="The party responsible for authorization, adjudication and reimbursement." )
12554    protected Reference insurer;
12555
12556    /**
12557     * The actual object that is the target of the reference (The party responsible for authorization, adjudication and reimbursement.)
12558     */
12559    protected Organization insurerTarget;
12560
12561    /**
12562     * The provider which is responsible for the claim, predetermination or preauthorization.
12563     */
12564    @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=10, min=1, max=1, modifier=false, summary=true)
12565    @Description(shortDefinition="Party responsible for the claim", formalDefinition="The provider which is responsible for the claim, predetermination or preauthorization." )
12566    protected Reference provider;
12567
12568    /**
12569     * The actual object that is the target of the reference (The provider which is responsible for the claim, predetermination or preauthorization.)
12570     */
12571    protected Resource providerTarget;
12572
12573    /**
12574     * The provider-required urgency of processing the request. Typical values include: stat, routine deferred.
12575     */
12576    @Child(name = "priority", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=false)
12577    @Description(shortDefinition="Desired processing urgency", formalDefinition="The provider-required urgency of processing the request. Typical values include: stat, routine deferred." )
12578    protected CodeableConcept priority;
12579
12580    /**
12581     * A code to indicate whether and for whom funds are to be reserved for future claims.
12582     */
12583    @Child(name = "fundsReserveRequested", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
12584    @Description(shortDefinition="For whom to reserve funds", formalDefinition="A code to indicate whether and for whom funds are to be reserved for future claims." )
12585    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fundsreserve")
12586    protected CodeableConcept fundsReserveRequested;
12587
12588    /**
12589     * A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.
12590     */
12591    @Child(name = "fundsReserve", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
12592    @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." )
12593    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fundsreserve")
12594    protected CodeableConcept fundsReserve;
12595
12596    /**
12597     * Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.
12598     */
12599    @Child(name = "related", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12600    @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." )
12601    protected List<RelatedClaimComponent> related;
12602
12603    /**
12604     * Prescription to support the dispensing of pharmacy, device or vision products.
12605     */
12606    @Child(name = "prescription", type = {MedicationRequest.class, VisionPrescription.class}, order=15, min=0, max=1, modifier=false, summary=false)
12607    @Description(shortDefinition="Prescription authorizing services or products", formalDefinition="Prescription to support the dispensing of pharmacy, device or vision products." )
12608    protected Reference prescription;
12609
12610    /**
12611     * The actual object that is the target of the reference (Prescription to support the dispensing of pharmacy, device or vision products.)
12612     */
12613    protected Resource prescriptionTarget;
12614
12615    /**
12616     * Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.
12617     */
12618    @Child(name = "originalPrescription", type = {MedicationRequest.class}, order=16, min=0, max=1, modifier=false, summary=false)
12619    @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." )
12620    protected Reference originalPrescription;
12621
12622    /**
12623     * The actual object that is the target of the reference (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
12624     */
12625    protected MedicationRequest originalPrescriptionTarget;
12626
12627    /**
12628     * The party to be reimbursed for cost of the products and services according to the terms of the policy.
12629     */
12630    @Child(name = "payee", type = {}, order=17, min=0, max=1, modifier=false, summary=false)
12631    @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." )
12632    protected PayeeComponent payee;
12633
12634    /**
12635     * A reference to a referral resource.
12636     */
12637    @Child(name = "referral", type = {ServiceRequest.class}, order=18, min=0, max=1, modifier=false, summary=false)
12638    @Description(shortDefinition="Treatment Referral", formalDefinition="A reference to a referral resource." )
12639    protected Reference referral;
12640
12641    /**
12642     * The actual object that is the target of the reference (A reference to a referral resource.)
12643     */
12644    protected ServiceRequest referralTarget;
12645
12646    /**
12647     * Facility where the services were provided.
12648     */
12649    @Child(name = "facility", type = {Location.class}, order=19, min=0, max=1, modifier=false, summary=false)
12650    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
12651    protected Reference facility;
12652
12653    /**
12654     * The actual object that is the target of the reference (Facility where the services were provided.)
12655     */
12656    protected Location facilityTarget;
12657
12658    /**
12659     * The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.
12660     */
12661    @Child(name = "claim", type = {Claim.class}, order=20, min=0, max=1, modifier=false, summary=false)
12662    @Description(shortDefinition="Claim reference", formalDefinition="The business identifier for the instance of the adjudication request: claim predetermination or preauthorization." )
12663    protected Reference claim;
12664
12665    /**
12666     * The actual object that is the target of the reference (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
12667     */
12668    protected Claim claimTarget;
12669
12670    /**
12671     * The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.
12672     */
12673    @Child(name = "claimResponse", type = {ClaimResponse.class}, order=21, min=0, max=1, modifier=false, summary=false)
12674    @Description(shortDefinition="Claim response reference", formalDefinition="The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response." )
12675    protected Reference claimResponse;
12676
12677    /**
12678     * The actual object that is the target of the reference (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
12679     */
12680    protected ClaimResponse claimResponseTarget;
12681
12682    /**
12683     * The outcome of the claim, predetermination, or preauthorization processing.
12684     */
12685    @Child(name = "outcome", type = {CodeType.class}, order=22, min=1, max=1, modifier=false, summary=true)
12686    @Description(shortDefinition="queued | complete | error | partial", formalDefinition="The outcome of the claim, predetermination, or preauthorization processing." )
12687    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/remittance-outcome")
12688    protected Enumeration<RemittanceOutcome> outcome;
12689
12690    /**
12691     * A human readable description of the status of the adjudication.
12692     */
12693    @Child(name = "disposition", type = {StringType.class}, order=23, min=0, max=1, modifier=false, summary=false)
12694    @Description(shortDefinition="Disposition Message", formalDefinition="A human readable description of the status of the adjudication." )
12695    protected StringType disposition;
12696
12697    /**
12698     * Reference from the Insurer which is used in later communications which refers to this adjudication.
12699     */
12700    @Child(name = "preAuthRef", type = {StringType.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12701    @Description(shortDefinition="Preauthorization reference", formalDefinition="Reference from the Insurer which is used in later communications which refers to this adjudication." )
12702    protected List<StringType> preAuthRef;
12703
12704    /**
12705     * The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.
12706     */
12707    @Child(name = "preAuthRefPeriod", type = {Period.class}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12708    @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." )
12709    protected List<Period> preAuthRefPeriod;
12710
12711    /**
12712     * The members of the team who provided the products and services.
12713     */
12714    @Child(name = "careTeam", type = {}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12715    @Description(shortDefinition="Care Team members", formalDefinition="The members of the team who provided the products and services." )
12716    protected List<CareTeamComponent> careTeam;
12717
12718    /**
12719     * Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.
12720     */
12721    @Child(name = "supportingInfo", type = {}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12722    @Description(shortDefinition="Supporting information", formalDefinition="Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues." )
12723    protected List<SupportingInformationComponent> supportingInfo;
12724
12725    /**
12726     * Information about diagnoses relevant to the claim items.
12727     */
12728    @Child(name = "diagnosis", type = {}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12729    @Description(shortDefinition="Pertinent diagnosis information", formalDefinition="Information about diagnoses relevant to the claim items." )
12730    protected List<DiagnosisComponent> diagnosis;
12731
12732    /**
12733     * Procedures performed on the patient relevant to the billing items with the claim.
12734     */
12735    @Child(name = "procedure", type = {}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12736    @Description(shortDefinition="Clinical procedures performed", formalDefinition="Procedures performed on the patient relevant to the billing items with the claim." )
12737    protected List<ProcedureComponent> procedure;
12738
12739    /**
12740     * This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
12741     */
12742    @Child(name = "precedence", type = {PositiveIntType.class}, order=30, min=0, max=1, modifier=false, summary=false)
12743    @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." )
12744    protected PositiveIntType precedence;
12745
12746    /**
12747     * Financial instruments for reimbursement for the health care products and services specified on the claim.
12748     */
12749    @Child(name = "insurance", type = {}, order=31, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
12750    @Description(shortDefinition="Patient insurance information", formalDefinition="Financial instruments for reimbursement for the health care products and services specified on the claim." )
12751    protected List<InsuranceComponent> insurance;
12752
12753    /**
12754     * Details of a accident which resulted in injuries which required the products and services listed in the claim.
12755     */
12756    @Child(name = "accident", type = {}, order=32, min=0, max=1, modifier=false, summary=false)
12757    @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." )
12758    protected AccidentComponent accident;
12759
12760    /**
12761     * 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.
12762     */
12763    @Child(name = "item", type = {}, order=33, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12764    @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." )
12765    protected List<ItemComponent> item;
12766
12767    /**
12768     * The first-tier service adjudications for payor added product or service lines.
12769     */
12770    @Child(name = "addItem", type = {}, order=34, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12771    @Description(shortDefinition="Insurer added line items", formalDefinition="The first-tier service adjudications for payor added product or service lines." )
12772    protected List<AddedItemComponent> addItem;
12773
12774    /**
12775     * The adjudication results which are presented at the header level rather than at the line-item or add-item levels.
12776     */
12777    @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=35, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12778    @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." )
12779    protected List<AdjudicationComponent> adjudication;
12780
12781    /**
12782     * Categorized monetary totals for the adjudication.
12783     */
12784    @Child(name = "total", type = {}, order=36, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
12785    @Description(shortDefinition="Adjudication totals", formalDefinition="Categorized monetary totals for the adjudication." )
12786    protected List<TotalComponent> total;
12787
12788    /**
12789     * Payment details for the adjudication of the claim.
12790     */
12791    @Child(name = "payment", type = {}, order=37, min=0, max=1, modifier=false, summary=false)
12792    @Description(shortDefinition="Payment Details", formalDefinition="Payment details for the adjudication of the claim." )
12793    protected PaymentComponent payment;
12794
12795    /**
12796     * A code for the form to be used for printing the content.
12797     */
12798    @Child(name = "formCode", type = {CodeableConcept.class}, order=38, min=0, max=1, modifier=false, summary=false)
12799    @Description(shortDefinition="Printed form identifier", formalDefinition="A code for the form to be used for printing the content." )
12800    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/forms")
12801    protected CodeableConcept formCode;
12802
12803    /**
12804     * The actual form, by reference or inclusion, for printing the content or an EOB.
12805     */
12806    @Child(name = "form", type = {Attachment.class}, order=39, min=0, max=1, modifier=false, summary=false)
12807    @Description(shortDefinition="Printed reference or actual form", formalDefinition="The actual form, by reference or inclusion, for printing the content or an EOB." )
12808    protected Attachment form;
12809
12810    /**
12811     * A note that describes or explains adjudication results in a human readable form.
12812     */
12813    @Child(name = "processNote", type = {}, order=40, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12814    @Description(shortDefinition="Note concerning adjudication", formalDefinition="A note that describes or explains adjudication results in a human readable form." )
12815    protected List<NoteComponent> processNote;
12816
12817    /**
12818     * The term of the benefits documented in this response.
12819     */
12820    @Child(name = "benefitPeriod", type = {Period.class}, order=41, min=0, max=1, modifier=false, summary=false)
12821    @Description(shortDefinition="When the benefits are applicable", formalDefinition="The term of the benefits documented in this response." )
12822    protected Period benefitPeriod;
12823
12824    /**
12825     * Balance by Benefit Category.
12826     */
12827    @Child(name = "benefitBalance", type = {}, order=42, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12828    @Description(shortDefinition="Balance by Benefit Category", formalDefinition="Balance by Benefit Category." )
12829    protected List<BenefitBalanceComponent> benefitBalance;
12830
12831    private static final long serialVersionUID = -1515422099L;
12832
12833  /**
12834   * Constructor
12835   */
12836    public ExplanationOfBenefit() {
12837      super();
12838    }
12839
12840  /**
12841   * Constructor
12842   */
12843    public ExplanationOfBenefit(Enumeration<ExplanationOfBenefitStatus> status, CodeableConcept type, Enumeration<Use> use, Reference patient, DateTimeType created, Reference insurer, Reference provider, Enumeration<RemittanceOutcome> outcome) {
12844      super();
12845      this.status = status;
12846      this.type = type;
12847      this.use = use;
12848      this.patient = patient;
12849      this.created = created;
12850      this.insurer = insurer;
12851      this.provider = provider;
12852      this.outcome = outcome;
12853    }
12854
12855    /**
12856     * @return {@link #identifier} (A unique identifier assigned to this explanation of benefit.)
12857     */
12858    public List<Identifier> getIdentifier() { 
12859      if (this.identifier == null)
12860        this.identifier = new ArrayList<Identifier>();
12861      return this.identifier;
12862    }
12863
12864    /**
12865     * @return Returns a reference to <code>this</code> for easy method chaining
12866     */
12867    public ExplanationOfBenefit setIdentifier(List<Identifier> theIdentifier) { 
12868      this.identifier = theIdentifier;
12869      return this;
12870    }
12871
12872    public boolean hasIdentifier() { 
12873      if (this.identifier == null)
12874        return false;
12875      for (Identifier item : this.identifier)
12876        if (!item.isEmpty())
12877          return true;
12878      return false;
12879    }
12880
12881    public Identifier addIdentifier() { //3
12882      Identifier t = new Identifier();
12883      if (this.identifier == null)
12884        this.identifier = new ArrayList<Identifier>();
12885      this.identifier.add(t);
12886      return t;
12887    }
12888
12889    public ExplanationOfBenefit addIdentifier(Identifier t) { //3
12890      if (t == null)
12891        return this;
12892      if (this.identifier == null)
12893        this.identifier = new ArrayList<Identifier>();
12894      this.identifier.add(t);
12895      return this;
12896    }
12897
12898    /**
12899     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
12900     */
12901    public Identifier getIdentifierFirstRep() { 
12902      if (getIdentifier().isEmpty()) {
12903        addIdentifier();
12904      }
12905      return getIdentifier().get(0);
12906    }
12907
12908    /**
12909     * @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
12910     */
12911    public Enumeration<ExplanationOfBenefitStatus> getStatusElement() { 
12912      if (this.status == null)
12913        if (Configuration.errorOnAutoCreate())
12914          throw new Error("Attempt to auto-create ExplanationOfBenefit.status");
12915        else if (Configuration.doAutoCreate())
12916          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory()); // bb
12917      return this.status;
12918    }
12919
12920    public boolean hasStatusElement() { 
12921      return this.status != null && !this.status.isEmpty();
12922    }
12923
12924    public boolean hasStatus() { 
12925      return this.status != null && !this.status.isEmpty();
12926    }
12927
12928    /**
12929     * @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
12930     */
12931    public ExplanationOfBenefit setStatusElement(Enumeration<ExplanationOfBenefitStatus> value) { 
12932      this.status = value;
12933      return this;
12934    }
12935
12936    /**
12937     * @return The status of the resource instance.
12938     */
12939    public ExplanationOfBenefitStatus getStatus() { 
12940      return this.status == null ? null : this.status.getValue();
12941    }
12942
12943    /**
12944     * @param value The status of the resource instance.
12945     */
12946    public ExplanationOfBenefit setStatus(ExplanationOfBenefitStatus value) { 
12947        if (this.status == null)
12948          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory());
12949        this.status.setValue(value);
12950      return this;
12951    }
12952
12953    /**
12954     * @return {@link #type} (The category of claim, e.g. oral, pharmacy, vision, institutional, professional.)
12955     */
12956    public CodeableConcept getType() { 
12957      if (this.type == null)
12958        if (Configuration.errorOnAutoCreate())
12959          throw new Error("Attempt to auto-create ExplanationOfBenefit.type");
12960        else if (Configuration.doAutoCreate())
12961          this.type = new CodeableConcept(); // cc
12962      return this.type;
12963    }
12964
12965    public boolean hasType() { 
12966      return this.type != null && !this.type.isEmpty();
12967    }
12968
12969    /**
12970     * @param value {@link #type} (The category of claim, e.g. oral, pharmacy, vision, institutional, professional.)
12971     */
12972    public ExplanationOfBenefit setType(CodeableConcept value) { 
12973      this.type = value;
12974      return this;
12975    }
12976
12977    /**
12978     * @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.)
12979     */
12980    public CodeableConcept getSubType() { 
12981      if (this.subType == null)
12982        if (Configuration.errorOnAutoCreate())
12983          throw new Error("Attempt to auto-create ExplanationOfBenefit.subType");
12984        else if (Configuration.doAutoCreate())
12985          this.subType = new CodeableConcept(); // cc
12986      return this.subType;
12987    }
12988
12989    public boolean hasSubType() { 
12990      return this.subType != null && !this.subType.isEmpty();
12991    }
12992
12993    /**
12994     * @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.)
12995     */
12996    public ExplanationOfBenefit setSubType(CodeableConcept value) { 
12997      this.subType = value;
12998      return this;
12999    }
13000
13001    /**
13002     * @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
13003     */
13004    public Enumeration<Use> getUseElement() { 
13005      if (this.use == null)
13006        if (Configuration.errorOnAutoCreate())
13007          throw new Error("Attempt to auto-create ExplanationOfBenefit.use");
13008        else if (Configuration.doAutoCreate())
13009          this.use = new Enumeration<Use>(new UseEnumFactory()); // bb
13010      return this.use;
13011    }
13012
13013    public boolean hasUseElement() { 
13014      return this.use != null && !this.use.isEmpty();
13015    }
13016
13017    public boolean hasUse() { 
13018      return this.use != null && !this.use.isEmpty();
13019    }
13020
13021    /**
13022     * @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
13023     */
13024    public ExplanationOfBenefit setUseElement(Enumeration<Use> value) { 
13025      this.use = value;
13026      return this;
13027    }
13028
13029    /**
13030     * @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.
13031     */
13032    public Use getUse() { 
13033      return this.use == null ? null : this.use.getValue();
13034    }
13035
13036    /**
13037     * @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.
13038     */
13039    public ExplanationOfBenefit setUse(Use value) { 
13040        if (this.use == null)
13041          this.use = new Enumeration<Use>(new UseEnumFactory());
13042        this.use.setValue(value);
13043      return this;
13044    }
13045
13046    /**
13047     * @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.)
13048     */
13049    public Reference getPatient() { 
13050      if (this.patient == null)
13051        if (Configuration.errorOnAutoCreate())
13052          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
13053        else if (Configuration.doAutoCreate())
13054          this.patient = new Reference(); // cc
13055      return this.patient;
13056    }
13057
13058    public boolean hasPatient() { 
13059      return this.patient != null && !this.patient.isEmpty();
13060    }
13061
13062    /**
13063     * @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.)
13064     */
13065    public ExplanationOfBenefit setPatient(Reference value) { 
13066      this.patient = value;
13067      return this;
13068    }
13069
13070    /**
13071     * @return {@link #patient} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (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.)
13072     */
13073    public Patient getPatientTarget() { 
13074      if (this.patientTarget == null)
13075        if (Configuration.errorOnAutoCreate())
13076          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
13077        else if (Configuration.doAutoCreate())
13078          this.patientTarget = new Patient(); // aa
13079      return this.patientTarget;
13080    }
13081
13082    /**
13083     * @param value {@link #patient} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (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.)
13084     */
13085    public ExplanationOfBenefit setPatientTarget(Patient value) { 
13086      this.patientTarget = value;
13087      return this;
13088    }
13089
13090    /**
13091     * @return {@link #billablePeriod} (The period for which charges are being submitted.)
13092     */
13093    public Period getBillablePeriod() { 
13094      if (this.billablePeriod == null)
13095        if (Configuration.errorOnAutoCreate())
13096          throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
13097        else if (Configuration.doAutoCreate())
13098          this.billablePeriod = new Period(); // cc
13099      return this.billablePeriod;
13100    }
13101
13102    public boolean hasBillablePeriod() { 
13103      return this.billablePeriod != null && !this.billablePeriod.isEmpty();
13104    }
13105
13106    /**
13107     * @param value {@link #billablePeriod} (The period for which charges are being submitted.)
13108     */
13109    public ExplanationOfBenefit setBillablePeriod(Period value) { 
13110      this.billablePeriod = value;
13111      return this;
13112    }
13113
13114    /**
13115     * @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
13116     */
13117    public DateTimeType getCreatedElement() { 
13118      if (this.created == null)
13119        if (Configuration.errorOnAutoCreate())
13120          throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
13121        else if (Configuration.doAutoCreate())
13122          this.created = new DateTimeType(); // bb
13123      return this.created;
13124    }
13125
13126    public boolean hasCreatedElement() { 
13127      return this.created != null && !this.created.isEmpty();
13128    }
13129
13130    public boolean hasCreated() { 
13131      return this.created != null && !this.created.isEmpty();
13132    }
13133
13134    /**
13135     * @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
13136     */
13137    public ExplanationOfBenefit setCreatedElement(DateTimeType value) { 
13138      this.created = value;
13139      return this;
13140    }
13141
13142    /**
13143     * @return The date this resource was created.
13144     */
13145    public Date getCreated() { 
13146      return this.created == null ? null : this.created.getValue();
13147    }
13148
13149    /**
13150     * @param value The date this resource was created.
13151     */
13152    public ExplanationOfBenefit setCreated(Date value) { 
13153        if (this.created == null)
13154          this.created = new DateTimeType();
13155        this.created.setValue(value);
13156      return this;
13157    }
13158
13159    /**
13160     * @return {@link #enterer} (Individual who created the claim, predetermination or preauthorization.)
13161     */
13162    public Reference getEnterer() { 
13163      if (this.enterer == null)
13164        if (Configuration.errorOnAutoCreate())
13165          throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
13166        else if (Configuration.doAutoCreate())
13167          this.enterer = new Reference(); // cc
13168      return this.enterer;
13169    }
13170
13171    public boolean hasEnterer() { 
13172      return this.enterer != null && !this.enterer.isEmpty();
13173    }
13174
13175    /**
13176     * @param value {@link #enterer} (Individual who created the claim, predetermination or preauthorization.)
13177     */
13178    public ExplanationOfBenefit setEnterer(Reference value) { 
13179      this.enterer = value;
13180      return this;
13181    }
13182
13183    /**
13184     * @return {@link #enterer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Individual who created the claim, predetermination or preauthorization.)
13185     */
13186    public Resource getEntererTarget() { 
13187      return this.entererTarget;
13188    }
13189
13190    /**
13191     * @param value {@link #enterer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Individual who created the claim, predetermination or preauthorization.)
13192     */
13193    public ExplanationOfBenefit setEntererTarget(Resource value) { 
13194      this.entererTarget = value;
13195      return this;
13196    }
13197
13198    /**
13199     * @return {@link #insurer} (The party responsible for authorization, adjudication and reimbursement.)
13200     */
13201    public Reference getInsurer() { 
13202      if (this.insurer == null)
13203        if (Configuration.errorOnAutoCreate())
13204          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
13205        else if (Configuration.doAutoCreate())
13206          this.insurer = new Reference(); // cc
13207      return this.insurer;
13208    }
13209
13210    public boolean hasInsurer() { 
13211      return this.insurer != null && !this.insurer.isEmpty();
13212    }
13213
13214    /**
13215     * @param value {@link #insurer} (The party responsible for authorization, adjudication and reimbursement.)
13216     */
13217    public ExplanationOfBenefit setInsurer(Reference value) { 
13218      this.insurer = value;
13219      return this;
13220    }
13221
13222    /**
13223     * @return {@link #insurer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The party responsible for authorization, adjudication and reimbursement.)
13224     */
13225    public Organization getInsurerTarget() { 
13226      if (this.insurerTarget == null)
13227        if (Configuration.errorOnAutoCreate())
13228          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
13229        else if (Configuration.doAutoCreate())
13230          this.insurerTarget = new Organization(); // aa
13231      return this.insurerTarget;
13232    }
13233
13234    /**
13235     * @param value {@link #insurer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The party responsible for authorization, adjudication and reimbursement.)
13236     */
13237    public ExplanationOfBenefit setInsurerTarget(Organization value) { 
13238      this.insurerTarget = value;
13239      return this;
13240    }
13241
13242    /**
13243     * @return {@link #provider} (The provider which is responsible for the claim, predetermination or preauthorization.)
13244     */
13245    public Reference getProvider() { 
13246      if (this.provider == null)
13247        if (Configuration.errorOnAutoCreate())
13248          throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
13249        else if (Configuration.doAutoCreate())
13250          this.provider = new Reference(); // cc
13251      return this.provider;
13252    }
13253
13254    public boolean hasProvider() { 
13255      return this.provider != null && !this.provider.isEmpty();
13256    }
13257
13258    /**
13259     * @param value {@link #provider} (The provider which is responsible for the claim, predetermination or preauthorization.)
13260     */
13261    public ExplanationOfBenefit setProvider(Reference value) { 
13262      this.provider = value;
13263      return this;
13264    }
13265
13266    /**
13267     * @return {@link #provider} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The provider which is responsible for the claim, predetermination or preauthorization.)
13268     */
13269    public Resource getProviderTarget() { 
13270      return this.providerTarget;
13271    }
13272
13273    /**
13274     * @param value {@link #provider} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The provider which is responsible for the claim, predetermination or preauthorization.)
13275     */
13276    public ExplanationOfBenefit setProviderTarget(Resource value) { 
13277      this.providerTarget = value;
13278      return this;
13279    }
13280
13281    /**
13282     * @return {@link #priority} (The provider-required urgency of processing the request. Typical values include: stat, routine deferred.)
13283     */
13284    public CodeableConcept getPriority() { 
13285      if (this.priority == null)
13286        if (Configuration.errorOnAutoCreate())
13287          throw new Error("Attempt to auto-create ExplanationOfBenefit.priority");
13288        else if (Configuration.doAutoCreate())
13289          this.priority = new CodeableConcept(); // cc
13290      return this.priority;
13291    }
13292
13293    public boolean hasPriority() { 
13294      return this.priority != null && !this.priority.isEmpty();
13295    }
13296
13297    /**
13298     * @param value {@link #priority} (The provider-required urgency of processing the request. Typical values include: stat, routine deferred.)
13299     */
13300    public ExplanationOfBenefit setPriority(CodeableConcept value) { 
13301      this.priority = value;
13302      return this;
13303    }
13304
13305    /**
13306     * @return {@link #fundsReserveRequested} (A code to indicate whether and for whom funds are to be reserved for future claims.)
13307     */
13308    public CodeableConcept getFundsReserveRequested() { 
13309      if (this.fundsReserveRequested == null)
13310        if (Configuration.errorOnAutoCreate())
13311          throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserveRequested");
13312        else if (Configuration.doAutoCreate())
13313          this.fundsReserveRequested = new CodeableConcept(); // cc
13314      return this.fundsReserveRequested;
13315    }
13316
13317    public boolean hasFundsReserveRequested() { 
13318      return this.fundsReserveRequested != null && !this.fundsReserveRequested.isEmpty();
13319    }
13320
13321    /**
13322     * @param value {@link #fundsReserveRequested} (A code to indicate whether and for whom funds are to be reserved for future claims.)
13323     */
13324    public ExplanationOfBenefit setFundsReserveRequested(CodeableConcept value) { 
13325      this.fundsReserveRequested = value;
13326      return this;
13327    }
13328
13329    /**
13330     * @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.)
13331     */
13332    public CodeableConcept getFundsReserve() { 
13333      if (this.fundsReserve == null)
13334        if (Configuration.errorOnAutoCreate())
13335          throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserve");
13336        else if (Configuration.doAutoCreate())
13337          this.fundsReserve = new CodeableConcept(); // cc
13338      return this.fundsReserve;
13339    }
13340
13341    public boolean hasFundsReserve() { 
13342      return this.fundsReserve != null && !this.fundsReserve.isEmpty();
13343    }
13344
13345    /**
13346     * @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.)
13347     */
13348    public ExplanationOfBenefit setFundsReserve(CodeableConcept value) { 
13349      this.fundsReserve = value;
13350      return this;
13351    }
13352
13353    /**
13354     * @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.)
13355     */
13356    public List<RelatedClaimComponent> getRelated() { 
13357      if (this.related == null)
13358        this.related = new ArrayList<RelatedClaimComponent>();
13359      return this.related;
13360    }
13361
13362    /**
13363     * @return Returns a reference to <code>this</code> for easy method chaining
13364     */
13365    public ExplanationOfBenefit setRelated(List<RelatedClaimComponent> theRelated) { 
13366      this.related = theRelated;
13367      return this;
13368    }
13369
13370    public boolean hasRelated() { 
13371      if (this.related == null)
13372        return false;
13373      for (RelatedClaimComponent item : this.related)
13374        if (!item.isEmpty())
13375          return true;
13376      return false;
13377    }
13378
13379    public RelatedClaimComponent addRelated() { //3
13380      RelatedClaimComponent t = new RelatedClaimComponent();
13381      if (this.related == null)
13382        this.related = new ArrayList<RelatedClaimComponent>();
13383      this.related.add(t);
13384      return t;
13385    }
13386
13387    public ExplanationOfBenefit addRelated(RelatedClaimComponent t) { //3
13388      if (t == null)
13389        return this;
13390      if (this.related == null)
13391        this.related = new ArrayList<RelatedClaimComponent>();
13392      this.related.add(t);
13393      return this;
13394    }
13395
13396    /**
13397     * @return The first repetition of repeating field {@link #related}, creating it if it does not already exist
13398     */
13399    public RelatedClaimComponent getRelatedFirstRep() { 
13400      if (getRelated().isEmpty()) {
13401        addRelated();
13402      }
13403      return getRelated().get(0);
13404    }
13405
13406    /**
13407     * @return {@link #prescription} (Prescription to support the dispensing of pharmacy, device or vision products.)
13408     */
13409    public Reference getPrescription() { 
13410      if (this.prescription == null)
13411        if (Configuration.errorOnAutoCreate())
13412          throw new Error("Attempt to auto-create ExplanationOfBenefit.prescription");
13413        else if (Configuration.doAutoCreate())
13414          this.prescription = new Reference(); // cc
13415      return this.prescription;
13416    }
13417
13418    public boolean hasPrescription() { 
13419      return this.prescription != null && !this.prescription.isEmpty();
13420    }
13421
13422    /**
13423     * @param value {@link #prescription} (Prescription to support the dispensing of pharmacy, device or vision products.)
13424     */
13425    public ExplanationOfBenefit setPrescription(Reference value) { 
13426      this.prescription = value;
13427      return this;
13428    }
13429
13430    /**
13431     * @return {@link #prescription} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Prescription to support the dispensing of pharmacy, device or vision products.)
13432     */
13433    public Resource getPrescriptionTarget() { 
13434      return this.prescriptionTarget;
13435    }
13436
13437    /**
13438     * @param value {@link #prescription} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Prescription to support the dispensing of pharmacy, device or vision products.)
13439     */
13440    public ExplanationOfBenefit setPrescriptionTarget(Resource value) { 
13441      this.prescriptionTarget = value;
13442      return this;
13443    }
13444
13445    /**
13446     * @return {@link #originalPrescription} (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
13447     */
13448    public Reference getOriginalPrescription() { 
13449      if (this.originalPrescription == null)
13450        if (Configuration.errorOnAutoCreate())
13451          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
13452        else if (Configuration.doAutoCreate())
13453          this.originalPrescription = new Reference(); // cc
13454      return this.originalPrescription;
13455    }
13456
13457    public boolean hasOriginalPrescription() { 
13458      return this.originalPrescription != null && !this.originalPrescription.isEmpty();
13459    }
13460
13461    /**
13462     * @param value {@link #originalPrescription} (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
13463     */
13464    public ExplanationOfBenefit setOriginalPrescription(Reference value) { 
13465      this.originalPrescription = value;
13466      return this;
13467    }
13468
13469    /**
13470     * @return {@link #originalPrescription} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
13471     */
13472    public MedicationRequest getOriginalPrescriptionTarget() { 
13473      if (this.originalPrescriptionTarget == null)
13474        if (Configuration.errorOnAutoCreate())
13475          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
13476        else if (Configuration.doAutoCreate())
13477          this.originalPrescriptionTarget = new MedicationRequest(); // aa
13478      return this.originalPrescriptionTarget;
13479    }
13480
13481    /**
13482     * @param value {@link #originalPrescription} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
13483     */
13484    public ExplanationOfBenefit setOriginalPrescriptionTarget(MedicationRequest value) { 
13485      this.originalPrescriptionTarget = value;
13486      return this;
13487    }
13488
13489    /**
13490     * @return {@link #payee} (The party to be reimbursed for cost of the products and services according to the terms of the policy.)
13491     */
13492    public PayeeComponent getPayee() { 
13493      if (this.payee == null)
13494        if (Configuration.errorOnAutoCreate())
13495          throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
13496        else if (Configuration.doAutoCreate())
13497          this.payee = new PayeeComponent(); // cc
13498      return this.payee;
13499    }
13500
13501    public boolean hasPayee() { 
13502      return this.payee != null && !this.payee.isEmpty();
13503    }
13504
13505    /**
13506     * @param value {@link #payee} (The party to be reimbursed for cost of the products and services according to the terms of the policy.)
13507     */
13508    public ExplanationOfBenefit setPayee(PayeeComponent value) { 
13509      this.payee = value;
13510      return this;
13511    }
13512
13513    /**
13514     * @return {@link #referral} (A reference to a referral resource.)
13515     */
13516    public Reference getReferral() { 
13517      if (this.referral == null)
13518        if (Configuration.errorOnAutoCreate())
13519          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
13520        else if (Configuration.doAutoCreate())
13521          this.referral = new Reference(); // cc
13522      return this.referral;
13523    }
13524
13525    public boolean hasReferral() { 
13526      return this.referral != null && !this.referral.isEmpty();
13527    }
13528
13529    /**
13530     * @param value {@link #referral} (A reference to a referral resource.)
13531     */
13532    public ExplanationOfBenefit setReferral(Reference value) { 
13533      this.referral = value;
13534      return this;
13535    }
13536
13537    /**
13538     * @return {@link #referral} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A reference to a referral resource.)
13539     */
13540    public ServiceRequest getReferralTarget() { 
13541      if (this.referralTarget == null)
13542        if (Configuration.errorOnAutoCreate())
13543          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
13544        else if (Configuration.doAutoCreate())
13545          this.referralTarget = new ServiceRequest(); // aa
13546      return this.referralTarget;
13547    }
13548
13549    /**
13550     * @param value {@link #referral} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A reference to a referral resource.)
13551     */
13552    public ExplanationOfBenefit setReferralTarget(ServiceRequest value) { 
13553      this.referralTarget = value;
13554      return this;
13555    }
13556
13557    /**
13558     * @return {@link #facility} (Facility where the services were provided.)
13559     */
13560    public Reference getFacility() { 
13561      if (this.facility == null)
13562        if (Configuration.errorOnAutoCreate())
13563          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
13564        else if (Configuration.doAutoCreate())
13565          this.facility = new Reference(); // cc
13566      return this.facility;
13567    }
13568
13569    public boolean hasFacility() { 
13570      return this.facility != null && !this.facility.isEmpty();
13571    }
13572
13573    /**
13574     * @param value {@link #facility} (Facility where the services were provided.)
13575     */
13576    public ExplanationOfBenefit setFacility(Reference value) { 
13577      this.facility = value;
13578      return this;
13579    }
13580
13581    /**
13582     * @return {@link #facility} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Facility where the services were provided.)
13583     */
13584    public Location getFacilityTarget() { 
13585      if (this.facilityTarget == null)
13586        if (Configuration.errorOnAutoCreate())
13587          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
13588        else if (Configuration.doAutoCreate())
13589          this.facilityTarget = new Location(); // aa
13590      return this.facilityTarget;
13591    }
13592
13593    /**
13594     * @param value {@link #facility} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Facility where the services were provided.)
13595     */
13596    public ExplanationOfBenefit setFacilityTarget(Location value) { 
13597      this.facilityTarget = value;
13598      return this;
13599    }
13600
13601    /**
13602     * @return {@link #claim} (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
13603     */
13604    public Reference getClaim() { 
13605      if (this.claim == null)
13606        if (Configuration.errorOnAutoCreate())
13607          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
13608        else if (Configuration.doAutoCreate())
13609          this.claim = new Reference(); // cc
13610      return this.claim;
13611    }
13612
13613    public boolean hasClaim() { 
13614      return this.claim != null && !this.claim.isEmpty();
13615    }
13616
13617    /**
13618     * @param value {@link #claim} (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
13619     */
13620    public ExplanationOfBenefit setClaim(Reference value) { 
13621      this.claim = value;
13622      return this;
13623    }
13624
13625    /**
13626     * @return {@link #claim} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
13627     */
13628    public Claim getClaimTarget() { 
13629      if (this.claimTarget == null)
13630        if (Configuration.errorOnAutoCreate())
13631          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
13632        else if (Configuration.doAutoCreate())
13633          this.claimTarget = new Claim(); // aa
13634      return this.claimTarget;
13635    }
13636
13637    /**
13638     * @param value {@link #claim} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
13639     */
13640    public ExplanationOfBenefit setClaimTarget(Claim value) { 
13641      this.claimTarget = value;
13642      return this;
13643    }
13644
13645    /**
13646     * @return {@link #claimResponse} (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
13647     */
13648    public Reference getClaimResponse() { 
13649      if (this.claimResponse == null)
13650        if (Configuration.errorOnAutoCreate())
13651          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
13652        else if (Configuration.doAutoCreate())
13653          this.claimResponse = new Reference(); // cc
13654      return this.claimResponse;
13655    }
13656
13657    public boolean hasClaimResponse() { 
13658      return this.claimResponse != null && !this.claimResponse.isEmpty();
13659    }
13660
13661    /**
13662     * @param value {@link #claimResponse} (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
13663     */
13664    public ExplanationOfBenefit setClaimResponse(Reference value) { 
13665      this.claimResponse = value;
13666      return this;
13667    }
13668
13669    /**
13670     * @return {@link #claimResponse} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
13671     */
13672    public ClaimResponse getClaimResponseTarget() { 
13673      if (this.claimResponseTarget == null)
13674        if (Configuration.errorOnAutoCreate())
13675          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
13676        else if (Configuration.doAutoCreate())
13677          this.claimResponseTarget = new ClaimResponse(); // aa
13678      return this.claimResponseTarget;
13679    }
13680
13681    /**
13682     * @param value {@link #claimResponse} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
13683     */
13684    public ExplanationOfBenefit setClaimResponseTarget(ClaimResponse value) { 
13685      this.claimResponseTarget = value;
13686      return this;
13687    }
13688
13689    /**
13690     * @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
13691     */
13692    public Enumeration<RemittanceOutcome> getOutcomeElement() { 
13693      if (this.outcome == null)
13694        if (Configuration.errorOnAutoCreate())
13695          throw new Error("Attempt to auto-create ExplanationOfBenefit.outcome");
13696        else if (Configuration.doAutoCreate())
13697          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory()); // bb
13698      return this.outcome;
13699    }
13700
13701    public boolean hasOutcomeElement() { 
13702      return this.outcome != null && !this.outcome.isEmpty();
13703    }
13704
13705    public boolean hasOutcome() { 
13706      return this.outcome != null && !this.outcome.isEmpty();
13707    }
13708
13709    /**
13710     * @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
13711     */
13712    public ExplanationOfBenefit setOutcomeElement(Enumeration<RemittanceOutcome> value) { 
13713      this.outcome = value;
13714      return this;
13715    }
13716
13717    /**
13718     * @return The outcome of the claim, predetermination, or preauthorization processing.
13719     */
13720    public RemittanceOutcome getOutcome() { 
13721      return this.outcome == null ? null : this.outcome.getValue();
13722    }
13723
13724    /**
13725     * @param value The outcome of the claim, predetermination, or preauthorization processing.
13726     */
13727    public ExplanationOfBenefit setOutcome(RemittanceOutcome value) { 
13728        if (this.outcome == null)
13729          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory());
13730        this.outcome.setValue(value);
13731      return this;
13732    }
13733
13734    /**
13735     * @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
13736     */
13737    public StringType getDispositionElement() { 
13738      if (this.disposition == null)
13739        if (Configuration.errorOnAutoCreate())
13740          throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
13741        else if (Configuration.doAutoCreate())
13742          this.disposition = new StringType(); // bb
13743      return this.disposition;
13744    }
13745
13746    public boolean hasDispositionElement() { 
13747      return this.disposition != null && !this.disposition.isEmpty();
13748    }
13749
13750    public boolean hasDisposition() { 
13751      return this.disposition != null && !this.disposition.isEmpty();
13752    }
13753
13754    /**
13755     * @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
13756     */
13757    public ExplanationOfBenefit setDispositionElement(StringType value) { 
13758      this.disposition = value;
13759      return this;
13760    }
13761
13762    /**
13763     * @return A human readable description of the status of the adjudication.
13764     */
13765    public String getDisposition() { 
13766      return this.disposition == null ? null : this.disposition.getValue();
13767    }
13768
13769    /**
13770     * @param value A human readable description of the status of the adjudication.
13771     */
13772    public ExplanationOfBenefit setDisposition(String value) { 
13773      if (Utilities.noString(value))
13774        this.disposition = null;
13775      else {
13776        if (this.disposition == null)
13777          this.disposition = new StringType();
13778        this.disposition.setValue(value);
13779      }
13780      return this;
13781    }
13782
13783    /**
13784     * @return {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13785     */
13786    public List<StringType> getPreAuthRef() { 
13787      if (this.preAuthRef == null)
13788        this.preAuthRef = new ArrayList<StringType>();
13789      return this.preAuthRef;
13790    }
13791
13792    /**
13793     * @return Returns a reference to <code>this</code> for easy method chaining
13794     */
13795    public ExplanationOfBenefit setPreAuthRef(List<StringType> thePreAuthRef) { 
13796      this.preAuthRef = thePreAuthRef;
13797      return this;
13798    }
13799
13800    public boolean hasPreAuthRef() { 
13801      if (this.preAuthRef == null)
13802        return false;
13803      for (StringType item : this.preAuthRef)
13804        if (!item.isEmpty())
13805          return true;
13806      return false;
13807    }
13808
13809    /**
13810     * @return {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13811     */
13812    public StringType addPreAuthRefElement() {//2 
13813      StringType t = new StringType();
13814      if (this.preAuthRef == null)
13815        this.preAuthRef = new ArrayList<StringType>();
13816      this.preAuthRef.add(t);
13817      return t;
13818    }
13819
13820    /**
13821     * @param value {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13822     */
13823    public ExplanationOfBenefit addPreAuthRef(String value) { //1
13824      StringType t = new StringType();
13825      t.setValue(value);
13826      if (this.preAuthRef == null)
13827        this.preAuthRef = new ArrayList<StringType>();
13828      this.preAuthRef.add(t);
13829      return this;
13830    }
13831
13832    /**
13833     * @param value {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13834     */
13835    public boolean hasPreAuthRef(String value) { 
13836      if (this.preAuthRef == null)
13837        return false;
13838      for (StringType v : this.preAuthRef)
13839        if (v.getValue().equals(value)) // string
13840          return true;
13841      return false;
13842    }
13843
13844    /**
13845     * @return {@link #preAuthRefPeriod} (The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.)
13846     */
13847    public List<Period> getPreAuthRefPeriod() { 
13848      if (this.preAuthRefPeriod == null)
13849        this.preAuthRefPeriod = new ArrayList<Period>();
13850      return this.preAuthRefPeriod;
13851    }
13852
13853    /**
13854     * @return Returns a reference to <code>this</code> for easy method chaining
13855     */
13856    public ExplanationOfBenefit setPreAuthRefPeriod(List<Period> thePreAuthRefPeriod) { 
13857      this.preAuthRefPeriod = thePreAuthRefPeriod;
13858      return this;
13859    }
13860
13861    public boolean hasPreAuthRefPeriod() { 
13862      if (this.preAuthRefPeriod == null)
13863        return false;
13864      for (Period item : this.preAuthRefPeriod)
13865        if (!item.isEmpty())
13866          return true;
13867      return false;
13868    }
13869
13870    public Period addPreAuthRefPeriod() { //3
13871      Period t = new Period();
13872      if (this.preAuthRefPeriod == null)
13873        this.preAuthRefPeriod = new ArrayList<Period>();
13874      this.preAuthRefPeriod.add(t);
13875      return t;
13876    }
13877
13878    public ExplanationOfBenefit addPreAuthRefPeriod(Period t) { //3
13879      if (t == null)
13880        return this;
13881      if (this.preAuthRefPeriod == null)
13882        this.preAuthRefPeriod = new ArrayList<Period>();
13883      this.preAuthRefPeriod.add(t);
13884      return this;
13885    }
13886
13887    /**
13888     * @return The first repetition of repeating field {@link #preAuthRefPeriod}, creating it if it does not already exist
13889     */
13890    public Period getPreAuthRefPeriodFirstRep() { 
13891      if (getPreAuthRefPeriod().isEmpty()) {
13892        addPreAuthRefPeriod();
13893      }
13894      return getPreAuthRefPeriod().get(0);
13895    }
13896
13897    /**
13898     * @return {@link #careTeam} (The members of the team who provided the products and services.)
13899     */
13900    public List<CareTeamComponent> getCareTeam() { 
13901      if (this.careTeam == null)
13902        this.careTeam = new ArrayList<CareTeamComponent>();
13903      return this.careTeam;
13904    }
13905
13906    /**
13907     * @return Returns a reference to <code>this</code> for easy method chaining
13908     */
13909    public ExplanationOfBenefit setCareTeam(List<CareTeamComponent> theCareTeam) { 
13910      this.careTeam = theCareTeam;
13911      return this;
13912    }
13913
13914    public boolean hasCareTeam() { 
13915      if (this.careTeam == null)
13916        return false;
13917      for (CareTeamComponent item : this.careTeam)
13918        if (!item.isEmpty())
13919          return true;
13920      return false;
13921    }
13922
13923    public CareTeamComponent addCareTeam() { //3
13924      CareTeamComponent t = new CareTeamComponent();
13925      if (this.careTeam == null)
13926        this.careTeam = new ArrayList<CareTeamComponent>();
13927      this.careTeam.add(t);
13928      return t;
13929    }
13930
13931    public ExplanationOfBenefit addCareTeam(CareTeamComponent t) { //3
13932      if (t == null)
13933        return this;
13934      if (this.careTeam == null)
13935        this.careTeam = new ArrayList<CareTeamComponent>();
13936      this.careTeam.add(t);
13937      return this;
13938    }
13939
13940    /**
13941     * @return The first repetition of repeating field {@link #careTeam}, creating it if it does not already exist
13942     */
13943    public CareTeamComponent getCareTeamFirstRep() { 
13944      if (getCareTeam().isEmpty()) {
13945        addCareTeam();
13946      }
13947      return getCareTeam().get(0);
13948    }
13949
13950    /**
13951     * @return {@link #supportingInfo} (Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.)
13952     */
13953    public List<SupportingInformationComponent> getSupportingInfo() { 
13954      if (this.supportingInfo == null)
13955        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13956      return this.supportingInfo;
13957    }
13958
13959    /**
13960     * @return Returns a reference to <code>this</code> for easy method chaining
13961     */
13962    public ExplanationOfBenefit setSupportingInfo(List<SupportingInformationComponent> theSupportingInfo) { 
13963      this.supportingInfo = theSupportingInfo;
13964      return this;
13965    }
13966
13967    public boolean hasSupportingInfo() { 
13968      if (this.supportingInfo == null)
13969        return false;
13970      for (SupportingInformationComponent item : this.supportingInfo)
13971        if (!item.isEmpty())
13972          return true;
13973      return false;
13974    }
13975
13976    public SupportingInformationComponent addSupportingInfo() { //3
13977      SupportingInformationComponent t = new SupportingInformationComponent();
13978      if (this.supportingInfo == null)
13979        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13980      this.supportingInfo.add(t);
13981      return t;
13982    }
13983
13984    public ExplanationOfBenefit addSupportingInfo(SupportingInformationComponent t) { //3
13985      if (t == null)
13986        return this;
13987      if (this.supportingInfo == null)
13988        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13989      this.supportingInfo.add(t);
13990      return this;
13991    }
13992
13993    /**
13994     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist
13995     */
13996    public SupportingInformationComponent getSupportingInfoFirstRep() { 
13997      if (getSupportingInfo().isEmpty()) {
13998        addSupportingInfo();
13999      }
14000      return getSupportingInfo().get(0);
14001    }
14002
14003    /**
14004     * @return {@link #diagnosis} (Information about diagnoses relevant to the claim items.)
14005     */
14006    public List<DiagnosisComponent> getDiagnosis() { 
14007      if (this.diagnosis == null)
14008        this.diagnosis = new ArrayList<DiagnosisComponent>();
14009      return this.diagnosis;
14010    }
14011
14012    /**
14013     * @return Returns a reference to <code>this</code> for easy method chaining
14014     */
14015    public ExplanationOfBenefit setDiagnosis(List<DiagnosisComponent> theDiagnosis) { 
14016      this.diagnosis = theDiagnosis;
14017      return this;
14018    }
14019
14020    public boolean hasDiagnosis() { 
14021      if (this.diagnosis == null)
14022        return false;
14023      for (DiagnosisComponent item : this.diagnosis)
14024        if (!item.isEmpty())
14025          return true;
14026      return false;
14027    }
14028
14029    public DiagnosisComponent addDiagnosis() { //3
14030      DiagnosisComponent t = new DiagnosisComponent();
14031      if (this.diagnosis == null)
14032        this.diagnosis = new ArrayList<DiagnosisComponent>();
14033      this.diagnosis.add(t);
14034      return t;
14035    }
14036
14037    public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { //3
14038      if (t == null)
14039        return this;
14040      if (this.diagnosis == null)
14041        this.diagnosis = new ArrayList<DiagnosisComponent>();
14042      this.diagnosis.add(t);
14043      return this;
14044    }
14045
14046    /**
14047     * @return The first repetition of repeating field {@link #diagnosis}, creating it if it does not already exist
14048     */
14049    public DiagnosisComponent getDiagnosisFirstRep() { 
14050      if (getDiagnosis().isEmpty()) {
14051        addDiagnosis();
14052      }
14053      return getDiagnosis().get(0);
14054    }
14055
14056    /**
14057     * @return {@link #procedure} (Procedures performed on the patient relevant to the billing items with the claim.)
14058     */
14059    public List<ProcedureComponent> getProcedure() { 
14060      if (this.procedure == null)
14061        this.procedure = new ArrayList<ProcedureComponent>();
14062      return this.procedure;
14063    }
14064
14065    /**
14066     * @return Returns a reference to <code>this</code> for easy method chaining
14067     */
14068    public ExplanationOfBenefit setProcedure(List<ProcedureComponent> theProcedure) { 
14069      this.procedure = theProcedure;
14070      return this;
14071    }
14072
14073    public boolean hasProcedure() { 
14074      if (this.procedure == null)
14075        return false;
14076      for (ProcedureComponent item : this.procedure)
14077        if (!item.isEmpty())
14078          return true;
14079      return false;
14080    }
14081
14082    public ProcedureComponent addProcedure() { //3
14083      ProcedureComponent t = new ProcedureComponent();
14084      if (this.procedure == null)
14085        this.procedure = new ArrayList<ProcedureComponent>();
14086      this.procedure.add(t);
14087      return t;
14088    }
14089
14090    public ExplanationOfBenefit addProcedure(ProcedureComponent t) { //3
14091      if (t == null)
14092        return this;
14093      if (this.procedure == null)
14094        this.procedure = new ArrayList<ProcedureComponent>();
14095      this.procedure.add(t);
14096      return this;
14097    }
14098
14099    /**
14100     * @return The first repetition of repeating field {@link #procedure}, creating it if it does not already exist
14101     */
14102    public ProcedureComponent getProcedureFirstRep() { 
14103      if (getProcedure().isEmpty()) {
14104        addProcedure();
14105      }
14106      return getProcedure().get(0);
14107    }
14108
14109    /**
14110     * @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
14111     */
14112    public PositiveIntType getPrecedenceElement() { 
14113      if (this.precedence == null)
14114        if (Configuration.errorOnAutoCreate())
14115          throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
14116        else if (Configuration.doAutoCreate())
14117          this.precedence = new PositiveIntType(); // bb
14118      return this.precedence;
14119    }
14120
14121    public boolean hasPrecedenceElement() { 
14122      return this.precedence != null && !this.precedence.isEmpty();
14123    }
14124
14125    public boolean hasPrecedence() { 
14126      return this.precedence != null && !this.precedence.isEmpty();
14127    }
14128
14129    /**
14130     * @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
14131     */
14132    public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) { 
14133      this.precedence = value;
14134      return this;
14135    }
14136
14137    /**
14138     * @return This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
14139     */
14140    public int getPrecedence() { 
14141      return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
14142    }
14143
14144    /**
14145     * @param value This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
14146     */
14147    public ExplanationOfBenefit setPrecedence(int value) { 
14148        if (this.precedence == null)
14149          this.precedence = new PositiveIntType();
14150        this.precedence.setValue(value);
14151      return this;
14152    }
14153
14154    /**
14155     * @return {@link #insurance} (Financial instruments for reimbursement for the health care products and services specified on the claim.)
14156     */
14157    public List<InsuranceComponent> getInsurance() { 
14158      if (this.insurance == null)
14159        this.insurance = new ArrayList<InsuranceComponent>();
14160      return this.insurance;
14161    }
14162
14163    /**
14164     * @return Returns a reference to <code>this</code> for easy method chaining
14165     */
14166    public ExplanationOfBenefit setInsurance(List<InsuranceComponent> theInsurance) { 
14167      this.insurance = theInsurance;
14168      return this;
14169    }
14170
14171    public boolean hasInsurance() { 
14172      if (this.insurance == null)
14173        return false;
14174      for (InsuranceComponent item : this.insurance)
14175        if (!item.isEmpty())
14176          return true;
14177      return false;
14178    }
14179
14180    public InsuranceComponent addInsurance() { //3
14181      InsuranceComponent t = new InsuranceComponent();
14182      if (this.insurance == null)
14183        this.insurance = new ArrayList<InsuranceComponent>();
14184      this.insurance.add(t);
14185      return t;
14186    }
14187
14188    public ExplanationOfBenefit addInsurance(InsuranceComponent t) { //3
14189      if (t == null)
14190        return this;
14191      if (this.insurance == null)
14192        this.insurance = new ArrayList<InsuranceComponent>();
14193      this.insurance.add(t);
14194      return this;
14195    }
14196
14197    /**
14198     * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist
14199     */
14200    public InsuranceComponent getInsuranceFirstRep() { 
14201      if (getInsurance().isEmpty()) {
14202        addInsurance();
14203      }
14204      return getInsurance().get(0);
14205    }
14206
14207    /**
14208     * @return {@link #accident} (Details of a accident which resulted in injuries which required the products and services listed in the claim.)
14209     */
14210    public AccidentComponent getAccident() { 
14211      if (this.accident == null)
14212        if (Configuration.errorOnAutoCreate())
14213          throw new Error("Attempt to auto-create ExplanationOfBenefit.accident");
14214        else if (Configuration.doAutoCreate())
14215          this.accident = new AccidentComponent(); // cc
14216      return this.accident;
14217    }
14218
14219    public boolean hasAccident() { 
14220      return this.accident != null && !this.accident.isEmpty();
14221    }
14222
14223    /**
14224     * @param value {@link #accident} (Details of a accident which resulted in injuries which required the products and services listed in the claim.)
14225     */
14226    public ExplanationOfBenefit setAccident(AccidentComponent value) { 
14227      this.accident = value;
14228      return this;
14229    }
14230
14231    /**
14232     * @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.)
14233     */
14234    public List<ItemComponent> getItem() { 
14235      if (this.item == null)
14236        this.item = new ArrayList<ItemComponent>();
14237      return this.item;
14238    }
14239
14240    /**
14241     * @return Returns a reference to <code>this</code> for easy method chaining
14242     */
14243    public ExplanationOfBenefit setItem(List<ItemComponent> theItem) { 
14244      this.item = theItem;
14245      return this;
14246    }
14247
14248    public boolean hasItem() { 
14249      if (this.item == null)
14250        return false;
14251      for (ItemComponent item : this.item)
14252        if (!item.isEmpty())
14253          return true;
14254      return false;
14255    }
14256
14257    public ItemComponent addItem() { //3
14258      ItemComponent t = new ItemComponent();
14259      if (this.item == null)
14260        this.item = new ArrayList<ItemComponent>();
14261      this.item.add(t);
14262      return t;
14263    }
14264
14265    public ExplanationOfBenefit addItem(ItemComponent t) { //3
14266      if (t == null)
14267        return this;
14268      if (this.item == null)
14269        this.item = new ArrayList<ItemComponent>();
14270      this.item.add(t);
14271      return this;
14272    }
14273
14274    /**
14275     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
14276     */
14277    public ItemComponent getItemFirstRep() { 
14278      if (getItem().isEmpty()) {
14279        addItem();
14280      }
14281      return getItem().get(0);
14282    }
14283
14284    /**
14285     * @return {@link #addItem} (The first-tier service adjudications for payor added product or service lines.)
14286     */
14287    public List<AddedItemComponent> getAddItem() { 
14288      if (this.addItem == null)
14289        this.addItem = new ArrayList<AddedItemComponent>();
14290      return this.addItem;
14291    }
14292
14293    /**
14294     * @return Returns a reference to <code>this</code> for easy method chaining
14295     */
14296    public ExplanationOfBenefit setAddItem(List<AddedItemComponent> theAddItem) { 
14297      this.addItem = theAddItem;
14298      return this;
14299    }
14300
14301    public boolean hasAddItem() { 
14302      if (this.addItem == null)
14303        return false;
14304      for (AddedItemComponent item : this.addItem)
14305        if (!item.isEmpty())
14306          return true;
14307      return false;
14308    }
14309
14310    public AddedItemComponent addAddItem() { //3
14311      AddedItemComponent t = new AddedItemComponent();
14312      if (this.addItem == null)
14313        this.addItem = new ArrayList<AddedItemComponent>();
14314      this.addItem.add(t);
14315      return t;
14316    }
14317
14318    public ExplanationOfBenefit addAddItem(AddedItemComponent t) { //3
14319      if (t == null)
14320        return this;
14321      if (this.addItem == null)
14322        this.addItem = new ArrayList<AddedItemComponent>();
14323      this.addItem.add(t);
14324      return this;
14325    }
14326
14327    /**
14328     * @return The first repetition of repeating field {@link #addItem}, creating it if it does not already exist
14329     */
14330    public AddedItemComponent getAddItemFirstRep() { 
14331      if (getAddItem().isEmpty()) {
14332        addAddItem();
14333      }
14334      return getAddItem().get(0);
14335    }
14336
14337    /**
14338     * @return {@link #adjudication} (The adjudication results which are presented at the header level rather than at the line-item or add-item levels.)
14339     */
14340    public List<AdjudicationComponent> getAdjudication() { 
14341      if (this.adjudication == null)
14342        this.adjudication = new ArrayList<AdjudicationComponent>();
14343      return this.adjudication;
14344    }
14345
14346    /**
14347     * @return Returns a reference to <code>this</code> for easy method chaining
14348     */
14349    public ExplanationOfBenefit setAdjudication(List<AdjudicationComponent> theAdjudication) { 
14350      this.adjudication = theAdjudication;
14351      return this;
14352    }
14353
14354    public boolean hasAdjudication() { 
14355      if (this.adjudication == null)
14356        return false;
14357      for (AdjudicationComponent item : this.adjudication)
14358        if (!item.isEmpty())
14359          return true;
14360      return false;
14361    }
14362
14363    public AdjudicationComponent addAdjudication() { //3
14364      AdjudicationComponent t = new AdjudicationComponent();
14365      if (this.adjudication == null)
14366        this.adjudication = new ArrayList<AdjudicationComponent>();
14367      this.adjudication.add(t);
14368      return t;
14369    }
14370
14371    public ExplanationOfBenefit addAdjudication(AdjudicationComponent t) { //3
14372      if (t == null)
14373        return this;
14374      if (this.adjudication == null)
14375        this.adjudication = new ArrayList<AdjudicationComponent>();
14376      this.adjudication.add(t);
14377      return this;
14378    }
14379
14380    /**
14381     * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
14382     */
14383    public AdjudicationComponent getAdjudicationFirstRep() { 
14384      if (getAdjudication().isEmpty()) {
14385        addAdjudication();
14386      }
14387      return getAdjudication().get(0);
14388    }
14389
14390    /**
14391     * @return {@link #total} (Categorized monetary totals for the adjudication.)
14392     */
14393    public List<TotalComponent> getTotal() { 
14394      if (this.total == null)
14395        this.total = new ArrayList<TotalComponent>();
14396      return this.total;
14397    }
14398
14399    /**
14400     * @return Returns a reference to <code>this</code> for easy method chaining
14401     */
14402    public ExplanationOfBenefit setTotal(List<TotalComponent> theTotal) { 
14403      this.total = theTotal;
14404      return this;
14405    }
14406
14407    public boolean hasTotal() { 
14408      if (this.total == null)
14409        return false;
14410      for (TotalComponent item : this.total)
14411        if (!item.isEmpty())
14412          return true;
14413      return false;
14414    }
14415
14416    public TotalComponent addTotal() { //3
14417      TotalComponent t = new TotalComponent();
14418      if (this.total == null)
14419        this.total = new ArrayList<TotalComponent>();
14420      this.total.add(t);
14421      return t;
14422    }
14423
14424    public ExplanationOfBenefit addTotal(TotalComponent t) { //3
14425      if (t == null)
14426        return this;
14427      if (this.total == null)
14428        this.total = new ArrayList<TotalComponent>();
14429      this.total.add(t);
14430      return this;
14431    }
14432
14433    /**
14434     * @return The first repetition of repeating field {@link #total}, creating it if it does not already exist
14435     */
14436    public TotalComponent getTotalFirstRep() { 
14437      if (getTotal().isEmpty()) {
14438        addTotal();
14439      }
14440      return getTotal().get(0);
14441    }
14442
14443    /**
14444     * @return {@link #payment} (Payment details for the adjudication of the claim.)
14445     */
14446    public PaymentComponent getPayment() { 
14447      if (this.payment == null)
14448        if (Configuration.errorOnAutoCreate())
14449          throw new Error("Attempt to auto-create ExplanationOfBenefit.payment");
14450        else if (Configuration.doAutoCreate())
14451          this.payment = new PaymentComponent(); // cc
14452      return this.payment;
14453    }
14454
14455    public boolean hasPayment() { 
14456      return this.payment != null && !this.payment.isEmpty();
14457    }
14458
14459    /**
14460     * @param value {@link #payment} (Payment details for the adjudication of the claim.)
14461     */
14462    public ExplanationOfBenefit setPayment(PaymentComponent value) { 
14463      this.payment = value;
14464      return this;
14465    }
14466
14467    /**
14468     * @return {@link #formCode} (A code for the form to be used for printing the content.)
14469     */
14470    public CodeableConcept getFormCode() { 
14471      if (this.formCode == null)
14472        if (Configuration.errorOnAutoCreate())
14473          throw new Error("Attempt to auto-create ExplanationOfBenefit.formCode");
14474        else if (Configuration.doAutoCreate())
14475          this.formCode = new CodeableConcept(); // cc
14476      return this.formCode;
14477    }
14478
14479    public boolean hasFormCode() { 
14480      return this.formCode != null && !this.formCode.isEmpty();
14481    }
14482
14483    /**
14484     * @param value {@link #formCode} (A code for the form to be used for printing the content.)
14485     */
14486    public ExplanationOfBenefit setFormCode(CodeableConcept value) { 
14487      this.formCode = value;
14488      return this;
14489    }
14490
14491    /**
14492     * @return {@link #form} (The actual form, by reference or inclusion, for printing the content or an EOB.)
14493     */
14494    public Attachment getForm() { 
14495      if (this.form == null)
14496        if (Configuration.errorOnAutoCreate())
14497          throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
14498        else if (Configuration.doAutoCreate())
14499          this.form = new Attachment(); // cc
14500      return this.form;
14501    }
14502
14503    public boolean hasForm() { 
14504      return this.form != null && !this.form.isEmpty();
14505    }
14506
14507    /**
14508     * @param value {@link #form} (The actual form, by reference or inclusion, for printing the content or an EOB.)
14509     */
14510    public ExplanationOfBenefit setForm(Attachment value) { 
14511      this.form = value;
14512      return this;
14513    }
14514
14515    /**
14516     * @return {@link #processNote} (A note that describes or explains adjudication results in a human readable form.)
14517     */
14518    public List<NoteComponent> getProcessNote() { 
14519      if (this.processNote == null)
14520        this.processNote = new ArrayList<NoteComponent>();
14521      return this.processNote;
14522    }
14523
14524    /**
14525     * @return Returns a reference to <code>this</code> for easy method chaining
14526     */
14527    public ExplanationOfBenefit setProcessNote(List<NoteComponent> theProcessNote) { 
14528      this.processNote = theProcessNote;
14529      return this;
14530    }
14531
14532    public boolean hasProcessNote() { 
14533      if (this.processNote == null)
14534        return false;
14535      for (NoteComponent item : this.processNote)
14536        if (!item.isEmpty())
14537          return true;
14538      return false;
14539    }
14540
14541    public NoteComponent addProcessNote() { //3
14542      NoteComponent t = new NoteComponent();
14543      if (this.processNote == null)
14544        this.processNote = new ArrayList<NoteComponent>();
14545      this.processNote.add(t);
14546      return t;
14547    }
14548
14549    public ExplanationOfBenefit addProcessNote(NoteComponent t) { //3
14550      if (t == null)
14551        return this;
14552      if (this.processNote == null)
14553        this.processNote = new ArrayList<NoteComponent>();
14554      this.processNote.add(t);
14555      return this;
14556    }
14557
14558    /**
14559     * @return The first repetition of repeating field {@link #processNote}, creating it if it does not already exist
14560     */
14561    public NoteComponent getProcessNoteFirstRep() { 
14562      if (getProcessNote().isEmpty()) {
14563        addProcessNote();
14564      }
14565      return getProcessNote().get(0);
14566    }
14567
14568    /**
14569     * @return {@link #benefitPeriod} (The term of the benefits documented in this response.)
14570     */
14571    public Period getBenefitPeriod() { 
14572      if (this.benefitPeriod == null)
14573        if (Configuration.errorOnAutoCreate())
14574          throw new Error("Attempt to auto-create ExplanationOfBenefit.benefitPeriod");
14575        else if (Configuration.doAutoCreate())
14576          this.benefitPeriod = new Period(); // cc
14577      return this.benefitPeriod;
14578    }
14579
14580    public boolean hasBenefitPeriod() { 
14581      return this.benefitPeriod != null && !this.benefitPeriod.isEmpty();
14582    }
14583
14584    /**
14585     * @param value {@link #benefitPeriod} (The term of the benefits documented in this response.)
14586     */
14587    public ExplanationOfBenefit setBenefitPeriod(Period value) { 
14588      this.benefitPeriod = value;
14589      return this;
14590    }
14591
14592    /**
14593     * @return {@link #benefitBalance} (Balance by Benefit Category.)
14594     */
14595    public List<BenefitBalanceComponent> getBenefitBalance() { 
14596      if (this.benefitBalance == null)
14597        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14598      return this.benefitBalance;
14599    }
14600
14601    /**
14602     * @return Returns a reference to <code>this</code> for easy method chaining
14603     */
14604    public ExplanationOfBenefit setBenefitBalance(List<BenefitBalanceComponent> theBenefitBalance) { 
14605      this.benefitBalance = theBenefitBalance;
14606      return this;
14607    }
14608
14609    public boolean hasBenefitBalance() { 
14610      if (this.benefitBalance == null)
14611        return false;
14612      for (BenefitBalanceComponent item : this.benefitBalance)
14613        if (!item.isEmpty())
14614          return true;
14615      return false;
14616    }
14617
14618    public BenefitBalanceComponent addBenefitBalance() { //3
14619      BenefitBalanceComponent t = new BenefitBalanceComponent();
14620      if (this.benefitBalance == null)
14621        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14622      this.benefitBalance.add(t);
14623      return t;
14624    }
14625
14626    public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { //3
14627      if (t == null)
14628        return this;
14629      if (this.benefitBalance == null)
14630        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14631      this.benefitBalance.add(t);
14632      return this;
14633    }
14634
14635    /**
14636     * @return The first repetition of repeating field {@link #benefitBalance}, creating it if it does not already exist
14637     */
14638    public BenefitBalanceComponent getBenefitBalanceFirstRep() { 
14639      if (getBenefitBalance().isEmpty()) {
14640        addBenefitBalance();
14641      }
14642      return getBenefitBalance().get(0);
14643    }
14644
14645      protected void listChildren(List<Property> children) {
14646        super.listChildren(children);
14647        children.add(new Property("identifier", "Identifier", "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier));
14648        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
14649        children.add(new Property("type", "CodeableConcept", "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type));
14650        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));
14651        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));
14652        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));
14653        children.add(new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1, billablePeriod));
14654        children.add(new Property("created", "dateTime", "The date this resource was created.", 0, 1, created));
14655        children.add(new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer));
14656        children.add(new Property("insurer", "Reference(Organization)", "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer));
14657        children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider));
14658        children.add(new Property("priority", "CodeableConcept", "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.", 0, 1, priority));
14659        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));
14660        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));
14661        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));
14662        children.add(new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription));
14663        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));
14664        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));
14665        children.add(new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral));
14666        children.add(new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility));
14667        children.add(new Property("claim", "Reference(Claim)", "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.", 0, 1, claim));
14668        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));
14669        children.add(new Property("outcome", "code", "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome));
14670        children.add(new Property("disposition", "string", "A human readable description of the status of the adjudication.", 0, 1, disposition));
14671        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));
14672        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));
14673        children.add(new Property("careTeam", "", "The members of the team who provided the products and services.", 0, java.lang.Integer.MAX_VALUE, careTeam));
14674        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));
14675        children.add(new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
14676        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));
14677        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));
14678        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));
14679        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));
14680        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));
14681        children.add(new Property("addItem", "", "The first-tier service adjudications for payor added product or service lines.", 0, java.lang.Integer.MAX_VALUE, addItem));
14682        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));
14683        children.add(new Property("total", "", "Categorized monetary totals for the adjudication.", 0, java.lang.Integer.MAX_VALUE, total));
14684        children.add(new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment));
14685        children.add(new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.", 0, 1, formCode));
14686        children.add(new Property("form", "Attachment", "The actual form, by reference or inclusion, for printing the content or an EOB.", 0, 1, form));
14687        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));
14688        children.add(new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1, benefitPeriod));
14689        children.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance));
14690      }
14691
14692      @Override
14693      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
14694        switch (_hash) {
14695        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier);
14696        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
14697        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type);
14698        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);
14699        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);
14700        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);
14701        case -332066046: /*billablePeriod*/  return new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1, billablePeriod);
14702        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date this resource was created.", 0, 1, created);
14703        case -1591951995: /*enterer*/  return new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer);
14704        case 1957615864: /*insurer*/  return new Property("insurer", "Reference(Organization)", "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer);
14705        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);
14706        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);
14707        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);
14708        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);
14709        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);
14710        case 460301338: /*prescription*/  return new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription);
14711        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);
14712        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);
14713        case -722568291: /*referral*/  return new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral);
14714        case 501116579: /*facility*/  return new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility);
14715        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);
14716        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);
14717        case -1106507950: /*outcome*/  return new Property("outcome", "code", "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome);
14718        case 583380919: /*disposition*/  return new Property("disposition", "string", "A human readable description of the status of the adjudication.", 0, 1, disposition);
14719        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);
14720        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);
14721        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);
14722        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);
14723        case 1196993265: /*diagnosis*/  return new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0, java.lang.Integer.MAX_VALUE, diagnosis);
14724        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);
14725        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);
14726        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);
14727        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);
14728        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);
14729        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);
14730        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);
14731        case 110549828: /*total*/  return new Property("total", "", "Categorized monetary totals for the adjudication.", 0, java.lang.Integer.MAX_VALUE, total);
14732        case -786681338: /*payment*/  return new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment);
14733        case 473181393: /*formCode*/  return new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.", 0, 1, formCode);
14734        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);
14735        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);
14736        case -407369416: /*benefitPeriod*/  return new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1, benefitPeriod);
14737        case 596003397: /*benefitBalance*/  return new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance);
14738        default: return super.getNamedProperty(_hash, _name, _checkValid);
14739        }
14740
14741      }
14742
14743      @Override
14744      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
14745        switch (hash) {
14746        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
14747        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ExplanationOfBenefitStatus>
14748        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
14749        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
14750        case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<Use>
14751        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
14752        case -332066046: /*billablePeriod*/ return this.billablePeriod == null ? new Base[0] : new Base[] {this.billablePeriod}; // Period
14753        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
14754        case -1591951995: /*enterer*/ return this.enterer == null ? new Base[0] : new Base[] {this.enterer}; // Reference
14755        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
14756        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
14757        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
14758        case -1688904576: /*fundsReserveRequested*/ return this.fundsReserveRequested == null ? new Base[0] : new Base[] {this.fundsReserveRequested}; // CodeableConcept
14759        case 1314609806: /*fundsReserve*/ return this.fundsReserve == null ? new Base[0] : new Base[] {this.fundsReserve}; // CodeableConcept
14760        case 1090493483: /*related*/ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimComponent
14761        case 460301338: /*prescription*/ return this.prescription == null ? new Base[0] : new Base[] {this.prescription}; // Reference
14762        case -1814015861: /*originalPrescription*/ return this.originalPrescription == null ? new Base[0] : new Base[] {this.originalPrescription}; // Reference
14763        case 106443592: /*payee*/ return this.payee == null ? new Base[0] : new Base[] {this.payee}; // PayeeComponent
14764        case -722568291: /*referral*/ return this.referral == null ? new Base[0] : new Base[] {this.referral}; // Reference
14765        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Reference
14766        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
14767        case 689513629: /*claimResponse*/ return this.claimResponse == null ? new Base[0] : new Base[] {this.claimResponse}; // Reference
14768        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // Enumeration<RemittanceOutcome>
14769        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
14770        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
14771        case -1262920311: /*preAuthRefPeriod*/ return this.preAuthRefPeriod == null ? new Base[0] : this.preAuthRefPeriod.toArray(new Base[this.preAuthRefPeriod.size()]); // Period
14772        case -7323378: /*careTeam*/ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // CareTeamComponent
14773        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // SupportingInformationComponent
14774        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
14775        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
14776        case 159695370: /*precedence*/ return this.precedence == null ? new Base[0] : new Base[] {this.precedence}; // PositiveIntType
14777        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // InsuranceComponent
14778        case -2143202801: /*accident*/ return this.accident == null ? new Base[0] : new Base[] {this.accident}; // AccidentComponent
14779        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
14780        case -1148899500: /*addItem*/ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
14781        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
14782        case 110549828: /*total*/ return this.total == null ? new Base[0] : this.total.toArray(new Base[this.total.size()]); // TotalComponent
14783        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // PaymentComponent
14784        case 473181393: /*formCode*/ return this.formCode == null ? new Base[0] : new Base[] {this.formCode}; // CodeableConcept
14785        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // Attachment
14786        case 202339073: /*processNote*/ return this.processNote == null ? new Base[0] : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
14787        case -407369416: /*benefitPeriod*/ return this.benefitPeriod == null ? new Base[0] : new Base[] {this.benefitPeriod}; // Period
14788        case 596003397: /*benefitBalance*/ return this.benefitBalance == null ? new Base[0] : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
14789        default: return super.getProperty(hash, name, checkValid);
14790        }
14791
14792      }
14793
14794      @Override
14795      public Base setProperty(int hash, String name, Base value) throws FHIRException {
14796        switch (hash) {
14797        case -1618432855: // identifier
14798          this.getIdentifier().add(castToIdentifier(value)); // Identifier
14799          return value;
14800        case -892481550: // status
14801          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
14802          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
14803          return value;
14804        case 3575610: // type
14805          this.type = castToCodeableConcept(value); // CodeableConcept
14806          return value;
14807        case -1868521062: // subType
14808          this.subType = castToCodeableConcept(value); // CodeableConcept
14809          return value;
14810        case 116103: // use
14811          value = new UseEnumFactory().fromType(castToCode(value));
14812          this.use = (Enumeration) value; // Enumeration<Use>
14813          return value;
14814        case -791418107: // patient
14815          this.patient = castToReference(value); // Reference
14816          return value;
14817        case -332066046: // billablePeriod
14818          this.billablePeriod = castToPeriod(value); // Period
14819          return value;
14820        case 1028554472: // created
14821          this.created = castToDateTime(value); // DateTimeType
14822          return value;
14823        case -1591951995: // enterer
14824          this.enterer = castToReference(value); // Reference
14825          return value;
14826        case 1957615864: // insurer
14827          this.insurer = castToReference(value); // Reference
14828          return value;
14829        case -987494927: // provider
14830          this.provider = castToReference(value); // Reference
14831          return value;
14832        case -1165461084: // priority
14833          this.priority = castToCodeableConcept(value); // CodeableConcept
14834          return value;
14835        case -1688904576: // fundsReserveRequested
14836          this.fundsReserveRequested = castToCodeableConcept(value); // CodeableConcept
14837          return value;
14838        case 1314609806: // fundsReserve
14839          this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
14840          return value;
14841        case 1090493483: // related
14842          this.getRelated().add((RelatedClaimComponent) value); // RelatedClaimComponent
14843          return value;
14844        case 460301338: // prescription
14845          this.prescription = castToReference(value); // Reference
14846          return value;
14847        case -1814015861: // originalPrescription
14848          this.originalPrescription = castToReference(value); // Reference
14849          return value;
14850        case 106443592: // payee
14851          this.payee = (PayeeComponent) value; // PayeeComponent
14852          return value;
14853        case -722568291: // referral
14854          this.referral = castToReference(value); // Reference
14855          return value;
14856        case 501116579: // facility
14857          this.facility = castToReference(value); // Reference
14858          return value;
14859        case 94742588: // claim
14860          this.claim = castToReference(value); // Reference
14861          return value;
14862        case 689513629: // claimResponse
14863          this.claimResponse = castToReference(value); // Reference
14864          return value;
14865        case -1106507950: // outcome
14866          value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
14867          this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
14868          return value;
14869        case 583380919: // disposition
14870          this.disposition = castToString(value); // StringType
14871          return value;
14872        case 522246568: // preAuthRef
14873          this.getPreAuthRef().add(castToString(value)); // StringType
14874          return value;
14875        case -1262920311: // preAuthRefPeriod
14876          this.getPreAuthRefPeriod().add(castToPeriod(value)); // Period
14877          return value;
14878        case -7323378: // careTeam
14879          this.getCareTeam().add((CareTeamComponent) value); // CareTeamComponent
14880          return value;
14881        case 1922406657: // supportingInfo
14882          this.getSupportingInfo().add((SupportingInformationComponent) value); // SupportingInformationComponent
14883          return value;
14884        case 1196993265: // diagnosis
14885          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
14886          return value;
14887        case -1095204141: // procedure
14888          this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
14889          return value;
14890        case 159695370: // precedence
14891          this.precedence = castToPositiveInt(value); // PositiveIntType
14892          return value;
14893        case 73049818: // insurance
14894          this.getInsurance().add((InsuranceComponent) value); // InsuranceComponent
14895          return value;
14896        case -2143202801: // accident
14897          this.accident = (AccidentComponent) value; // AccidentComponent
14898          return value;
14899        case 3242771: // item
14900          this.getItem().add((ItemComponent) value); // ItemComponent
14901          return value;
14902        case -1148899500: // addItem
14903          this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
14904          return value;
14905        case -231349275: // adjudication
14906          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
14907          return value;
14908        case 110549828: // total
14909          this.getTotal().add((TotalComponent) value); // TotalComponent
14910          return value;
14911        case -786681338: // payment
14912          this.payment = (PaymentComponent) value; // PaymentComponent
14913          return value;
14914        case 473181393: // formCode
14915          this.formCode = castToCodeableConcept(value); // CodeableConcept
14916          return value;
14917        case 3148996: // form
14918          this.form = castToAttachment(value); // Attachment
14919          return value;
14920        case 202339073: // processNote
14921          this.getProcessNote().add((NoteComponent) value); // NoteComponent
14922          return value;
14923        case -407369416: // benefitPeriod
14924          this.benefitPeriod = castToPeriod(value); // Period
14925          return value;
14926        case 596003397: // benefitBalance
14927          this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
14928          return value;
14929        default: return super.setProperty(hash, name, value);
14930        }
14931
14932      }
14933
14934      @Override
14935      public Base setProperty(String name, Base value) throws FHIRException {
14936        if (name.equals("identifier")) {
14937          this.getIdentifier().add(castToIdentifier(value));
14938        } else if (name.equals("status")) {
14939          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
14940          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
14941        } else if (name.equals("type")) {
14942          this.type = castToCodeableConcept(value); // CodeableConcept
14943        } else if (name.equals("subType")) {
14944          this.subType = castToCodeableConcept(value); // CodeableConcept
14945        } else if (name.equals("use")) {
14946          value = new UseEnumFactory().fromType(castToCode(value));
14947          this.use = (Enumeration) value; // Enumeration<Use>
14948        } else if (name.equals("patient")) {
14949          this.patient = castToReference(value); // Reference
14950        } else if (name.equals("billablePeriod")) {
14951          this.billablePeriod = castToPeriod(value); // Period
14952        } else if (name.equals("created")) {
14953          this.created = castToDateTime(value); // DateTimeType
14954        } else if (name.equals("enterer")) {
14955          this.enterer = castToReference(value); // Reference
14956        } else if (name.equals("insurer")) {
14957          this.insurer = castToReference(value); // Reference
14958        } else if (name.equals("provider")) {
14959          this.provider = castToReference(value); // Reference
14960        } else if (name.equals("priority")) {
14961          this.priority = castToCodeableConcept(value); // CodeableConcept
14962        } else if (name.equals("fundsReserveRequested")) {
14963          this.fundsReserveRequested = castToCodeableConcept(value); // CodeableConcept
14964        } else if (name.equals("fundsReserve")) {
14965          this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
14966        } else if (name.equals("related")) {
14967          this.getRelated().add((RelatedClaimComponent) value);
14968        } else if (name.equals("prescription")) {
14969          this.prescription = castToReference(value); // Reference
14970        } else if (name.equals("originalPrescription")) {
14971          this.originalPrescription = castToReference(value); // Reference
14972        } else if (name.equals("payee")) {
14973          this.payee = (PayeeComponent) value; // PayeeComponent
14974        } else if (name.equals("referral")) {
14975          this.referral = castToReference(value); // Reference
14976        } else if (name.equals("facility")) {
14977          this.facility = castToReference(value); // Reference
14978        } else if (name.equals("claim")) {
14979          this.claim = castToReference(value); // Reference
14980        } else if (name.equals("claimResponse")) {
14981          this.claimResponse = castToReference(value); // Reference
14982        } else if (name.equals("outcome")) {
14983          value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
14984          this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
14985        } else if (name.equals("disposition")) {
14986          this.disposition = castToString(value); // StringType
14987        } else if (name.equals("preAuthRef")) {
14988          this.getPreAuthRef().add(castToString(value));
14989        } else if (name.equals("preAuthRefPeriod")) {
14990          this.getPreAuthRefPeriod().add(castToPeriod(value));
14991        } else if (name.equals("careTeam")) {
14992          this.getCareTeam().add((CareTeamComponent) value);
14993        } else if (name.equals("supportingInfo")) {
14994          this.getSupportingInfo().add((SupportingInformationComponent) value);
14995        } else if (name.equals("diagnosis")) {
14996          this.getDiagnosis().add((DiagnosisComponent) value);
14997        } else if (name.equals("procedure")) {
14998          this.getProcedure().add((ProcedureComponent) value);
14999        } else if (name.equals("precedence")) {
15000          this.precedence = castToPositiveInt(value); // PositiveIntType
15001        } else if (name.equals("insurance")) {
15002          this.getInsurance().add((InsuranceComponent) value);
15003        } else if (name.equals("accident")) {
15004          this.accident = (AccidentComponent) value; // AccidentComponent
15005        } else if (name.equals("item")) {
15006          this.getItem().add((ItemComponent) value);
15007        } else if (name.equals("addItem")) {
15008          this.getAddItem().add((AddedItemComponent) value);
15009        } else if (name.equals("adjudication")) {
15010          this.getAdjudication().add((AdjudicationComponent) value);
15011        } else if (name.equals("total")) {
15012          this.getTotal().add((TotalComponent) value);
15013        } else if (name.equals("payment")) {
15014          this.payment = (PaymentComponent) value; // PaymentComponent
15015        } else if (name.equals("formCode")) {
15016          this.formCode = castToCodeableConcept(value); // CodeableConcept
15017        } else if (name.equals("form")) {
15018          this.form = castToAttachment(value); // Attachment
15019        } else if (name.equals("processNote")) {
15020          this.getProcessNote().add((NoteComponent) value);
15021        } else if (name.equals("benefitPeriod")) {
15022          this.benefitPeriod = castToPeriod(value); // Period
15023        } else if (name.equals("benefitBalance")) {
15024          this.getBenefitBalance().add((BenefitBalanceComponent) value);
15025        } else
15026          return super.setProperty(name, value);
15027        return value;
15028      }
15029
15030      @Override
15031      public Base makeProperty(int hash, String name) throws FHIRException {
15032        switch (hash) {
15033        case -1618432855:  return addIdentifier(); 
15034        case -892481550:  return getStatusElement();
15035        case 3575610:  return getType(); 
15036        case -1868521062:  return getSubType(); 
15037        case 116103:  return getUseElement();
15038        case -791418107:  return getPatient(); 
15039        case -332066046:  return getBillablePeriod(); 
15040        case 1028554472:  return getCreatedElement();
15041        case -1591951995:  return getEnterer(); 
15042        case 1957615864:  return getInsurer(); 
15043        case -987494927:  return getProvider(); 
15044        case -1165461084:  return getPriority(); 
15045        case -1688904576:  return getFundsReserveRequested(); 
15046        case 1314609806:  return getFundsReserve(); 
15047        case 1090493483:  return addRelated(); 
15048        case 460301338:  return getPrescription(); 
15049        case -1814015861:  return getOriginalPrescription(); 
15050        case 106443592:  return getPayee(); 
15051        case -722568291:  return getReferral(); 
15052        case 501116579:  return getFacility(); 
15053        case 94742588:  return getClaim(); 
15054        case 689513629:  return getClaimResponse(); 
15055        case -1106507950:  return getOutcomeElement();
15056        case 583380919:  return getDispositionElement();
15057        case 522246568:  return addPreAuthRefElement();
15058        case -1262920311:  return addPreAuthRefPeriod(); 
15059        case -7323378:  return addCareTeam(); 
15060        case 1922406657:  return addSupportingInfo(); 
15061        case 1196993265:  return addDiagnosis(); 
15062        case -1095204141:  return addProcedure(); 
15063        case 159695370:  return getPrecedenceElement();
15064        case 73049818:  return addInsurance(); 
15065        case -2143202801:  return getAccident(); 
15066        case 3242771:  return addItem(); 
15067        case -1148899500:  return addAddItem(); 
15068        case -231349275:  return addAdjudication(); 
15069        case 110549828:  return addTotal(); 
15070        case -786681338:  return getPayment(); 
15071        case 473181393:  return getFormCode(); 
15072        case 3148996:  return getForm(); 
15073        case 202339073:  return addProcessNote(); 
15074        case -407369416:  return getBenefitPeriod(); 
15075        case 596003397:  return addBenefitBalance(); 
15076        default: return super.makeProperty(hash, name);
15077        }
15078
15079      }
15080
15081      @Override
15082      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
15083        switch (hash) {
15084        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
15085        case -892481550: /*status*/ return new String[] {"code"};
15086        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
15087        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
15088        case 116103: /*use*/ return new String[] {"code"};
15089        case -791418107: /*patient*/ return new String[] {"Reference"};
15090        case -332066046: /*billablePeriod*/ return new String[] {"Period"};
15091        case 1028554472: /*created*/ return new String[] {"dateTime"};
15092        case -1591951995: /*enterer*/ return new String[] {"Reference"};
15093        case 1957615864: /*insurer*/ return new String[] {"Reference"};
15094        case -987494927: /*provider*/ return new String[] {"Reference"};
15095        case -1165461084: /*priority*/ return new String[] {"CodeableConcept"};
15096        case -1688904576: /*fundsReserveRequested*/ return new String[] {"CodeableConcept"};
15097        case 1314609806: /*fundsReserve*/ return new String[] {"CodeableConcept"};
15098        case 1090493483: /*related*/ return new String[] {};
15099        case 460301338: /*prescription*/ return new String[] {"Reference"};
15100        case -1814015861: /*originalPrescription*/ return new String[] {"Reference"};
15101        case 106443592: /*payee*/ return new String[] {};
15102        case -722568291: /*referral*/ return new String[] {"Reference"};
15103        case 501116579: /*facility*/ return new String[] {"Reference"};
15104        case 94742588: /*claim*/ return new String[] {"Reference"};
15105        case 689513629: /*claimResponse*/ return new String[] {"Reference"};
15106        case -1106507950: /*outcome*/ return new String[] {"code"};
15107        case 583380919: /*disposition*/ return new String[] {"string"};
15108        case 522246568: /*preAuthRef*/ return new String[] {"string"};
15109        case -1262920311: /*preAuthRefPeriod*/ return new String[] {"Period"};
15110        case -7323378: /*careTeam*/ return new String[] {};
15111        case 1922406657: /*supportingInfo*/ return new String[] {};
15112        case 1196993265: /*diagnosis*/ return new String[] {};
15113        case -1095204141: /*procedure*/ return new String[] {};
15114        case 159695370: /*precedence*/ return new String[] {"positiveInt"};
15115        case 73049818: /*insurance*/ return new String[] {};
15116        case -2143202801: /*accident*/ return new String[] {};
15117        case 3242771: /*item*/ return new String[] {};
15118        case -1148899500: /*addItem*/ return new String[] {};
15119        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
15120        case 110549828: /*total*/ return new String[] {};
15121        case -786681338: /*payment*/ return new String[] {};
15122        case 473181393: /*formCode*/ return new String[] {"CodeableConcept"};
15123        case 3148996: /*form*/ return new String[] {"Attachment"};
15124        case 202339073: /*processNote*/ return new String[] {};
15125        case -407369416: /*benefitPeriod*/ return new String[] {"Period"};
15126        case 596003397: /*benefitBalance*/ return new String[] {};
15127        default: return super.getTypesForProperty(hash, name);
15128        }
15129
15130      }
15131
15132      @Override
15133      public Base addChild(String name) throws FHIRException {
15134        if (name.equals("identifier")) {
15135          return addIdentifier();
15136        }
15137        else if (name.equals("status")) {
15138          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.status");
15139        }
15140        else if (name.equals("type")) {
15141          this.type = new CodeableConcept();
15142          return this.type;
15143        }
15144        else if (name.equals("subType")) {
15145          this.subType = new CodeableConcept();
15146          return this.subType;
15147        }
15148        else if (name.equals("use")) {
15149          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.use");
15150        }
15151        else if (name.equals("patient")) {
15152          this.patient = new Reference();
15153          return this.patient;
15154        }
15155        else if (name.equals("billablePeriod")) {
15156          this.billablePeriod = new Period();
15157          return this.billablePeriod;
15158        }
15159        else if (name.equals("created")) {
15160          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.created");
15161        }
15162        else if (name.equals("enterer")) {
15163          this.enterer = new Reference();
15164          return this.enterer;
15165        }
15166        else if (name.equals("insurer")) {
15167          this.insurer = new Reference();
15168          return this.insurer;
15169        }
15170        else if (name.equals("provider")) {
15171          this.provider = new Reference();
15172          return this.provider;
15173        }
15174        else if (name.equals("priority")) {
15175          this.priority = new CodeableConcept();
15176          return this.priority;
15177        }
15178        else if (name.equals("fundsReserveRequested")) {
15179          this.fundsReserveRequested = new CodeableConcept();
15180          return this.fundsReserveRequested;
15181        }
15182        else if (name.equals("fundsReserve")) {
15183          this.fundsReserve = new CodeableConcept();
15184          return this.fundsReserve;
15185        }
15186        else if (name.equals("related")) {
15187          return addRelated();
15188        }
15189        else if (name.equals("prescription")) {
15190          this.prescription = new Reference();
15191          return this.prescription;
15192        }
15193        else if (name.equals("originalPrescription")) {
15194          this.originalPrescription = new Reference();
15195          return this.originalPrescription;
15196        }
15197        else if (name.equals("payee")) {
15198          this.payee = new PayeeComponent();
15199          return this.payee;
15200        }
15201        else if (name.equals("referral")) {
15202          this.referral = new Reference();
15203          return this.referral;
15204        }
15205        else if (name.equals("facility")) {
15206          this.facility = new Reference();
15207          return this.facility;
15208        }
15209        else if (name.equals("claim")) {
15210          this.claim = new Reference();
15211          return this.claim;
15212        }
15213        else if (name.equals("claimResponse")) {
15214          this.claimResponse = new Reference();
15215          return this.claimResponse;
15216        }
15217        else if (name.equals("outcome")) {
15218          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.outcome");
15219        }
15220        else if (name.equals("disposition")) {
15221          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.disposition");
15222        }
15223        else if (name.equals("preAuthRef")) {
15224          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
15225        }
15226        else if (name.equals("preAuthRefPeriod")) {
15227          return addPreAuthRefPeriod();
15228        }
15229        else if (name.equals("careTeam")) {
15230          return addCareTeam();
15231        }
15232        else if (name.equals("supportingInfo")) {
15233          return addSupportingInfo();
15234        }
15235        else if (name.equals("diagnosis")) {
15236          return addDiagnosis();
15237        }
15238        else if (name.equals("procedure")) {
15239          return addProcedure();
15240        }
15241        else if (name.equals("precedence")) {
15242          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.precedence");
15243        }
15244        else if (name.equals("insurance")) {
15245          return addInsurance();
15246        }
15247        else if (name.equals("accident")) {
15248          this.accident = new AccidentComponent();
15249          return this.accident;
15250        }
15251        else if (name.equals("item")) {
15252          return addItem();
15253        }
15254        else if (name.equals("addItem")) {
15255          return addAddItem();
15256        }
15257        else if (name.equals("adjudication")) {
15258          return addAdjudication();
15259        }
15260        else if (name.equals("total")) {
15261          return addTotal();
15262        }
15263        else if (name.equals("payment")) {
15264          this.payment = new PaymentComponent();
15265          return this.payment;
15266        }
15267        else if (name.equals("formCode")) {
15268          this.formCode = new CodeableConcept();
15269          return this.formCode;
15270        }
15271        else if (name.equals("form")) {
15272          this.form = new Attachment();
15273          return this.form;
15274        }
15275        else if (name.equals("processNote")) {
15276          return addProcessNote();
15277        }
15278        else if (name.equals("benefitPeriod")) {
15279          this.benefitPeriod = new Period();
15280          return this.benefitPeriod;
15281        }
15282        else if (name.equals("benefitBalance")) {
15283          return addBenefitBalance();
15284        }
15285        else
15286          return super.addChild(name);
15287      }
15288
15289  public String fhirType() {
15290    return "ExplanationOfBenefit";
15291
15292  }
15293
15294      public ExplanationOfBenefit copy() {
15295        ExplanationOfBenefit dst = new ExplanationOfBenefit();
15296        copyValues(dst);
15297        return dst;
15298      }
15299
15300      public void copyValues(ExplanationOfBenefit dst) {
15301        super.copyValues(dst);
15302        if (identifier != null) {
15303          dst.identifier = new ArrayList<Identifier>();
15304          for (Identifier i : identifier)
15305            dst.identifier.add(i.copy());
15306        };
15307        dst.status = status == null ? null : status.copy();
15308        dst.type = type == null ? null : type.copy();
15309        dst.subType = subType == null ? null : subType.copy();
15310        dst.use = use == null ? null : use.copy();
15311        dst.patient = patient == null ? null : patient.copy();
15312        dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
15313        dst.created = created == null ? null : created.copy();
15314        dst.enterer = enterer == null ? null : enterer.copy();
15315        dst.insurer = insurer == null ? null : insurer.copy();
15316        dst.provider = provider == null ? null : provider.copy();
15317        dst.priority = priority == null ? null : priority.copy();
15318        dst.fundsReserveRequested = fundsReserveRequested == null ? null : fundsReserveRequested.copy();
15319        dst.fundsReserve = fundsReserve == null ? null : fundsReserve.copy();
15320        if (related != null) {
15321          dst.related = new ArrayList<RelatedClaimComponent>();
15322          for (RelatedClaimComponent i : related)
15323            dst.related.add(i.copy());
15324        };
15325        dst.prescription = prescription == null ? null : prescription.copy();
15326        dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
15327        dst.payee = payee == null ? null : payee.copy();
15328        dst.referral = referral == null ? null : referral.copy();
15329        dst.facility = facility == null ? null : facility.copy();
15330        dst.claim = claim == null ? null : claim.copy();
15331        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
15332        dst.outcome = outcome == null ? null : outcome.copy();
15333        dst.disposition = disposition == null ? null : disposition.copy();
15334        if (preAuthRef != null) {
15335          dst.preAuthRef = new ArrayList<StringType>();
15336          for (StringType i : preAuthRef)
15337            dst.preAuthRef.add(i.copy());
15338        };
15339        if (preAuthRefPeriod != null) {
15340          dst.preAuthRefPeriod = new ArrayList<Period>();
15341          for (Period i : preAuthRefPeriod)
15342            dst.preAuthRefPeriod.add(i.copy());
15343        };
15344        if (careTeam != null) {
15345          dst.careTeam = new ArrayList<CareTeamComponent>();
15346          for (CareTeamComponent i : careTeam)
15347            dst.careTeam.add(i.copy());
15348        };
15349        if (supportingInfo != null) {
15350          dst.supportingInfo = new ArrayList<SupportingInformationComponent>();
15351          for (SupportingInformationComponent i : supportingInfo)
15352            dst.supportingInfo.add(i.copy());
15353        };
15354        if (diagnosis != null) {
15355          dst.diagnosis = new ArrayList<DiagnosisComponent>();
15356          for (DiagnosisComponent i : diagnosis)
15357            dst.diagnosis.add(i.copy());
15358        };
15359        if (procedure != null) {
15360          dst.procedure = new ArrayList<ProcedureComponent>();
15361          for (ProcedureComponent i : procedure)
15362            dst.procedure.add(i.copy());
15363        };
15364        dst.precedence = precedence == null ? null : precedence.copy();
15365        if (insurance != null) {
15366          dst.insurance = new ArrayList<InsuranceComponent>();
15367          for (InsuranceComponent i : insurance)
15368            dst.insurance.add(i.copy());
15369        };
15370        dst.accident = accident == null ? null : accident.copy();
15371        if (item != null) {
15372          dst.item = new ArrayList<ItemComponent>();
15373          for (ItemComponent i : item)
15374            dst.item.add(i.copy());
15375        };
15376        if (addItem != null) {
15377          dst.addItem = new ArrayList<AddedItemComponent>();
15378          for (AddedItemComponent i : addItem)
15379            dst.addItem.add(i.copy());
15380        };
15381        if (adjudication != null) {
15382          dst.adjudication = new ArrayList<AdjudicationComponent>();
15383          for (AdjudicationComponent i : adjudication)
15384            dst.adjudication.add(i.copy());
15385        };
15386        if (total != null) {
15387          dst.total = new ArrayList<TotalComponent>();
15388          for (TotalComponent i : total)
15389            dst.total.add(i.copy());
15390        };
15391        dst.payment = payment == null ? null : payment.copy();
15392        dst.formCode = formCode == null ? null : formCode.copy();
15393        dst.form = form == null ? null : form.copy();
15394        if (processNote != null) {
15395          dst.processNote = new ArrayList<NoteComponent>();
15396          for (NoteComponent i : processNote)
15397            dst.processNote.add(i.copy());
15398        };
15399        dst.benefitPeriod = benefitPeriod == null ? null : benefitPeriod.copy();
15400        if (benefitBalance != null) {
15401          dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
15402          for (BenefitBalanceComponent i : benefitBalance)
15403            dst.benefitBalance.add(i.copy());
15404        };
15405      }
15406
15407      protected ExplanationOfBenefit typedCopy() {
15408        return copy();
15409      }
15410
15411      @Override
15412      public boolean equalsDeep(Base other_) {
15413        if (!super.equalsDeep(other_))
15414          return false;
15415        if (!(other_ instanceof ExplanationOfBenefit))
15416          return false;
15417        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
15418        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
15419           && compareDeep(subType, o.subType, true) && compareDeep(use, o.use, true) && compareDeep(patient, o.patient, true)
15420           && compareDeep(billablePeriod, o.billablePeriod, true) && compareDeep(created, o.created, true)
15421           && compareDeep(enterer, o.enterer, true) && compareDeep(insurer, o.insurer, true) && compareDeep(provider, o.provider, true)
15422           && compareDeep(priority, o.priority, true) && compareDeep(fundsReserveRequested, o.fundsReserveRequested, true)
15423           && compareDeep(fundsReserve, o.fundsReserve, true) && compareDeep(related, o.related, true) && compareDeep(prescription, o.prescription, true)
15424           && compareDeep(originalPrescription, o.originalPrescription, true) && compareDeep(payee, o.payee, true)
15425           && compareDeep(referral, o.referral, true) && compareDeep(facility, o.facility, true) && compareDeep(claim, o.claim, true)
15426           && compareDeep(claimResponse, o.claimResponse, true) && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true)
15427           && compareDeep(preAuthRef, o.preAuthRef, true) && compareDeep(preAuthRefPeriod, o.preAuthRefPeriod, true)
15428           && compareDeep(careTeam, o.careTeam, true) && compareDeep(supportingInfo, o.supportingInfo, true)
15429           && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true) && compareDeep(precedence, o.precedence, true)
15430           && compareDeep(insurance, o.insurance, true) && compareDeep(accident, o.accident, true) && compareDeep(item, o.item, true)
15431           && compareDeep(addItem, o.addItem, true) && compareDeep(adjudication, o.adjudication, true) && compareDeep(total, o.total, true)
15432           && compareDeep(payment, o.payment, true) && compareDeep(formCode, o.formCode, true) && compareDeep(form, o.form, true)
15433           && compareDeep(processNote, o.processNote, true) && compareDeep(benefitPeriod, o.benefitPeriod, true)
15434           && compareDeep(benefitBalance, o.benefitBalance, true);
15435      }
15436
15437      @Override
15438      public boolean equalsShallow(Base other_) {
15439        if (!super.equalsShallow(other_))
15440          return false;
15441        if (!(other_ instanceof ExplanationOfBenefit))
15442          return false;
15443        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
15444        return compareValues(status, o.status, true) && compareValues(use, o.use, true) && compareValues(created, o.created, true)
15445           && compareValues(outcome, o.outcome, true) && compareValues(disposition, o.disposition, true) && compareValues(preAuthRef, o.preAuthRef, true)
15446           && compareValues(precedence, o.precedence, true);
15447      }
15448
15449      public boolean isEmpty() {
15450        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
15451          , subType, use, patient, billablePeriod, created, enterer, insurer, provider
15452          , priority, fundsReserveRequested, fundsReserve, related, prescription, originalPrescription
15453          , payee, referral, facility, claim, claimResponse, outcome, disposition, preAuthRef
15454          , preAuthRefPeriod, careTeam, supportingInfo, diagnosis, procedure, precedence, insurance
15455          , accident, item, addItem, adjudication, total, payment, formCode, form, processNote
15456          , benefitPeriod, benefitBalance);
15457      }
15458
15459  @Override
15460  public ResourceType getResourceType() {
15461    return ResourceType.ExplanationOfBenefit;
15462   }
15463
15464 /**
15465   * Search parameter: <b>coverage</b>
15466   * <p>
15467   * Description: <b>The plan under which the claim was adjudicated</b><br>
15468   * Type: <b>reference</b><br>
15469   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
15470   * </p>
15471   */
15472  @SearchParamDefinition(name="coverage", path="ExplanationOfBenefit.insurance.coverage", description="The plan under which the claim was adjudicated", type="reference", target={Coverage.class } )
15473  public static final String SP_COVERAGE = "coverage";
15474 /**
15475   * <b>Fluent Client</b> search parameter constant for <b>coverage</b>
15476   * <p>
15477   * Description: <b>The plan under which the claim was adjudicated</b><br>
15478   * Type: <b>reference</b><br>
15479   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
15480   * </p>
15481   */
15482  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COVERAGE);
15483
15484/**
15485   * Constant for fluent queries to be used to add include statements. Specifies
15486   * the path value of "<b>ExplanationOfBenefit:coverage</b>".
15487   */
15488  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:coverage").toLocked();
15489
15490 /**
15491   * Search parameter: <b>care-team</b>
15492   * <p>
15493   * Description: <b>Member of the CareTeam</b><br>
15494   * Type: <b>reference</b><br>
15495   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
15496   * </p>
15497   */
15498  @SearchParamDefinition(name="care-team", path="ExplanationOfBenefit.careTeam.provider", description="Member of the CareTeam", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Organization.class, Practitioner.class, PractitionerRole.class } )
15499  public static final String SP_CARE_TEAM = "care-team";
15500 /**
15501   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
15502   * <p>
15503   * Description: <b>Member of the CareTeam</b><br>
15504   * Type: <b>reference</b><br>
15505   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
15506   * </p>
15507   */
15508  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CARE_TEAM);
15509
15510/**
15511   * Constant for fluent queries to be used to add include statements. Specifies
15512   * the path value of "<b>ExplanationOfBenefit:care-team</b>".
15513   */
15514  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:care-team").toLocked();
15515
15516 /**
15517   * Search parameter: <b>identifier</b>
15518   * <p>
15519   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
15520   * Type: <b>token</b><br>
15521   * Path: <b>ExplanationOfBenefit.identifier</b><br>
15522   * </p>
15523   */
15524  @SearchParamDefinition(name="identifier", path="ExplanationOfBenefit.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
15525  public static final String SP_IDENTIFIER = "identifier";
15526 /**
15527   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
15528   * <p>
15529   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
15530   * Type: <b>token</b><br>
15531   * Path: <b>ExplanationOfBenefit.identifier</b><br>
15532   * </p>
15533   */
15534  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
15535
15536 /**
15537   * Search parameter: <b>created</b>
15538   * <p>
15539   * Description: <b>The creation date for the EOB</b><br>
15540   * Type: <b>date</b><br>
15541   * Path: <b>ExplanationOfBenefit.created</b><br>
15542   * </p>
15543   */
15544  @SearchParamDefinition(name="created", path="ExplanationOfBenefit.created", description="The creation date for the EOB", type="date" )
15545  public static final String SP_CREATED = "created";
15546 /**
15547   * <b>Fluent Client</b> search parameter constant for <b>created</b>
15548   * <p>
15549   * Description: <b>The creation date for the EOB</b><br>
15550   * Type: <b>date</b><br>
15551   * Path: <b>ExplanationOfBenefit.created</b><br>
15552   * </p>
15553   */
15554  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
15555
15556 /**
15557   * Search parameter: <b>encounter</b>
15558   * <p>
15559   * Description: <b>Encounters associated with a billed line item</b><br>
15560   * Type: <b>reference</b><br>
15561   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
15562   * </p>
15563   */
15564  @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="Encounter") }, target={Encounter.class } )
15565  public static final String SP_ENCOUNTER = "encounter";
15566 /**
15567   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
15568   * <p>
15569   * Description: <b>Encounters associated with a billed line item</b><br>
15570   * Type: <b>reference</b><br>
15571   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
15572   * </p>
15573   */
15574  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
15575
15576/**
15577   * Constant for fluent queries to be used to add include statements. Specifies
15578   * the path value of "<b>ExplanationOfBenefit:encounter</b>".
15579   */
15580  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:encounter").toLocked();
15581
15582 /**
15583   * Search parameter: <b>payee</b>
15584   * <p>
15585   * Description: <b>The party receiving any payment for the Claim</b><br>
15586   * Type: <b>reference</b><br>
15587   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
15588   * </p>
15589   */
15590  @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="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
15591  public static final String SP_PAYEE = "payee";
15592 /**
15593   * <b>Fluent Client</b> search parameter constant for <b>payee</b>
15594   * <p>
15595   * Description: <b>The party receiving any payment for the Claim</b><br>
15596   * Type: <b>reference</b><br>
15597   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
15598   * </p>
15599   */
15600  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PAYEE);
15601
15602/**
15603   * Constant for fluent queries to be used to add include statements. Specifies
15604   * the path value of "<b>ExplanationOfBenefit:payee</b>".
15605   */
15606  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYEE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:payee").toLocked();
15607
15608 /**
15609   * Search parameter: <b>disposition</b>
15610   * <p>
15611   * Description: <b>The contents of the disposition message</b><br>
15612   * Type: <b>string</b><br>
15613   * Path: <b>ExplanationOfBenefit.disposition</b><br>
15614   * </p>
15615   */
15616  @SearchParamDefinition(name="disposition", path="ExplanationOfBenefit.disposition", description="The contents of the disposition message", type="string" )
15617  public static final String SP_DISPOSITION = "disposition";
15618 /**
15619   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
15620   * <p>
15621   * Description: <b>The contents of the disposition message</b><br>
15622   * Type: <b>string</b><br>
15623   * Path: <b>ExplanationOfBenefit.disposition</b><br>
15624   * </p>
15625   */
15626  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
15627
15628 /**
15629   * Search parameter: <b>provider</b>
15630   * <p>
15631   * Description: <b>The reference to the provider</b><br>
15632   * Type: <b>reference</b><br>
15633   * Path: <b>ExplanationOfBenefit.provider</b><br>
15634   * </p>
15635   */
15636  @SearchParamDefinition(name="provider", path="ExplanationOfBenefit.provider", description="The reference to the provider", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Organization.class, Practitioner.class, PractitionerRole.class } )
15637  public static final String SP_PROVIDER = "provider";
15638 /**
15639   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
15640   * <p>
15641   * Description: <b>The reference to the provider</b><br>
15642   * Type: <b>reference</b><br>
15643   * Path: <b>ExplanationOfBenefit.provider</b><br>
15644   * </p>
15645   */
15646  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
15647
15648/**
15649   * Constant for fluent queries to be used to add include statements. Specifies
15650   * the path value of "<b>ExplanationOfBenefit:provider</b>".
15651   */
15652  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:provider").toLocked();
15653
15654 /**
15655   * Search parameter: <b>patient</b>
15656   * <p>
15657   * Description: <b>The reference to the patient</b><br>
15658   * Type: <b>reference</b><br>
15659   * Path: <b>ExplanationOfBenefit.patient</b><br>
15660   * </p>
15661   */
15662  @SearchParamDefinition(name="patient", path="ExplanationOfBenefit.patient", description="The reference to the patient", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
15663  public static final String SP_PATIENT = "patient";
15664 /**
15665   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
15666   * <p>
15667   * Description: <b>The reference to the patient</b><br>
15668   * Type: <b>reference</b><br>
15669   * Path: <b>ExplanationOfBenefit.patient</b><br>
15670   * </p>
15671   */
15672  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
15673
15674/**
15675   * Constant for fluent queries to be used to add include statements. Specifies
15676   * the path value of "<b>ExplanationOfBenefit:patient</b>".
15677   */
15678  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:patient").toLocked();
15679
15680 /**
15681   * Search parameter: <b>detail-udi</b>
15682   * <p>
15683   * Description: <b>UDI associated with a line item detail product or service</b><br>
15684   * Type: <b>reference</b><br>
15685   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
15686   * </p>
15687   */
15688  @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="Device") }, target={Device.class } )
15689  public static final String SP_DETAIL_UDI = "detail-udi";
15690 /**
15691   * <b>Fluent Client</b> search parameter constant for <b>detail-udi</b>
15692   * <p>
15693   * Description: <b>UDI associated with a line item detail product or service</b><br>
15694   * Type: <b>reference</b><br>
15695   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
15696   * </p>
15697   */
15698  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DETAIL_UDI);
15699
15700/**
15701   * Constant for fluent queries to be used to add include statements. Specifies
15702   * the path value of "<b>ExplanationOfBenefit:detail-udi</b>".
15703   */
15704  public static final ca.uhn.fhir.model.api.Include INCLUDE_DETAIL_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:detail-udi").toLocked();
15705
15706 /**
15707   * Search parameter: <b>claim</b>
15708   * <p>
15709   * Description: <b>The reference to the claim</b><br>
15710   * Type: <b>reference</b><br>
15711   * Path: <b>ExplanationOfBenefit.claim</b><br>
15712   * </p>
15713   */
15714  @SearchParamDefinition(name="claim", path="ExplanationOfBenefit.claim", description="The reference to the claim", type="reference", target={Claim.class } )
15715  public static final String SP_CLAIM = "claim";
15716 /**
15717   * <b>Fluent Client</b> search parameter constant for <b>claim</b>
15718   * <p>
15719   * Description: <b>The reference to the claim</b><br>
15720   * Type: <b>reference</b><br>
15721   * Path: <b>ExplanationOfBenefit.claim</b><br>
15722   * </p>
15723   */
15724  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CLAIM);
15725
15726/**
15727   * Constant for fluent queries to be used to add include statements. Specifies
15728   * the path value of "<b>ExplanationOfBenefit:claim</b>".
15729   */
15730  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:claim").toLocked();
15731
15732 /**
15733   * Search parameter: <b>enterer</b>
15734   * <p>
15735   * Description: <b>The party responsible for the entry of the Claim</b><br>
15736   * Type: <b>reference</b><br>
15737   * Path: <b>ExplanationOfBenefit.enterer</b><br>
15738   * </p>
15739   */
15740  @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="Practitioner") }, target={Practitioner.class, PractitionerRole.class } )
15741  public static final String SP_ENTERER = "enterer";
15742 /**
15743   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
15744   * <p>
15745   * Description: <b>The party responsible for the entry of the Claim</b><br>
15746   * Type: <b>reference</b><br>
15747   * Path: <b>ExplanationOfBenefit.enterer</b><br>
15748   * </p>
15749   */
15750  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTERER);
15751
15752/**
15753   * Constant for fluent queries to be used to add include statements. Specifies
15754   * the path value of "<b>ExplanationOfBenefit:enterer</b>".
15755   */
15756  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:enterer").toLocked();
15757
15758 /**
15759   * Search parameter: <b>procedure-udi</b>
15760   * <p>
15761   * Description: <b>UDI associated with a procedure</b><br>
15762   * Type: <b>reference</b><br>
15763   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
15764   * </p>
15765   */
15766  @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="Device") }, target={Device.class } )
15767  public static final String SP_PROCEDURE_UDI = "procedure-udi";
15768 /**
15769   * <b>Fluent Client</b> search parameter constant for <b>procedure-udi</b>
15770   * <p>
15771   * Description: <b>UDI associated with a procedure</b><br>
15772   * Type: <b>reference</b><br>
15773   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
15774   * </p>
15775   */
15776  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROCEDURE_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROCEDURE_UDI);
15777
15778/**
15779   * Constant for fluent queries to be used to add include statements. Specifies
15780   * the path value of "<b>ExplanationOfBenefit:procedure-udi</b>".
15781   */
15782  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROCEDURE_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:procedure-udi").toLocked();
15783
15784 /**
15785   * Search parameter: <b>subdetail-udi</b>
15786   * <p>
15787   * Description: <b>UDI associated with a line item detail subdetail product or service</b><br>
15788   * Type: <b>reference</b><br>
15789   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
15790   * </p>
15791   */
15792  @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="Device") }, target={Device.class } )
15793  public static final String SP_SUBDETAIL_UDI = "subdetail-udi";
15794 /**
15795   * <b>Fluent Client</b> search parameter constant for <b>subdetail-udi</b>
15796   * <p>
15797   * Description: <b>UDI associated with a line item detail subdetail product or service</b><br>
15798   * Type: <b>reference</b><br>
15799   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
15800   * </p>
15801   */
15802  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBDETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBDETAIL_UDI);
15803
15804/**
15805   * Constant for fluent queries to be used to add include statements. Specifies
15806   * the path value of "<b>ExplanationOfBenefit:subdetail-udi</b>".
15807   */
15808  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBDETAIL_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:subdetail-udi").toLocked();
15809
15810 /**
15811   * Search parameter: <b>facility</b>
15812   * <p>
15813   * Description: <b>Facility responsible for the goods and services</b><br>
15814   * Type: <b>reference</b><br>
15815   * Path: <b>ExplanationOfBenefit.facility</b><br>
15816   * </p>
15817   */
15818  @SearchParamDefinition(name="facility", path="ExplanationOfBenefit.facility", description="Facility responsible for the goods and services", type="reference", target={Location.class } )
15819  public static final String SP_FACILITY = "facility";
15820 /**
15821   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
15822   * <p>
15823   * Description: <b>Facility responsible for the goods and services</b><br>
15824   * Type: <b>reference</b><br>
15825   * Path: <b>ExplanationOfBenefit.facility</b><br>
15826   * </p>
15827   */
15828  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITY);
15829
15830/**
15831   * Constant for fluent queries to be used to add include statements. Specifies
15832   * the path value of "<b>ExplanationOfBenefit:facility</b>".
15833   */
15834  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:facility").toLocked();
15835
15836 /**
15837   * Search parameter: <b>item-udi</b>
15838   * <p>
15839   * Description: <b>UDI associated with a line item product or service</b><br>
15840   * Type: <b>reference</b><br>
15841   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
15842   * </p>
15843   */
15844  @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="Device") }, target={Device.class } )
15845  public static final String SP_ITEM_UDI = "item-udi";
15846 /**
15847   * <b>Fluent Client</b> search parameter constant for <b>item-udi</b>
15848   * <p>
15849   * Description: <b>UDI associated with a line item product or service</b><br>
15850   * Type: <b>reference</b><br>
15851   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
15852   * </p>
15853   */
15854  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ITEM_UDI);
15855
15856/**
15857   * Constant for fluent queries to be used to add include statements. Specifies
15858   * the path value of "<b>ExplanationOfBenefit:item-udi</b>".
15859   */
15860  public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:item-udi").toLocked();
15861
15862 /**
15863   * Search parameter: <b>status</b>
15864   * <p>
15865   * Description: <b>Status of the instance</b><br>
15866   * Type: <b>token</b><br>
15867   * Path: <b>ExplanationOfBenefit.status</b><br>
15868   * </p>
15869   */
15870  @SearchParamDefinition(name="status", path="ExplanationOfBenefit.status", description="Status of the instance", type="token" )
15871  public static final String SP_STATUS = "status";
15872 /**
15873   * <b>Fluent Client</b> search parameter constant for <b>status</b>
15874   * <p>
15875   * Description: <b>Status of the instance</b><br>
15876   * Type: <b>token</b><br>
15877   * Path: <b>ExplanationOfBenefit.status</b><br>
15878   * </p>
15879   */
15880  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
15881
15882
15883}