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            default: return "?";
100          }
101        }
102        public String getSystem() {
103          switch (this) {
104            case ACTIVE: return "http://hl7.org/fhir/explanationofbenefit-status";
105            case CANCELLED: return "http://hl7.org/fhir/explanationofbenefit-status";
106            case DRAFT: return "http://hl7.org/fhir/explanationofbenefit-status";
107            case ENTEREDINERROR: return "http://hl7.org/fhir/explanationofbenefit-status";
108            default: return "?";
109          }
110        }
111        public String getDefinition() {
112          switch (this) {
113            case ACTIVE: return "The resource instance is currently in-force.";
114            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
115            case DRAFT: return "A new resource instance the contents of which is not complete.";
116            case ENTEREDINERROR: return "The resource instance was entered in error.";
117            default: return "?";
118          }
119        }
120        public String getDisplay() {
121          switch (this) {
122            case ACTIVE: return "Active";
123            case CANCELLED: return "Cancelled";
124            case DRAFT: return "Draft";
125            case ENTEREDINERROR: return "Entered In Error";
126            default: return "?";
127          }
128        }
129    }
130
131  public static class ExplanationOfBenefitStatusEnumFactory implements EnumFactory<ExplanationOfBenefitStatus> {
132    public ExplanationOfBenefitStatus fromCode(String codeString) throws IllegalArgumentException {
133      if (codeString == null || "".equals(codeString))
134            if (codeString == null || "".equals(codeString))
135                return null;
136        if ("active".equals(codeString))
137          return ExplanationOfBenefitStatus.ACTIVE;
138        if ("cancelled".equals(codeString))
139          return ExplanationOfBenefitStatus.CANCELLED;
140        if ("draft".equals(codeString))
141          return ExplanationOfBenefitStatus.DRAFT;
142        if ("entered-in-error".equals(codeString))
143          return ExplanationOfBenefitStatus.ENTEREDINERROR;
144        throw new IllegalArgumentException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
145        }
146        public Enumeration<ExplanationOfBenefitStatus> fromType(Base code) throws FHIRException {
147          if (code == null)
148            return null;
149          if (code.isEmpty())
150            return new Enumeration<ExplanationOfBenefitStatus>(this);
151          String codeString = ((PrimitiveType) code).asStringValue();
152          if (codeString == null || "".equals(codeString))
153            return null;
154        if ("active".equals(codeString))
155          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ACTIVE);
156        if ("cancelled".equals(codeString))
157          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.CANCELLED);
158        if ("draft".equals(codeString))
159          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.DRAFT);
160        if ("entered-in-error".equals(codeString))
161          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ENTEREDINERROR);
162        throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
163        }
164    public String toCode(ExplanationOfBenefitStatus code) {
165      if (code == ExplanationOfBenefitStatus.ACTIVE)
166        return "active";
167      if (code == ExplanationOfBenefitStatus.CANCELLED)
168        return "cancelled";
169      if (code == ExplanationOfBenefitStatus.DRAFT)
170        return "draft";
171      if (code == ExplanationOfBenefitStatus.ENTEREDINERROR)
172        return "entered-in-error";
173      return "?";
174      }
175    public String toSystem(ExplanationOfBenefitStatus code) {
176      return code.getSystem();
177      }
178    }
179
180    public enum Use {
181        /**
182         * The treatment is complete and this represents a Claim for the services.
183         */
184        CLAIM, 
185        /**
186         * The treatment is proposed and this represents a Pre-authorization for the services.
187         */
188        PREAUTHORIZATION, 
189        /**
190         * The treatment is proposed and this represents a Pre-determination for the services.
191         */
192        PREDETERMINATION, 
193        /**
194         * added to help the parsers with the generic types
195         */
196        NULL;
197        public static Use fromCode(String codeString) throws FHIRException {
198            if (codeString == null || "".equals(codeString))
199                return null;
200        if ("claim".equals(codeString))
201          return CLAIM;
202        if ("preauthorization".equals(codeString))
203          return PREAUTHORIZATION;
204        if ("predetermination".equals(codeString))
205          return PREDETERMINATION;
206        if (Configuration.isAcceptInvalidEnums())
207          return null;
208        else
209          throw new FHIRException("Unknown Use code '"+codeString+"'");
210        }
211        public String toCode() {
212          switch (this) {
213            case CLAIM: return "claim";
214            case PREAUTHORIZATION: return "preauthorization";
215            case PREDETERMINATION: return "predetermination";
216            default: return "?";
217          }
218        }
219        public String getSystem() {
220          switch (this) {
221            case CLAIM: return "http://hl7.org/fhir/claim-use";
222            case PREAUTHORIZATION: return "http://hl7.org/fhir/claim-use";
223            case PREDETERMINATION: return "http://hl7.org/fhir/claim-use";
224            default: return "?";
225          }
226        }
227        public String getDefinition() {
228          switch (this) {
229            case CLAIM: return "The treatment is complete and this represents a Claim for the services.";
230            case PREAUTHORIZATION: return "The treatment is proposed and this represents a Pre-authorization for the services.";
231            case PREDETERMINATION: return "The treatment is proposed and this represents a Pre-determination for the services.";
232            default: return "?";
233          }
234        }
235        public String getDisplay() {
236          switch (this) {
237            case CLAIM: return "Claim";
238            case PREAUTHORIZATION: return "Preauthorization";
239            case PREDETERMINATION: return "Predetermination";
240            default: return "?";
241          }
242        }
243    }
244
245  public static class UseEnumFactory implements EnumFactory<Use> {
246    public Use fromCode(String codeString) throws IllegalArgumentException {
247      if (codeString == null || "".equals(codeString))
248            if (codeString == null || "".equals(codeString))
249                return null;
250        if ("claim".equals(codeString))
251          return Use.CLAIM;
252        if ("preauthorization".equals(codeString))
253          return Use.PREAUTHORIZATION;
254        if ("predetermination".equals(codeString))
255          return Use.PREDETERMINATION;
256        throw new IllegalArgumentException("Unknown Use code '"+codeString+"'");
257        }
258        public Enumeration<Use> fromType(Base code) throws FHIRException {
259          if (code == null)
260            return null;
261          if (code.isEmpty())
262            return new Enumeration<Use>(this);
263          String codeString = ((PrimitiveType) code).asStringValue();
264          if (codeString == null || "".equals(codeString))
265            return null;
266        if ("claim".equals(codeString))
267          return new Enumeration<Use>(this, Use.CLAIM);
268        if ("preauthorization".equals(codeString))
269          return new Enumeration<Use>(this, Use.PREAUTHORIZATION);
270        if ("predetermination".equals(codeString))
271          return new Enumeration<Use>(this, Use.PREDETERMINATION);
272        throw new FHIRException("Unknown Use code '"+codeString+"'");
273        }
274    public String toCode(Use code) {
275      if (code == Use.CLAIM)
276        return "claim";
277      if (code == Use.PREAUTHORIZATION)
278        return "preauthorization";
279      if (code == Use.PREDETERMINATION)
280        return "predetermination";
281      return "?";
282      }
283    public String toSystem(Use code) {
284      return code.getSystem();
285      }
286    }
287
288    public enum RemittanceOutcome {
289        /**
290         * The Claim/Pre-authorization/Pre-determination has been received but processing has not begun.
291         */
292        QUEUED, 
293        /**
294         * The processing has completed without errors
295         */
296        COMPLETE, 
297        /**
298         * One or more errors have been detected in the Claim
299         */
300        ERROR, 
301        /**
302         * No errors have been detected in the Claim and some of the adjudication has been performed.
303         */
304        PARTIAL, 
305        /**
306         * added to help the parsers with the generic types
307         */
308        NULL;
309        public static RemittanceOutcome fromCode(String codeString) throws FHIRException {
310            if (codeString == null || "".equals(codeString))
311                return null;
312        if ("queued".equals(codeString))
313          return QUEUED;
314        if ("complete".equals(codeString))
315          return COMPLETE;
316        if ("error".equals(codeString))
317          return ERROR;
318        if ("partial".equals(codeString))
319          return PARTIAL;
320        if (Configuration.isAcceptInvalidEnums())
321          return null;
322        else
323          throw new FHIRException("Unknown RemittanceOutcome code '"+codeString+"'");
324        }
325        public String toCode() {
326          switch (this) {
327            case QUEUED: return "queued";
328            case COMPLETE: return "complete";
329            case ERROR: return "error";
330            case PARTIAL: return "partial";
331            default: return "?";
332          }
333        }
334        public String getSystem() {
335          switch (this) {
336            case QUEUED: return "http://hl7.org/fhir/remittance-outcome";
337            case COMPLETE: return "http://hl7.org/fhir/remittance-outcome";
338            case ERROR: return "http://hl7.org/fhir/remittance-outcome";
339            case PARTIAL: return "http://hl7.org/fhir/remittance-outcome";
340            default: return "?";
341          }
342        }
343        public String getDefinition() {
344          switch (this) {
345            case QUEUED: return "The Claim/Pre-authorization/Pre-determination has been received but processing has not begun.";
346            case COMPLETE: return "The processing has completed without errors";
347            case ERROR: return "One or more errors have been detected in the Claim";
348            case PARTIAL: return "No errors have been detected in the Claim and some of the adjudication has been performed.";
349            default: return "?";
350          }
351        }
352        public String getDisplay() {
353          switch (this) {
354            case QUEUED: return "Queued";
355            case COMPLETE: return "Processing Complete";
356            case ERROR: return "Error";
357            case PARTIAL: return "Partial Processing";
358            default: return "?";
359          }
360        }
361    }
362
363  public static class RemittanceOutcomeEnumFactory implements EnumFactory<RemittanceOutcome> {
364    public RemittanceOutcome fromCode(String codeString) throws IllegalArgumentException {
365      if (codeString == null || "".equals(codeString))
366            if (codeString == null || "".equals(codeString))
367                return null;
368        if ("queued".equals(codeString))
369          return RemittanceOutcome.QUEUED;
370        if ("complete".equals(codeString))
371          return RemittanceOutcome.COMPLETE;
372        if ("error".equals(codeString))
373          return RemittanceOutcome.ERROR;
374        if ("partial".equals(codeString))
375          return RemittanceOutcome.PARTIAL;
376        throw new IllegalArgumentException("Unknown RemittanceOutcome code '"+codeString+"'");
377        }
378        public Enumeration<RemittanceOutcome> fromType(Base code) throws FHIRException {
379          if (code == null)
380            return null;
381          if (code.isEmpty())
382            return new Enumeration<RemittanceOutcome>(this);
383          String codeString = ((PrimitiveType) code).asStringValue();
384          if (codeString == null || "".equals(codeString))
385            return null;
386        if ("queued".equals(codeString))
387          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.QUEUED);
388        if ("complete".equals(codeString))
389          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.COMPLETE);
390        if ("error".equals(codeString))
391          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.ERROR);
392        if ("partial".equals(codeString))
393          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.PARTIAL);
394        throw new FHIRException("Unknown RemittanceOutcome code '"+codeString+"'");
395        }
396    public String toCode(RemittanceOutcome code) {
397      if (code == RemittanceOutcome.QUEUED)
398        return "queued";
399      if (code == RemittanceOutcome.COMPLETE)
400        return "complete";
401      if (code == RemittanceOutcome.ERROR)
402        return "error";
403      if (code == RemittanceOutcome.PARTIAL)
404        return "partial";
405      return "?";
406      }
407    public String toSystem(RemittanceOutcome code) {
408      return code.getSystem();
409      }
410    }
411
412    @Block()
413    public static class RelatedClaimComponent extends BackboneElement implements IBaseBackboneElement {
414        /**
415         * Reference to a related claim.
416         */
417        @Child(name = "claim", type = {Claim.class}, order=1, min=0, max=1, modifier=false, summary=false)
418        @Description(shortDefinition="Reference to the related claim", formalDefinition="Reference to a related claim." )
419        protected Reference claim;
420
421        /**
422         * The actual object that is the target of the reference (Reference to a related claim.)
423         */
424        protected Claim claimTarget;
425
426        /**
427         * A code to convey how the claims are related.
428         */
429        @Child(name = "relationship", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
430        @Description(shortDefinition="How the reference claim is related", formalDefinition="A code to convey how the claims are related." )
431        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-claim-relationship")
432        protected CodeableConcept relationship;
433
434        /**
435         * An alternate organizational reference to the case or file to which this particular claim pertains.
436         */
437        @Child(name = "reference", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=false)
438        @Description(shortDefinition="File or case reference", formalDefinition="An alternate organizational reference to the case or file to which this particular claim pertains." )
439        protected Identifier reference;
440
441        private static final long serialVersionUID = -379338905L;
442
443    /**
444     * Constructor
445     */
446      public RelatedClaimComponent() {
447        super();
448      }
449
450        /**
451         * @return {@link #claim} (Reference to a related claim.)
452         */
453        public Reference getClaim() { 
454          if (this.claim == null)
455            if (Configuration.errorOnAutoCreate())
456              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
457            else if (Configuration.doAutoCreate())
458              this.claim = new Reference(); // cc
459          return this.claim;
460        }
461
462        public boolean hasClaim() { 
463          return this.claim != null && !this.claim.isEmpty();
464        }
465
466        /**
467         * @param value {@link #claim} (Reference to a related claim.)
468         */
469        public RelatedClaimComponent setClaim(Reference value) { 
470          this.claim = value;
471          return this;
472        }
473
474        /**
475         * @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.)
476         */
477        public Claim getClaimTarget() { 
478          if (this.claimTarget == null)
479            if (Configuration.errorOnAutoCreate())
480              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
481            else if (Configuration.doAutoCreate())
482              this.claimTarget = new Claim(); // aa
483          return this.claimTarget;
484        }
485
486        /**
487         * @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.)
488         */
489        public RelatedClaimComponent setClaimTarget(Claim value) { 
490          this.claimTarget = value;
491          return this;
492        }
493
494        /**
495         * @return {@link #relationship} (A code to convey how the claims are related.)
496         */
497        public CodeableConcept getRelationship() { 
498          if (this.relationship == null)
499            if (Configuration.errorOnAutoCreate())
500              throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
501            else if (Configuration.doAutoCreate())
502              this.relationship = new CodeableConcept(); // cc
503          return this.relationship;
504        }
505
506        public boolean hasRelationship() { 
507          return this.relationship != null && !this.relationship.isEmpty();
508        }
509
510        /**
511         * @param value {@link #relationship} (A code to convey how the claims are related.)
512         */
513        public RelatedClaimComponent setRelationship(CodeableConcept value) { 
514          this.relationship = value;
515          return this;
516        }
517
518        /**
519         * @return {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
520         */
521        public Identifier getReference() { 
522          if (this.reference == null)
523            if (Configuration.errorOnAutoCreate())
524              throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
525            else if (Configuration.doAutoCreate())
526              this.reference = new Identifier(); // cc
527          return this.reference;
528        }
529
530        public boolean hasReference() { 
531          return this.reference != null && !this.reference.isEmpty();
532        }
533
534        /**
535         * @param value {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
536         */
537        public RelatedClaimComponent setReference(Identifier value) { 
538          this.reference = value;
539          return this;
540        }
541
542        protected void listChildren(List<Property> children) {
543          super.listChildren(children);
544          children.add(new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim));
545          children.add(new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship));
546          children.add(new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1, reference));
547        }
548
549        @Override
550        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
551          switch (_hash) {
552          case 94742588: /*claim*/  return new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim);
553          case -261851592: /*relationship*/  return new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship);
554          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);
555          default: return super.getNamedProperty(_hash, _name, _checkValid);
556          }
557
558        }
559
560      @Override
561      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
562        switch (hash) {
563        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
564        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
565        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Identifier
566        default: return super.getProperty(hash, name, checkValid);
567        }
568
569      }
570
571      @Override
572      public Base setProperty(int hash, String name, Base value) throws FHIRException {
573        switch (hash) {
574        case 94742588: // claim
575          this.claim = castToReference(value); // Reference
576          return value;
577        case -261851592: // relationship
578          this.relationship = castToCodeableConcept(value); // CodeableConcept
579          return value;
580        case -925155509: // reference
581          this.reference = castToIdentifier(value); // Identifier
582          return value;
583        default: return super.setProperty(hash, name, value);
584        }
585
586      }
587
588      @Override
589      public Base setProperty(String name, Base value) throws FHIRException {
590        if (name.equals("claim")) {
591          this.claim = castToReference(value); // Reference
592        } else if (name.equals("relationship")) {
593          this.relationship = castToCodeableConcept(value); // CodeableConcept
594        } else if (name.equals("reference")) {
595          this.reference = castToIdentifier(value); // Identifier
596        } else
597          return super.setProperty(name, value);
598        return value;
599      }
600
601      @Override
602      public Base makeProperty(int hash, String name) throws FHIRException {
603        switch (hash) {
604        case 94742588:  return getClaim(); 
605        case -261851592:  return getRelationship(); 
606        case -925155509:  return getReference(); 
607        default: return super.makeProperty(hash, name);
608        }
609
610      }
611
612      @Override
613      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
614        switch (hash) {
615        case 94742588: /*claim*/ return new String[] {"Reference"};
616        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
617        case -925155509: /*reference*/ return new String[] {"Identifier"};
618        default: return super.getTypesForProperty(hash, name);
619        }
620
621      }
622
623      @Override
624      public Base addChild(String name) throws FHIRException {
625        if (name.equals("claim")) {
626          this.claim = new Reference();
627          return this.claim;
628        }
629        else if (name.equals("relationship")) {
630          this.relationship = new CodeableConcept();
631          return this.relationship;
632        }
633        else if (name.equals("reference")) {
634          this.reference = new Identifier();
635          return this.reference;
636        }
637        else
638          return super.addChild(name);
639      }
640
641      public RelatedClaimComponent copy() {
642        RelatedClaimComponent dst = new RelatedClaimComponent();
643        copyValues(dst);
644        return dst;
645      }
646
647      public void copyValues(RelatedClaimComponent dst) {
648        super.copyValues(dst);
649        dst.claim = claim == null ? null : claim.copy();
650        dst.relationship = relationship == null ? null : relationship.copy();
651        dst.reference = reference == null ? null : reference.copy();
652      }
653
654      @Override
655      public boolean equalsDeep(Base other_) {
656        if (!super.equalsDeep(other_))
657          return false;
658        if (!(other_ instanceof RelatedClaimComponent))
659          return false;
660        RelatedClaimComponent o = (RelatedClaimComponent) other_;
661        return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true) && compareDeep(reference, o.reference, true)
662          ;
663      }
664
665      @Override
666      public boolean equalsShallow(Base other_) {
667        if (!super.equalsShallow(other_))
668          return false;
669        if (!(other_ instanceof RelatedClaimComponent))
670          return false;
671        RelatedClaimComponent o = (RelatedClaimComponent) other_;
672        return true;
673      }
674
675      public boolean isEmpty() {
676        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference
677          );
678      }
679
680  public String fhirType() {
681    return "ExplanationOfBenefit.related";
682
683  }
684
685  }
686
687    @Block()
688    public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
689        /**
690         * Type of Party to be reimbursed: Subscriber, provider, other.
691         */
692        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
693        @Description(shortDefinition="Category of recipient", formalDefinition="Type of Party to be reimbursed: Subscriber, provider, other." )
694        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payeetype")
695        protected CodeableConcept type;
696
697        /**
698         * Reference to the individual or organization to whom any payment will be made.
699         */
700        @Child(name = "party", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, RelatedPerson.class}, order=2, min=0, max=1, modifier=false, summary=false)
701        @Description(shortDefinition="Recipient reference", formalDefinition="Reference to the individual or organization to whom any payment will be made." )
702        protected Reference party;
703
704        /**
705         * The actual object that is the target of the reference (Reference to the individual or organization to whom any payment will be made.)
706         */
707        protected Resource partyTarget;
708
709        private static final long serialVersionUID = 1609484699L;
710
711    /**
712     * Constructor
713     */
714      public PayeeComponent() {
715        super();
716      }
717
718        /**
719         * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
720         */
721        public CodeableConcept getType() { 
722          if (this.type == null)
723            if (Configuration.errorOnAutoCreate())
724              throw new Error("Attempt to auto-create PayeeComponent.type");
725            else if (Configuration.doAutoCreate())
726              this.type = new CodeableConcept(); // cc
727          return this.type;
728        }
729
730        public boolean hasType() { 
731          return this.type != null && !this.type.isEmpty();
732        }
733
734        /**
735         * @param value {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
736         */
737        public PayeeComponent setType(CodeableConcept value) { 
738          this.type = value;
739          return this;
740        }
741
742        /**
743         * @return {@link #party} (Reference to the individual or organization to whom any payment will be made.)
744         */
745        public Reference getParty() { 
746          if (this.party == null)
747            if (Configuration.errorOnAutoCreate())
748              throw new Error("Attempt to auto-create PayeeComponent.party");
749            else if (Configuration.doAutoCreate())
750              this.party = new Reference(); // cc
751          return this.party;
752        }
753
754        public boolean hasParty() { 
755          return this.party != null && !this.party.isEmpty();
756        }
757
758        /**
759         * @param value {@link #party} (Reference to the individual or organization to whom any payment will be made.)
760         */
761        public PayeeComponent setParty(Reference value) { 
762          this.party = value;
763          return this;
764        }
765
766        /**
767         * @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.)
768         */
769        public Resource getPartyTarget() { 
770          return this.partyTarget;
771        }
772
773        /**
774         * @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.)
775         */
776        public PayeeComponent setPartyTarget(Resource value) { 
777          this.partyTarget = value;
778          return this;
779        }
780
781        protected void listChildren(List<Property> children) {
782          super.listChildren(children);
783          children.add(new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type));
784          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));
785        }
786
787        @Override
788        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
789          switch (_hash) {
790          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type);
791          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);
792          default: return super.getNamedProperty(_hash, _name, _checkValid);
793          }
794
795        }
796
797      @Override
798      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
799        switch (hash) {
800        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
801        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
802        default: return super.getProperty(hash, name, checkValid);
803        }
804
805      }
806
807      @Override
808      public Base setProperty(int hash, String name, Base value) throws FHIRException {
809        switch (hash) {
810        case 3575610: // type
811          this.type = castToCodeableConcept(value); // CodeableConcept
812          return value;
813        case 106437350: // party
814          this.party = castToReference(value); // Reference
815          return value;
816        default: return super.setProperty(hash, name, value);
817        }
818
819      }
820
821      @Override
822      public Base setProperty(String name, Base value) throws FHIRException {
823        if (name.equals("type")) {
824          this.type = castToCodeableConcept(value); // CodeableConcept
825        } else if (name.equals("party")) {
826          this.party = castToReference(value); // Reference
827        } else
828          return super.setProperty(name, value);
829        return value;
830      }
831
832      @Override
833      public Base makeProperty(int hash, String name) throws FHIRException {
834        switch (hash) {
835        case 3575610:  return getType(); 
836        case 106437350:  return getParty(); 
837        default: return super.makeProperty(hash, name);
838        }
839
840      }
841
842      @Override
843      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
844        switch (hash) {
845        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
846        case 106437350: /*party*/ return new String[] {"Reference"};
847        default: return super.getTypesForProperty(hash, name);
848        }
849
850      }
851
852      @Override
853      public Base addChild(String name) throws FHIRException {
854        if (name.equals("type")) {
855          this.type = new CodeableConcept();
856          return this.type;
857        }
858        else if (name.equals("party")) {
859          this.party = new Reference();
860          return this.party;
861        }
862        else
863          return super.addChild(name);
864      }
865
866      public PayeeComponent copy() {
867        PayeeComponent dst = new PayeeComponent();
868        copyValues(dst);
869        return dst;
870      }
871
872      public void copyValues(PayeeComponent dst) {
873        super.copyValues(dst);
874        dst.type = type == null ? null : type.copy();
875        dst.party = party == null ? null : party.copy();
876      }
877
878      @Override
879      public boolean equalsDeep(Base other_) {
880        if (!super.equalsDeep(other_))
881          return false;
882        if (!(other_ instanceof PayeeComponent))
883          return false;
884        PayeeComponent o = (PayeeComponent) other_;
885        return compareDeep(type, o.type, true) && compareDeep(party, o.party, true);
886      }
887
888      @Override
889      public boolean equalsShallow(Base other_) {
890        if (!super.equalsShallow(other_))
891          return false;
892        if (!(other_ instanceof PayeeComponent))
893          return false;
894        PayeeComponent o = (PayeeComponent) other_;
895        return true;
896      }
897
898      public boolean isEmpty() {
899        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party);
900      }
901
902  public String fhirType() {
903    return "ExplanationOfBenefit.payee";
904
905  }
906
907  }
908
909    @Block()
910    public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
911        /**
912         * A number to uniquely identify care team entries.
913         */
914        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
915        @Description(shortDefinition="Order of care team", formalDefinition="A number to uniquely identify care team entries." )
916        protected PositiveIntType sequence;
917
918        /**
919         * Member of the team who provided the product or service.
920         */
921        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=2, min=1, max=1, modifier=false, summary=false)
922        @Description(shortDefinition="Practitioner or organization", formalDefinition="Member of the team who provided the product or service." )
923        protected Reference provider;
924
925        /**
926         * The actual object that is the target of the reference (Member of the team who provided the product or service.)
927         */
928        protected Resource providerTarget;
929
930        /**
931         * The party who is billing and/or responsible for the claimed products or services.
932         */
933        @Child(name = "responsible", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
934        @Description(shortDefinition="Indicator of the lead practitioner", formalDefinition="The party who is billing and/or responsible for the claimed products or services." )
935        protected BooleanType responsible;
936
937        /**
938         * The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.
939         */
940        @Child(name = "role", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
941        @Description(shortDefinition="Function within the team", formalDefinition="The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team." )
942        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-careteamrole")
943        protected CodeableConcept role;
944
945        /**
946         * The qualification of the practitioner which is applicable for this service.
947         */
948        @Child(name = "qualification", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
949        @Description(shortDefinition="Practitioner credential or specialization", formalDefinition="The qualification of the practitioner which is applicable for this service." )
950        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provider-qualification")
951        protected CodeableConcept qualification;
952
953        private static final long serialVersionUID = 1758966968L;
954
955    /**
956     * Constructor
957     */
958      public CareTeamComponent() {
959        super();
960      }
961
962    /**
963     * Constructor
964     */
965      public CareTeamComponent(PositiveIntType sequence, Reference provider) {
966        super();
967        this.sequence = sequence;
968        this.provider = provider;
969      }
970
971        /**
972         * @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
973         */
974        public PositiveIntType getSequenceElement() { 
975          if (this.sequence == null)
976            if (Configuration.errorOnAutoCreate())
977              throw new Error("Attempt to auto-create CareTeamComponent.sequence");
978            else if (Configuration.doAutoCreate())
979              this.sequence = new PositiveIntType(); // bb
980          return this.sequence;
981        }
982
983        public boolean hasSequenceElement() { 
984          return this.sequence != null && !this.sequence.isEmpty();
985        }
986
987        public boolean hasSequence() { 
988          return this.sequence != null && !this.sequence.isEmpty();
989        }
990
991        /**
992         * @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
993         */
994        public CareTeamComponent setSequenceElement(PositiveIntType value) { 
995          this.sequence = value;
996          return this;
997        }
998
999        /**
1000         * @return A number to uniquely identify care team entries.
1001         */
1002        public int getSequence() { 
1003          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1004        }
1005
1006        /**
1007         * @param value A number to uniquely identify care team entries.
1008         */
1009        public CareTeamComponent setSequence(int value) { 
1010            if (this.sequence == null)
1011              this.sequence = new PositiveIntType();
1012            this.sequence.setValue(value);
1013          return this;
1014        }
1015
1016        /**
1017         * @return {@link #provider} (Member of the team who provided the product or service.)
1018         */
1019        public Reference getProvider() { 
1020          if (this.provider == null)
1021            if (Configuration.errorOnAutoCreate())
1022              throw new Error("Attempt to auto-create CareTeamComponent.provider");
1023            else if (Configuration.doAutoCreate())
1024              this.provider = new Reference(); // cc
1025          return this.provider;
1026        }
1027
1028        public boolean hasProvider() { 
1029          return this.provider != null && !this.provider.isEmpty();
1030        }
1031
1032        /**
1033         * @param value {@link #provider} (Member of the team who provided the product or service.)
1034         */
1035        public CareTeamComponent setProvider(Reference value) { 
1036          this.provider = value;
1037          return this;
1038        }
1039
1040        /**
1041         * @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.)
1042         */
1043        public Resource getProviderTarget() { 
1044          return this.providerTarget;
1045        }
1046
1047        /**
1048         * @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.)
1049         */
1050        public CareTeamComponent setProviderTarget(Resource value) { 
1051          this.providerTarget = value;
1052          return this;
1053        }
1054
1055        /**
1056         * @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
1057         */
1058        public BooleanType getResponsibleElement() { 
1059          if (this.responsible == null)
1060            if (Configuration.errorOnAutoCreate())
1061              throw new Error("Attempt to auto-create CareTeamComponent.responsible");
1062            else if (Configuration.doAutoCreate())
1063              this.responsible = new BooleanType(); // bb
1064          return this.responsible;
1065        }
1066
1067        public boolean hasResponsibleElement() { 
1068          return this.responsible != null && !this.responsible.isEmpty();
1069        }
1070
1071        public boolean hasResponsible() { 
1072          return this.responsible != null && !this.responsible.isEmpty();
1073        }
1074
1075        /**
1076         * @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
1077         */
1078        public CareTeamComponent setResponsibleElement(BooleanType value) { 
1079          this.responsible = value;
1080          return this;
1081        }
1082
1083        /**
1084         * @return The party who is billing and/or responsible for the claimed products or services.
1085         */
1086        public boolean getResponsible() { 
1087          return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
1088        }
1089
1090        /**
1091         * @param value The party who is billing and/or responsible for the claimed products or services.
1092         */
1093        public CareTeamComponent setResponsible(boolean value) { 
1094            if (this.responsible == null)
1095              this.responsible = new BooleanType();
1096            this.responsible.setValue(value);
1097          return this;
1098        }
1099
1100        /**
1101         * @return {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.)
1102         */
1103        public CodeableConcept getRole() { 
1104          if (this.role == null)
1105            if (Configuration.errorOnAutoCreate())
1106              throw new Error("Attempt to auto-create CareTeamComponent.role");
1107            else if (Configuration.doAutoCreate())
1108              this.role = new CodeableConcept(); // cc
1109          return this.role;
1110        }
1111
1112        public boolean hasRole() { 
1113          return this.role != null && !this.role.isEmpty();
1114        }
1115
1116        /**
1117         * @param value {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.)
1118         */
1119        public CareTeamComponent setRole(CodeableConcept value) { 
1120          this.role = value;
1121          return this;
1122        }
1123
1124        /**
1125         * @return {@link #qualification} (The qualification of the practitioner which is applicable for this service.)
1126         */
1127        public CodeableConcept getQualification() { 
1128          if (this.qualification == null)
1129            if (Configuration.errorOnAutoCreate())
1130              throw new Error("Attempt to auto-create CareTeamComponent.qualification");
1131            else if (Configuration.doAutoCreate())
1132              this.qualification = new CodeableConcept(); // cc
1133          return this.qualification;
1134        }
1135
1136        public boolean hasQualification() { 
1137          return this.qualification != null && !this.qualification.isEmpty();
1138        }
1139
1140        /**
1141         * @param value {@link #qualification} (The qualification of the practitioner which is applicable for this service.)
1142         */
1143        public CareTeamComponent setQualification(CodeableConcept value) { 
1144          this.qualification = value;
1145          return this;
1146        }
1147
1148        protected void listChildren(List<Property> children) {
1149          super.listChildren(children);
1150          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence));
1151          children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "Member of the team who provided the product or service.", 0, 1, provider));
1152          children.add(new Property("responsible", "boolean", "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible));
1153          children.add(new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1, role));
1154          children.add(new Property("qualification", "CodeableConcept", "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification));
1155        }
1156
1157        @Override
1158        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1159          switch (_hash) {
1160          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence);
1161          case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "Member of the team who provided the product or service.", 0, 1, provider);
1162          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);
1163          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1, role);
1164          case -631333393: /*qualification*/  return new Property("qualification", "CodeableConcept", "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification);
1165          default: return super.getNamedProperty(_hash, _name, _checkValid);
1166          }
1167
1168        }
1169
1170      @Override
1171      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1172        switch (hash) {
1173        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1174        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
1175        case 1847674614: /*responsible*/ return this.responsible == null ? new Base[0] : new Base[] {this.responsible}; // BooleanType
1176        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
1177        case -631333393: /*qualification*/ return this.qualification == null ? new Base[0] : new Base[] {this.qualification}; // CodeableConcept
1178        default: return super.getProperty(hash, name, checkValid);
1179        }
1180
1181      }
1182
1183      @Override
1184      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1185        switch (hash) {
1186        case 1349547969: // sequence
1187          this.sequence = castToPositiveInt(value); // PositiveIntType
1188          return value;
1189        case -987494927: // provider
1190          this.provider = castToReference(value); // Reference
1191          return value;
1192        case 1847674614: // responsible
1193          this.responsible = castToBoolean(value); // BooleanType
1194          return value;
1195        case 3506294: // role
1196          this.role = castToCodeableConcept(value); // CodeableConcept
1197          return value;
1198        case -631333393: // qualification
1199          this.qualification = castToCodeableConcept(value); // CodeableConcept
1200          return value;
1201        default: return super.setProperty(hash, name, value);
1202        }
1203
1204      }
1205
1206      @Override
1207      public Base setProperty(String name, Base value) throws FHIRException {
1208        if (name.equals("sequence")) {
1209          this.sequence = castToPositiveInt(value); // PositiveIntType
1210        } else if (name.equals("provider")) {
1211          this.provider = castToReference(value); // Reference
1212        } else if (name.equals("responsible")) {
1213          this.responsible = castToBoolean(value); // BooleanType
1214        } else if (name.equals("role")) {
1215          this.role = castToCodeableConcept(value); // CodeableConcept
1216        } else if (name.equals("qualification")) {
1217          this.qualification = castToCodeableConcept(value); // CodeableConcept
1218        } else
1219          return super.setProperty(name, value);
1220        return value;
1221      }
1222
1223      @Override
1224      public Base makeProperty(int hash, String name) throws FHIRException {
1225        switch (hash) {
1226        case 1349547969:  return getSequenceElement();
1227        case -987494927:  return getProvider(); 
1228        case 1847674614:  return getResponsibleElement();
1229        case 3506294:  return getRole(); 
1230        case -631333393:  return getQualification(); 
1231        default: return super.makeProperty(hash, name);
1232        }
1233
1234      }
1235
1236      @Override
1237      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1238        switch (hash) {
1239        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1240        case -987494927: /*provider*/ return new String[] {"Reference"};
1241        case 1847674614: /*responsible*/ return new String[] {"boolean"};
1242        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
1243        case -631333393: /*qualification*/ return new String[] {"CodeableConcept"};
1244        default: return super.getTypesForProperty(hash, name);
1245        }
1246
1247      }
1248
1249      @Override
1250      public Base addChild(String name) throws FHIRException {
1251        if (name.equals("sequence")) {
1252          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1253        }
1254        else if (name.equals("provider")) {
1255          this.provider = new Reference();
1256          return this.provider;
1257        }
1258        else if (name.equals("responsible")) {
1259          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.responsible");
1260        }
1261        else if (name.equals("role")) {
1262          this.role = new CodeableConcept();
1263          return this.role;
1264        }
1265        else if (name.equals("qualification")) {
1266          this.qualification = new CodeableConcept();
1267          return this.qualification;
1268        }
1269        else
1270          return super.addChild(name);
1271      }
1272
1273      public CareTeamComponent copy() {
1274        CareTeamComponent dst = new CareTeamComponent();
1275        copyValues(dst);
1276        return dst;
1277      }
1278
1279      public void copyValues(CareTeamComponent dst) {
1280        super.copyValues(dst);
1281        dst.sequence = sequence == null ? null : sequence.copy();
1282        dst.provider = provider == null ? null : provider.copy();
1283        dst.responsible = responsible == null ? null : responsible.copy();
1284        dst.role = role == null ? null : role.copy();
1285        dst.qualification = qualification == null ? null : qualification.copy();
1286      }
1287
1288      @Override
1289      public boolean equalsDeep(Base other_) {
1290        if (!super.equalsDeep(other_))
1291          return false;
1292        if (!(other_ instanceof CareTeamComponent))
1293          return false;
1294        CareTeamComponent o = (CareTeamComponent) other_;
1295        return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true) && compareDeep(responsible, o.responsible, true)
1296           && compareDeep(role, o.role, true) && compareDeep(qualification, o.qualification, true);
1297      }
1298
1299      @Override
1300      public boolean equalsShallow(Base other_) {
1301        if (!super.equalsShallow(other_))
1302          return false;
1303        if (!(other_ instanceof CareTeamComponent))
1304          return false;
1305        CareTeamComponent o = (CareTeamComponent) other_;
1306        return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true)
1307          ;
1308      }
1309
1310      public boolean isEmpty() {
1311        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible
1312          , role, qualification);
1313      }
1314
1315  public String fhirType() {
1316    return "ExplanationOfBenefit.careTeam";
1317
1318  }
1319
1320  }
1321
1322    @Block()
1323    public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
1324        /**
1325         * A number to uniquely identify supporting information entries.
1326         */
1327        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1328        @Description(shortDefinition="Information instance identifier", formalDefinition="A number to uniquely identify supporting information entries." )
1329        protected PositiveIntType sequence;
1330
1331        /**
1332         * The general class of the information supplied: information; exception; accident, employment; onset, etc.
1333         */
1334        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
1335        @Description(shortDefinition="Classification of the supplied information", formalDefinition="The general class of the information supplied: information; exception; accident, employment; onset, etc." )
1336        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-informationcategory")
1337        protected CodeableConcept category;
1338
1339        /**
1340         * System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.
1341         */
1342        @Child(name = "code", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1343        @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." )
1344        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-exception")
1345        protected CodeableConcept code;
1346
1347        /**
1348         * The date when or period to which this information refers.
1349         */
1350        @Child(name = "timing", type = {DateType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
1351        @Description(shortDefinition="When it occurred", formalDefinition="The date when or period to which this information refers." )
1352        protected Type timing;
1353
1354        /**
1355         * Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.
1356         */
1357        @Child(name = "value", type = {BooleanType.class, StringType.class, Quantity.class, Attachment.class, Reference.class}, order=5, min=0, max=1, modifier=false, summary=false)
1358        @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." )
1359        protected Type value;
1360
1361        /**
1362         * Provides the reason in the situation where a reason code is required in addition to the content.
1363         */
1364        @Child(name = "reason", type = {Coding.class}, order=6, min=0, max=1, modifier=false, summary=false)
1365        @Description(shortDefinition="Explanation for the information", formalDefinition="Provides the reason in the situation where a reason code is required in addition to the content." )
1366        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/missing-tooth-reason")
1367        protected Coding reason;
1368
1369        private static final long serialVersionUID = -410136661L;
1370
1371    /**
1372     * Constructor
1373     */
1374      public SupportingInformationComponent() {
1375        super();
1376      }
1377
1378    /**
1379     * Constructor
1380     */
1381      public SupportingInformationComponent(PositiveIntType sequence, CodeableConcept category) {
1382        super();
1383        this.sequence = sequence;
1384        this.category = category;
1385      }
1386
1387        /**
1388         * @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
1389         */
1390        public PositiveIntType getSequenceElement() { 
1391          if (this.sequence == null)
1392            if (Configuration.errorOnAutoCreate())
1393              throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
1394            else if (Configuration.doAutoCreate())
1395              this.sequence = new PositiveIntType(); // bb
1396          return this.sequence;
1397        }
1398
1399        public boolean hasSequenceElement() { 
1400          return this.sequence != null && !this.sequence.isEmpty();
1401        }
1402
1403        public boolean hasSequence() { 
1404          return this.sequence != null && !this.sequence.isEmpty();
1405        }
1406
1407        /**
1408         * @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
1409         */
1410        public SupportingInformationComponent setSequenceElement(PositiveIntType value) { 
1411          this.sequence = value;
1412          return this;
1413        }
1414
1415        /**
1416         * @return A number to uniquely identify supporting information entries.
1417         */
1418        public int getSequence() { 
1419          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1420        }
1421
1422        /**
1423         * @param value A number to uniquely identify supporting information entries.
1424         */
1425        public SupportingInformationComponent setSequence(int value) { 
1426            if (this.sequence == null)
1427              this.sequence = new PositiveIntType();
1428            this.sequence.setValue(value);
1429          return this;
1430        }
1431
1432        /**
1433         * @return {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1434         */
1435        public CodeableConcept getCategory() { 
1436          if (this.category == null)
1437            if (Configuration.errorOnAutoCreate())
1438              throw new Error("Attempt to auto-create SupportingInformationComponent.category");
1439            else if (Configuration.doAutoCreate())
1440              this.category = new CodeableConcept(); // cc
1441          return this.category;
1442        }
1443
1444        public boolean hasCategory() { 
1445          return this.category != null && !this.category.isEmpty();
1446        }
1447
1448        /**
1449         * @param value {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1450         */
1451        public SupportingInformationComponent setCategory(CodeableConcept value) { 
1452          this.category = value;
1453          return this;
1454        }
1455
1456        /**
1457         * @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.)
1458         */
1459        public CodeableConcept getCode() { 
1460          if (this.code == null)
1461            if (Configuration.errorOnAutoCreate())
1462              throw new Error("Attempt to auto-create SupportingInformationComponent.code");
1463            else if (Configuration.doAutoCreate())
1464              this.code = new CodeableConcept(); // cc
1465          return this.code;
1466        }
1467
1468        public boolean hasCode() { 
1469          return this.code != null && !this.code.isEmpty();
1470        }
1471
1472        /**
1473         * @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.)
1474         */
1475        public SupportingInformationComponent setCode(CodeableConcept value) { 
1476          this.code = value;
1477          return this;
1478        }
1479
1480        /**
1481         * @return {@link #timing} (The date when or period to which this information refers.)
1482         */
1483        public Type getTiming() { 
1484          return this.timing;
1485        }
1486
1487        /**
1488         * @return {@link #timing} (The date when or period to which this information refers.)
1489         */
1490        public DateType getTimingDateType() throws FHIRException { 
1491          if (this.timing == null)
1492            this.timing = new DateType();
1493          if (!(this.timing instanceof DateType))
1494            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.timing.getClass().getName()+" was encountered");
1495          return (DateType) this.timing;
1496        }
1497
1498        public boolean hasTimingDateType() { 
1499          return this != null && this.timing instanceof DateType;
1500        }
1501
1502        /**
1503         * @return {@link #timing} (The date when or period to which this information refers.)
1504         */
1505        public Period getTimingPeriod() throws FHIRException { 
1506          if (this.timing == null)
1507            this.timing = new Period();
1508          if (!(this.timing instanceof Period))
1509            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
1510          return (Period) this.timing;
1511        }
1512
1513        public boolean hasTimingPeriod() { 
1514          return this != null && this.timing instanceof Period;
1515        }
1516
1517        public boolean hasTiming() { 
1518          return this.timing != null && !this.timing.isEmpty();
1519        }
1520
1521        /**
1522         * @param value {@link #timing} (The date when or period to which this information refers.)
1523         */
1524        public SupportingInformationComponent setTiming(Type value) { 
1525          if (value != null && !(value instanceof DateType || value instanceof Period))
1526            throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.timing[x]: "+value.fhirType());
1527          this.timing = value;
1528          return this;
1529        }
1530
1531        /**
1532         * @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.)
1533         */
1534        public Type getValue() { 
1535          return this.value;
1536        }
1537
1538        /**
1539         * @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.)
1540         */
1541        public BooleanType getValueBooleanType() throws FHIRException { 
1542          if (this.value == null)
1543            this.value = new BooleanType();
1544          if (!(this.value instanceof BooleanType))
1545            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
1546          return (BooleanType) this.value;
1547        }
1548
1549        public boolean hasValueBooleanType() { 
1550          return this != null && this.value instanceof BooleanType;
1551        }
1552
1553        /**
1554         * @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.)
1555         */
1556        public StringType getValueStringType() throws FHIRException { 
1557          if (this.value == null)
1558            this.value = new StringType();
1559          if (!(this.value instanceof StringType))
1560            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
1561          return (StringType) this.value;
1562        }
1563
1564        public boolean hasValueStringType() { 
1565          return this != null && this.value instanceof StringType;
1566        }
1567
1568        /**
1569         * @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.)
1570         */
1571        public Quantity getValueQuantity() throws FHIRException { 
1572          if (this.value == null)
1573            this.value = new Quantity();
1574          if (!(this.value instanceof Quantity))
1575            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
1576          return (Quantity) this.value;
1577        }
1578
1579        public boolean hasValueQuantity() { 
1580          return this != null && this.value instanceof Quantity;
1581        }
1582
1583        /**
1584         * @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.)
1585         */
1586        public Attachment getValueAttachment() throws FHIRException { 
1587          if (this.value == null)
1588            this.value = new Attachment();
1589          if (!(this.value instanceof Attachment))
1590            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
1591          return (Attachment) this.value;
1592        }
1593
1594        public boolean hasValueAttachment() { 
1595          return this != null && this.value instanceof Attachment;
1596        }
1597
1598        /**
1599         * @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.)
1600         */
1601        public Reference getValueReference() throws FHIRException { 
1602          if (this.value == null)
1603            this.value = new Reference();
1604          if (!(this.value instanceof Reference))
1605            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
1606          return (Reference) this.value;
1607        }
1608
1609        public boolean hasValueReference() { 
1610          return this != null && this.value instanceof Reference;
1611        }
1612
1613        public boolean hasValue() { 
1614          return this.value != null && !this.value.isEmpty();
1615        }
1616
1617        /**
1618         * @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.)
1619         */
1620        public SupportingInformationComponent setValue(Type value) { 
1621          if (value != null && !(value instanceof BooleanType || value instanceof StringType || value instanceof Quantity || value instanceof Attachment || value instanceof Reference))
1622            throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.value[x]: "+value.fhirType());
1623          this.value = value;
1624          return this;
1625        }
1626
1627        /**
1628         * @return {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1629         */
1630        public Coding getReason() { 
1631          if (this.reason == null)
1632            if (Configuration.errorOnAutoCreate())
1633              throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1634            else if (Configuration.doAutoCreate())
1635              this.reason = new Coding(); // cc
1636          return this.reason;
1637        }
1638
1639        public boolean hasReason() { 
1640          return this.reason != null && !this.reason.isEmpty();
1641        }
1642
1643        /**
1644         * @param value {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1645         */
1646        public SupportingInformationComponent setReason(Coding value) { 
1647          this.reason = value;
1648          return this;
1649        }
1650
1651        protected void listChildren(List<Property> children) {
1652          super.listChildren(children);
1653          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence));
1654          children.add(new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category));
1655          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));
1656          children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing));
1657          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));
1658          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));
1659        }
1660
1661        @Override
1662        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1663          switch (_hash) {
1664          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence);
1665          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category);
1666          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);
1667          case 164632566: /*timing[x]*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1668          case -873664438: /*timing*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1669          case 807935768: /*timingDate*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1670          case -615615829: /*timingPeriod*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1671          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);
1672          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);
1673          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);
1674          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);
1675          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);
1676          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);
1677          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);
1678          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);
1679          default: return super.getNamedProperty(_hash, _name, _checkValid);
1680          }
1681
1682        }
1683
1684      @Override
1685      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1686        switch (hash) {
1687        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1688        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1689        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1690        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Type
1691        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
1692        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
1693        default: return super.getProperty(hash, name, checkValid);
1694        }
1695
1696      }
1697
1698      @Override
1699      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1700        switch (hash) {
1701        case 1349547969: // sequence
1702          this.sequence = castToPositiveInt(value); // PositiveIntType
1703          return value;
1704        case 50511102: // category
1705          this.category = castToCodeableConcept(value); // CodeableConcept
1706          return value;
1707        case 3059181: // code
1708          this.code = castToCodeableConcept(value); // CodeableConcept
1709          return value;
1710        case -873664438: // timing
1711          this.timing = castToType(value); // Type
1712          return value;
1713        case 111972721: // value
1714          this.value = castToType(value); // Type
1715          return value;
1716        case -934964668: // reason
1717          this.reason = castToCoding(value); // Coding
1718          return value;
1719        default: return super.setProperty(hash, name, value);
1720        }
1721
1722      }
1723
1724      @Override
1725      public Base setProperty(String name, Base value) throws FHIRException {
1726        if (name.equals("sequence")) {
1727          this.sequence = castToPositiveInt(value); // PositiveIntType
1728        } else if (name.equals("category")) {
1729          this.category = castToCodeableConcept(value); // CodeableConcept
1730        } else if (name.equals("code")) {
1731          this.code = castToCodeableConcept(value); // CodeableConcept
1732        } else if (name.equals("timing[x]")) {
1733          this.timing = castToType(value); // Type
1734        } else if (name.equals("value[x]")) {
1735          this.value = castToType(value); // Type
1736        } else if (name.equals("reason")) {
1737          this.reason = castToCoding(value); // Coding
1738        } else
1739          return super.setProperty(name, value);
1740        return value;
1741      }
1742
1743      @Override
1744      public Base makeProperty(int hash, String name) throws FHIRException {
1745        switch (hash) {
1746        case 1349547969:  return getSequenceElement();
1747        case 50511102:  return getCategory(); 
1748        case 3059181:  return getCode(); 
1749        case 164632566:  return getTiming(); 
1750        case -873664438:  return getTiming(); 
1751        case -1410166417:  return getValue(); 
1752        case 111972721:  return getValue(); 
1753        case -934964668:  return getReason(); 
1754        default: return super.makeProperty(hash, name);
1755        }
1756
1757      }
1758
1759      @Override
1760      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1761        switch (hash) {
1762        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1763        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1764        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1765        case -873664438: /*timing*/ return new String[] {"date", "Period"};
1766        case 111972721: /*value*/ return new String[] {"boolean", "string", "Quantity", "Attachment", "Reference"};
1767        case -934964668: /*reason*/ return new String[] {"Coding"};
1768        default: return super.getTypesForProperty(hash, name);
1769        }
1770
1771      }
1772
1773      @Override
1774      public Base addChild(String name) throws FHIRException {
1775        if (name.equals("sequence")) {
1776          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1777        }
1778        else if (name.equals("category")) {
1779          this.category = new CodeableConcept();
1780          return this.category;
1781        }
1782        else if (name.equals("code")) {
1783          this.code = new CodeableConcept();
1784          return this.code;
1785        }
1786        else if (name.equals("timingDate")) {
1787          this.timing = new DateType();
1788          return this.timing;
1789        }
1790        else if (name.equals("timingPeriod")) {
1791          this.timing = new Period();
1792          return this.timing;
1793        }
1794        else if (name.equals("valueBoolean")) {
1795          this.value = new BooleanType();
1796          return this.value;
1797        }
1798        else if (name.equals("valueString")) {
1799          this.value = new StringType();
1800          return this.value;
1801        }
1802        else if (name.equals("valueQuantity")) {
1803          this.value = new Quantity();
1804          return this.value;
1805        }
1806        else if (name.equals("valueAttachment")) {
1807          this.value = new Attachment();
1808          return this.value;
1809        }
1810        else if (name.equals("valueReference")) {
1811          this.value = new Reference();
1812          return this.value;
1813        }
1814        else if (name.equals("reason")) {
1815          this.reason = new Coding();
1816          return this.reason;
1817        }
1818        else
1819          return super.addChild(name);
1820      }
1821
1822      public SupportingInformationComponent copy() {
1823        SupportingInformationComponent dst = new SupportingInformationComponent();
1824        copyValues(dst);
1825        return dst;
1826      }
1827
1828      public void copyValues(SupportingInformationComponent dst) {
1829        super.copyValues(dst);
1830        dst.sequence = sequence == null ? null : sequence.copy();
1831        dst.category = category == null ? null : category.copy();
1832        dst.code = code == null ? null : code.copy();
1833        dst.timing = timing == null ? null : timing.copy();
1834        dst.value = value == null ? null : value.copy();
1835        dst.reason = reason == null ? null : reason.copy();
1836      }
1837
1838      @Override
1839      public boolean equalsDeep(Base other_) {
1840        if (!super.equalsDeep(other_))
1841          return false;
1842        if (!(other_ instanceof SupportingInformationComponent))
1843          return false;
1844        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1845        return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true) && compareDeep(code, o.code, true)
1846           && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true) && compareDeep(reason, o.reason, true)
1847          ;
1848      }
1849
1850      @Override
1851      public boolean equalsShallow(Base other_) {
1852        if (!super.equalsShallow(other_))
1853          return false;
1854        if (!(other_ instanceof SupportingInformationComponent))
1855          return false;
1856        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1857        return compareValues(sequence, o.sequence, true);
1858      }
1859
1860      public boolean isEmpty() {
1861        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code
1862          , timing, value, reason);
1863      }
1864
1865  public String fhirType() {
1866    return "ExplanationOfBenefit.supportingInfo";
1867
1868  }
1869
1870  }
1871
1872    @Block()
1873    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
1874        /**
1875         * A number to uniquely identify diagnosis entries.
1876         */
1877        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1878        @Description(shortDefinition="Diagnosis instance identifier", formalDefinition="A number to uniquely identify diagnosis entries." )
1879        protected PositiveIntType sequence;
1880
1881        /**
1882         * The nature of illness or problem in a coded form or as a reference to an external defined Condition.
1883         */
1884        @Child(name = "diagnosis", type = {CodeableConcept.class, Condition.class}, order=2, min=1, max=1, modifier=false, summary=false)
1885        @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." )
1886        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10")
1887        protected Type diagnosis;
1888
1889        /**
1890         * When the condition was observed or the relative ranking.
1891         */
1892        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1893        @Description(shortDefinition="Timing or nature of the diagnosis", formalDefinition="When the condition was observed or the relative ranking." )
1894        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosistype")
1895        protected List<CodeableConcept> type;
1896
1897        /**
1898         * Indication of whether the diagnosis was present on admission to a facility.
1899         */
1900        @Child(name = "onAdmission", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1901        @Description(shortDefinition="Present on admission", formalDefinition="Indication of whether the diagnosis was present on admission to a facility." )
1902        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosis-on-admission")
1903        protected CodeableConcept onAdmission;
1904
1905        /**
1906         * 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.
1907         */
1908        @Child(name = "packageCode", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1909        @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." )
1910        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
1911        protected CodeableConcept packageCode;
1912
1913        private static final long serialVersionUID = 2120593974L;
1914
1915    /**
1916     * Constructor
1917     */
1918      public DiagnosisComponent() {
1919        super();
1920      }
1921
1922    /**
1923     * Constructor
1924     */
1925      public DiagnosisComponent(PositiveIntType sequence, Type diagnosis) {
1926        super();
1927        this.sequence = sequence;
1928        this.diagnosis = diagnosis;
1929      }
1930
1931        /**
1932         * @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
1933         */
1934        public PositiveIntType getSequenceElement() { 
1935          if (this.sequence == null)
1936            if (Configuration.errorOnAutoCreate())
1937              throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
1938            else if (Configuration.doAutoCreate())
1939              this.sequence = new PositiveIntType(); // bb
1940          return this.sequence;
1941        }
1942
1943        public boolean hasSequenceElement() { 
1944          return this.sequence != null && !this.sequence.isEmpty();
1945        }
1946
1947        public boolean hasSequence() { 
1948          return this.sequence != null && !this.sequence.isEmpty();
1949        }
1950
1951        /**
1952         * @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
1953         */
1954        public DiagnosisComponent setSequenceElement(PositiveIntType value) { 
1955          this.sequence = value;
1956          return this;
1957        }
1958
1959        /**
1960         * @return A number to uniquely identify diagnosis entries.
1961         */
1962        public int getSequence() { 
1963          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1964        }
1965
1966        /**
1967         * @param value A number to uniquely identify diagnosis entries.
1968         */
1969        public DiagnosisComponent setSequence(int value) { 
1970            if (this.sequence == null)
1971              this.sequence = new PositiveIntType();
1972            this.sequence.setValue(value);
1973          return this;
1974        }
1975
1976        /**
1977         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1978         */
1979        public Type getDiagnosis() { 
1980          return this.diagnosis;
1981        }
1982
1983        /**
1984         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1985         */
1986        public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException { 
1987          if (this.diagnosis == null)
1988            this.diagnosis = new CodeableConcept();
1989          if (!(this.diagnosis instanceof CodeableConcept))
1990            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1991          return (CodeableConcept) this.diagnosis;
1992        }
1993
1994        public boolean hasDiagnosisCodeableConcept() { 
1995          return this != null && this.diagnosis instanceof CodeableConcept;
1996        }
1997
1998        /**
1999         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
2000         */
2001        public Reference getDiagnosisReference() throws FHIRException { 
2002          if (this.diagnosis == null)
2003            this.diagnosis = new Reference();
2004          if (!(this.diagnosis instanceof Reference))
2005            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
2006          return (Reference) this.diagnosis;
2007        }
2008
2009        public boolean hasDiagnosisReference() { 
2010          return this != null && this.diagnosis instanceof Reference;
2011        }
2012
2013        public boolean hasDiagnosis() { 
2014          return this.diagnosis != null && !this.diagnosis.isEmpty();
2015        }
2016
2017        /**
2018         * @param value {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
2019         */
2020        public DiagnosisComponent setDiagnosis(Type value) { 
2021          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2022            throw new Error("Not the right type for ExplanationOfBenefit.diagnosis.diagnosis[x]: "+value.fhirType());
2023          this.diagnosis = value;
2024          return this;
2025        }
2026
2027        /**
2028         * @return {@link #type} (When the condition was observed or the relative ranking.)
2029         */
2030        public List<CodeableConcept> getType() { 
2031          if (this.type == null)
2032            this.type = new ArrayList<CodeableConcept>();
2033          return this.type;
2034        }
2035
2036        /**
2037         * @return Returns a reference to <code>this</code> for easy method chaining
2038         */
2039        public DiagnosisComponent setType(List<CodeableConcept> theType) { 
2040          this.type = theType;
2041          return this;
2042        }
2043
2044        public boolean hasType() { 
2045          if (this.type == null)
2046            return false;
2047          for (CodeableConcept item : this.type)
2048            if (!item.isEmpty())
2049              return true;
2050          return false;
2051        }
2052
2053        public CodeableConcept addType() { //3
2054          CodeableConcept t = new CodeableConcept();
2055          if (this.type == null)
2056            this.type = new ArrayList<CodeableConcept>();
2057          this.type.add(t);
2058          return t;
2059        }
2060
2061        public DiagnosisComponent addType(CodeableConcept t) { //3
2062          if (t == null)
2063            return this;
2064          if (this.type == null)
2065            this.type = new ArrayList<CodeableConcept>();
2066          this.type.add(t);
2067          return this;
2068        }
2069
2070        /**
2071         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
2072         */
2073        public CodeableConcept getTypeFirstRep() { 
2074          if (getType().isEmpty()) {
2075            addType();
2076          }
2077          return getType().get(0);
2078        }
2079
2080        /**
2081         * @return {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
2082         */
2083        public CodeableConcept getOnAdmission() { 
2084          if (this.onAdmission == null)
2085            if (Configuration.errorOnAutoCreate())
2086              throw new Error("Attempt to auto-create DiagnosisComponent.onAdmission");
2087            else if (Configuration.doAutoCreate())
2088              this.onAdmission = new CodeableConcept(); // cc
2089          return this.onAdmission;
2090        }
2091
2092        public boolean hasOnAdmission() { 
2093          return this.onAdmission != null && !this.onAdmission.isEmpty();
2094        }
2095
2096        /**
2097         * @param value {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
2098         */
2099        public DiagnosisComponent setOnAdmission(CodeableConcept value) { 
2100          this.onAdmission = value;
2101          return this;
2102        }
2103
2104        /**
2105         * @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.)
2106         */
2107        public CodeableConcept getPackageCode() { 
2108          if (this.packageCode == null)
2109            if (Configuration.errorOnAutoCreate())
2110              throw new Error("Attempt to auto-create DiagnosisComponent.packageCode");
2111            else if (Configuration.doAutoCreate())
2112              this.packageCode = new CodeableConcept(); // cc
2113          return this.packageCode;
2114        }
2115
2116        public boolean hasPackageCode() { 
2117          return this.packageCode != null && !this.packageCode.isEmpty();
2118        }
2119
2120        /**
2121         * @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.)
2122         */
2123        public DiagnosisComponent setPackageCode(CodeableConcept value) { 
2124          this.packageCode = value;
2125          return this;
2126        }
2127
2128        protected void listChildren(List<Property> children) {
2129          super.listChildren(children);
2130          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence));
2131          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));
2132          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
2133          children.add(new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission));
2134          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));
2135        }
2136
2137        @Override
2138        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2139          switch (_hash) {
2140          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence);
2141          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);
2142          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);
2143          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);
2144          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);
2145          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2146          case -3386134: /*onAdmission*/  return new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission);
2147          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);
2148          default: return super.getNamedProperty(_hash, _name, _checkValid);
2149          }
2150
2151        }
2152
2153      @Override
2154      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2155        switch (hash) {
2156        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2157        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // Type
2158        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2159        case -3386134: /*onAdmission*/ return this.onAdmission == null ? new Base[0] : new Base[] {this.onAdmission}; // CodeableConcept
2160        case 908444499: /*packageCode*/ return this.packageCode == null ? new Base[0] : new Base[] {this.packageCode}; // CodeableConcept
2161        default: return super.getProperty(hash, name, checkValid);
2162        }
2163
2164      }
2165
2166      @Override
2167      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2168        switch (hash) {
2169        case 1349547969: // sequence
2170          this.sequence = castToPositiveInt(value); // PositiveIntType
2171          return value;
2172        case 1196993265: // diagnosis
2173          this.diagnosis = castToType(value); // Type
2174          return value;
2175        case 3575610: // type
2176          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
2177          return value;
2178        case -3386134: // onAdmission
2179          this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2180          return value;
2181        case 908444499: // packageCode
2182          this.packageCode = castToCodeableConcept(value); // CodeableConcept
2183          return value;
2184        default: return super.setProperty(hash, name, value);
2185        }
2186
2187      }
2188
2189      @Override
2190      public Base setProperty(String name, Base value) throws FHIRException {
2191        if (name.equals("sequence")) {
2192          this.sequence = castToPositiveInt(value); // PositiveIntType
2193        } else if (name.equals("diagnosis[x]")) {
2194          this.diagnosis = castToType(value); // Type
2195        } else if (name.equals("type")) {
2196          this.getType().add(castToCodeableConcept(value));
2197        } else if (name.equals("onAdmission")) {
2198          this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2199        } else if (name.equals("packageCode")) {
2200          this.packageCode = castToCodeableConcept(value); // CodeableConcept
2201        } else
2202          return super.setProperty(name, value);
2203        return value;
2204      }
2205
2206      @Override
2207      public Base makeProperty(int hash, String name) throws FHIRException {
2208        switch (hash) {
2209        case 1349547969:  return getSequenceElement();
2210        case -1487009809:  return getDiagnosis(); 
2211        case 1196993265:  return getDiagnosis(); 
2212        case 3575610:  return addType(); 
2213        case -3386134:  return getOnAdmission(); 
2214        case 908444499:  return getPackageCode(); 
2215        default: return super.makeProperty(hash, name);
2216        }
2217
2218      }
2219
2220      @Override
2221      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2222        switch (hash) {
2223        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2224        case 1196993265: /*diagnosis*/ return new String[] {"CodeableConcept", "Reference"};
2225        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2226        case -3386134: /*onAdmission*/ return new String[] {"CodeableConcept"};
2227        case 908444499: /*packageCode*/ return new String[] {"CodeableConcept"};
2228        default: return super.getTypesForProperty(hash, name);
2229        }
2230
2231      }
2232
2233      @Override
2234      public Base addChild(String name) throws FHIRException {
2235        if (name.equals("sequence")) {
2236          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
2237        }
2238        else if (name.equals("diagnosisCodeableConcept")) {
2239          this.diagnosis = new CodeableConcept();
2240          return this.diagnosis;
2241        }
2242        else if (name.equals("diagnosisReference")) {
2243          this.diagnosis = new Reference();
2244          return this.diagnosis;
2245        }
2246        else if (name.equals("type")) {
2247          return addType();
2248        }
2249        else if (name.equals("onAdmission")) {
2250          this.onAdmission = new CodeableConcept();
2251          return this.onAdmission;
2252        }
2253        else if (name.equals("packageCode")) {
2254          this.packageCode = new CodeableConcept();
2255          return this.packageCode;
2256        }
2257        else
2258          return super.addChild(name);
2259      }
2260
2261      public DiagnosisComponent copy() {
2262        DiagnosisComponent dst = new DiagnosisComponent();
2263        copyValues(dst);
2264        return dst;
2265      }
2266
2267      public void copyValues(DiagnosisComponent dst) {
2268        super.copyValues(dst);
2269        dst.sequence = sequence == null ? null : sequence.copy();
2270        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
2271        if (type != null) {
2272          dst.type = new ArrayList<CodeableConcept>();
2273          for (CodeableConcept i : type)
2274            dst.type.add(i.copy());
2275        };
2276        dst.onAdmission = onAdmission == null ? null : onAdmission.copy();
2277        dst.packageCode = packageCode == null ? null : packageCode.copy();
2278      }
2279
2280      @Override
2281      public boolean equalsDeep(Base other_) {
2282        if (!super.equalsDeep(other_))
2283          return false;
2284        if (!(other_ instanceof DiagnosisComponent))
2285          return false;
2286        DiagnosisComponent o = (DiagnosisComponent) other_;
2287        return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(type, o.type, true)
2288           && compareDeep(onAdmission, o.onAdmission, true) && compareDeep(packageCode, o.packageCode, true)
2289          ;
2290      }
2291
2292      @Override
2293      public boolean equalsShallow(Base other_) {
2294        if (!super.equalsShallow(other_))
2295          return false;
2296        if (!(other_ instanceof DiagnosisComponent))
2297          return false;
2298        DiagnosisComponent o = (DiagnosisComponent) other_;
2299        return compareValues(sequence, o.sequence, true);
2300      }
2301
2302      public boolean isEmpty() {
2303        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type
2304          , onAdmission, packageCode);
2305      }
2306
2307  public String fhirType() {
2308    return "ExplanationOfBenefit.diagnosis";
2309
2310  }
2311
2312  }
2313
2314    @Block()
2315    public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
2316        /**
2317         * A number to uniquely identify procedure entries.
2318         */
2319        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2320        @Description(shortDefinition="Procedure instance identifier", formalDefinition="A number to uniquely identify procedure entries." )
2321        protected PositiveIntType sequence;
2322
2323        /**
2324         * When the condition was observed or the relative ranking.
2325         */
2326        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2327        @Description(shortDefinition="Category of Procedure", formalDefinition="When the condition was observed or the relative ranking." )
2328        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-procedure-type")
2329        protected List<CodeableConcept> type;
2330
2331        /**
2332         * Date and optionally time the procedure was performed.
2333         */
2334        @Child(name = "date", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2335        @Description(shortDefinition="When the procedure was performed", formalDefinition="Date and optionally time the procedure was performed." )
2336        protected DateTimeType date;
2337
2338        /**
2339         * The code or reference to a Procedure resource which identifies the clinical intervention performed.
2340         */
2341        @Child(name = "procedure", type = {CodeableConcept.class, Procedure.class}, order=4, min=1, max=1, modifier=false, summary=false)
2342        @Description(shortDefinition="Specific clinical procedure", formalDefinition="The code or reference to a Procedure resource which identifies the clinical intervention performed." )
2343        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10-procedures")
2344        protected Type procedure;
2345
2346        /**
2347         * Unique Device Identifiers associated with this line item.
2348         */
2349        @Child(name = "udi", type = {Device.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2350        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
2351        protected List<Reference> udi;
2352        /**
2353         * The actual objects that are the target of the reference (Unique Device Identifiers associated with this line item.)
2354         */
2355        protected List<Device> udiTarget;
2356
2357
2358        private static final long serialVersionUID = 935341852L;
2359
2360    /**
2361     * Constructor
2362     */
2363      public ProcedureComponent() {
2364        super();
2365      }
2366
2367    /**
2368     * Constructor
2369     */
2370      public ProcedureComponent(PositiveIntType sequence, Type procedure) {
2371        super();
2372        this.sequence = sequence;
2373        this.procedure = procedure;
2374      }
2375
2376        /**
2377         * @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
2378         */
2379        public PositiveIntType getSequenceElement() { 
2380          if (this.sequence == null)
2381            if (Configuration.errorOnAutoCreate())
2382              throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2383            else if (Configuration.doAutoCreate())
2384              this.sequence = new PositiveIntType(); // bb
2385          return this.sequence;
2386        }
2387
2388        public boolean hasSequenceElement() { 
2389          return this.sequence != null && !this.sequence.isEmpty();
2390        }
2391
2392        public boolean hasSequence() { 
2393          return this.sequence != null && !this.sequence.isEmpty();
2394        }
2395
2396        /**
2397         * @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
2398         */
2399        public ProcedureComponent setSequenceElement(PositiveIntType value) { 
2400          this.sequence = value;
2401          return this;
2402        }
2403
2404        /**
2405         * @return A number to uniquely identify procedure entries.
2406         */
2407        public int getSequence() { 
2408          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2409        }
2410
2411        /**
2412         * @param value A number to uniquely identify procedure entries.
2413         */
2414        public ProcedureComponent setSequence(int value) { 
2415            if (this.sequence == null)
2416              this.sequence = new PositiveIntType();
2417            this.sequence.setValue(value);
2418          return this;
2419        }
2420
2421        /**
2422         * @return {@link #type} (When the condition was observed or the relative ranking.)
2423         */
2424        public List<CodeableConcept> getType() { 
2425          if (this.type == null)
2426            this.type = new ArrayList<CodeableConcept>();
2427          return this.type;
2428        }
2429
2430        /**
2431         * @return Returns a reference to <code>this</code> for easy method chaining
2432         */
2433        public ProcedureComponent setType(List<CodeableConcept> theType) { 
2434          this.type = theType;
2435          return this;
2436        }
2437
2438        public boolean hasType() { 
2439          if (this.type == null)
2440            return false;
2441          for (CodeableConcept item : this.type)
2442            if (!item.isEmpty())
2443              return true;
2444          return false;
2445        }
2446
2447        public CodeableConcept addType() { //3
2448          CodeableConcept t = new CodeableConcept();
2449          if (this.type == null)
2450            this.type = new ArrayList<CodeableConcept>();
2451          this.type.add(t);
2452          return t;
2453        }
2454
2455        public ProcedureComponent addType(CodeableConcept t) { //3
2456          if (t == null)
2457            return this;
2458          if (this.type == null)
2459            this.type = new ArrayList<CodeableConcept>();
2460          this.type.add(t);
2461          return this;
2462        }
2463
2464        /**
2465         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
2466         */
2467        public CodeableConcept getTypeFirstRep() { 
2468          if (getType().isEmpty()) {
2469            addType();
2470          }
2471          return getType().get(0);
2472        }
2473
2474        /**
2475         * @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
2476         */
2477        public DateTimeType getDateElement() { 
2478          if (this.date == null)
2479            if (Configuration.errorOnAutoCreate())
2480              throw new Error("Attempt to auto-create ProcedureComponent.date");
2481            else if (Configuration.doAutoCreate())
2482              this.date = new DateTimeType(); // bb
2483          return this.date;
2484        }
2485
2486        public boolean hasDateElement() { 
2487          return this.date != null && !this.date.isEmpty();
2488        }
2489
2490        public boolean hasDate() { 
2491          return this.date != null && !this.date.isEmpty();
2492        }
2493
2494        /**
2495         * @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
2496         */
2497        public ProcedureComponent setDateElement(DateTimeType value) { 
2498          this.date = value;
2499          return this;
2500        }
2501
2502        /**
2503         * @return Date and optionally time the procedure was performed.
2504         */
2505        public Date getDate() { 
2506          return this.date == null ? null : this.date.getValue();
2507        }
2508
2509        /**
2510         * @param value Date and optionally time the procedure was performed.
2511         */
2512        public ProcedureComponent setDate(Date value) { 
2513          if (value == null)
2514            this.date = null;
2515          else {
2516            if (this.date == null)
2517              this.date = new DateTimeType();
2518            this.date.setValue(value);
2519          }
2520          return this;
2521        }
2522
2523        /**
2524         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2525         */
2526        public Type getProcedure() { 
2527          return this.procedure;
2528        }
2529
2530        /**
2531         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2532         */
2533        public CodeableConcept getProcedureCodeableConcept() throws FHIRException { 
2534          if (this.procedure == null)
2535            this.procedure = new CodeableConcept();
2536          if (!(this.procedure instanceof CodeableConcept))
2537            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.procedure.getClass().getName()+" was encountered");
2538          return (CodeableConcept) this.procedure;
2539        }
2540
2541        public boolean hasProcedureCodeableConcept() { 
2542          return this != null && this.procedure instanceof CodeableConcept;
2543        }
2544
2545        /**
2546         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2547         */
2548        public Reference getProcedureReference() throws FHIRException { 
2549          if (this.procedure == null)
2550            this.procedure = new Reference();
2551          if (!(this.procedure instanceof Reference))
2552            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.procedure.getClass().getName()+" was encountered");
2553          return (Reference) this.procedure;
2554        }
2555
2556        public boolean hasProcedureReference() { 
2557          return this != null && this.procedure instanceof Reference;
2558        }
2559
2560        public boolean hasProcedure() { 
2561          return this.procedure != null && !this.procedure.isEmpty();
2562        }
2563
2564        /**
2565         * @param value {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2566         */
2567        public ProcedureComponent setProcedure(Type value) { 
2568          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2569            throw new Error("Not the right type for ExplanationOfBenefit.procedure.procedure[x]: "+value.fhirType());
2570          this.procedure = value;
2571          return this;
2572        }
2573
2574        /**
2575         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
2576         */
2577        public List<Reference> getUdi() { 
2578          if (this.udi == null)
2579            this.udi = new ArrayList<Reference>();
2580          return this.udi;
2581        }
2582
2583        /**
2584         * @return Returns a reference to <code>this</code> for easy method chaining
2585         */
2586        public ProcedureComponent setUdi(List<Reference> theUdi) { 
2587          this.udi = theUdi;
2588          return this;
2589        }
2590
2591        public boolean hasUdi() { 
2592          if (this.udi == null)
2593            return false;
2594          for (Reference item : this.udi)
2595            if (!item.isEmpty())
2596              return true;
2597          return false;
2598        }
2599
2600        public Reference addUdi() { //3
2601          Reference t = new Reference();
2602          if (this.udi == null)
2603            this.udi = new ArrayList<Reference>();
2604          this.udi.add(t);
2605          return t;
2606        }
2607
2608        public ProcedureComponent addUdi(Reference t) { //3
2609          if (t == null)
2610            return this;
2611          if (this.udi == null)
2612            this.udi = new ArrayList<Reference>();
2613          this.udi.add(t);
2614          return this;
2615        }
2616
2617        /**
2618         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
2619         */
2620        public Reference getUdiFirstRep() { 
2621          if (getUdi().isEmpty()) {
2622            addUdi();
2623          }
2624          return getUdi().get(0);
2625        }
2626
2627        /**
2628         * @deprecated Use Reference#setResource(IBaseResource) instead
2629         */
2630        @Deprecated
2631        public List<Device> getUdiTarget() { 
2632          if (this.udiTarget == null)
2633            this.udiTarget = new ArrayList<Device>();
2634          return this.udiTarget;
2635        }
2636
2637        /**
2638         * @deprecated Use Reference#setResource(IBaseResource) instead
2639         */
2640        @Deprecated
2641        public Device addUdiTarget() { 
2642          Device r = new Device();
2643          if (this.udiTarget == null)
2644            this.udiTarget = new ArrayList<Device>();
2645          this.udiTarget.add(r);
2646          return r;
2647        }
2648
2649        protected void listChildren(List<Property> children) {
2650          super.listChildren(children);
2651          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence));
2652          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
2653          children.add(new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date));
2654          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));
2655          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
2656        }
2657
2658        @Override
2659        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2660          switch (_hash) {
2661          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence);
2662          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2663          case 3076014: /*date*/  return new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date);
2664          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);
2665          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);
2666          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);
2667          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);
2668          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
2669          default: return super.getNamedProperty(_hash, _name, _checkValid);
2670          }
2671
2672        }
2673
2674      @Override
2675      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2676        switch (hash) {
2677        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2678        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2679        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2680        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // Type
2681        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
2682        default: return super.getProperty(hash, name, checkValid);
2683        }
2684
2685      }
2686
2687      @Override
2688      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2689        switch (hash) {
2690        case 1349547969: // sequence
2691          this.sequence = castToPositiveInt(value); // PositiveIntType
2692          return value;
2693        case 3575610: // type
2694          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
2695          return value;
2696        case 3076014: // date
2697          this.date = castToDateTime(value); // DateTimeType
2698          return value;
2699        case -1095204141: // procedure
2700          this.procedure = castToType(value); // Type
2701          return value;
2702        case 115642: // udi
2703          this.getUdi().add(castToReference(value)); // Reference
2704          return value;
2705        default: return super.setProperty(hash, name, value);
2706        }
2707
2708      }
2709
2710      @Override
2711      public Base setProperty(String name, Base value) throws FHIRException {
2712        if (name.equals("sequence")) {
2713          this.sequence = castToPositiveInt(value); // PositiveIntType
2714        } else if (name.equals("type")) {
2715          this.getType().add(castToCodeableConcept(value));
2716        } else if (name.equals("date")) {
2717          this.date = castToDateTime(value); // DateTimeType
2718        } else if (name.equals("procedure[x]")) {
2719          this.procedure = castToType(value); // Type
2720        } else if (name.equals("udi")) {
2721          this.getUdi().add(castToReference(value));
2722        } else
2723          return super.setProperty(name, value);
2724        return value;
2725      }
2726
2727      @Override
2728      public Base makeProperty(int hash, String name) throws FHIRException {
2729        switch (hash) {
2730        case 1349547969:  return getSequenceElement();
2731        case 3575610:  return addType(); 
2732        case 3076014:  return getDateElement();
2733        case 1640074445:  return getProcedure(); 
2734        case -1095204141:  return getProcedure(); 
2735        case 115642:  return addUdi(); 
2736        default: return super.makeProperty(hash, name);
2737        }
2738
2739      }
2740
2741      @Override
2742      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2743        switch (hash) {
2744        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2745        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2746        case 3076014: /*date*/ return new String[] {"dateTime"};
2747        case -1095204141: /*procedure*/ return new String[] {"CodeableConcept", "Reference"};
2748        case 115642: /*udi*/ return new String[] {"Reference"};
2749        default: return super.getTypesForProperty(hash, name);
2750        }
2751
2752      }
2753
2754      @Override
2755      public Base addChild(String name) throws FHIRException {
2756        if (name.equals("sequence")) {
2757          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
2758        }
2759        else if (name.equals("type")) {
2760          return addType();
2761        }
2762        else if (name.equals("date")) {
2763          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
2764        }
2765        else if (name.equals("procedureCodeableConcept")) {
2766          this.procedure = new CodeableConcept();
2767          return this.procedure;
2768        }
2769        else if (name.equals("procedureReference")) {
2770          this.procedure = new Reference();
2771          return this.procedure;
2772        }
2773        else if (name.equals("udi")) {
2774          return addUdi();
2775        }
2776        else
2777          return super.addChild(name);
2778      }
2779
2780      public ProcedureComponent copy() {
2781        ProcedureComponent dst = new ProcedureComponent();
2782        copyValues(dst);
2783        return dst;
2784      }
2785
2786      public void copyValues(ProcedureComponent dst) {
2787        super.copyValues(dst);
2788        dst.sequence = sequence == null ? null : sequence.copy();
2789        if (type != null) {
2790          dst.type = new ArrayList<CodeableConcept>();
2791          for (CodeableConcept i : type)
2792            dst.type.add(i.copy());
2793        };
2794        dst.date = date == null ? null : date.copy();
2795        dst.procedure = procedure == null ? null : procedure.copy();
2796        if (udi != null) {
2797          dst.udi = new ArrayList<Reference>();
2798          for (Reference i : udi)
2799            dst.udi.add(i.copy());
2800        };
2801      }
2802
2803      @Override
2804      public boolean equalsDeep(Base other_) {
2805        if (!super.equalsDeep(other_))
2806          return false;
2807        if (!(other_ instanceof ProcedureComponent))
2808          return false;
2809        ProcedureComponent o = (ProcedureComponent) other_;
2810        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(date, o.date, true)
2811           && compareDeep(procedure, o.procedure, true) && compareDeep(udi, o.udi, true);
2812      }
2813
2814      @Override
2815      public boolean equalsShallow(Base other_) {
2816        if (!super.equalsShallow(other_))
2817          return false;
2818        if (!(other_ instanceof ProcedureComponent))
2819          return false;
2820        ProcedureComponent o = (ProcedureComponent) other_;
2821        return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
2822      }
2823
2824      public boolean isEmpty() {
2825        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, date, procedure
2826          , udi);
2827      }
2828
2829  public String fhirType() {
2830    return "ExplanationOfBenefit.procedure";
2831
2832  }
2833
2834  }
2835
2836    @Block()
2837    public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
2838        /**
2839         * A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2840         */
2841        @Child(name = "focal", type = {BooleanType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2842        @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." )
2843        protected BooleanType focal;
2844
2845        /**
2846         * 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.
2847         */
2848        @Child(name = "coverage", type = {Coverage.class}, order=2, min=1, max=1, modifier=false, summary=true)
2849        @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." )
2850        protected Reference coverage;
2851
2852        /**
2853         * 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.)
2854         */
2855        protected Coverage coverageTarget;
2856
2857        /**
2858         * 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.
2859         */
2860        @Child(name = "preAuthRef", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2861        @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." )
2862        protected List<StringType> preAuthRef;
2863
2864        private static final long serialVersionUID = -606383626L;
2865
2866    /**
2867     * Constructor
2868     */
2869      public InsuranceComponent() {
2870        super();
2871      }
2872
2873    /**
2874     * Constructor
2875     */
2876      public InsuranceComponent(BooleanType focal, Reference coverage) {
2877        super();
2878        this.focal = focal;
2879        this.coverage = coverage;
2880      }
2881
2882        /**
2883         * @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
2884         */
2885        public BooleanType getFocalElement() { 
2886          if (this.focal == null)
2887            if (Configuration.errorOnAutoCreate())
2888              throw new Error("Attempt to auto-create InsuranceComponent.focal");
2889            else if (Configuration.doAutoCreate())
2890              this.focal = new BooleanType(); // bb
2891          return this.focal;
2892        }
2893
2894        public boolean hasFocalElement() { 
2895          return this.focal != null && !this.focal.isEmpty();
2896        }
2897
2898        public boolean hasFocal() { 
2899          return this.focal != null && !this.focal.isEmpty();
2900        }
2901
2902        /**
2903         * @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
2904         */
2905        public InsuranceComponent setFocalElement(BooleanType value) { 
2906          this.focal = value;
2907          return this;
2908        }
2909
2910        /**
2911         * @return A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2912         */
2913        public boolean getFocal() { 
2914          return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
2915        }
2916
2917        /**
2918         * @param value A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2919         */
2920        public InsuranceComponent setFocal(boolean value) { 
2921            if (this.focal == null)
2922              this.focal = new BooleanType();
2923            this.focal.setValue(value);
2924          return this;
2925        }
2926
2927        /**
2928         * @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.)
2929         */
2930        public Reference getCoverage() { 
2931          if (this.coverage == null)
2932            if (Configuration.errorOnAutoCreate())
2933              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2934            else if (Configuration.doAutoCreate())
2935              this.coverage = new Reference(); // cc
2936          return this.coverage;
2937        }
2938
2939        public boolean hasCoverage() { 
2940          return this.coverage != null && !this.coverage.isEmpty();
2941        }
2942
2943        /**
2944         * @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.)
2945         */
2946        public InsuranceComponent setCoverage(Reference value) { 
2947          this.coverage = value;
2948          return this;
2949        }
2950
2951        /**
2952         * @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.)
2953         */
2954        public Coverage getCoverageTarget() { 
2955          if (this.coverageTarget == null)
2956            if (Configuration.errorOnAutoCreate())
2957              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2958            else if (Configuration.doAutoCreate())
2959              this.coverageTarget = new Coverage(); // aa
2960          return this.coverageTarget;
2961        }
2962
2963        /**
2964         * @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.)
2965         */
2966        public InsuranceComponent setCoverageTarget(Coverage value) { 
2967          this.coverageTarget = value;
2968          return this;
2969        }
2970
2971        /**
2972         * @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.)
2973         */
2974        public List<StringType> getPreAuthRef() { 
2975          if (this.preAuthRef == null)
2976            this.preAuthRef = new ArrayList<StringType>();
2977          return this.preAuthRef;
2978        }
2979
2980        /**
2981         * @return Returns a reference to <code>this</code> for easy method chaining
2982         */
2983        public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) { 
2984          this.preAuthRef = thePreAuthRef;
2985          return this;
2986        }
2987
2988        public boolean hasPreAuthRef() { 
2989          if (this.preAuthRef == null)
2990            return false;
2991          for (StringType item : this.preAuthRef)
2992            if (!item.isEmpty())
2993              return true;
2994          return false;
2995        }
2996
2997        /**
2998         * @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.)
2999         */
3000        public StringType addPreAuthRefElement() {//2 
3001          StringType t = new StringType();
3002          if (this.preAuthRef == null)
3003            this.preAuthRef = new ArrayList<StringType>();
3004          this.preAuthRef.add(t);
3005          return t;
3006        }
3007
3008        /**
3009         * @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.)
3010         */
3011        public InsuranceComponent addPreAuthRef(String value) { //1
3012          StringType t = new StringType();
3013          t.setValue(value);
3014          if (this.preAuthRef == null)
3015            this.preAuthRef = new ArrayList<StringType>();
3016          this.preAuthRef.add(t);
3017          return this;
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 boolean hasPreAuthRef(String value) { 
3024          if (this.preAuthRef == null)
3025            return false;
3026          for (StringType v : this.preAuthRef)
3027            if (v.getValue().equals(value)) // string
3028              return true;
3029          return false;
3030        }
3031
3032        protected void listChildren(List<Property> children) {
3033          super.listChildren(children);
3034          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));
3035          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));
3036          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));
3037        }
3038
3039        @Override
3040        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3041          switch (_hash) {
3042          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);
3043          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);
3044          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);
3045          default: return super.getNamedProperty(_hash, _name, _checkValid);
3046          }
3047
3048        }
3049
3050      @Override
3051      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3052        switch (hash) {
3053        case 97604197: /*focal*/ return this.focal == null ? new Base[0] : new Base[] {this.focal}; // BooleanType
3054        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
3055        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
3056        default: return super.getProperty(hash, name, checkValid);
3057        }
3058
3059      }
3060
3061      @Override
3062      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3063        switch (hash) {
3064        case 97604197: // focal
3065          this.focal = castToBoolean(value); // BooleanType
3066          return value;
3067        case -351767064: // coverage
3068          this.coverage = castToReference(value); // Reference
3069          return value;
3070        case 522246568: // preAuthRef
3071          this.getPreAuthRef().add(castToString(value)); // StringType
3072          return value;
3073        default: return super.setProperty(hash, name, value);
3074        }
3075
3076      }
3077
3078      @Override
3079      public Base setProperty(String name, Base value) throws FHIRException {
3080        if (name.equals("focal")) {
3081          this.focal = castToBoolean(value); // BooleanType
3082        } else if (name.equals("coverage")) {
3083          this.coverage = castToReference(value); // Reference
3084        } else if (name.equals("preAuthRef")) {
3085          this.getPreAuthRef().add(castToString(value));
3086        } else
3087          return super.setProperty(name, value);
3088        return value;
3089      }
3090
3091      @Override
3092      public Base makeProperty(int hash, String name) throws FHIRException {
3093        switch (hash) {
3094        case 97604197:  return getFocalElement();
3095        case -351767064:  return getCoverage(); 
3096        case 522246568:  return addPreAuthRefElement();
3097        default: return super.makeProperty(hash, name);
3098        }
3099
3100      }
3101
3102      @Override
3103      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3104        switch (hash) {
3105        case 97604197: /*focal*/ return new String[] {"boolean"};
3106        case -351767064: /*coverage*/ return new String[] {"Reference"};
3107        case 522246568: /*preAuthRef*/ return new String[] {"string"};
3108        default: return super.getTypesForProperty(hash, name);
3109        }
3110
3111      }
3112
3113      @Override
3114      public Base addChild(String name) throws FHIRException {
3115        if (name.equals("focal")) {
3116          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.focal");
3117        }
3118        else if (name.equals("coverage")) {
3119          this.coverage = new Reference();
3120          return this.coverage;
3121        }
3122        else if (name.equals("preAuthRef")) {
3123          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
3124        }
3125        else
3126          return super.addChild(name);
3127      }
3128
3129      public InsuranceComponent copy() {
3130        InsuranceComponent dst = new InsuranceComponent();
3131        copyValues(dst);
3132        return dst;
3133      }
3134
3135      public void copyValues(InsuranceComponent dst) {
3136        super.copyValues(dst);
3137        dst.focal = focal == null ? null : focal.copy();
3138        dst.coverage = coverage == null ? null : coverage.copy();
3139        if (preAuthRef != null) {
3140          dst.preAuthRef = new ArrayList<StringType>();
3141          for (StringType i : preAuthRef)
3142            dst.preAuthRef.add(i.copy());
3143        };
3144      }
3145
3146      @Override
3147      public boolean equalsDeep(Base other_) {
3148        if (!super.equalsDeep(other_))
3149          return false;
3150        if (!(other_ instanceof InsuranceComponent))
3151          return false;
3152        InsuranceComponent o = (InsuranceComponent) other_;
3153        return compareDeep(focal, o.focal, true) && compareDeep(coverage, o.coverage, true) && compareDeep(preAuthRef, o.preAuthRef, true)
3154          ;
3155      }
3156
3157      @Override
3158      public boolean equalsShallow(Base other_) {
3159        if (!super.equalsShallow(other_))
3160          return false;
3161        if (!(other_ instanceof InsuranceComponent))
3162          return false;
3163        InsuranceComponent o = (InsuranceComponent) other_;
3164        return compareValues(focal, o.focal, true) && compareValues(preAuthRef, o.preAuthRef, true);
3165      }
3166
3167      public boolean isEmpty() {
3168        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(focal, coverage, preAuthRef
3169          );
3170      }
3171
3172  public String fhirType() {
3173    return "ExplanationOfBenefit.insurance";
3174
3175  }
3176
3177  }
3178
3179    @Block()
3180    public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
3181        /**
3182         * Date of an accident event  related to the products and services contained in the claim.
3183         */
3184        @Child(name = "date", type = {DateType.class}, order=1, min=0, max=1, modifier=false, summary=false)
3185        @Description(shortDefinition="When the incident occurred", formalDefinition="Date of an accident event  related to the products and services contained in the claim." )
3186        protected DateType date;
3187
3188        /**
3189         * The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.
3190         */
3191        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
3192        @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." )
3193        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActIncidentCode")
3194        protected CodeableConcept type;
3195
3196        /**
3197         * The physical location of the accident event.
3198         */
3199        @Child(name = "location", type = {Address.class, Location.class}, order=3, min=0, max=1, modifier=false, summary=false)
3200        @Description(shortDefinition="Where the event occurred", formalDefinition="The physical location of the accident event." )
3201        protected Type location;
3202
3203        private static final long serialVersionUID = 622904984L;
3204
3205    /**
3206     * Constructor
3207     */
3208      public AccidentComponent() {
3209        super();
3210      }
3211
3212        /**
3213         * @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
3214         */
3215        public DateType getDateElement() { 
3216          if (this.date == null)
3217            if (Configuration.errorOnAutoCreate())
3218              throw new Error("Attempt to auto-create AccidentComponent.date");
3219            else if (Configuration.doAutoCreate())
3220              this.date = new DateType(); // bb
3221          return this.date;
3222        }
3223
3224        public boolean hasDateElement() { 
3225          return this.date != null && !this.date.isEmpty();
3226        }
3227
3228        public boolean hasDate() { 
3229          return this.date != null && !this.date.isEmpty();
3230        }
3231
3232        /**
3233         * @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
3234         */
3235        public AccidentComponent setDateElement(DateType value) { 
3236          this.date = value;
3237          return this;
3238        }
3239
3240        /**
3241         * @return Date of an accident event  related to the products and services contained in the claim.
3242         */
3243        public Date getDate() { 
3244          return this.date == null ? null : this.date.getValue();
3245        }
3246
3247        /**
3248         * @param value Date of an accident event  related to the products and services contained in the claim.
3249         */
3250        public AccidentComponent setDate(Date value) { 
3251          if (value == null)
3252            this.date = null;
3253          else {
3254            if (this.date == null)
3255              this.date = new DateType();
3256            this.date.setValue(value);
3257          }
3258          return this;
3259        }
3260
3261        /**
3262         * @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.)
3263         */
3264        public CodeableConcept getType() { 
3265          if (this.type == null)
3266            if (Configuration.errorOnAutoCreate())
3267              throw new Error("Attempt to auto-create AccidentComponent.type");
3268            else if (Configuration.doAutoCreate())
3269              this.type = new CodeableConcept(); // cc
3270          return this.type;
3271        }
3272
3273        public boolean hasType() { 
3274          return this.type != null && !this.type.isEmpty();
3275        }
3276
3277        /**
3278         * @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.)
3279         */
3280        public AccidentComponent setType(CodeableConcept value) { 
3281          this.type = value;
3282          return this;
3283        }
3284
3285        /**
3286         * @return {@link #location} (The physical location of the accident event.)
3287         */
3288        public Type getLocation() { 
3289          return this.location;
3290        }
3291
3292        /**
3293         * @return {@link #location} (The physical location of the accident event.)
3294         */
3295        public Address getLocationAddress() throws FHIRException { 
3296          if (this.location == null)
3297            this.location = new Address();
3298          if (!(this.location instanceof Address))
3299            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
3300          return (Address) this.location;
3301        }
3302
3303        public boolean hasLocationAddress() { 
3304          return this != null && this.location instanceof Address;
3305        }
3306
3307        /**
3308         * @return {@link #location} (The physical location of the accident event.)
3309         */
3310        public Reference getLocationReference() throws FHIRException { 
3311          if (this.location == null)
3312            this.location = new Reference();
3313          if (!(this.location instanceof Reference))
3314            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
3315          return (Reference) this.location;
3316        }
3317
3318        public boolean hasLocationReference() { 
3319          return this != null && this.location instanceof Reference;
3320        }
3321
3322        public boolean hasLocation() { 
3323          return this.location != null && !this.location.isEmpty();
3324        }
3325
3326        /**
3327         * @param value {@link #location} (The physical location of the accident event.)
3328         */
3329        public AccidentComponent setLocation(Type value) { 
3330          if (value != null && !(value instanceof Address || value instanceof Reference))
3331            throw new Error("Not the right type for ExplanationOfBenefit.accident.location[x]: "+value.fhirType());
3332          this.location = value;
3333          return this;
3334        }
3335
3336        protected void listChildren(List<Property> children) {
3337          super.listChildren(children);
3338          children.add(new Property("date", "date", "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date));
3339          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));
3340          children.add(new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location));
3341        }
3342
3343        @Override
3344        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3345          switch (_hash) {
3346          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);
3347          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);
3348          case 552316075: /*location[x]*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3349          case 1901043637: /*location*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3350          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3351          case 755866390: /*locationReference*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3352          default: return super.getNamedProperty(_hash, _name, _checkValid);
3353          }
3354
3355        }
3356
3357      @Override
3358      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3359        switch (hash) {
3360        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
3361        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3362        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
3363        default: return super.getProperty(hash, name, checkValid);
3364        }
3365
3366      }
3367
3368      @Override
3369      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3370        switch (hash) {
3371        case 3076014: // date
3372          this.date = castToDate(value); // DateType
3373          return value;
3374        case 3575610: // type
3375          this.type = castToCodeableConcept(value); // CodeableConcept
3376          return value;
3377        case 1901043637: // location
3378          this.location = castToType(value); // Type
3379          return value;
3380        default: return super.setProperty(hash, name, value);
3381        }
3382
3383      }
3384
3385      @Override
3386      public Base setProperty(String name, Base value) throws FHIRException {
3387        if (name.equals("date")) {
3388          this.date = castToDate(value); // DateType
3389        } else if (name.equals("type")) {
3390          this.type = castToCodeableConcept(value); // CodeableConcept
3391        } else if (name.equals("location[x]")) {
3392          this.location = castToType(value); // Type
3393        } else
3394          return super.setProperty(name, value);
3395        return value;
3396      }
3397
3398      @Override
3399      public Base makeProperty(int hash, String name) throws FHIRException {
3400        switch (hash) {
3401        case 3076014:  return getDateElement();
3402        case 3575610:  return getType(); 
3403        case 552316075:  return getLocation(); 
3404        case 1901043637:  return getLocation(); 
3405        default: return super.makeProperty(hash, name);
3406        }
3407
3408      }
3409
3410      @Override
3411      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3412        switch (hash) {
3413        case 3076014: /*date*/ return new String[] {"date"};
3414        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3415        case 1901043637: /*location*/ return new String[] {"Address", "Reference"};
3416        default: return super.getTypesForProperty(hash, name);
3417        }
3418
3419      }
3420
3421      @Override
3422      public Base addChild(String name) throws FHIRException {
3423        if (name.equals("date")) {
3424          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
3425        }
3426        else if (name.equals("type")) {
3427          this.type = new CodeableConcept();
3428          return this.type;
3429        }
3430        else if (name.equals("locationAddress")) {
3431          this.location = new Address();
3432          return this.location;
3433        }
3434        else if (name.equals("locationReference")) {
3435          this.location = new Reference();
3436          return this.location;
3437        }
3438        else
3439          return super.addChild(name);
3440      }
3441
3442      public AccidentComponent copy() {
3443        AccidentComponent dst = new AccidentComponent();
3444        copyValues(dst);
3445        return dst;
3446      }
3447
3448      public void copyValues(AccidentComponent dst) {
3449        super.copyValues(dst);
3450        dst.date = date == null ? null : date.copy();
3451        dst.type = type == null ? null : type.copy();
3452        dst.location = location == null ? null : location.copy();
3453      }
3454
3455      @Override
3456      public boolean equalsDeep(Base other_) {
3457        if (!super.equalsDeep(other_))
3458          return false;
3459        if (!(other_ instanceof AccidentComponent))
3460          return false;
3461        AccidentComponent o = (AccidentComponent) other_;
3462        return compareDeep(date, o.date, true) && compareDeep(type, o.type, true) && compareDeep(location, o.location, true)
3463          ;
3464      }
3465
3466      @Override
3467      public boolean equalsShallow(Base other_) {
3468        if (!super.equalsShallow(other_))
3469          return false;
3470        if (!(other_ instanceof AccidentComponent))
3471          return false;
3472        AccidentComponent o = (AccidentComponent) other_;
3473        return compareValues(date, o.date, true);
3474      }
3475
3476      public boolean isEmpty() {
3477        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
3478      }
3479
3480  public String fhirType() {
3481    return "ExplanationOfBenefit.accident";
3482
3483  }
3484
3485  }
3486
3487    @Block()
3488    public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
3489        /**
3490         * A number to uniquely identify item entries.
3491         */
3492        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
3493        @Description(shortDefinition="Item instance identifier", formalDefinition="A number to uniquely identify item entries." )
3494        protected PositiveIntType sequence;
3495
3496        /**
3497         * Care team members related to this service or product.
3498         */
3499        @Child(name = "careTeamSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3500        @Description(shortDefinition="Applicable care team members", formalDefinition="Care team members related to this service or product." )
3501        protected List<PositiveIntType> careTeamSequence;
3502
3503        /**
3504         * Diagnoses applicable for this service or product.
3505         */
3506        @Child(name = "diagnosisSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3507        @Description(shortDefinition="Applicable diagnoses", formalDefinition="Diagnoses applicable for this service or product." )
3508        protected List<PositiveIntType> diagnosisSequence;
3509
3510        /**
3511         * Procedures applicable for this service or product.
3512         */
3513        @Child(name = "procedureSequence", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3514        @Description(shortDefinition="Applicable procedures", formalDefinition="Procedures applicable for this service or product." )
3515        protected List<PositiveIntType> procedureSequence;
3516
3517        /**
3518         * Exceptions, special conditions and supporting information applicable for this service or product.
3519         */
3520        @Child(name = "informationSequence", type = {PositiveIntType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3521        @Description(shortDefinition="Applicable exception and supporting information", formalDefinition="Exceptions, special conditions and supporting information applicable for this service or product." )
3522        protected List<PositiveIntType> informationSequence;
3523
3524        /**
3525         * The type of revenue or cost center providing the product and/or service.
3526         */
3527        @Child(name = "revenue", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
3528        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
3529        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
3530        protected CodeableConcept revenue;
3531
3532        /**
3533         * Code to identify the general type of benefits under which products and services are provided.
3534         */
3535        @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
3536        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
3537        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
3538        protected CodeableConcept category;
3539
3540        /**
3541         * 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.
3542         */
3543        @Child(name = "productOrService", type = {CodeableConcept.class}, order=8, min=1, max=1, modifier=false, summary=false)
3544        @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." )
3545        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
3546        protected CodeableConcept productOrService;
3547
3548        /**
3549         * Item typification or modifiers codes to convey additional context for the product or service.
3550         */
3551        @Child(name = "modifier", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3552        @Description(shortDefinition="Product or service billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
3553        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
3554        protected List<CodeableConcept> modifier;
3555
3556        /**
3557         * Identifies the program under which this may be recovered.
3558         */
3559        @Child(name = "programCode", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3560        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
3561        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
3562        protected List<CodeableConcept> programCode;
3563
3564        /**
3565         * The date or dates when the service or product was supplied, performed or completed.
3566         */
3567        @Child(name = "serviced", type = {DateType.class, Period.class}, order=11, min=0, max=1, modifier=false, summary=false)
3568        @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." )
3569        protected Type serviced;
3570
3571        /**
3572         * Where the product or service was provided.
3573         */
3574        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
3575        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
3576        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
3577        protected Type location;
3578
3579        /**
3580         * The number of repetitions of a service or product.
3581         */
3582        @Child(name = "quantity", type = {Quantity.class}, order=13, min=0, max=1, modifier=false, summary=false)
3583        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
3584        protected Quantity quantity;
3585
3586        /**
3587         * 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.
3588         */
3589        @Child(name = "unitPrice", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
3590        @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." )
3591        protected Money unitPrice;
3592
3593        /**
3594         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3595         */
3596        @Child(name = "factor", type = {DecimalType.class}, order=15, min=0, max=1, modifier=false, summary=false)
3597        @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." )
3598        protected DecimalType factor;
3599
3600        /**
3601         * The quantity times the unit price for an additional service or product or charge.
3602         */
3603        @Child(name = "net", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=false)
3604        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
3605        protected Money net;
3606
3607        /**
3608         * Unique Device Identifiers associated with this line item.
3609         */
3610        @Child(name = "udi", type = {Device.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3611        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
3612        protected List<Reference> udi;
3613        /**
3614         * The actual objects that are the target of the reference (Unique Device Identifiers associated with this line item.)
3615         */
3616        protected List<Device> udiTarget;
3617
3618
3619        /**
3620         * Physical service site on the patient (limb, tooth, etc.).
3621         */
3622        @Child(name = "bodySite", type = {CodeableConcept.class}, order=18, min=0, max=1, modifier=false, summary=false)
3623        @Description(shortDefinition="Anatomical location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
3624        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
3625        protected CodeableConcept bodySite;
3626
3627        /**
3628         * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
3629         */
3630        @Child(name = "subSite", type = {CodeableConcept.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3631        @Description(shortDefinition="Anatomical sub-location", formalDefinition="A region or surface of the bodySite, e.g. limb region or tooth surface(s)." )
3632        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
3633        protected List<CodeableConcept> subSite;
3634
3635        /**
3636         * A billed item may include goods or services provided in multiple encounters.
3637         */
3638        @Child(name = "encounter", type = {Encounter.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3639        @Description(shortDefinition="Encounters related to this billed item", formalDefinition="A billed item may include goods or services provided in multiple encounters." )
3640        protected List<Reference> encounter;
3641        /**
3642         * The actual objects that are the target of the reference (A billed item may include goods or services provided in multiple encounters.)
3643         */
3644        protected List<Encounter> encounterTarget;
3645
3646
3647        /**
3648         * The numbers associated with notes below which apply to the adjudication of this item.
3649         */
3650        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3651        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
3652        protected List<PositiveIntType> noteNumber;
3653
3654        /**
3655         * 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.
3656         */
3657        @Child(name = "adjudication", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3658        @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." )
3659        protected List<AdjudicationComponent> adjudication;
3660
3661        /**
3662         * Second-tier of goods and services.
3663         */
3664        @Child(name = "detail", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3665        @Description(shortDefinition="Additional items", formalDefinition="Second-tier of goods and services." )
3666        protected List<DetailComponent> detail;
3667
3668        private static final long serialVersionUID = 67419471L;
3669
3670    /**
3671     * Constructor
3672     */
3673      public ItemComponent() {
3674        super();
3675      }
3676
3677    /**
3678     * Constructor
3679     */
3680      public ItemComponent(PositiveIntType sequence, CodeableConcept productOrService) {
3681        super();
3682        this.sequence = sequence;
3683        this.productOrService = productOrService;
3684      }
3685
3686        /**
3687         * @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
3688         */
3689        public PositiveIntType getSequenceElement() { 
3690          if (this.sequence == null)
3691            if (Configuration.errorOnAutoCreate())
3692              throw new Error("Attempt to auto-create ItemComponent.sequence");
3693            else if (Configuration.doAutoCreate())
3694              this.sequence = new PositiveIntType(); // bb
3695          return this.sequence;
3696        }
3697
3698        public boolean hasSequenceElement() { 
3699          return this.sequence != null && !this.sequence.isEmpty();
3700        }
3701
3702        public boolean hasSequence() { 
3703          return this.sequence != null && !this.sequence.isEmpty();
3704        }
3705
3706        /**
3707         * @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
3708         */
3709        public ItemComponent setSequenceElement(PositiveIntType value) { 
3710          this.sequence = value;
3711          return this;
3712        }
3713
3714        /**
3715         * @return A number to uniquely identify item entries.
3716         */
3717        public int getSequence() { 
3718          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3719        }
3720
3721        /**
3722         * @param value A number to uniquely identify item entries.
3723         */
3724        public ItemComponent setSequence(int value) { 
3725            if (this.sequence == null)
3726              this.sequence = new PositiveIntType();
3727            this.sequence.setValue(value);
3728          return this;
3729        }
3730
3731        /**
3732         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3733         */
3734        public List<PositiveIntType> getCareTeamSequence() { 
3735          if (this.careTeamSequence == null)
3736            this.careTeamSequence = new ArrayList<PositiveIntType>();
3737          return this.careTeamSequence;
3738        }
3739
3740        /**
3741         * @return Returns a reference to <code>this</code> for easy method chaining
3742         */
3743        public ItemComponent setCareTeamSequence(List<PositiveIntType> theCareTeamSequence) { 
3744          this.careTeamSequence = theCareTeamSequence;
3745          return this;
3746        }
3747
3748        public boolean hasCareTeamSequence() { 
3749          if (this.careTeamSequence == null)
3750            return false;
3751          for (PositiveIntType item : this.careTeamSequence)
3752            if (!item.isEmpty())
3753              return true;
3754          return false;
3755        }
3756
3757        /**
3758         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3759         */
3760        public PositiveIntType addCareTeamSequenceElement() {//2 
3761          PositiveIntType t = new PositiveIntType();
3762          if (this.careTeamSequence == null)
3763            this.careTeamSequence = new ArrayList<PositiveIntType>();
3764          this.careTeamSequence.add(t);
3765          return t;
3766        }
3767
3768        /**
3769         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3770         */
3771        public ItemComponent addCareTeamSequence(int value) { //1
3772          PositiveIntType t = new PositiveIntType();
3773          t.setValue(value);
3774          if (this.careTeamSequence == null)
3775            this.careTeamSequence = new ArrayList<PositiveIntType>();
3776          this.careTeamSequence.add(t);
3777          return this;
3778        }
3779
3780        /**
3781         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3782         */
3783        public boolean hasCareTeamSequence(int value) { 
3784          if (this.careTeamSequence == null)
3785            return false;
3786          for (PositiveIntType v : this.careTeamSequence)
3787            if (v.getValue().equals(value)) // positiveInt
3788              return true;
3789          return false;
3790        }
3791
3792        /**
3793         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3794         */
3795        public List<PositiveIntType> getDiagnosisSequence() { 
3796          if (this.diagnosisSequence == null)
3797            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3798          return this.diagnosisSequence;
3799        }
3800
3801        /**
3802         * @return Returns a reference to <code>this</code> for easy method chaining
3803         */
3804        public ItemComponent setDiagnosisSequence(List<PositiveIntType> theDiagnosisSequence) { 
3805          this.diagnosisSequence = theDiagnosisSequence;
3806          return this;
3807        }
3808
3809        public boolean hasDiagnosisSequence() { 
3810          if (this.diagnosisSequence == null)
3811            return false;
3812          for (PositiveIntType item : this.diagnosisSequence)
3813            if (!item.isEmpty())
3814              return true;
3815          return false;
3816        }
3817
3818        /**
3819         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3820         */
3821        public PositiveIntType addDiagnosisSequenceElement() {//2 
3822          PositiveIntType t = new PositiveIntType();
3823          if (this.diagnosisSequence == null)
3824            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3825          this.diagnosisSequence.add(t);
3826          return t;
3827        }
3828
3829        /**
3830         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3831         */
3832        public ItemComponent addDiagnosisSequence(int value) { //1
3833          PositiveIntType t = new PositiveIntType();
3834          t.setValue(value);
3835          if (this.diagnosisSequence == null)
3836            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3837          this.diagnosisSequence.add(t);
3838          return this;
3839        }
3840
3841        /**
3842         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3843         */
3844        public boolean hasDiagnosisSequence(int value) { 
3845          if (this.diagnosisSequence == null)
3846            return false;
3847          for (PositiveIntType v : this.diagnosisSequence)
3848            if (v.getValue().equals(value)) // positiveInt
3849              return true;
3850          return false;
3851        }
3852
3853        /**
3854         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3855         */
3856        public List<PositiveIntType> getProcedureSequence() { 
3857          if (this.procedureSequence == null)
3858            this.procedureSequence = new ArrayList<PositiveIntType>();
3859          return this.procedureSequence;
3860        }
3861
3862        /**
3863         * @return Returns a reference to <code>this</code> for easy method chaining
3864         */
3865        public ItemComponent setProcedureSequence(List<PositiveIntType> theProcedureSequence) { 
3866          this.procedureSequence = theProcedureSequence;
3867          return this;
3868        }
3869
3870        public boolean hasProcedureSequence() { 
3871          if (this.procedureSequence == null)
3872            return false;
3873          for (PositiveIntType item : this.procedureSequence)
3874            if (!item.isEmpty())
3875              return true;
3876          return false;
3877        }
3878
3879        /**
3880         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3881         */
3882        public PositiveIntType addProcedureSequenceElement() {//2 
3883          PositiveIntType t = new PositiveIntType();
3884          if (this.procedureSequence == null)
3885            this.procedureSequence = new ArrayList<PositiveIntType>();
3886          this.procedureSequence.add(t);
3887          return t;
3888        }
3889
3890        /**
3891         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3892         */
3893        public ItemComponent addProcedureSequence(int value) { //1
3894          PositiveIntType t = new PositiveIntType();
3895          t.setValue(value);
3896          if (this.procedureSequence == null)
3897            this.procedureSequence = new ArrayList<PositiveIntType>();
3898          this.procedureSequence.add(t);
3899          return this;
3900        }
3901
3902        /**
3903         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3904         */
3905        public boolean hasProcedureSequence(int value) { 
3906          if (this.procedureSequence == null)
3907            return false;
3908          for (PositiveIntType v : this.procedureSequence)
3909            if (v.getValue().equals(value)) // positiveInt
3910              return true;
3911          return false;
3912        }
3913
3914        /**
3915         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3916         */
3917        public List<PositiveIntType> getInformationSequence() { 
3918          if (this.informationSequence == null)
3919            this.informationSequence = new ArrayList<PositiveIntType>();
3920          return this.informationSequence;
3921        }
3922
3923        /**
3924         * @return Returns a reference to <code>this</code> for easy method chaining
3925         */
3926        public ItemComponent setInformationSequence(List<PositiveIntType> theInformationSequence) { 
3927          this.informationSequence = theInformationSequence;
3928          return this;
3929        }
3930
3931        public boolean hasInformationSequence() { 
3932          if (this.informationSequence == null)
3933            return false;
3934          for (PositiveIntType item : this.informationSequence)
3935            if (!item.isEmpty())
3936              return true;
3937          return false;
3938        }
3939
3940        /**
3941         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3942         */
3943        public PositiveIntType addInformationSequenceElement() {//2 
3944          PositiveIntType t = new PositiveIntType();
3945          if (this.informationSequence == null)
3946            this.informationSequence = new ArrayList<PositiveIntType>();
3947          this.informationSequence.add(t);
3948          return t;
3949        }
3950
3951        /**
3952         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3953         */
3954        public ItemComponent addInformationSequence(int value) { //1
3955          PositiveIntType t = new PositiveIntType();
3956          t.setValue(value);
3957          if (this.informationSequence == null)
3958            this.informationSequence = new ArrayList<PositiveIntType>();
3959          this.informationSequence.add(t);
3960          return this;
3961        }
3962
3963        /**
3964         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3965         */
3966        public boolean hasInformationSequence(int value) { 
3967          if (this.informationSequence == null)
3968            return false;
3969          for (PositiveIntType v : this.informationSequence)
3970            if (v.getValue().equals(value)) // positiveInt
3971              return true;
3972          return false;
3973        }
3974
3975        /**
3976         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3977         */
3978        public CodeableConcept getRevenue() { 
3979          if (this.revenue == null)
3980            if (Configuration.errorOnAutoCreate())
3981              throw new Error("Attempt to auto-create ItemComponent.revenue");
3982            else if (Configuration.doAutoCreate())
3983              this.revenue = new CodeableConcept(); // cc
3984          return this.revenue;
3985        }
3986
3987        public boolean hasRevenue() { 
3988          return this.revenue != null && !this.revenue.isEmpty();
3989        }
3990
3991        /**
3992         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3993         */
3994        public ItemComponent setRevenue(CodeableConcept value) { 
3995          this.revenue = value;
3996          return this;
3997        }
3998
3999        /**
4000         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
4001         */
4002        public CodeableConcept getCategory() { 
4003          if (this.category == null)
4004            if (Configuration.errorOnAutoCreate())
4005              throw new Error("Attempt to auto-create ItemComponent.category");
4006            else if (Configuration.doAutoCreate())
4007              this.category = new CodeableConcept(); // cc
4008          return this.category;
4009        }
4010
4011        public boolean hasCategory() { 
4012          return this.category != null && !this.category.isEmpty();
4013        }
4014
4015        /**
4016         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
4017         */
4018        public ItemComponent setCategory(CodeableConcept value) { 
4019          this.category = value;
4020          return this;
4021        }
4022
4023        /**
4024         * @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.)
4025         */
4026        public CodeableConcept getProductOrService() { 
4027          if (this.productOrService == null)
4028            if (Configuration.errorOnAutoCreate())
4029              throw new Error("Attempt to auto-create ItemComponent.productOrService");
4030            else if (Configuration.doAutoCreate())
4031              this.productOrService = new CodeableConcept(); // cc
4032          return this.productOrService;
4033        }
4034
4035        public boolean hasProductOrService() { 
4036          return this.productOrService != null && !this.productOrService.isEmpty();
4037        }
4038
4039        /**
4040         * @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.)
4041         */
4042        public ItemComponent setProductOrService(CodeableConcept value) { 
4043          this.productOrService = value;
4044          return this;
4045        }
4046
4047        /**
4048         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
4049         */
4050        public List<CodeableConcept> getModifier() { 
4051          if (this.modifier == null)
4052            this.modifier = new ArrayList<CodeableConcept>();
4053          return this.modifier;
4054        }
4055
4056        /**
4057         * @return Returns a reference to <code>this</code> for easy method chaining
4058         */
4059        public ItemComponent setModifier(List<CodeableConcept> theModifier) { 
4060          this.modifier = theModifier;
4061          return this;
4062        }
4063
4064        public boolean hasModifier() { 
4065          if (this.modifier == null)
4066            return false;
4067          for (CodeableConcept item : this.modifier)
4068            if (!item.isEmpty())
4069              return true;
4070          return false;
4071        }
4072
4073        public CodeableConcept addModifier() { //3
4074          CodeableConcept t = new CodeableConcept();
4075          if (this.modifier == null)
4076            this.modifier = new ArrayList<CodeableConcept>();
4077          this.modifier.add(t);
4078          return t;
4079        }
4080
4081        public ItemComponent addModifier(CodeableConcept t) { //3
4082          if (t == null)
4083            return this;
4084          if (this.modifier == null)
4085            this.modifier = new ArrayList<CodeableConcept>();
4086          this.modifier.add(t);
4087          return this;
4088        }
4089
4090        /**
4091         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
4092         */
4093        public CodeableConcept getModifierFirstRep() { 
4094          if (getModifier().isEmpty()) {
4095            addModifier();
4096          }
4097          return getModifier().get(0);
4098        }
4099
4100        /**
4101         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
4102         */
4103        public List<CodeableConcept> getProgramCode() { 
4104          if (this.programCode == null)
4105            this.programCode = new ArrayList<CodeableConcept>();
4106          return this.programCode;
4107        }
4108
4109        /**
4110         * @return Returns a reference to <code>this</code> for easy method chaining
4111         */
4112        public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
4113          this.programCode = theProgramCode;
4114          return this;
4115        }
4116
4117        public boolean hasProgramCode() { 
4118          if (this.programCode == null)
4119            return false;
4120          for (CodeableConcept item : this.programCode)
4121            if (!item.isEmpty())
4122              return true;
4123          return false;
4124        }
4125
4126        public CodeableConcept addProgramCode() { //3
4127          CodeableConcept t = new CodeableConcept();
4128          if (this.programCode == null)
4129            this.programCode = new ArrayList<CodeableConcept>();
4130          this.programCode.add(t);
4131          return t;
4132        }
4133
4134        public ItemComponent addProgramCode(CodeableConcept t) { //3
4135          if (t == null)
4136            return this;
4137          if (this.programCode == null)
4138            this.programCode = new ArrayList<CodeableConcept>();
4139          this.programCode.add(t);
4140          return this;
4141        }
4142
4143        /**
4144         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
4145         */
4146        public CodeableConcept getProgramCodeFirstRep() { 
4147          if (getProgramCode().isEmpty()) {
4148            addProgramCode();
4149          }
4150          return getProgramCode().get(0);
4151        }
4152
4153        /**
4154         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4155         */
4156        public Type getServiced() { 
4157          return this.serviced;
4158        }
4159
4160        /**
4161         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4162         */
4163        public DateType getServicedDateType() throws FHIRException { 
4164          if (this.serviced == null)
4165            this.serviced = new DateType();
4166          if (!(this.serviced instanceof DateType))
4167            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
4168          return (DateType) this.serviced;
4169        }
4170
4171        public boolean hasServicedDateType() { 
4172          return this != null && this.serviced instanceof DateType;
4173        }
4174
4175        /**
4176         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4177         */
4178        public Period getServicedPeriod() throws FHIRException { 
4179          if (this.serviced == null)
4180            this.serviced = new Period();
4181          if (!(this.serviced instanceof Period))
4182            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
4183          return (Period) this.serviced;
4184        }
4185
4186        public boolean hasServicedPeriod() { 
4187          return this != null && this.serviced instanceof Period;
4188        }
4189
4190        public boolean hasServiced() { 
4191          return this.serviced != null && !this.serviced.isEmpty();
4192        }
4193
4194        /**
4195         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4196         */
4197        public ItemComponent setServiced(Type value) { 
4198          if (value != null && !(value instanceof DateType || value instanceof Period))
4199            throw new Error("Not the right type for ExplanationOfBenefit.item.serviced[x]: "+value.fhirType());
4200          this.serviced = value;
4201          return this;
4202        }
4203
4204        /**
4205         * @return {@link #location} (Where the product or service was provided.)
4206         */
4207        public Type getLocation() { 
4208          return this.location;
4209        }
4210
4211        /**
4212         * @return {@link #location} (Where the product or service was provided.)
4213         */
4214        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
4215          if (this.location == null)
4216            this.location = new CodeableConcept();
4217          if (!(this.location instanceof CodeableConcept))
4218            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
4219          return (CodeableConcept) this.location;
4220        }
4221
4222        public boolean hasLocationCodeableConcept() { 
4223          return this != null && this.location instanceof CodeableConcept;
4224        }
4225
4226        /**
4227         * @return {@link #location} (Where the product or service was provided.)
4228         */
4229        public Address getLocationAddress() throws FHIRException { 
4230          if (this.location == null)
4231            this.location = new Address();
4232          if (!(this.location instanceof Address))
4233            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
4234          return (Address) this.location;
4235        }
4236
4237        public boolean hasLocationAddress() { 
4238          return this != null && this.location instanceof Address;
4239        }
4240
4241        /**
4242         * @return {@link #location} (Where the product or service was provided.)
4243         */
4244        public Reference getLocationReference() throws FHIRException { 
4245          if (this.location == null)
4246            this.location = new Reference();
4247          if (!(this.location instanceof Reference))
4248            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
4249          return (Reference) this.location;
4250        }
4251
4252        public boolean hasLocationReference() { 
4253          return this != null && this.location instanceof Reference;
4254        }
4255
4256        public boolean hasLocation() { 
4257          return this.location != null && !this.location.isEmpty();
4258        }
4259
4260        /**
4261         * @param value {@link #location} (Where the product or service was provided.)
4262         */
4263        public ItemComponent setLocation(Type value) { 
4264          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
4265            throw new Error("Not the right type for ExplanationOfBenefit.item.location[x]: "+value.fhirType());
4266          this.location = value;
4267          return this;
4268        }
4269
4270        /**
4271         * @return {@link #quantity} (The number of repetitions of a service or product.)
4272         */
4273        public Quantity getQuantity() { 
4274          if (this.quantity == null)
4275            if (Configuration.errorOnAutoCreate())
4276              throw new Error("Attempt to auto-create ItemComponent.quantity");
4277            else if (Configuration.doAutoCreate())
4278              this.quantity = new Quantity(); // cc
4279          return this.quantity;
4280        }
4281
4282        public boolean hasQuantity() { 
4283          return this.quantity != null && !this.quantity.isEmpty();
4284        }
4285
4286        /**
4287         * @param value {@link #quantity} (The number of repetitions of a service or product.)
4288         */
4289        public ItemComponent setQuantity(Quantity value) { 
4290          this.quantity = value;
4291          return this;
4292        }
4293
4294        /**
4295         * @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.)
4296         */
4297        public Money getUnitPrice() { 
4298          if (this.unitPrice == null)
4299            if (Configuration.errorOnAutoCreate())
4300              throw new Error("Attempt to auto-create ItemComponent.unitPrice");
4301            else if (Configuration.doAutoCreate())
4302              this.unitPrice = new Money(); // cc
4303          return this.unitPrice;
4304        }
4305
4306        public boolean hasUnitPrice() { 
4307          return this.unitPrice != null && !this.unitPrice.isEmpty();
4308        }
4309
4310        /**
4311         * @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.)
4312         */
4313        public ItemComponent setUnitPrice(Money value) { 
4314          this.unitPrice = value;
4315          return this;
4316        }
4317
4318        /**
4319         * @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
4320         */
4321        public DecimalType getFactorElement() { 
4322          if (this.factor == null)
4323            if (Configuration.errorOnAutoCreate())
4324              throw new Error("Attempt to auto-create ItemComponent.factor");
4325            else if (Configuration.doAutoCreate())
4326              this.factor = new DecimalType(); // bb
4327          return this.factor;
4328        }
4329
4330        public boolean hasFactorElement() { 
4331          return this.factor != null && !this.factor.isEmpty();
4332        }
4333
4334        public boolean hasFactor() { 
4335          return this.factor != null && !this.factor.isEmpty();
4336        }
4337
4338        /**
4339         * @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
4340         */
4341        public ItemComponent setFactorElement(DecimalType value) { 
4342          this.factor = value;
4343          return this;
4344        }
4345
4346        /**
4347         * @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.
4348         */
4349        public BigDecimal getFactor() { 
4350          return this.factor == null ? null : this.factor.getValue();
4351        }
4352
4353        /**
4354         * @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.
4355         */
4356        public ItemComponent setFactor(BigDecimal value) { 
4357          if (value == null)
4358            this.factor = null;
4359          else {
4360            if (this.factor == null)
4361              this.factor = new DecimalType();
4362            this.factor.setValue(value);
4363          }
4364          return this;
4365        }
4366
4367        /**
4368         * @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.
4369         */
4370        public ItemComponent setFactor(long value) { 
4371              this.factor = new DecimalType();
4372            this.factor.setValue(value);
4373          return this;
4374        }
4375
4376        /**
4377         * @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.
4378         */
4379        public ItemComponent setFactor(double value) { 
4380              this.factor = new DecimalType();
4381            this.factor.setValue(value);
4382          return this;
4383        }
4384
4385        /**
4386         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4387         */
4388        public Money getNet() { 
4389          if (this.net == null)
4390            if (Configuration.errorOnAutoCreate())
4391              throw new Error("Attempt to auto-create ItemComponent.net");
4392            else if (Configuration.doAutoCreate())
4393              this.net = new Money(); // cc
4394          return this.net;
4395        }
4396
4397        public boolean hasNet() { 
4398          return this.net != null && !this.net.isEmpty();
4399        }
4400
4401        /**
4402         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4403         */
4404        public ItemComponent setNet(Money value) { 
4405          this.net = value;
4406          return this;
4407        }
4408
4409        /**
4410         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
4411         */
4412        public List<Reference> getUdi() { 
4413          if (this.udi == null)
4414            this.udi = new ArrayList<Reference>();
4415          return this.udi;
4416        }
4417
4418        /**
4419         * @return Returns a reference to <code>this</code> for easy method chaining
4420         */
4421        public ItemComponent setUdi(List<Reference> theUdi) { 
4422          this.udi = theUdi;
4423          return this;
4424        }
4425
4426        public boolean hasUdi() { 
4427          if (this.udi == null)
4428            return false;
4429          for (Reference item : this.udi)
4430            if (!item.isEmpty())
4431              return true;
4432          return false;
4433        }
4434
4435        public Reference addUdi() { //3
4436          Reference t = new Reference();
4437          if (this.udi == null)
4438            this.udi = new ArrayList<Reference>();
4439          this.udi.add(t);
4440          return t;
4441        }
4442
4443        public ItemComponent addUdi(Reference t) { //3
4444          if (t == null)
4445            return this;
4446          if (this.udi == null)
4447            this.udi = new ArrayList<Reference>();
4448          this.udi.add(t);
4449          return this;
4450        }
4451
4452        /**
4453         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
4454         */
4455        public Reference getUdiFirstRep() { 
4456          if (getUdi().isEmpty()) {
4457            addUdi();
4458          }
4459          return getUdi().get(0);
4460        }
4461
4462        /**
4463         * @deprecated Use Reference#setResource(IBaseResource) instead
4464         */
4465        @Deprecated
4466        public List<Device> getUdiTarget() { 
4467          if (this.udiTarget == null)
4468            this.udiTarget = new ArrayList<Device>();
4469          return this.udiTarget;
4470        }
4471
4472        /**
4473         * @deprecated Use Reference#setResource(IBaseResource) instead
4474         */
4475        @Deprecated
4476        public Device addUdiTarget() { 
4477          Device r = new Device();
4478          if (this.udiTarget == null)
4479            this.udiTarget = new ArrayList<Device>();
4480          this.udiTarget.add(r);
4481          return r;
4482        }
4483
4484        /**
4485         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4486         */
4487        public CodeableConcept getBodySite() { 
4488          if (this.bodySite == null)
4489            if (Configuration.errorOnAutoCreate())
4490              throw new Error("Attempt to auto-create ItemComponent.bodySite");
4491            else if (Configuration.doAutoCreate())
4492              this.bodySite = new CodeableConcept(); // cc
4493          return this.bodySite;
4494        }
4495
4496        public boolean hasBodySite() { 
4497          return this.bodySite != null && !this.bodySite.isEmpty();
4498        }
4499
4500        /**
4501         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4502         */
4503        public ItemComponent setBodySite(CodeableConcept value) { 
4504          this.bodySite = value;
4505          return this;
4506        }
4507
4508        /**
4509         * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb region or tooth surface(s).)
4510         */
4511        public List<CodeableConcept> getSubSite() { 
4512          if (this.subSite == null)
4513            this.subSite = new ArrayList<CodeableConcept>();
4514          return this.subSite;
4515        }
4516
4517        /**
4518         * @return Returns a reference to <code>this</code> for easy method chaining
4519         */
4520        public ItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
4521          this.subSite = theSubSite;
4522          return this;
4523        }
4524
4525        public boolean hasSubSite() { 
4526          if (this.subSite == null)
4527            return false;
4528          for (CodeableConcept item : this.subSite)
4529            if (!item.isEmpty())
4530              return true;
4531          return false;
4532        }
4533
4534        public CodeableConcept addSubSite() { //3
4535          CodeableConcept t = new CodeableConcept();
4536          if (this.subSite == null)
4537            this.subSite = new ArrayList<CodeableConcept>();
4538          this.subSite.add(t);
4539          return t;
4540        }
4541
4542        public ItemComponent addSubSite(CodeableConcept t) { //3
4543          if (t == null)
4544            return this;
4545          if (this.subSite == null)
4546            this.subSite = new ArrayList<CodeableConcept>();
4547          this.subSite.add(t);
4548          return this;
4549        }
4550
4551        /**
4552         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist
4553         */
4554        public CodeableConcept getSubSiteFirstRep() { 
4555          if (getSubSite().isEmpty()) {
4556            addSubSite();
4557          }
4558          return getSubSite().get(0);
4559        }
4560
4561        /**
4562         * @return {@link #encounter} (A billed item may include goods or services provided in multiple encounters.)
4563         */
4564        public List<Reference> getEncounter() { 
4565          if (this.encounter == null)
4566            this.encounter = new ArrayList<Reference>();
4567          return this.encounter;
4568        }
4569
4570        /**
4571         * @return Returns a reference to <code>this</code> for easy method chaining
4572         */
4573        public ItemComponent setEncounter(List<Reference> theEncounter) { 
4574          this.encounter = theEncounter;
4575          return this;
4576        }
4577
4578        public boolean hasEncounter() { 
4579          if (this.encounter == null)
4580            return false;
4581          for (Reference item : this.encounter)
4582            if (!item.isEmpty())
4583              return true;
4584          return false;
4585        }
4586
4587        public Reference addEncounter() { //3
4588          Reference t = new Reference();
4589          if (this.encounter == null)
4590            this.encounter = new ArrayList<Reference>();
4591          this.encounter.add(t);
4592          return t;
4593        }
4594
4595        public ItemComponent addEncounter(Reference t) { //3
4596          if (t == null)
4597            return this;
4598          if (this.encounter == null)
4599            this.encounter = new ArrayList<Reference>();
4600          this.encounter.add(t);
4601          return this;
4602        }
4603
4604        /**
4605         * @return The first repetition of repeating field {@link #encounter}, creating it if it does not already exist
4606         */
4607        public Reference getEncounterFirstRep() { 
4608          if (getEncounter().isEmpty()) {
4609            addEncounter();
4610          }
4611          return getEncounter().get(0);
4612        }
4613
4614        /**
4615         * @deprecated Use Reference#setResource(IBaseResource) instead
4616         */
4617        @Deprecated
4618        public List<Encounter> getEncounterTarget() { 
4619          if (this.encounterTarget == null)
4620            this.encounterTarget = new ArrayList<Encounter>();
4621          return this.encounterTarget;
4622        }
4623
4624        /**
4625         * @deprecated Use Reference#setResource(IBaseResource) instead
4626         */
4627        @Deprecated
4628        public Encounter addEncounterTarget() { 
4629          Encounter r = new Encounter();
4630          if (this.encounterTarget == null)
4631            this.encounterTarget = new ArrayList<Encounter>();
4632          this.encounterTarget.add(r);
4633          return r;
4634        }
4635
4636        /**
4637         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4638         */
4639        public List<PositiveIntType> getNoteNumber() { 
4640          if (this.noteNumber == null)
4641            this.noteNumber = new ArrayList<PositiveIntType>();
4642          return this.noteNumber;
4643        }
4644
4645        /**
4646         * @return Returns a reference to <code>this</code> for easy method chaining
4647         */
4648        public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
4649          this.noteNumber = theNoteNumber;
4650          return this;
4651        }
4652
4653        public boolean hasNoteNumber() { 
4654          if (this.noteNumber == null)
4655            return false;
4656          for (PositiveIntType item : this.noteNumber)
4657            if (!item.isEmpty())
4658              return true;
4659          return false;
4660        }
4661
4662        /**
4663         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4664         */
4665        public PositiveIntType addNoteNumberElement() {//2 
4666          PositiveIntType t = new PositiveIntType();
4667          if (this.noteNumber == null)
4668            this.noteNumber = new ArrayList<PositiveIntType>();
4669          this.noteNumber.add(t);
4670          return t;
4671        }
4672
4673        /**
4674         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4675         */
4676        public ItemComponent addNoteNumber(int value) { //1
4677          PositiveIntType t = new PositiveIntType();
4678          t.setValue(value);
4679          if (this.noteNumber == null)
4680            this.noteNumber = new ArrayList<PositiveIntType>();
4681          this.noteNumber.add(t);
4682          return this;
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 boolean hasNoteNumber(int value) { 
4689          if (this.noteNumber == null)
4690            return false;
4691          for (PositiveIntType v : this.noteNumber)
4692            if (v.getValue().equals(value)) // positiveInt
4693              return true;
4694          return false;
4695        }
4696
4697        /**
4698         * @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.)
4699         */
4700        public List<AdjudicationComponent> getAdjudication() { 
4701          if (this.adjudication == null)
4702            this.adjudication = new ArrayList<AdjudicationComponent>();
4703          return this.adjudication;
4704        }
4705
4706        /**
4707         * @return Returns a reference to <code>this</code> for easy method chaining
4708         */
4709        public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
4710          this.adjudication = theAdjudication;
4711          return this;
4712        }
4713
4714        public boolean hasAdjudication() { 
4715          if (this.adjudication == null)
4716            return false;
4717          for (AdjudicationComponent item : this.adjudication)
4718            if (!item.isEmpty())
4719              return true;
4720          return false;
4721        }
4722
4723        public AdjudicationComponent addAdjudication() { //3
4724          AdjudicationComponent t = new AdjudicationComponent();
4725          if (this.adjudication == null)
4726            this.adjudication = new ArrayList<AdjudicationComponent>();
4727          this.adjudication.add(t);
4728          return t;
4729        }
4730
4731        public ItemComponent addAdjudication(AdjudicationComponent t) { //3
4732          if (t == null)
4733            return this;
4734          if (this.adjudication == null)
4735            this.adjudication = new ArrayList<AdjudicationComponent>();
4736          this.adjudication.add(t);
4737          return this;
4738        }
4739
4740        /**
4741         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
4742         */
4743        public AdjudicationComponent getAdjudicationFirstRep() { 
4744          if (getAdjudication().isEmpty()) {
4745            addAdjudication();
4746          }
4747          return getAdjudication().get(0);
4748        }
4749
4750        /**
4751         * @return {@link #detail} (Second-tier of goods and services.)
4752         */
4753        public List<DetailComponent> getDetail() { 
4754          if (this.detail == null)
4755            this.detail = new ArrayList<DetailComponent>();
4756          return this.detail;
4757        }
4758
4759        /**
4760         * @return Returns a reference to <code>this</code> for easy method chaining
4761         */
4762        public ItemComponent setDetail(List<DetailComponent> theDetail) { 
4763          this.detail = theDetail;
4764          return this;
4765        }
4766
4767        public boolean hasDetail() { 
4768          if (this.detail == null)
4769            return false;
4770          for (DetailComponent item : this.detail)
4771            if (!item.isEmpty())
4772              return true;
4773          return false;
4774        }
4775
4776        public DetailComponent addDetail() { //3
4777          DetailComponent t = new DetailComponent();
4778          if (this.detail == null)
4779            this.detail = new ArrayList<DetailComponent>();
4780          this.detail.add(t);
4781          return t;
4782        }
4783
4784        public ItemComponent addDetail(DetailComponent t) { //3
4785          if (t == null)
4786            return this;
4787          if (this.detail == null)
4788            this.detail = new ArrayList<DetailComponent>();
4789          this.detail.add(t);
4790          return this;
4791        }
4792
4793        /**
4794         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
4795         */
4796        public DetailComponent getDetailFirstRep() { 
4797          if (getDetail().isEmpty()) {
4798            addDetail();
4799          }
4800          return getDetail().get(0);
4801        }
4802
4803        protected void listChildren(List<Property> children) {
4804          super.listChildren(children);
4805          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence));
4806          children.add(new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence));
4807          children.add(new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence));
4808          children.add(new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence));
4809          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));
4810          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
4811          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
4812          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));
4813          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));
4814          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
4815          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));
4816          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location));
4817          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
4818          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));
4819          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));
4820          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
4821          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
4822          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
4823          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));
4824          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));
4825          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));
4826          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));
4827          children.add(new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
4828        }
4829
4830        @Override
4831        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4832          switch (_hash) {
4833          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence);
4834          case 1070083823: /*careTeamSequence*/  return new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence);
4835          case -909769262: /*diagnosisSequence*/  return new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence);
4836          case -808920140: /*procedureSequence*/  return new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence);
4837          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);
4838          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
4839          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);
4840          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);
4841          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);
4842          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
4843          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);
4844          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);
4845          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);
4846          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);
4847          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4848          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4849          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4850          case -1280020865: /*locationAddress*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4851          case 755866390: /*locationReference*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4852          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
4853          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);
4854          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);
4855          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);
4856          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
4857          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
4858          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);
4859          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);
4860          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);
4861          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);
4862          case -1335224239: /*detail*/  return new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail);
4863          default: return super.getNamedProperty(_hash, _name, _checkValid);
4864          }
4865
4866        }
4867
4868      @Override
4869      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4870        switch (hash) {
4871        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
4872        case 1070083823: /*careTeamSequence*/ return this.careTeamSequence == null ? new Base[0] : this.careTeamSequence.toArray(new Base[this.careTeamSequence.size()]); // PositiveIntType
4873        case -909769262: /*diagnosisSequence*/ return this.diagnosisSequence == null ? new Base[0] : this.diagnosisSequence.toArray(new Base[this.diagnosisSequence.size()]); // PositiveIntType
4874        case -808920140: /*procedureSequence*/ return this.procedureSequence == null ? new Base[0] : this.procedureSequence.toArray(new Base[this.procedureSequence.size()]); // PositiveIntType
4875        case -702585587: /*informationSequence*/ return this.informationSequence == null ? new Base[0] : this.informationSequence.toArray(new Base[this.informationSequence.size()]); // PositiveIntType
4876        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
4877        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4878        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
4879        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
4880        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
4881        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
4882        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
4883        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
4884        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
4885        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
4886        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
4887        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
4888        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
4889        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
4890        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
4891        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
4892        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
4893        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
4894        default: return super.getProperty(hash, name, checkValid);
4895        }
4896
4897      }
4898
4899      @Override
4900      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4901        switch (hash) {
4902        case 1349547969: // sequence
4903          this.sequence = castToPositiveInt(value); // PositiveIntType
4904          return value;
4905        case 1070083823: // careTeamSequence
4906          this.getCareTeamSequence().add(castToPositiveInt(value)); // PositiveIntType
4907          return value;
4908        case -909769262: // diagnosisSequence
4909          this.getDiagnosisSequence().add(castToPositiveInt(value)); // PositiveIntType
4910          return value;
4911        case -808920140: // procedureSequence
4912          this.getProcedureSequence().add(castToPositiveInt(value)); // PositiveIntType
4913          return value;
4914        case -702585587: // informationSequence
4915          this.getInformationSequence().add(castToPositiveInt(value)); // PositiveIntType
4916          return value;
4917        case 1099842588: // revenue
4918          this.revenue = castToCodeableConcept(value); // CodeableConcept
4919          return value;
4920        case 50511102: // category
4921          this.category = castToCodeableConcept(value); // CodeableConcept
4922          return value;
4923        case 1957227299: // productOrService
4924          this.productOrService = castToCodeableConcept(value); // CodeableConcept
4925          return value;
4926        case -615513385: // modifier
4927          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
4928          return value;
4929        case 1010065041: // programCode
4930          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
4931          return value;
4932        case 1379209295: // serviced
4933          this.serviced = castToType(value); // Type
4934          return value;
4935        case 1901043637: // location
4936          this.location = castToType(value); // Type
4937          return value;
4938        case -1285004149: // quantity
4939          this.quantity = castToQuantity(value); // Quantity
4940          return value;
4941        case -486196699: // unitPrice
4942          this.unitPrice = castToMoney(value); // Money
4943          return value;
4944        case -1282148017: // factor
4945          this.factor = castToDecimal(value); // DecimalType
4946          return value;
4947        case 108957: // net
4948          this.net = castToMoney(value); // Money
4949          return value;
4950        case 115642: // udi
4951          this.getUdi().add(castToReference(value)); // Reference
4952          return value;
4953        case 1702620169: // bodySite
4954          this.bodySite = castToCodeableConcept(value); // CodeableConcept
4955          return value;
4956        case -1868566105: // subSite
4957          this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
4958          return value;
4959        case 1524132147: // encounter
4960          this.getEncounter().add(castToReference(value)); // Reference
4961          return value;
4962        case -1110033957: // noteNumber
4963          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
4964          return value;
4965        case -231349275: // adjudication
4966          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
4967          return value;
4968        case -1335224239: // detail
4969          this.getDetail().add((DetailComponent) value); // DetailComponent
4970          return value;
4971        default: return super.setProperty(hash, name, value);
4972        }
4973
4974      }
4975
4976      @Override
4977      public Base setProperty(String name, Base value) throws FHIRException {
4978        if (name.equals("sequence")) {
4979          this.sequence = castToPositiveInt(value); // PositiveIntType
4980        } else if (name.equals("careTeamSequence")) {
4981          this.getCareTeamSequence().add(castToPositiveInt(value));
4982        } else if (name.equals("diagnosisSequence")) {
4983          this.getDiagnosisSequence().add(castToPositiveInt(value));
4984        } else if (name.equals("procedureSequence")) {
4985          this.getProcedureSequence().add(castToPositiveInt(value));
4986        } else if (name.equals("informationSequence")) {
4987          this.getInformationSequence().add(castToPositiveInt(value));
4988        } else if (name.equals("revenue")) {
4989          this.revenue = castToCodeableConcept(value); // CodeableConcept
4990        } else if (name.equals("category")) {
4991          this.category = castToCodeableConcept(value); // CodeableConcept
4992        } else if (name.equals("productOrService")) {
4993          this.productOrService = castToCodeableConcept(value); // CodeableConcept
4994        } else if (name.equals("modifier")) {
4995          this.getModifier().add(castToCodeableConcept(value));
4996        } else if (name.equals("programCode")) {
4997          this.getProgramCode().add(castToCodeableConcept(value));
4998        } else if (name.equals("serviced[x]")) {
4999          this.serviced = castToType(value); // Type
5000        } else if (name.equals("location[x]")) {
5001          this.location = castToType(value); // Type
5002        } else if (name.equals("quantity")) {
5003          this.quantity = castToQuantity(value); // Quantity
5004        } else if (name.equals("unitPrice")) {
5005          this.unitPrice = castToMoney(value); // Money
5006        } else if (name.equals("factor")) {
5007          this.factor = castToDecimal(value); // DecimalType
5008        } else if (name.equals("net")) {
5009          this.net = castToMoney(value); // Money
5010        } else if (name.equals("udi")) {
5011          this.getUdi().add(castToReference(value));
5012        } else if (name.equals("bodySite")) {
5013          this.bodySite = castToCodeableConcept(value); // CodeableConcept
5014        } else if (name.equals("subSite")) {
5015          this.getSubSite().add(castToCodeableConcept(value));
5016        } else if (name.equals("encounter")) {
5017          this.getEncounter().add(castToReference(value));
5018        } else if (name.equals("noteNumber")) {
5019          this.getNoteNumber().add(castToPositiveInt(value));
5020        } else if (name.equals("adjudication")) {
5021          this.getAdjudication().add((AdjudicationComponent) value);
5022        } else if (name.equals("detail")) {
5023          this.getDetail().add((DetailComponent) value);
5024        } else
5025          return super.setProperty(name, value);
5026        return value;
5027      }
5028
5029      @Override
5030      public Base makeProperty(int hash, String name) throws FHIRException {
5031        switch (hash) {
5032        case 1349547969:  return getSequenceElement();
5033        case 1070083823:  return addCareTeamSequenceElement();
5034        case -909769262:  return addDiagnosisSequenceElement();
5035        case -808920140:  return addProcedureSequenceElement();
5036        case -702585587:  return addInformationSequenceElement();
5037        case 1099842588:  return getRevenue(); 
5038        case 50511102:  return getCategory(); 
5039        case 1957227299:  return getProductOrService(); 
5040        case -615513385:  return addModifier(); 
5041        case 1010065041:  return addProgramCode(); 
5042        case -1927922223:  return getServiced(); 
5043        case 1379209295:  return getServiced(); 
5044        case 552316075:  return getLocation(); 
5045        case 1901043637:  return getLocation(); 
5046        case -1285004149:  return getQuantity(); 
5047        case -486196699:  return getUnitPrice(); 
5048        case -1282148017:  return getFactorElement();
5049        case 108957:  return getNet(); 
5050        case 115642:  return addUdi(); 
5051        case 1702620169:  return getBodySite(); 
5052        case -1868566105:  return addSubSite(); 
5053        case 1524132147:  return addEncounter(); 
5054        case -1110033957:  return addNoteNumberElement();
5055        case -231349275:  return addAdjudication(); 
5056        case -1335224239:  return addDetail(); 
5057        default: return super.makeProperty(hash, name);
5058        }
5059
5060      }
5061
5062      @Override
5063      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5064        switch (hash) {
5065        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
5066        case 1070083823: /*careTeamSequence*/ return new String[] {"positiveInt"};
5067        case -909769262: /*diagnosisSequence*/ return new String[] {"positiveInt"};
5068        case -808920140: /*procedureSequence*/ return new String[] {"positiveInt"};
5069        case -702585587: /*informationSequence*/ return new String[] {"positiveInt"};
5070        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
5071        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5072        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
5073        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
5074        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
5075        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
5076        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
5077        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
5078        case -486196699: /*unitPrice*/ return new String[] {"Money"};
5079        case -1282148017: /*factor*/ return new String[] {"decimal"};
5080        case 108957: /*net*/ return new String[] {"Money"};
5081        case 115642: /*udi*/ return new String[] {"Reference"};
5082        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
5083        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
5084        case 1524132147: /*encounter*/ return new String[] {"Reference"};
5085        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
5086        case -231349275: /*adjudication*/ return new String[] {};
5087        case -1335224239: /*detail*/ return new String[] {};
5088        default: return super.getTypesForProperty(hash, name);
5089        }
5090
5091      }
5092
5093      @Override
5094      public Base addChild(String name) throws FHIRException {
5095        if (name.equals("sequence")) {
5096          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
5097        }
5098        else if (name.equals("careTeamSequence")) {
5099          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.careTeamSequence");
5100        }
5101        else if (name.equals("diagnosisSequence")) {
5102          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.diagnosisSequence");
5103        }
5104        else if (name.equals("procedureSequence")) {
5105          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedureSequence");
5106        }
5107        else if (name.equals("informationSequence")) {
5108          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.informationSequence");
5109        }
5110        else if (name.equals("revenue")) {
5111          this.revenue = new CodeableConcept();
5112          return this.revenue;
5113        }
5114        else if (name.equals("category")) {
5115          this.category = new CodeableConcept();
5116          return this.category;
5117        }
5118        else if (name.equals("productOrService")) {
5119          this.productOrService = new CodeableConcept();
5120          return this.productOrService;
5121        }
5122        else if (name.equals("modifier")) {
5123          return addModifier();
5124        }
5125        else if (name.equals("programCode")) {
5126          return addProgramCode();
5127        }
5128        else if (name.equals("servicedDate")) {
5129          this.serviced = new DateType();
5130          return this.serviced;
5131        }
5132        else if (name.equals("servicedPeriod")) {
5133          this.serviced = new Period();
5134          return this.serviced;
5135        }
5136        else if (name.equals("locationCodeableConcept")) {
5137          this.location = new CodeableConcept();
5138          return this.location;
5139        }
5140        else if (name.equals("locationAddress")) {
5141          this.location = new Address();
5142          return this.location;
5143        }
5144        else if (name.equals("locationReference")) {
5145          this.location = new Reference();
5146          return this.location;
5147        }
5148        else if (name.equals("quantity")) {
5149          this.quantity = new Quantity();
5150          return this.quantity;
5151        }
5152        else if (name.equals("unitPrice")) {
5153          this.unitPrice = new Money();
5154          return this.unitPrice;
5155        }
5156        else if (name.equals("factor")) {
5157          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
5158        }
5159        else if (name.equals("net")) {
5160          this.net = new Money();
5161          return this.net;
5162        }
5163        else if (name.equals("udi")) {
5164          return addUdi();
5165        }
5166        else if (name.equals("bodySite")) {
5167          this.bodySite = new CodeableConcept();
5168          return this.bodySite;
5169        }
5170        else if (name.equals("subSite")) {
5171          return addSubSite();
5172        }
5173        else if (name.equals("encounter")) {
5174          return addEncounter();
5175        }
5176        else if (name.equals("noteNumber")) {
5177          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
5178        }
5179        else if (name.equals("adjudication")) {
5180          return addAdjudication();
5181        }
5182        else if (name.equals("detail")) {
5183          return addDetail();
5184        }
5185        else
5186          return super.addChild(name);
5187      }
5188
5189      public ItemComponent copy() {
5190        ItemComponent dst = new ItemComponent();
5191        copyValues(dst);
5192        return dst;
5193      }
5194
5195      public void copyValues(ItemComponent dst) {
5196        super.copyValues(dst);
5197        dst.sequence = sequence == null ? null : sequence.copy();
5198        if (careTeamSequence != null) {
5199          dst.careTeamSequence = new ArrayList<PositiveIntType>();
5200          for (PositiveIntType i : careTeamSequence)
5201            dst.careTeamSequence.add(i.copy());
5202        };
5203        if (diagnosisSequence != null) {
5204          dst.diagnosisSequence = new ArrayList<PositiveIntType>();
5205          for (PositiveIntType i : diagnosisSequence)
5206            dst.diagnosisSequence.add(i.copy());
5207        };
5208        if (procedureSequence != null) {
5209          dst.procedureSequence = new ArrayList<PositiveIntType>();
5210          for (PositiveIntType i : procedureSequence)
5211            dst.procedureSequence.add(i.copy());
5212        };
5213        if (informationSequence != null) {
5214          dst.informationSequence = new ArrayList<PositiveIntType>();
5215          for (PositiveIntType i : informationSequence)
5216            dst.informationSequence.add(i.copy());
5217        };
5218        dst.revenue = revenue == null ? null : revenue.copy();
5219        dst.category = category == null ? null : category.copy();
5220        dst.productOrService = productOrService == null ? null : productOrService.copy();
5221        if (modifier != null) {
5222          dst.modifier = new ArrayList<CodeableConcept>();
5223          for (CodeableConcept i : modifier)
5224            dst.modifier.add(i.copy());
5225        };
5226        if (programCode != null) {
5227          dst.programCode = new ArrayList<CodeableConcept>();
5228          for (CodeableConcept i : programCode)
5229            dst.programCode.add(i.copy());
5230        };
5231        dst.serviced = serviced == null ? null : serviced.copy();
5232        dst.location = location == null ? null : location.copy();
5233        dst.quantity = quantity == null ? null : quantity.copy();
5234        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
5235        dst.factor = factor == null ? null : factor.copy();
5236        dst.net = net == null ? null : net.copy();
5237        if (udi != null) {
5238          dst.udi = new ArrayList<Reference>();
5239          for (Reference i : udi)
5240            dst.udi.add(i.copy());
5241        };
5242        dst.bodySite = bodySite == null ? null : bodySite.copy();
5243        if (subSite != null) {
5244          dst.subSite = new ArrayList<CodeableConcept>();
5245          for (CodeableConcept i : subSite)
5246            dst.subSite.add(i.copy());
5247        };
5248        if (encounter != null) {
5249          dst.encounter = new ArrayList<Reference>();
5250          for (Reference i : encounter)
5251            dst.encounter.add(i.copy());
5252        };
5253        if (noteNumber != null) {
5254          dst.noteNumber = new ArrayList<PositiveIntType>();
5255          for (PositiveIntType i : noteNumber)
5256            dst.noteNumber.add(i.copy());
5257        };
5258        if (adjudication != null) {
5259          dst.adjudication = new ArrayList<AdjudicationComponent>();
5260          for (AdjudicationComponent i : adjudication)
5261            dst.adjudication.add(i.copy());
5262        };
5263        if (detail != null) {
5264          dst.detail = new ArrayList<DetailComponent>();
5265          for (DetailComponent i : detail)
5266            dst.detail.add(i.copy());
5267        };
5268      }
5269
5270      @Override
5271      public boolean equalsDeep(Base other_) {
5272        if (!super.equalsDeep(other_))
5273          return false;
5274        if (!(other_ instanceof ItemComponent))
5275          return false;
5276        ItemComponent o = (ItemComponent) other_;
5277        return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamSequence, o.careTeamSequence, true)
5278           && compareDeep(diagnosisSequence, o.diagnosisSequence, true) && compareDeep(procedureSequence, o.procedureSequence, true)
5279           && compareDeep(informationSequence, o.informationSequence, true) && compareDeep(revenue, o.revenue, true)
5280           && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
5281           && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true)
5282           && compareDeep(location, o.location, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
5283           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
5284           && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true) && compareDeep(encounter, o.encounter, true)
5285           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
5286           && compareDeep(detail, o.detail, true);
5287      }
5288
5289      @Override
5290      public boolean equalsShallow(Base other_) {
5291        if (!super.equalsShallow(other_))
5292          return false;
5293        if (!(other_ instanceof ItemComponent))
5294          return false;
5295        ItemComponent o = (ItemComponent) other_;
5296        return compareValues(sequence, o.sequence, true) && compareValues(careTeamSequence, o.careTeamSequence, true)
5297           && compareValues(diagnosisSequence, o.diagnosisSequence, true) && compareValues(procedureSequence, o.procedureSequence, true)
5298           && compareValues(informationSequence, o.informationSequence, true) && compareValues(factor, o.factor, true)
5299           && compareValues(noteNumber, o.noteNumber, true);
5300      }
5301
5302      public boolean isEmpty() {
5303        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamSequence
5304          , diagnosisSequence, procedureSequence, informationSequence, revenue, category, productOrService
5305          , modifier, programCode, serviced, location, quantity, unitPrice, factor, net
5306          , udi, bodySite, subSite, encounter, noteNumber, adjudication, detail);
5307      }
5308
5309  public String fhirType() {
5310    return "ExplanationOfBenefit.item";
5311
5312  }
5313
5314  }
5315
5316    @Block()
5317    public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
5318        /**
5319         * 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.
5320         */
5321        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
5322        @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." )
5323        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
5324        protected CodeableConcept category;
5325
5326        /**
5327         * A code supporting the understanding of the adjudication result and explaining variance from expected amount.
5328         */
5329        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5330        @Description(shortDefinition="Explanation of adjudication outcome", formalDefinition="A code supporting the understanding of the adjudication result and explaining variance from expected amount." )
5331        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-reason")
5332        protected CodeableConcept reason;
5333
5334        /**
5335         * Monetary amount associated with the category.
5336         */
5337        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
5338        @Description(shortDefinition="Monetary amount", formalDefinition="Monetary amount associated with the category." )
5339        protected Money amount;
5340
5341        /**
5342         * A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5343         */
5344        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
5345        @Description(shortDefinition="Non-monitary value", formalDefinition="A non-monetary value associated with the category. Mutually exclusive to the amount element above." )
5346        protected DecimalType value;
5347
5348        private static final long serialVersionUID = 1559898786L;
5349
5350    /**
5351     * Constructor
5352     */
5353      public AdjudicationComponent() {
5354        super();
5355      }
5356
5357    /**
5358     * Constructor
5359     */
5360      public AdjudicationComponent(CodeableConcept category) {
5361        super();
5362        this.category = category;
5363      }
5364
5365        /**
5366         * @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.)
5367         */
5368        public CodeableConcept getCategory() { 
5369          if (this.category == null)
5370            if (Configuration.errorOnAutoCreate())
5371              throw new Error("Attempt to auto-create AdjudicationComponent.category");
5372            else if (Configuration.doAutoCreate())
5373              this.category = new CodeableConcept(); // cc
5374          return this.category;
5375        }
5376
5377        public boolean hasCategory() { 
5378          return this.category != null && !this.category.isEmpty();
5379        }
5380
5381        /**
5382         * @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.)
5383         */
5384        public AdjudicationComponent setCategory(CodeableConcept value) { 
5385          this.category = value;
5386          return this;
5387        }
5388
5389        /**
5390         * @return {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
5391         */
5392        public CodeableConcept getReason() { 
5393          if (this.reason == null)
5394            if (Configuration.errorOnAutoCreate())
5395              throw new Error("Attempt to auto-create AdjudicationComponent.reason");
5396            else if (Configuration.doAutoCreate())
5397              this.reason = new CodeableConcept(); // cc
5398          return this.reason;
5399        }
5400
5401        public boolean hasReason() { 
5402          return this.reason != null && !this.reason.isEmpty();
5403        }
5404
5405        /**
5406         * @param value {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
5407         */
5408        public AdjudicationComponent setReason(CodeableConcept value) { 
5409          this.reason = value;
5410          return this;
5411        }
5412
5413        /**
5414         * @return {@link #amount} (Monetary amount associated with the category.)
5415         */
5416        public Money getAmount() { 
5417          if (this.amount == null)
5418            if (Configuration.errorOnAutoCreate())
5419              throw new Error("Attempt to auto-create AdjudicationComponent.amount");
5420            else if (Configuration.doAutoCreate())
5421              this.amount = new Money(); // cc
5422          return this.amount;
5423        }
5424
5425        public boolean hasAmount() { 
5426          return this.amount != null && !this.amount.isEmpty();
5427        }
5428
5429        /**
5430         * @param value {@link #amount} (Monetary amount associated with the category.)
5431         */
5432        public AdjudicationComponent setAmount(Money value) { 
5433          this.amount = value;
5434          return this;
5435        }
5436
5437        /**
5438         * @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
5439         */
5440        public DecimalType getValueElement() { 
5441          if (this.value == null)
5442            if (Configuration.errorOnAutoCreate())
5443              throw new Error("Attempt to auto-create AdjudicationComponent.value");
5444            else if (Configuration.doAutoCreate())
5445              this.value = new DecimalType(); // bb
5446          return this.value;
5447        }
5448
5449        public boolean hasValueElement() { 
5450          return this.value != null && !this.value.isEmpty();
5451        }
5452
5453        public boolean hasValue() { 
5454          return this.value != null && !this.value.isEmpty();
5455        }
5456
5457        /**
5458         * @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
5459         */
5460        public AdjudicationComponent setValueElement(DecimalType value) { 
5461          this.value = value;
5462          return this;
5463        }
5464
5465        /**
5466         * @return A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5467         */
5468        public BigDecimal getValue() { 
5469          return this.value == null ? null : this.value.getValue();
5470        }
5471
5472        /**
5473         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5474         */
5475        public AdjudicationComponent setValue(BigDecimal value) { 
5476          if (value == null)
5477            this.value = null;
5478          else {
5479            if (this.value == null)
5480              this.value = new DecimalType();
5481            this.value.setValue(value);
5482          }
5483          return this;
5484        }
5485
5486        /**
5487         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5488         */
5489        public AdjudicationComponent setValue(long value) { 
5490              this.value = new DecimalType();
5491            this.value.setValue(value);
5492          return this;
5493        }
5494
5495        /**
5496         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5497         */
5498        public AdjudicationComponent setValue(double value) { 
5499              this.value = new DecimalType();
5500            this.value.setValue(value);
5501          return this;
5502        }
5503
5504        protected void listChildren(List<Property> children) {
5505          super.listChildren(children);
5506          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));
5507          children.add(new Property("reason", "CodeableConcept", "A code supporting the understanding of the adjudication result and explaining variance from expected amount.", 0, 1, reason));
5508          children.add(new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount));
5509          children.add(new Property("value", "decimal", "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1, value));
5510        }
5511
5512        @Override
5513        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5514          switch (_hash) {
5515          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);
5516          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);
5517          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount);
5518          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);
5519          default: return super.getNamedProperty(_hash, _name, _checkValid);
5520          }
5521
5522        }
5523
5524      @Override
5525      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5526        switch (hash) {
5527        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
5528        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
5529        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
5530        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
5531        default: return super.getProperty(hash, name, checkValid);
5532        }
5533
5534      }
5535
5536      @Override
5537      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5538        switch (hash) {
5539        case 50511102: // category
5540          this.category = castToCodeableConcept(value); // CodeableConcept
5541          return value;
5542        case -934964668: // reason
5543          this.reason = castToCodeableConcept(value); // CodeableConcept
5544          return value;
5545        case -1413853096: // amount
5546          this.amount = castToMoney(value); // Money
5547          return value;
5548        case 111972721: // value
5549          this.value = castToDecimal(value); // DecimalType
5550          return value;
5551        default: return super.setProperty(hash, name, value);
5552        }
5553
5554      }
5555
5556      @Override
5557      public Base setProperty(String name, Base value) throws FHIRException {
5558        if (name.equals("category")) {
5559          this.category = castToCodeableConcept(value); // CodeableConcept
5560        } else if (name.equals("reason")) {
5561          this.reason = castToCodeableConcept(value); // CodeableConcept
5562        } else if (name.equals("amount")) {
5563          this.amount = castToMoney(value); // Money
5564        } else if (name.equals("value")) {
5565          this.value = castToDecimal(value); // DecimalType
5566        } else
5567          return super.setProperty(name, value);
5568        return value;
5569      }
5570
5571      @Override
5572      public Base makeProperty(int hash, String name) throws FHIRException {
5573        switch (hash) {
5574        case 50511102:  return getCategory(); 
5575        case -934964668:  return getReason(); 
5576        case -1413853096:  return getAmount(); 
5577        case 111972721:  return getValueElement();
5578        default: return super.makeProperty(hash, name);
5579        }
5580
5581      }
5582
5583      @Override
5584      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5585        switch (hash) {
5586        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5587        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
5588        case -1413853096: /*amount*/ return new String[] {"Money"};
5589        case 111972721: /*value*/ return new String[] {"decimal"};
5590        default: return super.getTypesForProperty(hash, name);
5591        }
5592
5593      }
5594
5595      @Override
5596      public Base addChild(String name) throws FHIRException {
5597        if (name.equals("category")) {
5598          this.category = new CodeableConcept();
5599          return this.category;
5600        }
5601        else if (name.equals("reason")) {
5602          this.reason = new CodeableConcept();
5603          return this.reason;
5604        }
5605        else if (name.equals("amount")) {
5606          this.amount = new Money();
5607          return this.amount;
5608        }
5609        else if (name.equals("value")) {
5610          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
5611        }
5612        else
5613          return super.addChild(name);
5614      }
5615
5616      public AdjudicationComponent copy() {
5617        AdjudicationComponent dst = new AdjudicationComponent();
5618        copyValues(dst);
5619        return dst;
5620      }
5621
5622      public void copyValues(AdjudicationComponent dst) {
5623        super.copyValues(dst);
5624        dst.category = category == null ? null : category.copy();
5625        dst.reason = reason == null ? null : reason.copy();
5626        dst.amount = amount == null ? null : amount.copy();
5627        dst.value = value == null ? null : value.copy();
5628      }
5629
5630      @Override
5631      public boolean equalsDeep(Base other_) {
5632        if (!super.equalsDeep(other_))
5633          return false;
5634        if (!(other_ instanceof AdjudicationComponent))
5635          return false;
5636        AdjudicationComponent o = (AdjudicationComponent) other_;
5637        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
5638           && compareDeep(value, o.value, true);
5639      }
5640
5641      @Override
5642      public boolean equalsShallow(Base other_) {
5643        if (!super.equalsShallow(other_))
5644          return false;
5645        if (!(other_ instanceof AdjudicationComponent))
5646          return false;
5647        AdjudicationComponent o = (AdjudicationComponent) other_;
5648        return compareValues(value, o.value, true);
5649      }
5650
5651      public boolean isEmpty() {
5652        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount
5653          , value);
5654      }
5655
5656  public String fhirType() {
5657    return "ExplanationOfBenefit.item.adjudication";
5658
5659  }
5660
5661  }
5662
5663    @Block()
5664    public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
5665        /**
5666         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5667         */
5668        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
5669        @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." )
5670        protected PositiveIntType sequence;
5671
5672        /**
5673         * The type of revenue or cost center providing the product and/or service.
5674         */
5675        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5676        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
5677        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
5678        protected CodeableConcept revenue;
5679
5680        /**
5681         * Code to identify the general type of benefits under which products and services are provided.
5682         */
5683        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
5684        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
5685        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
5686        protected CodeableConcept category;
5687
5688        /**
5689         * 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.
5690         */
5691        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
5692        @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." )
5693        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
5694        protected CodeableConcept productOrService;
5695
5696        /**
5697         * Item typification or modifiers codes to convey additional context for the product or service.
5698         */
5699        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5700        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
5701        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
5702        protected List<CodeableConcept> modifier;
5703
5704        /**
5705         * Identifies the program under which this may be recovered.
5706         */
5707        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5708        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
5709        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
5710        protected List<CodeableConcept> programCode;
5711
5712        /**
5713         * The number of repetitions of a service or product.
5714         */
5715        @Child(name = "quantity", type = {Quantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
5716        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
5717        protected Quantity quantity;
5718
5719        /**
5720         * 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.
5721         */
5722        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
5723        @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." )
5724        protected Money unitPrice;
5725
5726        /**
5727         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
5728         */
5729        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
5730        @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." )
5731        protected DecimalType factor;
5732
5733        /**
5734         * The quantity times the unit price for an additional service or product or charge.
5735         */
5736        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
5737        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
5738        protected Money net;
5739
5740        /**
5741         * Unique Device Identifiers associated with this line item.
5742         */
5743        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5744        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
5745        protected List<Reference> udi;
5746        /**
5747         * The actual objects that are the target of the reference (Unique Device Identifiers associated with this line item.)
5748         */
5749        protected List<Device> udiTarget;
5750
5751
5752        /**
5753         * The numbers associated with notes below which apply to the adjudication of this item.
5754         */
5755        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5756        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
5757        protected List<PositiveIntType> noteNumber;
5758
5759        /**
5760         * The adjudication results.
5761         */
5762        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5763        @Description(shortDefinition="Detail level adjudication details", formalDefinition="The adjudication results." )
5764        protected List<AdjudicationComponent> adjudication;
5765
5766        /**
5767         * Third-tier of goods and services.
5768         */
5769        @Child(name = "subDetail", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5770        @Description(shortDefinition="Additional items", formalDefinition="Third-tier of goods and services." )
5771        protected List<SubDetailComponent> subDetail;
5772
5773        private static final long serialVersionUID = 225639798L;
5774
5775    /**
5776     * Constructor
5777     */
5778      public DetailComponent() {
5779        super();
5780      }
5781
5782    /**
5783     * Constructor
5784     */
5785      public DetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
5786        super();
5787        this.sequence = sequence;
5788        this.productOrService = productOrService;
5789      }
5790
5791        /**
5792         * @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
5793         */
5794        public PositiveIntType getSequenceElement() { 
5795          if (this.sequence == null)
5796            if (Configuration.errorOnAutoCreate())
5797              throw new Error("Attempt to auto-create DetailComponent.sequence");
5798            else if (Configuration.doAutoCreate())
5799              this.sequence = new PositiveIntType(); // bb
5800          return this.sequence;
5801        }
5802
5803        public boolean hasSequenceElement() { 
5804          return this.sequence != null && !this.sequence.isEmpty();
5805        }
5806
5807        public boolean hasSequence() { 
5808          return this.sequence != null && !this.sequence.isEmpty();
5809        }
5810
5811        /**
5812         * @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
5813         */
5814        public DetailComponent setSequenceElement(PositiveIntType value) { 
5815          this.sequence = value;
5816          return this;
5817        }
5818
5819        /**
5820         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5821         */
5822        public int getSequence() { 
5823          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
5824        }
5825
5826        /**
5827         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5828         */
5829        public DetailComponent setSequence(int value) { 
5830            if (this.sequence == null)
5831              this.sequence = new PositiveIntType();
5832            this.sequence.setValue(value);
5833          return this;
5834        }
5835
5836        /**
5837         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5838         */
5839        public CodeableConcept getRevenue() { 
5840          if (this.revenue == null)
5841            if (Configuration.errorOnAutoCreate())
5842              throw new Error("Attempt to auto-create DetailComponent.revenue");
5843            else if (Configuration.doAutoCreate())
5844              this.revenue = new CodeableConcept(); // cc
5845          return this.revenue;
5846        }
5847
5848        public boolean hasRevenue() { 
5849          return this.revenue != null && !this.revenue.isEmpty();
5850        }
5851
5852        /**
5853         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5854         */
5855        public DetailComponent setRevenue(CodeableConcept value) { 
5856          this.revenue = value;
5857          return this;
5858        }
5859
5860        /**
5861         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5862         */
5863        public CodeableConcept getCategory() { 
5864          if (this.category == null)
5865            if (Configuration.errorOnAutoCreate())
5866              throw new Error("Attempt to auto-create DetailComponent.category");
5867            else if (Configuration.doAutoCreate())
5868              this.category = new CodeableConcept(); // cc
5869          return this.category;
5870        }
5871
5872        public boolean hasCategory() { 
5873          return this.category != null && !this.category.isEmpty();
5874        }
5875
5876        /**
5877         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5878         */
5879        public DetailComponent setCategory(CodeableConcept value) { 
5880          this.category = value;
5881          return this;
5882        }
5883
5884        /**
5885         * @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.)
5886         */
5887        public CodeableConcept getProductOrService() { 
5888          if (this.productOrService == null)
5889            if (Configuration.errorOnAutoCreate())
5890              throw new Error("Attempt to auto-create DetailComponent.productOrService");
5891            else if (Configuration.doAutoCreate())
5892              this.productOrService = new CodeableConcept(); // cc
5893          return this.productOrService;
5894        }
5895
5896        public boolean hasProductOrService() { 
5897          return this.productOrService != null && !this.productOrService.isEmpty();
5898        }
5899
5900        /**
5901         * @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.)
5902         */
5903        public DetailComponent setProductOrService(CodeableConcept value) { 
5904          this.productOrService = value;
5905          return this;
5906        }
5907
5908        /**
5909         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
5910         */
5911        public List<CodeableConcept> getModifier() { 
5912          if (this.modifier == null)
5913            this.modifier = new ArrayList<CodeableConcept>();
5914          return this.modifier;
5915        }
5916
5917        /**
5918         * @return Returns a reference to <code>this</code> for easy method chaining
5919         */
5920        public DetailComponent setModifier(List<CodeableConcept> theModifier) { 
5921          this.modifier = theModifier;
5922          return this;
5923        }
5924
5925        public boolean hasModifier() { 
5926          if (this.modifier == null)
5927            return false;
5928          for (CodeableConcept item : this.modifier)
5929            if (!item.isEmpty())
5930              return true;
5931          return false;
5932        }
5933
5934        public CodeableConcept addModifier() { //3
5935          CodeableConcept t = new CodeableConcept();
5936          if (this.modifier == null)
5937            this.modifier = new ArrayList<CodeableConcept>();
5938          this.modifier.add(t);
5939          return t;
5940        }
5941
5942        public DetailComponent addModifier(CodeableConcept t) { //3
5943          if (t == null)
5944            return this;
5945          if (this.modifier == null)
5946            this.modifier = new ArrayList<CodeableConcept>();
5947          this.modifier.add(t);
5948          return this;
5949        }
5950
5951        /**
5952         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
5953         */
5954        public CodeableConcept getModifierFirstRep() { 
5955          if (getModifier().isEmpty()) {
5956            addModifier();
5957          }
5958          return getModifier().get(0);
5959        }
5960
5961        /**
5962         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
5963         */
5964        public List<CodeableConcept> getProgramCode() { 
5965          if (this.programCode == null)
5966            this.programCode = new ArrayList<CodeableConcept>();
5967          return this.programCode;
5968        }
5969
5970        /**
5971         * @return Returns a reference to <code>this</code> for easy method chaining
5972         */
5973        public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
5974          this.programCode = theProgramCode;
5975          return this;
5976        }
5977
5978        public boolean hasProgramCode() { 
5979          if (this.programCode == null)
5980            return false;
5981          for (CodeableConcept item : this.programCode)
5982            if (!item.isEmpty())
5983              return true;
5984          return false;
5985        }
5986
5987        public CodeableConcept addProgramCode() { //3
5988          CodeableConcept t = new CodeableConcept();
5989          if (this.programCode == null)
5990            this.programCode = new ArrayList<CodeableConcept>();
5991          this.programCode.add(t);
5992          return t;
5993        }
5994
5995        public DetailComponent addProgramCode(CodeableConcept t) { //3
5996          if (t == null)
5997            return this;
5998          if (this.programCode == null)
5999            this.programCode = new ArrayList<CodeableConcept>();
6000          this.programCode.add(t);
6001          return this;
6002        }
6003
6004        /**
6005         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
6006         */
6007        public CodeableConcept getProgramCodeFirstRep() { 
6008          if (getProgramCode().isEmpty()) {
6009            addProgramCode();
6010          }
6011          return getProgramCode().get(0);
6012        }
6013
6014        /**
6015         * @return {@link #quantity} (The number of repetitions of a service or product.)
6016         */
6017        public Quantity getQuantity() { 
6018          if (this.quantity == null)
6019            if (Configuration.errorOnAutoCreate())
6020              throw new Error("Attempt to auto-create DetailComponent.quantity");
6021            else if (Configuration.doAutoCreate())
6022              this.quantity = new Quantity(); // cc
6023          return this.quantity;
6024        }
6025
6026        public boolean hasQuantity() { 
6027          return this.quantity != null && !this.quantity.isEmpty();
6028        }
6029
6030        /**
6031         * @param value {@link #quantity} (The number of repetitions of a service or product.)
6032         */
6033        public DetailComponent setQuantity(Quantity value) { 
6034          this.quantity = value;
6035          return this;
6036        }
6037
6038        /**
6039         * @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.)
6040         */
6041        public Money getUnitPrice() { 
6042          if (this.unitPrice == null)
6043            if (Configuration.errorOnAutoCreate())
6044              throw new Error("Attempt to auto-create DetailComponent.unitPrice");
6045            else if (Configuration.doAutoCreate())
6046              this.unitPrice = new Money(); // cc
6047          return this.unitPrice;
6048        }
6049
6050        public boolean hasUnitPrice() { 
6051          return this.unitPrice != null && !this.unitPrice.isEmpty();
6052        }
6053
6054        /**
6055         * @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.)
6056         */
6057        public DetailComponent setUnitPrice(Money value) { 
6058          this.unitPrice = value;
6059          return this;
6060        }
6061
6062        /**
6063         * @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
6064         */
6065        public DecimalType getFactorElement() { 
6066          if (this.factor == null)
6067            if (Configuration.errorOnAutoCreate())
6068              throw new Error("Attempt to auto-create DetailComponent.factor");
6069            else if (Configuration.doAutoCreate())
6070              this.factor = new DecimalType(); // bb
6071          return this.factor;
6072        }
6073
6074        public boolean hasFactorElement() { 
6075          return this.factor != null && !this.factor.isEmpty();
6076        }
6077
6078        public boolean hasFactor() { 
6079          return this.factor != null && !this.factor.isEmpty();
6080        }
6081
6082        /**
6083         * @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
6084         */
6085        public DetailComponent setFactorElement(DecimalType value) { 
6086          this.factor = value;
6087          return this;
6088        }
6089
6090        /**
6091         * @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.
6092         */
6093        public BigDecimal getFactor() { 
6094          return this.factor == null ? null : this.factor.getValue();
6095        }
6096
6097        /**
6098         * @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.
6099         */
6100        public DetailComponent setFactor(BigDecimal value) { 
6101          if (value == null)
6102            this.factor = null;
6103          else {
6104            if (this.factor == null)
6105              this.factor = new DecimalType();
6106            this.factor.setValue(value);
6107          }
6108          return this;
6109        }
6110
6111        /**
6112         * @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.
6113         */
6114        public DetailComponent setFactor(long value) { 
6115              this.factor = new DecimalType();
6116            this.factor.setValue(value);
6117          return this;
6118        }
6119
6120        /**
6121         * @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.
6122         */
6123        public DetailComponent setFactor(double value) { 
6124              this.factor = new DecimalType();
6125            this.factor.setValue(value);
6126          return this;
6127        }
6128
6129        /**
6130         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
6131         */
6132        public Money getNet() { 
6133          if (this.net == null)
6134            if (Configuration.errorOnAutoCreate())
6135              throw new Error("Attempt to auto-create DetailComponent.net");
6136            else if (Configuration.doAutoCreate())
6137              this.net = new Money(); // cc
6138          return this.net;
6139        }
6140
6141        public boolean hasNet() { 
6142          return this.net != null && !this.net.isEmpty();
6143        }
6144
6145        /**
6146         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
6147         */
6148        public DetailComponent setNet(Money value) { 
6149          this.net = value;
6150          return this;
6151        }
6152
6153        /**
6154         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
6155         */
6156        public List<Reference> getUdi() { 
6157          if (this.udi == null)
6158            this.udi = new ArrayList<Reference>();
6159          return this.udi;
6160        }
6161
6162        /**
6163         * @return Returns a reference to <code>this</code> for easy method chaining
6164         */
6165        public DetailComponent setUdi(List<Reference> theUdi) { 
6166          this.udi = theUdi;
6167          return this;
6168        }
6169
6170        public boolean hasUdi() { 
6171          if (this.udi == null)
6172            return false;
6173          for (Reference item : this.udi)
6174            if (!item.isEmpty())
6175              return true;
6176          return false;
6177        }
6178
6179        public Reference addUdi() { //3
6180          Reference t = new Reference();
6181          if (this.udi == null)
6182            this.udi = new ArrayList<Reference>();
6183          this.udi.add(t);
6184          return t;
6185        }
6186
6187        public DetailComponent addUdi(Reference t) { //3
6188          if (t == null)
6189            return this;
6190          if (this.udi == null)
6191            this.udi = new ArrayList<Reference>();
6192          this.udi.add(t);
6193          return this;
6194        }
6195
6196        /**
6197         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
6198         */
6199        public Reference getUdiFirstRep() { 
6200          if (getUdi().isEmpty()) {
6201            addUdi();
6202          }
6203          return getUdi().get(0);
6204        }
6205
6206        /**
6207         * @deprecated Use Reference#setResource(IBaseResource) instead
6208         */
6209        @Deprecated
6210        public List<Device> getUdiTarget() { 
6211          if (this.udiTarget == null)
6212            this.udiTarget = new ArrayList<Device>();
6213          return this.udiTarget;
6214        }
6215
6216        /**
6217         * @deprecated Use Reference#setResource(IBaseResource) instead
6218         */
6219        @Deprecated
6220        public Device addUdiTarget() { 
6221          Device r = new Device();
6222          if (this.udiTarget == null)
6223            this.udiTarget = new ArrayList<Device>();
6224          this.udiTarget.add(r);
6225          return r;
6226        }
6227
6228        /**
6229         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6230         */
6231        public List<PositiveIntType> getNoteNumber() { 
6232          if (this.noteNumber == null)
6233            this.noteNumber = new ArrayList<PositiveIntType>();
6234          return this.noteNumber;
6235        }
6236
6237        /**
6238         * @return Returns a reference to <code>this</code> for easy method chaining
6239         */
6240        public DetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
6241          this.noteNumber = theNoteNumber;
6242          return this;
6243        }
6244
6245        public boolean hasNoteNumber() { 
6246          if (this.noteNumber == null)
6247            return false;
6248          for (PositiveIntType item : this.noteNumber)
6249            if (!item.isEmpty())
6250              return true;
6251          return false;
6252        }
6253
6254        /**
6255         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6256         */
6257        public PositiveIntType addNoteNumberElement() {//2 
6258          PositiveIntType t = new PositiveIntType();
6259          if (this.noteNumber == null)
6260            this.noteNumber = new ArrayList<PositiveIntType>();
6261          this.noteNumber.add(t);
6262          return t;
6263        }
6264
6265        /**
6266         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6267         */
6268        public DetailComponent addNoteNumber(int value) { //1
6269          PositiveIntType t = new PositiveIntType();
6270          t.setValue(value);
6271          if (this.noteNumber == null)
6272            this.noteNumber = new ArrayList<PositiveIntType>();
6273          this.noteNumber.add(t);
6274          return this;
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 boolean hasNoteNumber(int value) { 
6281          if (this.noteNumber == null)
6282            return false;
6283          for (PositiveIntType v : this.noteNumber)
6284            if (v.getValue().equals(value)) // positiveInt
6285              return true;
6286          return false;
6287        }
6288
6289        /**
6290         * @return {@link #adjudication} (The adjudication results.)
6291         */
6292        public List<AdjudicationComponent> getAdjudication() { 
6293          if (this.adjudication == null)
6294            this.adjudication = new ArrayList<AdjudicationComponent>();
6295          return this.adjudication;
6296        }
6297
6298        /**
6299         * @return Returns a reference to <code>this</code> for easy method chaining
6300         */
6301        public DetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
6302          this.adjudication = theAdjudication;
6303          return this;
6304        }
6305
6306        public boolean hasAdjudication() { 
6307          if (this.adjudication == null)
6308            return false;
6309          for (AdjudicationComponent item : this.adjudication)
6310            if (!item.isEmpty())
6311              return true;
6312          return false;
6313        }
6314
6315        public AdjudicationComponent addAdjudication() { //3
6316          AdjudicationComponent t = new AdjudicationComponent();
6317          if (this.adjudication == null)
6318            this.adjudication = new ArrayList<AdjudicationComponent>();
6319          this.adjudication.add(t);
6320          return t;
6321        }
6322
6323        public DetailComponent addAdjudication(AdjudicationComponent t) { //3
6324          if (t == null)
6325            return this;
6326          if (this.adjudication == null)
6327            this.adjudication = new ArrayList<AdjudicationComponent>();
6328          this.adjudication.add(t);
6329          return this;
6330        }
6331
6332        /**
6333         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
6334         */
6335        public AdjudicationComponent getAdjudicationFirstRep() { 
6336          if (getAdjudication().isEmpty()) {
6337            addAdjudication();
6338          }
6339          return getAdjudication().get(0);
6340        }
6341
6342        /**
6343         * @return {@link #subDetail} (Third-tier of goods and services.)
6344         */
6345        public List<SubDetailComponent> getSubDetail() { 
6346          if (this.subDetail == null)
6347            this.subDetail = new ArrayList<SubDetailComponent>();
6348          return this.subDetail;
6349        }
6350
6351        /**
6352         * @return Returns a reference to <code>this</code> for easy method chaining
6353         */
6354        public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) { 
6355          this.subDetail = theSubDetail;
6356          return this;
6357        }
6358
6359        public boolean hasSubDetail() { 
6360          if (this.subDetail == null)
6361            return false;
6362          for (SubDetailComponent item : this.subDetail)
6363            if (!item.isEmpty())
6364              return true;
6365          return false;
6366        }
6367
6368        public SubDetailComponent addSubDetail() { //3
6369          SubDetailComponent t = new SubDetailComponent();
6370          if (this.subDetail == null)
6371            this.subDetail = new ArrayList<SubDetailComponent>();
6372          this.subDetail.add(t);
6373          return t;
6374        }
6375
6376        public DetailComponent addSubDetail(SubDetailComponent t) { //3
6377          if (t == null)
6378            return this;
6379          if (this.subDetail == null)
6380            this.subDetail = new ArrayList<SubDetailComponent>();
6381          this.subDetail.add(t);
6382          return this;
6383        }
6384
6385        /**
6386         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist
6387         */
6388        public SubDetailComponent getSubDetailFirstRep() { 
6389          if (getSubDetail().isEmpty()) {
6390            addSubDetail();
6391          }
6392          return getSubDetail().get(0);
6393        }
6394
6395        protected void listChildren(List<Property> children) {
6396          super.listChildren(children);
6397          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));
6398          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
6399          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
6400          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));
6401          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));
6402          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
6403          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
6404          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));
6405          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));
6406          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
6407          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
6408          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));
6409          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6410          children.add(new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
6411        }
6412
6413        @Override
6414        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6415          switch (_hash) {
6416          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);
6417          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
6418          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);
6419          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);
6420          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);
6421          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
6422          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
6423          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);
6424          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);
6425          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);
6426          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
6427          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);
6428          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
6429          case -828829007: /*subDetail*/  return new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
6430          default: return super.getNamedProperty(_hash, _name, _checkValid);
6431          }
6432
6433        }
6434
6435      @Override
6436      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6437        switch (hash) {
6438        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
6439        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
6440        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
6441        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
6442        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
6443        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
6444        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
6445        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6446        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6447        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6448        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
6449        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
6450        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
6451        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
6452        default: return super.getProperty(hash, name, checkValid);
6453        }
6454
6455      }
6456
6457      @Override
6458      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6459        switch (hash) {
6460        case 1349547969: // sequence
6461          this.sequence = castToPositiveInt(value); // PositiveIntType
6462          return value;
6463        case 1099842588: // revenue
6464          this.revenue = castToCodeableConcept(value); // CodeableConcept
6465          return value;
6466        case 50511102: // category
6467          this.category = castToCodeableConcept(value); // CodeableConcept
6468          return value;
6469        case 1957227299: // productOrService
6470          this.productOrService = castToCodeableConcept(value); // CodeableConcept
6471          return value;
6472        case -615513385: // modifier
6473          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
6474          return value;
6475        case 1010065041: // programCode
6476          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
6477          return value;
6478        case -1285004149: // quantity
6479          this.quantity = castToQuantity(value); // Quantity
6480          return value;
6481        case -486196699: // unitPrice
6482          this.unitPrice = castToMoney(value); // Money
6483          return value;
6484        case -1282148017: // factor
6485          this.factor = castToDecimal(value); // DecimalType
6486          return value;
6487        case 108957: // net
6488          this.net = castToMoney(value); // Money
6489          return value;
6490        case 115642: // udi
6491          this.getUdi().add(castToReference(value)); // Reference
6492          return value;
6493        case -1110033957: // noteNumber
6494          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
6495          return value;
6496        case -231349275: // adjudication
6497          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
6498          return value;
6499        case -828829007: // subDetail
6500          this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
6501          return value;
6502        default: return super.setProperty(hash, name, value);
6503        }
6504
6505      }
6506
6507      @Override
6508      public Base setProperty(String name, Base value) throws FHIRException {
6509        if (name.equals("sequence")) {
6510          this.sequence = castToPositiveInt(value); // PositiveIntType
6511        } else if (name.equals("revenue")) {
6512          this.revenue = castToCodeableConcept(value); // CodeableConcept
6513        } else if (name.equals("category")) {
6514          this.category = castToCodeableConcept(value); // CodeableConcept
6515        } else if (name.equals("productOrService")) {
6516          this.productOrService = castToCodeableConcept(value); // CodeableConcept
6517        } else if (name.equals("modifier")) {
6518          this.getModifier().add(castToCodeableConcept(value));
6519        } else if (name.equals("programCode")) {
6520          this.getProgramCode().add(castToCodeableConcept(value));
6521        } else if (name.equals("quantity")) {
6522          this.quantity = castToQuantity(value); // Quantity
6523        } else if (name.equals("unitPrice")) {
6524          this.unitPrice = castToMoney(value); // Money
6525        } else if (name.equals("factor")) {
6526          this.factor = castToDecimal(value); // DecimalType
6527        } else if (name.equals("net")) {
6528          this.net = castToMoney(value); // Money
6529        } else if (name.equals("udi")) {
6530          this.getUdi().add(castToReference(value));
6531        } else if (name.equals("noteNumber")) {
6532          this.getNoteNumber().add(castToPositiveInt(value));
6533        } else if (name.equals("adjudication")) {
6534          this.getAdjudication().add((AdjudicationComponent) value);
6535        } else if (name.equals("subDetail")) {
6536          this.getSubDetail().add((SubDetailComponent) value);
6537        } else
6538          return super.setProperty(name, value);
6539        return value;
6540      }
6541
6542      @Override
6543      public Base makeProperty(int hash, String name) throws FHIRException {
6544        switch (hash) {
6545        case 1349547969:  return getSequenceElement();
6546        case 1099842588:  return getRevenue(); 
6547        case 50511102:  return getCategory(); 
6548        case 1957227299:  return getProductOrService(); 
6549        case -615513385:  return addModifier(); 
6550        case 1010065041:  return addProgramCode(); 
6551        case -1285004149:  return getQuantity(); 
6552        case -486196699:  return getUnitPrice(); 
6553        case -1282148017:  return getFactorElement();
6554        case 108957:  return getNet(); 
6555        case 115642:  return addUdi(); 
6556        case -1110033957:  return addNoteNumberElement();
6557        case -231349275:  return addAdjudication(); 
6558        case -828829007:  return addSubDetail(); 
6559        default: return super.makeProperty(hash, name);
6560        }
6561
6562      }
6563
6564      @Override
6565      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6566        switch (hash) {
6567        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
6568        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
6569        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
6570        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
6571        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
6572        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
6573        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
6574        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6575        case -1282148017: /*factor*/ return new String[] {"decimal"};
6576        case 108957: /*net*/ return new String[] {"Money"};
6577        case 115642: /*udi*/ return new String[] {"Reference"};
6578        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
6579        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
6580        case -828829007: /*subDetail*/ return new String[] {};
6581        default: return super.getTypesForProperty(hash, name);
6582        }
6583
6584      }
6585
6586      @Override
6587      public Base addChild(String name) throws FHIRException {
6588        if (name.equals("sequence")) {
6589          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
6590        }
6591        else if (name.equals("revenue")) {
6592          this.revenue = new CodeableConcept();
6593          return this.revenue;
6594        }
6595        else if (name.equals("category")) {
6596          this.category = new CodeableConcept();
6597          return this.category;
6598        }
6599        else if (name.equals("productOrService")) {
6600          this.productOrService = new CodeableConcept();
6601          return this.productOrService;
6602        }
6603        else if (name.equals("modifier")) {
6604          return addModifier();
6605        }
6606        else if (name.equals("programCode")) {
6607          return addProgramCode();
6608        }
6609        else if (name.equals("quantity")) {
6610          this.quantity = new Quantity();
6611          return this.quantity;
6612        }
6613        else if (name.equals("unitPrice")) {
6614          this.unitPrice = new Money();
6615          return this.unitPrice;
6616        }
6617        else if (name.equals("factor")) {
6618          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
6619        }
6620        else if (name.equals("net")) {
6621          this.net = new Money();
6622          return this.net;
6623        }
6624        else if (name.equals("udi")) {
6625          return addUdi();
6626        }
6627        else if (name.equals("noteNumber")) {
6628          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
6629        }
6630        else if (name.equals("adjudication")) {
6631          return addAdjudication();
6632        }
6633        else if (name.equals("subDetail")) {
6634          return addSubDetail();
6635        }
6636        else
6637          return super.addChild(name);
6638      }
6639
6640      public DetailComponent copy() {
6641        DetailComponent dst = new DetailComponent();
6642        copyValues(dst);
6643        return dst;
6644      }
6645
6646      public void copyValues(DetailComponent dst) {
6647        super.copyValues(dst);
6648        dst.sequence = sequence == null ? null : sequence.copy();
6649        dst.revenue = revenue == null ? null : revenue.copy();
6650        dst.category = category == null ? null : category.copy();
6651        dst.productOrService = productOrService == null ? null : productOrService.copy();
6652        if (modifier != null) {
6653          dst.modifier = new ArrayList<CodeableConcept>();
6654          for (CodeableConcept i : modifier)
6655            dst.modifier.add(i.copy());
6656        };
6657        if (programCode != null) {
6658          dst.programCode = new ArrayList<CodeableConcept>();
6659          for (CodeableConcept i : programCode)
6660            dst.programCode.add(i.copy());
6661        };
6662        dst.quantity = quantity == null ? null : quantity.copy();
6663        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6664        dst.factor = factor == null ? null : factor.copy();
6665        dst.net = net == null ? null : net.copy();
6666        if (udi != null) {
6667          dst.udi = new ArrayList<Reference>();
6668          for (Reference i : udi)
6669            dst.udi.add(i.copy());
6670        };
6671        if (noteNumber != null) {
6672          dst.noteNumber = new ArrayList<PositiveIntType>();
6673          for (PositiveIntType i : noteNumber)
6674            dst.noteNumber.add(i.copy());
6675        };
6676        if (adjudication != null) {
6677          dst.adjudication = new ArrayList<AdjudicationComponent>();
6678          for (AdjudicationComponent i : adjudication)
6679            dst.adjudication.add(i.copy());
6680        };
6681        if (subDetail != null) {
6682          dst.subDetail = new ArrayList<SubDetailComponent>();
6683          for (SubDetailComponent i : subDetail)
6684            dst.subDetail.add(i.copy());
6685        };
6686      }
6687
6688      @Override
6689      public boolean equalsDeep(Base other_) {
6690        if (!super.equalsDeep(other_))
6691          return false;
6692        if (!(other_ instanceof DetailComponent))
6693          return false;
6694        DetailComponent o = (DetailComponent) other_;
6695        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
6696           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
6697           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
6698           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
6699           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
6700           && compareDeep(subDetail, o.subDetail, true);
6701      }
6702
6703      @Override
6704      public boolean equalsShallow(Base other_) {
6705        if (!super.equalsShallow(other_))
6706          return false;
6707        if (!(other_ instanceof DetailComponent))
6708          return false;
6709        DetailComponent o = (DetailComponent) other_;
6710        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
6711          ;
6712      }
6713
6714      public boolean isEmpty() {
6715        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
6716          , productOrService, modifier, programCode, quantity, unitPrice, factor, net, udi
6717          , noteNumber, adjudication, subDetail);
6718      }
6719
6720  public String fhirType() {
6721    return "ExplanationOfBenefit.item.detail";
6722
6723  }
6724
6725  }
6726
6727    @Block()
6728    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
6729        /**
6730         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6731         */
6732        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
6733        @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." )
6734        protected PositiveIntType sequence;
6735
6736        /**
6737         * The type of revenue or cost center providing the product and/or service.
6738         */
6739        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
6740        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
6741        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
6742        protected CodeableConcept revenue;
6743
6744        /**
6745         * Code to identify the general type of benefits under which products and services are provided.
6746         */
6747        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
6748        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
6749        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
6750        protected CodeableConcept category;
6751
6752        /**
6753         * 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.
6754         */
6755        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
6756        @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." )
6757        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
6758        protected CodeableConcept productOrService;
6759
6760        /**
6761         * Item typification or modifiers codes to convey additional context for the product or service.
6762         */
6763        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6764        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
6765        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
6766        protected List<CodeableConcept> modifier;
6767
6768        /**
6769         * Identifies the program under which this may be recovered.
6770         */
6771        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6772        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
6773        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
6774        protected List<CodeableConcept> programCode;
6775
6776        /**
6777         * The number of repetitions of a service or product.
6778         */
6779        @Child(name = "quantity", type = {Quantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
6780        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
6781        protected Quantity quantity;
6782
6783        /**
6784         * 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.
6785         */
6786        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
6787        @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." )
6788        protected Money unitPrice;
6789
6790        /**
6791         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
6792         */
6793        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
6794        @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." )
6795        protected DecimalType factor;
6796
6797        /**
6798         * The quantity times the unit price for an additional service or product or charge.
6799         */
6800        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
6801        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
6802        protected Money net;
6803
6804        /**
6805         * Unique Device Identifiers associated with this line item.
6806         */
6807        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6808        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
6809        protected List<Reference> udi;
6810        /**
6811         * The actual objects that are the target of the reference (Unique Device Identifiers associated with this line item.)
6812         */
6813        protected List<Device> udiTarget;
6814
6815
6816        /**
6817         * The numbers associated with notes below which apply to the adjudication of this item.
6818         */
6819        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6820        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
6821        protected List<PositiveIntType> noteNumber;
6822
6823        /**
6824         * The adjudication results.
6825         */
6826        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6827        @Description(shortDefinition="Subdetail level adjudication details", formalDefinition="The adjudication results." )
6828        protected List<AdjudicationComponent> adjudication;
6829
6830        private static final long serialVersionUID = -996156853L;
6831
6832    /**
6833     * Constructor
6834     */
6835      public SubDetailComponent() {
6836        super();
6837      }
6838
6839    /**
6840     * Constructor
6841     */
6842      public SubDetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
6843        super();
6844        this.sequence = sequence;
6845        this.productOrService = productOrService;
6846      }
6847
6848        /**
6849         * @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
6850         */
6851        public PositiveIntType getSequenceElement() { 
6852          if (this.sequence == null)
6853            if (Configuration.errorOnAutoCreate())
6854              throw new Error("Attempt to auto-create SubDetailComponent.sequence");
6855            else if (Configuration.doAutoCreate())
6856              this.sequence = new PositiveIntType(); // bb
6857          return this.sequence;
6858        }
6859
6860        public boolean hasSequenceElement() { 
6861          return this.sequence != null && !this.sequence.isEmpty();
6862        }
6863
6864        public boolean hasSequence() { 
6865          return this.sequence != null && !this.sequence.isEmpty();
6866        }
6867
6868        /**
6869         * @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
6870         */
6871        public SubDetailComponent setSequenceElement(PositiveIntType value) { 
6872          this.sequence = value;
6873          return this;
6874        }
6875
6876        /**
6877         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6878         */
6879        public int getSequence() { 
6880          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
6881        }
6882
6883        /**
6884         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6885         */
6886        public SubDetailComponent setSequence(int value) { 
6887            if (this.sequence == null)
6888              this.sequence = new PositiveIntType();
6889            this.sequence.setValue(value);
6890          return this;
6891        }
6892
6893        /**
6894         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
6895         */
6896        public CodeableConcept getRevenue() { 
6897          if (this.revenue == null)
6898            if (Configuration.errorOnAutoCreate())
6899              throw new Error("Attempt to auto-create SubDetailComponent.revenue");
6900            else if (Configuration.doAutoCreate())
6901              this.revenue = new CodeableConcept(); // cc
6902          return this.revenue;
6903        }
6904
6905        public boolean hasRevenue() { 
6906          return this.revenue != null && !this.revenue.isEmpty();
6907        }
6908
6909        /**
6910         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
6911         */
6912        public SubDetailComponent setRevenue(CodeableConcept value) { 
6913          this.revenue = value;
6914          return this;
6915        }
6916
6917        /**
6918         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
6919         */
6920        public CodeableConcept getCategory() { 
6921          if (this.category == null)
6922            if (Configuration.errorOnAutoCreate())
6923              throw new Error("Attempt to auto-create SubDetailComponent.category");
6924            else if (Configuration.doAutoCreate())
6925              this.category = new CodeableConcept(); // cc
6926          return this.category;
6927        }
6928
6929        public boolean hasCategory() { 
6930          return this.category != null && !this.category.isEmpty();
6931        }
6932
6933        /**
6934         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
6935         */
6936        public SubDetailComponent setCategory(CodeableConcept value) { 
6937          this.category = value;
6938          return this;
6939        }
6940
6941        /**
6942         * @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.)
6943         */
6944        public CodeableConcept getProductOrService() { 
6945          if (this.productOrService == null)
6946            if (Configuration.errorOnAutoCreate())
6947              throw new Error("Attempt to auto-create SubDetailComponent.productOrService");
6948            else if (Configuration.doAutoCreate())
6949              this.productOrService = new CodeableConcept(); // cc
6950          return this.productOrService;
6951        }
6952
6953        public boolean hasProductOrService() { 
6954          return this.productOrService != null && !this.productOrService.isEmpty();
6955        }
6956
6957        /**
6958         * @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.)
6959         */
6960        public SubDetailComponent setProductOrService(CodeableConcept value) { 
6961          this.productOrService = value;
6962          return this;
6963        }
6964
6965        /**
6966         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
6967         */
6968        public List<CodeableConcept> getModifier() { 
6969          if (this.modifier == null)
6970            this.modifier = new ArrayList<CodeableConcept>();
6971          return this.modifier;
6972        }
6973
6974        /**
6975         * @return Returns a reference to <code>this</code> for easy method chaining
6976         */
6977        public SubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
6978          this.modifier = theModifier;
6979          return this;
6980        }
6981
6982        public boolean hasModifier() { 
6983          if (this.modifier == null)
6984            return false;
6985          for (CodeableConcept item : this.modifier)
6986            if (!item.isEmpty())
6987              return true;
6988          return false;
6989        }
6990
6991        public CodeableConcept addModifier() { //3
6992          CodeableConcept t = new CodeableConcept();
6993          if (this.modifier == null)
6994            this.modifier = new ArrayList<CodeableConcept>();
6995          this.modifier.add(t);
6996          return t;
6997        }
6998
6999        public SubDetailComponent addModifier(CodeableConcept t) { //3
7000          if (t == null)
7001            return this;
7002          if (this.modifier == null)
7003            this.modifier = new ArrayList<CodeableConcept>();
7004          this.modifier.add(t);
7005          return this;
7006        }
7007
7008        /**
7009         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
7010         */
7011        public CodeableConcept getModifierFirstRep() { 
7012          if (getModifier().isEmpty()) {
7013            addModifier();
7014          }
7015          return getModifier().get(0);
7016        }
7017
7018        /**
7019         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
7020         */
7021        public List<CodeableConcept> getProgramCode() { 
7022          if (this.programCode == null)
7023            this.programCode = new ArrayList<CodeableConcept>();
7024          return this.programCode;
7025        }
7026
7027        /**
7028         * @return Returns a reference to <code>this</code> for easy method chaining
7029         */
7030        public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
7031          this.programCode = theProgramCode;
7032          return this;
7033        }
7034
7035        public boolean hasProgramCode() { 
7036          if (this.programCode == null)
7037            return false;
7038          for (CodeableConcept item : this.programCode)
7039            if (!item.isEmpty())
7040              return true;
7041          return false;
7042        }
7043
7044        public CodeableConcept addProgramCode() { //3
7045          CodeableConcept t = new CodeableConcept();
7046          if (this.programCode == null)
7047            this.programCode = new ArrayList<CodeableConcept>();
7048          this.programCode.add(t);
7049          return t;
7050        }
7051
7052        public SubDetailComponent addProgramCode(CodeableConcept t) { //3
7053          if (t == null)
7054            return this;
7055          if (this.programCode == null)
7056            this.programCode = new ArrayList<CodeableConcept>();
7057          this.programCode.add(t);
7058          return this;
7059        }
7060
7061        /**
7062         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
7063         */
7064        public CodeableConcept getProgramCodeFirstRep() { 
7065          if (getProgramCode().isEmpty()) {
7066            addProgramCode();
7067          }
7068          return getProgramCode().get(0);
7069        }
7070
7071        /**
7072         * @return {@link #quantity} (The number of repetitions of a service or product.)
7073         */
7074        public Quantity getQuantity() { 
7075          if (this.quantity == null)
7076            if (Configuration.errorOnAutoCreate())
7077              throw new Error("Attempt to auto-create SubDetailComponent.quantity");
7078            else if (Configuration.doAutoCreate())
7079              this.quantity = new Quantity(); // cc
7080          return this.quantity;
7081        }
7082
7083        public boolean hasQuantity() { 
7084          return this.quantity != null && !this.quantity.isEmpty();
7085        }
7086
7087        /**
7088         * @param value {@link #quantity} (The number of repetitions of a service or product.)
7089         */
7090        public SubDetailComponent setQuantity(Quantity value) { 
7091          this.quantity = value;
7092          return this;
7093        }
7094
7095        /**
7096         * @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.)
7097         */
7098        public Money getUnitPrice() { 
7099          if (this.unitPrice == null)
7100            if (Configuration.errorOnAutoCreate())
7101              throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
7102            else if (Configuration.doAutoCreate())
7103              this.unitPrice = new Money(); // cc
7104          return this.unitPrice;
7105        }
7106
7107        public boolean hasUnitPrice() { 
7108          return this.unitPrice != null && !this.unitPrice.isEmpty();
7109        }
7110
7111        /**
7112         * @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.)
7113         */
7114        public SubDetailComponent setUnitPrice(Money value) { 
7115          this.unitPrice = value;
7116          return this;
7117        }
7118
7119        /**
7120         * @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
7121         */
7122        public DecimalType getFactorElement() { 
7123          if (this.factor == null)
7124            if (Configuration.errorOnAutoCreate())
7125              throw new Error("Attempt to auto-create SubDetailComponent.factor");
7126            else if (Configuration.doAutoCreate())
7127              this.factor = new DecimalType(); // bb
7128          return this.factor;
7129        }
7130
7131        public boolean hasFactorElement() { 
7132          return this.factor != null && !this.factor.isEmpty();
7133        }
7134
7135        public boolean hasFactor() { 
7136          return this.factor != null && !this.factor.isEmpty();
7137        }
7138
7139        /**
7140         * @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
7141         */
7142        public SubDetailComponent setFactorElement(DecimalType value) { 
7143          this.factor = value;
7144          return this;
7145        }
7146
7147        /**
7148         * @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.
7149         */
7150        public BigDecimal getFactor() { 
7151          return this.factor == null ? null : this.factor.getValue();
7152        }
7153
7154        /**
7155         * @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.
7156         */
7157        public SubDetailComponent setFactor(BigDecimal value) { 
7158          if (value == null)
7159            this.factor = null;
7160          else {
7161            if (this.factor == null)
7162              this.factor = new DecimalType();
7163            this.factor.setValue(value);
7164          }
7165          return this;
7166        }
7167
7168        /**
7169         * @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.
7170         */
7171        public SubDetailComponent setFactor(long value) { 
7172              this.factor = new DecimalType();
7173            this.factor.setValue(value);
7174          return this;
7175        }
7176
7177        /**
7178         * @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.
7179         */
7180        public SubDetailComponent setFactor(double value) { 
7181              this.factor = new DecimalType();
7182            this.factor.setValue(value);
7183          return this;
7184        }
7185
7186        /**
7187         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
7188         */
7189        public Money getNet() { 
7190          if (this.net == null)
7191            if (Configuration.errorOnAutoCreate())
7192              throw new Error("Attempt to auto-create SubDetailComponent.net");
7193            else if (Configuration.doAutoCreate())
7194              this.net = new Money(); // cc
7195          return this.net;
7196        }
7197
7198        public boolean hasNet() { 
7199          return this.net != null && !this.net.isEmpty();
7200        }
7201
7202        /**
7203         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
7204         */
7205        public SubDetailComponent setNet(Money value) { 
7206          this.net = value;
7207          return this;
7208        }
7209
7210        /**
7211         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
7212         */
7213        public List<Reference> getUdi() { 
7214          if (this.udi == null)
7215            this.udi = new ArrayList<Reference>();
7216          return this.udi;
7217        }
7218
7219        /**
7220         * @return Returns a reference to <code>this</code> for easy method chaining
7221         */
7222        public SubDetailComponent setUdi(List<Reference> theUdi) { 
7223          this.udi = theUdi;
7224          return this;
7225        }
7226
7227        public boolean hasUdi() { 
7228          if (this.udi == null)
7229            return false;
7230          for (Reference item : this.udi)
7231            if (!item.isEmpty())
7232              return true;
7233          return false;
7234        }
7235
7236        public Reference addUdi() { //3
7237          Reference t = new Reference();
7238          if (this.udi == null)
7239            this.udi = new ArrayList<Reference>();
7240          this.udi.add(t);
7241          return t;
7242        }
7243
7244        public SubDetailComponent addUdi(Reference t) { //3
7245          if (t == null)
7246            return this;
7247          if (this.udi == null)
7248            this.udi = new ArrayList<Reference>();
7249          this.udi.add(t);
7250          return this;
7251        }
7252
7253        /**
7254         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
7255         */
7256        public Reference getUdiFirstRep() { 
7257          if (getUdi().isEmpty()) {
7258            addUdi();
7259          }
7260          return getUdi().get(0);
7261        }
7262
7263        /**
7264         * @deprecated Use Reference#setResource(IBaseResource) instead
7265         */
7266        @Deprecated
7267        public List<Device> getUdiTarget() { 
7268          if (this.udiTarget == null)
7269            this.udiTarget = new ArrayList<Device>();
7270          return this.udiTarget;
7271        }
7272
7273        /**
7274         * @deprecated Use Reference#setResource(IBaseResource) instead
7275         */
7276        @Deprecated
7277        public Device addUdiTarget() { 
7278          Device r = new Device();
7279          if (this.udiTarget == null)
7280            this.udiTarget = new ArrayList<Device>();
7281          this.udiTarget.add(r);
7282          return r;
7283        }
7284
7285        /**
7286         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7287         */
7288        public List<PositiveIntType> getNoteNumber() { 
7289          if (this.noteNumber == null)
7290            this.noteNumber = new ArrayList<PositiveIntType>();
7291          return this.noteNumber;
7292        }
7293
7294        /**
7295         * @return Returns a reference to <code>this</code> for easy method chaining
7296         */
7297        public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
7298          this.noteNumber = theNoteNumber;
7299          return this;
7300        }
7301
7302        public boolean hasNoteNumber() { 
7303          if (this.noteNumber == null)
7304            return false;
7305          for (PositiveIntType item : this.noteNumber)
7306            if (!item.isEmpty())
7307              return true;
7308          return false;
7309        }
7310
7311        /**
7312         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7313         */
7314        public PositiveIntType addNoteNumberElement() {//2 
7315          PositiveIntType t = new PositiveIntType();
7316          if (this.noteNumber == null)
7317            this.noteNumber = new ArrayList<PositiveIntType>();
7318          this.noteNumber.add(t);
7319          return t;
7320        }
7321
7322        /**
7323         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7324         */
7325        public SubDetailComponent addNoteNumber(int value) { //1
7326          PositiveIntType t = new PositiveIntType();
7327          t.setValue(value);
7328          if (this.noteNumber == null)
7329            this.noteNumber = new ArrayList<PositiveIntType>();
7330          this.noteNumber.add(t);
7331          return this;
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 boolean hasNoteNumber(int value) { 
7338          if (this.noteNumber == null)
7339            return false;
7340          for (PositiveIntType v : this.noteNumber)
7341            if (v.getValue().equals(value)) // positiveInt
7342              return true;
7343          return false;
7344        }
7345
7346        /**
7347         * @return {@link #adjudication} (The adjudication results.)
7348         */
7349        public List<AdjudicationComponent> getAdjudication() { 
7350          if (this.adjudication == null)
7351            this.adjudication = new ArrayList<AdjudicationComponent>();
7352          return this.adjudication;
7353        }
7354
7355        /**
7356         * @return Returns a reference to <code>this</code> for easy method chaining
7357         */
7358        public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
7359          this.adjudication = theAdjudication;
7360          return this;
7361        }
7362
7363        public boolean hasAdjudication() { 
7364          if (this.adjudication == null)
7365            return false;
7366          for (AdjudicationComponent item : this.adjudication)
7367            if (!item.isEmpty())
7368              return true;
7369          return false;
7370        }
7371
7372        public AdjudicationComponent addAdjudication() { //3
7373          AdjudicationComponent t = new AdjudicationComponent();
7374          if (this.adjudication == null)
7375            this.adjudication = new ArrayList<AdjudicationComponent>();
7376          this.adjudication.add(t);
7377          return t;
7378        }
7379
7380        public SubDetailComponent addAdjudication(AdjudicationComponent t) { //3
7381          if (t == null)
7382            return this;
7383          if (this.adjudication == null)
7384            this.adjudication = new ArrayList<AdjudicationComponent>();
7385          this.adjudication.add(t);
7386          return this;
7387        }
7388
7389        /**
7390         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
7391         */
7392        public AdjudicationComponent getAdjudicationFirstRep() { 
7393          if (getAdjudication().isEmpty()) {
7394            addAdjudication();
7395          }
7396          return getAdjudication().get(0);
7397        }
7398
7399        protected void listChildren(List<Property> children) {
7400          super.listChildren(children);
7401          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));
7402          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
7403          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
7404          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));
7405          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));
7406          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
7407          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
7408          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));
7409          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));
7410          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
7411          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
7412          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));
7413          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
7414        }
7415
7416        @Override
7417        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7418          switch (_hash) {
7419          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);
7420          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
7421          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);
7422          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);
7423          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);
7424          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
7425          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
7426          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);
7427          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);
7428          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);
7429          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
7430          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);
7431          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
7432          default: return super.getNamedProperty(_hash, _name, _checkValid);
7433          }
7434
7435        }
7436
7437      @Override
7438      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7439        switch (hash) {
7440        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
7441        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
7442        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
7443        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
7444        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7445        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
7446        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
7447        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
7448        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
7449        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
7450        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
7451        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
7452        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
7453        default: return super.getProperty(hash, name, checkValid);
7454        }
7455
7456      }
7457
7458      @Override
7459      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7460        switch (hash) {
7461        case 1349547969: // sequence
7462          this.sequence = castToPositiveInt(value); // PositiveIntType
7463          return value;
7464        case 1099842588: // revenue
7465          this.revenue = castToCodeableConcept(value); // CodeableConcept
7466          return value;
7467        case 50511102: // category
7468          this.category = castToCodeableConcept(value); // CodeableConcept
7469          return value;
7470        case 1957227299: // productOrService
7471          this.productOrService = castToCodeableConcept(value); // CodeableConcept
7472          return value;
7473        case -615513385: // modifier
7474          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
7475          return value;
7476        case 1010065041: // programCode
7477          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
7478          return value;
7479        case -1285004149: // quantity
7480          this.quantity = castToQuantity(value); // Quantity
7481          return value;
7482        case -486196699: // unitPrice
7483          this.unitPrice = castToMoney(value); // Money
7484          return value;
7485        case -1282148017: // factor
7486          this.factor = castToDecimal(value); // DecimalType
7487          return value;
7488        case 108957: // net
7489          this.net = castToMoney(value); // Money
7490          return value;
7491        case 115642: // udi
7492          this.getUdi().add(castToReference(value)); // Reference
7493          return value;
7494        case -1110033957: // noteNumber
7495          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
7496          return value;
7497        case -231349275: // adjudication
7498          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7499          return value;
7500        default: return super.setProperty(hash, name, value);
7501        }
7502
7503      }
7504
7505      @Override
7506      public Base setProperty(String name, Base value) throws FHIRException {
7507        if (name.equals("sequence")) {
7508          this.sequence = castToPositiveInt(value); // PositiveIntType
7509        } else if (name.equals("revenue")) {
7510          this.revenue = castToCodeableConcept(value); // CodeableConcept
7511        } else if (name.equals("category")) {
7512          this.category = castToCodeableConcept(value); // CodeableConcept
7513        } else if (name.equals("productOrService")) {
7514          this.productOrService = castToCodeableConcept(value); // CodeableConcept
7515        } else if (name.equals("modifier")) {
7516          this.getModifier().add(castToCodeableConcept(value));
7517        } else if (name.equals("programCode")) {
7518          this.getProgramCode().add(castToCodeableConcept(value));
7519        } else if (name.equals("quantity")) {
7520          this.quantity = castToQuantity(value); // Quantity
7521        } else if (name.equals("unitPrice")) {
7522          this.unitPrice = castToMoney(value); // Money
7523        } else if (name.equals("factor")) {
7524          this.factor = castToDecimal(value); // DecimalType
7525        } else if (name.equals("net")) {
7526          this.net = castToMoney(value); // Money
7527        } else if (name.equals("udi")) {
7528          this.getUdi().add(castToReference(value));
7529        } else if (name.equals("noteNumber")) {
7530          this.getNoteNumber().add(castToPositiveInt(value));
7531        } else if (name.equals("adjudication")) {
7532          this.getAdjudication().add((AdjudicationComponent) value);
7533        } else
7534          return super.setProperty(name, value);
7535        return value;
7536      }
7537
7538      @Override
7539      public Base makeProperty(int hash, String name) throws FHIRException {
7540        switch (hash) {
7541        case 1349547969:  return getSequenceElement();
7542        case 1099842588:  return getRevenue(); 
7543        case 50511102:  return getCategory(); 
7544        case 1957227299:  return getProductOrService(); 
7545        case -615513385:  return addModifier(); 
7546        case 1010065041:  return addProgramCode(); 
7547        case -1285004149:  return getQuantity(); 
7548        case -486196699:  return getUnitPrice(); 
7549        case -1282148017:  return getFactorElement();
7550        case 108957:  return getNet(); 
7551        case 115642:  return addUdi(); 
7552        case -1110033957:  return addNoteNumberElement();
7553        case -231349275:  return addAdjudication(); 
7554        default: return super.makeProperty(hash, name);
7555        }
7556
7557      }
7558
7559      @Override
7560      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7561        switch (hash) {
7562        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
7563        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
7564        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
7565        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
7566        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
7567        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
7568        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
7569        case -486196699: /*unitPrice*/ return new String[] {"Money"};
7570        case -1282148017: /*factor*/ return new String[] {"decimal"};
7571        case 108957: /*net*/ return new String[] {"Money"};
7572        case 115642: /*udi*/ return new String[] {"Reference"};
7573        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
7574        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
7575        default: return super.getTypesForProperty(hash, name);
7576        }
7577
7578      }
7579
7580      @Override
7581      public Base addChild(String name) throws FHIRException {
7582        if (name.equals("sequence")) {
7583          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
7584        }
7585        else if (name.equals("revenue")) {
7586          this.revenue = new CodeableConcept();
7587          return this.revenue;
7588        }
7589        else if (name.equals("category")) {
7590          this.category = new CodeableConcept();
7591          return this.category;
7592        }
7593        else if (name.equals("productOrService")) {
7594          this.productOrService = new CodeableConcept();
7595          return this.productOrService;
7596        }
7597        else if (name.equals("modifier")) {
7598          return addModifier();
7599        }
7600        else if (name.equals("programCode")) {
7601          return addProgramCode();
7602        }
7603        else if (name.equals("quantity")) {
7604          this.quantity = new Quantity();
7605          return this.quantity;
7606        }
7607        else if (name.equals("unitPrice")) {
7608          this.unitPrice = new Money();
7609          return this.unitPrice;
7610        }
7611        else if (name.equals("factor")) {
7612          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
7613        }
7614        else if (name.equals("net")) {
7615          this.net = new Money();
7616          return this.net;
7617        }
7618        else if (name.equals("udi")) {
7619          return addUdi();
7620        }
7621        else if (name.equals("noteNumber")) {
7622          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
7623        }
7624        else if (name.equals("adjudication")) {
7625          return addAdjudication();
7626        }
7627        else
7628          return super.addChild(name);
7629      }
7630
7631      public SubDetailComponent copy() {
7632        SubDetailComponent dst = new SubDetailComponent();
7633        copyValues(dst);
7634        return dst;
7635      }
7636
7637      public void copyValues(SubDetailComponent dst) {
7638        super.copyValues(dst);
7639        dst.sequence = sequence == null ? null : sequence.copy();
7640        dst.revenue = revenue == null ? null : revenue.copy();
7641        dst.category = category == null ? null : category.copy();
7642        dst.productOrService = productOrService == null ? null : productOrService.copy();
7643        if (modifier != null) {
7644          dst.modifier = new ArrayList<CodeableConcept>();
7645          for (CodeableConcept i : modifier)
7646            dst.modifier.add(i.copy());
7647        };
7648        if (programCode != null) {
7649          dst.programCode = new ArrayList<CodeableConcept>();
7650          for (CodeableConcept i : programCode)
7651            dst.programCode.add(i.copy());
7652        };
7653        dst.quantity = quantity == null ? null : quantity.copy();
7654        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7655        dst.factor = factor == null ? null : factor.copy();
7656        dst.net = net == null ? null : net.copy();
7657        if (udi != null) {
7658          dst.udi = new ArrayList<Reference>();
7659          for (Reference i : udi)
7660            dst.udi.add(i.copy());
7661        };
7662        if (noteNumber != null) {
7663          dst.noteNumber = new ArrayList<PositiveIntType>();
7664          for (PositiveIntType i : noteNumber)
7665            dst.noteNumber.add(i.copy());
7666        };
7667        if (adjudication != null) {
7668          dst.adjudication = new ArrayList<AdjudicationComponent>();
7669          for (AdjudicationComponent i : adjudication)
7670            dst.adjudication.add(i.copy());
7671        };
7672      }
7673
7674      @Override
7675      public boolean equalsDeep(Base other_) {
7676        if (!super.equalsDeep(other_))
7677          return false;
7678        if (!(other_ instanceof SubDetailComponent))
7679          return false;
7680        SubDetailComponent o = (SubDetailComponent) other_;
7681        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
7682           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
7683           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
7684           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
7685           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
7686          ;
7687      }
7688
7689      @Override
7690      public boolean equalsShallow(Base other_) {
7691        if (!super.equalsShallow(other_))
7692          return false;
7693        if (!(other_ instanceof SubDetailComponent))
7694          return false;
7695        SubDetailComponent o = (SubDetailComponent) other_;
7696        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
7697          ;
7698      }
7699
7700      public boolean isEmpty() {
7701        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
7702          , productOrService, modifier, programCode, quantity, unitPrice, factor, net, udi
7703          , noteNumber, adjudication);
7704      }
7705
7706  public String fhirType() {
7707    return "ExplanationOfBenefit.item.detail.subDetail";
7708
7709  }
7710
7711  }
7712
7713    @Block()
7714    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
7715        /**
7716         * Claim items which this service line is intended to replace.
7717         */
7718        @Child(name = "itemSequence", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7719        @Description(shortDefinition="Item sequence number", formalDefinition="Claim items which this service line is intended to replace." )
7720        protected List<PositiveIntType> itemSequence;
7721
7722        /**
7723         * The sequence number of the details within the claim item which this line is intended to replace.
7724         */
7725        @Child(name = "detailSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7726        @Description(shortDefinition="Detail sequence number", formalDefinition="The sequence number of the details within the claim item which this line is intended to replace." )
7727        protected List<PositiveIntType> detailSequence;
7728
7729        /**
7730         * The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.
7731         */
7732        @Child(name = "subDetailSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7733        @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." )
7734        protected List<PositiveIntType> subDetailSequence;
7735
7736        /**
7737         * The providers who are authorized for the services rendered to the patient.
7738         */
7739        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7740        @Description(shortDefinition="Authorized providers", formalDefinition="The providers who are authorized for the services rendered to the patient." )
7741        protected List<Reference> provider;
7742        /**
7743         * The actual objects that are the target of the reference (The providers who are authorized for the services rendered to the patient.)
7744         */
7745        protected List<Resource> providerTarget;
7746
7747
7748        /**
7749         * 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.
7750         */
7751        @Child(name = "productOrService", type = {CodeableConcept.class}, order=5, min=1, max=1, modifier=false, summary=false)
7752        @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." )
7753        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
7754        protected CodeableConcept productOrService;
7755
7756        /**
7757         * Item typification or modifiers codes to convey additional context for the product or service.
7758         */
7759        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7760        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
7761        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
7762        protected List<CodeableConcept> modifier;
7763
7764        /**
7765         * Identifies the program under which this may be recovered.
7766         */
7767        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7768        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
7769        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
7770        protected List<CodeableConcept> programCode;
7771
7772        /**
7773         * The date or dates when the service or product was supplied, performed or completed.
7774         */
7775        @Child(name = "serviced", type = {DateType.class, Period.class}, order=8, min=0, max=1, modifier=false, summary=false)
7776        @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." )
7777        protected Type serviced;
7778
7779        /**
7780         * Where the product or service was provided.
7781         */
7782        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=9, min=0, max=1, modifier=false, summary=false)
7783        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
7784        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
7785        protected Type location;
7786
7787        /**
7788         * The number of repetitions of a service or product.
7789         */
7790        @Child(name = "quantity", type = {Quantity.class}, order=10, min=0, max=1, modifier=false, summary=false)
7791        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
7792        protected Quantity quantity;
7793
7794        /**
7795         * 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.
7796         */
7797        @Child(name = "unitPrice", type = {Money.class}, order=11, min=0, max=1, modifier=false, summary=false)
7798        @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." )
7799        protected Money unitPrice;
7800
7801        /**
7802         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
7803         */
7804        @Child(name = "factor", type = {DecimalType.class}, order=12, min=0, max=1, modifier=false, summary=false)
7805        @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." )
7806        protected DecimalType factor;
7807
7808        /**
7809         * The quantity times the unit price for an additional service or product or charge.
7810         */
7811        @Child(name = "net", type = {Money.class}, order=13, min=0, max=1, modifier=false, summary=false)
7812        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
7813        protected Money net;
7814
7815        /**
7816         * Physical service site on the patient (limb, tooth, etc.).
7817         */
7818        @Child(name = "bodySite", type = {CodeableConcept.class}, order=14, min=0, max=1, modifier=false, summary=false)
7819        @Description(shortDefinition="Anatomical location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
7820        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
7821        protected CodeableConcept bodySite;
7822
7823        /**
7824         * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
7825         */
7826        @Child(name = "subSite", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7827        @Description(shortDefinition="Anatomical sub-location", formalDefinition="A region or surface of the bodySite, e.g. limb region or tooth surface(s)." )
7828        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
7829        protected List<CodeableConcept> subSite;
7830
7831        /**
7832         * The numbers associated with notes below which apply to the adjudication of this item.
7833         */
7834        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7835        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
7836        protected List<PositiveIntType> noteNumber;
7837
7838        /**
7839         * The adjudication results.
7840         */
7841        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7842        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
7843        protected List<AdjudicationComponent> adjudication;
7844
7845        /**
7846         * The second-tier service adjudications for payor added services.
7847         */
7848        @Child(name = "detail", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7849        @Description(shortDefinition="Insurer added line items", formalDefinition="The second-tier service adjudications for payor added services." )
7850        protected List<AddedItemDetailComponent> detail;
7851
7852        private static final long serialVersionUID = -206524210L;
7853
7854    /**
7855     * Constructor
7856     */
7857      public AddedItemComponent() {
7858        super();
7859      }
7860
7861    /**
7862     * Constructor
7863     */
7864      public AddedItemComponent(CodeableConcept productOrService) {
7865        super();
7866        this.productOrService = productOrService;
7867      }
7868
7869        /**
7870         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
7871         */
7872        public List<PositiveIntType> getItemSequence() { 
7873          if (this.itemSequence == null)
7874            this.itemSequence = new ArrayList<PositiveIntType>();
7875          return this.itemSequence;
7876        }
7877
7878        /**
7879         * @return Returns a reference to <code>this</code> for easy method chaining
7880         */
7881        public AddedItemComponent setItemSequence(List<PositiveIntType> theItemSequence) { 
7882          this.itemSequence = theItemSequence;
7883          return this;
7884        }
7885
7886        public boolean hasItemSequence() { 
7887          if (this.itemSequence == null)
7888            return false;
7889          for (PositiveIntType item : this.itemSequence)
7890            if (!item.isEmpty())
7891              return true;
7892          return false;
7893        }
7894
7895        /**
7896         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
7897         */
7898        public PositiveIntType addItemSequenceElement() {//2 
7899          PositiveIntType t = new PositiveIntType();
7900          if (this.itemSequence == null)
7901            this.itemSequence = new ArrayList<PositiveIntType>();
7902          this.itemSequence.add(t);
7903          return t;
7904        }
7905
7906        /**
7907         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
7908         */
7909        public AddedItemComponent addItemSequence(int value) { //1
7910          PositiveIntType t = new PositiveIntType();
7911          t.setValue(value);
7912          if (this.itemSequence == null)
7913            this.itemSequence = new ArrayList<PositiveIntType>();
7914          this.itemSequence.add(t);
7915          return this;
7916        }
7917
7918        /**
7919         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
7920         */
7921        public boolean hasItemSequence(int value) { 
7922          if (this.itemSequence == null)
7923            return false;
7924          for (PositiveIntType v : this.itemSequence)
7925            if (v.getValue().equals(value)) // positiveInt
7926              return true;
7927          return false;
7928        }
7929
7930        /**
7931         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7932         */
7933        public List<PositiveIntType> getDetailSequence() { 
7934          if (this.detailSequence == null)
7935            this.detailSequence = new ArrayList<PositiveIntType>();
7936          return this.detailSequence;
7937        }
7938
7939        /**
7940         * @return Returns a reference to <code>this</code> for easy method chaining
7941         */
7942        public AddedItemComponent setDetailSequence(List<PositiveIntType> theDetailSequence) { 
7943          this.detailSequence = theDetailSequence;
7944          return this;
7945        }
7946
7947        public boolean hasDetailSequence() { 
7948          if (this.detailSequence == null)
7949            return false;
7950          for (PositiveIntType item : this.detailSequence)
7951            if (!item.isEmpty())
7952              return true;
7953          return false;
7954        }
7955
7956        /**
7957         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7958         */
7959        public PositiveIntType addDetailSequenceElement() {//2 
7960          PositiveIntType t = new PositiveIntType();
7961          if (this.detailSequence == null)
7962            this.detailSequence = new ArrayList<PositiveIntType>();
7963          this.detailSequence.add(t);
7964          return t;
7965        }
7966
7967        /**
7968         * @param value {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7969         */
7970        public AddedItemComponent addDetailSequence(int value) { //1
7971          PositiveIntType t = new PositiveIntType();
7972          t.setValue(value);
7973          if (this.detailSequence == null)
7974            this.detailSequence = new ArrayList<PositiveIntType>();
7975          this.detailSequence.add(t);
7976          return this;
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 boolean hasDetailSequence(int value) { 
7983          if (this.detailSequence == null)
7984            return false;
7985          for (PositiveIntType v : this.detailSequence)
7986            if (v.getValue().equals(value)) // positiveInt
7987              return true;
7988          return false;
7989        }
7990
7991        /**
7992         * @return {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
7993         */
7994        public List<PositiveIntType> getSubDetailSequence() { 
7995          if (this.subDetailSequence == null)
7996            this.subDetailSequence = new ArrayList<PositiveIntType>();
7997          return this.subDetailSequence;
7998        }
7999
8000        /**
8001         * @return Returns a reference to <code>this</code> for easy method chaining
8002         */
8003        public AddedItemComponent setSubDetailSequence(List<PositiveIntType> theSubDetailSequence) { 
8004          this.subDetailSequence = theSubDetailSequence;
8005          return this;
8006        }
8007
8008        public boolean hasSubDetailSequence() { 
8009          if (this.subDetailSequence == null)
8010            return false;
8011          for (PositiveIntType item : this.subDetailSequence)
8012            if (!item.isEmpty())
8013              return true;
8014          return false;
8015        }
8016
8017        /**
8018         * @return {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
8019         */
8020        public PositiveIntType addSubDetailSequenceElement() {//2 
8021          PositiveIntType t = new PositiveIntType();
8022          if (this.subDetailSequence == null)
8023            this.subDetailSequence = new ArrayList<PositiveIntType>();
8024          this.subDetailSequence.add(t);
8025          return t;
8026        }
8027
8028        /**
8029         * @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.)
8030         */
8031        public AddedItemComponent addSubDetailSequence(int value) { //1
8032          PositiveIntType t = new PositiveIntType();
8033          t.setValue(value);
8034          if (this.subDetailSequence == null)
8035            this.subDetailSequence = new ArrayList<PositiveIntType>();
8036          this.subDetailSequence.add(t);
8037          return this;
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 boolean hasSubDetailSequence(int value) { 
8044          if (this.subDetailSequence == null)
8045            return false;
8046          for (PositiveIntType v : this.subDetailSequence)
8047            if (v.getValue().equals(value)) // positiveInt
8048              return true;
8049          return false;
8050        }
8051
8052        /**
8053         * @return {@link #provider} (The providers who are authorized for the services rendered to the patient.)
8054         */
8055        public List<Reference> getProvider() { 
8056          if (this.provider == null)
8057            this.provider = new ArrayList<Reference>();
8058          return this.provider;
8059        }
8060
8061        /**
8062         * @return Returns a reference to <code>this</code> for easy method chaining
8063         */
8064        public AddedItemComponent setProvider(List<Reference> theProvider) { 
8065          this.provider = theProvider;
8066          return this;
8067        }
8068
8069        public boolean hasProvider() { 
8070          if (this.provider == null)
8071            return false;
8072          for (Reference item : this.provider)
8073            if (!item.isEmpty())
8074              return true;
8075          return false;
8076        }
8077
8078        public Reference addProvider() { //3
8079          Reference t = new Reference();
8080          if (this.provider == null)
8081            this.provider = new ArrayList<Reference>();
8082          this.provider.add(t);
8083          return t;
8084        }
8085
8086        public AddedItemComponent addProvider(Reference t) { //3
8087          if (t == null)
8088            return this;
8089          if (this.provider == null)
8090            this.provider = new ArrayList<Reference>();
8091          this.provider.add(t);
8092          return this;
8093        }
8094
8095        /**
8096         * @return The first repetition of repeating field {@link #provider}, creating it if it does not already exist
8097         */
8098        public Reference getProviderFirstRep() { 
8099          if (getProvider().isEmpty()) {
8100            addProvider();
8101          }
8102          return getProvider().get(0);
8103        }
8104
8105        /**
8106         * @deprecated Use Reference#setResource(IBaseResource) instead
8107         */
8108        @Deprecated
8109        public List<Resource> getProviderTarget() { 
8110          if (this.providerTarget == null)
8111            this.providerTarget = new ArrayList<Resource>();
8112          return this.providerTarget;
8113        }
8114
8115        /**
8116         * @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.)
8117         */
8118        public CodeableConcept getProductOrService() { 
8119          if (this.productOrService == null)
8120            if (Configuration.errorOnAutoCreate())
8121              throw new Error("Attempt to auto-create AddedItemComponent.productOrService");
8122            else if (Configuration.doAutoCreate())
8123              this.productOrService = new CodeableConcept(); // cc
8124          return this.productOrService;
8125        }
8126
8127        public boolean hasProductOrService() { 
8128          return this.productOrService != null && !this.productOrService.isEmpty();
8129        }
8130
8131        /**
8132         * @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.)
8133         */
8134        public AddedItemComponent setProductOrService(CodeableConcept value) { 
8135          this.productOrService = value;
8136          return this;
8137        }
8138
8139        /**
8140         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
8141         */
8142        public List<CodeableConcept> getModifier() { 
8143          if (this.modifier == null)
8144            this.modifier = new ArrayList<CodeableConcept>();
8145          return this.modifier;
8146        }
8147
8148        /**
8149         * @return Returns a reference to <code>this</code> for easy method chaining
8150         */
8151        public AddedItemComponent setModifier(List<CodeableConcept> theModifier) { 
8152          this.modifier = theModifier;
8153          return this;
8154        }
8155
8156        public boolean hasModifier() { 
8157          if (this.modifier == null)
8158            return false;
8159          for (CodeableConcept item : this.modifier)
8160            if (!item.isEmpty())
8161              return true;
8162          return false;
8163        }
8164
8165        public CodeableConcept addModifier() { //3
8166          CodeableConcept t = new CodeableConcept();
8167          if (this.modifier == null)
8168            this.modifier = new ArrayList<CodeableConcept>();
8169          this.modifier.add(t);
8170          return t;
8171        }
8172
8173        public AddedItemComponent addModifier(CodeableConcept t) { //3
8174          if (t == null)
8175            return this;
8176          if (this.modifier == null)
8177            this.modifier = new ArrayList<CodeableConcept>();
8178          this.modifier.add(t);
8179          return this;
8180        }
8181
8182        /**
8183         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
8184         */
8185        public CodeableConcept getModifierFirstRep() { 
8186          if (getModifier().isEmpty()) {
8187            addModifier();
8188          }
8189          return getModifier().get(0);
8190        }
8191
8192        /**
8193         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
8194         */
8195        public List<CodeableConcept> getProgramCode() { 
8196          if (this.programCode == null)
8197            this.programCode = new ArrayList<CodeableConcept>();
8198          return this.programCode;
8199        }
8200
8201        /**
8202         * @return Returns a reference to <code>this</code> for easy method chaining
8203         */
8204        public AddedItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
8205          this.programCode = theProgramCode;
8206          return this;
8207        }
8208
8209        public boolean hasProgramCode() { 
8210          if (this.programCode == null)
8211            return false;
8212          for (CodeableConcept item : this.programCode)
8213            if (!item.isEmpty())
8214              return true;
8215          return false;
8216        }
8217
8218        public CodeableConcept addProgramCode() { //3
8219          CodeableConcept t = new CodeableConcept();
8220          if (this.programCode == null)
8221            this.programCode = new ArrayList<CodeableConcept>();
8222          this.programCode.add(t);
8223          return t;
8224        }
8225
8226        public AddedItemComponent addProgramCode(CodeableConcept t) { //3
8227          if (t == null)
8228            return this;
8229          if (this.programCode == null)
8230            this.programCode = new ArrayList<CodeableConcept>();
8231          this.programCode.add(t);
8232          return this;
8233        }
8234
8235        /**
8236         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
8237         */
8238        public CodeableConcept getProgramCodeFirstRep() { 
8239          if (getProgramCode().isEmpty()) {
8240            addProgramCode();
8241          }
8242          return getProgramCode().get(0);
8243        }
8244
8245        /**
8246         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8247         */
8248        public Type getServiced() { 
8249          return this.serviced;
8250        }
8251
8252        /**
8253         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8254         */
8255        public DateType getServicedDateType() throws FHIRException { 
8256          if (this.serviced == null)
8257            this.serviced = new DateType();
8258          if (!(this.serviced instanceof DateType))
8259            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
8260          return (DateType) this.serviced;
8261        }
8262
8263        public boolean hasServicedDateType() { 
8264          return this != null && this.serviced instanceof DateType;
8265        }
8266
8267        /**
8268         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8269         */
8270        public Period getServicedPeriod() throws FHIRException { 
8271          if (this.serviced == null)
8272            this.serviced = new Period();
8273          if (!(this.serviced instanceof Period))
8274            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
8275          return (Period) this.serviced;
8276        }
8277
8278        public boolean hasServicedPeriod() { 
8279          return this != null && this.serviced instanceof Period;
8280        }
8281
8282        public boolean hasServiced() { 
8283          return this.serviced != null && !this.serviced.isEmpty();
8284        }
8285
8286        /**
8287         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8288         */
8289        public AddedItemComponent setServiced(Type value) { 
8290          if (value != null && !(value instanceof DateType || value instanceof Period))
8291            throw new Error("Not the right type for ExplanationOfBenefit.addItem.serviced[x]: "+value.fhirType());
8292          this.serviced = value;
8293          return this;
8294        }
8295
8296        /**
8297         * @return {@link #location} (Where the product or service was provided.)
8298         */
8299        public Type getLocation() { 
8300          return this.location;
8301        }
8302
8303        /**
8304         * @return {@link #location} (Where the product or service was provided.)
8305         */
8306        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
8307          if (this.location == null)
8308            this.location = new CodeableConcept();
8309          if (!(this.location instanceof CodeableConcept))
8310            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
8311          return (CodeableConcept) this.location;
8312        }
8313
8314        public boolean hasLocationCodeableConcept() { 
8315          return this != null && this.location instanceof CodeableConcept;
8316        }
8317
8318        /**
8319         * @return {@link #location} (Where the product or service was provided.)
8320         */
8321        public Address getLocationAddress() throws FHIRException { 
8322          if (this.location == null)
8323            this.location = new Address();
8324          if (!(this.location instanceof Address))
8325            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
8326          return (Address) this.location;
8327        }
8328
8329        public boolean hasLocationAddress() { 
8330          return this != null && this.location instanceof Address;
8331        }
8332
8333        /**
8334         * @return {@link #location} (Where the product or service was provided.)
8335         */
8336        public Reference getLocationReference() throws FHIRException { 
8337          if (this.location == null)
8338            this.location = new Reference();
8339          if (!(this.location instanceof Reference))
8340            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
8341          return (Reference) this.location;
8342        }
8343
8344        public boolean hasLocationReference() { 
8345          return this != null && this.location instanceof Reference;
8346        }
8347
8348        public boolean hasLocation() { 
8349          return this.location != null && !this.location.isEmpty();
8350        }
8351
8352        /**
8353         * @param value {@link #location} (Where the product or service was provided.)
8354         */
8355        public AddedItemComponent setLocation(Type value) { 
8356          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
8357            throw new Error("Not the right type for ExplanationOfBenefit.addItem.location[x]: "+value.fhirType());
8358          this.location = value;
8359          return this;
8360        }
8361
8362        /**
8363         * @return {@link #quantity} (The number of repetitions of a service or product.)
8364         */
8365        public Quantity getQuantity() { 
8366          if (this.quantity == null)
8367            if (Configuration.errorOnAutoCreate())
8368              throw new Error("Attempt to auto-create AddedItemComponent.quantity");
8369            else if (Configuration.doAutoCreate())
8370              this.quantity = new Quantity(); // cc
8371          return this.quantity;
8372        }
8373
8374        public boolean hasQuantity() { 
8375          return this.quantity != null && !this.quantity.isEmpty();
8376        }
8377
8378        /**
8379         * @param value {@link #quantity} (The number of repetitions of a service or product.)
8380         */
8381        public AddedItemComponent setQuantity(Quantity value) { 
8382          this.quantity = value;
8383          return this;
8384        }
8385
8386        /**
8387         * @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.)
8388         */
8389        public Money getUnitPrice() { 
8390          if (this.unitPrice == null)
8391            if (Configuration.errorOnAutoCreate())
8392              throw new Error("Attempt to auto-create AddedItemComponent.unitPrice");
8393            else if (Configuration.doAutoCreate())
8394              this.unitPrice = new Money(); // cc
8395          return this.unitPrice;
8396        }
8397
8398        public boolean hasUnitPrice() { 
8399          return this.unitPrice != null && !this.unitPrice.isEmpty();
8400        }
8401
8402        /**
8403         * @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.)
8404         */
8405        public AddedItemComponent setUnitPrice(Money value) { 
8406          this.unitPrice = value;
8407          return this;
8408        }
8409
8410        /**
8411         * @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
8412         */
8413        public DecimalType getFactorElement() { 
8414          if (this.factor == null)
8415            if (Configuration.errorOnAutoCreate())
8416              throw new Error("Attempt to auto-create AddedItemComponent.factor");
8417            else if (Configuration.doAutoCreate())
8418              this.factor = new DecimalType(); // bb
8419          return this.factor;
8420        }
8421
8422        public boolean hasFactorElement() { 
8423          return this.factor != null && !this.factor.isEmpty();
8424        }
8425
8426        public boolean hasFactor() { 
8427          return this.factor != null && !this.factor.isEmpty();
8428        }
8429
8430        /**
8431         * @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
8432         */
8433        public AddedItemComponent setFactorElement(DecimalType value) { 
8434          this.factor = value;
8435          return this;
8436        }
8437
8438        /**
8439         * @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.
8440         */
8441        public BigDecimal getFactor() { 
8442          return this.factor == null ? null : this.factor.getValue();
8443        }
8444
8445        /**
8446         * @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.
8447         */
8448        public AddedItemComponent setFactor(BigDecimal value) { 
8449          if (value == null)
8450            this.factor = null;
8451          else {
8452            if (this.factor == null)
8453              this.factor = new DecimalType();
8454            this.factor.setValue(value);
8455          }
8456          return this;
8457        }
8458
8459        /**
8460         * @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.
8461         */
8462        public AddedItemComponent setFactor(long value) { 
8463              this.factor = new DecimalType();
8464            this.factor.setValue(value);
8465          return this;
8466        }
8467
8468        /**
8469         * @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.
8470         */
8471        public AddedItemComponent setFactor(double value) { 
8472              this.factor = new DecimalType();
8473            this.factor.setValue(value);
8474          return this;
8475        }
8476
8477        /**
8478         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8479         */
8480        public Money getNet() { 
8481          if (this.net == null)
8482            if (Configuration.errorOnAutoCreate())
8483              throw new Error("Attempt to auto-create AddedItemComponent.net");
8484            else if (Configuration.doAutoCreate())
8485              this.net = new Money(); // cc
8486          return this.net;
8487        }
8488
8489        public boolean hasNet() { 
8490          return this.net != null && !this.net.isEmpty();
8491        }
8492
8493        /**
8494         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8495         */
8496        public AddedItemComponent setNet(Money value) { 
8497          this.net = value;
8498          return this;
8499        }
8500
8501        /**
8502         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
8503         */
8504        public CodeableConcept getBodySite() { 
8505          if (this.bodySite == null)
8506            if (Configuration.errorOnAutoCreate())
8507              throw new Error("Attempt to auto-create AddedItemComponent.bodySite");
8508            else if (Configuration.doAutoCreate())
8509              this.bodySite = new CodeableConcept(); // cc
8510          return this.bodySite;
8511        }
8512
8513        public boolean hasBodySite() { 
8514          return this.bodySite != null && !this.bodySite.isEmpty();
8515        }
8516
8517        /**
8518         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
8519         */
8520        public AddedItemComponent setBodySite(CodeableConcept value) { 
8521          this.bodySite = value;
8522          return this;
8523        }
8524
8525        /**
8526         * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb region or tooth surface(s).)
8527         */
8528        public List<CodeableConcept> getSubSite() { 
8529          if (this.subSite == null)
8530            this.subSite = new ArrayList<CodeableConcept>();
8531          return this.subSite;
8532        }
8533
8534        /**
8535         * @return Returns a reference to <code>this</code> for easy method chaining
8536         */
8537        public AddedItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
8538          this.subSite = theSubSite;
8539          return this;
8540        }
8541
8542        public boolean hasSubSite() { 
8543          if (this.subSite == null)
8544            return false;
8545          for (CodeableConcept item : this.subSite)
8546            if (!item.isEmpty())
8547              return true;
8548          return false;
8549        }
8550
8551        public CodeableConcept addSubSite() { //3
8552          CodeableConcept t = new CodeableConcept();
8553          if (this.subSite == null)
8554            this.subSite = new ArrayList<CodeableConcept>();
8555          this.subSite.add(t);
8556          return t;
8557        }
8558
8559        public AddedItemComponent addSubSite(CodeableConcept t) { //3
8560          if (t == null)
8561            return this;
8562          if (this.subSite == null)
8563            this.subSite = new ArrayList<CodeableConcept>();
8564          this.subSite.add(t);
8565          return this;
8566        }
8567
8568        /**
8569         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist
8570         */
8571        public CodeableConcept getSubSiteFirstRep() { 
8572          if (getSubSite().isEmpty()) {
8573            addSubSite();
8574          }
8575          return getSubSite().get(0);
8576        }
8577
8578        /**
8579         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8580         */
8581        public List<PositiveIntType> getNoteNumber() { 
8582          if (this.noteNumber == null)
8583            this.noteNumber = new ArrayList<PositiveIntType>();
8584          return this.noteNumber;
8585        }
8586
8587        /**
8588         * @return Returns a reference to <code>this</code> for easy method chaining
8589         */
8590        public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
8591          this.noteNumber = theNoteNumber;
8592          return this;
8593        }
8594
8595        public boolean hasNoteNumber() { 
8596          if (this.noteNumber == null)
8597            return false;
8598          for (PositiveIntType item : this.noteNumber)
8599            if (!item.isEmpty())
8600              return true;
8601          return false;
8602        }
8603
8604        /**
8605         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8606         */
8607        public PositiveIntType addNoteNumberElement() {//2 
8608          PositiveIntType t = new PositiveIntType();
8609          if (this.noteNumber == null)
8610            this.noteNumber = new ArrayList<PositiveIntType>();
8611          this.noteNumber.add(t);
8612          return t;
8613        }
8614
8615        /**
8616         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8617         */
8618        public AddedItemComponent addNoteNumber(int value) { //1
8619          PositiveIntType t = new PositiveIntType();
8620          t.setValue(value);
8621          if (this.noteNumber == null)
8622            this.noteNumber = new ArrayList<PositiveIntType>();
8623          this.noteNumber.add(t);
8624          return this;
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 boolean hasNoteNumber(int value) { 
8631          if (this.noteNumber == null)
8632            return false;
8633          for (PositiveIntType v : this.noteNumber)
8634            if (v.getValue().equals(value)) // positiveInt
8635              return true;
8636          return false;
8637        }
8638
8639        /**
8640         * @return {@link #adjudication} (The adjudication results.)
8641         */
8642        public List<AdjudicationComponent> getAdjudication() { 
8643          if (this.adjudication == null)
8644            this.adjudication = new ArrayList<AdjudicationComponent>();
8645          return this.adjudication;
8646        }
8647
8648        /**
8649         * @return Returns a reference to <code>this</code> for easy method chaining
8650         */
8651        public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
8652          this.adjudication = theAdjudication;
8653          return this;
8654        }
8655
8656        public boolean hasAdjudication() { 
8657          if (this.adjudication == null)
8658            return false;
8659          for (AdjudicationComponent item : this.adjudication)
8660            if (!item.isEmpty())
8661              return true;
8662          return false;
8663        }
8664
8665        public AdjudicationComponent addAdjudication() { //3
8666          AdjudicationComponent t = new AdjudicationComponent();
8667          if (this.adjudication == null)
8668            this.adjudication = new ArrayList<AdjudicationComponent>();
8669          this.adjudication.add(t);
8670          return t;
8671        }
8672
8673        public AddedItemComponent addAdjudication(AdjudicationComponent t) { //3
8674          if (t == null)
8675            return this;
8676          if (this.adjudication == null)
8677            this.adjudication = new ArrayList<AdjudicationComponent>();
8678          this.adjudication.add(t);
8679          return this;
8680        }
8681
8682        /**
8683         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
8684         */
8685        public AdjudicationComponent getAdjudicationFirstRep() { 
8686          if (getAdjudication().isEmpty()) {
8687            addAdjudication();
8688          }
8689          return getAdjudication().get(0);
8690        }
8691
8692        /**
8693         * @return {@link #detail} (The second-tier service adjudications for payor added services.)
8694         */
8695        public List<AddedItemDetailComponent> getDetail() { 
8696          if (this.detail == null)
8697            this.detail = new ArrayList<AddedItemDetailComponent>();
8698          return this.detail;
8699        }
8700
8701        /**
8702         * @return Returns a reference to <code>this</code> for easy method chaining
8703         */
8704        public AddedItemComponent setDetail(List<AddedItemDetailComponent> theDetail) { 
8705          this.detail = theDetail;
8706          return this;
8707        }
8708
8709        public boolean hasDetail() { 
8710          if (this.detail == null)
8711            return false;
8712          for (AddedItemDetailComponent item : this.detail)
8713            if (!item.isEmpty())
8714              return true;
8715          return false;
8716        }
8717
8718        public AddedItemDetailComponent addDetail() { //3
8719          AddedItemDetailComponent t = new AddedItemDetailComponent();
8720          if (this.detail == null)
8721            this.detail = new ArrayList<AddedItemDetailComponent>();
8722          this.detail.add(t);
8723          return t;
8724        }
8725
8726        public AddedItemComponent addDetail(AddedItemDetailComponent t) { //3
8727          if (t == null)
8728            return this;
8729          if (this.detail == null)
8730            this.detail = new ArrayList<AddedItemDetailComponent>();
8731          this.detail.add(t);
8732          return this;
8733        }
8734
8735        /**
8736         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
8737         */
8738        public AddedItemDetailComponent getDetailFirstRep() { 
8739          if (getDetail().isEmpty()) {
8740            addDetail();
8741          }
8742          return getDetail().get(0);
8743        }
8744
8745        protected void listChildren(List<Property> children) {
8746          super.listChildren(children);
8747          children.add(new Property("itemSequence", "positiveInt", "Claim items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, itemSequence));
8748          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));
8749          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));
8750          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));
8751          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));
8752          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));
8753          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
8754          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));
8755          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location));
8756          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
8757          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));
8758          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));
8759          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
8760          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
8761          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));
8762          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));
8763          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
8764          children.add(new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail));
8765        }
8766
8767        @Override
8768        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8769          switch (_hash) {
8770          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);
8771          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);
8772          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);
8773          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);
8774          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);
8775          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);
8776          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
8777          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);
8778          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);
8779          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);
8780          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);
8781          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8782          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8783          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8784          case -1280020865: /*locationAddress*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8785          case 755866390: /*locationReference*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8786          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
8787          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);
8788          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);
8789          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);
8790          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
8791          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);
8792          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);
8793          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
8794          case -1335224239: /*detail*/  return new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail);
8795          default: return super.getNamedProperty(_hash, _name, _checkValid);
8796          }
8797
8798        }
8799
8800      @Override
8801      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8802        switch (hash) {
8803        case 1977979892: /*itemSequence*/ return this.itemSequence == null ? new Base[0] : this.itemSequence.toArray(new Base[this.itemSequence.size()]); // PositiveIntType
8804        case 1321472818: /*detailSequence*/ return this.detailSequence == null ? new Base[0] : this.detailSequence.toArray(new Base[this.detailSequence.size()]); // PositiveIntType
8805        case -855462510: /*subDetailSequence*/ return this.subDetailSequence == null ? new Base[0] : this.subDetailSequence.toArray(new Base[this.subDetailSequence.size()]); // PositiveIntType
8806        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : this.provider.toArray(new Base[this.provider.size()]); // Reference
8807        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
8808        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
8809        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
8810        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
8811        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
8812        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
8813        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
8814        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
8815        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
8816        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
8817        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
8818        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
8819        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
8820        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemDetailComponent
8821        default: return super.getProperty(hash, name, checkValid);
8822        }
8823
8824      }
8825
8826      @Override
8827      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8828        switch (hash) {
8829        case 1977979892: // itemSequence
8830          this.getItemSequence().add(castToPositiveInt(value)); // PositiveIntType
8831          return value;
8832        case 1321472818: // detailSequence
8833          this.getDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
8834          return value;
8835        case -855462510: // subDetailSequence
8836          this.getSubDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
8837          return value;
8838        case -987494927: // provider
8839          this.getProvider().add(castToReference(value)); // Reference
8840          return value;
8841        case 1957227299: // productOrService
8842          this.productOrService = castToCodeableConcept(value); // CodeableConcept
8843          return value;
8844        case -615513385: // modifier
8845          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
8846          return value;
8847        case 1010065041: // programCode
8848          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
8849          return value;
8850        case 1379209295: // serviced
8851          this.serviced = castToType(value); // Type
8852          return value;
8853        case 1901043637: // location
8854          this.location = castToType(value); // Type
8855          return value;
8856        case -1285004149: // quantity
8857          this.quantity = castToQuantity(value); // Quantity
8858          return value;
8859        case -486196699: // unitPrice
8860          this.unitPrice = castToMoney(value); // Money
8861          return value;
8862        case -1282148017: // factor
8863          this.factor = castToDecimal(value); // DecimalType
8864          return value;
8865        case 108957: // net
8866          this.net = castToMoney(value); // Money
8867          return value;
8868        case 1702620169: // bodySite
8869          this.bodySite = castToCodeableConcept(value); // CodeableConcept
8870          return value;
8871        case -1868566105: // subSite
8872          this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
8873          return value;
8874        case -1110033957: // noteNumber
8875          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
8876          return value;
8877        case -231349275: // adjudication
8878          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
8879          return value;
8880        case -1335224239: // detail
8881          this.getDetail().add((AddedItemDetailComponent) value); // AddedItemDetailComponent
8882          return value;
8883        default: return super.setProperty(hash, name, value);
8884        }
8885
8886      }
8887
8888      @Override
8889      public Base setProperty(String name, Base value) throws FHIRException {
8890        if (name.equals("itemSequence")) {
8891          this.getItemSequence().add(castToPositiveInt(value));
8892        } else if (name.equals("detailSequence")) {
8893          this.getDetailSequence().add(castToPositiveInt(value));
8894        } else if (name.equals("subDetailSequence")) {
8895          this.getSubDetailSequence().add(castToPositiveInt(value));
8896        } else if (name.equals("provider")) {
8897          this.getProvider().add(castToReference(value));
8898        } else if (name.equals("productOrService")) {
8899          this.productOrService = castToCodeableConcept(value); // CodeableConcept
8900        } else if (name.equals("modifier")) {
8901          this.getModifier().add(castToCodeableConcept(value));
8902        } else if (name.equals("programCode")) {
8903          this.getProgramCode().add(castToCodeableConcept(value));
8904        } else if (name.equals("serviced[x]")) {
8905          this.serviced = castToType(value); // Type
8906        } else if (name.equals("location[x]")) {
8907          this.location = castToType(value); // Type
8908        } else if (name.equals("quantity")) {
8909          this.quantity = castToQuantity(value); // Quantity
8910        } else if (name.equals("unitPrice")) {
8911          this.unitPrice = castToMoney(value); // Money
8912        } else if (name.equals("factor")) {
8913          this.factor = castToDecimal(value); // DecimalType
8914        } else if (name.equals("net")) {
8915          this.net = castToMoney(value); // Money
8916        } else if (name.equals("bodySite")) {
8917          this.bodySite = castToCodeableConcept(value); // CodeableConcept
8918        } else if (name.equals("subSite")) {
8919          this.getSubSite().add(castToCodeableConcept(value));
8920        } else if (name.equals("noteNumber")) {
8921          this.getNoteNumber().add(castToPositiveInt(value));
8922        } else if (name.equals("adjudication")) {
8923          this.getAdjudication().add((AdjudicationComponent) value);
8924        } else if (name.equals("detail")) {
8925          this.getDetail().add((AddedItemDetailComponent) value);
8926        } else
8927          return super.setProperty(name, value);
8928        return value;
8929      }
8930
8931      @Override
8932      public Base makeProperty(int hash, String name) throws FHIRException {
8933        switch (hash) {
8934        case 1977979892:  return addItemSequenceElement();
8935        case 1321472818:  return addDetailSequenceElement();
8936        case -855462510:  return addSubDetailSequenceElement();
8937        case -987494927:  return addProvider(); 
8938        case 1957227299:  return getProductOrService(); 
8939        case -615513385:  return addModifier(); 
8940        case 1010065041:  return addProgramCode(); 
8941        case -1927922223:  return getServiced(); 
8942        case 1379209295:  return getServiced(); 
8943        case 552316075:  return getLocation(); 
8944        case 1901043637:  return getLocation(); 
8945        case -1285004149:  return getQuantity(); 
8946        case -486196699:  return getUnitPrice(); 
8947        case -1282148017:  return getFactorElement();
8948        case 108957:  return getNet(); 
8949        case 1702620169:  return getBodySite(); 
8950        case -1868566105:  return addSubSite(); 
8951        case -1110033957:  return addNoteNumberElement();
8952        case -231349275:  return addAdjudication(); 
8953        case -1335224239:  return addDetail(); 
8954        default: return super.makeProperty(hash, name);
8955        }
8956
8957      }
8958
8959      @Override
8960      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8961        switch (hash) {
8962        case 1977979892: /*itemSequence*/ return new String[] {"positiveInt"};
8963        case 1321472818: /*detailSequence*/ return new String[] {"positiveInt"};
8964        case -855462510: /*subDetailSequence*/ return new String[] {"positiveInt"};
8965        case -987494927: /*provider*/ return new String[] {"Reference"};
8966        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
8967        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
8968        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
8969        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
8970        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
8971        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
8972        case -486196699: /*unitPrice*/ return new String[] {"Money"};
8973        case -1282148017: /*factor*/ return new String[] {"decimal"};
8974        case 108957: /*net*/ return new String[] {"Money"};
8975        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
8976        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
8977        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
8978        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
8979        case -1335224239: /*detail*/ return new String[] {};
8980        default: return super.getTypesForProperty(hash, name);
8981        }
8982
8983      }
8984
8985      @Override
8986      public Base addChild(String name) throws FHIRException {
8987        if (name.equals("itemSequence")) {
8988          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.itemSequence");
8989        }
8990        else if (name.equals("detailSequence")) {
8991          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.detailSequence");
8992        }
8993        else if (name.equals("subDetailSequence")) {
8994          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.subDetailSequence");
8995        }
8996        else if (name.equals("provider")) {
8997          return addProvider();
8998        }
8999        else if (name.equals("productOrService")) {
9000          this.productOrService = new CodeableConcept();
9001          return this.productOrService;
9002        }
9003        else if (name.equals("modifier")) {
9004          return addModifier();
9005        }
9006        else if (name.equals("programCode")) {
9007          return addProgramCode();
9008        }
9009        else if (name.equals("servicedDate")) {
9010          this.serviced = new DateType();
9011          return this.serviced;
9012        }
9013        else if (name.equals("servicedPeriod")) {
9014          this.serviced = new Period();
9015          return this.serviced;
9016        }
9017        else if (name.equals("locationCodeableConcept")) {
9018          this.location = new CodeableConcept();
9019          return this.location;
9020        }
9021        else if (name.equals("locationAddress")) {
9022          this.location = new Address();
9023          return this.location;
9024        }
9025        else if (name.equals("locationReference")) {
9026          this.location = new Reference();
9027          return this.location;
9028        }
9029        else if (name.equals("quantity")) {
9030          this.quantity = new Quantity();
9031          return this.quantity;
9032        }
9033        else if (name.equals("unitPrice")) {
9034          this.unitPrice = new Money();
9035          return this.unitPrice;
9036        }
9037        else if (name.equals("factor")) {
9038          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
9039        }
9040        else if (name.equals("net")) {
9041          this.net = new Money();
9042          return this.net;
9043        }
9044        else if (name.equals("bodySite")) {
9045          this.bodySite = new CodeableConcept();
9046          return this.bodySite;
9047        }
9048        else if (name.equals("subSite")) {
9049          return addSubSite();
9050        }
9051        else if (name.equals("noteNumber")) {
9052          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
9053        }
9054        else if (name.equals("adjudication")) {
9055          return addAdjudication();
9056        }
9057        else if (name.equals("detail")) {
9058          return addDetail();
9059        }
9060        else
9061          return super.addChild(name);
9062      }
9063
9064      public AddedItemComponent copy() {
9065        AddedItemComponent dst = new AddedItemComponent();
9066        copyValues(dst);
9067        return dst;
9068      }
9069
9070      public void copyValues(AddedItemComponent dst) {
9071        super.copyValues(dst);
9072        if (itemSequence != null) {
9073          dst.itemSequence = new ArrayList<PositiveIntType>();
9074          for (PositiveIntType i : itemSequence)
9075            dst.itemSequence.add(i.copy());
9076        };
9077        if (detailSequence != null) {
9078          dst.detailSequence = new ArrayList<PositiveIntType>();
9079          for (PositiveIntType i : detailSequence)
9080            dst.detailSequence.add(i.copy());
9081        };
9082        if (subDetailSequence != null) {
9083          dst.subDetailSequence = new ArrayList<PositiveIntType>();
9084          for (PositiveIntType i : subDetailSequence)
9085            dst.subDetailSequence.add(i.copy());
9086        };
9087        if (provider != null) {
9088          dst.provider = new ArrayList<Reference>();
9089          for (Reference i : provider)
9090            dst.provider.add(i.copy());
9091        };
9092        dst.productOrService = productOrService == null ? null : productOrService.copy();
9093        if (modifier != null) {
9094          dst.modifier = new ArrayList<CodeableConcept>();
9095          for (CodeableConcept i : modifier)
9096            dst.modifier.add(i.copy());
9097        };
9098        if (programCode != null) {
9099          dst.programCode = new ArrayList<CodeableConcept>();
9100          for (CodeableConcept i : programCode)
9101            dst.programCode.add(i.copy());
9102        };
9103        dst.serviced = serviced == null ? null : serviced.copy();
9104        dst.location = location == null ? null : location.copy();
9105        dst.quantity = quantity == null ? null : quantity.copy();
9106        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
9107        dst.factor = factor == null ? null : factor.copy();
9108        dst.net = net == null ? null : net.copy();
9109        dst.bodySite = bodySite == null ? null : bodySite.copy();
9110        if (subSite != null) {
9111          dst.subSite = new ArrayList<CodeableConcept>();
9112          for (CodeableConcept i : subSite)
9113            dst.subSite.add(i.copy());
9114        };
9115        if (noteNumber != null) {
9116          dst.noteNumber = new ArrayList<PositiveIntType>();
9117          for (PositiveIntType i : noteNumber)
9118            dst.noteNumber.add(i.copy());
9119        };
9120        if (adjudication != null) {
9121          dst.adjudication = new ArrayList<AdjudicationComponent>();
9122          for (AdjudicationComponent i : adjudication)
9123            dst.adjudication.add(i.copy());
9124        };
9125        if (detail != null) {
9126          dst.detail = new ArrayList<AddedItemDetailComponent>();
9127          for (AddedItemDetailComponent i : detail)
9128            dst.detail.add(i.copy());
9129        };
9130      }
9131
9132      @Override
9133      public boolean equalsDeep(Base other_) {
9134        if (!super.equalsDeep(other_))
9135          return false;
9136        if (!(other_ instanceof AddedItemComponent))
9137          return false;
9138        AddedItemComponent o = (AddedItemComponent) other_;
9139        return compareDeep(itemSequence, o.itemSequence, true) && compareDeep(detailSequence, o.detailSequence, true)
9140           && compareDeep(subDetailSequence, o.subDetailSequence, true) && compareDeep(provider, o.provider, true)
9141           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
9142           && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
9143           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
9144           && compareDeep(net, o.net, true) && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true)
9145           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
9146           && compareDeep(detail, o.detail, true);
9147      }
9148
9149      @Override
9150      public boolean equalsShallow(Base other_) {
9151        if (!super.equalsShallow(other_))
9152          return false;
9153        if (!(other_ instanceof AddedItemComponent))
9154          return false;
9155        AddedItemComponent o = (AddedItemComponent) other_;
9156        return compareValues(itemSequence, o.itemSequence, true) && compareValues(detailSequence, o.detailSequence, true)
9157           && compareValues(subDetailSequence, o.subDetailSequence, true) && compareValues(factor, o.factor, true)
9158           && compareValues(noteNumber, o.noteNumber, true);
9159      }
9160
9161      public boolean isEmpty() {
9162        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(itemSequence, detailSequence
9163          , subDetailSequence, provider, productOrService, modifier, programCode, serviced
9164          , location, quantity, unitPrice, factor, net, bodySite, subSite, noteNumber
9165          , adjudication, detail);
9166      }
9167
9168  public String fhirType() {
9169    return "ExplanationOfBenefit.addItem";
9170
9171  }
9172
9173  }
9174
9175    @Block()
9176    public static class AddedItemDetailComponent extends BackboneElement implements IBaseBackboneElement {
9177        /**
9178         * 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.
9179         */
9180        @Child(name = "productOrService", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9181        @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." )
9182        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
9183        protected CodeableConcept productOrService;
9184
9185        /**
9186         * Item typification or modifiers codes to convey additional context for the product or service.
9187         */
9188        @Child(name = "modifier", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9189        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
9190        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
9191        protected List<CodeableConcept> modifier;
9192
9193        /**
9194         * The number of repetitions of a service or product.
9195         */
9196        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
9197        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
9198        protected Quantity quantity;
9199
9200        /**
9201         * 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.
9202         */
9203        @Child(name = "unitPrice", type = {Money.class}, order=4, min=0, max=1, modifier=false, summary=false)
9204        @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." )
9205        protected Money unitPrice;
9206
9207        /**
9208         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
9209         */
9210        @Child(name = "factor", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=false)
9211        @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." )
9212        protected DecimalType factor;
9213
9214        /**
9215         * The quantity times the unit price for an additional service or product or charge.
9216         */
9217        @Child(name = "net", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
9218        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
9219        protected Money net;
9220
9221        /**
9222         * The numbers associated with notes below which apply to the adjudication of this item.
9223         */
9224        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9225        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
9226        protected List<PositiveIntType> noteNumber;
9227
9228        /**
9229         * The adjudication results.
9230         */
9231        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9232        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
9233        protected List<AdjudicationComponent> adjudication;
9234
9235        /**
9236         * The third-tier service adjudications for payor added services.
9237         */
9238        @Child(name = "subDetail", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9239        @Description(shortDefinition="Insurer added line items", formalDefinition="The third-tier service adjudications for payor added services." )
9240        protected List<AddedItemDetailSubDetailComponent> subDetail;
9241
9242        private static final long serialVersionUID = 295910869L;
9243
9244    /**
9245     * Constructor
9246     */
9247      public AddedItemDetailComponent() {
9248        super();
9249      }
9250
9251    /**
9252     * Constructor
9253     */
9254      public AddedItemDetailComponent(CodeableConcept productOrService) {
9255        super();
9256        this.productOrService = productOrService;
9257      }
9258
9259        /**
9260         * @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.)
9261         */
9262        public CodeableConcept getProductOrService() { 
9263          if (this.productOrService == null)
9264            if (Configuration.errorOnAutoCreate())
9265              throw new Error("Attempt to auto-create AddedItemDetailComponent.productOrService");
9266            else if (Configuration.doAutoCreate())
9267              this.productOrService = new CodeableConcept(); // cc
9268          return this.productOrService;
9269        }
9270
9271        public boolean hasProductOrService() { 
9272          return this.productOrService != null && !this.productOrService.isEmpty();
9273        }
9274
9275        /**
9276         * @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.)
9277         */
9278        public AddedItemDetailComponent setProductOrService(CodeableConcept value) { 
9279          this.productOrService = value;
9280          return this;
9281        }
9282
9283        /**
9284         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
9285         */
9286        public List<CodeableConcept> getModifier() { 
9287          if (this.modifier == null)
9288            this.modifier = new ArrayList<CodeableConcept>();
9289          return this.modifier;
9290        }
9291
9292        /**
9293         * @return Returns a reference to <code>this</code> for easy method chaining
9294         */
9295        public AddedItemDetailComponent setModifier(List<CodeableConcept> theModifier) { 
9296          this.modifier = theModifier;
9297          return this;
9298        }
9299
9300        public boolean hasModifier() { 
9301          if (this.modifier == null)
9302            return false;
9303          for (CodeableConcept item : this.modifier)
9304            if (!item.isEmpty())
9305              return true;
9306          return false;
9307        }
9308
9309        public CodeableConcept addModifier() { //3
9310          CodeableConcept t = new CodeableConcept();
9311          if (this.modifier == null)
9312            this.modifier = new ArrayList<CodeableConcept>();
9313          this.modifier.add(t);
9314          return t;
9315        }
9316
9317        public AddedItemDetailComponent addModifier(CodeableConcept t) { //3
9318          if (t == null)
9319            return this;
9320          if (this.modifier == null)
9321            this.modifier = new ArrayList<CodeableConcept>();
9322          this.modifier.add(t);
9323          return this;
9324        }
9325
9326        /**
9327         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
9328         */
9329        public CodeableConcept getModifierFirstRep() { 
9330          if (getModifier().isEmpty()) {
9331            addModifier();
9332          }
9333          return getModifier().get(0);
9334        }
9335
9336        /**
9337         * @return {@link #quantity} (The number of repetitions of a service or product.)
9338         */
9339        public Quantity getQuantity() { 
9340          if (this.quantity == null)
9341            if (Configuration.errorOnAutoCreate())
9342              throw new Error("Attempt to auto-create AddedItemDetailComponent.quantity");
9343            else if (Configuration.doAutoCreate())
9344              this.quantity = new Quantity(); // cc
9345          return this.quantity;
9346        }
9347
9348        public boolean hasQuantity() { 
9349          return this.quantity != null && !this.quantity.isEmpty();
9350        }
9351
9352        /**
9353         * @param value {@link #quantity} (The number of repetitions of a service or product.)
9354         */
9355        public AddedItemDetailComponent setQuantity(Quantity value) { 
9356          this.quantity = value;
9357          return this;
9358        }
9359
9360        /**
9361         * @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.)
9362         */
9363        public Money getUnitPrice() { 
9364          if (this.unitPrice == null)
9365            if (Configuration.errorOnAutoCreate())
9366              throw new Error("Attempt to auto-create AddedItemDetailComponent.unitPrice");
9367            else if (Configuration.doAutoCreate())
9368              this.unitPrice = new Money(); // cc
9369          return this.unitPrice;
9370        }
9371
9372        public boolean hasUnitPrice() { 
9373          return this.unitPrice != null && !this.unitPrice.isEmpty();
9374        }
9375
9376        /**
9377         * @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.)
9378         */
9379        public AddedItemDetailComponent setUnitPrice(Money value) { 
9380          this.unitPrice = value;
9381          return this;
9382        }
9383
9384        /**
9385         * @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
9386         */
9387        public DecimalType getFactorElement() { 
9388          if (this.factor == null)
9389            if (Configuration.errorOnAutoCreate())
9390              throw new Error("Attempt to auto-create AddedItemDetailComponent.factor");
9391            else if (Configuration.doAutoCreate())
9392              this.factor = new DecimalType(); // bb
9393          return this.factor;
9394        }
9395
9396        public boolean hasFactorElement() { 
9397          return this.factor != null && !this.factor.isEmpty();
9398        }
9399
9400        public boolean hasFactor() { 
9401          return this.factor != null && !this.factor.isEmpty();
9402        }
9403
9404        /**
9405         * @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
9406         */
9407        public AddedItemDetailComponent setFactorElement(DecimalType value) { 
9408          this.factor = value;
9409          return this;
9410        }
9411
9412        /**
9413         * @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.
9414         */
9415        public BigDecimal getFactor() { 
9416          return this.factor == null ? null : this.factor.getValue();
9417        }
9418
9419        /**
9420         * @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.
9421         */
9422        public AddedItemDetailComponent setFactor(BigDecimal value) { 
9423          if (value == null)
9424            this.factor = null;
9425          else {
9426            if (this.factor == null)
9427              this.factor = new DecimalType();
9428            this.factor.setValue(value);
9429          }
9430          return this;
9431        }
9432
9433        /**
9434         * @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.
9435         */
9436        public AddedItemDetailComponent setFactor(long value) { 
9437              this.factor = new DecimalType();
9438            this.factor.setValue(value);
9439          return this;
9440        }
9441
9442        /**
9443         * @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.
9444         */
9445        public AddedItemDetailComponent setFactor(double value) { 
9446              this.factor = new DecimalType();
9447            this.factor.setValue(value);
9448          return this;
9449        }
9450
9451        /**
9452         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9453         */
9454        public Money getNet() { 
9455          if (this.net == null)
9456            if (Configuration.errorOnAutoCreate())
9457              throw new Error("Attempt to auto-create AddedItemDetailComponent.net");
9458            else if (Configuration.doAutoCreate())
9459              this.net = new Money(); // cc
9460          return this.net;
9461        }
9462
9463        public boolean hasNet() { 
9464          return this.net != null && !this.net.isEmpty();
9465        }
9466
9467        /**
9468         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9469         */
9470        public AddedItemDetailComponent setNet(Money value) { 
9471          this.net = value;
9472          return this;
9473        }
9474
9475        /**
9476         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9477         */
9478        public List<PositiveIntType> getNoteNumber() { 
9479          if (this.noteNumber == null)
9480            this.noteNumber = new ArrayList<PositiveIntType>();
9481          return this.noteNumber;
9482        }
9483
9484        /**
9485         * @return Returns a reference to <code>this</code> for easy method chaining
9486         */
9487        public AddedItemDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
9488          this.noteNumber = theNoteNumber;
9489          return this;
9490        }
9491
9492        public boolean hasNoteNumber() { 
9493          if (this.noteNumber == null)
9494            return false;
9495          for (PositiveIntType item : this.noteNumber)
9496            if (!item.isEmpty())
9497              return true;
9498          return false;
9499        }
9500
9501        /**
9502         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9503         */
9504        public PositiveIntType addNoteNumberElement() {//2 
9505          PositiveIntType t = new PositiveIntType();
9506          if (this.noteNumber == null)
9507            this.noteNumber = new ArrayList<PositiveIntType>();
9508          this.noteNumber.add(t);
9509          return t;
9510        }
9511
9512        /**
9513         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9514         */
9515        public AddedItemDetailComponent addNoteNumber(int value) { //1
9516          PositiveIntType t = new PositiveIntType();
9517          t.setValue(value);
9518          if (this.noteNumber == null)
9519            this.noteNumber = new ArrayList<PositiveIntType>();
9520          this.noteNumber.add(t);
9521          return this;
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 boolean hasNoteNumber(int value) { 
9528          if (this.noteNumber == null)
9529            return false;
9530          for (PositiveIntType v : this.noteNumber)
9531            if (v.getValue().equals(value)) // positiveInt
9532              return true;
9533          return false;
9534        }
9535
9536        /**
9537         * @return {@link #adjudication} (The adjudication results.)
9538         */
9539        public List<AdjudicationComponent> getAdjudication() { 
9540          if (this.adjudication == null)
9541            this.adjudication = new ArrayList<AdjudicationComponent>();
9542          return this.adjudication;
9543        }
9544
9545        /**
9546         * @return Returns a reference to <code>this</code> for easy method chaining
9547         */
9548        public AddedItemDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
9549          this.adjudication = theAdjudication;
9550          return this;
9551        }
9552
9553        public boolean hasAdjudication() { 
9554          if (this.adjudication == null)
9555            return false;
9556          for (AdjudicationComponent item : this.adjudication)
9557            if (!item.isEmpty())
9558              return true;
9559          return false;
9560        }
9561
9562        public AdjudicationComponent addAdjudication() { //3
9563          AdjudicationComponent t = new AdjudicationComponent();
9564          if (this.adjudication == null)
9565            this.adjudication = new ArrayList<AdjudicationComponent>();
9566          this.adjudication.add(t);
9567          return t;
9568        }
9569
9570        public AddedItemDetailComponent addAdjudication(AdjudicationComponent t) { //3
9571          if (t == null)
9572            return this;
9573          if (this.adjudication == null)
9574            this.adjudication = new ArrayList<AdjudicationComponent>();
9575          this.adjudication.add(t);
9576          return this;
9577        }
9578
9579        /**
9580         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
9581         */
9582        public AdjudicationComponent getAdjudicationFirstRep() { 
9583          if (getAdjudication().isEmpty()) {
9584            addAdjudication();
9585          }
9586          return getAdjudication().get(0);
9587        }
9588
9589        /**
9590         * @return {@link #subDetail} (The third-tier service adjudications for payor added services.)
9591         */
9592        public List<AddedItemDetailSubDetailComponent> getSubDetail() { 
9593          if (this.subDetail == null)
9594            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9595          return this.subDetail;
9596        }
9597
9598        /**
9599         * @return Returns a reference to <code>this</code> for easy method chaining
9600         */
9601        public AddedItemDetailComponent setSubDetail(List<AddedItemDetailSubDetailComponent> theSubDetail) { 
9602          this.subDetail = theSubDetail;
9603          return this;
9604        }
9605
9606        public boolean hasSubDetail() { 
9607          if (this.subDetail == null)
9608            return false;
9609          for (AddedItemDetailSubDetailComponent item : this.subDetail)
9610            if (!item.isEmpty())
9611              return true;
9612          return false;
9613        }
9614
9615        public AddedItemDetailSubDetailComponent addSubDetail() { //3
9616          AddedItemDetailSubDetailComponent t = new AddedItemDetailSubDetailComponent();
9617          if (this.subDetail == null)
9618            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9619          this.subDetail.add(t);
9620          return t;
9621        }
9622
9623        public AddedItemDetailComponent addSubDetail(AddedItemDetailSubDetailComponent t) { //3
9624          if (t == null)
9625            return this;
9626          if (this.subDetail == null)
9627            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9628          this.subDetail.add(t);
9629          return this;
9630        }
9631
9632        /**
9633         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist
9634         */
9635        public AddedItemDetailSubDetailComponent getSubDetailFirstRep() { 
9636          if (getSubDetail().isEmpty()) {
9637            addSubDetail();
9638          }
9639          return getSubDetail().get(0);
9640        }
9641
9642        protected void listChildren(List<Property> children) {
9643          super.listChildren(children);
9644          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));
9645          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));
9646          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
9647          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));
9648          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));
9649          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
9650          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));
9651          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
9652          children.add(new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
9653        }
9654
9655        @Override
9656        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9657          switch (_hash) {
9658          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);
9659          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);
9660          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
9661          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);
9662          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);
9663          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);
9664          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);
9665          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
9666          case -828829007: /*subDetail*/  return new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
9667          default: return super.getNamedProperty(_hash, _name, _checkValid);
9668          }
9669
9670        }
9671
9672      @Override
9673      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9674        switch (hash) {
9675        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
9676        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
9677        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
9678        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
9679        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
9680        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
9681        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
9682        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
9683        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // AddedItemDetailSubDetailComponent
9684        default: return super.getProperty(hash, name, checkValid);
9685        }
9686
9687      }
9688
9689      @Override
9690      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9691        switch (hash) {
9692        case 1957227299: // productOrService
9693          this.productOrService = castToCodeableConcept(value); // CodeableConcept
9694          return value;
9695        case -615513385: // modifier
9696          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
9697          return value;
9698        case -1285004149: // quantity
9699          this.quantity = castToQuantity(value); // Quantity
9700          return value;
9701        case -486196699: // unitPrice
9702          this.unitPrice = castToMoney(value); // Money
9703          return value;
9704        case -1282148017: // factor
9705          this.factor = castToDecimal(value); // DecimalType
9706          return value;
9707        case 108957: // net
9708          this.net = castToMoney(value); // Money
9709          return value;
9710        case -1110033957: // noteNumber
9711          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
9712          return value;
9713        case -231349275: // adjudication
9714          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
9715          return value;
9716        case -828829007: // subDetail
9717          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value); // AddedItemDetailSubDetailComponent
9718          return value;
9719        default: return super.setProperty(hash, name, value);
9720        }
9721
9722      }
9723
9724      @Override
9725      public Base setProperty(String name, Base value) throws FHIRException {
9726        if (name.equals("productOrService")) {
9727          this.productOrService = castToCodeableConcept(value); // CodeableConcept
9728        } else if (name.equals("modifier")) {
9729          this.getModifier().add(castToCodeableConcept(value));
9730        } else if (name.equals("quantity")) {
9731          this.quantity = castToQuantity(value); // Quantity
9732        } else if (name.equals("unitPrice")) {
9733          this.unitPrice = castToMoney(value); // Money
9734        } else if (name.equals("factor")) {
9735          this.factor = castToDecimal(value); // DecimalType
9736        } else if (name.equals("net")) {
9737          this.net = castToMoney(value); // Money
9738        } else if (name.equals("noteNumber")) {
9739          this.getNoteNumber().add(castToPositiveInt(value));
9740        } else if (name.equals("adjudication")) {
9741          this.getAdjudication().add((AdjudicationComponent) value);
9742        } else if (name.equals("subDetail")) {
9743          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value);
9744        } else
9745          return super.setProperty(name, value);
9746        return value;
9747      }
9748
9749      @Override
9750      public Base makeProperty(int hash, String name) throws FHIRException {
9751        switch (hash) {
9752        case 1957227299:  return getProductOrService(); 
9753        case -615513385:  return addModifier(); 
9754        case -1285004149:  return getQuantity(); 
9755        case -486196699:  return getUnitPrice(); 
9756        case -1282148017:  return getFactorElement();
9757        case 108957:  return getNet(); 
9758        case -1110033957:  return addNoteNumberElement();
9759        case -231349275:  return addAdjudication(); 
9760        case -828829007:  return addSubDetail(); 
9761        default: return super.makeProperty(hash, name);
9762        }
9763
9764      }
9765
9766      @Override
9767      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9768        switch (hash) {
9769        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
9770        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
9771        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
9772        case -486196699: /*unitPrice*/ return new String[] {"Money"};
9773        case -1282148017: /*factor*/ return new String[] {"decimal"};
9774        case 108957: /*net*/ return new String[] {"Money"};
9775        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
9776        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
9777        case -828829007: /*subDetail*/ return new String[] {};
9778        default: return super.getTypesForProperty(hash, name);
9779        }
9780
9781      }
9782
9783      @Override
9784      public Base addChild(String name) throws FHIRException {
9785        if (name.equals("productOrService")) {
9786          this.productOrService = new CodeableConcept();
9787          return this.productOrService;
9788        }
9789        else if (name.equals("modifier")) {
9790          return addModifier();
9791        }
9792        else if (name.equals("quantity")) {
9793          this.quantity = new Quantity();
9794          return this.quantity;
9795        }
9796        else if (name.equals("unitPrice")) {
9797          this.unitPrice = new Money();
9798          return this.unitPrice;
9799        }
9800        else if (name.equals("factor")) {
9801          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
9802        }
9803        else if (name.equals("net")) {
9804          this.net = new Money();
9805          return this.net;
9806        }
9807        else if (name.equals("noteNumber")) {
9808          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
9809        }
9810        else if (name.equals("adjudication")) {
9811          return addAdjudication();
9812        }
9813        else if (name.equals("subDetail")) {
9814          return addSubDetail();
9815        }
9816        else
9817          return super.addChild(name);
9818      }
9819
9820      public AddedItemDetailComponent copy() {
9821        AddedItemDetailComponent dst = new AddedItemDetailComponent();
9822        copyValues(dst);
9823        return dst;
9824      }
9825
9826      public void copyValues(AddedItemDetailComponent dst) {
9827        super.copyValues(dst);
9828        dst.productOrService = productOrService == null ? null : productOrService.copy();
9829        if (modifier != null) {
9830          dst.modifier = new ArrayList<CodeableConcept>();
9831          for (CodeableConcept i : modifier)
9832            dst.modifier.add(i.copy());
9833        };
9834        dst.quantity = quantity == null ? null : quantity.copy();
9835        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
9836        dst.factor = factor == null ? null : factor.copy();
9837        dst.net = net == null ? null : net.copy();
9838        if (noteNumber != null) {
9839          dst.noteNumber = new ArrayList<PositiveIntType>();
9840          for (PositiveIntType i : noteNumber)
9841            dst.noteNumber.add(i.copy());
9842        };
9843        if (adjudication != null) {
9844          dst.adjudication = new ArrayList<AdjudicationComponent>();
9845          for (AdjudicationComponent i : adjudication)
9846            dst.adjudication.add(i.copy());
9847        };
9848        if (subDetail != null) {
9849          dst.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9850          for (AddedItemDetailSubDetailComponent i : subDetail)
9851            dst.subDetail.add(i.copy());
9852        };
9853      }
9854
9855      @Override
9856      public boolean equalsDeep(Base other_) {
9857        if (!super.equalsDeep(other_))
9858          return false;
9859        if (!(other_ instanceof AddedItemDetailComponent))
9860          return false;
9861        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
9862        return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
9863           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
9864           && compareDeep(net, o.net, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
9865           && compareDeep(subDetail, o.subDetail, true);
9866      }
9867
9868      @Override
9869      public boolean equalsShallow(Base other_) {
9870        if (!super.equalsShallow(other_))
9871          return false;
9872        if (!(other_ instanceof AddedItemDetailComponent))
9873          return false;
9874        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
9875        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
9876      }
9877
9878      public boolean isEmpty() {
9879        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier
9880          , quantity, unitPrice, factor, net, noteNumber, adjudication, subDetail);
9881      }
9882
9883  public String fhirType() {
9884    return "ExplanationOfBenefit.addItem.detail";
9885
9886  }
9887
9888  }
9889
9890    @Block()
9891    public static class AddedItemDetailSubDetailComponent extends BackboneElement implements IBaseBackboneElement {
9892        /**
9893         * 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.
9894         */
9895        @Child(name = "productOrService", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9896        @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." )
9897        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
9898        protected CodeableConcept productOrService;
9899
9900        /**
9901         * Item typification or modifiers codes to convey additional context for the product or service.
9902         */
9903        @Child(name = "modifier", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9904        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
9905        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
9906        protected List<CodeableConcept> modifier;
9907
9908        /**
9909         * The number of repetitions of a service or product.
9910         */
9911        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
9912        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
9913        protected Quantity quantity;
9914
9915        /**
9916         * 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.
9917         */
9918        @Child(name = "unitPrice", type = {Money.class}, order=4, min=0, max=1, modifier=false, summary=false)
9919        @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." )
9920        protected Money unitPrice;
9921
9922        /**
9923         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
9924         */
9925        @Child(name = "factor", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=false)
9926        @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." )
9927        protected DecimalType factor;
9928
9929        /**
9930         * The quantity times the unit price for an additional service or product or charge.
9931         */
9932        @Child(name = "net", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
9933        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
9934        protected Money net;
9935
9936        /**
9937         * The numbers associated with notes below which apply to the adjudication of this item.
9938         */
9939        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9940        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
9941        protected List<PositiveIntType> noteNumber;
9942
9943        /**
9944         * The adjudication results.
9945         */
9946        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9947        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
9948        protected List<AdjudicationComponent> adjudication;
9949
9950        private static final long serialVersionUID = 1301363592L;
9951
9952    /**
9953     * Constructor
9954     */
9955      public AddedItemDetailSubDetailComponent() {
9956        super();
9957      }
9958
9959    /**
9960     * Constructor
9961     */
9962      public AddedItemDetailSubDetailComponent(CodeableConcept productOrService) {
9963        super();
9964        this.productOrService = productOrService;
9965      }
9966
9967        /**
9968         * @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.)
9969         */
9970        public CodeableConcept getProductOrService() { 
9971          if (this.productOrService == null)
9972            if (Configuration.errorOnAutoCreate())
9973              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.productOrService");
9974            else if (Configuration.doAutoCreate())
9975              this.productOrService = new CodeableConcept(); // cc
9976          return this.productOrService;
9977        }
9978
9979        public boolean hasProductOrService() { 
9980          return this.productOrService != null && !this.productOrService.isEmpty();
9981        }
9982
9983        /**
9984         * @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.)
9985         */
9986        public AddedItemDetailSubDetailComponent setProductOrService(CodeableConcept value) { 
9987          this.productOrService = value;
9988          return this;
9989        }
9990
9991        /**
9992         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
9993         */
9994        public List<CodeableConcept> getModifier() { 
9995          if (this.modifier == null)
9996            this.modifier = new ArrayList<CodeableConcept>();
9997          return this.modifier;
9998        }
9999
10000        /**
10001         * @return Returns a reference to <code>this</code> for easy method chaining
10002         */
10003        public AddedItemDetailSubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
10004          this.modifier = theModifier;
10005          return this;
10006        }
10007
10008        public boolean hasModifier() { 
10009          if (this.modifier == null)
10010            return false;
10011          for (CodeableConcept item : this.modifier)
10012            if (!item.isEmpty())
10013              return true;
10014          return false;
10015        }
10016
10017        public CodeableConcept addModifier() { //3
10018          CodeableConcept t = new CodeableConcept();
10019          if (this.modifier == null)
10020            this.modifier = new ArrayList<CodeableConcept>();
10021          this.modifier.add(t);
10022          return t;
10023        }
10024
10025        public AddedItemDetailSubDetailComponent addModifier(CodeableConcept t) { //3
10026          if (t == null)
10027            return this;
10028          if (this.modifier == null)
10029            this.modifier = new ArrayList<CodeableConcept>();
10030          this.modifier.add(t);
10031          return this;
10032        }
10033
10034        /**
10035         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
10036         */
10037        public CodeableConcept getModifierFirstRep() { 
10038          if (getModifier().isEmpty()) {
10039            addModifier();
10040          }
10041          return getModifier().get(0);
10042        }
10043
10044        /**
10045         * @return {@link #quantity} (The number of repetitions of a service or product.)
10046         */
10047        public Quantity getQuantity() { 
10048          if (this.quantity == null)
10049            if (Configuration.errorOnAutoCreate())
10050              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.quantity");
10051            else if (Configuration.doAutoCreate())
10052              this.quantity = new Quantity(); // cc
10053          return this.quantity;
10054        }
10055
10056        public boolean hasQuantity() { 
10057          return this.quantity != null && !this.quantity.isEmpty();
10058        }
10059
10060        /**
10061         * @param value {@link #quantity} (The number of repetitions of a service or product.)
10062         */
10063        public AddedItemDetailSubDetailComponent setQuantity(Quantity value) { 
10064          this.quantity = value;
10065          return this;
10066        }
10067
10068        /**
10069         * @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.)
10070         */
10071        public Money getUnitPrice() { 
10072          if (this.unitPrice == null)
10073            if (Configuration.errorOnAutoCreate())
10074              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.unitPrice");
10075            else if (Configuration.doAutoCreate())
10076              this.unitPrice = new Money(); // cc
10077          return this.unitPrice;
10078        }
10079
10080        public boolean hasUnitPrice() { 
10081          return this.unitPrice != null && !this.unitPrice.isEmpty();
10082        }
10083
10084        /**
10085         * @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.)
10086         */
10087        public AddedItemDetailSubDetailComponent setUnitPrice(Money value) { 
10088          this.unitPrice = value;
10089          return this;
10090        }
10091
10092        /**
10093         * @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
10094         */
10095        public DecimalType getFactorElement() { 
10096          if (this.factor == null)
10097            if (Configuration.errorOnAutoCreate())
10098              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.factor");
10099            else if (Configuration.doAutoCreate())
10100              this.factor = new DecimalType(); // bb
10101          return this.factor;
10102        }
10103
10104        public boolean hasFactorElement() { 
10105          return this.factor != null && !this.factor.isEmpty();
10106        }
10107
10108        public boolean hasFactor() { 
10109          return this.factor != null && !this.factor.isEmpty();
10110        }
10111
10112        /**
10113         * @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
10114         */
10115        public AddedItemDetailSubDetailComponent setFactorElement(DecimalType value) { 
10116          this.factor = value;
10117          return this;
10118        }
10119
10120        /**
10121         * @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.
10122         */
10123        public BigDecimal getFactor() { 
10124          return this.factor == null ? null : this.factor.getValue();
10125        }
10126
10127        /**
10128         * @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.
10129         */
10130        public AddedItemDetailSubDetailComponent setFactor(BigDecimal value) { 
10131          if (value == null)
10132            this.factor = null;
10133          else {
10134            if (this.factor == null)
10135              this.factor = new DecimalType();
10136            this.factor.setValue(value);
10137          }
10138          return this;
10139        }
10140
10141        /**
10142         * @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.
10143         */
10144        public AddedItemDetailSubDetailComponent setFactor(long value) { 
10145              this.factor = new DecimalType();
10146            this.factor.setValue(value);
10147          return this;
10148        }
10149
10150        /**
10151         * @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.
10152         */
10153        public AddedItemDetailSubDetailComponent setFactor(double value) { 
10154              this.factor = new DecimalType();
10155            this.factor.setValue(value);
10156          return this;
10157        }
10158
10159        /**
10160         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
10161         */
10162        public Money getNet() { 
10163          if (this.net == null)
10164            if (Configuration.errorOnAutoCreate())
10165              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.net");
10166            else if (Configuration.doAutoCreate())
10167              this.net = new Money(); // cc
10168          return this.net;
10169        }
10170
10171        public boolean hasNet() { 
10172          return this.net != null && !this.net.isEmpty();
10173        }
10174
10175        /**
10176         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
10177         */
10178        public AddedItemDetailSubDetailComponent setNet(Money value) { 
10179          this.net = value;
10180          return this;
10181        }
10182
10183        /**
10184         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10185         */
10186        public List<PositiveIntType> getNoteNumber() { 
10187          if (this.noteNumber == null)
10188            this.noteNumber = new ArrayList<PositiveIntType>();
10189          return this.noteNumber;
10190        }
10191
10192        /**
10193         * @return Returns a reference to <code>this</code> for easy method chaining
10194         */
10195        public AddedItemDetailSubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
10196          this.noteNumber = theNoteNumber;
10197          return this;
10198        }
10199
10200        public boolean hasNoteNumber() { 
10201          if (this.noteNumber == null)
10202            return false;
10203          for (PositiveIntType item : this.noteNumber)
10204            if (!item.isEmpty())
10205              return true;
10206          return false;
10207        }
10208
10209        /**
10210         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10211         */
10212        public PositiveIntType addNoteNumberElement() {//2 
10213          PositiveIntType t = new PositiveIntType();
10214          if (this.noteNumber == null)
10215            this.noteNumber = new ArrayList<PositiveIntType>();
10216          this.noteNumber.add(t);
10217          return t;
10218        }
10219
10220        /**
10221         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10222         */
10223        public AddedItemDetailSubDetailComponent addNoteNumber(int value) { //1
10224          PositiveIntType t = new PositiveIntType();
10225          t.setValue(value);
10226          if (this.noteNumber == null)
10227            this.noteNumber = new ArrayList<PositiveIntType>();
10228          this.noteNumber.add(t);
10229          return this;
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 boolean hasNoteNumber(int value) { 
10236          if (this.noteNumber == null)
10237            return false;
10238          for (PositiveIntType v : this.noteNumber)
10239            if (v.getValue().equals(value)) // positiveInt
10240              return true;
10241          return false;
10242        }
10243
10244        /**
10245         * @return {@link #adjudication} (The adjudication results.)
10246         */
10247        public List<AdjudicationComponent> getAdjudication() { 
10248          if (this.adjudication == null)
10249            this.adjudication = new ArrayList<AdjudicationComponent>();
10250          return this.adjudication;
10251        }
10252
10253        /**
10254         * @return Returns a reference to <code>this</code> for easy method chaining
10255         */
10256        public AddedItemDetailSubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
10257          this.adjudication = theAdjudication;
10258          return this;
10259        }
10260
10261        public boolean hasAdjudication() { 
10262          if (this.adjudication == null)
10263            return false;
10264          for (AdjudicationComponent item : this.adjudication)
10265            if (!item.isEmpty())
10266              return true;
10267          return false;
10268        }
10269
10270        public AdjudicationComponent addAdjudication() { //3
10271          AdjudicationComponent t = new AdjudicationComponent();
10272          if (this.adjudication == null)
10273            this.adjudication = new ArrayList<AdjudicationComponent>();
10274          this.adjudication.add(t);
10275          return t;
10276        }
10277
10278        public AddedItemDetailSubDetailComponent addAdjudication(AdjudicationComponent t) { //3
10279          if (t == null)
10280            return this;
10281          if (this.adjudication == null)
10282            this.adjudication = new ArrayList<AdjudicationComponent>();
10283          this.adjudication.add(t);
10284          return this;
10285        }
10286
10287        /**
10288         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
10289         */
10290        public AdjudicationComponent getAdjudicationFirstRep() { 
10291          if (getAdjudication().isEmpty()) {
10292            addAdjudication();
10293          }
10294          return getAdjudication().get(0);
10295        }
10296
10297        protected void listChildren(List<Property> children) {
10298          super.listChildren(children);
10299          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));
10300          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));
10301          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
10302          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));
10303          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));
10304          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
10305          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));
10306          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
10307        }
10308
10309        @Override
10310        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10311          switch (_hash) {
10312          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);
10313          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);
10314          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
10315          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);
10316          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);
10317          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);
10318          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);
10319          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
10320          default: return super.getNamedProperty(_hash, _name, _checkValid);
10321          }
10322
10323        }
10324
10325      @Override
10326      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10327        switch (hash) {
10328        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
10329        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
10330        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
10331        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
10332        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
10333        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
10334        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
10335        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
10336        default: return super.getProperty(hash, name, checkValid);
10337        }
10338
10339      }
10340
10341      @Override
10342      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10343        switch (hash) {
10344        case 1957227299: // productOrService
10345          this.productOrService = castToCodeableConcept(value); // CodeableConcept
10346          return value;
10347        case -615513385: // modifier
10348          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
10349          return value;
10350        case -1285004149: // quantity
10351          this.quantity = castToQuantity(value); // Quantity
10352          return value;
10353        case -486196699: // unitPrice
10354          this.unitPrice = castToMoney(value); // Money
10355          return value;
10356        case -1282148017: // factor
10357          this.factor = castToDecimal(value); // DecimalType
10358          return value;
10359        case 108957: // net
10360          this.net = castToMoney(value); // Money
10361          return value;
10362        case -1110033957: // noteNumber
10363          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
10364          return value;
10365        case -231349275: // adjudication
10366          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
10367          return value;
10368        default: return super.setProperty(hash, name, value);
10369        }
10370
10371      }
10372
10373      @Override
10374      public Base setProperty(String name, Base value) throws FHIRException {
10375        if (name.equals("productOrService")) {
10376          this.productOrService = castToCodeableConcept(value); // CodeableConcept
10377        } else if (name.equals("modifier")) {
10378          this.getModifier().add(castToCodeableConcept(value));
10379        } else if (name.equals("quantity")) {
10380          this.quantity = castToQuantity(value); // Quantity
10381        } else if (name.equals("unitPrice")) {
10382          this.unitPrice = castToMoney(value); // Money
10383        } else if (name.equals("factor")) {
10384          this.factor = castToDecimal(value); // DecimalType
10385        } else if (name.equals("net")) {
10386          this.net = castToMoney(value); // Money
10387        } else if (name.equals("noteNumber")) {
10388          this.getNoteNumber().add(castToPositiveInt(value));
10389        } else if (name.equals("adjudication")) {
10390          this.getAdjudication().add((AdjudicationComponent) value);
10391        } else
10392          return super.setProperty(name, value);
10393        return value;
10394      }
10395
10396      @Override
10397      public Base makeProperty(int hash, String name) throws FHIRException {
10398        switch (hash) {
10399        case 1957227299:  return getProductOrService(); 
10400        case -615513385:  return addModifier(); 
10401        case -1285004149:  return getQuantity(); 
10402        case -486196699:  return getUnitPrice(); 
10403        case -1282148017:  return getFactorElement();
10404        case 108957:  return getNet(); 
10405        case -1110033957:  return addNoteNumberElement();
10406        case -231349275:  return addAdjudication(); 
10407        default: return super.makeProperty(hash, name);
10408        }
10409
10410      }
10411
10412      @Override
10413      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10414        switch (hash) {
10415        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
10416        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
10417        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
10418        case -486196699: /*unitPrice*/ return new String[] {"Money"};
10419        case -1282148017: /*factor*/ return new String[] {"decimal"};
10420        case 108957: /*net*/ return new String[] {"Money"};
10421        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
10422        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
10423        default: return super.getTypesForProperty(hash, name);
10424        }
10425
10426      }
10427
10428      @Override
10429      public Base addChild(String name) throws FHIRException {
10430        if (name.equals("productOrService")) {
10431          this.productOrService = new CodeableConcept();
10432          return this.productOrService;
10433        }
10434        else if (name.equals("modifier")) {
10435          return addModifier();
10436        }
10437        else if (name.equals("quantity")) {
10438          this.quantity = new Quantity();
10439          return this.quantity;
10440        }
10441        else if (name.equals("unitPrice")) {
10442          this.unitPrice = new Money();
10443          return this.unitPrice;
10444        }
10445        else if (name.equals("factor")) {
10446          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
10447        }
10448        else if (name.equals("net")) {
10449          this.net = new Money();
10450          return this.net;
10451        }
10452        else if (name.equals("noteNumber")) {
10453          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
10454        }
10455        else if (name.equals("adjudication")) {
10456          return addAdjudication();
10457        }
10458        else
10459          return super.addChild(name);
10460      }
10461
10462      public AddedItemDetailSubDetailComponent copy() {
10463        AddedItemDetailSubDetailComponent dst = new AddedItemDetailSubDetailComponent();
10464        copyValues(dst);
10465        return dst;
10466      }
10467
10468      public void copyValues(AddedItemDetailSubDetailComponent dst) {
10469        super.copyValues(dst);
10470        dst.productOrService = productOrService == null ? null : productOrService.copy();
10471        if (modifier != null) {
10472          dst.modifier = new ArrayList<CodeableConcept>();
10473          for (CodeableConcept i : modifier)
10474            dst.modifier.add(i.copy());
10475        };
10476        dst.quantity = quantity == null ? null : quantity.copy();
10477        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
10478        dst.factor = factor == null ? null : factor.copy();
10479        dst.net = net == null ? null : net.copy();
10480        if (noteNumber != null) {
10481          dst.noteNumber = new ArrayList<PositiveIntType>();
10482          for (PositiveIntType i : noteNumber)
10483            dst.noteNumber.add(i.copy());
10484        };
10485        if (adjudication != null) {
10486          dst.adjudication = new ArrayList<AdjudicationComponent>();
10487          for (AdjudicationComponent i : adjudication)
10488            dst.adjudication.add(i.copy());
10489        };
10490      }
10491
10492      @Override
10493      public boolean equalsDeep(Base other_) {
10494        if (!super.equalsDeep(other_))
10495          return false;
10496        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
10497          return false;
10498        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
10499        return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
10500           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
10501           && compareDeep(net, o.net, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
10502          ;
10503      }
10504
10505      @Override
10506      public boolean equalsShallow(Base other_) {
10507        if (!super.equalsShallow(other_))
10508          return false;
10509        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
10510          return false;
10511        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
10512        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
10513      }
10514
10515      public boolean isEmpty() {
10516        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier
10517          , quantity, unitPrice, factor, net, noteNumber, adjudication);
10518      }
10519
10520  public String fhirType() {
10521    return "ExplanationOfBenefit.addItem.detail.subDetail";
10522
10523  }
10524
10525  }
10526
10527    @Block()
10528    public static class TotalComponent extends BackboneElement implements IBaseBackboneElement {
10529        /**
10530         * 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.
10531         */
10532        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
10533        @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." )
10534        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
10535        protected CodeableConcept category;
10536
10537        /**
10538         * Monetary total amount associated with the category.
10539         */
10540        @Child(name = "amount", type = {Money.class}, order=2, min=1, max=1, modifier=false, summary=true)
10541        @Description(shortDefinition="Financial total for the category", formalDefinition="Monetary total amount associated with the category." )
10542        protected Money amount;
10543
10544        private static final long serialVersionUID = 2012310309L;
10545
10546    /**
10547     * Constructor
10548     */
10549      public TotalComponent() {
10550        super();
10551      }
10552
10553    /**
10554     * Constructor
10555     */
10556      public TotalComponent(CodeableConcept category, Money amount) {
10557        super();
10558        this.category = category;
10559        this.amount = amount;
10560      }
10561
10562        /**
10563         * @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.)
10564         */
10565        public CodeableConcept getCategory() { 
10566          if (this.category == null)
10567            if (Configuration.errorOnAutoCreate())
10568              throw new Error("Attempt to auto-create TotalComponent.category");
10569            else if (Configuration.doAutoCreate())
10570              this.category = new CodeableConcept(); // cc
10571          return this.category;
10572        }
10573
10574        public boolean hasCategory() { 
10575          return this.category != null && !this.category.isEmpty();
10576        }
10577
10578        /**
10579         * @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.)
10580         */
10581        public TotalComponent setCategory(CodeableConcept value) { 
10582          this.category = value;
10583          return this;
10584        }
10585
10586        /**
10587         * @return {@link #amount} (Monetary total amount associated with the category.)
10588         */
10589        public Money getAmount() { 
10590          if (this.amount == null)
10591            if (Configuration.errorOnAutoCreate())
10592              throw new Error("Attempt to auto-create TotalComponent.amount");
10593            else if (Configuration.doAutoCreate())
10594              this.amount = new Money(); // cc
10595          return this.amount;
10596        }
10597
10598        public boolean hasAmount() { 
10599          return this.amount != null && !this.amount.isEmpty();
10600        }
10601
10602        /**
10603         * @param value {@link #amount} (Monetary total amount associated with the category.)
10604         */
10605        public TotalComponent setAmount(Money value) { 
10606          this.amount = value;
10607          return this;
10608        }
10609
10610        protected void listChildren(List<Property> children) {
10611          super.listChildren(children);
10612          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));
10613          children.add(new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount));
10614        }
10615
10616        @Override
10617        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10618          switch (_hash) {
10619          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);
10620          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount);
10621          default: return super.getNamedProperty(_hash, _name, _checkValid);
10622          }
10623
10624        }
10625
10626      @Override
10627      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10628        switch (hash) {
10629        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
10630        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
10631        default: return super.getProperty(hash, name, checkValid);
10632        }
10633
10634      }
10635
10636      @Override
10637      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10638        switch (hash) {
10639        case 50511102: // category
10640          this.category = castToCodeableConcept(value); // CodeableConcept
10641          return value;
10642        case -1413853096: // amount
10643          this.amount = castToMoney(value); // Money
10644          return value;
10645        default: return super.setProperty(hash, name, value);
10646        }
10647
10648      }
10649
10650      @Override
10651      public Base setProperty(String name, Base value) throws FHIRException {
10652        if (name.equals("category")) {
10653          this.category = castToCodeableConcept(value); // CodeableConcept
10654        } else if (name.equals("amount")) {
10655          this.amount = castToMoney(value); // Money
10656        } else
10657          return super.setProperty(name, value);
10658        return value;
10659      }
10660
10661      @Override
10662      public Base makeProperty(int hash, String name) throws FHIRException {
10663        switch (hash) {
10664        case 50511102:  return getCategory(); 
10665        case -1413853096:  return getAmount(); 
10666        default: return super.makeProperty(hash, name);
10667        }
10668
10669      }
10670
10671      @Override
10672      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10673        switch (hash) {
10674        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
10675        case -1413853096: /*amount*/ return new String[] {"Money"};
10676        default: return super.getTypesForProperty(hash, name);
10677        }
10678
10679      }
10680
10681      @Override
10682      public Base addChild(String name) throws FHIRException {
10683        if (name.equals("category")) {
10684          this.category = new CodeableConcept();
10685          return this.category;
10686        }
10687        else if (name.equals("amount")) {
10688          this.amount = new Money();
10689          return this.amount;
10690        }
10691        else
10692          return super.addChild(name);
10693      }
10694
10695      public TotalComponent copy() {
10696        TotalComponent dst = new TotalComponent();
10697        copyValues(dst);
10698        return dst;
10699      }
10700
10701      public void copyValues(TotalComponent dst) {
10702        super.copyValues(dst);
10703        dst.category = category == null ? null : category.copy();
10704        dst.amount = amount == null ? null : amount.copy();
10705      }
10706
10707      @Override
10708      public boolean equalsDeep(Base other_) {
10709        if (!super.equalsDeep(other_))
10710          return false;
10711        if (!(other_ instanceof TotalComponent))
10712          return false;
10713        TotalComponent o = (TotalComponent) other_;
10714        return compareDeep(category, o.category, true) && compareDeep(amount, o.amount, true);
10715      }
10716
10717      @Override
10718      public boolean equalsShallow(Base other_) {
10719        if (!super.equalsShallow(other_))
10720          return false;
10721        if (!(other_ instanceof TotalComponent))
10722          return false;
10723        TotalComponent o = (TotalComponent) other_;
10724        return true;
10725      }
10726
10727      public boolean isEmpty() {
10728        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, amount);
10729      }
10730
10731  public String fhirType() {
10732    return "ExplanationOfBenefit.total";
10733
10734  }
10735
10736  }
10737
10738    @Block()
10739    public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
10740        /**
10741         * Whether this represents partial or complete payment of the benefits payable.
10742         */
10743        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
10744        @Description(shortDefinition="Partial or complete payment", formalDefinition="Whether this represents partial or complete payment of the benefits payable." )
10745        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-paymenttype")
10746        protected CodeableConcept type;
10747
10748        /**
10749         * Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.
10750         */
10751        @Child(name = "adjustment", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
10752        @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." )
10753        protected Money adjustment;
10754
10755        /**
10756         * Reason for the payment adjustment.
10757         */
10758        @Child(name = "adjustmentReason", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
10759        @Description(shortDefinition="Explanation for the variance", formalDefinition="Reason for the payment adjustment." )
10760        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
10761        protected CodeableConcept adjustmentReason;
10762
10763        /**
10764         * Estimated date the payment will be issued or the actual issue date of payment.
10765         */
10766        @Child(name = "date", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=false)
10767        @Description(shortDefinition="Expected date of payment", formalDefinition="Estimated date the payment will be issued or the actual issue date of payment." )
10768        protected DateType date;
10769
10770        /**
10771         * Benefits payable less any payment adjustment.
10772         */
10773        @Child(name = "amount", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
10774        @Description(shortDefinition="Payable amount after adjustment", formalDefinition="Benefits payable less any payment adjustment." )
10775        protected Money amount;
10776
10777        /**
10778         * Issuer's unique identifier for the payment instrument.
10779         */
10780        @Child(name = "identifier", type = {Identifier.class}, order=6, min=0, max=1, modifier=false, summary=false)
10781        @Description(shortDefinition="Business identifier for the payment", formalDefinition="Issuer's unique identifier for the payment instrument." )
10782        protected Identifier identifier;
10783
10784        private static final long serialVersionUID = 1539906026L;
10785
10786    /**
10787     * Constructor
10788     */
10789      public PaymentComponent() {
10790        super();
10791      }
10792
10793        /**
10794         * @return {@link #type} (Whether this represents partial or complete payment of the benefits payable.)
10795         */
10796        public CodeableConcept getType() { 
10797          if (this.type == null)
10798            if (Configuration.errorOnAutoCreate())
10799              throw new Error("Attempt to auto-create PaymentComponent.type");
10800            else if (Configuration.doAutoCreate())
10801              this.type = new CodeableConcept(); // cc
10802          return this.type;
10803        }
10804
10805        public boolean hasType() { 
10806          return this.type != null && !this.type.isEmpty();
10807        }
10808
10809        /**
10810         * @param value {@link #type} (Whether this represents partial or complete payment of the benefits payable.)
10811         */
10812        public PaymentComponent setType(CodeableConcept value) { 
10813          this.type = value;
10814          return this;
10815        }
10816
10817        /**
10818         * @return {@link #adjustment} (Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.)
10819         */
10820        public Money getAdjustment() { 
10821          if (this.adjustment == null)
10822            if (Configuration.errorOnAutoCreate())
10823              throw new Error("Attempt to auto-create PaymentComponent.adjustment");
10824            else if (Configuration.doAutoCreate())
10825              this.adjustment = new Money(); // cc
10826          return this.adjustment;
10827        }
10828
10829        public boolean hasAdjustment() { 
10830          return this.adjustment != null && !this.adjustment.isEmpty();
10831        }
10832
10833        /**
10834         * @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.)
10835         */
10836        public PaymentComponent setAdjustment(Money value) { 
10837          this.adjustment = value;
10838          return this;
10839        }
10840
10841        /**
10842         * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
10843         */
10844        public CodeableConcept getAdjustmentReason() { 
10845          if (this.adjustmentReason == null)
10846            if (Configuration.errorOnAutoCreate())
10847              throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
10848            else if (Configuration.doAutoCreate())
10849              this.adjustmentReason = new CodeableConcept(); // cc
10850          return this.adjustmentReason;
10851        }
10852
10853        public boolean hasAdjustmentReason() { 
10854          return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
10855        }
10856
10857        /**
10858         * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
10859         */
10860        public PaymentComponent setAdjustmentReason(CodeableConcept value) { 
10861          this.adjustmentReason = value;
10862          return this;
10863        }
10864
10865        /**
10866         * @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
10867         */
10868        public DateType getDateElement() { 
10869          if (this.date == null)
10870            if (Configuration.errorOnAutoCreate())
10871              throw new Error("Attempt to auto-create PaymentComponent.date");
10872            else if (Configuration.doAutoCreate())
10873              this.date = new DateType(); // bb
10874          return this.date;
10875        }
10876
10877        public boolean hasDateElement() { 
10878          return this.date != null && !this.date.isEmpty();
10879        }
10880
10881        public boolean hasDate() { 
10882          return this.date != null && !this.date.isEmpty();
10883        }
10884
10885        /**
10886         * @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
10887         */
10888        public PaymentComponent setDateElement(DateType value) { 
10889          this.date = value;
10890          return this;
10891        }
10892
10893        /**
10894         * @return Estimated date the payment will be issued or the actual issue date of payment.
10895         */
10896        public Date getDate() { 
10897          return this.date == null ? null : this.date.getValue();
10898        }
10899
10900        /**
10901         * @param value Estimated date the payment will be issued or the actual issue date of payment.
10902         */
10903        public PaymentComponent setDate(Date value) { 
10904          if (value == null)
10905            this.date = null;
10906          else {
10907            if (this.date == null)
10908              this.date = new DateType();
10909            this.date.setValue(value);
10910          }
10911          return this;
10912        }
10913
10914        /**
10915         * @return {@link #amount} (Benefits payable less any payment adjustment.)
10916         */
10917        public Money getAmount() { 
10918          if (this.amount == null)
10919            if (Configuration.errorOnAutoCreate())
10920              throw new Error("Attempt to auto-create PaymentComponent.amount");
10921            else if (Configuration.doAutoCreate())
10922              this.amount = new Money(); // cc
10923          return this.amount;
10924        }
10925
10926        public boolean hasAmount() { 
10927          return this.amount != null && !this.amount.isEmpty();
10928        }
10929
10930        /**
10931         * @param value {@link #amount} (Benefits payable less any payment adjustment.)
10932         */
10933        public PaymentComponent setAmount(Money value) { 
10934          this.amount = value;
10935          return this;
10936        }
10937
10938        /**
10939         * @return {@link #identifier} (Issuer's unique identifier for the payment instrument.)
10940         */
10941        public Identifier getIdentifier() { 
10942          if (this.identifier == null)
10943            if (Configuration.errorOnAutoCreate())
10944              throw new Error("Attempt to auto-create PaymentComponent.identifier");
10945            else if (Configuration.doAutoCreate())
10946              this.identifier = new Identifier(); // cc
10947          return this.identifier;
10948        }
10949
10950        public boolean hasIdentifier() { 
10951          return this.identifier != null && !this.identifier.isEmpty();
10952        }
10953
10954        /**
10955         * @param value {@link #identifier} (Issuer's unique identifier for the payment instrument.)
10956         */
10957        public PaymentComponent setIdentifier(Identifier value) { 
10958          this.identifier = value;
10959          return this;
10960        }
10961
10962        protected void listChildren(List<Property> children) {
10963          super.listChildren(children);
10964          children.add(new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type));
10965          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));
10966          children.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason));
10967          children.add(new Property("date", "date", "Estimated date the payment will be issued or the actual issue date of payment.", 0, 1, date));
10968          children.add(new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount));
10969          children.add(new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0, 1, identifier));
10970        }
10971
10972        @Override
10973        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10974          switch (_hash) {
10975          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type);
10976          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);
10977          case -1255938543: /*adjustmentReason*/  return new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason);
10978          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);
10979          case -1413853096: /*amount*/  return new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount);
10980          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0, 1, identifier);
10981          default: return super.getNamedProperty(_hash, _name, _checkValid);
10982          }
10983
10984        }
10985
10986      @Override
10987      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10988        switch (hash) {
10989        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
10990        case 1977085293: /*adjustment*/ return this.adjustment == null ? new Base[0] : new Base[] {this.adjustment}; // Money
10991        case -1255938543: /*adjustmentReason*/ return this.adjustmentReason == null ? new Base[0] : new Base[] {this.adjustmentReason}; // CodeableConcept
10992        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
10993        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
10994        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
10995        default: return super.getProperty(hash, name, checkValid);
10996        }
10997
10998      }
10999
11000      @Override
11001      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11002        switch (hash) {
11003        case 3575610: // type
11004          this.type = castToCodeableConcept(value); // CodeableConcept
11005          return value;
11006        case 1977085293: // adjustment
11007          this.adjustment = castToMoney(value); // Money
11008          return value;
11009        case -1255938543: // adjustmentReason
11010          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
11011          return value;
11012        case 3076014: // date
11013          this.date = castToDate(value); // DateType
11014          return value;
11015        case -1413853096: // amount
11016          this.amount = castToMoney(value); // Money
11017          return value;
11018        case -1618432855: // identifier
11019          this.identifier = castToIdentifier(value); // Identifier
11020          return value;
11021        default: return super.setProperty(hash, name, value);
11022        }
11023
11024      }
11025
11026      @Override
11027      public Base setProperty(String name, Base value) throws FHIRException {
11028        if (name.equals("type")) {
11029          this.type = castToCodeableConcept(value); // CodeableConcept
11030        } else if (name.equals("adjustment")) {
11031          this.adjustment = castToMoney(value); // Money
11032        } else if (name.equals("adjustmentReason")) {
11033          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
11034        } else if (name.equals("date")) {
11035          this.date = castToDate(value); // DateType
11036        } else if (name.equals("amount")) {
11037          this.amount = castToMoney(value); // Money
11038        } else if (name.equals("identifier")) {
11039          this.identifier = castToIdentifier(value); // Identifier
11040        } else
11041          return super.setProperty(name, value);
11042        return value;
11043      }
11044
11045      @Override
11046      public Base makeProperty(int hash, String name) throws FHIRException {
11047        switch (hash) {
11048        case 3575610:  return getType(); 
11049        case 1977085293:  return getAdjustment(); 
11050        case -1255938543:  return getAdjustmentReason(); 
11051        case 3076014:  return getDateElement();
11052        case -1413853096:  return getAmount(); 
11053        case -1618432855:  return getIdentifier(); 
11054        default: return super.makeProperty(hash, name);
11055        }
11056
11057      }
11058
11059      @Override
11060      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11061        switch (hash) {
11062        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
11063        case 1977085293: /*adjustment*/ return new String[] {"Money"};
11064        case -1255938543: /*adjustmentReason*/ return new String[] {"CodeableConcept"};
11065        case 3076014: /*date*/ return new String[] {"date"};
11066        case -1413853096: /*amount*/ return new String[] {"Money"};
11067        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
11068        default: return super.getTypesForProperty(hash, name);
11069        }
11070
11071      }
11072
11073      @Override
11074      public Base addChild(String name) throws FHIRException {
11075        if (name.equals("type")) {
11076          this.type = new CodeableConcept();
11077          return this.type;
11078        }
11079        else if (name.equals("adjustment")) {
11080          this.adjustment = new Money();
11081          return this.adjustment;
11082        }
11083        else if (name.equals("adjustmentReason")) {
11084          this.adjustmentReason = new CodeableConcept();
11085          return this.adjustmentReason;
11086        }
11087        else if (name.equals("date")) {
11088          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
11089        }
11090        else if (name.equals("amount")) {
11091          this.amount = new Money();
11092          return this.amount;
11093        }
11094        else if (name.equals("identifier")) {
11095          this.identifier = new Identifier();
11096          return this.identifier;
11097        }
11098        else
11099          return super.addChild(name);
11100      }
11101
11102      public PaymentComponent copy() {
11103        PaymentComponent dst = new PaymentComponent();
11104        copyValues(dst);
11105        return dst;
11106      }
11107
11108      public void copyValues(PaymentComponent dst) {
11109        super.copyValues(dst);
11110        dst.type = type == null ? null : type.copy();
11111        dst.adjustment = adjustment == null ? null : adjustment.copy();
11112        dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
11113        dst.date = date == null ? null : date.copy();
11114        dst.amount = amount == null ? null : amount.copy();
11115        dst.identifier = identifier == null ? null : identifier.copy();
11116      }
11117
11118      @Override
11119      public boolean equalsDeep(Base other_) {
11120        if (!super.equalsDeep(other_))
11121          return false;
11122        if (!(other_ instanceof PaymentComponent))
11123          return false;
11124        PaymentComponent o = (PaymentComponent) other_;
11125        return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true) && compareDeep(adjustmentReason, o.adjustmentReason, true)
11126           && compareDeep(date, o.date, true) && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true)
11127          ;
11128      }
11129
11130      @Override
11131      public boolean equalsShallow(Base other_) {
11132        if (!super.equalsShallow(other_))
11133          return false;
11134        if (!(other_ instanceof PaymentComponent))
11135          return false;
11136        PaymentComponent o = (PaymentComponent) other_;
11137        return compareValues(date, o.date, true);
11138      }
11139
11140      public boolean isEmpty() {
11141        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason
11142          , date, amount, identifier);
11143      }
11144
11145  public String fhirType() {
11146    return "ExplanationOfBenefit.payment";
11147
11148  }
11149
11150  }
11151
11152    @Block()
11153    public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
11154        /**
11155         * A number to uniquely identify a note entry.
11156         */
11157        @Child(name = "number", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
11158        @Description(shortDefinition="Note instance identifier", formalDefinition="A number to uniquely identify a note entry." )
11159        protected PositiveIntType number;
11160
11161        /**
11162         * The business purpose of the note text.
11163         */
11164        @Child(name = "type", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
11165        @Description(shortDefinition="display | print | printoper", formalDefinition="The business purpose of the note text." )
11166        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/note-type")
11167        protected Enumeration<NoteType> type;
11168
11169        /**
11170         * The explanation or description associated with the processing.
11171         */
11172        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
11173        @Description(shortDefinition="Note explanatory text", formalDefinition="The explanation or description associated with the processing." )
11174        protected StringType text;
11175
11176        /**
11177         * A code to define the language used in the text of the note.
11178         */
11179        @Child(name = "language", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
11180        @Description(shortDefinition="Language of the text", formalDefinition="A code to define the language used in the text of the note." )
11181        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
11182        protected CodeableConcept language;
11183
11184        private static final long serialVersionUID = -385184277L;
11185
11186    /**
11187     * Constructor
11188     */
11189      public NoteComponent() {
11190        super();
11191      }
11192
11193        /**
11194         * @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
11195         */
11196        public PositiveIntType getNumberElement() { 
11197          if (this.number == null)
11198            if (Configuration.errorOnAutoCreate())
11199              throw new Error("Attempt to auto-create NoteComponent.number");
11200            else if (Configuration.doAutoCreate())
11201              this.number = new PositiveIntType(); // bb
11202          return this.number;
11203        }
11204
11205        public boolean hasNumberElement() { 
11206          return this.number != null && !this.number.isEmpty();
11207        }
11208
11209        public boolean hasNumber() { 
11210          return this.number != null && !this.number.isEmpty();
11211        }
11212
11213        /**
11214         * @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
11215         */
11216        public NoteComponent setNumberElement(PositiveIntType value) { 
11217          this.number = value;
11218          return this;
11219        }
11220
11221        /**
11222         * @return A number to uniquely identify a note entry.
11223         */
11224        public int getNumber() { 
11225          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
11226        }
11227
11228        /**
11229         * @param value A number to uniquely identify a note entry.
11230         */
11231        public NoteComponent setNumber(int value) { 
11232            if (this.number == null)
11233              this.number = new PositiveIntType();
11234            this.number.setValue(value);
11235          return this;
11236        }
11237
11238        /**
11239         * @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
11240         */
11241        public Enumeration<NoteType> getTypeElement() { 
11242          if (this.type == null)
11243            if (Configuration.errorOnAutoCreate())
11244              throw new Error("Attempt to auto-create NoteComponent.type");
11245            else if (Configuration.doAutoCreate())
11246              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory()); // bb
11247          return this.type;
11248        }
11249
11250        public boolean hasTypeElement() { 
11251          return this.type != null && !this.type.isEmpty();
11252        }
11253
11254        public boolean hasType() { 
11255          return this.type != null && !this.type.isEmpty();
11256        }
11257
11258        /**
11259         * @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
11260         */
11261        public NoteComponent setTypeElement(Enumeration<NoteType> value) { 
11262          this.type = value;
11263          return this;
11264        }
11265
11266        /**
11267         * @return The business purpose of the note text.
11268         */
11269        public NoteType getType() { 
11270          return this.type == null ? null : this.type.getValue();
11271        }
11272
11273        /**
11274         * @param value The business purpose of the note text.
11275         */
11276        public NoteComponent setType(NoteType value) { 
11277          if (value == null)
11278            this.type = null;
11279          else {
11280            if (this.type == null)
11281              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory());
11282            this.type.setValue(value);
11283          }
11284          return this;
11285        }
11286
11287        /**
11288         * @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
11289         */
11290        public StringType getTextElement() { 
11291          if (this.text == null)
11292            if (Configuration.errorOnAutoCreate())
11293              throw new Error("Attempt to auto-create NoteComponent.text");
11294            else if (Configuration.doAutoCreate())
11295              this.text = new StringType(); // bb
11296          return this.text;
11297        }
11298
11299        public boolean hasTextElement() { 
11300          return this.text != null && !this.text.isEmpty();
11301        }
11302
11303        public boolean hasText() { 
11304          return this.text != null && !this.text.isEmpty();
11305        }
11306
11307        /**
11308         * @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
11309         */
11310        public NoteComponent setTextElement(StringType value) { 
11311          this.text = value;
11312          return this;
11313        }
11314
11315        /**
11316         * @return The explanation or description associated with the processing.
11317         */
11318        public String getText() { 
11319          return this.text == null ? null : this.text.getValue();
11320        }
11321
11322        /**
11323         * @param value The explanation or description associated with the processing.
11324         */
11325        public NoteComponent setText(String value) { 
11326          if (Utilities.noString(value))
11327            this.text = null;
11328          else {
11329            if (this.text == null)
11330              this.text = new StringType();
11331            this.text.setValue(value);
11332          }
11333          return this;
11334        }
11335
11336        /**
11337         * @return {@link #language} (A code to define the language used in the text of the note.)
11338         */
11339        public CodeableConcept getLanguage() { 
11340          if (this.language == null)
11341            if (Configuration.errorOnAutoCreate())
11342              throw new Error("Attempt to auto-create NoteComponent.language");
11343            else if (Configuration.doAutoCreate())
11344              this.language = new CodeableConcept(); // cc
11345          return this.language;
11346        }
11347
11348        public boolean hasLanguage() { 
11349          return this.language != null && !this.language.isEmpty();
11350        }
11351
11352        /**
11353         * @param value {@link #language} (A code to define the language used in the text of the note.)
11354         */
11355        public NoteComponent setLanguage(CodeableConcept value) { 
11356          this.language = value;
11357          return this;
11358        }
11359
11360        protected void listChildren(List<Property> children) {
11361          super.listChildren(children);
11362          children.add(new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number));
11363          children.add(new Property("type", "code", "The business purpose of the note text.", 0, 1, type));
11364          children.add(new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text));
11365          children.add(new Property("language", "CodeableConcept", "A code to define the language used in the text of the note.", 0, 1, language));
11366        }
11367
11368        @Override
11369        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11370          switch (_hash) {
11371          case -1034364087: /*number*/  return new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number);
11372          case 3575610: /*type*/  return new Property("type", "code", "The business purpose of the note text.", 0, 1, type);
11373          case 3556653: /*text*/  return new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text);
11374          case -1613589672: /*language*/  return new Property("language", "CodeableConcept", "A code to define the language used in the text of the note.", 0, 1, language);
11375          default: return super.getNamedProperty(_hash, _name, _checkValid);
11376          }
11377
11378        }
11379
11380      @Override
11381      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11382        switch (hash) {
11383        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // PositiveIntType
11384        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<NoteType>
11385        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
11386        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeableConcept
11387        default: return super.getProperty(hash, name, checkValid);
11388        }
11389
11390      }
11391
11392      @Override
11393      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11394        switch (hash) {
11395        case -1034364087: // number
11396          this.number = castToPositiveInt(value); // PositiveIntType
11397          return value;
11398        case 3575610: // type
11399          value = new NoteTypeEnumFactory().fromType(castToCode(value));
11400          this.type = (Enumeration) value; // Enumeration<NoteType>
11401          return value;
11402        case 3556653: // text
11403          this.text = castToString(value); // StringType
11404          return value;
11405        case -1613589672: // language
11406          this.language = castToCodeableConcept(value); // CodeableConcept
11407          return value;
11408        default: return super.setProperty(hash, name, value);
11409        }
11410
11411      }
11412
11413      @Override
11414      public Base setProperty(String name, Base value) throws FHIRException {
11415        if (name.equals("number")) {
11416          this.number = castToPositiveInt(value); // PositiveIntType
11417        } else if (name.equals("type")) {
11418          value = new NoteTypeEnumFactory().fromType(castToCode(value));
11419          this.type = (Enumeration) value; // Enumeration<NoteType>
11420        } else if (name.equals("text")) {
11421          this.text = castToString(value); // StringType
11422        } else if (name.equals("language")) {
11423          this.language = castToCodeableConcept(value); // CodeableConcept
11424        } else
11425          return super.setProperty(name, value);
11426        return value;
11427      }
11428
11429      @Override
11430      public Base makeProperty(int hash, String name) throws FHIRException {
11431        switch (hash) {
11432        case -1034364087:  return getNumberElement();
11433        case 3575610:  return getTypeElement();
11434        case 3556653:  return getTextElement();
11435        case -1613589672:  return getLanguage(); 
11436        default: return super.makeProperty(hash, name);
11437        }
11438
11439      }
11440
11441      @Override
11442      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11443        switch (hash) {
11444        case -1034364087: /*number*/ return new String[] {"positiveInt"};
11445        case 3575610: /*type*/ return new String[] {"code"};
11446        case 3556653: /*text*/ return new String[] {"string"};
11447        case -1613589672: /*language*/ return new String[] {"CodeableConcept"};
11448        default: return super.getTypesForProperty(hash, name);
11449        }
11450
11451      }
11452
11453      @Override
11454      public Base addChild(String name) throws FHIRException {
11455        if (name.equals("number")) {
11456          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.number");
11457        }
11458        else if (name.equals("type")) {
11459          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.type");
11460        }
11461        else if (name.equals("text")) {
11462          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.text");
11463        }
11464        else if (name.equals("language")) {
11465          this.language = new CodeableConcept();
11466          return this.language;
11467        }
11468        else
11469          return super.addChild(name);
11470      }
11471
11472      public NoteComponent copy() {
11473        NoteComponent dst = new NoteComponent();
11474        copyValues(dst);
11475        return dst;
11476      }
11477
11478      public void copyValues(NoteComponent dst) {
11479        super.copyValues(dst);
11480        dst.number = number == null ? null : number.copy();
11481        dst.type = type == null ? null : type.copy();
11482        dst.text = text == null ? null : text.copy();
11483        dst.language = language == null ? null : language.copy();
11484      }
11485
11486      @Override
11487      public boolean equalsDeep(Base other_) {
11488        if (!super.equalsDeep(other_))
11489          return false;
11490        if (!(other_ instanceof NoteComponent))
11491          return false;
11492        NoteComponent o = (NoteComponent) other_;
11493        return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
11494           && compareDeep(language, o.language, true);
11495      }
11496
11497      @Override
11498      public boolean equalsShallow(Base other_) {
11499        if (!super.equalsShallow(other_))
11500          return false;
11501        if (!(other_ instanceof NoteComponent))
11502          return false;
11503        NoteComponent o = (NoteComponent) other_;
11504        return compareValues(number, o.number, true) && compareValues(type, o.type, true) && compareValues(text, o.text, true)
11505          ;
11506      }
11507
11508      public boolean isEmpty() {
11509        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language
11510          );
11511      }
11512
11513  public String fhirType() {
11514    return "ExplanationOfBenefit.processNote";
11515
11516  }
11517
11518  }
11519
11520    @Block()
11521    public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
11522        /**
11523         * Code to identify the general type of benefits under which products and services are provided.
11524         */
11525        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
11526        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
11527        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
11528        protected CodeableConcept category;
11529
11530        /**
11531         * 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.
11532         */
11533        @Child(name = "excluded", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
11534        @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." )
11535        protected BooleanType excluded;
11536
11537        /**
11538         * A short name or tag for the benefit.
11539         */
11540        @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
11541        @Description(shortDefinition="Short name for the benefit", formalDefinition="A short name or tag for the benefit." )
11542        protected StringType name;
11543
11544        /**
11545         * A richer description of the benefit or services covered.
11546         */
11547        @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
11548        @Description(shortDefinition="Description of the benefit or services covered", formalDefinition="A richer description of the benefit or services covered." )
11549        protected StringType description;
11550
11551        /**
11552         * Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.
11553         */
11554        @Child(name = "network", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
11555        @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." )
11556        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-network")
11557        protected CodeableConcept network;
11558
11559        /**
11560         * Indicates if the benefits apply to an individual or to the family.
11561         */
11562        @Child(name = "unit", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
11563        @Description(shortDefinition="Individual or family", formalDefinition="Indicates if the benefits apply to an individual or to the family." )
11564        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-unit")
11565        protected CodeableConcept unit;
11566
11567        /**
11568         * The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.
11569         */
11570        @Child(name = "term", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
11571        @Description(shortDefinition="Annual or lifetime", formalDefinition="The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'." )
11572        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-term")
11573        protected CodeableConcept term;
11574
11575        /**
11576         * Benefits Used to date.
11577         */
11578        @Child(name = "financial", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
11579        @Description(shortDefinition="Benefit Summary", formalDefinition="Benefits Used to date." )
11580        protected List<BenefitComponent> financial;
11581
11582        private static final long serialVersionUID = -1889655824L;
11583
11584    /**
11585     * Constructor
11586     */
11587      public BenefitBalanceComponent() {
11588        super();
11589      }
11590
11591    /**
11592     * Constructor
11593     */
11594      public BenefitBalanceComponent(CodeableConcept category) {
11595        super();
11596        this.category = category;
11597      }
11598
11599        /**
11600         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
11601         */
11602        public CodeableConcept getCategory() { 
11603          if (this.category == null)
11604            if (Configuration.errorOnAutoCreate())
11605              throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
11606            else if (Configuration.doAutoCreate())
11607              this.category = new CodeableConcept(); // cc
11608          return this.category;
11609        }
11610
11611        public boolean hasCategory() { 
11612          return this.category != null && !this.category.isEmpty();
11613        }
11614
11615        /**
11616         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
11617         */
11618        public BenefitBalanceComponent setCategory(CodeableConcept value) { 
11619          this.category = value;
11620          return this;
11621        }
11622
11623        /**
11624         * @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
11625         */
11626        public BooleanType getExcludedElement() { 
11627          if (this.excluded == null)
11628            if (Configuration.errorOnAutoCreate())
11629              throw new Error("Attempt to auto-create BenefitBalanceComponent.excluded");
11630            else if (Configuration.doAutoCreate())
11631              this.excluded = new BooleanType(); // bb
11632          return this.excluded;
11633        }
11634
11635        public boolean hasExcludedElement() { 
11636          return this.excluded != null && !this.excluded.isEmpty();
11637        }
11638
11639        public boolean hasExcluded() { 
11640          return this.excluded != null && !this.excluded.isEmpty();
11641        }
11642
11643        /**
11644         * @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
11645         */
11646        public BenefitBalanceComponent setExcludedElement(BooleanType value) { 
11647          this.excluded = value;
11648          return this;
11649        }
11650
11651        /**
11652         * @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.
11653         */
11654        public boolean getExcluded() { 
11655          return this.excluded == null || this.excluded.isEmpty() ? false : this.excluded.getValue();
11656        }
11657
11658        /**
11659         * @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.
11660         */
11661        public BenefitBalanceComponent setExcluded(boolean value) { 
11662            if (this.excluded == null)
11663              this.excluded = new BooleanType();
11664            this.excluded.setValue(value);
11665          return this;
11666        }
11667
11668        /**
11669         * @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
11670         */
11671        public StringType getNameElement() { 
11672          if (this.name == null)
11673            if (Configuration.errorOnAutoCreate())
11674              throw new Error("Attempt to auto-create BenefitBalanceComponent.name");
11675            else if (Configuration.doAutoCreate())
11676              this.name = new StringType(); // bb
11677          return this.name;
11678        }
11679
11680        public boolean hasNameElement() { 
11681          return this.name != null && !this.name.isEmpty();
11682        }
11683
11684        public boolean hasName() { 
11685          return this.name != null && !this.name.isEmpty();
11686        }
11687
11688        /**
11689         * @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
11690         */
11691        public BenefitBalanceComponent setNameElement(StringType value) { 
11692          this.name = value;
11693          return this;
11694        }
11695
11696        /**
11697         * @return A short name or tag for the benefit.
11698         */
11699        public String getName() { 
11700          return this.name == null ? null : this.name.getValue();
11701        }
11702
11703        /**
11704         * @param value A short name or tag for the benefit.
11705         */
11706        public BenefitBalanceComponent setName(String value) { 
11707          if (Utilities.noString(value))
11708            this.name = null;
11709          else {
11710            if (this.name == null)
11711              this.name = new StringType();
11712            this.name.setValue(value);
11713          }
11714          return this;
11715        }
11716
11717        /**
11718         * @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
11719         */
11720        public StringType getDescriptionElement() { 
11721          if (this.description == null)
11722            if (Configuration.errorOnAutoCreate())
11723              throw new Error("Attempt to auto-create BenefitBalanceComponent.description");
11724            else if (Configuration.doAutoCreate())
11725              this.description = new StringType(); // bb
11726          return this.description;
11727        }
11728
11729        public boolean hasDescriptionElement() { 
11730          return this.description != null && !this.description.isEmpty();
11731        }
11732
11733        public boolean hasDescription() { 
11734          return this.description != null && !this.description.isEmpty();
11735        }
11736
11737        /**
11738         * @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
11739         */
11740        public BenefitBalanceComponent setDescriptionElement(StringType value) { 
11741          this.description = value;
11742          return this;
11743        }
11744
11745        /**
11746         * @return A richer description of the benefit or services covered.
11747         */
11748        public String getDescription() { 
11749          return this.description == null ? null : this.description.getValue();
11750        }
11751
11752        /**
11753         * @param value A richer description of the benefit or services covered.
11754         */
11755        public BenefitBalanceComponent setDescription(String value) { 
11756          if (Utilities.noString(value))
11757            this.description = null;
11758          else {
11759            if (this.description == null)
11760              this.description = new StringType();
11761            this.description.setValue(value);
11762          }
11763          return this;
11764        }
11765
11766        /**
11767         * @return {@link #network} (Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.)
11768         */
11769        public CodeableConcept getNetwork() { 
11770          if (this.network == null)
11771            if (Configuration.errorOnAutoCreate())
11772              throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
11773            else if (Configuration.doAutoCreate())
11774              this.network = new CodeableConcept(); // cc
11775          return this.network;
11776        }
11777
11778        public boolean hasNetwork() { 
11779          return this.network != null && !this.network.isEmpty();
11780        }
11781
11782        /**
11783         * @param value {@link #network} (Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.)
11784         */
11785        public BenefitBalanceComponent setNetwork(CodeableConcept value) { 
11786          this.network = value;
11787          return this;
11788        }
11789
11790        /**
11791         * @return {@link #unit} (Indicates if the benefits apply to an individual or to the family.)
11792         */
11793        public CodeableConcept getUnit() { 
11794          if (this.unit == null)
11795            if (Configuration.errorOnAutoCreate())
11796              throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
11797            else if (Configuration.doAutoCreate())
11798              this.unit = new CodeableConcept(); // cc
11799          return this.unit;
11800        }
11801
11802        public boolean hasUnit() { 
11803          return this.unit != null && !this.unit.isEmpty();
11804        }
11805
11806        /**
11807         * @param value {@link #unit} (Indicates if the benefits apply to an individual or to the family.)
11808         */
11809        public BenefitBalanceComponent setUnit(CodeableConcept value) { 
11810          this.unit = value;
11811          return this;
11812        }
11813
11814        /**
11815         * @return {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.)
11816         */
11817        public CodeableConcept getTerm() { 
11818          if (this.term == null)
11819            if (Configuration.errorOnAutoCreate())
11820              throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
11821            else if (Configuration.doAutoCreate())
11822              this.term = new CodeableConcept(); // cc
11823          return this.term;
11824        }
11825
11826        public boolean hasTerm() { 
11827          return this.term != null && !this.term.isEmpty();
11828        }
11829
11830        /**
11831         * @param value {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.)
11832         */
11833        public BenefitBalanceComponent setTerm(CodeableConcept value) { 
11834          this.term = value;
11835          return this;
11836        }
11837
11838        /**
11839         * @return {@link #financial} (Benefits Used to date.)
11840         */
11841        public List<BenefitComponent> getFinancial() { 
11842          if (this.financial == null)
11843            this.financial = new ArrayList<BenefitComponent>();
11844          return this.financial;
11845        }
11846
11847        /**
11848         * @return Returns a reference to <code>this</code> for easy method chaining
11849         */
11850        public BenefitBalanceComponent setFinancial(List<BenefitComponent> theFinancial) { 
11851          this.financial = theFinancial;
11852          return this;
11853        }
11854
11855        public boolean hasFinancial() { 
11856          if (this.financial == null)
11857            return false;
11858          for (BenefitComponent item : this.financial)
11859            if (!item.isEmpty())
11860              return true;
11861          return false;
11862        }
11863
11864        public BenefitComponent addFinancial() { //3
11865          BenefitComponent t = new BenefitComponent();
11866          if (this.financial == null)
11867            this.financial = new ArrayList<BenefitComponent>();
11868          this.financial.add(t);
11869          return t;
11870        }
11871
11872        public BenefitBalanceComponent addFinancial(BenefitComponent t) { //3
11873          if (t == null)
11874            return this;
11875          if (this.financial == null)
11876            this.financial = new ArrayList<BenefitComponent>();
11877          this.financial.add(t);
11878          return this;
11879        }
11880
11881        /**
11882         * @return The first repetition of repeating field {@link #financial}, creating it if it does not already exist
11883         */
11884        public BenefitComponent getFinancialFirstRep() { 
11885          if (getFinancial().isEmpty()) {
11886            addFinancial();
11887          }
11888          return getFinancial().get(0);
11889        }
11890
11891        protected void listChildren(List<Property> children) {
11892          super.listChildren(children);
11893          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
11894          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));
11895          children.add(new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name));
11896          children.add(new Property("description", "string", "A richer description of the benefit or services covered.", 0, 1, description));
11897          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));
11898          children.add(new Property("unit", "CodeableConcept", "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit));
11899          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));
11900          children.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
11901        }
11902
11903        @Override
11904        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11905          switch (_hash) {
11906          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);
11907          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);
11908          case 3373707: /*name*/  return new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name);
11909          case -1724546052: /*description*/  return new Property("description", "string", "A richer description of the benefit or services covered.", 0, 1, description);
11910          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);
11911          case 3594628: /*unit*/  return new Property("unit", "CodeableConcept", "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit);
11912          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);
11913          case 357555337: /*financial*/  return new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial);
11914          default: return super.getNamedProperty(_hash, _name, _checkValid);
11915          }
11916
11917        }
11918
11919      @Override
11920      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11921        switch (hash) {
11922        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
11923        case 1994055114: /*excluded*/ return this.excluded == null ? new Base[0] : new Base[] {this.excluded}; // BooleanType
11924        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
11925        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
11926        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // CodeableConcept
11927        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // CodeableConcept
11928        case 3556460: /*term*/ return this.term == null ? new Base[0] : new Base[] {this.term}; // CodeableConcept
11929        case 357555337: /*financial*/ return this.financial == null ? new Base[0] : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
11930        default: return super.getProperty(hash, name, checkValid);
11931        }
11932
11933      }
11934
11935      @Override
11936      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11937        switch (hash) {
11938        case 50511102: // category
11939          this.category = castToCodeableConcept(value); // CodeableConcept
11940          return value;
11941        case 1994055114: // excluded
11942          this.excluded = castToBoolean(value); // BooleanType
11943          return value;
11944        case 3373707: // name
11945          this.name = castToString(value); // StringType
11946          return value;
11947        case -1724546052: // description
11948          this.description = castToString(value); // StringType
11949          return value;
11950        case 1843485230: // network
11951          this.network = castToCodeableConcept(value); // CodeableConcept
11952          return value;
11953        case 3594628: // unit
11954          this.unit = castToCodeableConcept(value); // CodeableConcept
11955          return value;
11956        case 3556460: // term
11957          this.term = castToCodeableConcept(value); // CodeableConcept
11958          return value;
11959        case 357555337: // financial
11960          this.getFinancial().add((BenefitComponent) value); // BenefitComponent
11961          return value;
11962        default: return super.setProperty(hash, name, value);
11963        }
11964
11965      }
11966
11967      @Override
11968      public Base setProperty(String name, Base value) throws FHIRException {
11969        if (name.equals("category")) {
11970          this.category = castToCodeableConcept(value); // CodeableConcept
11971        } else if (name.equals("excluded")) {
11972          this.excluded = castToBoolean(value); // BooleanType
11973        } else if (name.equals("name")) {
11974          this.name = castToString(value); // StringType
11975        } else if (name.equals("description")) {
11976          this.description = castToString(value); // StringType
11977        } else if (name.equals("network")) {
11978          this.network = castToCodeableConcept(value); // CodeableConcept
11979        } else if (name.equals("unit")) {
11980          this.unit = castToCodeableConcept(value); // CodeableConcept
11981        } else if (name.equals("term")) {
11982          this.term = castToCodeableConcept(value); // CodeableConcept
11983        } else if (name.equals("financial")) {
11984          this.getFinancial().add((BenefitComponent) value);
11985        } else
11986          return super.setProperty(name, value);
11987        return value;
11988      }
11989
11990      @Override
11991      public Base makeProperty(int hash, String name) throws FHIRException {
11992        switch (hash) {
11993        case 50511102:  return getCategory(); 
11994        case 1994055114:  return getExcludedElement();
11995        case 3373707:  return getNameElement();
11996        case -1724546052:  return getDescriptionElement();
11997        case 1843485230:  return getNetwork(); 
11998        case 3594628:  return getUnit(); 
11999        case 3556460:  return getTerm(); 
12000        case 357555337:  return addFinancial(); 
12001        default: return super.makeProperty(hash, name);
12002        }
12003
12004      }
12005
12006      @Override
12007      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12008        switch (hash) {
12009        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
12010        case 1994055114: /*excluded*/ return new String[] {"boolean"};
12011        case 3373707: /*name*/ return new String[] {"string"};
12012        case -1724546052: /*description*/ return new String[] {"string"};
12013        case 1843485230: /*network*/ return new String[] {"CodeableConcept"};
12014        case 3594628: /*unit*/ return new String[] {"CodeableConcept"};
12015        case 3556460: /*term*/ return new String[] {"CodeableConcept"};
12016        case 357555337: /*financial*/ return new String[] {};
12017        default: return super.getTypesForProperty(hash, name);
12018        }
12019
12020      }
12021
12022      @Override
12023      public Base addChild(String name) throws FHIRException {
12024        if (name.equals("category")) {
12025          this.category = new CodeableConcept();
12026          return this.category;
12027        }
12028        else if (name.equals("excluded")) {
12029          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.excluded");
12030        }
12031        else if (name.equals("name")) {
12032          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.name");
12033        }
12034        else if (name.equals("description")) {
12035          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.description");
12036        }
12037        else if (name.equals("network")) {
12038          this.network = new CodeableConcept();
12039          return this.network;
12040        }
12041        else if (name.equals("unit")) {
12042          this.unit = new CodeableConcept();
12043          return this.unit;
12044        }
12045        else if (name.equals("term")) {
12046          this.term = new CodeableConcept();
12047          return this.term;
12048        }
12049        else if (name.equals("financial")) {
12050          return addFinancial();
12051        }
12052        else
12053          return super.addChild(name);
12054      }
12055
12056      public BenefitBalanceComponent copy() {
12057        BenefitBalanceComponent dst = new BenefitBalanceComponent();
12058        copyValues(dst);
12059        return dst;
12060      }
12061
12062      public void copyValues(BenefitBalanceComponent dst) {
12063        super.copyValues(dst);
12064        dst.category = category == null ? null : category.copy();
12065        dst.excluded = excluded == null ? null : excluded.copy();
12066        dst.name = name == null ? null : name.copy();
12067        dst.description = description == null ? null : description.copy();
12068        dst.network = network == null ? null : network.copy();
12069        dst.unit = unit == null ? null : unit.copy();
12070        dst.term = term == null ? null : term.copy();
12071        if (financial != null) {
12072          dst.financial = new ArrayList<BenefitComponent>();
12073          for (BenefitComponent i : financial)
12074            dst.financial.add(i.copy());
12075        };
12076      }
12077
12078      @Override
12079      public boolean equalsDeep(Base other_) {
12080        if (!super.equalsDeep(other_))
12081          return false;
12082        if (!(other_ instanceof BenefitBalanceComponent))
12083          return false;
12084        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
12085        return compareDeep(category, o.category, true) && compareDeep(excluded, o.excluded, true) && compareDeep(name, o.name, true)
12086           && compareDeep(description, o.description, true) && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true)
12087           && compareDeep(term, o.term, true) && compareDeep(financial, o.financial, true);
12088      }
12089
12090      @Override
12091      public boolean equalsShallow(Base other_) {
12092        if (!super.equalsShallow(other_))
12093          return false;
12094        if (!(other_ instanceof BenefitBalanceComponent))
12095          return false;
12096        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
12097        return compareValues(excluded, o.excluded, true) && compareValues(name, o.name, true) && compareValues(description, o.description, true)
12098          ;
12099      }
12100
12101      public boolean isEmpty() {
12102        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, excluded, name
12103          , description, network, unit, term, financial);
12104      }
12105
12106  public String fhirType() {
12107    return "ExplanationOfBenefit.benefitBalance";
12108
12109  }
12110
12111  }
12112
12113    @Block()
12114    public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
12115        /**
12116         * Classification of benefit being provided.
12117         */
12118        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
12119        @Description(shortDefinition="Benefit classification", formalDefinition="Classification of benefit being provided." )
12120        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-type")
12121        protected CodeableConcept type;
12122
12123        /**
12124         * The quantity of the benefit which is permitted under the coverage.
12125         */
12126        @Child(name = "allowed", type = {UnsignedIntType.class, StringType.class, Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
12127        @Description(shortDefinition="Benefits allowed", formalDefinition="The quantity of the benefit which is permitted under the coverage." )
12128        protected Type allowed;
12129
12130        /**
12131         * The quantity of the benefit which have been consumed to date.
12132         */
12133        @Child(name = "used", type = {UnsignedIntType.class, Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
12134        @Description(shortDefinition="Benefits used", formalDefinition="The quantity of the benefit which have been consumed to date." )
12135        protected Type used;
12136
12137        private static final long serialVersionUID = -1506285314L;
12138
12139    /**
12140     * Constructor
12141     */
12142      public BenefitComponent() {
12143        super();
12144      }
12145
12146    /**
12147     * Constructor
12148     */
12149      public BenefitComponent(CodeableConcept type) {
12150        super();
12151        this.type = type;
12152      }
12153
12154        /**
12155         * @return {@link #type} (Classification of benefit being provided.)
12156         */
12157        public CodeableConcept getType() { 
12158          if (this.type == null)
12159            if (Configuration.errorOnAutoCreate())
12160              throw new Error("Attempt to auto-create BenefitComponent.type");
12161            else if (Configuration.doAutoCreate())
12162              this.type = new CodeableConcept(); // cc
12163          return this.type;
12164        }
12165
12166        public boolean hasType() { 
12167          return this.type != null && !this.type.isEmpty();
12168        }
12169
12170        /**
12171         * @param value {@link #type} (Classification of benefit being provided.)
12172         */
12173        public BenefitComponent setType(CodeableConcept value) { 
12174          this.type = value;
12175          return this;
12176        }
12177
12178        /**
12179         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12180         */
12181        public Type getAllowed() { 
12182          return this.allowed;
12183        }
12184
12185        /**
12186         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12187         */
12188        public UnsignedIntType getAllowedUnsignedIntType() throws FHIRException { 
12189          if (this.allowed == null)
12190            this.allowed = new UnsignedIntType();
12191          if (!(this.allowed instanceof UnsignedIntType))
12192            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.allowed.getClass().getName()+" was encountered");
12193          return (UnsignedIntType) this.allowed;
12194        }
12195
12196        public boolean hasAllowedUnsignedIntType() { 
12197          return this != null && this.allowed instanceof UnsignedIntType;
12198        }
12199
12200        /**
12201         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12202         */
12203        public StringType getAllowedStringType() throws FHIRException { 
12204          if (this.allowed == null)
12205            this.allowed = new StringType();
12206          if (!(this.allowed instanceof StringType))
12207            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.allowed.getClass().getName()+" was encountered");
12208          return (StringType) this.allowed;
12209        }
12210
12211        public boolean hasAllowedStringType() { 
12212          return this != null && this.allowed instanceof StringType;
12213        }
12214
12215        /**
12216         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12217         */
12218        public Money getAllowedMoney() throws FHIRException { 
12219          if (this.allowed == null)
12220            this.allowed = new Money();
12221          if (!(this.allowed instanceof Money))
12222            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.allowed.getClass().getName()+" was encountered");
12223          return (Money) this.allowed;
12224        }
12225
12226        public boolean hasAllowedMoney() { 
12227          return this != null && this.allowed instanceof Money;
12228        }
12229
12230        public boolean hasAllowed() { 
12231          return this.allowed != null && !this.allowed.isEmpty();
12232        }
12233
12234        /**
12235         * @param value {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12236         */
12237        public BenefitComponent setAllowed(Type value) { 
12238          if (value != null && !(value instanceof UnsignedIntType || value instanceof StringType || value instanceof Money))
12239            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.allowed[x]: "+value.fhirType());
12240          this.allowed = value;
12241          return this;
12242        }
12243
12244        /**
12245         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
12246         */
12247        public Type getUsed() { 
12248          return this.used;
12249        }
12250
12251        /**
12252         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
12253         */
12254        public UnsignedIntType getUsedUnsignedIntType() throws FHIRException { 
12255          if (this.used == null)
12256            this.used = new UnsignedIntType();
12257          if (!(this.used instanceof UnsignedIntType))
12258            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.used.getClass().getName()+" was encountered");
12259          return (UnsignedIntType) this.used;
12260        }
12261
12262        public boolean hasUsedUnsignedIntType() { 
12263          return this != null && this.used instanceof UnsignedIntType;
12264        }
12265
12266        /**
12267         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
12268         */
12269        public Money getUsedMoney() throws FHIRException { 
12270          if (this.used == null)
12271            this.used = new Money();
12272          if (!(this.used instanceof Money))
12273            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.used.getClass().getName()+" was encountered");
12274          return (Money) this.used;
12275        }
12276
12277        public boolean hasUsedMoney() { 
12278          return this != null && this.used instanceof Money;
12279        }
12280
12281        public boolean hasUsed() { 
12282          return this.used != null && !this.used.isEmpty();
12283        }
12284
12285        /**
12286         * @param value {@link #used} (The quantity of the benefit which have been consumed to date.)
12287         */
12288        public BenefitComponent setUsed(Type value) { 
12289          if (value != null && !(value instanceof UnsignedIntType || value instanceof Money))
12290            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.used[x]: "+value.fhirType());
12291          this.used = value;
12292          return this;
12293        }
12294
12295        protected void listChildren(List<Property> children) {
12296          super.listChildren(children);
12297          children.add(new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type));
12298          children.add(new Property("allowed[x]", "unsignedInt|string|Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed));
12299          children.add(new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used));
12300        }
12301
12302        @Override
12303        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
12304          switch (_hash) {
12305          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type);
12306          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);
12307          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);
12308          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);
12309          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);
12310          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);
12311          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);
12312          case 3599293: /*used*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
12313          case 1252740285: /*usedUnsignedInt*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
12314          case -78048509: /*usedMoney*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
12315          default: return super.getNamedProperty(_hash, _name, _checkValid);
12316          }
12317
12318        }
12319
12320      @Override
12321      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
12322        switch (hash) {
12323        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
12324        case -911343192: /*allowed*/ return this.allowed == null ? new Base[0] : new Base[] {this.allowed}; // Type
12325        case 3599293: /*used*/ return this.used == null ? new Base[0] : new Base[] {this.used}; // Type
12326        default: return super.getProperty(hash, name, checkValid);
12327        }
12328
12329      }
12330
12331      @Override
12332      public Base setProperty(int hash, String name, Base value) throws FHIRException {
12333        switch (hash) {
12334        case 3575610: // type
12335          this.type = castToCodeableConcept(value); // CodeableConcept
12336          return value;
12337        case -911343192: // allowed
12338          this.allowed = castToType(value); // Type
12339          return value;
12340        case 3599293: // used
12341          this.used = castToType(value); // Type
12342          return value;
12343        default: return super.setProperty(hash, name, value);
12344        }
12345
12346      }
12347
12348      @Override
12349      public Base setProperty(String name, Base value) throws FHIRException {
12350        if (name.equals("type")) {
12351          this.type = castToCodeableConcept(value); // CodeableConcept
12352        } else if (name.equals("allowed[x]")) {
12353          this.allowed = castToType(value); // Type
12354        } else if (name.equals("used[x]")) {
12355          this.used = castToType(value); // Type
12356        } else
12357          return super.setProperty(name, value);
12358        return value;
12359      }
12360
12361      @Override
12362      public Base makeProperty(int hash, String name) throws FHIRException {
12363        switch (hash) {
12364        case 3575610:  return getType(); 
12365        case -1336663592:  return getAllowed(); 
12366        case -911343192:  return getAllowed(); 
12367        case -147553373:  return getUsed(); 
12368        case 3599293:  return getUsed(); 
12369        default: return super.makeProperty(hash, name);
12370        }
12371
12372      }
12373
12374      @Override
12375      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12376        switch (hash) {
12377        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
12378        case -911343192: /*allowed*/ return new String[] {"unsignedInt", "string", "Money"};
12379        case 3599293: /*used*/ return new String[] {"unsignedInt", "Money"};
12380        default: return super.getTypesForProperty(hash, name);
12381        }
12382
12383      }
12384
12385      @Override
12386      public Base addChild(String name) throws FHIRException {
12387        if (name.equals("type")) {
12388          this.type = new CodeableConcept();
12389          return this.type;
12390        }
12391        else if (name.equals("allowedUnsignedInt")) {
12392          this.allowed = new UnsignedIntType();
12393          return this.allowed;
12394        }
12395        else if (name.equals("allowedString")) {
12396          this.allowed = new StringType();
12397          return this.allowed;
12398        }
12399        else if (name.equals("allowedMoney")) {
12400          this.allowed = new Money();
12401          return this.allowed;
12402        }
12403        else if (name.equals("usedUnsignedInt")) {
12404          this.used = new UnsignedIntType();
12405          return this.used;
12406        }
12407        else if (name.equals("usedMoney")) {
12408          this.used = new Money();
12409          return this.used;
12410        }
12411        else
12412          return super.addChild(name);
12413      }
12414
12415      public BenefitComponent copy() {
12416        BenefitComponent dst = new BenefitComponent();
12417        copyValues(dst);
12418        return dst;
12419      }
12420
12421      public void copyValues(BenefitComponent dst) {
12422        super.copyValues(dst);
12423        dst.type = type == null ? null : type.copy();
12424        dst.allowed = allowed == null ? null : allowed.copy();
12425        dst.used = used == null ? null : used.copy();
12426      }
12427
12428      @Override
12429      public boolean equalsDeep(Base other_) {
12430        if (!super.equalsDeep(other_))
12431          return false;
12432        if (!(other_ instanceof BenefitComponent))
12433          return false;
12434        BenefitComponent o = (BenefitComponent) other_;
12435        return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true) && compareDeep(used, o.used, true)
12436          ;
12437      }
12438
12439      @Override
12440      public boolean equalsShallow(Base other_) {
12441        if (!super.equalsShallow(other_))
12442          return false;
12443        if (!(other_ instanceof BenefitComponent))
12444          return false;
12445        BenefitComponent o = (BenefitComponent) other_;
12446        return true;
12447      }
12448
12449      public boolean isEmpty() {
12450        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed, used);
12451      }
12452
12453  public String fhirType() {
12454    return "ExplanationOfBenefit.benefitBalance.financial";
12455
12456  }
12457
12458  }
12459
12460    /**
12461     * A unique identifier assigned to this explanation of benefit.
12462     */
12463    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12464    @Description(shortDefinition="Business Identifier for the resource", formalDefinition="A unique identifier assigned to this explanation of benefit." )
12465    protected List<Identifier> identifier;
12466
12467    /**
12468     * The status of the resource instance.
12469     */
12470    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
12471    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
12472    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/explanationofbenefit-status")
12473    protected Enumeration<ExplanationOfBenefitStatus> status;
12474
12475    /**
12476     * The category of claim, e.g. oral, pharmacy, vision, institutional, professional.
12477     */
12478    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
12479    @Description(shortDefinition="Category or discipline", formalDefinition="The category of claim, e.g. oral, pharmacy, vision, institutional, professional." )
12480    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-type")
12481    protected CodeableConcept type;
12482
12483    /**
12484     * A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.
12485     */
12486    @Child(name = "subType", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
12487    @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." )
12488    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-subtype")
12489    protected CodeableConcept subType;
12490
12491    /**
12492     * 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.
12493     */
12494    @Child(name = "use", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
12495    @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." )
12496    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-use")
12497    protected Enumeration<Use> use;
12498
12499    /**
12500     * 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.
12501     */
12502    @Child(name = "patient", type = {Patient.class}, order=5, min=1, max=1, modifier=false, summary=true)
12503    @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." )
12504    protected Reference patient;
12505
12506    /**
12507     * 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.)
12508     */
12509    protected Patient patientTarget;
12510
12511    /**
12512     * The period for which charges are being submitted.
12513     */
12514    @Child(name = "billablePeriod", type = {Period.class}, order=6, min=0, max=1, modifier=false, summary=true)
12515    @Description(shortDefinition="Relevant time frame for the claim", formalDefinition="The period for which charges are being submitted." )
12516    protected Period billablePeriod;
12517
12518    /**
12519     * The date this resource was created.
12520     */
12521    @Child(name = "created", type = {DateTimeType.class}, order=7, min=1, max=1, modifier=false, summary=true)
12522    @Description(shortDefinition="Response creation date", formalDefinition="The date this resource was created." )
12523    protected DateTimeType created;
12524
12525    /**
12526     * Individual who created the claim, predetermination or preauthorization.
12527     */
12528    @Child(name = "enterer", type = {Practitioner.class, PractitionerRole.class}, order=8, min=0, max=1, modifier=false, summary=false)
12529    @Description(shortDefinition="Author of the claim", formalDefinition="Individual who created the claim, predetermination or preauthorization." )
12530    protected Reference enterer;
12531
12532    /**
12533     * The actual object that is the target of the reference (Individual who created the claim, predetermination or preauthorization.)
12534     */
12535    protected Resource entererTarget;
12536
12537    /**
12538     * The party responsible for authorization, adjudication and reimbursement.
12539     */
12540    @Child(name = "insurer", type = {Organization.class}, order=9, min=1, max=1, modifier=false, summary=true)
12541    @Description(shortDefinition="Party responsible for reimbursement", formalDefinition="The party responsible for authorization, adjudication and reimbursement." )
12542    protected Reference insurer;
12543
12544    /**
12545     * The actual object that is the target of the reference (The party responsible for authorization, adjudication and reimbursement.)
12546     */
12547    protected Organization insurerTarget;
12548
12549    /**
12550     * The provider which is responsible for the claim, predetermination or preauthorization.
12551     */
12552    @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=10, min=1, max=1, modifier=false, summary=true)
12553    @Description(shortDefinition="Party responsible for the claim", formalDefinition="The provider which is responsible for the claim, predetermination or preauthorization." )
12554    protected Reference provider;
12555
12556    /**
12557     * The actual object that is the target of the reference (The provider which is responsible for the claim, predetermination or preauthorization.)
12558     */
12559    protected Resource providerTarget;
12560
12561    /**
12562     * The provider-required urgency of processing the request. Typical values include: stat, routine deferred.
12563     */
12564    @Child(name = "priority", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=false)
12565    @Description(shortDefinition="Desired processing urgency", formalDefinition="The provider-required urgency of processing the request. Typical values include: stat, routine deferred." )
12566    protected CodeableConcept priority;
12567
12568    /**
12569     * A code to indicate whether and for whom funds are to be reserved for future claims.
12570     */
12571    @Child(name = "fundsReserveRequested", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
12572    @Description(shortDefinition="For whom to reserve funds", formalDefinition="A code to indicate whether and for whom funds are to be reserved for future claims." )
12573    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fundsreserve")
12574    protected CodeableConcept fundsReserveRequested;
12575
12576    /**
12577     * A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.
12578     */
12579    @Child(name = "fundsReserve", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
12580    @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." )
12581    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fundsreserve")
12582    protected CodeableConcept fundsReserve;
12583
12584    /**
12585     * Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.
12586     */
12587    @Child(name = "related", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12588    @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." )
12589    protected List<RelatedClaimComponent> related;
12590
12591    /**
12592     * Prescription to support the dispensing of pharmacy, device or vision products.
12593     */
12594    @Child(name = "prescription", type = {MedicationRequest.class, VisionPrescription.class}, order=15, min=0, max=1, modifier=false, summary=false)
12595    @Description(shortDefinition="Prescription authorizing services or products", formalDefinition="Prescription to support the dispensing of pharmacy, device or vision products." )
12596    protected Reference prescription;
12597
12598    /**
12599     * The actual object that is the target of the reference (Prescription to support the dispensing of pharmacy, device or vision products.)
12600     */
12601    protected Resource prescriptionTarget;
12602
12603    /**
12604     * Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.
12605     */
12606    @Child(name = "originalPrescription", type = {MedicationRequest.class}, order=16, min=0, max=1, modifier=false, summary=false)
12607    @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." )
12608    protected Reference originalPrescription;
12609
12610    /**
12611     * 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.)
12612     */
12613    protected MedicationRequest originalPrescriptionTarget;
12614
12615    /**
12616     * The party to be reimbursed for cost of the products and services according to the terms of the policy.
12617     */
12618    @Child(name = "payee", type = {}, order=17, min=0, max=1, modifier=false, summary=false)
12619    @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." )
12620    protected PayeeComponent payee;
12621
12622    /**
12623     * A reference to a referral resource.
12624     */
12625    @Child(name = "referral", type = {ServiceRequest.class}, order=18, min=0, max=1, modifier=false, summary=false)
12626    @Description(shortDefinition="Treatment Referral", formalDefinition="A reference to a referral resource." )
12627    protected Reference referral;
12628
12629    /**
12630     * The actual object that is the target of the reference (A reference to a referral resource.)
12631     */
12632    protected ServiceRequest referralTarget;
12633
12634    /**
12635     * Facility where the services were provided.
12636     */
12637    @Child(name = "facility", type = {Location.class}, order=19, min=0, max=1, modifier=false, summary=false)
12638    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
12639    protected Reference facility;
12640
12641    /**
12642     * The actual object that is the target of the reference (Facility where the services were provided.)
12643     */
12644    protected Location facilityTarget;
12645
12646    /**
12647     * The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.
12648     */
12649    @Child(name = "claim", type = {Claim.class}, order=20, min=0, max=1, modifier=false, summary=false)
12650    @Description(shortDefinition="Claim reference", formalDefinition="The business identifier for the instance of the adjudication request: claim predetermination or preauthorization." )
12651    protected Reference claim;
12652
12653    /**
12654     * The actual object that is the target of the reference (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
12655     */
12656    protected Claim claimTarget;
12657
12658    /**
12659     * The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.
12660     */
12661    @Child(name = "claimResponse", type = {ClaimResponse.class}, order=21, min=0, max=1, modifier=false, summary=false)
12662    @Description(shortDefinition="Claim response reference", formalDefinition="The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response." )
12663    protected Reference claimResponse;
12664
12665    /**
12666     * 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.)
12667     */
12668    protected ClaimResponse claimResponseTarget;
12669
12670    /**
12671     * The outcome of the claim, predetermination, or preauthorization processing.
12672     */
12673    @Child(name = "outcome", type = {CodeType.class}, order=22, min=1, max=1, modifier=false, summary=true)
12674    @Description(shortDefinition="queued | complete | error | partial", formalDefinition="The outcome of the claim, predetermination, or preauthorization processing." )
12675    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/remittance-outcome")
12676    protected Enumeration<RemittanceOutcome> outcome;
12677
12678    /**
12679     * A human readable description of the status of the adjudication.
12680     */
12681    @Child(name = "disposition", type = {StringType.class}, order=23, min=0, max=1, modifier=false, summary=false)
12682    @Description(shortDefinition="Disposition Message", formalDefinition="A human readable description of the status of the adjudication." )
12683    protected StringType disposition;
12684
12685    /**
12686     * Reference from the Insurer which is used in later communications which refers to this adjudication.
12687     */
12688    @Child(name = "preAuthRef", type = {StringType.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12689    @Description(shortDefinition="Preauthorization reference", formalDefinition="Reference from the Insurer which is used in later communications which refers to this adjudication." )
12690    protected List<StringType> preAuthRef;
12691
12692    /**
12693     * The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.
12694     */
12695    @Child(name = "preAuthRefPeriod", type = {Period.class}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12696    @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." )
12697    protected List<Period> preAuthRefPeriod;
12698
12699    /**
12700     * The members of the team who provided the products and services.
12701     */
12702    @Child(name = "careTeam", type = {}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12703    @Description(shortDefinition="Care Team members", formalDefinition="The members of the team who provided the products and services." )
12704    protected List<CareTeamComponent> careTeam;
12705
12706    /**
12707     * Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.
12708     */
12709    @Child(name = "supportingInfo", type = {}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12710    @Description(shortDefinition="Supporting information", formalDefinition="Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues." )
12711    protected List<SupportingInformationComponent> supportingInfo;
12712
12713    /**
12714     * Information about diagnoses relevant to the claim items.
12715     */
12716    @Child(name = "diagnosis", type = {}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12717    @Description(shortDefinition="Pertinent diagnosis information", formalDefinition="Information about diagnoses relevant to the claim items." )
12718    protected List<DiagnosisComponent> diagnosis;
12719
12720    /**
12721     * Procedures performed on the patient relevant to the billing items with the claim.
12722     */
12723    @Child(name = "procedure", type = {}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12724    @Description(shortDefinition="Clinical procedures performed", formalDefinition="Procedures performed on the patient relevant to the billing items with the claim." )
12725    protected List<ProcedureComponent> procedure;
12726
12727    /**
12728     * This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
12729     */
12730    @Child(name = "precedence", type = {PositiveIntType.class}, order=30, min=0, max=1, modifier=false, summary=false)
12731    @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." )
12732    protected PositiveIntType precedence;
12733
12734    /**
12735     * Financial instruments for reimbursement for the health care products and services specified on the claim.
12736     */
12737    @Child(name = "insurance", type = {}, order=31, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
12738    @Description(shortDefinition="Patient insurance information", formalDefinition="Financial instruments for reimbursement for the health care products and services specified on the claim." )
12739    protected List<InsuranceComponent> insurance;
12740
12741    /**
12742     * Details of a accident which resulted in injuries which required the products and services listed in the claim.
12743     */
12744    @Child(name = "accident", type = {}, order=32, min=0, max=1, modifier=false, summary=false)
12745    @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." )
12746    protected AccidentComponent accident;
12747
12748    /**
12749     * 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.
12750     */
12751    @Child(name = "item", type = {}, order=33, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12752    @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." )
12753    protected List<ItemComponent> item;
12754
12755    /**
12756     * The first-tier service adjudications for payor added product or service lines.
12757     */
12758    @Child(name = "addItem", type = {}, order=34, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12759    @Description(shortDefinition="Insurer added line items", formalDefinition="The first-tier service adjudications for payor added product or service lines." )
12760    protected List<AddedItemComponent> addItem;
12761
12762    /**
12763     * The adjudication results which are presented at the header level rather than at the line-item or add-item levels.
12764     */
12765    @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=35, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12766    @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." )
12767    protected List<AdjudicationComponent> adjudication;
12768
12769    /**
12770     * Categorized monetary totals for the adjudication.
12771     */
12772    @Child(name = "total", type = {}, order=36, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
12773    @Description(shortDefinition="Adjudication totals", formalDefinition="Categorized monetary totals for the adjudication." )
12774    protected List<TotalComponent> total;
12775
12776    /**
12777     * Payment details for the adjudication of the claim.
12778     */
12779    @Child(name = "payment", type = {}, order=37, min=0, max=1, modifier=false, summary=false)
12780    @Description(shortDefinition="Payment Details", formalDefinition="Payment details for the adjudication of the claim." )
12781    protected PaymentComponent payment;
12782
12783    /**
12784     * A code for the form to be used for printing the content.
12785     */
12786    @Child(name = "formCode", type = {CodeableConcept.class}, order=38, min=0, max=1, modifier=false, summary=false)
12787    @Description(shortDefinition="Printed form identifier", formalDefinition="A code for the form to be used for printing the content." )
12788    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/forms")
12789    protected CodeableConcept formCode;
12790
12791    /**
12792     * The actual form, by reference or inclusion, for printing the content or an EOB.
12793     */
12794    @Child(name = "form", type = {Attachment.class}, order=39, min=0, max=1, modifier=false, summary=false)
12795    @Description(shortDefinition="Printed reference or actual form", formalDefinition="The actual form, by reference or inclusion, for printing the content or an EOB." )
12796    protected Attachment form;
12797
12798    /**
12799     * A note that describes or explains adjudication results in a human readable form.
12800     */
12801    @Child(name = "processNote", type = {}, order=40, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12802    @Description(shortDefinition="Note concerning adjudication", formalDefinition="A note that describes or explains adjudication results in a human readable form." )
12803    protected List<NoteComponent> processNote;
12804
12805    /**
12806     * The term of the benefits documented in this response.
12807     */
12808    @Child(name = "benefitPeriod", type = {Period.class}, order=41, min=0, max=1, modifier=false, summary=false)
12809    @Description(shortDefinition="When the benefits are applicable", formalDefinition="The term of the benefits documented in this response." )
12810    protected Period benefitPeriod;
12811
12812    /**
12813     * Balance by Benefit Category.
12814     */
12815    @Child(name = "benefitBalance", type = {}, order=42, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12816    @Description(shortDefinition="Balance by Benefit Category", formalDefinition="Balance by Benefit Category." )
12817    protected List<BenefitBalanceComponent> benefitBalance;
12818
12819    private static final long serialVersionUID = -1515422099L;
12820
12821  /**
12822   * Constructor
12823   */
12824    public ExplanationOfBenefit() {
12825      super();
12826    }
12827
12828  /**
12829   * Constructor
12830   */
12831    public ExplanationOfBenefit(Enumeration<ExplanationOfBenefitStatus> status, CodeableConcept type, Enumeration<Use> use, Reference patient, DateTimeType created, Reference insurer, Reference provider, Enumeration<RemittanceOutcome> outcome) {
12832      super();
12833      this.status = status;
12834      this.type = type;
12835      this.use = use;
12836      this.patient = patient;
12837      this.created = created;
12838      this.insurer = insurer;
12839      this.provider = provider;
12840      this.outcome = outcome;
12841    }
12842
12843    /**
12844     * @return {@link #identifier} (A unique identifier assigned to this explanation of benefit.)
12845     */
12846    public List<Identifier> getIdentifier() { 
12847      if (this.identifier == null)
12848        this.identifier = new ArrayList<Identifier>();
12849      return this.identifier;
12850    }
12851
12852    /**
12853     * @return Returns a reference to <code>this</code> for easy method chaining
12854     */
12855    public ExplanationOfBenefit setIdentifier(List<Identifier> theIdentifier) { 
12856      this.identifier = theIdentifier;
12857      return this;
12858    }
12859
12860    public boolean hasIdentifier() { 
12861      if (this.identifier == null)
12862        return false;
12863      for (Identifier item : this.identifier)
12864        if (!item.isEmpty())
12865          return true;
12866      return false;
12867    }
12868
12869    public Identifier addIdentifier() { //3
12870      Identifier t = new Identifier();
12871      if (this.identifier == null)
12872        this.identifier = new ArrayList<Identifier>();
12873      this.identifier.add(t);
12874      return t;
12875    }
12876
12877    public ExplanationOfBenefit addIdentifier(Identifier t) { //3
12878      if (t == null)
12879        return this;
12880      if (this.identifier == null)
12881        this.identifier = new ArrayList<Identifier>();
12882      this.identifier.add(t);
12883      return this;
12884    }
12885
12886    /**
12887     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
12888     */
12889    public Identifier getIdentifierFirstRep() { 
12890      if (getIdentifier().isEmpty()) {
12891        addIdentifier();
12892      }
12893      return getIdentifier().get(0);
12894    }
12895
12896    /**
12897     * @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
12898     */
12899    public Enumeration<ExplanationOfBenefitStatus> getStatusElement() { 
12900      if (this.status == null)
12901        if (Configuration.errorOnAutoCreate())
12902          throw new Error("Attempt to auto-create ExplanationOfBenefit.status");
12903        else if (Configuration.doAutoCreate())
12904          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory()); // bb
12905      return this.status;
12906    }
12907
12908    public boolean hasStatusElement() { 
12909      return this.status != null && !this.status.isEmpty();
12910    }
12911
12912    public boolean hasStatus() { 
12913      return this.status != null && !this.status.isEmpty();
12914    }
12915
12916    /**
12917     * @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
12918     */
12919    public ExplanationOfBenefit setStatusElement(Enumeration<ExplanationOfBenefitStatus> value) { 
12920      this.status = value;
12921      return this;
12922    }
12923
12924    /**
12925     * @return The status of the resource instance.
12926     */
12927    public ExplanationOfBenefitStatus getStatus() { 
12928      return this.status == null ? null : this.status.getValue();
12929    }
12930
12931    /**
12932     * @param value The status of the resource instance.
12933     */
12934    public ExplanationOfBenefit setStatus(ExplanationOfBenefitStatus value) { 
12935        if (this.status == null)
12936          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory());
12937        this.status.setValue(value);
12938      return this;
12939    }
12940
12941    /**
12942     * @return {@link #type} (The category of claim, e.g. oral, pharmacy, vision, institutional, professional.)
12943     */
12944    public CodeableConcept getType() { 
12945      if (this.type == null)
12946        if (Configuration.errorOnAutoCreate())
12947          throw new Error("Attempt to auto-create ExplanationOfBenefit.type");
12948        else if (Configuration.doAutoCreate())
12949          this.type = new CodeableConcept(); // cc
12950      return this.type;
12951    }
12952
12953    public boolean hasType() { 
12954      return this.type != null && !this.type.isEmpty();
12955    }
12956
12957    /**
12958     * @param value {@link #type} (The category of claim, e.g. oral, pharmacy, vision, institutional, professional.)
12959     */
12960    public ExplanationOfBenefit setType(CodeableConcept value) { 
12961      this.type = value;
12962      return this;
12963    }
12964
12965    /**
12966     * @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.)
12967     */
12968    public CodeableConcept getSubType() { 
12969      if (this.subType == null)
12970        if (Configuration.errorOnAutoCreate())
12971          throw new Error("Attempt to auto-create ExplanationOfBenefit.subType");
12972        else if (Configuration.doAutoCreate())
12973          this.subType = new CodeableConcept(); // cc
12974      return this.subType;
12975    }
12976
12977    public boolean hasSubType() { 
12978      return this.subType != null && !this.subType.isEmpty();
12979    }
12980
12981    /**
12982     * @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.)
12983     */
12984    public ExplanationOfBenefit setSubType(CodeableConcept value) { 
12985      this.subType = value;
12986      return this;
12987    }
12988
12989    /**
12990     * @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
12991     */
12992    public Enumeration<Use> getUseElement() { 
12993      if (this.use == null)
12994        if (Configuration.errorOnAutoCreate())
12995          throw new Error("Attempt to auto-create ExplanationOfBenefit.use");
12996        else if (Configuration.doAutoCreate())
12997          this.use = new Enumeration<Use>(new UseEnumFactory()); // bb
12998      return this.use;
12999    }
13000
13001    public boolean hasUseElement() { 
13002      return this.use != null && !this.use.isEmpty();
13003    }
13004
13005    public boolean hasUse() { 
13006      return this.use != null && !this.use.isEmpty();
13007    }
13008
13009    /**
13010     * @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
13011     */
13012    public ExplanationOfBenefit setUseElement(Enumeration<Use> value) { 
13013      this.use = value;
13014      return this;
13015    }
13016
13017    /**
13018     * @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.
13019     */
13020    public Use getUse() { 
13021      return this.use == null ? null : this.use.getValue();
13022    }
13023
13024    /**
13025     * @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.
13026     */
13027    public ExplanationOfBenefit setUse(Use value) { 
13028        if (this.use == null)
13029          this.use = new Enumeration<Use>(new UseEnumFactory());
13030        this.use.setValue(value);
13031      return this;
13032    }
13033
13034    /**
13035     * @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.)
13036     */
13037    public Reference getPatient() { 
13038      if (this.patient == null)
13039        if (Configuration.errorOnAutoCreate())
13040          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
13041        else if (Configuration.doAutoCreate())
13042          this.patient = new Reference(); // cc
13043      return this.patient;
13044    }
13045
13046    public boolean hasPatient() { 
13047      return this.patient != null && !this.patient.isEmpty();
13048    }
13049
13050    /**
13051     * @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.)
13052     */
13053    public ExplanationOfBenefit setPatient(Reference value) { 
13054      this.patient = value;
13055      return this;
13056    }
13057
13058    /**
13059     * @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.)
13060     */
13061    public Patient getPatientTarget() { 
13062      if (this.patientTarget == null)
13063        if (Configuration.errorOnAutoCreate())
13064          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
13065        else if (Configuration.doAutoCreate())
13066          this.patientTarget = new Patient(); // aa
13067      return this.patientTarget;
13068    }
13069
13070    /**
13071     * @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.)
13072     */
13073    public ExplanationOfBenefit setPatientTarget(Patient value) { 
13074      this.patientTarget = value;
13075      return this;
13076    }
13077
13078    /**
13079     * @return {@link #billablePeriod} (The period for which charges are being submitted.)
13080     */
13081    public Period getBillablePeriod() { 
13082      if (this.billablePeriod == null)
13083        if (Configuration.errorOnAutoCreate())
13084          throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
13085        else if (Configuration.doAutoCreate())
13086          this.billablePeriod = new Period(); // cc
13087      return this.billablePeriod;
13088    }
13089
13090    public boolean hasBillablePeriod() { 
13091      return this.billablePeriod != null && !this.billablePeriod.isEmpty();
13092    }
13093
13094    /**
13095     * @param value {@link #billablePeriod} (The period for which charges are being submitted.)
13096     */
13097    public ExplanationOfBenefit setBillablePeriod(Period value) { 
13098      this.billablePeriod = value;
13099      return this;
13100    }
13101
13102    /**
13103     * @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
13104     */
13105    public DateTimeType getCreatedElement() { 
13106      if (this.created == null)
13107        if (Configuration.errorOnAutoCreate())
13108          throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
13109        else if (Configuration.doAutoCreate())
13110          this.created = new DateTimeType(); // bb
13111      return this.created;
13112    }
13113
13114    public boolean hasCreatedElement() { 
13115      return this.created != null && !this.created.isEmpty();
13116    }
13117
13118    public boolean hasCreated() { 
13119      return this.created != null && !this.created.isEmpty();
13120    }
13121
13122    /**
13123     * @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
13124     */
13125    public ExplanationOfBenefit setCreatedElement(DateTimeType value) { 
13126      this.created = value;
13127      return this;
13128    }
13129
13130    /**
13131     * @return The date this resource was created.
13132     */
13133    public Date getCreated() { 
13134      return this.created == null ? null : this.created.getValue();
13135    }
13136
13137    /**
13138     * @param value The date this resource was created.
13139     */
13140    public ExplanationOfBenefit setCreated(Date value) { 
13141        if (this.created == null)
13142          this.created = new DateTimeType();
13143        this.created.setValue(value);
13144      return this;
13145    }
13146
13147    /**
13148     * @return {@link #enterer} (Individual who created the claim, predetermination or preauthorization.)
13149     */
13150    public Reference getEnterer() { 
13151      if (this.enterer == null)
13152        if (Configuration.errorOnAutoCreate())
13153          throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
13154        else if (Configuration.doAutoCreate())
13155          this.enterer = new Reference(); // cc
13156      return this.enterer;
13157    }
13158
13159    public boolean hasEnterer() { 
13160      return this.enterer != null && !this.enterer.isEmpty();
13161    }
13162
13163    /**
13164     * @param value {@link #enterer} (Individual who created the claim, predetermination or preauthorization.)
13165     */
13166    public ExplanationOfBenefit setEnterer(Reference value) { 
13167      this.enterer = value;
13168      return this;
13169    }
13170
13171    /**
13172     * @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.)
13173     */
13174    public Resource getEntererTarget() { 
13175      return this.entererTarget;
13176    }
13177
13178    /**
13179     * @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.)
13180     */
13181    public ExplanationOfBenefit setEntererTarget(Resource value) { 
13182      this.entererTarget = value;
13183      return this;
13184    }
13185
13186    /**
13187     * @return {@link #insurer} (The party responsible for authorization, adjudication and reimbursement.)
13188     */
13189    public Reference getInsurer() { 
13190      if (this.insurer == null)
13191        if (Configuration.errorOnAutoCreate())
13192          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
13193        else if (Configuration.doAutoCreate())
13194          this.insurer = new Reference(); // cc
13195      return this.insurer;
13196    }
13197
13198    public boolean hasInsurer() { 
13199      return this.insurer != null && !this.insurer.isEmpty();
13200    }
13201
13202    /**
13203     * @param value {@link #insurer} (The party responsible for authorization, adjudication and reimbursement.)
13204     */
13205    public ExplanationOfBenefit setInsurer(Reference value) { 
13206      this.insurer = value;
13207      return this;
13208    }
13209
13210    /**
13211     * @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.)
13212     */
13213    public Organization getInsurerTarget() { 
13214      if (this.insurerTarget == null)
13215        if (Configuration.errorOnAutoCreate())
13216          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
13217        else if (Configuration.doAutoCreate())
13218          this.insurerTarget = new Organization(); // aa
13219      return this.insurerTarget;
13220    }
13221
13222    /**
13223     * @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.)
13224     */
13225    public ExplanationOfBenefit setInsurerTarget(Organization value) { 
13226      this.insurerTarget = value;
13227      return this;
13228    }
13229
13230    /**
13231     * @return {@link #provider} (The provider which is responsible for the claim, predetermination or preauthorization.)
13232     */
13233    public Reference getProvider() { 
13234      if (this.provider == null)
13235        if (Configuration.errorOnAutoCreate())
13236          throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
13237        else if (Configuration.doAutoCreate())
13238          this.provider = new Reference(); // cc
13239      return this.provider;
13240    }
13241
13242    public boolean hasProvider() { 
13243      return this.provider != null && !this.provider.isEmpty();
13244    }
13245
13246    /**
13247     * @param value {@link #provider} (The provider which is responsible for the claim, predetermination or preauthorization.)
13248     */
13249    public ExplanationOfBenefit setProvider(Reference value) { 
13250      this.provider = value;
13251      return this;
13252    }
13253
13254    /**
13255     * @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.)
13256     */
13257    public Resource getProviderTarget() { 
13258      return this.providerTarget;
13259    }
13260
13261    /**
13262     * @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.)
13263     */
13264    public ExplanationOfBenefit setProviderTarget(Resource value) { 
13265      this.providerTarget = value;
13266      return this;
13267    }
13268
13269    /**
13270     * @return {@link #priority} (The provider-required urgency of processing the request. Typical values include: stat, routine deferred.)
13271     */
13272    public CodeableConcept getPriority() { 
13273      if (this.priority == null)
13274        if (Configuration.errorOnAutoCreate())
13275          throw new Error("Attempt to auto-create ExplanationOfBenefit.priority");
13276        else if (Configuration.doAutoCreate())
13277          this.priority = new CodeableConcept(); // cc
13278      return this.priority;
13279    }
13280
13281    public boolean hasPriority() { 
13282      return this.priority != null && !this.priority.isEmpty();
13283    }
13284
13285    /**
13286     * @param value {@link #priority} (The provider-required urgency of processing the request. Typical values include: stat, routine deferred.)
13287     */
13288    public ExplanationOfBenefit setPriority(CodeableConcept value) { 
13289      this.priority = value;
13290      return this;
13291    }
13292
13293    /**
13294     * @return {@link #fundsReserveRequested} (A code to indicate whether and for whom funds are to be reserved for future claims.)
13295     */
13296    public CodeableConcept getFundsReserveRequested() { 
13297      if (this.fundsReserveRequested == null)
13298        if (Configuration.errorOnAutoCreate())
13299          throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserveRequested");
13300        else if (Configuration.doAutoCreate())
13301          this.fundsReserveRequested = new CodeableConcept(); // cc
13302      return this.fundsReserveRequested;
13303    }
13304
13305    public boolean hasFundsReserveRequested() { 
13306      return this.fundsReserveRequested != null && !this.fundsReserveRequested.isEmpty();
13307    }
13308
13309    /**
13310     * @param value {@link #fundsReserveRequested} (A code to indicate whether and for whom funds are to be reserved for future claims.)
13311     */
13312    public ExplanationOfBenefit setFundsReserveRequested(CodeableConcept value) { 
13313      this.fundsReserveRequested = value;
13314      return this;
13315    }
13316
13317    /**
13318     * @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.)
13319     */
13320    public CodeableConcept getFundsReserve() { 
13321      if (this.fundsReserve == null)
13322        if (Configuration.errorOnAutoCreate())
13323          throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserve");
13324        else if (Configuration.doAutoCreate())
13325          this.fundsReserve = new CodeableConcept(); // cc
13326      return this.fundsReserve;
13327    }
13328
13329    public boolean hasFundsReserve() { 
13330      return this.fundsReserve != null && !this.fundsReserve.isEmpty();
13331    }
13332
13333    /**
13334     * @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.)
13335     */
13336    public ExplanationOfBenefit setFundsReserve(CodeableConcept value) { 
13337      this.fundsReserve = value;
13338      return this;
13339    }
13340
13341    /**
13342     * @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.)
13343     */
13344    public List<RelatedClaimComponent> getRelated() { 
13345      if (this.related == null)
13346        this.related = new ArrayList<RelatedClaimComponent>();
13347      return this.related;
13348    }
13349
13350    /**
13351     * @return Returns a reference to <code>this</code> for easy method chaining
13352     */
13353    public ExplanationOfBenefit setRelated(List<RelatedClaimComponent> theRelated) { 
13354      this.related = theRelated;
13355      return this;
13356    }
13357
13358    public boolean hasRelated() { 
13359      if (this.related == null)
13360        return false;
13361      for (RelatedClaimComponent item : this.related)
13362        if (!item.isEmpty())
13363          return true;
13364      return false;
13365    }
13366
13367    public RelatedClaimComponent addRelated() { //3
13368      RelatedClaimComponent t = new RelatedClaimComponent();
13369      if (this.related == null)
13370        this.related = new ArrayList<RelatedClaimComponent>();
13371      this.related.add(t);
13372      return t;
13373    }
13374
13375    public ExplanationOfBenefit addRelated(RelatedClaimComponent t) { //3
13376      if (t == null)
13377        return this;
13378      if (this.related == null)
13379        this.related = new ArrayList<RelatedClaimComponent>();
13380      this.related.add(t);
13381      return this;
13382    }
13383
13384    /**
13385     * @return The first repetition of repeating field {@link #related}, creating it if it does not already exist
13386     */
13387    public RelatedClaimComponent getRelatedFirstRep() { 
13388      if (getRelated().isEmpty()) {
13389        addRelated();
13390      }
13391      return getRelated().get(0);
13392    }
13393
13394    /**
13395     * @return {@link #prescription} (Prescription to support the dispensing of pharmacy, device or vision products.)
13396     */
13397    public Reference getPrescription() { 
13398      if (this.prescription == null)
13399        if (Configuration.errorOnAutoCreate())
13400          throw new Error("Attempt to auto-create ExplanationOfBenefit.prescription");
13401        else if (Configuration.doAutoCreate())
13402          this.prescription = new Reference(); // cc
13403      return this.prescription;
13404    }
13405
13406    public boolean hasPrescription() { 
13407      return this.prescription != null && !this.prescription.isEmpty();
13408    }
13409
13410    /**
13411     * @param value {@link #prescription} (Prescription to support the dispensing of pharmacy, device or vision products.)
13412     */
13413    public ExplanationOfBenefit setPrescription(Reference value) { 
13414      this.prescription = value;
13415      return this;
13416    }
13417
13418    /**
13419     * @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.)
13420     */
13421    public Resource getPrescriptionTarget() { 
13422      return this.prescriptionTarget;
13423    }
13424
13425    /**
13426     * @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.)
13427     */
13428    public ExplanationOfBenefit setPrescriptionTarget(Resource value) { 
13429      this.prescriptionTarget = value;
13430      return this;
13431    }
13432
13433    /**
13434     * @return {@link #originalPrescription} (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
13435     */
13436    public Reference getOriginalPrescription() { 
13437      if (this.originalPrescription == null)
13438        if (Configuration.errorOnAutoCreate())
13439          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
13440        else if (Configuration.doAutoCreate())
13441          this.originalPrescription = new Reference(); // cc
13442      return this.originalPrescription;
13443    }
13444
13445    public boolean hasOriginalPrescription() { 
13446      return this.originalPrescription != null && !this.originalPrescription.isEmpty();
13447    }
13448
13449    /**
13450     * @param value {@link #originalPrescription} (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
13451     */
13452    public ExplanationOfBenefit setOriginalPrescription(Reference value) { 
13453      this.originalPrescription = value;
13454      return this;
13455    }
13456
13457    /**
13458     * @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.)
13459     */
13460    public MedicationRequest getOriginalPrescriptionTarget() { 
13461      if (this.originalPrescriptionTarget == null)
13462        if (Configuration.errorOnAutoCreate())
13463          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
13464        else if (Configuration.doAutoCreate())
13465          this.originalPrescriptionTarget = new MedicationRequest(); // aa
13466      return this.originalPrescriptionTarget;
13467    }
13468
13469    /**
13470     * @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.)
13471     */
13472    public ExplanationOfBenefit setOriginalPrescriptionTarget(MedicationRequest value) { 
13473      this.originalPrescriptionTarget = value;
13474      return this;
13475    }
13476
13477    /**
13478     * @return {@link #payee} (The party to be reimbursed for cost of the products and services according to the terms of the policy.)
13479     */
13480    public PayeeComponent getPayee() { 
13481      if (this.payee == null)
13482        if (Configuration.errorOnAutoCreate())
13483          throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
13484        else if (Configuration.doAutoCreate())
13485          this.payee = new PayeeComponent(); // cc
13486      return this.payee;
13487    }
13488
13489    public boolean hasPayee() { 
13490      return this.payee != null && !this.payee.isEmpty();
13491    }
13492
13493    /**
13494     * @param value {@link #payee} (The party to be reimbursed for cost of the products and services according to the terms of the policy.)
13495     */
13496    public ExplanationOfBenefit setPayee(PayeeComponent value) { 
13497      this.payee = value;
13498      return this;
13499    }
13500
13501    /**
13502     * @return {@link #referral} (A reference to a referral resource.)
13503     */
13504    public Reference getReferral() { 
13505      if (this.referral == null)
13506        if (Configuration.errorOnAutoCreate())
13507          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
13508        else if (Configuration.doAutoCreate())
13509          this.referral = new Reference(); // cc
13510      return this.referral;
13511    }
13512
13513    public boolean hasReferral() { 
13514      return this.referral != null && !this.referral.isEmpty();
13515    }
13516
13517    /**
13518     * @param value {@link #referral} (A reference to a referral resource.)
13519     */
13520    public ExplanationOfBenefit setReferral(Reference value) { 
13521      this.referral = value;
13522      return this;
13523    }
13524
13525    /**
13526     * @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.)
13527     */
13528    public ServiceRequest getReferralTarget() { 
13529      if (this.referralTarget == null)
13530        if (Configuration.errorOnAutoCreate())
13531          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
13532        else if (Configuration.doAutoCreate())
13533          this.referralTarget = new ServiceRequest(); // aa
13534      return this.referralTarget;
13535    }
13536
13537    /**
13538     * @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.)
13539     */
13540    public ExplanationOfBenefit setReferralTarget(ServiceRequest value) { 
13541      this.referralTarget = value;
13542      return this;
13543    }
13544
13545    /**
13546     * @return {@link #facility} (Facility where the services were provided.)
13547     */
13548    public Reference getFacility() { 
13549      if (this.facility == null)
13550        if (Configuration.errorOnAutoCreate())
13551          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
13552        else if (Configuration.doAutoCreate())
13553          this.facility = new Reference(); // cc
13554      return this.facility;
13555    }
13556
13557    public boolean hasFacility() { 
13558      return this.facility != null && !this.facility.isEmpty();
13559    }
13560
13561    /**
13562     * @param value {@link #facility} (Facility where the services were provided.)
13563     */
13564    public ExplanationOfBenefit setFacility(Reference value) { 
13565      this.facility = value;
13566      return this;
13567    }
13568
13569    /**
13570     * @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.)
13571     */
13572    public Location getFacilityTarget() { 
13573      if (this.facilityTarget == null)
13574        if (Configuration.errorOnAutoCreate())
13575          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
13576        else if (Configuration.doAutoCreate())
13577          this.facilityTarget = new Location(); // aa
13578      return this.facilityTarget;
13579    }
13580
13581    /**
13582     * @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.)
13583     */
13584    public ExplanationOfBenefit setFacilityTarget(Location value) { 
13585      this.facilityTarget = value;
13586      return this;
13587    }
13588
13589    /**
13590     * @return {@link #claim} (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
13591     */
13592    public Reference getClaim() { 
13593      if (this.claim == null)
13594        if (Configuration.errorOnAutoCreate())
13595          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
13596        else if (Configuration.doAutoCreate())
13597          this.claim = new Reference(); // cc
13598      return this.claim;
13599    }
13600
13601    public boolean hasClaim() { 
13602      return this.claim != null && !this.claim.isEmpty();
13603    }
13604
13605    /**
13606     * @param value {@link #claim} (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
13607     */
13608    public ExplanationOfBenefit setClaim(Reference value) { 
13609      this.claim = value;
13610      return this;
13611    }
13612
13613    /**
13614     * @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.)
13615     */
13616    public Claim getClaimTarget() { 
13617      if (this.claimTarget == null)
13618        if (Configuration.errorOnAutoCreate())
13619          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
13620        else if (Configuration.doAutoCreate())
13621          this.claimTarget = new Claim(); // aa
13622      return this.claimTarget;
13623    }
13624
13625    /**
13626     * @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.)
13627     */
13628    public ExplanationOfBenefit setClaimTarget(Claim value) { 
13629      this.claimTarget = value;
13630      return this;
13631    }
13632
13633    /**
13634     * @return {@link #claimResponse} (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
13635     */
13636    public Reference getClaimResponse() { 
13637      if (this.claimResponse == null)
13638        if (Configuration.errorOnAutoCreate())
13639          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
13640        else if (Configuration.doAutoCreate())
13641          this.claimResponse = new Reference(); // cc
13642      return this.claimResponse;
13643    }
13644
13645    public boolean hasClaimResponse() { 
13646      return this.claimResponse != null && !this.claimResponse.isEmpty();
13647    }
13648
13649    /**
13650     * @param value {@link #claimResponse} (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
13651     */
13652    public ExplanationOfBenefit setClaimResponse(Reference value) { 
13653      this.claimResponse = value;
13654      return this;
13655    }
13656
13657    /**
13658     * @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.)
13659     */
13660    public ClaimResponse getClaimResponseTarget() { 
13661      if (this.claimResponseTarget == null)
13662        if (Configuration.errorOnAutoCreate())
13663          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
13664        else if (Configuration.doAutoCreate())
13665          this.claimResponseTarget = new ClaimResponse(); // aa
13666      return this.claimResponseTarget;
13667    }
13668
13669    /**
13670     * @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.)
13671     */
13672    public ExplanationOfBenefit setClaimResponseTarget(ClaimResponse value) { 
13673      this.claimResponseTarget = value;
13674      return this;
13675    }
13676
13677    /**
13678     * @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
13679     */
13680    public Enumeration<RemittanceOutcome> getOutcomeElement() { 
13681      if (this.outcome == null)
13682        if (Configuration.errorOnAutoCreate())
13683          throw new Error("Attempt to auto-create ExplanationOfBenefit.outcome");
13684        else if (Configuration.doAutoCreate())
13685          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory()); // bb
13686      return this.outcome;
13687    }
13688
13689    public boolean hasOutcomeElement() { 
13690      return this.outcome != null && !this.outcome.isEmpty();
13691    }
13692
13693    public boolean hasOutcome() { 
13694      return this.outcome != null && !this.outcome.isEmpty();
13695    }
13696
13697    /**
13698     * @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
13699     */
13700    public ExplanationOfBenefit setOutcomeElement(Enumeration<RemittanceOutcome> value) { 
13701      this.outcome = value;
13702      return this;
13703    }
13704
13705    /**
13706     * @return The outcome of the claim, predetermination, or preauthorization processing.
13707     */
13708    public RemittanceOutcome getOutcome() { 
13709      return this.outcome == null ? null : this.outcome.getValue();
13710    }
13711
13712    /**
13713     * @param value The outcome of the claim, predetermination, or preauthorization processing.
13714     */
13715    public ExplanationOfBenefit setOutcome(RemittanceOutcome value) { 
13716        if (this.outcome == null)
13717          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory());
13718        this.outcome.setValue(value);
13719      return this;
13720    }
13721
13722    /**
13723     * @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
13724     */
13725    public StringType getDispositionElement() { 
13726      if (this.disposition == null)
13727        if (Configuration.errorOnAutoCreate())
13728          throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
13729        else if (Configuration.doAutoCreate())
13730          this.disposition = new StringType(); // bb
13731      return this.disposition;
13732    }
13733
13734    public boolean hasDispositionElement() { 
13735      return this.disposition != null && !this.disposition.isEmpty();
13736    }
13737
13738    public boolean hasDisposition() { 
13739      return this.disposition != null && !this.disposition.isEmpty();
13740    }
13741
13742    /**
13743     * @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
13744     */
13745    public ExplanationOfBenefit setDispositionElement(StringType value) { 
13746      this.disposition = value;
13747      return this;
13748    }
13749
13750    /**
13751     * @return A human readable description of the status of the adjudication.
13752     */
13753    public String getDisposition() { 
13754      return this.disposition == null ? null : this.disposition.getValue();
13755    }
13756
13757    /**
13758     * @param value A human readable description of the status of the adjudication.
13759     */
13760    public ExplanationOfBenefit setDisposition(String value) { 
13761      if (Utilities.noString(value))
13762        this.disposition = null;
13763      else {
13764        if (this.disposition == null)
13765          this.disposition = new StringType();
13766        this.disposition.setValue(value);
13767      }
13768      return this;
13769    }
13770
13771    /**
13772     * @return {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13773     */
13774    public List<StringType> getPreAuthRef() { 
13775      if (this.preAuthRef == null)
13776        this.preAuthRef = new ArrayList<StringType>();
13777      return this.preAuthRef;
13778    }
13779
13780    /**
13781     * @return Returns a reference to <code>this</code> for easy method chaining
13782     */
13783    public ExplanationOfBenefit setPreAuthRef(List<StringType> thePreAuthRef) { 
13784      this.preAuthRef = thePreAuthRef;
13785      return this;
13786    }
13787
13788    public boolean hasPreAuthRef() { 
13789      if (this.preAuthRef == null)
13790        return false;
13791      for (StringType item : this.preAuthRef)
13792        if (!item.isEmpty())
13793          return true;
13794      return false;
13795    }
13796
13797    /**
13798     * @return {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13799     */
13800    public StringType addPreAuthRefElement() {//2 
13801      StringType t = new StringType();
13802      if (this.preAuthRef == null)
13803        this.preAuthRef = new ArrayList<StringType>();
13804      this.preAuthRef.add(t);
13805      return t;
13806    }
13807
13808    /**
13809     * @param value {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13810     */
13811    public ExplanationOfBenefit addPreAuthRef(String value) { //1
13812      StringType t = new StringType();
13813      t.setValue(value);
13814      if (this.preAuthRef == null)
13815        this.preAuthRef = new ArrayList<StringType>();
13816      this.preAuthRef.add(t);
13817      return this;
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 boolean hasPreAuthRef(String value) { 
13824      if (this.preAuthRef == null)
13825        return false;
13826      for (StringType v : this.preAuthRef)
13827        if (v.getValue().equals(value)) // string
13828          return true;
13829      return false;
13830    }
13831
13832    /**
13833     * @return {@link #preAuthRefPeriod} (The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.)
13834     */
13835    public List<Period> getPreAuthRefPeriod() { 
13836      if (this.preAuthRefPeriod == null)
13837        this.preAuthRefPeriod = new ArrayList<Period>();
13838      return this.preAuthRefPeriod;
13839    }
13840
13841    /**
13842     * @return Returns a reference to <code>this</code> for easy method chaining
13843     */
13844    public ExplanationOfBenefit setPreAuthRefPeriod(List<Period> thePreAuthRefPeriod) { 
13845      this.preAuthRefPeriod = thePreAuthRefPeriod;
13846      return this;
13847    }
13848
13849    public boolean hasPreAuthRefPeriod() { 
13850      if (this.preAuthRefPeriod == null)
13851        return false;
13852      for (Period item : this.preAuthRefPeriod)
13853        if (!item.isEmpty())
13854          return true;
13855      return false;
13856    }
13857
13858    public Period addPreAuthRefPeriod() { //3
13859      Period t = new Period();
13860      if (this.preAuthRefPeriod == null)
13861        this.preAuthRefPeriod = new ArrayList<Period>();
13862      this.preAuthRefPeriod.add(t);
13863      return t;
13864    }
13865
13866    public ExplanationOfBenefit addPreAuthRefPeriod(Period t) { //3
13867      if (t == null)
13868        return this;
13869      if (this.preAuthRefPeriod == null)
13870        this.preAuthRefPeriod = new ArrayList<Period>();
13871      this.preAuthRefPeriod.add(t);
13872      return this;
13873    }
13874
13875    /**
13876     * @return The first repetition of repeating field {@link #preAuthRefPeriod}, creating it if it does not already exist
13877     */
13878    public Period getPreAuthRefPeriodFirstRep() { 
13879      if (getPreAuthRefPeriod().isEmpty()) {
13880        addPreAuthRefPeriod();
13881      }
13882      return getPreAuthRefPeriod().get(0);
13883    }
13884
13885    /**
13886     * @return {@link #careTeam} (The members of the team who provided the products and services.)
13887     */
13888    public List<CareTeamComponent> getCareTeam() { 
13889      if (this.careTeam == null)
13890        this.careTeam = new ArrayList<CareTeamComponent>();
13891      return this.careTeam;
13892    }
13893
13894    /**
13895     * @return Returns a reference to <code>this</code> for easy method chaining
13896     */
13897    public ExplanationOfBenefit setCareTeam(List<CareTeamComponent> theCareTeam) { 
13898      this.careTeam = theCareTeam;
13899      return this;
13900    }
13901
13902    public boolean hasCareTeam() { 
13903      if (this.careTeam == null)
13904        return false;
13905      for (CareTeamComponent item : this.careTeam)
13906        if (!item.isEmpty())
13907          return true;
13908      return false;
13909    }
13910
13911    public CareTeamComponent addCareTeam() { //3
13912      CareTeamComponent t = new CareTeamComponent();
13913      if (this.careTeam == null)
13914        this.careTeam = new ArrayList<CareTeamComponent>();
13915      this.careTeam.add(t);
13916      return t;
13917    }
13918
13919    public ExplanationOfBenefit addCareTeam(CareTeamComponent t) { //3
13920      if (t == null)
13921        return this;
13922      if (this.careTeam == null)
13923        this.careTeam = new ArrayList<CareTeamComponent>();
13924      this.careTeam.add(t);
13925      return this;
13926    }
13927
13928    /**
13929     * @return The first repetition of repeating field {@link #careTeam}, creating it if it does not already exist
13930     */
13931    public CareTeamComponent getCareTeamFirstRep() { 
13932      if (getCareTeam().isEmpty()) {
13933        addCareTeam();
13934      }
13935      return getCareTeam().get(0);
13936    }
13937
13938    /**
13939     * @return {@link #supportingInfo} (Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.)
13940     */
13941    public List<SupportingInformationComponent> getSupportingInfo() { 
13942      if (this.supportingInfo == null)
13943        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13944      return this.supportingInfo;
13945    }
13946
13947    /**
13948     * @return Returns a reference to <code>this</code> for easy method chaining
13949     */
13950    public ExplanationOfBenefit setSupportingInfo(List<SupportingInformationComponent> theSupportingInfo) { 
13951      this.supportingInfo = theSupportingInfo;
13952      return this;
13953    }
13954
13955    public boolean hasSupportingInfo() { 
13956      if (this.supportingInfo == null)
13957        return false;
13958      for (SupportingInformationComponent item : this.supportingInfo)
13959        if (!item.isEmpty())
13960          return true;
13961      return false;
13962    }
13963
13964    public SupportingInformationComponent addSupportingInfo() { //3
13965      SupportingInformationComponent t = new SupportingInformationComponent();
13966      if (this.supportingInfo == null)
13967        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13968      this.supportingInfo.add(t);
13969      return t;
13970    }
13971
13972    public ExplanationOfBenefit addSupportingInfo(SupportingInformationComponent t) { //3
13973      if (t == null)
13974        return this;
13975      if (this.supportingInfo == null)
13976        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13977      this.supportingInfo.add(t);
13978      return this;
13979    }
13980
13981    /**
13982     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist
13983     */
13984    public SupportingInformationComponent getSupportingInfoFirstRep() { 
13985      if (getSupportingInfo().isEmpty()) {
13986        addSupportingInfo();
13987      }
13988      return getSupportingInfo().get(0);
13989    }
13990
13991    /**
13992     * @return {@link #diagnosis} (Information about diagnoses relevant to the claim items.)
13993     */
13994    public List<DiagnosisComponent> getDiagnosis() { 
13995      if (this.diagnosis == null)
13996        this.diagnosis = new ArrayList<DiagnosisComponent>();
13997      return this.diagnosis;
13998    }
13999
14000    /**
14001     * @return Returns a reference to <code>this</code> for easy method chaining
14002     */
14003    public ExplanationOfBenefit setDiagnosis(List<DiagnosisComponent> theDiagnosis) { 
14004      this.diagnosis = theDiagnosis;
14005      return this;
14006    }
14007
14008    public boolean hasDiagnosis() { 
14009      if (this.diagnosis == null)
14010        return false;
14011      for (DiagnosisComponent item : this.diagnosis)
14012        if (!item.isEmpty())
14013          return true;
14014      return false;
14015    }
14016
14017    public DiagnosisComponent addDiagnosis() { //3
14018      DiagnosisComponent t = new DiagnosisComponent();
14019      if (this.diagnosis == null)
14020        this.diagnosis = new ArrayList<DiagnosisComponent>();
14021      this.diagnosis.add(t);
14022      return t;
14023    }
14024
14025    public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { //3
14026      if (t == null)
14027        return this;
14028      if (this.diagnosis == null)
14029        this.diagnosis = new ArrayList<DiagnosisComponent>();
14030      this.diagnosis.add(t);
14031      return this;
14032    }
14033
14034    /**
14035     * @return The first repetition of repeating field {@link #diagnosis}, creating it if it does not already exist
14036     */
14037    public DiagnosisComponent getDiagnosisFirstRep() { 
14038      if (getDiagnosis().isEmpty()) {
14039        addDiagnosis();
14040      }
14041      return getDiagnosis().get(0);
14042    }
14043
14044    /**
14045     * @return {@link #procedure} (Procedures performed on the patient relevant to the billing items with the claim.)
14046     */
14047    public List<ProcedureComponent> getProcedure() { 
14048      if (this.procedure == null)
14049        this.procedure = new ArrayList<ProcedureComponent>();
14050      return this.procedure;
14051    }
14052
14053    /**
14054     * @return Returns a reference to <code>this</code> for easy method chaining
14055     */
14056    public ExplanationOfBenefit setProcedure(List<ProcedureComponent> theProcedure) { 
14057      this.procedure = theProcedure;
14058      return this;
14059    }
14060
14061    public boolean hasProcedure() { 
14062      if (this.procedure == null)
14063        return false;
14064      for (ProcedureComponent item : this.procedure)
14065        if (!item.isEmpty())
14066          return true;
14067      return false;
14068    }
14069
14070    public ProcedureComponent addProcedure() { //3
14071      ProcedureComponent t = new ProcedureComponent();
14072      if (this.procedure == null)
14073        this.procedure = new ArrayList<ProcedureComponent>();
14074      this.procedure.add(t);
14075      return t;
14076    }
14077
14078    public ExplanationOfBenefit addProcedure(ProcedureComponent t) { //3
14079      if (t == null)
14080        return this;
14081      if (this.procedure == null)
14082        this.procedure = new ArrayList<ProcedureComponent>();
14083      this.procedure.add(t);
14084      return this;
14085    }
14086
14087    /**
14088     * @return The first repetition of repeating field {@link #procedure}, creating it if it does not already exist
14089     */
14090    public ProcedureComponent getProcedureFirstRep() { 
14091      if (getProcedure().isEmpty()) {
14092        addProcedure();
14093      }
14094      return getProcedure().get(0);
14095    }
14096
14097    /**
14098     * @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
14099     */
14100    public PositiveIntType getPrecedenceElement() { 
14101      if (this.precedence == null)
14102        if (Configuration.errorOnAutoCreate())
14103          throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
14104        else if (Configuration.doAutoCreate())
14105          this.precedence = new PositiveIntType(); // bb
14106      return this.precedence;
14107    }
14108
14109    public boolean hasPrecedenceElement() { 
14110      return this.precedence != null && !this.precedence.isEmpty();
14111    }
14112
14113    public boolean hasPrecedence() { 
14114      return this.precedence != null && !this.precedence.isEmpty();
14115    }
14116
14117    /**
14118     * @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
14119     */
14120    public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) { 
14121      this.precedence = value;
14122      return this;
14123    }
14124
14125    /**
14126     * @return This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
14127     */
14128    public int getPrecedence() { 
14129      return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
14130    }
14131
14132    /**
14133     * @param value This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
14134     */
14135    public ExplanationOfBenefit setPrecedence(int value) { 
14136        if (this.precedence == null)
14137          this.precedence = new PositiveIntType();
14138        this.precedence.setValue(value);
14139      return this;
14140    }
14141
14142    /**
14143     * @return {@link #insurance} (Financial instruments for reimbursement for the health care products and services specified on the claim.)
14144     */
14145    public List<InsuranceComponent> getInsurance() { 
14146      if (this.insurance == null)
14147        this.insurance = new ArrayList<InsuranceComponent>();
14148      return this.insurance;
14149    }
14150
14151    /**
14152     * @return Returns a reference to <code>this</code> for easy method chaining
14153     */
14154    public ExplanationOfBenefit setInsurance(List<InsuranceComponent> theInsurance) { 
14155      this.insurance = theInsurance;
14156      return this;
14157    }
14158
14159    public boolean hasInsurance() { 
14160      if (this.insurance == null)
14161        return false;
14162      for (InsuranceComponent item : this.insurance)
14163        if (!item.isEmpty())
14164          return true;
14165      return false;
14166    }
14167
14168    public InsuranceComponent addInsurance() { //3
14169      InsuranceComponent t = new InsuranceComponent();
14170      if (this.insurance == null)
14171        this.insurance = new ArrayList<InsuranceComponent>();
14172      this.insurance.add(t);
14173      return t;
14174    }
14175
14176    public ExplanationOfBenefit addInsurance(InsuranceComponent t) { //3
14177      if (t == null)
14178        return this;
14179      if (this.insurance == null)
14180        this.insurance = new ArrayList<InsuranceComponent>();
14181      this.insurance.add(t);
14182      return this;
14183    }
14184
14185    /**
14186     * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist
14187     */
14188    public InsuranceComponent getInsuranceFirstRep() { 
14189      if (getInsurance().isEmpty()) {
14190        addInsurance();
14191      }
14192      return getInsurance().get(0);
14193    }
14194
14195    /**
14196     * @return {@link #accident} (Details of a accident which resulted in injuries which required the products and services listed in the claim.)
14197     */
14198    public AccidentComponent getAccident() { 
14199      if (this.accident == null)
14200        if (Configuration.errorOnAutoCreate())
14201          throw new Error("Attempt to auto-create ExplanationOfBenefit.accident");
14202        else if (Configuration.doAutoCreate())
14203          this.accident = new AccidentComponent(); // cc
14204      return this.accident;
14205    }
14206
14207    public boolean hasAccident() { 
14208      return this.accident != null && !this.accident.isEmpty();
14209    }
14210
14211    /**
14212     * @param value {@link #accident} (Details of a accident which resulted in injuries which required the products and services listed in the claim.)
14213     */
14214    public ExplanationOfBenefit setAccident(AccidentComponent value) { 
14215      this.accident = value;
14216      return this;
14217    }
14218
14219    /**
14220     * @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.)
14221     */
14222    public List<ItemComponent> getItem() { 
14223      if (this.item == null)
14224        this.item = new ArrayList<ItemComponent>();
14225      return this.item;
14226    }
14227
14228    /**
14229     * @return Returns a reference to <code>this</code> for easy method chaining
14230     */
14231    public ExplanationOfBenefit setItem(List<ItemComponent> theItem) { 
14232      this.item = theItem;
14233      return this;
14234    }
14235
14236    public boolean hasItem() { 
14237      if (this.item == null)
14238        return false;
14239      for (ItemComponent item : this.item)
14240        if (!item.isEmpty())
14241          return true;
14242      return false;
14243    }
14244
14245    public ItemComponent addItem() { //3
14246      ItemComponent t = new ItemComponent();
14247      if (this.item == null)
14248        this.item = new ArrayList<ItemComponent>();
14249      this.item.add(t);
14250      return t;
14251    }
14252
14253    public ExplanationOfBenefit addItem(ItemComponent t) { //3
14254      if (t == null)
14255        return this;
14256      if (this.item == null)
14257        this.item = new ArrayList<ItemComponent>();
14258      this.item.add(t);
14259      return this;
14260    }
14261
14262    /**
14263     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
14264     */
14265    public ItemComponent getItemFirstRep() { 
14266      if (getItem().isEmpty()) {
14267        addItem();
14268      }
14269      return getItem().get(0);
14270    }
14271
14272    /**
14273     * @return {@link #addItem} (The first-tier service adjudications for payor added product or service lines.)
14274     */
14275    public List<AddedItemComponent> getAddItem() { 
14276      if (this.addItem == null)
14277        this.addItem = new ArrayList<AddedItemComponent>();
14278      return this.addItem;
14279    }
14280
14281    /**
14282     * @return Returns a reference to <code>this</code> for easy method chaining
14283     */
14284    public ExplanationOfBenefit setAddItem(List<AddedItemComponent> theAddItem) { 
14285      this.addItem = theAddItem;
14286      return this;
14287    }
14288
14289    public boolean hasAddItem() { 
14290      if (this.addItem == null)
14291        return false;
14292      for (AddedItemComponent item : this.addItem)
14293        if (!item.isEmpty())
14294          return true;
14295      return false;
14296    }
14297
14298    public AddedItemComponent addAddItem() { //3
14299      AddedItemComponent t = new AddedItemComponent();
14300      if (this.addItem == null)
14301        this.addItem = new ArrayList<AddedItemComponent>();
14302      this.addItem.add(t);
14303      return t;
14304    }
14305
14306    public ExplanationOfBenefit addAddItem(AddedItemComponent t) { //3
14307      if (t == null)
14308        return this;
14309      if (this.addItem == null)
14310        this.addItem = new ArrayList<AddedItemComponent>();
14311      this.addItem.add(t);
14312      return this;
14313    }
14314
14315    /**
14316     * @return The first repetition of repeating field {@link #addItem}, creating it if it does not already exist
14317     */
14318    public AddedItemComponent getAddItemFirstRep() { 
14319      if (getAddItem().isEmpty()) {
14320        addAddItem();
14321      }
14322      return getAddItem().get(0);
14323    }
14324
14325    /**
14326     * @return {@link #adjudication} (The adjudication results which are presented at the header level rather than at the line-item or add-item levels.)
14327     */
14328    public List<AdjudicationComponent> getAdjudication() { 
14329      if (this.adjudication == null)
14330        this.adjudication = new ArrayList<AdjudicationComponent>();
14331      return this.adjudication;
14332    }
14333
14334    /**
14335     * @return Returns a reference to <code>this</code> for easy method chaining
14336     */
14337    public ExplanationOfBenefit setAdjudication(List<AdjudicationComponent> theAdjudication) { 
14338      this.adjudication = theAdjudication;
14339      return this;
14340    }
14341
14342    public boolean hasAdjudication() { 
14343      if (this.adjudication == null)
14344        return false;
14345      for (AdjudicationComponent item : this.adjudication)
14346        if (!item.isEmpty())
14347          return true;
14348      return false;
14349    }
14350
14351    public AdjudicationComponent addAdjudication() { //3
14352      AdjudicationComponent t = new AdjudicationComponent();
14353      if (this.adjudication == null)
14354        this.adjudication = new ArrayList<AdjudicationComponent>();
14355      this.adjudication.add(t);
14356      return t;
14357    }
14358
14359    public ExplanationOfBenefit addAdjudication(AdjudicationComponent t) { //3
14360      if (t == null)
14361        return this;
14362      if (this.adjudication == null)
14363        this.adjudication = new ArrayList<AdjudicationComponent>();
14364      this.adjudication.add(t);
14365      return this;
14366    }
14367
14368    /**
14369     * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
14370     */
14371    public AdjudicationComponent getAdjudicationFirstRep() { 
14372      if (getAdjudication().isEmpty()) {
14373        addAdjudication();
14374      }
14375      return getAdjudication().get(0);
14376    }
14377
14378    /**
14379     * @return {@link #total} (Categorized monetary totals for the adjudication.)
14380     */
14381    public List<TotalComponent> getTotal() { 
14382      if (this.total == null)
14383        this.total = new ArrayList<TotalComponent>();
14384      return this.total;
14385    }
14386
14387    /**
14388     * @return Returns a reference to <code>this</code> for easy method chaining
14389     */
14390    public ExplanationOfBenefit setTotal(List<TotalComponent> theTotal) { 
14391      this.total = theTotal;
14392      return this;
14393    }
14394
14395    public boolean hasTotal() { 
14396      if (this.total == null)
14397        return false;
14398      for (TotalComponent item : this.total)
14399        if (!item.isEmpty())
14400          return true;
14401      return false;
14402    }
14403
14404    public TotalComponent addTotal() { //3
14405      TotalComponent t = new TotalComponent();
14406      if (this.total == null)
14407        this.total = new ArrayList<TotalComponent>();
14408      this.total.add(t);
14409      return t;
14410    }
14411
14412    public ExplanationOfBenefit addTotal(TotalComponent t) { //3
14413      if (t == null)
14414        return this;
14415      if (this.total == null)
14416        this.total = new ArrayList<TotalComponent>();
14417      this.total.add(t);
14418      return this;
14419    }
14420
14421    /**
14422     * @return The first repetition of repeating field {@link #total}, creating it if it does not already exist
14423     */
14424    public TotalComponent getTotalFirstRep() { 
14425      if (getTotal().isEmpty()) {
14426        addTotal();
14427      }
14428      return getTotal().get(0);
14429    }
14430
14431    /**
14432     * @return {@link #payment} (Payment details for the adjudication of the claim.)
14433     */
14434    public PaymentComponent getPayment() { 
14435      if (this.payment == null)
14436        if (Configuration.errorOnAutoCreate())
14437          throw new Error("Attempt to auto-create ExplanationOfBenefit.payment");
14438        else if (Configuration.doAutoCreate())
14439          this.payment = new PaymentComponent(); // cc
14440      return this.payment;
14441    }
14442
14443    public boolean hasPayment() { 
14444      return this.payment != null && !this.payment.isEmpty();
14445    }
14446
14447    /**
14448     * @param value {@link #payment} (Payment details for the adjudication of the claim.)
14449     */
14450    public ExplanationOfBenefit setPayment(PaymentComponent value) { 
14451      this.payment = value;
14452      return this;
14453    }
14454
14455    /**
14456     * @return {@link #formCode} (A code for the form to be used for printing the content.)
14457     */
14458    public CodeableConcept getFormCode() { 
14459      if (this.formCode == null)
14460        if (Configuration.errorOnAutoCreate())
14461          throw new Error("Attempt to auto-create ExplanationOfBenefit.formCode");
14462        else if (Configuration.doAutoCreate())
14463          this.formCode = new CodeableConcept(); // cc
14464      return this.formCode;
14465    }
14466
14467    public boolean hasFormCode() { 
14468      return this.formCode != null && !this.formCode.isEmpty();
14469    }
14470
14471    /**
14472     * @param value {@link #formCode} (A code for the form to be used for printing the content.)
14473     */
14474    public ExplanationOfBenefit setFormCode(CodeableConcept value) { 
14475      this.formCode = value;
14476      return this;
14477    }
14478
14479    /**
14480     * @return {@link #form} (The actual form, by reference or inclusion, for printing the content or an EOB.)
14481     */
14482    public Attachment getForm() { 
14483      if (this.form == null)
14484        if (Configuration.errorOnAutoCreate())
14485          throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
14486        else if (Configuration.doAutoCreate())
14487          this.form = new Attachment(); // cc
14488      return this.form;
14489    }
14490
14491    public boolean hasForm() { 
14492      return this.form != null && !this.form.isEmpty();
14493    }
14494
14495    /**
14496     * @param value {@link #form} (The actual form, by reference or inclusion, for printing the content or an EOB.)
14497     */
14498    public ExplanationOfBenefit setForm(Attachment value) { 
14499      this.form = value;
14500      return this;
14501    }
14502
14503    /**
14504     * @return {@link #processNote} (A note that describes or explains adjudication results in a human readable form.)
14505     */
14506    public List<NoteComponent> getProcessNote() { 
14507      if (this.processNote == null)
14508        this.processNote = new ArrayList<NoteComponent>();
14509      return this.processNote;
14510    }
14511
14512    /**
14513     * @return Returns a reference to <code>this</code> for easy method chaining
14514     */
14515    public ExplanationOfBenefit setProcessNote(List<NoteComponent> theProcessNote) { 
14516      this.processNote = theProcessNote;
14517      return this;
14518    }
14519
14520    public boolean hasProcessNote() { 
14521      if (this.processNote == null)
14522        return false;
14523      for (NoteComponent item : this.processNote)
14524        if (!item.isEmpty())
14525          return true;
14526      return false;
14527    }
14528
14529    public NoteComponent addProcessNote() { //3
14530      NoteComponent t = new NoteComponent();
14531      if (this.processNote == null)
14532        this.processNote = new ArrayList<NoteComponent>();
14533      this.processNote.add(t);
14534      return t;
14535    }
14536
14537    public ExplanationOfBenefit addProcessNote(NoteComponent t) { //3
14538      if (t == null)
14539        return this;
14540      if (this.processNote == null)
14541        this.processNote = new ArrayList<NoteComponent>();
14542      this.processNote.add(t);
14543      return this;
14544    }
14545
14546    /**
14547     * @return The first repetition of repeating field {@link #processNote}, creating it if it does not already exist
14548     */
14549    public NoteComponent getProcessNoteFirstRep() { 
14550      if (getProcessNote().isEmpty()) {
14551        addProcessNote();
14552      }
14553      return getProcessNote().get(0);
14554    }
14555
14556    /**
14557     * @return {@link #benefitPeriod} (The term of the benefits documented in this response.)
14558     */
14559    public Period getBenefitPeriod() { 
14560      if (this.benefitPeriod == null)
14561        if (Configuration.errorOnAutoCreate())
14562          throw new Error("Attempt to auto-create ExplanationOfBenefit.benefitPeriod");
14563        else if (Configuration.doAutoCreate())
14564          this.benefitPeriod = new Period(); // cc
14565      return this.benefitPeriod;
14566    }
14567
14568    public boolean hasBenefitPeriod() { 
14569      return this.benefitPeriod != null && !this.benefitPeriod.isEmpty();
14570    }
14571
14572    /**
14573     * @param value {@link #benefitPeriod} (The term of the benefits documented in this response.)
14574     */
14575    public ExplanationOfBenefit setBenefitPeriod(Period value) { 
14576      this.benefitPeriod = value;
14577      return this;
14578    }
14579
14580    /**
14581     * @return {@link #benefitBalance} (Balance by Benefit Category.)
14582     */
14583    public List<BenefitBalanceComponent> getBenefitBalance() { 
14584      if (this.benefitBalance == null)
14585        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14586      return this.benefitBalance;
14587    }
14588
14589    /**
14590     * @return Returns a reference to <code>this</code> for easy method chaining
14591     */
14592    public ExplanationOfBenefit setBenefitBalance(List<BenefitBalanceComponent> theBenefitBalance) { 
14593      this.benefitBalance = theBenefitBalance;
14594      return this;
14595    }
14596
14597    public boolean hasBenefitBalance() { 
14598      if (this.benefitBalance == null)
14599        return false;
14600      for (BenefitBalanceComponent item : this.benefitBalance)
14601        if (!item.isEmpty())
14602          return true;
14603      return false;
14604    }
14605
14606    public BenefitBalanceComponent addBenefitBalance() { //3
14607      BenefitBalanceComponent t = new BenefitBalanceComponent();
14608      if (this.benefitBalance == null)
14609        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14610      this.benefitBalance.add(t);
14611      return t;
14612    }
14613
14614    public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { //3
14615      if (t == null)
14616        return this;
14617      if (this.benefitBalance == null)
14618        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14619      this.benefitBalance.add(t);
14620      return this;
14621    }
14622
14623    /**
14624     * @return The first repetition of repeating field {@link #benefitBalance}, creating it if it does not already exist
14625     */
14626    public BenefitBalanceComponent getBenefitBalanceFirstRep() { 
14627      if (getBenefitBalance().isEmpty()) {
14628        addBenefitBalance();
14629      }
14630      return getBenefitBalance().get(0);
14631    }
14632
14633      protected void listChildren(List<Property> children) {
14634        super.listChildren(children);
14635        children.add(new Property("identifier", "Identifier", "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier));
14636        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
14637        children.add(new Property("type", "CodeableConcept", "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type));
14638        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));
14639        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));
14640        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));
14641        children.add(new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1, billablePeriod));
14642        children.add(new Property("created", "dateTime", "The date this resource was created.", 0, 1, created));
14643        children.add(new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer));
14644        children.add(new Property("insurer", "Reference(Organization)", "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer));
14645        children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider));
14646        children.add(new Property("priority", "CodeableConcept", "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.", 0, 1, priority));
14647        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));
14648        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));
14649        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));
14650        children.add(new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription));
14651        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));
14652        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));
14653        children.add(new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral));
14654        children.add(new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility));
14655        children.add(new Property("claim", "Reference(Claim)", "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.", 0, 1, claim));
14656        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));
14657        children.add(new Property("outcome", "code", "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome));
14658        children.add(new Property("disposition", "string", "A human readable description of the status of the adjudication.", 0, 1, disposition));
14659        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));
14660        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));
14661        children.add(new Property("careTeam", "", "The members of the team who provided the products and services.", 0, java.lang.Integer.MAX_VALUE, careTeam));
14662        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));
14663        children.add(new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
14664        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));
14665        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));
14666        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));
14667        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));
14668        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));
14669        children.add(new Property("addItem", "", "The first-tier service adjudications for payor added product or service lines.", 0, java.lang.Integer.MAX_VALUE, addItem));
14670        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));
14671        children.add(new Property("total", "", "Categorized monetary totals for the adjudication.", 0, java.lang.Integer.MAX_VALUE, total));
14672        children.add(new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment));
14673        children.add(new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.", 0, 1, formCode));
14674        children.add(new Property("form", "Attachment", "The actual form, by reference or inclusion, for printing the content or an EOB.", 0, 1, form));
14675        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));
14676        children.add(new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1, benefitPeriod));
14677        children.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance));
14678      }
14679
14680      @Override
14681      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
14682        switch (_hash) {
14683        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier);
14684        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
14685        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type);
14686        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);
14687        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);
14688        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);
14689        case -332066046: /*billablePeriod*/  return new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1, billablePeriod);
14690        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date this resource was created.", 0, 1, created);
14691        case -1591951995: /*enterer*/  return new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer);
14692        case 1957615864: /*insurer*/  return new Property("insurer", "Reference(Organization)", "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer);
14693        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);
14694        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);
14695        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);
14696        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);
14697        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);
14698        case 460301338: /*prescription*/  return new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription);
14699        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);
14700        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);
14701        case -722568291: /*referral*/  return new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral);
14702        case 501116579: /*facility*/  return new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility);
14703        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);
14704        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);
14705        case -1106507950: /*outcome*/  return new Property("outcome", "code", "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome);
14706        case 583380919: /*disposition*/  return new Property("disposition", "string", "A human readable description of the status of the adjudication.", 0, 1, disposition);
14707        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);
14708        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);
14709        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);
14710        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);
14711        case 1196993265: /*diagnosis*/  return new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0, java.lang.Integer.MAX_VALUE, diagnosis);
14712        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);
14713        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);
14714        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);
14715        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);
14716        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);
14717        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);
14718        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);
14719        case 110549828: /*total*/  return new Property("total", "", "Categorized monetary totals for the adjudication.", 0, java.lang.Integer.MAX_VALUE, total);
14720        case -786681338: /*payment*/  return new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment);
14721        case 473181393: /*formCode*/  return new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.", 0, 1, formCode);
14722        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);
14723        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);
14724        case -407369416: /*benefitPeriod*/  return new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1, benefitPeriod);
14725        case 596003397: /*benefitBalance*/  return new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance);
14726        default: return super.getNamedProperty(_hash, _name, _checkValid);
14727        }
14728
14729      }
14730
14731      @Override
14732      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
14733        switch (hash) {
14734        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
14735        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ExplanationOfBenefitStatus>
14736        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
14737        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
14738        case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<Use>
14739        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
14740        case -332066046: /*billablePeriod*/ return this.billablePeriod == null ? new Base[0] : new Base[] {this.billablePeriod}; // Period
14741        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
14742        case -1591951995: /*enterer*/ return this.enterer == null ? new Base[0] : new Base[] {this.enterer}; // Reference
14743        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
14744        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
14745        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
14746        case -1688904576: /*fundsReserveRequested*/ return this.fundsReserveRequested == null ? new Base[0] : new Base[] {this.fundsReserveRequested}; // CodeableConcept
14747        case 1314609806: /*fundsReserve*/ return this.fundsReserve == null ? new Base[0] : new Base[] {this.fundsReserve}; // CodeableConcept
14748        case 1090493483: /*related*/ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimComponent
14749        case 460301338: /*prescription*/ return this.prescription == null ? new Base[0] : new Base[] {this.prescription}; // Reference
14750        case -1814015861: /*originalPrescription*/ return this.originalPrescription == null ? new Base[0] : new Base[] {this.originalPrescription}; // Reference
14751        case 106443592: /*payee*/ return this.payee == null ? new Base[0] : new Base[] {this.payee}; // PayeeComponent
14752        case -722568291: /*referral*/ return this.referral == null ? new Base[0] : new Base[] {this.referral}; // Reference
14753        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Reference
14754        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
14755        case 689513629: /*claimResponse*/ return this.claimResponse == null ? new Base[0] : new Base[] {this.claimResponse}; // Reference
14756        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // Enumeration<RemittanceOutcome>
14757        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
14758        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
14759        case -1262920311: /*preAuthRefPeriod*/ return this.preAuthRefPeriod == null ? new Base[0] : this.preAuthRefPeriod.toArray(new Base[this.preAuthRefPeriod.size()]); // Period
14760        case -7323378: /*careTeam*/ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // CareTeamComponent
14761        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // SupportingInformationComponent
14762        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
14763        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
14764        case 159695370: /*precedence*/ return this.precedence == null ? new Base[0] : new Base[] {this.precedence}; // PositiveIntType
14765        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // InsuranceComponent
14766        case -2143202801: /*accident*/ return this.accident == null ? new Base[0] : new Base[] {this.accident}; // AccidentComponent
14767        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
14768        case -1148899500: /*addItem*/ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
14769        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
14770        case 110549828: /*total*/ return this.total == null ? new Base[0] : this.total.toArray(new Base[this.total.size()]); // TotalComponent
14771        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // PaymentComponent
14772        case 473181393: /*formCode*/ return this.formCode == null ? new Base[0] : new Base[] {this.formCode}; // CodeableConcept
14773        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // Attachment
14774        case 202339073: /*processNote*/ return this.processNote == null ? new Base[0] : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
14775        case -407369416: /*benefitPeriod*/ return this.benefitPeriod == null ? new Base[0] : new Base[] {this.benefitPeriod}; // Period
14776        case 596003397: /*benefitBalance*/ return this.benefitBalance == null ? new Base[0] : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
14777        default: return super.getProperty(hash, name, checkValid);
14778        }
14779
14780      }
14781
14782      @Override
14783      public Base setProperty(int hash, String name, Base value) throws FHIRException {
14784        switch (hash) {
14785        case -1618432855: // identifier
14786          this.getIdentifier().add(castToIdentifier(value)); // Identifier
14787          return value;
14788        case -892481550: // status
14789          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
14790          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
14791          return value;
14792        case 3575610: // type
14793          this.type = castToCodeableConcept(value); // CodeableConcept
14794          return value;
14795        case -1868521062: // subType
14796          this.subType = castToCodeableConcept(value); // CodeableConcept
14797          return value;
14798        case 116103: // use
14799          value = new UseEnumFactory().fromType(castToCode(value));
14800          this.use = (Enumeration) value; // Enumeration<Use>
14801          return value;
14802        case -791418107: // patient
14803          this.patient = castToReference(value); // Reference
14804          return value;
14805        case -332066046: // billablePeriod
14806          this.billablePeriod = castToPeriod(value); // Period
14807          return value;
14808        case 1028554472: // created
14809          this.created = castToDateTime(value); // DateTimeType
14810          return value;
14811        case -1591951995: // enterer
14812          this.enterer = castToReference(value); // Reference
14813          return value;
14814        case 1957615864: // insurer
14815          this.insurer = castToReference(value); // Reference
14816          return value;
14817        case -987494927: // provider
14818          this.provider = castToReference(value); // Reference
14819          return value;
14820        case -1165461084: // priority
14821          this.priority = castToCodeableConcept(value); // CodeableConcept
14822          return value;
14823        case -1688904576: // fundsReserveRequested
14824          this.fundsReserveRequested = castToCodeableConcept(value); // CodeableConcept
14825          return value;
14826        case 1314609806: // fundsReserve
14827          this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
14828          return value;
14829        case 1090493483: // related
14830          this.getRelated().add((RelatedClaimComponent) value); // RelatedClaimComponent
14831          return value;
14832        case 460301338: // prescription
14833          this.prescription = castToReference(value); // Reference
14834          return value;
14835        case -1814015861: // originalPrescription
14836          this.originalPrescription = castToReference(value); // Reference
14837          return value;
14838        case 106443592: // payee
14839          this.payee = (PayeeComponent) value; // PayeeComponent
14840          return value;
14841        case -722568291: // referral
14842          this.referral = castToReference(value); // Reference
14843          return value;
14844        case 501116579: // facility
14845          this.facility = castToReference(value); // Reference
14846          return value;
14847        case 94742588: // claim
14848          this.claim = castToReference(value); // Reference
14849          return value;
14850        case 689513629: // claimResponse
14851          this.claimResponse = castToReference(value); // Reference
14852          return value;
14853        case -1106507950: // outcome
14854          value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
14855          this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
14856          return value;
14857        case 583380919: // disposition
14858          this.disposition = castToString(value); // StringType
14859          return value;
14860        case 522246568: // preAuthRef
14861          this.getPreAuthRef().add(castToString(value)); // StringType
14862          return value;
14863        case -1262920311: // preAuthRefPeriod
14864          this.getPreAuthRefPeriod().add(castToPeriod(value)); // Period
14865          return value;
14866        case -7323378: // careTeam
14867          this.getCareTeam().add((CareTeamComponent) value); // CareTeamComponent
14868          return value;
14869        case 1922406657: // supportingInfo
14870          this.getSupportingInfo().add((SupportingInformationComponent) value); // SupportingInformationComponent
14871          return value;
14872        case 1196993265: // diagnosis
14873          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
14874          return value;
14875        case -1095204141: // procedure
14876          this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
14877          return value;
14878        case 159695370: // precedence
14879          this.precedence = castToPositiveInt(value); // PositiveIntType
14880          return value;
14881        case 73049818: // insurance
14882          this.getInsurance().add((InsuranceComponent) value); // InsuranceComponent
14883          return value;
14884        case -2143202801: // accident
14885          this.accident = (AccidentComponent) value; // AccidentComponent
14886          return value;
14887        case 3242771: // item
14888          this.getItem().add((ItemComponent) value); // ItemComponent
14889          return value;
14890        case -1148899500: // addItem
14891          this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
14892          return value;
14893        case -231349275: // adjudication
14894          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
14895          return value;
14896        case 110549828: // total
14897          this.getTotal().add((TotalComponent) value); // TotalComponent
14898          return value;
14899        case -786681338: // payment
14900          this.payment = (PaymentComponent) value; // PaymentComponent
14901          return value;
14902        case 473181393: // formCode
14903          this.formCode = castToCodeableConcept(value); // CodeableConcept
14904          return value;
14905        case 3148996: // form
14906          this.form = castToAttachment(value); // Attachment
14907          return value;
14908        case 202339073: // processNote
14909          this.getProcessNote().add((NoteComponent) value); // NoteComponent
14910          return value;
14911        case -407369416: // benefitPeriod
14912          this.benefitPeriod = castToPeriod(value); // Period
14913          return value;
14914        case 596003397: // benefitBalance
14915          this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
14916          return value;
14917        default: return super.setProperty(hash, name, value);
14918        }
14919
14920      }
14921
14922      @Override
14923      public Base setProperty(String name, Base value) throws FHIRException {
14924        if (name.equals("identifier")) {
14925          this.getIdentifier().add(castToIdentifier(value));
14926        } else if (name.equals("status")) {
14927          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
14928          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
14929        } else if (name.equals("type")) {
14930          this.type = castToCodeableConcept(value); // CodeableConcept
14931        } else if (name.equals("subType")) {
14932          this.subType = castToCodeableConcept(value); // CodeableConcept
14933        } else if (name.equals("use")) {
14934          value = new UseEnumFactory().fromType(castToCode(value));
14935          this.use = (Enumeration) value; // Enumeration<Use>
14936        } else if (name.equals("patient")) {
14937          this.patient = castToReference(value); // Reference
14938        } else if (name.equals("billablePeriod")) {
14939          this.billablePeriod = castToPeriod(value); // Period
14940        } else if (name.equals("created")) {
14941          this.created = castToDateTime(value); // DateTimeType
14942        } else if (name.equals("enterer")) {
14943          this.enterer = castToReference(value); // Reference
14944        } else if (name.equals("insurer")) {
14945          this.insurer = castToReference(value); // Reference
14946        } else if (name.equals("provider")) {
14947          this.provider = castToReference(value); // Reference
14948        } else if (name.equals("priority")) {
14949          this.priority = castToCodeableConcept(value); // CodeableConcept
14950        } else if (name.equals("fundsReserveRequested")) {
14951          this.fundsReserveRequested = castToCodeableConcept(value); // CodeableConcept
14952        } else if (name.equals("fundsReserve")) {
14953          this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
14954        } else if (name.equals("related")) {
14955          this.getRelated().add((RelatedClaimComponent) value);
14956        } else if (name.equals("prescription")) {
14957          this.prescription = castToReference(value); // Reference
14958        } else if (name.equals("originalPrescription")) {
14959          this.originalPrescription = castToReference(value); // Reference
14960        } else if (name.equals("payee")) {
14961          this.payee = (PayeeComponent) value; // PayeeComponent
14962        } else if (name.equals("referral")) {
14963          this.referral = castToReference(value); // Reference
14964        } else if (name.equals("facility")) {
14965          this.facility = castToReference(value); // Reference
14966        } else if (name.equals("claim")) {
14967          this.claim = castToReference(value); // Reference
14968        } else if (name.equals("claimResponse")) {
14969          this.claimResponse = castToReference(value); // Reference
14970        } else if (name.equals("outcome")) {
14971          value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
14972          this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
14973        } else if (name.equals("disposition")) {
14974          this.disposition = castToString(value); // StringType
14975        } else if (name.equals("preAuthRef")) {
14976          this.getPreAuthRef().add(castToString(value));
14977        } else if (name.equals("preAuthRefPeriod")) {
14978          this.getPreAuthRefPeriod().add(castToPeriod(value));
14979        } else if (name.equals("careTeam")) {
14980          this.getCareTeam().add((CareTeamComponent) value);
14981        } else if (name.equals("supportingInfo")) {
14982          this.getSupportingInfo().add((SupportingInformationComponent) value);
14983        } else if (name.equals("diagnosis")) {
14984          this.getDiagnosis().add((DiagnosisComponent) value);
14985        } else if (name.equals("procedure")) {
14986          this.getProcedure().add((ProcedureComponent) value);
14987        } else if (name.equals("precedence")) {
14988          this.precedence = castToPositiveInt(value); // PositiveIntType
14989        } else if (name.equals("insurance")) {
14990          this.getInsurance().add((InsuranceComponent) value);
14991        } else if (name.equals("accident")) {
14992          this.accident = (AccidentComponent) value; // AccidentComponent
14993        } else if (name.equals("item")) {
14994          this.getItem().add((ItemComponent) value);
14995        } else if (name.equals("addItem")) {
14996          this.getAddItem().add((AddedItemComponent) value);
14997        } else if (name.equals("adjudication")) {
14998          this.getAdjudication().add((AdjudicationComponent) value);
14999        } else if (name.equals("total")) {
15000          this.getTotal().add((TotalComponent) value);
15001        } else if (name.equals("payment")) {
15002          this.payment = (PaymentComponent) value; // PaymentComponent
15003        } else if (name.equals("formCode")) {
15004          this.formCode = castToCodeableConcept(value); // CodeableConcept
15005        } else if (name.equals("form")) {
15006          this.form = castToAttachment(value); // Attachment
15007        } else if (name.equals("processNote")) {
15008          this.getProcessNote().add((NoteComponent) value);
15009        } else if (name.equals("benefitPeriod")) {
15010          this.benefitPeriod = castToPeriod(value); // Period
15011        } else if (name.equals("benefitBalance")) {
15012          this.getBenefitBalance().add((BenefitBalanceComponent) value);
15013        } else
15014          return super.setProperty(name, value);
15015        return value;
15016      }
15017
15018      @Override
15019      public Base makeProperty(int hash, String name) throws FHIRException {
15020        switch (hash) {
15021        case -1618432855:  return addIdentifier(); 
15022        case -892481550:  return getStatusElement();
15023        case 3575610:  return getType(); 
15024        case -1868521062:  return getSubType(); 
15025        case 116103:  return getUseElement();
15026        case -791418107:  return getPatient(); 
15027        case -332066046:  return getBillablePeriod(); 
15028        case 1028554472:  return getCreatedElement();
15029        case -1591951995:  return getEnterer(); 
15030        case 1957615864:  return getInsurer(); 
15031        case -987494927:  return getProvider(); 
15032        case -1165461084:  return getPriority(); 
15033        case -1688904576:  return getFundsReserveRequested(); 
15034        case 1314609806:  return getFundsReserve(); 
15035        case 1090493483:  return addRelated(); 
15036        case 460301338:  return getPrescription(); 
15037        case -1814015861:  return getOriginalPrescription(); 
15038        case 106443592:  return getPayee(); 
15039        case -722568291:  return getReferral(); 
15040        case 501116579:  return getFacility(); 
15041        case 94742588:  return getClaim(); 
15042        case 689513629:  return getClaimResponse(); 
15043        case -1106507950:  return getOutcomeElement();
15044        case 583380919:  return getDispositionElement();
15045        case 522246568:  return addPreAuthRefElement();
15046        case -1262920311:  return addPreAuthRefPeriod(); 
15047        case -7323378:  return addCareTeam(); 
15048        case 1922406657:  return addSupportingInfo(); 
15049        case 1196993265:  return addDiagnosis(); 
15050        case -1095204141:  return addProcedure(); 
15051        case 159695370:  return getPrecedenceElement();
15052        case 73049818:  return addInsurance(); 
15053        case -2143202801:  return getAccident(); 
15054        case 3242771:  return addItem(); 
15055        case -1148899500:  return addAddItem(); 
15056        case -231349275:  return addAdjudication(); 
15057        case 110549828:  return addTotal(); 
15058        case -786681338:  return getPayment(); 
15059        case 473181393:  return getFormCode(); 
15060        case 3148996:  return getForm(); 
15061        case 202339073:  return addProcessNote(); 
15062        case -407369416:  return getBenefitPeriod(); 
15063        case 596003397:  return addBenefitBalance(); 
15064        default: return super.makeProperty(hash, name);
15065        }
15066
15067      }
15068
15069      @Override
15070      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
15071        switch (hash) {
15072        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
15073        case -892481550: /*status*/ return new String[] {"code"};
15074        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
15075        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
15076        case 116103: /*use*/ return new String[] {"code"};
15077        case -791418107: /*patient*/ return new String[] {"Reference"};
15078        case -332066046: /*billablePeriod*/ return new String[] {"Period"};
15079        case 1028554472: /*created*/ return new String[] {"dateTime"};
15080        case -1591951995: /*enterer*/ return new String[] {"Reference"};
15081        case 1957615864: /*insurer*/ return new String[] {"Reference"};
15082        case -987494927: /*provider*/ return new String[] {"Reference"};
15083        case -1165461084: /*priority*/ return new String[] {"CodeableConcept"};
15084        case -1688904576: /*fundsReserveRequested*/ return new String[] {"CodeableConcept"};
15085        case 1314609806: /*fundsReserve*/ return new String[] {"CodeableConcept"};
15086        case 1090493483: /*related*/ return new String[] {};
15087        case 460301338: /*prescription*/ return new String[] {"Reference"};
15088        case -1814015861: /*originalPrescription*/ return new String[] {"Reference"};
15089        case 106443592: /*payee*/ return new String[] {};
15090        case -722568291: /*referral*/ return new String[] {"Reference"};
15091        case 501116579: /*facility*/ return new String[] {"Reference"};
15092        case 94742588: /*claim*/ return new String[] {"Reference"};
15093        case 689513629: /*claimResponse*/ return new String[] {"Reference"};
15094        case -1106507950: /*outcome*/ return new String[] {"code"};
15095        case 583380919: /*disposition*/ return new String[] {"string"};
15096        case 522246568: /*preAuthRef*/ return new String[] {"string"};
15097        case -1262920311: /*preAuthRefPeriod*/ return new String[] {"Period"};
15098        case -7323378: /*careTeam*/ return new String[] {};
15099        case 1922406657: /*supportingInfo*/ return new String[] {};
15100        case 1196993265: /*diagnosis*/ return new String[] {};
15101        case -1095204141: /*procedure*/ return new String[] {};
15102        case 159695370: /*precedence*/ return new String[] {"positiveInt"};
15103        case 73049818: /*insurance*/ return new String[] {};
15104        case -2143202801: /*accident*/ return new String[] {};
15105        case 3242771: /*item*/ return new String[] {};
15106        case -1148899500: /*addItem*/ return new String[] {};
15107        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
15108        case 110549828: /*total*/ return new String[] {};
15109        case -786681338: /*payment*/ return new String[] {};
15110        case 473181393: /*formCode*/ return new String[] {"CodeableConcept"};
15111        case 3148996: /*form*/ return new String[] {"Attachment"};
15112        case 202339073: /*processNote*/ return new String[] {};
15113        case -407369416: /*benefitPeriod*/ return new String[] {"Period"};
15114        case 596003397: /*benefitBalance*/ return new String[] {};
15115        default: return super.getTypesForProperty(hash, name);
15116        }
15117
15118      }
15119
15120      @Override
15121      public Base addChild(String name) throws FHIRException {
15122        if (name.equals("identifier")) {
15123          return addIdentifier();
15124        }
15125        else if (name.equals("status")) {
15126          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.status");
15127        }
15128        else if (name.equals("type")) {
15129          this.type = new CodeableConcept();
15130          return this.type;
15131        }
15132        else if (name.equals("subType")) {
15133          this.subType = new CodeableConcept();
15134          return this.subType;
15135        }
15136        else if (name.equals("use")) {
15137          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.use");
15138        }
15139        else if (name.equals("patient")) {
15140          this.patient = new Reference();
15141          return this.patient;
15142        }
15143        else if (name.equals("billablePeriod")) {
15144          this.billablePeriod = new Period();
15145          return this.billablePeriod;
15146        }
15147        else if (name.equals("created")) {
15148          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.created");
15149        }
15150        else if (name.equals("enterer")) {
15151          this.enterer = new Reference();
15152          return this.enterer;
15153        }
15154        else if (name.equals("insurer")) {
15155          this.insurer = new Reference();
15156          return this.insurer;
15157        }
15158        else if (name.equals("provider")) {
15159          this.provider = new Reference();
15160          return this.provider;
15161        }
15162        else if (name.equals("priority")) {
15163          this.priority = new CodeableConcept();
15164          return this.priority;
15165        }
15166        else if (name.equals("fundsReserveRequested")) {
15167          this.fundsReserveRequested = new CodeableConcept();
15168          return this.fundsReserveRequested;
15169        }
15170        else if (name.equals("fundsReserve")) {
15171          this.fundsReserve = new CodeableConcept();
15172          return this.fundsReserve;
15173        }
15174        else if (name.equals("related")) {
15175          return addRelated();
15176        }
15177        else if (name.equals("prescription")) {
15178          this.prescription = new Reference();
15179          return this.prescription;
15180        }
15181        else if (name.equals("originalPrescription")) {
15182          this.originalPrescription = new Reference();
15183          return this.originalPrescription;
15184        }
15185        else if (name.equals("payee")) {
15186          this.payee = new PayeeComponent();
15187          return this.payee;
15188        }
15189        else if (name.equals("referral")) {
15190          this.referral = new Reference();
15191          return this.referral;
15192        }
15193        else if (name.equals("facility")) {
15194          this.facility = new Reference();
15195          return this.facility;
15196        }
15197        else if (name.equals("claim")) {
15198          this.claim = new Reference();
15199          return this.claim;
15200        }
15201        else if (name.equals("claimResponse")) {
15202          this.claimResponse = new Reference();
15203          return this.claimResponse;
15204        }
15205        else if (name.equals("outcome")) {
15206          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.outcome");
15207        }
15208        else if (name.equals("disposition")) {
15209          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.disposition");
15210        }
15211        else if (name.equals("preAuthRef")) {
15212          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
15213        }
15214        else if (name.equals("preAuthRefPeriod")) {
15215          return addPreAuthRefPeriod();
15216        }
15217        else if (name.equals("careTeam")) {
15218          return addCareTeam();
15219        }
15220        else if (name.equals("supportingInfo")) {
15221          return addSupportingInfo();
15222        }
15223        else if (name.equals("diagnosis")) {
15224          return addDiagnosis();
15225        }
15226        else if (name.equals("procedure")) {
15227          return addProcedure();
15228        }
15229        else if (name.equals("precedence")) {
15230          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.precedence");
15231        }
15232        else if (name.equals("insurance")) {
15233          return addInsurance();
15234        }
15235        else if (name.equals("accident")) {
15236          this.accident = new AccidentComponent();
15237          return this.accident;
15238        }
15239        else if (name.equals("item")) {
15240          return addItem();
15241        }
15242        else if (name.equals("addItem")) {
15243          return addAddItem();
15244        }
15245        else if (name.equals("adjudication")) {
15246          return addAdjudication();
15247        }
15248        else if (name.equals("total")) {
15249          return addTotal();
15250        }
15251        else if (name.equals("payment")) {
15252          this.payment = new PaymentComponent();
15253          return this.payment;
15254        }
15255        else if (name.equals("formCode")) {
15256          this.formCode = new CodeableConcept();
15257          return this.formCode;
15258        }
15259        else if (name.equals("form")) {
15260          this.form = new Attachment();
15261          return this.form;
15262        }
15263        else if (name.equals("processNote")) {
15264          return addProcessNote();
15265        }
15266        else if (name.equals("benefitPeriod")) {
15267          this.benefitPeriod = new Period();
15268          return this.benefitPeriod;
15269        }
15270        else if (name.equals("benefitBalance")) {
15271          return addBenefitBalance();
15272        }
15273        else
15274          return super.addChild(name);
15275      }
15276
15277  public String fhirType() {
15278    return "ExplanationOfBenefit";
15279
15280  }
15281
15282      public ExplanationOfBenefit copy() {
15283        ExplanationOfBenefit dst = new ExplanationOfBenefit();
15284        copyValues(dst);
15285        return dst;
15286      }
15287
15288      public void copyValues(ExplanationOfBenefit dst) {
15289        super.copyValues(dst);
15290        if (identifier != null) {
15291          dst.identifier = new ArrayList<Identifier>();
15292          for (Identifier i : identifier)
15293            dst.identifier.add(i.copy());
15294        };
15295        dst.status = status == null ? null : status.copy();
15296        dst.type = type == null ? null : type.copy();
15297        dst.subType = subType == null ? null : subType.copy();
15298        dst.use = use == null ? null : use.copy();
15299        dst.patient = patient == null ? null : patient.copy();
15300        dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
15301        dst.created = created == null ? null : created.copy();
15302        dst.enterer = enterer == null ? null : enterer.copy();
15303        dst.insurer = insurer == null ? null : insurer.copy();
15304        dst.provider = provider == null ? null : provider.copy();
15305        dst.priority = priority == null ? null : priority.copy();
15306        dst.fundsReserveRequested = fundsReserveRequested == null ? null : fundsReserveRequested.copy();
15307        dst.fundsReserve = fundsReserve == null ? null : fundsReserve.copy();
15308        if (related != null) {
15309          dst.related = new ArrayList<RelatedClaimComponent>();
15310          for (RelatedClaimComponent i : related)
15311            dst.related.add(i.copy());
15312        };
15313        dst.prescription = prescription == null ? null : prescription.copy();
15314        dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
15315        dst.payee = payee == null ? null : payee.copy();
15316        dst.referral = referral == null ? null : referral.copy();
15317        dst.facility = facility == null ? null : facility.copy();
15318        dst.claim = claim == null ? null : claim.copy();
15319        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
15320        dst.outcome = outcome == null ? null : outcome.copy();
15321        dst.disposition = disposition == null ? null : disposition.copy();
15322        if (preAuthRef != null) {
15323          dst.preAuthRef = new ArrayList<StringType>();
15324          for (StringType i : preAuthRef)
15325            dst.preAuthRef.add(i.copy());
15326        };
15327        if (preAuthRefPeriod != null) {
15328          dst.preAuthRefPeriod = new ArrayList<Period>();
15329          for (Period i : preAuthRefPeriod)
15330            dst.preAuthRefPeriod.add(i.copy());
15331        };
15332        if (careTeam != null) {
15333          dst.careTeam = new ArrayList<CareTeamComponent>();
15334          for (CareTeamComponent i : careTeam)
15335            dst.careTeam.add(i.copy());
15336        };
15337        if (supportingInfo != null) {
15338          dst.supportingInfo = new ArrayList<SupportingInformationComponent>();
15339          for (SupportingInformationComponent i : supportingInfo)
15340            dst.supportingInfo.add(i.copy());
15341        };
15342        if (diagnosis != null) {
15343          dst.diagnosis = new ArrayList<DiagnosisComponent>();
15344          for (DiagnosisComponent i : diagnosis)
15345            dst.diagnosis.add(i.copy());
15346        };
15347        if (procedure != null) {
15348          dst.procedure = new ArrayList<ProcedureComponent>();
15349          for (ProcedureComponent i : procedure)
15350            dst.procedure.add(i.copy());
15351        };
15352        dst.precedence = precedence == null ? null : precedence.copy();
15353        if (insurance != null) {
15354          dst.insurance = new ArrayList<InsuranceComponent>();
15355          for (InsuranceComponent i : insurance)
15356            dst.insurance.add(i.copy());
15357        };
15358        dst.accident = accident == null ? null : accident.copy();
15359        if (item != null) {
15360          dst.item = new ArrayList<ItemComponent>();
15361          for (ItemComponent i : item)
15362            dst.item.add(i.copy());
15363        };
15364        if (addItem != null) {
15365          dst.addItem = new ArrayList<AddedItemComponent>();
15366          for (AddedItemComponent i : addItem)
15367            dst.addItem.add(i.copy());
15368        };
15369        if (adjudication != null) {
15370          dst.adjudication = new ArrayList<AdjudicationComponent>();
15371          for (AdjudicationComponent i : adjudication)
15372            dst.adjudication.add(i.copy());
15373        };
15374        if (total != null) {
15375          dst.total = new ArrayList<TotalComponent>();
15376          for (TotalComponent i : total)
15377            dst.total.add(i.copy());
15378        };
15379        dst.payment = payment == null ? null : payment.copy();
15380        dst.formCode = formCode == null ? null : formCode.copy();
15381        dst.form = form == null ? null : form.copy();
15382        if (processNote != null) {
15383          dst.processNote = new ArrayList<NoteComponent>();
15384          for (NoteComponent i : processNote)
15385            dst.processNote.add(i.copy());
15386        };
15387        dst.benefitPeriod = benefitPeriod == null ? null : benefitPeriod.copy();
15388        if (benefitBalance != null) {
15389          dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
15390          for (BenefitBalanceComponent i : benefitBalance)
15391            dst.benefitBalance.add(i.copy());
15392        };
15393      }
15394
15395      protected ExplanationOfBenefit typedCopy() {
15396        return copy();
15397      }
15398
15399      @Override
15400      public boolean equalsDeep(Base other_) {
15401        if (!super.equalsDeep(other_))
15402          return false;
15403        if (!(other_ instanceof ExplanationOfBenefit))
15404          return false;
15405        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
15406        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
15407           && compareDeep(subType, o.subType, true) && compareDeep(use, o.use, true) && compareDeep(patient, o.patient, true)
15408           && compareDeep(billablePeriod, o.billablePeriod, true) && compareDeep(created, o.created, true)
15409           && compareDeep(enterer, o.enterer, true) && compareDeep(insurer, o.insurer, true) && compareDeep(provider, o.provider, true)
15410           && compareDeep(priority, o.priority, true) && compareDeep(fundsReserveRequested, o.fundsReserveRequested, true)
15411           && compareDeep(fundsReserve, o.fundsReserve, true) && compareDeep(related, o.related, true) && compareDeep(prescription, o.prescription, true)
15412           && compareDeep(originalPrescription, o.originalPrescription, true) && compareDeep(payee, o.payee, true)
15413           && compareDeep(referral, o.referral, true) && compareDeep(facility, o.facility, true) && compareDeep(claim, o.claim, true)
15414           && compareDeep(claimResponse, o.claimResponse, true) && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true)
15415           && compareDeep(preAuthRef, o.preAuthRef, true) && compareDeep(preAuthRefPeriod, o.preAuthRefPeriod, true)
15416           && compareDeep(careTeam, o.careTeam, true) && compareDeep(supportingInfo, o.supportingInfo, true)
15417           && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true) && compareDeep(precedence, o.precedence, true)
15418           && compareDeep(insurance, o.insurance, true) && compareDeep(accident, o.accident, true) && compareDeep(item, o.item, true)
15419           && compareDeep(addItem, o.addItem, true) && compareDeep(adjudication, o.adjudication, true) && compareDeep(total, o.total, true)
15420           && compareDeep(payment, o.payment, true) && compareDeep(formCode, o.formCode, true) && compareDeep(form, o.form, true)
15421           && compareDeep(processNote, o.processNote, true) && compareDeep(benefitPeriod, o.benefitPeriod, true)
15422           && compareDeep(benefitBalance, o.benefitBalance, true);
15423      }
15424
15425      @Override
15426      public boolean equalsShallow(Base other_) {
15427        if (!super.equalsShallow(other_))
15428          return false;
15429        if (!(other_ instanceof ExplanationOfBenefit))
15430          return false;
15431        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
15432        return compareValues(status, o.status, true) && compareValues(use, o.use, true) && compareValues(created, o.created, true)
15433           && compareValues(outcome, o.outcome, true) && compareValues(disposition, o.disposition, true) && compareValues(preAuthRef, o.preAuthRef, true)
15434           && compareValues(precedence, o.precedence, true);
15435      }
15436
15437      public boolean isEmpty() {
15438        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
15439          , subType, use, patient, billablePeriod, created, enterer, insurer, provider
15440          , priority, fundsReserveRequested, fundsReserve, related, prescription, originalPrescription
15441          , payee, referral, facility, claim, claimResponse, outcome, disposition, preAuthRef
15442          , preAuthRefPeriod, careTeam, supportingInfo, diagnosis, procedure, precedence, insurance
15443          , accident, item, addItem, adjudication, total, payment, formCode, form, processNote
15444          , benefitPeriod, benefitBalance);
15445      }
15446
15447  @Override
15448  public ResourceType getResourceType() {
15449    return ResourceType.ExplanationOfBenefit;
15450   }
15451
15452 /**
15453   * Search parameter: <b>coverage</b>
15454   * <p>
15455   * Description: <b>The plan under which the claim was adjudicated</b><br>
15456   * Type: <b>reference</b><br>
15457   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
15458   * </p>
15459   */
15460  @SearchParamDefinition(name="coverage", path="ExplanationOfBenefit.insurance.coverage", description="The plan under which the claim was adjudicated", type="reference", target={Coverage.class } )
15461  public static final String SP_COVERAGE = "coverage";
15462 /**
15463   * <b>Fluent Client</b> search parameter constant for <b>coverage</b>
15464   * <p>
15465   * Description: <b>The plan under which the claim was adjudicated</b><br>
15466   * Type: <b>reference</b><br>
15467   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
15468   * </p>
15469   */
15470  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COVERAGE);
15471
15472/**
15473   * Constant for fluent queries to be used to add include statements. Specifies
15474   * the path value of "<b>ExplanationOfBenefit:coverage</b>".
15475   */
15476  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:coverage").toLocked();
15477
15478 /**
15479   * Search parameter: <b>care-team</b>
15480   * <p>
15481   * Description: <b>Member of the CareTeam</b><br>
15482   * Type: <b>reference</b><br>
15483   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
15484   * </p>
15485   */
15486  @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 } )
15487  public static final String SP_CARE_TEAM = "care-team";
15488 /**
15489   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
15490   * <p>
15491   * Description: <b>Member of the CareTeam</b><br>
15492   * Type: <b>reference</b><br>
15493   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
15494   * </p>
15495   */
15496  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CARE_TEAM);
15497
15498/**
15499   * Constant for fluent queries to be used to add include statements. Specifies
15500   * the path value of "<b>ExplanationOfBenefit:care-team</b>".
15501   */
15502  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:care-team").toLocked();
15503
15504 /**
15505   * Search parameter: <b>identifier</b>
15506   * <p>
15507   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
15508   * Type: <b>token</b><br>
15509   * Path: <b>ExplanationOfBenefit.identifier</b><br>
15510   * </p>
15511   */
15512  @SearchParamDefinition(name="identifier", path="ExplanationOfBenefit.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
15513  public static final String SP_IDENTIFIER = "identifier";
15514 /**
15515   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
15516   * <p>
15517   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
15518   * Type: <b>token</b><br>
15519   * Path: <b>ExplanationOfBenefit.identifier</b><br>
15520   * </p>
15521   */
15522  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
15523
15524 /**
15525   * Search parameter: <b>created</b>
15526   * <p>
15527   * Description: <b>The creation date for the EOB</b><br>
15528   * Type: <b>date</b><br>
15529   * Path: <b>ExplanationOfBenefit.created</b><br>
15530   * </p>
15531   */
15532  @SearchParamDefinition(name="created", path="ExplanationOfBenefit.created", description="The creation date for the EOB", type="date" )
15533  public static final String SP_CREATED = "created";
15534 /**
15535   * <b>Fluent Client</b> search parameter constant for <b>created</b>
15536   * <p>
15537   * Description: <b>The creation date for the EOB</b><br>
15538   * Type: <b>date</b><br>
15539   * Path: <b>ExplanationOfBenefit.created</b><br>
15540   * </p>
15541   */
15542  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
15543
15544 /**
15545   * Search parameter: <b>encounter</b>
15546   * <p>
15547   * Description: <b>Encounters associated with a billed line item</b><br>
15548   * Type: <b>reference</b><br>
15549   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
15550   * </p>
15551   */
15552  @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 } )
15553  public static final String SP_ENCOUNTER = "encounter";
15554 /**
15555   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
15556   * <p>
15557   * Description: <b>Encounters associated with a billed line item</b><br>
15558   * Type: <b>reference</b><br>
15559   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
15560   * </p>
15561   */
15562  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
15563
15564/**
15565   * Constant for fluent queries to be used to add include statements. Specifies
15566   * the path value of "<b>ExplanationOfBenefit:encounter</b>".
15567   */
15568  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:encounter").toLocked();
15569
15570 /**
15571   * Search parameter: <b>payee</b>
15572   * <p>
15573   * Description: <b>The party receiving any payment for the Claim</b><br>
15574   * Type: <b>reference</b><br>
15575   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
15576   * </p>
15577   */
15578  @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 } )
15579  public static final String SP_PAYEE = "payee";
15580 /**
15581   * <b>Fluent Client</b> search parameter constant for <b>payee</b>
15582   * <p>
15583   * Description: <b>The party receiving any payment for the Claim</b><br>
15584   * Type: <b>reference</b><br>
15585   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
15586   * </p>
15587   */
15588  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PAYEE);
15589
15590/**
15591   * Constant for fluent queries to be used to add include statements. Specifies
15592   * the path value of "<b>ExplanationOfBenefit:payee</b>".
15593   */
15594  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYEE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:payee").toLocked();
15595
15596 /**
15597   * Search parameter: <b>disposition</b>
15598   * <p>
15599   * Description: <b>The contents of the disposition message</b><br>
15600   * Type: <b>string</b><br>
15601   * Path: <b>ExplanationOfBenefit.disposition</b><br>
15602   * </p>
15603   */
15604  @SearchParamDefinition(name="disposition", path="ExplanationOfBenefit.disposition", description="The contents of the disposition message", type="string" )
15605  public static final String SP_DISPOSITION = "disposition";
15606 /**
15607   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
15608   * <p>
15609   * Description: <b>The contents of the disposition message</b><br>
15610   * Type: <b>string</b><br>
15611   * Path: <b>ExplanationOfBenefit.disposition</b><br>
15612   * </p>
15613   */
15614  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
15615
15616 /**
15617   * Search parameter: <b>provider</b>
15618   * <p>
15619   * Description: <b>The reference to the provider</b><br>
15620   * Type: <b>reference</b><br>
15621   * Path: <b>ExplanationOfBenefit.provider</b><br>
15622   * </p>
15623   */
15624  @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 } )
15625  public static final String SP_PROVIDER = "provider";
15626 /**
15627   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
15628   * <p>
15629   * Description: <b>The reference to the provider</b><br>
15630   * Type: <b>reference</b><br>
15631   * Path: <b>ExplanationOfBenefit.provider</b><br>
15632   * </p>
15633   */
15634  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
15635
15636/**
15637   * Constant for fluent queries to be used to add include statements. Specifies
15638   * the path value of "<b>ExplanationOfBenefit:provider</b>".
15639   */
15640  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:provider").toLocked();
15641
15642 /**
15643   * Search parameter: <b>patient</b>
15644   * <p>
15645   * Description: <b>The reference to the patient</b><br>
15646   * Type: <b>reference</b><br>
15647   * Path: <b>ExplanationOfBenefit.patient</b><br>
15648   * </p>
15649   */
15650  @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 } )
15651  public static final String SP_PATIENT = "patient";
15652 /**
15653   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
15654   * <p>
15655   * Description: <b>The reference to the patient</b><br>
15656   * Type: <b>reference</b><br>
15657   * Path: <b>ExplanationOfBenefit.patient</b><br>
15658   * </p>
15659   */
15660  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
15661
15662/**
15663   * Constant for fluent queries to be used to add include statements. Specifies
15664   * the path value of "<b>ExplanationOfBenefit:patient</b>".
15665   */
15666  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:patient").toLocked();
15667
15668 /**
15669   * Search parameter: <b>detail-udi</b>
15670   * <p>
15671   * Description: <b>UDI associated with a line item detail product or service</b><br>
15672   * Type: <b>reference</b><br>
15673   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
15674   * </p>
15675   */
15676  @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 } )
15677  public static final String SP_DETAIL_UDI = "detail-udi";
15678 /**
15679   * <b>Fluent Client</b> search parameter constant for <b>detail-udi</b>
15680   * <p>
15681   * Description: <b>UDI associated with a line item detail product or service</b><br>
15682   * Type: <b>reference</b><br>
15683   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
15684   * </p>
15685   */
15686  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DETAIL_UDI);
15687
15688/**
15689   * Constant for fluent queries to be used to add include statements. Specifies
15690   * the path value of "<b>ExplanationOfBenefit:detail-udi</b>".
15691   */
15692  public static final ca.uhn.fhir.model.api.Include INCLUDE_DETAIL_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:detail-udi").toLocked();
15693
15694 /**
15695   * Search parameter: <b>claim</b>
15696   * <p>
15697   * Description: <b>The reference to the claim</b><br>
15698   * Type: <b>reference</b><br>
15699   * Path: <b>ExplanationOfBenefit.claim</b><br>
15700   * </p>
15701   */
15702  @SearchParamDefinition(name="claim", path="ExplanationOfBenefit.claim", description="The reference to the claim", type="reference", target={Claim.class } )
15703  public static final String SP_CLAIM = "claim";
15704 /**
15705   * <b>Fluent Client</b> search parameter constant for <b>claim</b>
15706   * <p>
15707   * Description: <b>The reference to the claim</b><br>
15708   * Type: <b>reference</b><br>
15709   * Path: <b>ExplanationOfBenefit.claim</b><br>
15710   * </p>
15711   */
15712  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CLAIM);
15713
15714/**
15715   * Constant for fluent queries to be used to add include statements. Specifies
15716   * the path value of "<b>ExplanationOfBenefit:claim</b>".
15717   */
15718  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:claim").toLocked();
15719
15720 /**
15721   * Search parameter: <b>enterer</b>
15722   * <p>
15723   * Description: <b>The party responsible for the entry of the Claim</b><br>
15724   * Type: <b>reference</b><br>
15725   * Path: <b>ExplanationOfBenefit.enterer</b><br>
15726   * </p>
15727   */
15728  @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 } )
15729  public static final String SP_ENTERER = "enterer";
15730 /**
15731   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
15732   * <p>
15733   * Description: <b>The party responsible for the entry of the Claim</b><br>
15734   * Type: <b>reference</b><br>
15735   * Path: <b>ExplanationOfBenefit.enterer</b><br>
15736   * </p>
15737   */
15738  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTERER);
15739
15740/**
15741   * Constant for fluent queries to be used to add include statements. Specifies
15742   * the path value of "<b>ExplanationOfBenefit:enterer</b>".
15743   */
15744  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:enterer").toLocked();
15745
15746 /**
15747   * Search parameter: <b>procedure-udi</b>
15748   * <p>
15749   * Description: <b>UDI associated with a procedure</b><br>
15750   * Type: <b>reference</b><br>
15751   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
15752   * </p>
15753   */
15754  @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 } )
15755  public static final String SP_PROCEDURE_UDI = "procedure-udi";
15756 /**
15757   * <b>Fluent Client</b> search parameter constant for <b>procedure-udi</b>
15758   * <p>
15759   * Description: <b>UDI associated with a procedure</b><br>
15760   * Type: <b>reference</b><br>
15761   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
15762   * </p>
15763   */
15764  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROCEDURE_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROCEDURE_UDI);
15765
15766/**
15767   * Constant for fluent queries to be used to add include statements. Specifies
15768   * the path value of "<b>ExplanationOfBenefit:procedure-udi</b>".
15769   */
15770  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROCEDURE_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:procedure-udi").toLocked();
15771
15772 /**
15773   * Search parameter: <b>subdetail-udi</b>
15774   * <p>
15775   * Description: <b>UDI associated with a line item detail subdetail product or service</b><br>
15776   * Type: <b>reference</b><br>
15777   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
15778   * </p>
15779   */
15780  @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 } )
15781  public static final String SP_SUBDETAIL_UDI = "subdetail-udi";
15782 /**
15783   * <b>Fluent Client</b> search parameter constant for <b>subdetail-udi</b>
15784   * <p>
15785   * Description: <b>UDI associated with a line item detail subdetail product or service</b><br>
15786   * Type: <b>reference</b><br>
15787   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
15788   * </p>
15789   */
15790  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBDETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBDETAIL_UDI);
15791
15792/**
15793   * Constant for fluent queries to be used to add include statements. Specifies
15794   * the path value of "<b>ExplanationOfBenefit:subdetail-udi</b>".
15795   */
15796  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBDETAIL_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:subdetail-udi").toLocked();
15797
15798 /**
15799   * Search parameter: <b>facility</b>
15800   * <p>
15801   * Description: <b>Facility responsible for the goods and services</b><br>
15802   * Type: <b>reference</b><br>
15803   * Path: <b>ExplanationOfBenefit.facility</b><br>
15804   * </p>
15805   */
15806  @SearchParamDefinition(name="facility", path="ExplanationOfBenefit.facility", description="Facility responsible for the goods and services", type="reference", target={Location.class } )
15807  public static final String SP_FACILITY = "facility";
15808 /**
15809   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
15810   * <p>
15811   * Description: <b>Facility responsible for the goods and services</b><br>
15812   * Type: <b>reference</b><br>
15813   * Path: <b>ExplanationOfBenefit.facility</b><br>
15814   * </p>
15815   */
15816  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITY);
15817
15818/**
15819   * Constant for fluent queries to be used to add include statements. Specifies
15820   * the path value of "<b>ExplanationOfBenefit:facility</b>".
15821   */
15822  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:facility").toLocked();
15823
15824 /**
15825   * Search parameter: <b>item-udi</b>
15826   * <p>
15827   * Description: <b>UDI associated with a line item product or service</b><br>
15828   * Type: <b>reference</b><br>
15829   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
15830   * </p>
15831   */
15832  @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 } )
15833  public static final String SP_ITEM_UDI = "item-udi";
15834 /**
15835   * <b>Fluent Client</b> search parameter constant for <b>item-udi</b>
15836   * <p>
15837   * Description: <b>UDI associated with a line item product or service</b><br>
15838   * Type: <b>reference</b><br>
15839   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
15840   * </p>
15841   */
15842  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ITEM_UDI);
15843
15844/**
15845   * Constant for fluent queries to be used to add include statements. Specifies
15846   * the path value of "<b>ExplanationOfBenefit:item-udi</b>".
15847   */
15848  public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:item-udi").toLocked();
15849
15850 /**
15851   * Search parameter: <b>status</b>
15852   * <p>
15853   * Description: <b>Status of the instance</b><br>
15854   * Type: <b>token</b><br>
15855   * Path: <b>ExplanationOfBenefit.status</b><br>
15856   * </p>
15857   */
15858  @SearchParamDefinition(name="status", path="ExplanationOfBenefit.status", description="Status of the instance", type="token" )
15859  public static final String SP_STATUS = "status";
15860 /**
15861   * <b>Fluent Client</b> search parameter constant for <b>status</b>
15862   * <p>
15863   * Description: <b>Status of the instance</b><br>
15864   * Type: <b>token</b><br>
15865   * Path: <b>ExplanationOfBenefit.status</b><br>
15866   * </p>
15867   */
15868  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
15869
15870
15871}