001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Thu, Sep 13, 2018 09:04-0400 for FHIR v3.5.0
033
034import java.util.*;
035
036import java.math.*;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r4.model.Enumerations.*;
039import ca.uhn.fhir.model.api.annotation.ResourceDef;
040import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.ChildOrder;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.Block;
045import org.hl7.fhir.instance.model.api.*;
046import org.hl7.fhir.exceptions.FHIRException;
047/**
048 * 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.
049 */
050@ResourceDef(name="ExplanationOfBenefit", profile="http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit")
051public class ExplanationOfBenefit extends DomainResource {
052
053    public enum ExplanationOfBenefitStatus {
054        /**
055         * The resource instance is currently in-force.
056         */
057        ACTIVE, 
058        /**
059         * The resource instance is withdrawn, rescinded or reversed.
060         */
061        CANCELLED, 
062        /**
063         * A new resource instance the contents of which is not complete.
064         */
065        DRAFT, 
066        /**
067         * The resource instance was entered in error.
068         */
069        ENTEREDINERROR, 
070        /**
071         * added to help the parsers with the generic types
072         */
073        NULL;
074        public static ExplanationOfBenefitStatus fromCode(String codeString) throws FHIRException {
075            if (codeString == null || "".equals(codeString))
076                return null;
077        if ("active".equals(codeString))
078          return ACTIVE;
079        if ("cancelled".equals(codeString))
080          return CANCELLED;
081        if ("draft".equals(codeString))
082          return DRAFT;
083        if ("entered-in-error".equals(codeString))
084          return ENTEREDINERROR;
085        if (Configuration.isAcceptInvalidEnums())
086          return null;
087        else
088          throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
089        }
090        public String toCode() {
091          switch (this) {
092            case ACTIVE: return "active";
093            case CANCELLED: return "cancelled";
094            case DRAFT: return "draft";
095            case ENTEREDINERROR: return "entered-in-error";
096            default: return "?";
097          }
098        }
099        public String getSystem() {
100          switch (this) {
101            case ACTIVE: return "http://hl7.org/fhir/explanationofbenefit-status";
102            case CANCELLED: return "http://hl7.org/fhir/explanationofbenefit-status";
103            case DRAFT: return "http://hl7.org/fhir/explanationofbenefit-status";
104            case ENTEREDINERROR: return "http://hl7.org/fhir/explanationofbenefit-status";
105            default: return "?";
106          }
107        }
108        public String getDefinition() {
109          switch (this) {
110            case ACTIVE: return "The resource instance is currently in-force.";
111            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
112            case DRAFT: return "A new resource instance the contents of which is not complete.";
113            case ENTEREDINERROR: return "The resource instance was entered in error.";
114            default: return "?";
115          }
116        }
117        public String getDisplay() {
118          switch (this) {
119            case ACTIVE: return "Active";
120            case CANCELLED: return "Cancelled";
121            case DRAFT: return "Draft";
122            case ENTEREDINERROR: return "Entered In Error";
123            default: return "?";
124          }
125        }
126    }
127
128  public static class ExplanationOfBenefitStatusEnumFactory implements EnumFactory<ExplanationOfBenefitStatus> {
129    public ExplanationOfBenefitStatus fromCode(String codeString) throws IllegalArgumentException {
130      if (codeString == null || "".equals(codeString))
131            if (codeString == null || "".equals(codeString))
132                return null;
133        if ("active".equals(codeString))
134          return ExplanationOfBenefitStatus.ACTIVE;
135        if ("cancelled".equals(codeString))
136          return ExplanationOfBenefitStatus.CANCELLED;
137        if ("draft".equals(codeString))
138          return ExplanationOfBenefitStatus.DRAFT;
139        if ("entered-in-error".equals(codeString))
140          return ExplanationOfBenefitStatus.ENTEREDINERROR;
141        throw new IllegalArgumentException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
142        }
143        public Enumeration<ExplanationOfBenefitStatus> fromType(Base code) throws FHIRException {
144          if (code == null)
145            return null;
146          if (code.isEmpty())
147            return new Enumeration<ExplanationOfBenefitStatus>(this);
148          String codeString = ((PrimitiveType) code).asStringValue();
149          if (codeString == null || "".equals(codeString))
150            return null;
151        if ("active".equals(codeString))
152          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ACTIVE);
153        if ("cancelled".equals(codeString))
154          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.CANCELLED);
155        if ("draft".equals(codeString))
156          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.DRAFT);
157        if ("entered-in-error".equals(codeString))
158          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ENTEREDINERROR);
159        throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
160        }
161    public String toCode(ExplanationOfBenefitStatus code) {
162      if (code == ExplanationOfBenefitStatus.ACTIVE)
163        return "active";
164      if (code == ExplanationOfBenefitStatus.CANCELLED)
165        return "cancelled";
166      if (code == ExplanationOfBenefitStatus.DRAFT)
167        return "draft";
168      if (code == ExplanationOfBenefitStatus.ENTEREDINERROR)
169        return "entered-in-error";
170      return "?";
171      }
172    public String toSystem(ExplanationOfBenefitStatus code) {
173      return code.getSystem();
174      }
175    }
176
177    public enum Use {
178        /**
179         * The treatment is complete and this represents a Claim for the services.
180         */
181        CLAIM, 
182        /**
183         * The treatment is proposed and this represents a Pre-authorization for the services.
184         */
185        PREAUTHORIZATION, 
186        /**
187         * The treatment is proposed and this represents a Pre-determination for the services.
188         */
189        PREDETERMINATION, 
190        /**
191         * added to help the parsers with the generic types
192         */
193        NULL;
194        public static Use fromCode(String codeString) throws FHIRException {
195            if (codeString == null || "".equals(codeString))
196                return null;
197        if ("claim".equals(codeString))
198          return CLAIM;
199        if ("preauthorization".equals(codeString))
200          return PREAUTHORIZATION;
201        if ("predetermination".equals(codeString))
202          return PREDETERMINATION;
203        if (Configuration.isAcceptInvalidEnums())
204          return null;
205        else
206          throw new FHIRException("Unknown Use code '"+codeString+"'");
207        }
208        public String toCode() {
209          switch (this) {
210            case CLAIM: return "claim";
211            case PREAUTHORIZATION: return "preauthorization";
212            case PREDETERMINATION: return "predetermination";
213            default: return "?";
214          }
215        }
216        public String getSystem() {
217          switch (this) {
218            case CLAIM: return "http://hl7.org/fhir/claim-use";
219            case PREAUTHORIZATION: return "http://hl7.org/fhir/claim-use";
220            case PREDETERMINATION: return "http://hl7.org/fhir/claim-use";
221            default: return "?";
222          }
223        }
224        public String getDefinition() {
225          switch (this) {
226            case CLAIM: return "The treatment is complete and this represents a Claim for the services.";
227            case PREAUTHORIZATION: return "The treatment is proposed and this represents a Pre-authorization for the services.";
228            case PREDETERMINATION: return "The treatment is proposed and this represents a Pre-determination for the services.";
229            default: return "?";
230          }
231        }
232        public String getDisplay() {
233          switch (this) {
234            case CLAIM: return "Claim";
235            case PREAUTHORIZATION: return "Preauthorization";
236            case PREDETERMINATION: return "Predetermination";
237            default: return "?";
238          }
239        }
240    }
241
242  public static class UseEnumFactory implements EnumFactory<Use> {
243    public Use fromCode(String codeString) throws IllegalArgumentException {
244      if (codeString == null || "".equals(codeString))
245            if (codeString == null || "".equals(codeString))
246                return null;
247        if ("claim".equals(codeString))
248          return Use.CLAIM;
249        if ("preauthorization".equals(codeString))
250          return Use.PREAUTHORIZATION;
251        if ("predetermination".equals(codeString))
252          return Use.PREDETERMINATION;
253        throw new IllegalArgumentException("Unknown Use code '"+codeString+"'");
254        }
255        public Enumeration<Use> fromType(Base code) throws FHIRException {
256          if (code == null)
257            return null;
258          if (code.isEmpty())
259            return new Enumeration<Use>(this);
260          String codeString = ((PrimitiveType) code).asStringValue();
261          if (codeString == null || "".equals(codeString))
262            return null;
263        if ("claim".equals(codeString))
264          return new Enumeration<Use>(this, Use.CLAIM);
265        if ("preauthorization".equals(codeString))
266          return new Enumeration<Use>(this, Use.PREAUTHORIZATION);
267        if ("predetermination".equals(codeString))
268          return new Enumeration<Use>(this, Use.PREDETERMINATION);
269        throw new FHIRException("Unknown Use code '"+codeString+"'");
270        }
271    public String toCode(Use code) {
272      if (code == Use.CLAIM)
273        return "claim";
274      if (code == Use.PREAUTHORIZATION)
275        return "preauthorization";
276      if (code == Use.PREDETERMINATION)
277        return "predetermination";
278      return "?";
279      }
280    public String toSystem(Use code) {
281      return code.getSystem();
282      }
283    }
284
285    public enum RemittanceOutcome {
286        /**
287         * The Claim/Pre-authorization/Pre-determination has been received but processing has not begun.
288         */
289        QUEUED, 
290        /**
291         * The processing has completed without errors
292         */
293        COMPLETE, 
294        /**
295         * One or more errors have been detected in the Claim
296         */
297        ERROR, 
298        /**
299         * No errors have been detected in the Claim and some of the adjudication has been performed.
300         */
301        PARTIAL, 
302        /**
303         * added to help the parsers with the generic types
304         */
305        NULL;
306        public static RemittanceOutcome fromCode(String codeString) throws FHIRException {
307            if (codeString == null || "".equals(codeString))
308                return null;
309        if ("queued".equals(codeString))
310          return QUEUED;
311        if ("complete".equals(codeString))
312          return COMPLETE;
313        if ("error".equals(codeString))
314          return ERROR;
315        if ("partial".equals(codeString))
316          return PARTIAL;
317        if (Configuration.isAcceptInvalidEnums())
318          return null;
319        else
320          throw new FHIRException("Unknown RemittanceOutcome code '"+codeString+"'");
321        }
322        public String toCode() {
323          switch (this) {
324            case QUEUED: return "queued";
325            case COMPLETE: return "complete";
326            case ERROR: return "error";
327            case PARTIAL: return "partial";
328            default: return "?";
329          }
330        }
331        public String getSystem() {
332          switch (this) {
333            case QUEUED: return "http://hl7.org/fhir/remittance-outcome";
334            case COMPLETE: return "http://hl7.org/fhir/remittance-outcome";
335            case ERROR: return "http://hl7.org/fhir/remittance-outcome";
336            case PARTIAL: return "http://hl7.org/fhir/remittance-outcome";
337            default: return "?";
338          }
339        }
340        public String getDefinition() {
341          switch (this) {
342            case QUEUED: return "The Claim/Pre-authorization/Pre-determination has been received but processing has not begun.";
343            case COMPLETE: return "The processing has completed without errors";
344            case ERROR: return "One or more errors have been detected in the Claim";
345            case PARTIAL: return "No errors have been detected in the Claim and some of the adjudication has been performed.";
346            default: return "?";
347          }
348        }
349        public String getDisplay() {
350          switch (this) {
351            case QUEUED: return "Queued";
352            case COMPLETE: return "Processing Complete";
353            case ERROR: return "Error";
354            case PARTIAL: return "Partial Processing";
355            default: return "?";
356          }
357        }
358    }
359
360  public static class RemittanceOutcomeEnumFactory implements EnumFactory<RemittanceOutcome> {
361    public RemittanceOutcome fromCode(String codeString) throws IllegalArgumentException {
362      if (codeString == null || "".equals(codeString))
363            if (codeString == null || "".equals(codeString))
364                return null;
365        if ("queued".equals(codeString))
366          return RemittanceOutcome.QUEUED;
367        if ("complete".equals(codeString))
368          return RemittanceOutcome.COMPLETE;
369        if ("error".equals(codeString))
370          return RemittanceOutcome.ERROR;
371        if ("partial".equals(codeString))
372          return RemittanceOutcome.PARTIAL;
373        throw new IllegalArgumentException("Unknown RemittanceOutcome code '"+codeString+"'");
374        }
375        public Enumeration<RemittanceOutcome> fromType(Base code) throws FHIRException {
376          if (code == null)
377            return null;
378          if (code.isEmpty())
379            return new Enumeration<RemittanceOutcome>(this);
380          String codeString = ((PrimitiveType) code).asStringValue();
381          if (codeString == null || "".equals(codeString))
382            return null;
383        if ("queued".equals(codeString))
384          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.QUEUED);
385        if ("complete".equals(codeString))
386          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.COMPLETE);
387        if ("error".equals(codeString))
388          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.ERROR);
389        if ("partial".equals(codeString))
390          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.PARTIAL);
391        throw new FHIRException("Unknown RemittanceOutcome code '"+codeString+"'");
392        }
393    public String toCode(RemittanceOutcome code) {
394      if (code == RemittanceOutcome.QUEUED)
395        return "queued";
396      if (code == RemittanceOutcome.COMPLETE)
397        return "complete";
398      if (code == RemittanceOutcome.ERROR)
399        return "error";
400      if (code == RemittanceOutcome.PARTIAL)
401        return "partial";
402      return "?";
403      }
404    public String toSystem(RemittanceOutcome code) {
405      return code.getSystem();
406      }
407    }
408
409    @Block()
410    public static class RelatedClaimComponent extends BackboneElement implements IBaseBackboneElement {
411        /**
412         * Other claims which are related to this claim such as prior claim versions or for related services.
413         */
414        @Child(name = "claim", type = {Claim.class}, order=1, min=0, max=1, modifier=false, summary=false)
415        @Description(shortDefinition="Reference to the related claim", formalDefinition="Other claims which are related to this claim such as prior claim versions or for related services." )
416        protected Reference claim;
417
418        /**
419         * The actual object that is the target of the reference (Other claims which are related to this claim such as prior claim versions or for related services.)
420         */
421        protected Claim claimTarget;
422
423        /**
424         * For example, prior or umbrella.
425         */
426        @Child(name = "relationship", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
427        @Description(shortDefinition="How the reference claim is related", formalDefinition="For example, prior or umbrella." )
428        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-claim-relationship")
429        protected CodeableConcept relationship;
430
431        /**
432         * An alternate organizational reference to the case or file to which this particular claim pertains - e.g. Property/Casualy insurer claim # or Workers Compensation case # .
433         */
434        @Child(name = "reference", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=false)
435        @Description(shortDefinition="Related file or case reference", formalDefinition="An alternate organizational reference to the case or file to which this particular claim pertains - e.g. Property/Casualy insurer claim # or Workers Compensation case # ." )
436        protected Identifier reference;
437
438        private static final long serialVersionUID = -379338905L;
439
440    /**
441     * Constructor
442     */
443      public RelatedClaimComponent() {
444        super();
445      }
446
447        /**
448         * @return {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
449         */
450        public Reference getClaim() { 
451          if (this.claim == null)
452            if (Configuration.errorOnAutoCreate())
453              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
454            else if (Configuration.doAutoCreate())
455              this.claim = new Reference(); // cc
456          return this.claim;
457        }
458
459        public boolean hasClaim() { 
460          return this.claim != null && !this.claim.isEmpty();
461        }
462
463        /**
464         * @param value {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
465         */
466        public RelatedClaimComponent setClaim(Reference value) { 
467          this.claim = value;
468          return this;
469        }
470
471        /**
472         * @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. (Other claims which are related to this claim such as prior claim versions or for related services.)
473         */
474        public Claim getClaimTarget() { 
475          if (this.claimTarget == null)
476            if (Configuration.errorOnAutoCreate())
477              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
478            else if (Configuration.doAutoCreate())
479              this.claimTarget = new Claim(); // aa
480          return this.claimTarget;
481        }
482
483        /**
484         * @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. (Other claims which are related to this claim such as prior claim versions or for related services.)
485         */
486        public RelatedClaimComponent setClaimTarget(Claim value) { 
487          this.claimTarget = value;
488          return this;
489        }
490
491        /**
492         * @return {@link #relationship} (For example, prior or umbrella.)
493         */
494        public CodeableConcept getRelationship() { 
495          if (this.relationship == null)
496            if (Configuration.errorOnAutoCreate())
497              throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
498            else if (Configuration.doAutoCreate())
499              this.relationship = new CodeableConcept(); // cc
500          return this.relationship;
501        }
502
503        public boolean hasRelationship() { 
504          return this.relationship != null && !this.relationship.isEmpty();
505        }
506
507        /**
508         * @param value {@link #relationship} (For example, prior or umbrella.)
509         */
510        public RelatedClaimComponent setRelationship(CodeableConcept value) { 
511          this.relationship = value;
512          return this;
513        }
514
515        /**
516         * @return {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains - e.g. Property/Casualy insurer claim # or Workers Compensation case # .)
517         */
518        public Identifier getReference() { 
519          if (this.reference == null)
520            if (Configuration.errorOnAutoCreate())
521              throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
522            else if (Configuration.doAutoCreate())
523              this.reference = new Identifier(); // cc
524          return this.reference;
525        }
526
527        public boolean hasReference() { 
528          return this.reference != null && !this.reference.isEmpty();
529        }
530
531        /**
532         * @param value {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains - e.g. Property/Casualy insurer claim # or Workers Compensation case # .)
533         */
534        public RelatedClaimComponent setReference(Identifier value) { 
535          this.reference = value;
536          return this;
537        }
538
539        protected void listChildren(List<Property> children) {
540          super.listChildren(children);
541          children.add(new Property("claim", "Reference(Claim)", "Other claims which are related to this claim such as prior claim versions or for related services.", 0, 1, claim));
542          children.add(new Property("relationship", "CodeableConcept", "For example, prior or umbrella.", 0, 1, relationship));
543          children.add(new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains - e.g. Property/Casualy insurer claim # or Workers Compensation case # .", 0, 1, reference));
544        }
545
546        @Override
547        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
548          switch (_hash) {
549          case 94742588: /*claim*/  return new Property("claim", "Reference(Claim)", "Other claims which are related to this claim such as prior claim versions or for related services.", 0, 1, claim);
550          case -261851592: /*relationship*/  return new Property("relationship", "CodeableConcept", "For example, prior or umbrella.", 0, 1, relationship);
551          case -925155509: /*reference*/  return new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains - e.g. Property/Casualy insurer claim # or Workers Compensation case # .", 0, 1, reference);
552          default: return super.getNamedProperty(_hash, _name, _checkValid);
553          }
554
555        }
556
557      @Override
558      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
559        switch (hash) {
560        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
561        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
562        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Identifier
563        default: return super.getProperty(hash, name, checkValid);
564        }
565
566      }
567
568      @Override
569      public Base setProperty(int hash, String name, Base value) throws FHIRException {
570        switch (hash) {
571        case 94742588: // claim
572          this.claim = castToReference(value); // Reference
573          return value;
574        case -261851592: // relationship
575          this.relationship = castToCodeableConcept(value); // CodeableConcept
576          return value;
577        case -925155509: // reference
578          this.reference = castToIdentifier(value); // Identifier
579          return value;
580        default: return super.setProperty(hash, name, value);
581        }
582
583      }
584
585      @Override
586      public Base setProperty(String name, Base value) throws FHIRException {
587        if (name.equals("claim")) {
588          this.claim = castToReference(value); // Reference
589        } else if (name.equals("relationship")) {
590          this.relationship = castToCodeableConcept(value); // CodeableConcept
591        } else if (name.equals("reference")) {
592          this.reference = castToIdentifier(value); // Identifier
593        } else
594          return super.setProperty(name, value);
595        return value;
596      }
597
598      @Override
599      public Base makeProperty(int hash, String name) throws FHIRException {
600        switch (hash) {
601        case 94742588:  return getClaim(); 
602        case -261851592:  return getRelationship(); 
603        case -925155509:  return getReference(); 
604        default: return super.makeProperty(hash, name);
605        }
606
607      }
608
609      @Override
610      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
611        switch (hash) {
612        case 94742588: /*claim*/ return new String[] {"Reference"};
613        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
614        case -925155509: /*reference*/ return new String[] {"Identifier"};
615        default: return super.getTypesForProperty(hash, name);
616        }
617
618      }
619
620      @Override
621      public Base addChild(String name) throws FHIRException {
622        if (name.equals("claim")) {
623          this.claim = new Reference();
624          return this.claim;
625        }
626        else if (name.equals("relationship")) {
627          this.relationship = new CodeableConcept();
628          return this.relationship;
629        }
630        else if (name.equals("reference")) {
631          this.reference = new Identifier();
632          return this.reference;
633        }
634        else
635          return super.addChild(name);
636      }
637
638      public RelatedClaimComponent copy() {
639        RelatedClaimComponent dst = new RelatedClaimComponent();
640        copyValues(dst);
641        dst.claim = claim == null ? null : claim.copy();
642        dst.relationship = relationship == null ? null : relationship.copy();
643        dst.reference = reference == null ? null : reference.copy();
644        return dst;
645      }
646
647      @Override
648      public boolean equalsDeep(Base other_) {
649        if (!super.equalsDeep(other_))
650          return false;
651        if (!(other_ instanceof RelatedClaimComponent))
652          return false;
653        RelatedClaimComponent o = (RelatedClaimComponent) other_;
654        return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true) && compareDeep(reference, o.reference, true)
655          ;
656      }
657
658      @Override
659      public boolean equalsShallow(Base other_) {
660        if (!super.equalsShallow(other_))
661          return false;
662        if (!(other_ instanceof RelatedClaimComponent))
663          return false;
664        RelatedClaimComponent o = (RelatedClaimComponent) other_;
665        return true;
666      }
667
668      public boolean isEmpty() {
669        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference
670          );
671      }
672
673  public String fhirType() {
674    return "ExplanationOfBenefit.related";
675
676  }
677
678  }
679
680    @Block()
681    public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
682        /**
683         * Type of Party to be reimbursed: Subscriber, provider, other.
684         */
685        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
686        @Description(shortDefinition="Type of party: Subscriber, Provider, other", formalDefinition="Type of Party to be reimbursed: Subscriber, provider, other." )
687        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payeetype")
688        protected CodeableConcept type;
689
690        /**
691         * organization | patient | practitioner | relatedperson.
692         */
693        @Child(name = "resource", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=false)
694        @Description(shortDefinition="organization | patient | practitioner | relatedperson", formalDefinition="organization | patient | practitioner | relatedperson." )
695        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-type-link")
696        protected Coding resource;
697
698        /**
699         * Party to be reimbursed: Subscriber, provider, other.
700         */
701        @Child(name = "party", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, RelatedPerson.class}, order=3, min=0, max=1, modifier=false, summary=false)
702        @Description(shortDefinition="Party to receive the payable", formalDefinition="Party to be reimbursed: Subscriber, provider, other." )
703        protected Reference party;
704
705        /**
706         * The actual object that is the target of the reference (Party to be reimbursed: Subscriber, provider, other.)
707         */
708        protected Resource partyTarget;
709
710        private static final long serialVersionUID = -553403531L;
711
712    /**
713     * Constructor
714     */
715      public PayeeComponent() {
716        super();
717      }
718
719        /**
720         * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
721         */
722        public CodeableConcept getType() { 
723          if (this.type == null)
724            if (Configuration.errorOnAutoCreate())
725              throw new Error("Attempt to auto-create PayeeComponent.type");
726            else if (Configuration.doAutoCreate())
727              this.type = new CodeableConcept(); // cc
728          return this.type;
729        }
730
731        public boolean hasType() { 
732          return this.type != null && !this.type.isEmpty();
733        }
734
735        /**
736         * @param value {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
737         */
738        public PayeeComponent setType(CodeableConcept value) { 
739          this.type = value;
740          return this;
741        }
742
743        /**
744         * @return {@link #resource} (organization | patient | practitioner | relatedperson.)
745         */
746        public Coding getResource() { 
747          if (this.resource == null)
748            if (Configuration.errorOnAutoCreate())
749              throw new Error("Attempt to auto-create PayeeComponent.resource");
750            else if (Configuration.doAutoCreate())
751              this.resource = new Coding(); // cc
752          return this.resource;
753        }
754
755        public boolean hasResource() { 
756          return this.resource != null && !this.resource.isEmpty();
757        }
758
759        /**
760         * @param value {@link #resource} (organization | patient | practitioner | relatedperson.)
761         */
762        public PayeeComponent setResource(Coding value) { 
763          this.resource = value;
764          return this;
765        }
766
767        /**
768         * @return {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
769         */
770        public Reference getParty() { 
771          if (this.party == null)
772            if (Configuration.errorOnAutoCreate())
773              throw new Error("Attempt to auto-create PayeeComponent.party");
774            else if (Configuration.doAutoCreate())
775              this.party = new Reference(); // cc
776          return this.party;
777        }
778
779        public boolean hasParty() { 
780          return this.party != null && !this.party.isEmpty();
781        }
782
783        /**
784         * @param value {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
785         */
786        public PayeeComponent setParty(Reference value) { 
787          this.party = value;
788          return this;
789        }
790
791        /**
792         * @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. (Party to be reimbursed: Subscriber, provider, other.)
793         */
794        public Resource getPartyTarget() { 
795          return this.partyTarget;
796        }
797
798        /**
799         * @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. (Party to be reimbursed: Subscriber, provider, other.)
800         */
801        public PayeeComponent setPartyTarget(Resource value) { 
802          this.partyTarget = value;
803          return this;
804        }
805
806        protected void listChildren(List<Property> children) {
807          super.listChildren(children);
808          children.add(new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type));
809          children.add(new Property("resource", "Coding", "organization | patient | practitioner | relatedperson.", 0, 1, resource));
810          children.add(new Property("party", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)", "Party to be reimbursed: Subscriber, provider, other.", 0, 1, party));
811        }
812
813        @Override
814        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
815          switch (_hash) {
816          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type);
817          case -341064690: /*resource*/  return new Property("resource", "Coding", "organization | patient | practitioner | relatedperson.", 0, 1, resource);
818          case 106437350: /*party*/  return new Property("party", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)", "Party to be reimbursed: Subscriber, provider, other.", 0, 1, party);
819          default: return super.getNamedProperty(_hash, _name, _checkValid);
820          }
821
822        }
823
824      @Override
825      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
826        switch (hash) {
827        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
828        case -341064690: /*resource*/ return this.resource == null ? new Base[0] : new Base[] {this.resource}; // Coding
829        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
830        default: return super.getProperty(hash, name, checkValid);
831        }
832
833      }
834
835      @Override
836      public Base setProperty(int hash, String name, Base value) throws FHIRException {
837        switch (hash) {
838        case 3575610: // type
839          this.type = castToCodeableConcept(value); // CodeableConcept
840          return value;
841        case -341064690: // resource
842          this.resource = castToCoding(value); // Coding
843          return value;
844        case 106437350: // party
845          this.party = castToReference(value); // Reference
846          return value;
847        default: return super.setProperty(hash, name, value);
848        }
849
850      }
851
852      @Override
853      public Base setProperty(String name, Base value) throws FHIRException {
854        if (name.equals("type")) {
855          this.type = castToCodeableConcept(value); // CodeableConcept
856        } else if (name.equals("resource")) {
857          this.resource = castToCoding(value); // Coding
858        } else if (name.equals("party")) {
859          this.party = castToReference(value); // Reference
860        } else
861          return super.setProperty(name, value);
862        return value;
863      }
864
865      @Override
866      public Base makeProperty(int hash, String name) throws FHIRException {
867        switch (hash) {
868        case 3575610:  return getType(); 
869        case -341064690:  return getResource(); 
870        case 106437350:  return getParty(); 
871        default: return super.makeProperty(hash, name);
872        }
873
874      }
875
876      @Override
877      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
878        switch (hash) {
879        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
880        case -341064690: /*resource*/ return new String[] {"Coding"};
881        case 106437350: /*party*/ return new String[] {"Reference"};
882        default: return super.getTypesForProperty(hash, name);
883        }
884
885      }
886
887      @Override
888      public Base addChild(String name) throws FHIRException {
889        if (name.equals("type")) {
890          this.type = new CodeableConcept();
891          return this.type;
892        }
893        else if (name.equals("resource")) {
894          this.resource = new Coding();
895          return this.resource;
896        }
897        else if (name.equals("party")) {
898          this.party = new Reference();
899          return this.party;
900        }
901        else
902          return super.addChild(name);
903      }
904
905      public PayeeComponent copy() {
906        PayeeComponent dst = new PayeeComponent();
907        copyValues(dst);
908        dst.type = type == null ? null : type.copy();
909        dst.resource = resource == null ? null : resource.copy();
910        dst.party = party == null ? null : party.copy();
911        return dst;
912      }
913
914      @Override
915      public boolean equalsDeep(Base other_) {
916        if (!super.equalsDeep(other_))
917          return false;
918        if (!(other_ instanceof PayeeComponent))
919          return false;
920        PayeeComponent o = (PayeeComponent) other_;
921        return compareDeep(type, o.type, true) && compareDeep(resource, o.resource, true) && compareDeep(party, o.party, true)
922          ;
923      }
924
925      @Override
926      public boolean equalsShallow(Base other_) {
927        if (!super.equalsShallow(other_))
928          return false;
929        if (!(other_ instanceof PayeeComponent))
930          return false;
931        PayeeComponent o = (PayeeComponent) other_;
932        return true;
933      }
934
935      public boolean isEmpty() {
936        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, resource, party);
937      }
938
939  public String fhirType() {
940    return "ExplanationOfBenefit.payee";
941
942  }
943
944  }
945
946    @Block()
947    public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
948        /**
949         * Sequence of the information element which serves to provide a link.
950         */
951        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
952        @Description(shortDefinition="Information instance identifier", formalDefinition="Sequence of the information element which serves to provide a link." )
953        protected PositiveIntType sequence;
954
955        /**
956         * The general class of the information supplied: information; exception; accident, employment; onset, etc.
957         */
958        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
959        @Description(shortDefinition="General class of information", formalDefinition="The general class of the information supplied: information; exception; accident, employment; onset, etc." )
960        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-informationcategory")
961        protected CodeableConcept category;
962
963        /**
964         * System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought which may influence the adjudication.
965         */
966        @Child(name = "code", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
967        @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 which may influence the adjudication." )
968        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-exception")
969        protected CodeableConcept code;
970
971        /**
972         * The date when or period to which this information refers.
973         */
974        @Child(name = "timing", type = {DateType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
975        @Description(shortDefinition="When it occurred", formalDefinition="The date when or period to which this information refers." )
976        protected Type timing;
977
978        /**
979         * Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.
980         */
981        @Child(name = "value", type = {BooleanType.class, StringType.class, Quantity.class, Attachment.class, Reference.class}, order=5, min=0, max=1, modifier=false, summary=false)
982        @Description(shortDefinition="Additional Data or supporting information", formalDefinition="Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data." )
983        protected Type value;
984
985        /**
986         * For example, provides the reason for: the additional stay, or missing tooth or any other situation where a reason code is required in addition to the content.
987         */
988        @Child(name = "reason", type = {Coding.class}, order=6, min=0, max=1, modifier=false, summary=false)
989        @Description(shortDefinition="Reason associated with the information", formalDefinition="For example, provides the reason for: the additional stay, or missing tooth or any other situation where a reason code is required in addition to the content." )
990        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/missing-tooth-reason")
991        protected Coding reason;
992
993        private static final long serialVersionUID = -410136661L;
994
995    /**
996     * Constructor
997     */
998      public SupportingInformationComponent() {
999        super();
1000      }
1001
1002    /**
1003     * Constructor
1004     */
1005      public SupportingInformationComponent(PositiveIntType sequence, CodeableConcept category) {
1006        super();
1007        this.sequence = sequence;
1008        this.category = category;
1009      }
1010
1011        /**
1012         * @return {@link #sequence} (Sequence of the information element which serves to provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1013         */
1014        public PositiveIntType getSequenceElement() { 
1015          if (this.sequence == null)
1016            if (Configuration.errorOnAutoCreate())
1017              throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
1018            else if (Configuration.doAutoCreate())
1019              this.sequence = new PositiveIntType(); // bb
1020          return this.sequence;
1021        }
1022
1023        public boolean hasSequenceElement() { 
1024          return this.sequence != null && !this.sequence.isEmpty();
1025        }
1026
1027        public boolean hasSequence() { 
1028          return this.sequence != null && !this.sequence.isEmpty();
1029        }
1030
1031        /**
1032         * @param value {@link #sequence} (Sequence of the information element which serves to provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1033         */
1034        public SupportingInformationComponent setSequenceElement(PositiveIntType value) { 
1035          this.sequence = value;
1036          return this;
1037        }
1038
1039        /**
1040         * @return Sequence of the information element which serves to provide a link.
1041         */
1042        public int getSequence() { 
1043          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1044        }
1045
1046        /**
1047         * @param value Sequence of the information element which serves to provide a link.
1048         */
1049        public SupportingInformationComponent setSequence(int value) { 
1050            if (this.sequence == null)
1051              this.sequence = new PositiveIntType();
1052            this.sequence.setValue(value);
1053          return this;
1054        }
1055
1056        /**
1057         * @return {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1058         */
1059        public CodeableConcept getCategory() { 
1060          if (this.category == null)
1061            if (Configuration.errorOnAutoCreate())
1062              throw new Error("Attempt to auto-create SupportingInformationComponent.category");
1063            else if (Configuration.doAutoCreate())
1064              this.category = new CodeableConcept(); // cc
1065          return this.category;
1066        }
1067
1068        public boolean hasCategory() { 
1069          return this.category != null && !this.category.isEmpty();
1070        }
1071
1072        /**
1073         * @param value {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1074         */
1075        public SupportingInformationComponent setCategory(CodeableConcept value) { 
1076          this.category = value;
1077          return this;
1078        }
1079
1080        /**
1081         * @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 which may influence the adjudication.)
1082         */
1083        public CodeableConcept getCode() { 
1084          if (this.code == null)
1085            if (Configuration.errorOnAutoCreate())
1086              throw new Error("Attempt to auto-create SupportingInformationComponent.code");
1087            else if (Configuration.doAutoCreate())
1088              this.code = new CodeableConcept(); // cc
1089          return this.code;
1090        }
1091
1092        public boolean hasCode() { 
1093          return this.code != null && !this.code.isEmpty();
1094        }
1095
1096        /**
1097         * @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 which may influence the adjudication.)
1098         */
1099        public SupportingInformationComponent setCode(CodeableConcept value) { 
1100          this.code = value;
1101          return this;
1102        }
1103
1104        /**
1105         * @return {@link #timing} (The date when or period to which this information refers.)
1106         */
1107        public Type getTiming() { 
1108          return this.timing;
1109        }
1110
1111        /**
1112         * @return {@link #timing} (The date when or period to which this information refers.)
1113         */
1114        public DateType getTimingDateType() throws FHIRException { 
1115          if (this.timing == null)
1116            return null;
1117          if (!(this.timing instanceof DateType))
1118            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.timing.getClass().getName()+" was encountered");
1119          return (DateType) this.timing;
1120        }
1121
1122        public boolean hasTimingDateType() { 
1123          return this != null && this.timing instanceof DateType;
1124        }
1125
1126        /**
1127         * @return {@link #timing} (The date when or period to which this information refers.)
1128         */
1129        public Period getTimingPeriod() throws FHIRException { 
1130          if (this.timing == null)
1131            return null;
1132          if (!(this.timing instanceof Period))
1133            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
1134          return (Period) this.timing;
1135        }
1136
1137        public boolean hasTimingPeriod() { 
1138          return this != null && this.timing instanceof Period;
1139        }
1140
1141        public boolean hasTiming() { 
1142          return this.timing != null && !this.timing.isEmpty();
1143        }
1144
1145        /**
1146         * @param value {@link #timing} (The date when or period to which this information refers.)
1147         */
1148        public SupportingInformationComponent setTiming(Type value) { 
1149          if (value != null && !(value instanceof DateType || value instanceof Period))
1150            throw new Error("Not the right type for ExplanationOfBenefit.information.timing[x]: "+value.fhirType());
1151          this.timing = value;
1152          return this;
1153        }
1154
1155        /**
1156         * @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.)
1157         */
1158        public Type getValue() { 
1159          return this.value;
1160        }
1161
1162        /**
1163         * @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.)
1164         */
1165        public BooleanType getValueBooleanType() throws FHIRException { 
1166          if (this.value == null)
1167            return null;
1168          if (!(this.value instanceof BooleanType))
1169            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
1170          return (BooleanType) this.value;
1171        }
1172
1173        public boolean hasValueBooleanType() { 
1174          return this != null && this.value instanceof BooleanType;
1175        }
1176
1177        /**
1178         * @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.)
1179         */
1180        public StringType getValueStringType() throws FHIRException { 
1181          if (this.value == null)
1182            return null;
1183          if (!(this.value instanceof StringType))
1184            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
1185          return (StringType) this.value;
1186        }
1187
1188        public boolean hasValueStringType() { 
1189          return this != null && this.value instanceof StringType;
1190        }
1191
1192        /**
1193         * @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.)
1194         */
1195        public Quantity getValueQuantity() throws FHIRException { 
1196          if (this.value == null)
1197            return null;
1198          if (!(this.value instanceof Quantity))
1199            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
1200          return (Quantity) this.value;
1201        }
1202
1203        public boolean hasValueQuantity() { 
1204          return this != null && this.value instanceof Quantity;
1205        }
1206
1207        /**
1208         * @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.)
1209         */
1210        public Attachment getValueAttachment() throws FHIRException { 
1211          if (this.value == null)
1212            return null;
1213          if (!(this.value instanceof Attachment))
1214            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
1215          return (Attachment) this.value;
1216        }
1217
1218        public boolean hasValueAttachment() { 
1219          return this != null && this.value instanceof Attachment;
1220        }
1221
1222        /**
1223         * @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.)
1224         */
1225        public Reference getValueReference() throws FHIRException { 
1226          if (this.value == null)
1227            return null;
1228          if (!(this.value instanceof Reference))
1229            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
1230          return (Reference) this.value;
1231        }
1232
1233        public boolean hasValueReference() { 
1234          return this != null && this.value instanceof Reference;
1235        }
1236
1237        public boolean hasValue() { 
1238          return this.value != null && !this.value.isEmpty();
1239        }
1240
1241        /**
1242         * @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.)
1243         */
1244        public SupportingInformationComponent setValue(Type value) { 
1245          if (value != null && !(value instanceof BooleanType || value instanceof StringType || value instanceof Quantity || value instanceof Attachment || value instanceof Reference))
1246            throw new Error("Not the right type for ExplanationOfBenefit.information.value[x]: "+value.fhirType());
1247          this.value = value;
1248          return this;
1249        }
1250
1251        /**
1252         * @return {@link #reason} (For example, provides the reason for: the additional stay, or missing tooth or any other situation where a reason code is required in addition to the content.)
1253         */
1254        public Coding getReason() { 
1255          if (this.reason == null)
1256            if (Configuration.errorOnAutoCreate())
1257              throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1258            else if (Configuration.doAutoCreate())
1259              this.reason = new Coding(); // cc
1260          return this.reason;
1261        }
1262
1263        public boolean hasReason() { 
1264          return this.reason != null && !this.reason.isEmpty();
1265        }
1266
1267        /**
1268         * @param value {@link #reason} (For example, provides the reason for: the additional stay, or missing tooth or any other situation where a reason code is required in addition to the content.)
1269         */
1270        public SupportingInformationComponent setReason(Coding value) { 
1271          this.reason = value;
1272          return this;
1273        }
1274
1275        protected void listChildren(List<Property> children) {
1276          super.listChildren(children);
1277          children.add(new Property("sequence", "positiveInt", "Sequence of the information element which serves to provide a link.", 0, 1, sequence));
1278          children.add(new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category));
1279          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 which may influence the adjudication.", 0, 1, code));
1280          children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing));
1281          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));
1282          children.add(new Property("reason", "Coding", "For example, provides the reason for: the additional stay, or missing tooth or any other situation where a reason code is required in addition to the content.", 0, 1, reason));
1283        }
1284
1285        @Override
1286        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1287          switch (_hash) {
1288          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of the information element which serves to provide a link.", 0, 1, sequence);
1289          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category);
1290          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 which may influence the adjudication.", 0, 1, code);
1291          case 164632566: /*timing[x]*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1292          case -873664438: /*timing*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1293          case 807935768: /*timingDate*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1294          case -615615829: /*timingPeriod*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1295          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);
1296          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);
1297          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);
1298          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);
1299          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);
1300          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);
1301          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);
1302          case -934964668: /*reason*/  return new Property("reason", "Coding", "For example, provides the reason for: the additional stay, or missing tooth or any other situation where a reason code is required in addition to the content.", 0, 1, reason);
1303          default: return super.getNamedProperty(_hash, _name, _checkValid);
1304          }
1305
1306        }
1307
1308      @Override
1309      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1310        switch (hash) {
1311        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1312        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1313        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1314        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Type
1315        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
1316        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
1317        default: return super.getProperty(hash, name, checkValid);
1318        }
1319
1320      }
1321
1322      @Override
1323      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1324        switch (hash) {
1325        case 1349547969: // sequence
1326          this.sequence = castToPositiveInt(value); // PositiveIntType
1327          return value;
1328        case 50511102: // category
1329          this.category = castToCodeableConcept(value); // CodeableConcept
1330          return value;
1331        case 3059181: // code
1332          this.code = castToCodeableConcept(value); // CodeableConcept
1333          return value;
1334        case -873664438: // timing
1335          this.timing = castToType(value); // Type
1336          return value;
1337        case 111972721: // value
1338          this.value = castToType(value); // Type
1339          return value;
1340        case -934964668: // reason
1341          this.reason = castToCoding(value); // Coding
1342          return value;
1343        default: return super.setProperty(hash, name, value);
1344        }
1345
1346      }
1347
1348      @Override
1349      public Base setProperty(String name, Base value) throws FHIRException {
1350        if (name.equals("sequence")) {
1351          this.sequence = castToPositiveInt(value); // PositiveIntType
1352        } else if (name.equals("category")) {
1353          this.category = castToCodeableConcept(value); // CodeableConcept
1354        } else if (name.equals("code")) {
1355          this.code = castToCodeableConcept(value); // CodeableConcept
1356        } else if (name.equals("timing[x]")) {
1357          this.timing = castToType(value); // Type
1358        } else if (name.equals("value[x]")) {
1359          this.value = castToType(value); // Type
1360        } else if (name.equals("reason")) {
1361          this.reason = castToCoding(value); // Coding
1362        } else
1363          return super.setProperty(name, value);
1364        return value;
1365      }
1366
1367      @Override
1368      public Base makeProperty(int hash, String name) throws FHIRException {
1369        switch (hash) {
1370        case 1349547969:  return getSequenceElement();
1371        case 50511102:  return getCategory(); 
1372        case 3059181:  return getCode(); 
1373        case 164632566:  return getTiming(); 
1374        case -873664438:  return getTiming(); 
1375        case -1410166417:  return getValue(); 
1376        case 111972721:  return getValue(); 
1377        case -934964668:  return getReason(); 
1378        default: return super.makeProperty(hash, name);
1379        }
1380
1381      }
1382
1383      @Override
1384      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1385        switch (hash) {
1386        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1387        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1388        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1389        case -873664438: /*timing*/ return new String[] {"date", "Period"};
1390        case 111972721: /*value*/ return new String[] {"boolean", "string", "Quantity", "Attachment", "Reference"};
1391        case -934964668: /*reason*/ return new String[] {"Coding"};
1392        default: return super.getTypesForProperty(hash, name);
1393        }
1394
1395      }
1396
1397      @Override
1398      public Base addChild(String name) throws FHIRException {
1399        if (name.equals("sequence")) {
1400          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1401        }
1402        else if (name.equals("category")) {
1403          this.category = new CodeableConcept();
1404          return this.category;
1405        }
1406        else if (name.equals("code")) {
1407          this.code = new CodeableConcept();
1408          return this.code;
1409        }
1410        else if (name.equals("timingDate")) {
1411          this.timing = new DateType();
1412          return this.timing;
1413        }
1414        else if (name.equals("timingPeriod")) {
1415          this.timing = new Period();
1416          return this.timing;
1417        }
1418        else if (name.equals("valueBoolean")) {
1419          this.value = new BooleanType();
1420          return this.value;
1421        }
1422        else if (name.equals("valueString")) {
1423          this.value = new StringType();
1424          return this.value;
1425        }
1426        else if (name.equals("valueQuantity")) {
1427          this.value = new Quantity();
1428          return this.value;
1429        }
1430        else if (name.equals("valueAttachment")) {
1431          this.value = new Attachment();
1432          return this.value;
1433        }
1434        else if (name.equals("valueReference")) {
1435          this.value = new Reference();
1436          return this.value;
1437        }
1438        else if (name.equals("reason")) {
1439          this.reason = new Coding();
1440          return this.reason;
1441        }
1442        else
1443          return super.addChild(name);
1444      }
1445
1446      public SupportingInformationComponent copy() {
1447        SupportingInformationComponent dst = new SupportingInformationComponent();
1448        copyValues(dst);
1449        dst.sequence = sequence == null ? null : sequence.copy();
1450        dst.category = category == null ? null : category.copy();
1451        dst.code = code == null ? null : code.copy();
1452        dst.timing = timing == null ? null : timing.copy();
1453        dst.value = value == null ? null : value.copy();
1454        dst.reason = reason == null ? null : reason.copy();
1455        return dst;
1456      }
1457
1458      @Override
1459      public boolean equalsDeep(Base other_) {
1460        if (!super.equalsDeep(other_))
1461          return false;
1462        if (!(other_ instanceof SupportingInformationComponent))
1463          return false;
1464        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1465        return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true) && compareDeep(code, o.code, true)
1466           && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true) && compareDeep(reason, o.reason, true)
1467          ;
1468      }
1469
1470      @Override
1471      public boolean equalsShallow(Base other_) {
1472        if (!super.equalsShallow(other_))
1473          return false;
1474        if (!(other_ instanceof SupportingInformationComponent))
1475          return false;
1476        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1477        return compareValues(sequence, o.sequence, true);
1478      }
1479
1480      public boolean isEmpty() {
1481        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code
1482          , timing, value, reason);
1483      }
1484
1485  public String fhirType() {
1486    return "ExplanationOfBenefit.information";
1487
1488  }
1489
1490  }
1491
1492    @Block()
1493    public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
1494        /**
1495         * Sequence of careteam which serves to order and provide a link.
1496         */
1497        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1498        @Description(shortDefinition="Number to convey order of careteam", formalDefinition="Sequence of careteam which serves to order and provide a link." )
1499        protected PositiveIntType sequence;
1500
1501        /**
1502         * The members of the team who provided the overall service.
1503         */
1504        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=2, min=1, max=1, modifier=false, summary=false)
1505        @Description(shortDefinition="Member of the Care Team", formalDefinition="The members of the team who provided the overall service." )
1506        protected Reference provider;
1507
1508        /**
1509         * The actual object that is the target of the reference (The members of the team who provided the overall service.)
1510         */
1511        protected Resource providerTarget;
1512
1513        /**
1514         * The practitioner who is billing and responsible for the claimed services rendered to the patient.
1515         */
1516        @Child(name = "responsible", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
1517        @Description(shortDefinition="Billing practitioner", formalDefinition="The practitioner who is billing and responsible for the claimed services rendered to the patient." )
1518        protected BooleanType responsible;
1519
1520        /**
1521         * The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.
1522         */
1523        @Child(name = "role", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1524        @Description(shortDefinition="Role on the team", formalDefinition="The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team." )
1525        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-careteamrole")
1526        protected CodeableConcept role;
1527
1528        /**
1529         * The qualification which is applicable for this service.
1530         */
1531        @Child(name = "qualification", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1532        @Description(shortDefinition="Type, classification or Specialization", formalDefinition="The qualification which is applicable for this service." )
1533        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provider-qualification")
1534        protected CodeableConcept qualification;
1535
1536        private static final long serialVersionUID = 1758966968L;
1537
1538    /**
1539     * Constructor
1540     */
1541      public CareTeamComponent() {
1542        super();
1543      }
1544
1545    /**
1546     * Constructor
1547     */
1548      public CareTeamComponent(PositiveIntType sequence, Reference provider) {
1549        super();
1550        this.sequence = sequence;
1551        this.provider = provider;
1552      }
1553
1554        /**
1555         * @return {@link #sequence} (Sequence of careteam which serves to order and provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1556         */
1557        public PositiveIntType getSequenceElement() { 
1558          if (this.sequence == null)
1559            if (Configuration.errorOnAutoCreate())
1560              throw new Error("Attempt to auto-create CareTeamComponent.sequence");
1561            else if (Configuration.doAutoCreate())
1562              this.sequence = new PositiveIntType(); // bb
1563          return this.sequence;
1564        }
1565
1566        public boolean hasSequenceElement() { 
1567          return this.sequence != null && !this.sequence.isEmpty();
1568        }
1569
1570        public boolean hasSequence() { 
1571          return this.sequence != null && !this.sequence.isEmpty();
1572        }
1573
1574        /**
1575         * @param value {@link #sequence} (Sequence of careteam which serves to order and provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1576         */
1577        public CareTeamComponent setSequenceElement(PositiveIntType value) { 
1578          this.sequence = value;
1579          return this;
1580        }
1581
1582        /**
1583         * @return Sequence of careteam which serves to order and provide a link.
1584         */
1585        public int getSequence() { 
1586          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1587        }
1588
1589        /**
1590         * @param value Sequence of careteam which serves to order and provide a link.
1591         */
1592        public CareTeamComponent setSequence(int value) { 
1593            if (this.sequence == null)
1594              this.sequence = new PositiveIntType();
1595            this.sequence.setValue(value);
1596          return this;
1597        }
1598
1599        /**
1600         * @return {@link #provider} (The members of the team who provided the overall service.)
1601         */
1602        public Reference getProvider() { 
1603          if (this.provider == null)
1604            if (Configuration.errorOnAutoCreate())
1605              throw new Error("Attempt to auto-create CareTeamComponent.provider");
1606            else if (Configuration.doAutoCreate())
1607              this.provider = new Reference(); // cc
1608          return this.provider;
1609        }
1610
1611        public boolean hasProvider() { 
1612          return this.provider != null && !this.provider.isEmpty();
1613        }
1614
1615        /**
1616         * @param value {@link #provider} (The members of the team who provided the overall service.)
1617         */
1618        public CareTeamComponent setProvider(Reference value) { 
1619          this.provider = value;
1620          return this;
1621        }
1622
1623        /**
1624         * @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 members of the team who provided the overall service.)
1625         */
1626        public Resource getProviderTarget() { 
1627          return this.providerTarget;
1628        }
1629
1630        /**
1631         * @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 members of the team who provided the overall service.)
1632         */
1633        public CareTeamComponent setProviderTarget(Resource value) { 
1634          this.providerTarget = value;
1635          return this;
1636        }
1637
1638        /**
1639         * @return {@link #responsible} (The practitioner who is billing and responsible for the claimed services rendered to the patient.). This is the underlying object with id, value and extensions. The accessor "getResponsible" gives direct access to the value
1640         */
1641        public BooleanType getResponsibleElement() { 
1642          if (this.responsible == null)
1643            if (Configuration.errorOnAutoCreate())
1644              throw new Error("Attempt to auto-create CareTeamComponent.responsible");
1645            else if (Configuration.doAutoCreate())
1646              this.responsible = new BooleanType(); // bb
1647          return this.responsible;
1648        }
1649
1650        public boolean hasResponsibleElement() { 
1651          return this.responsible != null && !this.responsible.isEmpty();
1652        }
1653
1654        public boolean hasResponsible() { 
1655          return this.responsible != null && !this.responsible.isEmpty();
1656        }
1657
1658        /**
1659         * @param value {@link #responsible} (The practitioner who is billing and responsible for the claimed services rendered to the patient.). This is the underlying object with id, value and extensions. The accessor "getResponsible" gives direct access to the value
1660         */
1661        public CareTeamComponent setResponsibleElement(BooleanType value) { 
1662          this.responsible = value;
1663          return this;
1664        }
1665
1666        /**
1667         * @return The practitioner who is billing and responsible for the claimed services rendered to the patient.
1668         */
1669        public boolean getResponsible() { 
1670          return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
1671        }
1672
1673        /**
1674         * @param value The practitioner who is billing and responsible for the claimed services rendered to the patient.
1675         */
1676        public CareTeamComponent setResponsible(boolean value) { 
1677            if (this.responsible == null)
1678              this.responsible = new BooleanType();
1679            this.responsible.setValue(value);
1680          return this;
1681        }
1682
1683        /**
1684         * @return {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.)
1685         */
1686        public CodeableConcept getRole() { 
1687          if (this.role == null)
1688            if (Configuration.errorOnAutoCreate())
1689              throw new Error("Attempt to auto-create CareTeamComponent.role");
1690            else if (Configuration.doAutoCreate())
1691              this.role = new CodeableConcept(); // cc
1692          return this.role;
1693        }
1694
1695        public boolean hasRole() { 
1696          return this.role != null && !this.role.isEmpty();
1697        }
1698
1699        /**
1700         * @param value {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.)
1701         */
1702        public CareTeamComponent setRole(CodeableConcept value) { 
1703          this.role = value;
1704          return this;
1705        }
1706
1707        /**
1708         * @return {@link #qualification} (The qualification which is applicable for this service.)
1709         */
1710        public CodeableConcept getQualification() { 
1711          if (this.qualification == null)
1712            if (Configuration.errorOnAutoCreate())
1713              throw new Error("Attempt to auto-create CareTeamComponent.qualification");
1714            else if (Configuration.doAutoCreate())
1715              this.qualification = new CodeableConcept(); // cc
1716          return this.qualification;
1717        }
1718
1719        public boolean hasQualification() { 
1720          return this.qualification != null && !this.qualification.isEmpty();
1721        }
1722
1723        /**
1724         * @param value {@link #qualification} (The qualification which is applicable for this service.)
1725         */
1726        public CareTeamComponent setQualification(CodeableConcept value) { 
1727          this.qualification = value;
1728          return this;
1729        }
1730
1731        protected void listChildren(List<Property> children) {
1732          super.listChildren(children);
1733          children.add(new Property("sequence", "positiveInt", "Sequence of careteam which serves to order and provide a link.", 0, 1, sequence));
1734          children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The members of the team who provided the overall service.", 0, 1, provider));
1735          children.add(new Property("responsible", "boolean", "The practitioner who is billing and responsible for the claimed services rendered to the patient.", 0, 1, responsible));
1736          children.add(new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.", 0, 1, role));
1737          children.add(new Property("qualification", "CodeableConcept", "The qualification which is applicable for this service.", 0, 1, qualification));
1738        }
1739
1740        @Override
1741        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1742          switch (_hash) {
1743          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of careteam which serves to order and provide a link.", 0, 1, sequence);
1744          case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The members of the team who provided the overall service.", 0, 1, provider);
1745          case 1847674614: /*responsible*/  return new Property("responsible", "boolean", "The practitioner who is billing and responsible for the claimed services rendered to the patient.", 0, 1, responsible);
1746          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.", 0, 1, role);
1747          case -631333393: /*qualification*/  return new Property("qualification", "CodeableConcept", "The qualification which is applicable for this service.", 0, 1, qualification);
1748          default: return super.getNamedProperty(_hash, _name, _checkValid);
1749          }
1750
1751        }
1752
1753      @Override
1754      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1755        switch (hash) {
1756        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1757        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
1758        case 1847674614: /*responsible*/ return this.responsible == null ? new Base[0] : new Base[] {this.responsible}; // BooleanType
1759        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
1760        case -631333393: /*qualification*/ return this.qualification == null ? new Base[0] : new Base[] {this.qualification}; // CodeableConcept
1761        default: return super.getProperty(hash, name, checkValid);
1762        }
1763
1764      }
1765
1766      @Override
1767      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1768        switch (hash) {
1769        case 1349547969: // sequence
1770          this.sequence = castToPositiveInt(value); // PositiveIntType
1771          return value;
1772        case -987494927: // provider
1773          this.provider = castToReference(value); // Reference
1774          return value;
1775        case 1847674614: // responsible
1776          this.responsible = castToBoolean(value); // BooleanType
1777          return value;
1778        case 3506294: // role
1779          this.role = castToCodeableConcept(value); // CodeableConcept
1780          return value;
1781        case -631333393: // qualification
1782          this.qualification = castToCodeableConcept(value); // CodeableConcept
1783          return value;
1784        default: return super.setProperty(hash, name, value);
1785        }
1786
1787      }
1788
1789      @Override
1790      public Base setProperty(String name, Base value) throws FHIRException {
1791        if (name.equals("sequence")) {
1792          this.sequence = castToPositiveInt(value); // PositiveIntType
1793        } else if (name.equals("provider")) {
1794          this.provider = castToReference(value); // Reference
1795        } else if (name.equals("responsible")) {
1796          this.responsible = castToBoolean(value); // BooleanType
1797        } else if (name.equals("role")) {
1798          this.role = castToCodeableConcept(value); // CodeableConcept
1799        } else if (name.equals("qualification")) {
1800          this.qualification = castToCodeableConcept(value); // CodeableConcept
1801        } else
1802          return super.setProperty(name, value);
1803        return value;
1804      }
1805
1806      @Override
1807      public Base makeProperty(int hash, String name) throws FHIRException {
1808        switch (hash) {
1809        case 1349547969:  return getSequenceElement();
1810        case -987494927:  return getProvider(); 
1811        case 1847674614:  return getResponsibleElement();
1812        case 3506294:  return getRole(); 
1813        case -631333393:  return getQualification(); 
1814        default: return super.makeProperty(hash, name);
1815        }
1816
1817      }
1818
1819      @Override
1820      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1821        switch (hash) {
1822        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1823        case -987494927: /*provider*/ return new String[] {"Reference"};
1824        case 1847674614: /*responsible*/ return new String[] {"boolean"};
1825        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
1826        case -631333393: /*qualification*/ return new String[] {"CodeableConcept"};
1827        default: return super.getTypesForProperty(hash, name);
1828        }
1829
1830      }
1831
1832      @Override
1833      public Base addChild(String name) throws FHIRException {
1834        if (name.equals("sequence")) {
1835          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1836        }
1837        else if (name.equals("provider")) {
1838          this.provider = new Reference();
1839          return this.provider;
1840        }
1841        else if (name.equals("responsible")) {
1842          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.responsible");
1843        }
1844        else if (name.equals("role")) {
1845          this.role = new CodeableConcept();
1846          return this.role;
1847        }
1848        else if (name.equals("qualification")) {
1849          this.qualification = new CodeableConcept();
1850          return this.qualification;
1851        }
1852        else
1853          return super.addChild(name);
1854      }
1855
1856      public CareTeamComponent copy() {
1857        CareTeamComponent dst = new CareTeamComponent();
1858        copyValues(dst);
1859        dst.sequence = sequence == null ? null : sequence.copy();
1860        dst.provider = provider == null ? null : provider.copy();
1861        dst.responsible = responsible == null ? null : responsible.copy();
1862        dst.role = role == null ? null : role.copy();
1863        dst.qualification = qualification == null ? null : qualification.copy();
1864        return dst;
1865      }
1866
1867      @Override
1868      public boolean equalsDeep(Base other_) {
1869        if (!super.equalsDeep(other_))
1870          return false;
1871        if (!(other_ instanceof CareTeamComponent))
1872          return false;
1873        CareTeamComponent o = (CareTeamComponent) other_;
1874        return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true) && compareDeep(responsible, o.responsible, true)
1875           && compareDeep(role, o.role, true) && compareDeep(qualification, o.qualification, true);
1876      }
1877
1878      @Override
1879      public boolean equalsShallow(Base other_) {
1880        if (!super.equalsShallow(other_))
1881          return false;
1882        if (!(other_ instanceof CareTeamComponent))
1883          return false;
1884        CareTeamComponent o = (CareTeamComponent) other_;
1885        return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true)
1886          ;
1887      }
1888
1889      public boolean isEmpty() {
1890        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible
1891          , role, qualification);
1892      }
1893
1894  public String fhirType() {
1895    return "ExplanationOfBenefit.careTeam";
1896
1897  }
1898
1899  }
1900
1901    @Block()
1902    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
1903        /**
1904         * Sequence of diagnosis which serves to provide a link.
1905         */
1906        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1907        @Description(shortDefinition="Number to convey order of diagnosis", formalDefinition="Sequence of diagnosis which serves to provide a link." )
1908        protected PositiveIntType sequence;
1909
1910        /**
1911         * The diagnosis.
1912         */
1913        @Child(name = "diagnosis", type = {CodeableConcept.class, Condition.class}, order=2, min=1, max=1, modifier=false, summary=false)
1914        @Description(shortDefinition="Patient's diagnosis", formalDefinition="The diagnosis." )
1915        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10")
1916        protected Type diagnosis;
1917
1918        /**
1919         * The type of the Diagnosis, for example: admitting, primary, secondary, discharge.
1920         */
1921        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1922        @Description(shortDefinition="Timing or nature of the diagnosis", formalDefinition="The type of the Diagnosis, for example: admitting, primary, secondary, discharge." )
1923        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosistype")
1924        protected List<CodeableConcept> type;
1925
1926        /**
1927         * Indication of whether the diagnosis was present on admission to a facility.
1928         */
1929        @Child(name = "onAdmission", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1930        @Description(shortDefinition="Present on admission", formalDefinition="Indication of whether the diagnosis was present on admission to a facility." )
1931        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosis-on-admission")
1932        protected CodeableConcept onAdmission;
1933
1934        /**
1935         * The package billing code, for example DRG, based on the assigned grouping code system.
1936         */
1937        @Child(name = "packageCode", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1938        @Description(shortDefinition="Package billing code", formalDefinition="The package billing code, for example DRG, based on the assigned grouping code system." )
1939        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
1940        protected CodeableConcept packageCode;
1941
1942        private static final long serialVersionUID = 2120593974L;
1943
1944    /**
1945     * Constructor
1946     */
1947      public DiagnosisComponent() {
1948        super();
1949      }
1950
1951    /**
1952     * Constructor
1953     */
1954      public DiagnosisComponent(PositiveIntType sequence, Type diagnosis) {
1955        super();
1956        this.sequence = sequence;
1957        this.diagnosis = diagnosis;
1958      }
1959
1960        /**
1961         * @return {@link #sequence} (Sequence of diagnosis which serves to provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1962         */
1963        public PositiveIntType getSequenceElement() { 
1964          if (this.sequence == null)
1965            if (Configuration.errorOnAutoCreate())
1966              throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
1967            else if (Configuration.doAutoCreate())
1968              this.sequence = new PositiveIntType(); // bb
1969          return this.sequence;
1970        }
1971
1972        public boolean hasSequenceElement() { 
1973          return this.sequence != null && !this.sequence.isEmpty();
1974        }
1975
1976        public boolean hasSequence() { 
1977          return this.sequence != null && !this.sequence.isEmpty();
1978        }
1979
1980        /**
1981         * @param value {@link #sequence} (Sequence of diagnosis which serves to provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1982         */
1983        public DiagnosisComponent setSequenceElement(PositiveIntType value) { 
1984          this.sequence = value;
1985          return this;
1986        }
1987
1988        /**
1989         * @return Sequence of diagnosis which serves to provide a link.
1990         */
1991        public int getSequence() { 
1992          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1993        }
1994
1995        /**
1996         * @param value Sequence of diagnosis which serves to provide a link.
1997         */
1998        public DiagnosisComponent setSequence(int value) { 
1999            if (this.sequence == null)
2000              this.sequence = new PositiveIntType();
2001            this.sequence.setValue(value);
2002          return this;
2003        }
2004
2005        /**
2006         * @return {@link #diagnosis} (The diagnosis.)
2007         */
2008        public Type getDiagnosis() { 
2009          return this.diagnosis;
2010        }
2011
2012        /**
2013         * @return {@link #diagnosis} (The diagnosis.)
2014         */
2015        public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException { 
2016          if (this.diagnosis == null)
2017            return null;
2018          if (!(this.diagnosis instanceof CodeableConcept))
2019            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
2020          return (CodeableConcept) this.diagnosis;
2021        }
2022
2023        public boolean hasDiagnosisCodeableConcept() { 
2024          return this != null && this.diagnosis instanceof CodeableConcept;
2025        }
2026
2027        /**
2028         * @return {@link #diagnosis} (The diagnosis.)
2029         */
2030        public Reference getDiagnosisReference() throws FHIRException { 
2031          if (this.diagnosis == null)
2032            return null;
2033          if (!(this.diagnosis instanceof Reference))
2034            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
2035          return (Reference) this.diagnosis;
2036        }
2037
2038        public boolean hasDiagnosisReference() { 
2039          return this != null && this.diagnosis instanceof Reference;
2040        }
2041
2042        public boolean hasDiagnosis() { 
2043          return this.diagnosis != null && !this.diagnosis.isEmpty();
2044        }
2045
2046        /**
2047         * @param value {@link #diagnosis} (The diagnosis.)
2048         */
2049        public DiagnosisComponent setDiagnosis(Type value) { 
2050          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2051            throw new Error("Not the right type for ExplanationOfBenefit.diagnosis.diagnosis[x]: "+value.fhirType());
2052          this.diagnosis = value;
2053          return this;
2054        }
2055
2056        /**
2057         * @return {@link #type} (The type of the Diagnosis, for example: admitting, primary, secondary, discharge.)
2058         */
2059        public List<CodeableConcept> getType() { 
2060          if (this.type == null)
2061            this.type = new ArrayList<CodeableConcept>();
2062          return this.type;
2063        }
2064
2065        /**
2066         * @return Returns a reference to <code>this</code> for easy method chaining
2067         */
2068        public DiagnosisComponent setType(List<CodeableConcept> theType) { 
2069          this.type = theType;
2070          return this;
2071        }
2072
2073        public boolean hasType() { 
2074          if (this.type == null)
2075            return false;
2076          for (CodeableConcept item : this.type)
2077            if (!item.isEmpty())
2078              return true;
2079          return false;
2080        }
2081
2082        public CodeableConcept addType() { //3
2083          CodeableConcept t = new CodeableConcept();
2084          if (this.type == null)
2085            this.type = new ArrayList<CodeableConcept>();
2086          this.type.add(t);
2087          return t;
2088        }
2089
2090        public DiagnosisComponent addType(CodeableConcept t) { //3
2091          if (t == null)
2092            return this;
2093          if (this.type == null)
2094            this.type = new ArrayList<CodeableConcept>();
2095          this.type.add(t);
2096          return this;
2097        }
2098
2099        /**
2100         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
2101         */
2102        public CodeableConcept getTypeFirstRep() { 
2103          if (getType().isEmpty()) {
2104            addType();
2105          }
2106          return getType().get(0);
2107        }
2108
2109        /**
2110         * @return {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
2111         */
2112        public CodeableConcept getOnAdmission() { 
2113          if (this.onAdmission == null)
2114            if (Configuration.errorOnAutoCreate())
2115              throw new Error("Attempt to auto-create DiagnosisComponent.onAdmission");
2116            else if (Configuration.doAutoCreate())
2117              this.onAdmission = new CodeableConcept(); // cc
2118          return this.onAdmission;
2119        }
2120
2121        public boolean hasOnAdmission() { 
2122          return this.onAdmission != null && !this.onAdmission.isEmpty();
2123        }
2124
2125        /**
2126         * @param value {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
2127         */
2128        public DiagnosisComponent setOnAdmission(CodeableConcept value) { 
2129          this.onAdmission = value;
2130          return this;
2131        }
2132
2133        /**
2134         * @return {@link #packageCode} (The package billing code, for example DRG, based on the assigned grouping code system.)
2135         */
2136        public CodeableConcept getPackageCode() { 
2137          if (this.packageCode == null)
2138            if (Configuration.errorOnAutoCreate())
2139              throw new Error("Attempt to auto-create DiagnosisComponent.packageCode");
2140            else if (Configuration.doAutoCreate())
2141              this.packageCode = new CodeableConcept(); // cc
2142          return this.packageCode;
2143        }
2144
2145        public boolean hasPackageCode() { 
2146          return this.packageCode != null && !this.packageCode.isEmpty();
2147        }
2148
2149        /**
2150         * @param value {@link #packageCode} (The package billing code, for example DRG, based on the assigned grouping code system.)
2151         */
2152        public DiagnosisComponent setPackageCode(CodeableConcept value) { 
2153          this.packageCode = value;
2154          return this;
2155        }
2156
2157        protected void listChildren(List<Property> children) {
2158          super.listChildren(children);
2159          children.add(new Property("sequence", "positiveInt", "Sequence of diagnosis which serves to provide a link.", 0, 1, sequence));
2160          children.add(new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis));
2161          children.add(new Property("type", "CodeableConcept", "The type of the Diagnosis, for example: admitting, primary, secondary, discharge.", 0, java.lang.Integer.MAX_VALUE, type));
2162          children.add(new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission));
2163          children.add(new Property("packageCode", "CodeableConcept", "The package billing code, for example DRG, based on the assigned grouping code system.", 0, 1, packageCode));
2164        }
2165
2166        @Override
2167        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2168          switch (_hash) {
2169          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of diagnosis which serves to provide a link.", 0, 1, sequence);
2170          case -1487009809: /*diagnosis[x]*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
2171          case 1196993265: /*diagnosis*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
2172          case 277781616: /*diagnosisCodeableConcept*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
2173          case 2050454362: /*diagnosisReference*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
2174          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of the Diagnosis, for example: admitting, primary, secondary, discharge.", 0, java.lang.Integer.MAX_VALUE, type);
2175          case -3386134: /*onAdmission*/  return new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission);
2176          case 908444499: /*packageCode*/  return new Property("packageCode", "CodeableConcept", "The package billing code, for example DRG, based on the assigned grouping code system.", 0, 1, packageCode);
2177          default: return super.getNamedProperty(_hash, _name, _checkValid);
2178          }
2179
2180        }
2181
2182      @Override
2183      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2184        switch (hash) {
2185        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2186        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // Type
2187        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2188        case -3386134: /*onAdmission*/ return this.onAdmission == null ? new Base[0] : new Base[] {this.onAdmission}; // CodeableConcept
2189        case 908444499: /*packageCode*/ return this.packageCode == null ? new Base[0] : new Base[] {this.packageCode}; // CodeableConcept
2190        default: return super.getProperty(hash, name, checkValid);
2191        }
2192
2193      }
2194
2195      @Override
2196      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2197        switch (hash) {
2198        case 1349547969: // sequence
2199          this.sequence = castToPositiveInt(value); // PositiveIntType
2200          return value;
2201        case 1196993265: // diagnosis
2202          this.diagnosis = castToType(value); // Type
2203          return value;
2204        case 3575610: // type
2205          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
2206          return value;
2207        case -3386134: // onAdmission
2208          this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2209          return value;
2210        case 908444499: // packageCode
2211          this.packageCode = castToCodeableConcept(value); // CodeableConcept
2212          return value;
2213        default: return super.setProperty(hash, name, value);
2214        }
2215
2216      }
2217
2218      @Override
2219      public Base setProperty(String name, Base value) throws FHIRException {
2220        if (name.equals("sequence")) {
2221          this.sequence = castToPositiveInt(value); // PositiveIntType
2222        } else if (name.equals("diagnosis[x]")) {
2223          this.diagnosis = castToType(value); // Type
2224        } else if (name.equals("type")) {
2225          this.getType().add(castToCodeableConcept(value));
2226        } else if (name.equals("onAdmission")) {
2227          this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2228        } else if (name.equals("packageCode")) {
2229          this.packageCode = castToCodeableConcept(value); // CodeableConcept
2230        } else
2231          return super.setProperty(name, value);
2232        return value;
2233      }
2234
2235      @Override
2236      public Base makeProperty(int hash, String name) throws FHIRException {
2237        switch (hash) {
2238        case 1349547969:  return getSequenceElement();
2239        case -1487009809:  return getDiagnosis(); 
2240        case 1196993265:  return getDiagnosis(); 
2241        case 3575610:  return addType(); 
2242        case -3386134:  return getOnAdmission(); 
2243        case 908444499:  return getPackageCode(); 
2244        default: return super.makeProperty(hash, name);
2245        }
2246
2247      }
2248
2249      @Override
2250      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2251        switch (hash) {
2252        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2253        case 1196993265: /*diagnosis*/ return new String[] {"CodeableConcept", "Reference"};
2254        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2255        case -3386134: /*onAdmission*/ return new String[] {"CodeableConcept"};
2256        case 908444499: /*packageCode*/ return new String[] {"CodeableConcept"};
2257        default: return super.getTypesForProperty(hash, name);
2258        }
2259
2260      }
2261
2262      @Override
2263      public Base addChild(String name) throws FHIRException {
2264        if (name.equals("sequence")) {
2265          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
2266        }
2267        else if (name.equals("diagnosisCodeableConcept")) {
2268          this.diagnosis = new CodeableConcept();
2269          return this.diagnosis;
2270        }
2271        else if (name.equals("diagnosisReference")) {
2272          this.diagnosis = new Reference();
2273          return this.diagnosis;
2274        }
2275        else if (name.equals("type")) {
2276          return addType();
2277        }
2278        else if (name.equals("onAdmission")) {
2279          this.onAdmission = new CodeableConcept();
2280          return this.onAdmission;
2281        }
2282        else if (name.equals("packageCode")) {
2283          this.packageCode = new CodeableConcept();
2284          return this.packageCode;
2285        }
2286        else
2287          return super.addChild(name);
2288      }
2289
2290      public DiagnosisComponent copy() {
2291        DiagnosisComponent dst = new DiagnosisComponent();
2292        copyValues(dst);
2293        dst.sequence = sequence == null ? null : sequence.copy();
2294        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
2295        if (type != null) {
2296          dst.type = new ArrayList<CodeableConcept>();
2297          for (CodeableConcept i : type)
2298            dst.type.add(i.copy());
2299        };
2300        dst.onAdmission = onAdmission == null ? null : onAdmission.copy();
2301        dst.packageCode = packageCode == null ? null : packageCode.copy();
2302        return dst;
2303      }
2304
2305      @Override
2306      public boolean equalsDeep(Base other_) {
2307        if (!super.equalsDeep(other_))
2308          return false;
2309        if (!(other_ instanceof DiagnosisComponent))
2310          return false;
2311        DiagnosisComponent o = (DiagnosisComponent) other_;
2312        return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(type, o.type, true)
2313           && compareDeep(onAdmission, o.onAdmission, true) && compareDeep(packageCode, o.packageCode, true)
2314          ;
2315      }
2316
2317      @Override
2318      public boolean equalsShallow(Base other_) {
2319        if (!super.equalsShallow(other_))
2320          return false;
2321        if (!(other_ instanceof DiagnosisComponent))
2322          return false;
2323        DiagnosisComponent o = (DiagnosisComponent) other_;
2324        return compareValues(sequence, o.sequence, true);
2325      }
2326
2327      public boolean isEmpty() {
2328        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type
2329          , onAdmission, packageCode);
2330      }
2331
2332  public String fhirType() {
2333    return "ExplanationOfBenefit.diagnosis";
2334
2335  }
2336
2337  }
2338
2339    @Block()
2340    public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
2341        /**
2342         * Sequence of procedures which serves to order and provide a link.
2343         */
2344        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2345        @Description(shortDefinition="Procedure sequence for reference", formalDefinition="Sequence of procedures which serves to order and provide a link." )
2346        protected PositiveIntType sequence;
2347
2348        /**
2349         * Date and optionally time the procedure was performed .
2350         */
2351        @Child(name = "date", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
2352        @Description(shortDefinition="When the procedure was performed", formalDefinition="Date and optionally time the procedure was performed ." )
2353        protected DateTimeType date;
2354
2355        /**
2356         * The procedure code.
2357         */
2358        @Child(name = "procedure", type = {CodeableConcept.class, Procedure.class}, order=3, min=1, max=1, modifier=false, summary=false)
2359        @Description(shortDefinition="Patient's list of procedures performed", formalDefinition="The procedure code." )
2360        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10-procedures")
2361        protected Type procedure;
2362
2363        private static final long serialVersionUID = 864307347L;
2364
2365    /**
2366     * Constructor
2367     */
2368      public ProcedureComponent() {
2369        super();
2370      }
2371
2372    /**
2373     * Constructor
2374     */
2375      public ProcedureComponent(PositiveIntType sequence, Type procedure) {
2376        super();
2377        this.sequence = sequence;
2378        this.procedure = procedure;
2379      }
2380
2381        /**
2382         * @return {@link #sequence} (Sequence of procedures which serves to order and provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
2383         */
2384        public PositiveIntType getSequenceElement() { 
2385          if (this.sequence == null)
2386            if (Configuration.errorOnAutoCreate())
2387              throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2388            else if (Configuration.doAutoCreate())
2389              this.sequence = new PositiveIntType(); // bb
2390          return this.sequence;
2391        }
2392
2393        public boolean hasSequenceElement() { 
2394          return this.sequence != null && !this.sequence.isEmpty();
2395        }
2396
2397        public boolean hasSequence() { 
2398          return this.sequence != null && !this.sequence.isEmpty();
2399        }
2400
2401        /**
2402         * @param value {@link #sequence} (Sequence of procedures which serves to order and provide a link.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
2403         */
2404        public ProcedureComponent setSequenceElement(PositiveIntType value) { 
2405          this.sequence = value;
2406          return this;
2407        }
2408
2409        /**
2410         * @return Sequence of procedures which serves to order and provide a link.
2411         */
2412        public int getSequence() { 
2413          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2414        }
2415
2416        /**
2417         * @param value Sequence of procedures which serves to order and provide a link.
2418         */
2419        public ProcedureComponent setSequence(int value) { 
2420            if (this.sequence == null)
2421              this.sequence = new PositiveIntType();
2422            this.sequence.setValue(value);
2423          return this;
2424        }
2425
2426        /**
2427         * @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
2428         */
2429        public DateTimeType getDateElement() { 
2430          if (this.date == null)
2431            if (Configuration.errorOnAutoCreate())
2432              throw new Error("Attempt to auto-create ProcedureComponent.date");
2433            else if (Configuration.doAutoCreate())
2434              this.date = new DateTimeType(); // bb
2435          return this.date;
2436        }
2437
2438        public boolean hasDateElement() { 
2439          return this.date != null && !this.date.isEmpty();
2440        }
2441
2442        public boolean hasDate() { 
2443          return this.date != null && !this.date.isEmpty();
2444        }
2445
2446        /**
2447         * @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
2448         */
2449        public ProcedureComponent setDateElement(DateTimeType value) { 
2450          this.date = value;
2451          return this;
2452        }
2453
2454        /**
2455         * @return Date and optionally time the procedure was performed .
2456         */
2457        public Date getDate() { 
2458          return this.date == null ? null : this.date.getValue();
2459        }
2460
2461        /**
2462         * @param value Date and optionally time the procedure was performed .
2463         */
2464        public ProcedureComponent setDate(Date value) { 
2465          if (value == null)
2466            this.date = null;
2467          else {
2468            if (this.date == null)
2469              this.date = new DateTimeType();
2470            this.date.setValue(value);
2471          }
2472          return this;
2473        }
2474
2475        /**
2476         * @return {@link #procedure} (The procedure code.)
2477         */
2478        public Type getProcedure() { 
2479          return this.procedure;
2480        }
2481
2482        /**
2483         * @return {@link #procedure} (The procedure code.)
2484         */
2485        public CodeableConcept getProcedureCodeableConcept() throws FHIRException { 
2486          if (this.procedure == null)
2487            return null;
2488          if (!(this.procedure instanceof CodeableConcept))
2489            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.procedure.getClass().getName()+" was encountered");
2490          return (CodeableConcept) this.procedure;
2491        }
2492
2493        public boolean hasProcedureCodeableConcept() { 
2494          return this != null && this.procedure instanceof CodeableConcept;
2495        }
2496
2497        /**
2498         * @return {@link #procedure} (The procedure code.)
2499         */
2500        public Reference getProcedureReference() throws FHIRException { 
2501          if (this.procedure == null)
2502            return null;
2503          if (!(this.procedure instanceof Reference))
2504            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.procedure.getClass().getName()+" was encountered");
2505          return (Reference) this.procedure;
2506        }
2507
2508        public boolean hasProcedureReference() { 
2509          return this != null && this.procedure instanceof Reference;
2510        }
2511
2512        public boolean hasProcedure() { 
2513          return this.procedure != null && !this.procedure.isEmpty();
2514        }
2515
2516        /**
2517         * @param value {@link #procedure} (The procedure code.)
2518         */
2519        public ProcedureComponent setProcedure(Type value) { 
2520          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2521            throw new Error("Not the right type for ExplanationOfBenefit.procedure.procedure[x]: "+value.fhirType());
2522          this.procedure = value;
2523          return this;
2524        }
2525
2526        protected void listChildren(List<Property> children) {
2527          super.listChildren(children);
2528          children.add(new Property("sequence", "positiveInt", "Sequence of procedures which serves to order and provide a link.", 0, 1, sequence));
2529          children.add(new Property("date", "dateTime", "Date and optionally time the procedure was performed .", 0, 1, date));
2530          children.add(new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure));
2531        }
2532
2533        @Override
2534        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2535          switch (_hash) {
2536          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of procedures which serves to order and provide a link.", 0, 1, sequence);
2537          case 3076014: /*date*/  return new Property("date", "dateTime", "Date and optionally time the procedure was performed .", 0, 1, date);
2538          case 1640074445: /*procedure[x]*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2539          case -1095204141: /*procedure*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2540          case -1284783026: /*procedureCodeableConcept*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2541          case 881809848: /*procedureReference*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2542          default: return super.getNamedProperty(_hash, _name, _checkValid);
2543          }
2544
2545        }
2546
2547      @Override
2548      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2549        switch (hash) {
2550        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2551        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2552        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // Type
2553        default: return super.getProperty(hash, name, checkValid);
2554        }
2555
2556      }
2557
2558      @Override
2559      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2560        switch (hash) {
2561        case 1349547969: // sequence
2562          this.sequence = castToPositiveInt(value); // PositiveIntType
2563          return value;
2564        case 3076014: // date
2565          this.date = castToDateTime(value); // DateTimeType
2566          return value;
2567        case -1095204141: // procedure
2568          this.procedure = castToType(value); // Type
2569          return value;
2570        default: return super.setProperty(hash, name, value);
2571        }
2572
2573      }
2574
2575      @Override
2576      public Base setProperty(String name, Base value) throws FHIRException {
2577        if (name.equals("sequence")) {
2578          this.sequence = castToPositiveInt(value); // PositiveIntType
2579        } else if (name.equals("date")) {
2580          this.date = castToDateTime(value); // DateTimeType
2581        } else if (name.equals("procedure[x]")) {
2582          this.procedure = castToType(value); // Type
2583        } else
2584          return super.setProperty(name, value);
2585        return value;
2586      }
2587
2588      @Override
2589      public Base makeProperty(int hash, String name) throws FHIRException {
2590        switch (hash) {
2591        case 1349547969:  return getSequenceElement();
2592        case 3076014:  return getDateElement();
2593        case 1640074445:  return getProcedure(); 
2594        case -1095204141:  return getProcedure(); 
2595        default: return super.makeProperty(hash, name);
2596        }
2597
2598      }
2599
2600      @Override
2601      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2602        switch (hash) {
2603        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2604        case 3076014: /*date*/ return new String[] {"dateTime"};
2605        case -1095204141: /*procedure*/ return new String[] {"CodeableConcept", "Reference"};
2606        default: return super.getTypesForProperty(hash, name);
2607        }
2608
2609      }
2610
2611      @Override
2612      public Base addChild(String name) throws FHIRException {
2613        if (name.equals("sequence")) {
2614          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
2615        }
2616        else if (name.equals("date")) {
2617          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
2618        }
2619        else if (name.equals("procedureCodeableConcept")) {
2620          this.procedure = new CodeableConcept();
2621          return this.procedure;
2622        }
2623        else if (name.equals("procedureReference")) {
2624          this.procedure = new Reference();
2625          return this.procedure;
2626        }
2627        else
2628          return super.addChild(name);
2629      }
2630
2631      public ProcedureComponent copy() {
2632        ProcedureComponent dst = new ProcedureComponent();
2633        copyValues(dst);
2634        dst.sequence = sequence == null ? null : sequence.copy();
2635        dst.date = date == null ? null : date.copy();
2636        dst.procedure = procedure == null ? null : procedure.copy();
2637        return dst;
2638      }
2639
2640      @Override
2641      public boolean equalsDeep(Base other_) {
2642        if (!super.equalsDeep(other_))
2643          return false;
2644        if (!(other_ instanceof ProcedureComponent))
2645          return false;
2646        ProcedureComponent o = (ProcedureComponent) other_;
2647        return compareDeep(sequence, o.sequence, true) && compareDeep(date, o.date, true) && compareDeep(procedure, o.procedure, true)
2648          ;
2649      }
2650
2651      @Override
2652      public boolean equalsShallow(Base other_) {
2653        if (!super.equalsShallow(other_))
2654          return false;
2655        if (!(other_ instanceof ProcedureComponent))
2656          return false;
2657        ProcedureComponent o = (ProcedureComponent) other_;
2658        return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
2659      }
2660
2661      public boolean isEmpty() {
2662        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, date, procedure
2663          );
2664      }
2665
2666  public String fhirType() {
2667    return "ExplanationOfBenefit.procedure";
2668
2669  }
2670
2671  }
2672
2673    @Block()
2674    public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
2675        /**
2676         * The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim was adjudicated.
2677         */
2678        @Child(name = "focal", type = {BooleanType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2679        @Description(shortDefinition="Is the focal Coverage", formalDefinition="The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim was adjudicated." )
2680        protected BooleanType focal;
2681
2682        /**
2683         * Reference to the program or plan identification, underwriter or payor.
2684         */
2685        @Child(name = "coverage", type = {Coverage.class}, order=2, min=1, max=1, modifier=false, summary=false)
2686        @Description(shortDefinition="Insurance information", formalDefinition="Reference to the program or plan identification, underwriter or payor." )
2687        protected Reference coverage;
2688
2689        /**
2690         * The actual object that is the target of the reference (Reference to the program or plan identification, underwriter or payor.)
2691         */
2692        protected Coverage coverageTarget;
2693
2694        private static final long serialVersionUID = 668686623L;
2695
2696    /**
2697     * Constructor
2698     */
2699      public InsuranceComponent() {
2700        super();
2701      }
2702
2703    /**
2704     * Constructor
2705     */
2706      public InsuranceComponent(BooleanType focal, Reference coverage) {
2707        super();
2708        this.focal = focal;
2709        this.coverage = coverage;
2710      }
2711
2712        /**
2713         * @return {@link #focal} (The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim was adjudicated.). This is the underlying object with id, value and extensions. The accessor "getFocal" gives direct access to the value
2714         */
2715        public BooleanType getFocalElement() { 
2716          if (this.focal == null)
2717            if (Configuration.errorOnAutoCreate())
2718              throw new Error("Attempt to auto-create InsuranceComponent.focal");
2719            else if (Configuration.doAutoCreate())
2720              this.focal = new BooleanType(); // bb
2721          return this.focal;
2722        }
2723
2724        public boolean hasFocalElement() { 
2725          return this.focal != null && !this.focal.isEmpty();
2726        }
2727
2728        public boolean hasFocal() { 
2729          return this.focal != null && !this.focal.isEmpty();
2730        }
2731
2732        /**
2733         * @param value {@link #focal} (The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim was adjudicated.). This is the underlying object with id, value and extensions. The accessor "getFocal" gives direct access to the value
2734         */
2735        public InsuranceComponent setFocalElement(BooleanType value) { 
2736          this.focal = value;
2737          return this;
2738        }
2739
2740        /**
2741         * @return The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim was adjudicated.
2742         */
2743        public boolean getFocal() { 
2744          return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
2745        }
2746
2747        /**
2748         * @param value The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim was adjudicated.
2749         */
2750        public InsuranceComponent setFocal(boolean value) { 
2751            if (this.focal == null)
2752              this.focal = new BooleanType();
2753            this.focal.setValue(value);
2754          return this;
2755        }
2756
2757        /**
2758         * @return {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
2759         */
2760        public Reference getCoverage() { 
2761          if (this.coverage == null)
2762            if (Configuration.errorOnAutoCreate())
2763              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2764            else if (Configuration.doAutoCreate())
2765              this.coverage = new Reference(); // cc
2766          return this.coverage;
2767        }
2768
2769        public boolean hasCoverage() { 
2770          return this.coverage != null && !this.coverage.isEmpty();
2771        }
2772
2773        /**
2774         * @param value {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
2775         */
2776        public InsuranceComponent setCoverage(Reference value) { 
2777          this.coverage = value;
2778          return this;
2779        }
2780
2781        /**
2782         * @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 program or plan identification, underwriter or payor.)
2783         */
2784        public Coverage getCoverageTarget() { 
2785          if (this.coverageTarget == null)
2786            if (Configuration.errorOnAutoCreate())
2787              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2788            else if (Configuration.doAutoCreate())
2789              this.coverageTarget = new Coverage(); // aa
2790          return this.coverageTarget;
2791        }
2792
2793        /**
2794         * @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 program or plan identification, underwriter or payor.)
2795         */
2796        public InsuranceComponent setCoverageTarget(Coverage value) { 
2797          this.coverageTarget = value;
2798          return this;
2799        }
2800
2801        protected void listChildren(List<Property> children) {
2802          super.listChildren(children);
2803          children.add(new Property("focal", "boolean", "The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim was adjudicated.", 0, 1, focal));
2804          children.add(new Property("coverage", "Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, 1, coverage));
2805        }
2806
2807        @Override
2808        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2809          switch (_hash) {
2810          case 97604197: /*focal*/  return new Property("focal", "boolean", "The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim was adjudicated.", 0, 1, focal);
2811          case -351767064: /*coverage*/  return new Property("coverage", "Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, 1, coverage);
2812          default: return super.getNamedProperty(_hash, _name, _checkValid);
2813          }
2814
2815        }
2816
2817      @Override
2818      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2819        switch (hash) {
2820        case 97604197: /*focal*/ return this.focal == null ? new Base[0] : new Base[] {this.focal}; // BooleanType
2821        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
2822        default: return super.getProperty(hash, name, checkValid);
2823        }
2824
2825      }
2826
2827      @Override
2828      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2829        switch (hash) {
2830        case 97604197: // focal
2831          this.focal = castToBoolean(value); // BooleanType
2832          return value;
2833        case -351767064: // coverage
2834          this.coverage = castToReference(value); // Reference
2835          return value;
2836        default: return super.setProperty(hash, name, value);
2837        }
2838
2839      }
2840
2841      @Override
2842      public Base setProperty(String name, Base value) throws FHIRException {
2843        if (name.equals("focal")) {
2844          this.focal = castToBoolean(value); // BooleanType
2845        } else if (name.equals("coverage")) {
2846          this.coverage = castToReference(value); // Reference
2847        } else
2848          return super.setProperty(name, value);
2849        return value;
2850      }
2851
2852      @Override
2853      public Base makeProperty(int hash, String name) throws FHIRException {
2854        switch (hash) {
2855        case 97604197:  return getFocalElement();
2856        case -351767064:  return getCoverage(); 
2857        default: return super.makeProperty(hash, name);
2858        }
2859
2860      }
2861
2862      @Override
2863      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2864        switch (hash) {
2865        case 97604197: /*focal*/ return new String[] {"boolean"};
2866        case -351767064: /*coverage*/ return new String[] {"Reference"};
2867        default: return super.getTypesForProperty(hash, name);
2868        }
2869
2870      }
2871
2872      @Override
2873      public Base addChild(String name) throws FHIRException {
2874        if (name.equals("focal")) {
2875          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.focal");
2876        }
2877        else if (name.equals("coverage")) {
2878          this.coverage = new Reference();
2879          return this.coverage;
2880        }
2881        else
2882          return super.addChild(name);
2883      }
2884
2885      public InsuranceComponent copy() {
2886        InsuranceComponent dst = new InsuranceComponent();
2887        copyValues(dst);
2888        dst.focal = focal == null ? null : focal.copy();
2889        dst.coverage = coverage == null ? null : coverage.copy();
2890        return dst;
2891      }
2892
2893      @Override
2894      public boolean equalsDeep(Base other_) {
2895        if (!super.equalsDeep(other_))
2896          return false;
2897        if (!(other_ instanceof InsuranceComponent))
2898          return false;
2899        InsuranceComponent o = (InsuranceComponent) other_;
2900        return compareDeep(focal, o.focal, true) && compareDeep(coverage, o.coverage, true);
2901      }
2902
2903      @Override
2904      public boolean equalsShallow(Base other_) {
2905        if (!super.equalsShallow(other_))
2906          return false;
2907        if (!(other_ instanceof InsuranceComponent))
2908          return false;
2909        InsuranceComponent o = (InsuranceComponent) other_;
2910        return compareValues(focal, o.focal, true);
2911      }
2912
2913      public boolean isEmpty() {
2914        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(focal, coverage);
2915      }
2916
2917  public String fhirType() {
2918    return "ExplanationOfBenefit.insurance";
2919
2920  }
2921
2922  }
2923
2924    @Block()
2925    public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
2926        /**
2927         * Date of an accident which these services are addressing.
2928         */
2929        @Child(name = "date", type = {DateType.class}, order=1, min=0, max=1, modifier=false, summary=false)
2930        @Description(shortDefinition="When the accident occurred", formalDefinition="Date of an accident which these services are addressing." )
2931        protected DateType date;
2932
2933        /**
2934         * Type of accident: work, auto, etc.
2935         */
2936        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
2937        @Description(shortDefinition="The nature of the accident", formalDefinition="Type of accident: work, auto, etc." )
2938        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActIncidentCode")
2939        protected CodeableConcept type;
2940
2941        /**
2942         * Where the accident occurred.
2943         */
2944        @Child(name = "location", type = {Address.class, Location.class}, order=3, min=0, max=1, modifier=false, summary=false)
2945        @Description(shortDefinition="Accident Place", formalDefinition="Where the accident occurred." )
2946        protected Type location;
2947
2948        private static final long serialVersionUID = 622904984L;
2949
2950    /**
2951     * Constructor
2952     */
2953      public AccidentComponent() {
2954        super();
2955      }
2956
2957        /**
2958         * @return {@link #date} (Date of an accident which these services are addressing.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2959         */
2960        public DateType getDateElement() { 
2961          if (this.date == null)
2962            if (Configuration.errorOnAutoCreate())
2963              throw new Error("Attempt to auto-create AccidentComponent.date");
2964            else if (Configuration.doAutoCreate())
2965              this.date = new DateType(); // bb
2966          return this.date;
2967        }
2968
2969        public boolean hasDateElement() { 
2970          return this.date != null && !this.date.isEmpty();
2971        }
2972
2973        public boolean hasDate() { 
2974          return this.date != null && !this.date.isEmpty();
2975        }
2976
2977        /**
2978         * @param value {@link #date} (Date of an accident which these services are addressing.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2979         */
2980        public AccidentComponent setDateElement(DateType value) { 
2981          this.date = value;
2982          return this;
2983        }
2984
2985        /**
2986         * @return Date of an accident which these services are addressing.
2987         */
2988        public Date getDate() { 
2989          return this.date == null ? null : this.date.getValue();
2990        }
2991
2992        /**
2993         * @param value Date of an accident which these services are addressing.
2994         */
2995        public AccidentComponent setDate(Date value) { 
2996          if (value == null)
2997            this.date = null;
2998          else {
2999            if (this.date == null)
3000              this.date = new DateType();
3001            this.date.setValue(value);
3002          }
3003          return this;
3004        }
3005
3006        /**
3007         * @return {@link #type} (Type of accident: work, auto, etc.)
3008         */
3009        public CodeableConcept getType() { 
3010          if (this.type == null)
3011            if (Configuration.errorOnAutoCreate())
3012              throw new Error("Attempt to auto-create AccidentComponent.type");
3013            else if (Configuration.doAutoCreate())
3014              this.type = new CodeableConcept(); // cc
3015          return this.type;
3016        }
3017
3018        public boolean hasType() { 
3019          return this.type != null && !this.type.isEmpty();
3020        }
3021
3022        /**
3023         * @param value {@link #type} (Type of accident: work, auto, etc.)
3024         */
3025        public AccidentComponent setType(CodeableConcept value) { 
3026          this.type = value;
3027          return this;
3028        }
3029
3030        /**
3031         * @return {@link #location} (Where the accident occurred.)
3032         */
3033        public Type getLocation() { 
3034          return this.location;
3035        }
3036
3037        /**
3038         * @return {@link #location} (Where the accident occurred.)
3039         */
3040        public Address getLocationAddress() throws FHIRException { 
3041          if (this.location == null)
3042            return null;
3043          if (!(this.location instanceof Address))
3044            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
3045          return (Address) this.location;
3046        }
3047
3048        public boolean hasLocationAddress() { 
3049          return this != null && this.location instanceof Address;
3050        }
3051
3052        /**
3053         * @return {@link #location} (Where the accident occurred.)
3054         */
3055        public Reference getLocationReference() throws FHIRException { 
3056          if (this.location == null)
3057            return null;
3058          if (!(this.location instanceof Reference))
3059            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
3060          return (Reference) this.location;
3061        }
3062
3063        public boolean hasLocationReference() { 
3064          return this != null && this.location instanceof Reference;
3065        }
3066
3067        public boolean hasLocation() { 
3068          return this.location != null && !this.location.isEmpty();
3069        }
3070
3071        /**
3072         * @param value {@link #location} (Where the accident occurred.)
3073         */
3074        public AccidentComponent setLocation(Type value) { 
3075          if (value != null && !(value instanceof Address || value instanceof Reference))
3076            throw new Error("Not the right type for ExplanationOfBenefit.accident.location[x]: "+value.fhirType());
3077          this.location = value;
3078          return this;
3079        }
3080
3081        protected void listChildren(List<Property> children) {
3082          super.listChildren(children);
3083          children.add(new Property("date", "date", "Date of an accident which these services are addressing.", 0, 1, date));
3084          children.add(new Property("type", "CodeableConcept", "Type of accident: work, auto, etc.", 0, 1, type));
3085          children.add(new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location));
3086        }
3087
3088        @Override
3089        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3090          switch (_hash) {
3091          case 3076014: /*date*/  return new Property("date", "date", "Date of an accident which these services are addressing.", 0, 1, date);
3092          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of accident: work, auto, etc.", 0, 1, type);
3093          case 552316075: /*location[x]*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
3094          case 1901043637: /*location*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
3095          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
3096          case 755866390: /*locationReference*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
3097          default: return super.getNamedProperty(_hash, _name, _checkValid);
3098          }
3099
3100        }
3101
3102      @Override
3103      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3104        switch (hash) {
3105        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
3106        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3107        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
3108        default: return super.getProperty(hash, name, checkValid);
3109        }
3110
3111      }
3112
3113      @Override
3114      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3115        switch (hash) {
3116        case 3076014: // date
3117          this.date = castToDate(value); // DateType
3118          return value;
3119        case 3575610: // type
3120          this.type = castToCodeableConcept(value); // CodeableConcept
3121          return value;
3122        case 1901043637: // location
3123          this.location = castToType(value); // Type
3124          return value;
3125        default: return super.setProperty(hash, name, value);
3126        }
3127
3128      }
3129
3130      @Override
3131      public Base setProperty(String name, Base value) throws FHIRException {
3132        if (name.equals("date")) {
3133          this.date = castToDate(value); // DateType
3134        } else if (name.equals("type")) {
3135          this.type = castToCodeableConcept(value); // CodeableConcept
3136        } else if (name.equals("location[x]")) {
3137          this.location = castToType(value); // Type
3138        } else
3139          return super.setProperty(name, value);
3140        return value;
3141      }
3142
3143      @Override
3144      public Base makeProperty(int hash, String name) throws FHIRException {
3145        switch (hash) {
3146        case 3076014:  return getDateElement();
3147        case 3575610:  return getType(); 
3148        case 552316075:  return getLocation(); 
3149        case 1901043637:  return getLocation(); 
3150        default: return super.makeProperty(hash, name);
3151        }
3152
3153      }
3154
3155      @Override
3156      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3157        switch (hash) {
3158        case 3076014: /*date*/ return new String[] {"date"};
3159        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3160        case 1901043637: /*location*/ return new String[] {"Address", "Reference"};
3161        default: return super.getTypesForProperty(hash, name);
3162        }
3163
3164      }
3165
3166      @Override
3167      public Base addChild(String name) throws FHIRException {
3168        if (name.equals("date")) {
3169          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
3170        }
3171        else if (name.equals("type")) {
3172          this.type = new CodeableConcept();
3173          return this.type;
3174        }
3175        else if (name.equals("locationAddress")) {
3176          this.location = new Address();
3177          return this.location;
3178        }
3179        else if (name.equals("locationReference")) {
3180          this.location = new Reference();
3181          return this.location;
3182        }
3183        else
3184          return super.addChild(name);
3185      }
3186
3187      public AccidentComponent copy() {
3188        AccidentComponent dst = new AccidentComponent();
3189        copyValues(dst);
3190        dst.date = date == null ? null : date.copy();
3191        dst.type = type == null ? null : type.copy();
3192        dst.location = location == null ? null : location.copy();
3193        return dst;
3194      }
3195
3196      @Override
3197      public boolean equalsDeep(Base other_) {
3198        if (!super.equalsDeep(other_))
3199          return false;
3200        if (!(other_ instanceof AccidentComponent))
3201          return false;
3202        AccidentComponent o = (AccidentComponent) other_;
3203        return compareDeep(date, o.date, true) && compareDeep(type, o.type, true) && compareDeep(location, o.location, true)
3204          ;
3205      }
3206
3207      @Override
3208      public boolean equalsShallow(Base other_) {
3209        if (!super.equalsShallow(other_))
3210          return false;
3211        if (!(other_ instanceof AccidentComponent))
3212          return false;
3213        AccidentComponent o = (AccidentComponent) other_;
3214        return compareValues(date, o.date, true);
3215      }
3216
3217      public boolean isEmpty() {
3218        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
3219      }
3220
3221  public String fhirType() {
3222    return "ExplanationOfBenefit.accident";
3223
3224  }
3225
3226  }
3227
3228    @Block()
3229    public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
3230        /**
3231         * A service line number.
3232         */
3233        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
3234        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
3235        protected PositiveIntType sequence;
3236
3237        /**
3238         * Careteam applicable for this service or product line.
3239         */
3240        @Child(name = "careTeamSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3241        @Description(shortDefinition="Applicable careteam members", formalDefinition="Careteam applicable for this service or product line." )
3242        protected List<PositiveIntType> careTeamSequence;
3243
3244        /**
3245         * Diagnosis applicable for this service or product line.
3246         */
3247        @Child(name = "diagnosisSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3248        @Description(shortDefinition="Applicable diagnoses", formalDefinition="Diagnosis applicable for this service or product line." )
3249        protected List<PositiveIntType> diagnosisSequence;
3250
3251        /**
3252         * Procedures applicable for this service or product line.
3253         */
3254        @Child(name = "procedureSequence", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3255        @Description(shortDefinition="Applicable procedures", formalDefinition="Procedures applicable for this service or product line." )
3256        protected List<PositiveIntType> procedureSequence;
3257
3258        /**
3259         * Exceptions, special conditions and supporting information pplicable for this service or product line.
3260         */
3261        @Child(name = "informationSequence", type = {PositiveIntType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3262        @Description(shortDefinition="Applicable exception and supporting information", formalDefinition="Exceptions, special conditions and supporting information pplicable for this service or product line." )
3263        protected List<PositiveIntType> informationSequence;
3264
3265        /**
3266         * The type of revenue or cost center providing the product and/or service.
3267         */
3268        @Child(name = "revenue", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
3269        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
3270        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
3271        protected CodeableConcept revenue;
3272
3273        /**
3274         * Health Care Service Type Codes  to identify the classification of service or benefits.
3275         */
3276        @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
3277        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
3278        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
3279        protected CodeableConcept category;
3280
3281        /**
3282         * If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.
3283         */
3284        @Child(name = "billcode", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
3285        @Description(shortDefinition="Billing Code", formalDefinition="If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'." )
3286        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
3287        protected CodeableConcept billcode;
3288
3289        /**
3290         * Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.
3291         */
3292        @Child(name = "modifier", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3293        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours." )
3294        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
3295        protected List<CodeableConcept> modifier;
3296
3297        /**
3298         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
3299         */
3300        @Child(name = "programCode", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3301        @Description(shortDefinition="Program specific reason for item inclusion", formalDefinition="For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program." )
3302        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
3303        protected List<CodeableConcept> programCode;
3304
3305        /**
3306         * The date or dates when the service or product was supplied, performed or completed.
3307         */
3308        @Child(name = "serviced", type = {DateType.class, Period.class}, order=11, min=0, max=1, modifier=false, summary=false)
3309        @Description(shortDefinition="Date or dates of Service", formalDefinition="The date or dates when the service or product was supplied, performed or completed." )
3310        protected Type serviced;
3311
3312        /**
3313         * Where the service was provided.
3314         */
3315        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
3316        @Description(shortDefinition="Place of service", formalDefinition="Where the service was provided." )
3317        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
3318        protected Type location;
3319
3320        /**
3321         * The number of repetitions of a service or product.
3322         */
3323        @Child(name = "quantity", type = {Quantity.class}, order=13, min=0, max=1, modifier=false, summary=false)
3324        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
3325        protected Quantity quantity;
3326
3327        /**
3328         * If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.
3329         */
3330        @Child(name = "unitPrice", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
3331        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group." )
3332        protected Money unitPrice;
3333
3334        /**
3335         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3336         */
3337        @Child(name = "factor", type = {DecimalType.class}, order=15, min=0, max=1, modifier=false, summary=false)
3338        @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." )
3339        protected DecimalType factor;
3340
3341        /**
3342         * The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
3343         */
3344        @Child(name = "net", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=false)
3345        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
3346        protected Money net;
3347
3348        /**
3349         * List of Unique Device Identifiers associated with this line item.
3350         */
3351        @Child(name = "udi", type = {Device.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3352        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
3353        protected List<Reference> udi;
3354        /**
3355         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
3356         */
3357        protected List<Device> udiTarget;
3358
3359
3360        /**
3361         * Physical service site on the patient (limb, tooth, etc.).
3362         */
3363        @Child(name = "bodySite", type = {CodeableConcept.class}, order=18, min=0, max=1, modifier=false, summary=false)
3364        @Description(shortDefinition="Service Location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
3365        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
3366        protected CodeableConcept bodySite;
3367
3368        /**
3369         * A region or surface of the site, e.g. limb region or tooth surface(s).
3370         */
3371        @Child(name = "subSite", type = {CodeableConcept.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3372        @Description(shortDefinition="Service Sub-location", formalDefinition="A region or surface of the site, e.g. limb region or tooth surface(s)." )
3373        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
3374        protected List<CodeableConcept> subSite;
3375
3376        /**
3377         * A billed item may include goods or services provided in multiple encounters.
3378         */
3379        @Child(name = "encounter", type = {Encounter.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3380        @Description(shortDefinition="Encounters related to this billed item", formalDefinition="A billed item may include goods or services provided in multiple encounters." )
3381        protected List<Reference> encounter;
3382        /**
3383         * The actual objects that are the target of the reference (A billed item may include goods or services provided in multiple encounters.)
3384         */
3385        protected List<Encounter> encounterTarget;
3386
3387
3388        /**
3389         * A list of note references to the notes provided below.
3390         */
3391        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3392        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
3393        protected List<PositiveIntType> noteNumber;
3394
3395        /**
3396         * The adjudication results.
3397         */
3398        @Child(name = "adjudication", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3399        @Description(shortDefinition="Adjudication details", formalDefinition="The adjudication results." )
3400        protected List<AdjudicationComponent> adjudication;
3401
3402        /**
3403         * Second-tier of goods and services.
3404         */
3405        @Child(name = "detail", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3406        @Description(shortDefinition="Additional items", formalDefinition="Second-tier of goods and services." )
3407        protected List<DetailComponent> detail;
3408
3409        private static final long serialVersionUID = -987069984L;
3410
3411    /**
3412     * Constructor
3413     */
3414      public ItemComponent() {
3415        super();
3416      }
3417
3418    /**
3419     * Constructor
3420     */
3421      public ItemComponent(PositiveIntType sequence) {
3422        super();
3423        this.sequence = sequence;
3424      }
3425
3426        /**
3427         * @return {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
3428         */
3429        public PositiveIntType getSequenceElement() { 
3430          if (this.sequence == null)
3431            if (Configuration.errorOnAutoCreate())
3432              throw new Error("Attempt to auto-create ItemComponent.sequence");
3433            else if (Configuration.doAutoCreate())
3434              this.sequence = new PositiveIntType(); // bb
3435          return this.sequence;
3436        }
3437
3438        public boolean hasSequenceElement() { 
3439          return this.sequence != null && !this.sequence.isEmpty();
3440        }
3441
3442        public boolean hasSequence() { 
3443          return this.sequence != null && !this.sequence.isEmpty();
3444        }
3445
3446        /**
3447         * @param value {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
3448         */
3449        public ItemComponent setSequenceElement(PositiveIntType value) { 
3450          this.sequence = value;
3451          return this;
3452        }
3453
3454        /**
3455         * @return A service line number.
3456         */
3457        public int getSequence() { 
3458          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3459        }
3460
3461        /**
3462         * @param value A service line number.
3463         */
3464        public ItemComponent setSequence(int value) { 
3465            if (this.sequence == null)
3466              this.sequence = new PositiveIntType();
3467            this.sequence.setValue(value);
3468          return this;
3469        }
3470
3471        /**
3472         * @return {@link #careTeamSequence} (Careteam applicable for this service or product line.)
3473         */
3474        public List<PositiveIntType> getCareTeamSequence() { 
3475          if (this.careTeamSequence == null)
3476            this.careTeamSequence = new ArrayList<PositiveIntType>();
3477          return this.careTeamSequence;
3478        }
3479
3480        /**
3481         * @return Returns a reference to <code>this</code> for easy method chaining
3482         */
3483        public ItemComponent setCareTeamSequence(List<PositiveIntType> theCareTeamSequence) { 
3484          this.careTeamSequence = theCareTeamSequence;
3485          return this;
3486        }
3487
3488        public boolean hasCareTeamSequence() { 
3489          if (this.careTeamSequence == null)
3490            return false;
3491          for (PositiveIntType item : this.careTeamSequence)
3492            if (!item.isEmpty())
3493              return true;
3494          return false;
3495        }
3496
3497        /**
3498         * @return {@link #careTeamSequence} (Careteam applicable for this service or product line.)
3499         */
3500        public PositiveIntType addCareTeamSequenceElement() {//2 
3501          PositiveIntType t = new PositiveIntType();
3502          if (this.careTeamSequence == null)
3503            this.careTeamSequence = new ArrayList<PositiveIntType>();
3504          this.careTeamSequence.add(t);
3505          return t;
3506        }
3507
3508        /**
3509         * @param value {@link #careTeamSequence} (Careteam applicable for this service or product line.)
3510         */
3511        public ItemComponent addCareTeamSequence(int value) { //1
3512          PositiveIntType t = new PositiveIntType();
3513          t.setValue(value);
3514          if (this.careTeamSequence == null)
3515            this.careTeamSequence = new ArrayList<PositiveIntType>();
3516          this.careTeamSequence.add(t);
3517          return this;
3518        }
3519
3520        /**
3521         * @param value {@link #careTeamSequence} (Careteam applicable for this service or product line.)
3522         */
3523        public boolean hasCareTeamSequence(int value) { 
3524          if (this.careTeamSequence == null)
3525            return false;
3526          for (PositiveIntType v : this.careTeamSequence)
3527            if (v.getValue().equals(value)) // positiveInt
3528              return true;
3529          return false;
3530        }
3531
3532        /**
3533         * @return {@link #diagnosisSequence} (Diagnosis applicable for this service or product line.)
3534         */
3535        public List<PositiveIntType> getDiagnosisSequence() { 
3536          if (this.diagnosisSequence == null)
3537            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3538          return this.diagnosisSequence;
3539        }
3540
3541        /**
3542         * @return Returns a reference to <code>this</code> for easy method chaining
3543         */
3544        public ItemComponent setDiagnosisSequence(List<PositiveIntType> theDiagnosisSequence) { 
3545          this.diagnosisSequence = theDiagnosisSequence;
3546          return this;
3547        }
3548
3549        public boolean hasDiagnosisSequence() { 
3550          if (this.diagnosisSequence == null)
3551            return false;
3552          for (PositiveIntType item : this.diagnosisSequence)
3553            if (!item.isEmpty())
3554              return true;
3555          return false;
3556        }
3557
3558        /**
3559         * @return {@link #diagnosisSequence} (Diagnosis applicable for this service or product line.)
3560         */
3561        public PositiveIntType addDiagnosisSequenceElement() {//2 
3562          PositiveIntType t = new PositiveIntType();
3563          if (this.diagnosisSequence == null)
3564            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3565          this.diagnosisSequence.add(t);
3566          return t;
3567        }
3568
3569        /**
3570         * @param value {@link #diagnosisSequence} (Diagnosis applicable for this service or product line.)
3571         */
3572        public ItemComponent addDiagnosisSequence(int value) { //1
3573          PositiveIntType t = new PositiveIntType();
3574          t.setValue(value);
3575          if (this.diagnosisSequence == null)
3576            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3577          this.diagnosisSequence.add(t);
3578          return this;
3579        }
3580
3581        /**
3582         * @param value {@link #diagnosisSequence} (Diagnosis applicable for this service or product line.)
3583         */
3584        public boolean hasDiagnosisSequence(int value) { 
3585          if (this.diagnosisSequence == null)
3586            return false;
3587          for (PositiveIntType v : this.diagnosisSequence)
3588            if (v.getValue().equals(value)) // positiveInt
3589              return true;
3590          return false;
3591        }
3592
3593        /**
3594         * @return {@link #procedureSequence} (Procedures applicable for this service or product line.)
3595         */
3596        public List<PositiveIntType> getProcedureSequence() { 
3597          if (this.procedureSequence == null)
3598            this.procedureSequence = new ArrayList<PositiveIntType>();
3599          return this.procedureSequence;
3600        }
3601
3602        /**
3603         * @return Returns a reference to <code>this</code> for easy method chaining
3604         */
3605        public ItemComponent setProcedureSequence(List<PositiveIntType> theProcedureSequence) { 
3606          this.procedureSequence = theProcedureSequence;
3607          return this;
3608        }
3609
3610        public boolean hasProcedureSequence() { 
3611          if (this.procedureSequence == null)
3612            return false;
3613          for (PositiveIntType item : this.procedureSequence)
3614            if (!item.isEmpty())
3615              return true;
3616          return false;
3617        }
3618
3619        /**
3620         * @return {@link #procedureSequence} (Procedures applicable for this service or product line.)
3621         */
3622        public PositiveIntType addProcedureSequenceElement() {//2 
3623          PositiveIntType t = new PositiveIntType();
3624          if (this.procedureSequence == null)
3625            this.procedureSequence = new ArrayList<PositiveIntType>();
3626          this.procedureSequence.add(t);
3627          return t;
3628        }
3629
3630        /**
3631         * @param value {@link #procedureSequence} (Procedures applicable for this service or product line.)
3632         */
3633        public ItemComponent addProcedureSequence(int value) { //1
3634          PositiveIntType t = new PositiveIntType();
3635          t.setValue(value);
3636          if (this.procedureSequence == null)
3637            this.procedureSequence = new ArrayList<PositiveIntType>();
3638          this.procedureSequence.add(t);
3639          return this;
3640        }
3641
3642        /**
3643         * @param value {@link #procedureSequence} (Procedures applicable for this service or product line.)
3644         */
3645        public boolean hasProcedureSequence(int value) { 
3646          if (this.procedureSequence == null)
3647            return false;
3648          for (PositiveIntType v : this.procedureSequence)
3649            if (v.getValue().equals(value)) // positiveInt
3650              return true;
3651          return false;
3652        }
3653
3654        /**
3655         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3656         */
3657        public List<PositiveIntType> getInformationSequence() { 
3658          if (this.informationSequence == null)
3659            this.informationSequence = new ArrayList<PositiveIntType>();
3660          return this.informationSequence;
3661        }
3662
3663        /**
3664         * @return Returns a reference to <code>this</code> for easy method chaining
3665         */
3666        public ItemComponent setInformationSequence(List<PositiveIntType> theInformationSequence) { 
3667          this.informationSequence = theInformationSequence;
3668          return this;
3669        }
3670
3671        public boolean hasInformationSequence() { 
3672          if (this.informationSequence == null)
3673            return false;
3674          for (PositiveIntType item : this.informationSequence)
3675            if (!item.isEmpty())
3676              return true;
3677          return false;
3678        }
3679
3680        /**
3681         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3682         */
3683        public PositiveIntType addInformationSequenceElement() {//2 
3684          PositiveIntType t = new PositiveIntType();
3685          if (this.informationSequence == null)
3686            this.informationSequence = new ArrayList<PositiveIntType>();
3687          this.informationSequence.add(t);
3688          return t;
3689        }
3690
3691        /**
3692         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3693         */
3694        public ItemComponent addInformationSequence(int value) { //1
3695          PositiveIntType t = new PositiveIntType();
3696          t.setValue(value);
3697          if (this.informationSequence == null)
3698            this.informationSequence = new ArrayList<PositiveIntType>();
3699          this.informationSequence.add(t);
3700          return this;
3701        }
3702
3703        /**
3704         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3705         */
3706        public boolean hasInformationSequence(int value) { 
3707          if (this.informationSequence == null)
3708            return false;
3709          for (PositiveIntType v : this.informationSequence)
3710            if (v.getValue().equals(value)) // positiveInt
3711              return true;
3712          return false;
3713        }
3714
3715        /**
3716         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3717         */
3718        public CodeableConcept getRevenue() { 
3719          if (this.revenue == null)
3720            if (Configuration.errorOnAutoCreate())
3721              throw new Error("Attempt to auto-create ItemComponent.revenue");
3722            else if (Configuration.doAutoCreate())
3723              this.revenue = new CodeableConcept(); // cc
3724          return this.revenue;
3725        }
3726
3727        public boolean hasRevenue() { 
3728          return this.revenue != null && !this.revenue.isEmpty();
3729        }
3730
3731        /**
3732         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3733         */
3734        public ItemComponent setRevenue(CodeableConcept value) { 
3735          this.revenue = value;
3736          return this;
3737        }
3738
3739        /**
3740         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
3741         */
3742        public CodeableConcept getCategory() { 
3743          if (this.category == null)
3744            if (Configuration.errorOnAutoCreate())
3745              throw new Error("Attempt to auto-create ItemComponent.category");
3746            else if (Configuration.doAutoCreate())
3747              this.category = new CodeableConcept(); // cc
3748          return this.category;
3749        }
3750
3751        public boolean hasCategory() { 
3752          return this.category != null && !this.category.isEmpty();
3753        }
3754
3755        /**
3756         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
3757         */
3758        public ItemComponent setCategory(CodeableConcept value) { 
3759          this.category = value;
3760          return this;
3761        }
3762
3763        /**
3764         * @return {@link #billcode} (If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.)
3765         */
3766        public CodeableConcept getBillcode() { 
3767          if (this.billcode == null)
3768            if (Configuration.errorOnAutoCreate())
3769              throw new Error("Attempt to auto-create ItemComponent.billcode");
3770            else if (Configuration.doAutoCreate())
3771              this.billcode = new CodeableConcept(); // cc
3772          return this.billcode;
3773        }
3774
3775        public boolean hasBillcode() { 
3776          return this.billcode != null && !this.billcode.isEmpty();
3777        }
3778
3779        /**
3780         * @param value {@link #billcode} (If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.)
3781         */
3782        public ItemComponent setBillcode(CodeableConcept value) { 
3783          this.billcode = value;
3784          return this;
3785        }
3786
3787        /**
3788         * @return {@link #modifier} (Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.)
3789         */
3790        public List<CodeableConcept> getModifier() { 
3791          if (this.modifier == null)
3792            this.modifier = new ArrayList<CodeableConcept>();
3793          return this.modifier;
3794        }
3795
3796        /**
3797         * @return Returns a reference to <code>this</code> for easy method chaining
3798         */
3799        public ItemComponent setModifier(List<CodeableConcept> theModifier) { 
3800          this.modifier = theModifier;
3801          return this;
3802        }
3803
3804        public boolean hasModifier() { 
3805          if (this.modifier == null)
3806            return false;
3807          for (CodeableConcept item : this.modifier)
3808            if (!item.isEmpty())
3809              return true;
3810          return false;
3811        }
3812
3813        public CodeableConcept addModifier() { //3
3814          CodeableConcept t = new CodeableConcept();
3815          if (this.modifier == null)
3816            this.modifier = new ArrayList<CodeableConcept>();
3817          this.modifier.add(t);
3818          return t;
3819        }
3820
3821        public ItemComponent addModifier(CodeableConcept t) { //3
3822          if (t == null)
3823            return this;
3824          if (this.modifier == null)
3825            this.modifier = new ArrayList<CodeableConcept>();
3826          this.modifier.add(t);
3827          return this;
3828        }
3829
3830        /**
3831         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
3832         */
3833        public CodeableConcept getModifierFirstRep() { 
3834          if (getModifier().isEmpty()) {
3835            addModifier();
3836          }
3837          return getModifier().get(0);
3838        }
3839
3840        /**
3841         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
3842         */
3843        public List<CodeableConcept> getProgramCode() { 
3844          if (this.programCode == null)
3845            this.programCode = new ArrayList<CodeableConcept>();
3846          return this.programCode;
3847        }
3848
3849        /**
3850         * @return Returns a reference to <code>this</code> for easy method chaining
3851         */
3852        public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
3853          this.programCode = theProgramCode;
3854          return this;
3855        }
3856
3857        public boolean hasProgramCode() { 
3858          if (this.programCode == null)
3859            return false;
3860          for (CodeableConcept item : this.programCode)
3861            if (!item.isEmpty())
3862              return true;
3863          return false;
3864        }
3865
3866        public CodeableConcept addProgramCode() { //3
3867          CodeableConcept t = new CodeableConcept();
3868          if (this.programCode == null)
3869            this.programCode = new ArrayList<CodeableConcept>();
3870          this.programCode.add(t);
3871          return t;
3872        }
3873
3874        public ItemComponent addProgramCode(CodeableConcept t) { //3
3875          if (t == null)
3876            return this;
3877          if (this.programCode == null)
3878            this.programCode = new ArrayList<CodeableConcept>();
3879          this.programCode.add(t);
3880          return this;
3881        }
3882
3883        /**
3884         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
3885         */
3886        public CodeableConcept getProgramCodeFirstRep() { 
3887          if (getProgramCode().isEmpty()) {
3888            addProgramCode();
3889          }
3890          return getProgramCode().get(0);
3891        }
3892
3893        /**
3894         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3895         */
3896        public Type getServiced() { 
3897          return this.serviced;
3898        }
3899
3900        /**
3901         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3902         */
3903        public DateType getServicedDateType() throws FHIRException { 
3904          if (this.serviced == null)
3905            return null;
3906          if (!(this.serviced instanceof DateType))
3907            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
3908          return (DateType) this.serviced;
3909        }
3910
3911        public boolean hasServicedDateType() { 
3912          return this != null && this.serviced instanceof DateType;
3913        }
3914
3915        /**
3916         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3917         */
3918        public Period getServicedPeriod() throws FHIRException { 
3919          if (this.serviced == null)
3920            return null;
3921          if (!(this.serviced instanceof Period))
3922            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
3923          return (Period) this.serviced;
3924        }
3925
3926        public boolean hasServicedPeriod() { 
3927          return this != null && this.serviced instanceof Period;
3928        }
3929
3930        public boolean hasServiced() { 
3931          return this.serviced != null && !this.serviced.isEmpty();
3932        }
3933
3934        /**
3935         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
3936         */
3937        public ItemComponent setServiced(Type value) { 
3938          if (value != null && !(value instanceof DateType || value instanceof Period))
3939            throw new Error("Not the right type for ExplanationOfBenefit.item.serviced[x]: "+value.fhirType());
3940          this.serviced = value;
3941          return this;
3942        }
3943
3944        /**
3945         * @return {@link #location} (Where the service was provided.)
3946         */
3947        public Type getLocation() { 
3948          return this.location;
3949        }
3950
3951        /**
3952         * @return {@link #location} (Where the service was provided.)
3953         */
3954        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
3955          if (this.location == null)
3956            return null;
3957          if (!(this.location instanceof CodeableConcept))
3958            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
3959          return (CodeableConcept) this.location;
3960        }
3961
3962        public boolean hasLocationCodeableConcept() { 
3963          return this != null && this.location instanceof CodeableConcept;
3964        }
3965
3966        /**
3967         * @return {@link #location} (Where the service was provided.)
3968         */
3969        public Address getLocationAddress() throws FHIRException { 
3970          if (this.location == null)
3971            return null;
3972          if (!(this.location instanceof Address))
3973            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
3974          return (Address) this.location;
3975        }
3976
3977        public boolean hasLocationAddress() { 
3978          return this != null && this.location instanceof Address;
3979        }
3980
3981        /**
3982         * @return {@link #location} (Where the service was provided.)
3983         */
3984        public Reference getLocationReference() throws FHIRException { 
3985          if (this.location == null)
3986            return null;
3987          if (!(this.location instanceof Reference))
3988            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
3989          return (Reference) this.location;
3990        }
3991
3992        public boolean hasLocationReference() { 
3993          return this != null && this.location instanceof Reference;
3994        }
3995
3996        public boolean hasLocation() { 
3997          return this.location != null && !this.location.isEmpty();
3998        }
3999
4000        /**
4001         * @param value {@link #location} (Where the service was provided.)
4002         */
4003        public ItemComponent setLocation(Type value) { 
4004          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
4005            throw new Error("Not the right type for ExplanationOfBenefit.item.location[x]: "+value.fhirType());
4006          this.location = value;
4007          return this;
4008        }
4009
4010        /**
4011         * @return {@link #quantity} (The number of repetitions of a service or product.)
4012         */
4013        public Quantity getQuantity() { 
4014          if (this.quantity == null)
4015            if (Configuration.errorOnAutoCreate())
4016              throw new Error("Attempt to auto-create ItemComponent.quantity");
4017            else if (Configuration.doAutoCreate())
4018              this.quantity = new Quantity(); // cc
4019          return this.quantity;
4020        }
4021
4022        public boolean hasQuantity() { 
4023          return this.quantity != null && !this.quantity.isEmpty();
4024        }
4025
4026        /**
4027         * @param value {@link #quantity} (The number of repetitions of a service or product.)
4028         */
4029        public ItemComponent setQuantity(Quantity value) { 
4030          this.quantity = value;
4031          return this;
4032        }
4033
4034        /**
4035         * @return {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
4036         */
4037        public Money getUnitPrice() { 
4038          if (this.unitPrice == null)
4039            if (Configuration.errorOnAutoCreate())
4040              throw new Error("Attempt to auto-create ItemComponent.unitPrice");
4041            else if (Configuration.doAutoCreate())
4042              this.unitPrice = new Money(); // cc
4043          return this.unitPrice;
4044        }
4045
4046        public boolean hasUnitPrice() { 
4047          return this.unitPrice != null && !this.unitPrice.isEmpty();
4048        }
4049
4050        /**
4051         * @param value {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
4052         */
4053        public ItemComponent setUnitPrice(Money value) { 
4054          this.unitPrice = value;
4055          return this;
4056        }
4057
4058        /**
4059         * @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
4060         */
4061        public DecimalType getFactorElement() { 
4062          if (this.factor == null)
4063            if (Configuration.errorOnAutoCreate())
4064              throw new Error("Attempt to auto-create ItemComponent.factor");
4065            else if (Configuration.doAutoCreate())
4066              this.factor = new DecimalType(); // bb
4067          return this.factor;
4068        }
4069
4070        public boolean hasFactorElement() { 
4071          return this.factor != null && !this.factor.isEmpty();
4072        }
4073
4074        public boolean hasFactor() { 
4075          return this.factor != null && !this.factor.isEmpty();
4076        }
4077
4078        /**
4079         * @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
4080         */
4081        public ItemComponent setFactorElement(DecimalType value) { 
4082          this.factor = value;
4083          return this;
4084        }
4085
4086        /**
4087         * @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.
4088         */
4089        public BigDecimal getFactor() { 
4090          return this.factor == null ? null : this.factor.getValue();
4091        }
4092
4093        /**
4094         * @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.
4095         */
4096        public ItemComponent setFactor(BigDecimal value) { 
4097          if (value == null)
4098            this.factor = null;
4099          else {
4100            if (this.factor == null)
4101              this.factor = new DecimalType();
4102            this.factor.setValue(value);
4103          }
4104          return this;
4105        }
4106
4107        /**
4108         * @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.
4109         */
4110        public ItemComponent setFactor(long value) { 
4111              this.factor = new DecimalType();
4112            this.factor.setValue(value);
4113          return this;
4114        }
4115
4116        /**
4117         * @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.
4118         */
4119        public ItemComponent setFactor(double value) { 
4120              this.factor = new DecimalType();
4121            this.factor.setValue(value);
4122          return this;
4123        }
4124
4125        /**
4126         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
4127         */
4128        public Money getNet() { 
4129          if (this.net == null)
4130            if (Configuration.errorOnAutoCreate())
4131              throw new Error("Attempt to auto-create ItemComponent.net");
4132            else if (Configuration.doAutoCreate())
4133              this.net = new Money(); // cc
4134          return this.net;
4135        }
4136
4137        public boolean hasNet() { 
4138          return this.net != null && !this.net.isEmpty();
4139        }
4140
4141        /**
4142         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
4143         */
4144        public ItemComponent setNet(Money value) { 
4145          this.net = value;
4146          return this;
4147        }
4148
4149        /**
4150         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
4151         */
4152        public List<Reference> getUdi() { 
4153          if (this.udi == null)
4154            this.udi = new ArrayList<Reference>();
4155          return this.udi;
4156        }
4157
4158        /**
4159         * @return Returns a reference to <code>this</code> for easy method chaining
4160         */
4161        public ItemComponent setUdi(List<Reference> theUdi) { 
4162          this.udi = theUdi;
4163          return this;
4164        }
4165
4166        public boolean hasUdi() { 
4167          if (this.udi == null)
4168            return false;
4169          for (Reference item : this.udi)
4170            if (!item.isEmpty())
4171              return true;
4172          return false;
4173        }
4174
4175        public Reference addUdi() { //3
4176          Reference t = new Reference();
4177          if (this.udi == null)
4178            this.udi = new ArrayList<Reference>();
4179          this.udi.add(t);
4180          return t;
4181        }
4182
4183        public ItemComponent addUdi(Reference t) { //3
4184          if (t == null)
4185            return this;
4186          if (this.udi == null)
4187            this.udi = new ArrayList<Reference>();
4188          this.udi.add(t);
4189          return this;
4190        }
4191
4192        /**
4193         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
4194         */
4195        public Reference getUdiFirstRep() { 
4196          if (getUdi().isEmpty()) {
4197            addUdi();
4198          }
4199          return getUdi().get(0);
4200        }
4201
4202        /**
4203         * @deprecated Use Reference#setResource(IBaseResource) instead
4204         */
4205        @Deprecated
4206        public List<Device> getUdiTarget() { 
4207          if (this.udiTarget == null)
4208            this.udiTarget = new ArrayList<Device>();
4209          return this.udiTarget;
4210        }
4211
4212        /**
4213         * @deprecated Use Reference#setResource(IBaseResource) instead
4214         */
4215        @Deprecated
4216        public Device addUdiTarget() { 
4217          Device r = new Device();
4218          if (this.udiTarget == null)
4219            this.udiTarget = new ArrayList<Device>();
4220          this.udiTarget.add(r);
4221          return r;
4222        }
4223
4224        /**
4225         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4226         */
4227        public CodeableConcept getBodySite() { 
4228          if (this.bodySite == null)
4229            if (Configuration.errorOnAutoCreate())
4230              throw new Error("Attempt to auto-create ItemComponent.bodySite");
4231            else if (Configuration.doAutoCreate())
4232              this.bodySite = new CodeableConcept(); // cc
4233          return this.bodySite;
4234        }
4235
4236        public boolean hasBodySite() { 
4237          return this.bodySite != null && !this.bodySite.isEmpty();
4238        }
4239
4240        /**
4241         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4242         */
4243        public ItemComponent setBodySite(CodeableConcept value) { 
4244          this.bodySite = value;
4245          return this;
4246        }
4247
4248        /**
4249         * @return {@link #subSite} (A region or surface of the site, e.g. limb region or tooth surface(s).)
4250         */
4251        public List<CodeableConcept> getSubSite() { 
4252          if (this.subSite == null)
4253            this.subSite = new ArrayList<CodeableConcept>();
4254          return this.subSite;
4255        }
4256
4257        /**
4258         * @return Returns a reference to <code>this</code> for easy method chaining
4259         */
4260        public ItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
4261          this.subSite = theSubSite;
4262          return this;
4263        }
4264
4265        public boolean hasSubSite() { 
4266          if (this.subSite == null)
4267            return false;
4268          for (CodeableConcept item : this.subSite)
4269            if (!item.isEmpty())
4270              return true;
4271          return false;
4272        }
4273
4274        public CodeableConcept addSubSite() { //3
4275          CodeableConcept t = new CodeableConcept();
4276          if (this.subSite == null)
4277            this.subSite = new ArrayList<CodeableConcept>();
4278          this.subSite.add(t);
4279          return t;
4280        }
4281
4282        public ItemComponent addSubSite(CodeableConcept t) { //3
4283          if (t == null)
4284            return this;
4285          if (this.subSite == null)
4286            this.subSite = new ArrayList<CodeableConcept>();
4287          this.subSite.add(t);
4288          return this;
4289        }
4290
4291        /**
4292         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist
4293         */
4294        public CodeableConcept getSubSiteFirstRep() { 
4295          if (getSubSite().isEmpty()) {
4296            addSubSite();
4297          }
4298          return getSubSite().get(0);
4299        }
4300
4301        /**
4302         * @return {@link #encounter} (A billed item may include goods or services provided in multiple encounters.)
4303         */
4304        public List<Reference> getEncounter() { 
4305          if (this.encounter == null)
4306            this.encounter = new ArrayList<Reference>();
4307          return this.encounter;
4308        }
4309
4310        /**
4311         * @return Returns a reference to <code>this</code> for easy method chaining
4312         */
4313        public ItemComponent setEncounter(List<Reference> theEncounter) { 
4314          this.encounter = theEncounter;
4315          return this;
4316        }
4317
4318        public boolean hasEncounter() { 
4319          if (this.encounter == null)
4320            return false;
4321          for (Reference item : this.encounter)
4322            if (!item.isEmpty())
4323              return true;
4324          return false;
4325        }
4326
4327        public Reference addEncounter() { //3
4328          Reference t = new Reference();
4329          if (this.encounter == null)
4330            this.encounter = new ArrayList<Reference>();
4331          this.encounter.add(t);
4332          return t;
4333        }
4334
4335        public ItemComponent addEncounter(Reference t) { //3
4336          if (t == null)
4337            return this;
4338          if (this.encounter == null)
4339            this.encounter = new ArrayList<Reference>();
4340          this.encounter.add(t);
4341          return this;
4342        }
4343
4344        /**
4345         * @return The first repetition of repeating field {@link #encounter}, creating it if it does not already exist
4346         */
4347        public Reference getEncounterFirstRep() { 
4348          if (getEncounter().isEmpty()) {
4349            addEncounter();
4350          }
4351          return getEncounter().get(0);
4352        }
4353
4354        /**
4355         * @deprecated Use Reference#setResource(IBaseResource) instead
4356         */
4357        @Deprecated
4358        public List<Encounter> getEncounterTarget() { 
4359          if (this.encounterTarget == null)
4360            this.encounterTarget = new ArrayList<Encounter>();
4361          return this.encounterTarget;
4362        }
4363
4364        /**
4365         * @deprecated Use Reference#setResource(IBaseResource) instead
4366         */
4367        @Deprecated
4368        public Encounter addEncounterTarget() { 
4369          Encounter r = new Encounter();
4370          if (this.encounterTarget == null)
4371            this.encounterTarget = new ArrayList<Encounter>();
4372          this.encounterTarget.add(r);
4373          return r;
4374        }
4375
4376        /**
4377         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
4378         */
4379        public List<PositiveIntType> getNoteNumber() { 
4380          if (this.noteNumber == null)
4381            this.noteNumber = new ArrayList<PositiveIntType>();
4382          return this.noteNumber;
4383        }
4384
4385        /**
4386         * @return Returns a reference to <code>this</code> for easy method chaining
4387         */
4388        public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
4389          this.noteNumber = theNoteNumber;
4390          return this;
4391        }
4392
4393        public boolean hasNoteNumber() { 
4394          if (this.noteNumber == null)
4395            return false;
4396          for (PositiveIntType item : this.noteNumber)
4397            if (!item.isEmpty())
4398              return true;
4399          return false;
4400        }
4401
4402        /**
4403         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
4404         */
4405        public PositiveIntType addNoteNumberElement() {//2 
4406          PositiveIntType t = new PositiveIntType();
4407          if (this.noteNumber == null)
4408            this.noteNumber = new ArrayList<PositiveIntType>();
4409          this.noteNumber.add(t);
4410          return t;
4411        }
4412
4413        /**
4414         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
4415         */
4416        public ItemComponent addNoteNumber(int value) { //1
4417          PositiveIntType t = new PositiveIntType();
4418          t.setValue(value);
4419          if (this.noteNumber == null)
4420            this.noteNumber = new ArrayList<PositiveIntType>();
4421          this.noteNumber.add(t);
4422          return this;
4423        }
4424
4425        /**
4426         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
4427         */
4428        public boolean hasNoteNumber(int value) { 
4429          if (this.noteNumber == null)
4430            return false;
4431          for (PositiveIntType v : this.noteNumber)
4432            if (v.getValue().equals(value)) // positiveInt
4433              return true;
4434          return false;
4435        }
4436
4437        /**
4438         * @return {@link #adjudication} (The adjudication results.)
4439         */
4440        public List<AdjudicationComponent> getAdjudication() { 
4441          if (this.adjudication == null)
4442            this.adjudication = new ArrayList<AdjudicationComponent>();
4443          return this.adjudication;
4444        }
4445
4446        /**
4447         * @return Returns a reference to <code>this</code> for easy method chaining
4448         */
4449        public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
4450          this.adjudication = theAdjudication;
4451          return this;
4452        }
4453
4454        public boolean hasAdjudication() { 
4455          if (this.adjudication == null)
4456            return false;
4457          for (AdjudicationComponent item : this.adjudication)
4458            if (!item.isEmpty())
4459              return true;
4460          return false;
4461        }
4462
4463        public AdjudicationComponent addAdjudication() { //3
4464          AdjudicationComponent t = new AdjudicationComponent();
4465          if (this.adjudication == null)
4466            this.adjudication = new ArrayList<AdjudicationComponent>();
4467          this.adjudication.add(t);
4468          return t;
4469        }
4470
4471        public ItemComponent addAdjudication(AdjudicationComponent t) { //3
4472          if (t == null)
4473            return this;
4474          if (this.adjudication == null)
4475            this.adjudication = new ArrayList<AdjudicationComponent>();
4476          this.adjudication.add(t);
4477          return this;
4478        }
4479
4480        /**
4481         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
4482         */
4483        public AdjudicationComponent getAdjudicationFirstRep() { 
4484          if (getAdjudication().isEmpty()) {
4485            addAdjudication();
4486          }
4487          return getAdjudication().get(0);
4488        }
4489
4490        /**
4491         * @return {@link #detail} (Second-tier of goods and services.)
4492         */
4493        public List<DetailComponent> getDetail() { 
4494          if (this.detail == null)
4495            this.detail = new ArrayList<DetailComponent>();
4496          return this.detail;
4497        }
4498
4499        /**
4500         * @return Returns a reference to <code>this</code> for easy method chaining
4501         */
4502        public ItemComponent setDetail(List<DetailComponent> theDetail) { 
4503          this.detail = theDetail;
4504          return this;
4505        }
4506
4507        public boolean hasDetail() { 
4508          if (this.detail == null)
4509            return false;
4510          for (DetailComponent item : this.detail)
4511            if (!item.isEmpty())
4512              return true;
4513          return false;
4514        }
4515
4516        public DetailComponent addDetail() { //3
4517          DetailComponent t = new DetailComponent();
4518          if (this.detail == null)
4519            this.detail = new ArrayList<DetailComponent>();
4520          this.detail.add(t);
4521          return t;
4522        }
4523
4524        public ItemComponent addDetail(DetailComponent t) { //3
4525          if (t == null)
4526            return this;
4527          if (this.detail == null)
4528            this.detail = new ArrayList<DetailComponent>();
4529          this.detail.add(t);
4530          return this;
4531        }
4532
4533        /**
4534         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
4535         */
4536        public DetailComponent getDetailFirstRep() { 
4537          if (getDetail().isEmpty()) {
4538            addDetail();
4539          }
4540          return getDetail().get(0);
4541        }
4542
4543        protected void listChildren(List<Property> children) {
4544          super.listChildren(children);
4545          children.add(new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence));
4546          children.add(new Property("careTeamSequence", "positiveInt", "Careteam applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence));
4547          children.add(new Property("diagnosisSequence", "positiveInt", "Diagnosis applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence));
4548          children.add(new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, procedureSequence));
4549          children.add(new Property("informationSequence", "positiveInt", "Exceptions, special conditions and supporting information pplicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, informationSequence));
4550          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
4551          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category));
4552          children.add(new Property("billcode", "CodeableConcept", "If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, billcode));
4553          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier));
4554          children.add(new Property("programCode", "CodeableConcept", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode));
4555          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));
4556          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location));
4557          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
4558          children.add(new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, 1, unitPrice));
4559          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));
4560          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net));
4561          children.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
4562          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
4563          children.add(new Property("subSite", "CodeableConcept", "A region or surface of the site, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite));
4564          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));
4565          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
4566          children.add(new Property("adjudication", "", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
4567          children.add(new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
4568        }
4569
4570        @Override
4571        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4572          switch (_hash) {
4573          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence);
4574          case 1070083823: /*careTeamSequence*/  return new Property("careTeamSequence", "positiveInt", "Careteam applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence);
4575          case -909769262: /*diagnosisSequence*/  return new Property("diagnosisSequence", "positiveInt", "Diagnosis applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence);
4576          case -808920140: /*procedureSequence*/  return new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, procedureSequence);
4577          case -702585587: /*informationSequence*/  return new Property("informationSequence", "positiveInt", "Exceptions, special conditions and supporting information pplicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, informationSequence);
4578          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
4579          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category);
4580          case 890074740: /*billcode*/  return new Property("billcode", "CodeableConcept", "If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, billcode);
4581          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier);
4582          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode);
4583          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);
4584          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);
4585          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);
4586          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);
4587          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4588          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4589          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4590          case -1280020865: /*locationAddress*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4591          case 755866390: /*locationReference*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4592          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
4593          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, 1, unitPrice);
4594          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);
4595          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net);
4596          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
4597          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
4598          case -1868566105: /*subSite*/  return new Property("subSite", "CodeableConcept", "A region or surface of the site, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite);
4599          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);
4600          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
4601          case -231349275: /*adjudication*/  return new Property("adjudication", "", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
4602          case -1335224239: /*detail*/  return new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail);
4603          default: return super.getNamedProperty(_hash, _name, _checkValid);
4604          }
4605
4606        }
4607
4608      @Override
4609      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4610        switch (hash) {
4611        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
4612        case 1070083823: /*careTeamSequence*/ return this.careTeamSequence == null ? new Base[0] : this.careTeamSequence.toArray(new Base[this.careTeamSequence.size()]); // PositiveIntType
4613        case -909769262: /*diagnosisSequence*/ return this.diagnosisSequence == null ? new Base[0] : this.diagnosisSequence.toArray(new Base[this.diagnosisSequence.size()]); // PositiveIntType
4614        case -808920140: /*procedureSequence*/ return this.procedureSequence == null ? new Base[0] : this.procedureSequence.toArray(new Base[this.procedureSequence.size()]); // PositiveIntType
4615        case -702585587: /*informationSequence*/ return this.informationSequence == null ? new Base[0] : this.informationSequence.toArray(new Base[this.informationSequence.size()]); // PositiveIntType
4616        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
4617        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4618        case 890074740: /*billcode*/ return this.billcode == null ? new Base[0] : new Base[] {this.billcode}; // CodeableConcept
4619        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
4620        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
4621        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
4622        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
4623        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
4624        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
4625        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
4626        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
4627        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
4628        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
4629        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
4630        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
4631        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
4632        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
4633        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
4634        default: return super.getProperty(hash, name, checkValid);
4635        }
4636
4637      }
4638
4639      @Override
4640      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4641        switch (hash) {
4642        case 1349547969: // sequence
4643          this.sequence = castToPositiveInt(value); // PositiveIntType
4644          return value;
4645        case 1070083823: // careTeamSequence
4646          this.getCareTeamSequence().add(castToPositiveInt(value)); // PositiveIntType
4647          return value;
4648        case -909769262: // diagnosisSequence
4649          this.getDiagnosisSequence().add(castToPositiveInt(value)); // PositiveIntType
4650          return value;
4651        case -808920140: // procedureSequence
4652          this.getProcedureSequence().add(castToPositiveInt(value)); // PositiveIntType
4653          return value;
4654        case -702585587: // informationSequence
4655          this.getInformationSequence().add(castToPositiveInt(value)); // PositiveIntType
4656          return value;
4657        case 1099842588: // revenue
4658          this.revenue = castToCodeableConcept(value); // CodeableConcept
4659          return value;
4660        case 50511102: // category
4661          this.category = castToCodeableConcept(value); // CodeableConcept
4662          return value;
4663        case 890074740: // billcode
4664          this.billcode = castToCodeableConcept(value); // CodeableConcept
4665          return value;
4666        case -615513385: // modifier
4667          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
4668          return value;
4669        case 1010065041: // programCode
4670          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
4671          return value;
4672        case 1379209295: // serviced
4673          this.serviced = castToType(value); // Type
4674          return value;
4675        case 1901043637: // location
4676          this.location = castToType(value); // Type
4677          return value;
4678        case -1285004149: // quantity
4679          this.quantity = castToQuantity(value); // Quantity
4680          return value;
4681        case -486196699: // unitPrice
4682          this.unitPrice = castToMoney(value); // Money
4683          return value;
4684        case -1282148017: // factor
4685          this.factor = castToDecimal(value); // DecimalType
4686          return value;
4687        case 108957: // net
4688          this.net = castToMoney(value); // Money
4689          return value;
4690        case 115642: // udi
4691          this.getUdi().add(castToReference(value)); // Reference
4692          return value;
4693        case 1702620169: // bodySite
4694          this.bodySite = castToCodeableConcept(value); // CodeableConcept
4695          return value;
4696        case -1868566105: // subSite
4697          this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
4698          return value;
4699        case 1524132147: // encounter
4700          this.getEncounter().add(castToReference(value)); // Reference
4701          return value;
4702        case -1110033957: // noteNumber
4703          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
4704          return value;
4705        case -231349275: // adjudication
4706          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
4707          return value;
4708        case -1335224239: // detail
4709          this.getDetail().add((DetailComponent) value); // DetailComponent
4710          return value;
4711        default: return super.setProperty(hash, name, value);
4712        }
4713
4714      }
4715
4716      @Override
4717      public Base setProperty(String name, Base value) throws FHIRException {
4718        if (name.equals("sequence")) {
4719          this.sequence = castToPositiveInt(value); // PositiveIntType
4720        } else if (name.equals("careTeamSequence")) {
4721          this.getCareTeamSequence().add(castToPositiveInt(value));
4722        } else if (name.equals("diagnosisSequence")) {
4723          this.getDiagnosisSequence().add(castToPositiveInt(value));
4724        } else if (name.equals("procedureSequence")) {
4725          this.getProcedureSequence().add(castToPositiveInt(value));
4726        } else if (name.equals("informationSequence")) {
4727          this.getInformationSequence().add(castToPositiveInt(value));
4728        } else if (name.equals("revenue")) {
4729          this.revenue = castToCodeableConcept(value); // CodeableConcept
4730        } else if (name.equals("category")) {
4731          this.category = castToCodeableConcept(value); // CodeableConcept
4732        } else if (name.equals("billcode")) {
4733          this.billcode = castToCodeableConcept(value); // CodeableConcept
4734        } else if (name.equals("modifier")) {
4735          this.getModifier().add(castToCodeableConcept(value));
4736        } else if (name.equals("programCode")) {
4737          this.getProgramCode().add(castToCodeableConcept(value));
4738        } else if (name.equals("serviced[x]")) {
4739          this.serviced = castToType(value); // Type
4740        } else if (name.equals("location[x]")) {
4741          this.location = castToType(value); // Type
4742        } else if (name.equals("quantity")) {
4743          this.quantity = castToQuantity(value); // Quantity
4744        } else if (name.equals("unitPrice")) {
4745          this.unitPrice = castToMoney(value); // Money
4746        } else if (name.equals("factor")) {
4747          this.factor = castToDecimal(value); // DecimalType
4748        } else if (name.equals("net")) {
4749          this.net = castToMoney(value); // Money
4750        } else if (name.equals("udi")) {
4751          this.getUdi().add(castToReference(value));
4752        } else if (name.equals("bodySite")) {
4753          this.bodySite = castToCodeableConcept(value); // CodeableConcept
4754        } else if (name.equals("subSite")) {
4755          this.getSubSite().add(castToCodeableConcept(value));
4756        } else if (name.equals("encounter")) {
4757          this.getEncounter().add(castToReference(value));
4758        } else if (name.equals("noteNumber")) {
4759          this.getNoteNumber().add(castToPositiveInt(value));
4760        } else if (name.equals("adjudication")) {
4761          this.getAdjudication().add((AdjudicationComponent) value);
4762        } else if (name.equals("detail")) {
4763          this.getDetail().add((DetailComponent) value);
4764        } else
4765          return super.setProperty(name, value);
4766        return value;
4767      }
4768
4769      @Override
4770      public Base makeProperty(int hash, String name) throws FHIRException {
4771        switch (hash) {
4772        case 1349547969:  return getSequenceElement();
4773        case 1070083823:  return addCareTeamSequenceElement();
4774        case -909769262:  return addDiagnosisSequenceElement();
4775        case -808920140:  return addProcedureSequenceElement();
4776        case -702585587:  return addInformationSequenceElement();
4777        case 1099842588:  return getRevenue(); 
4778        case 50511102:  return getCategory(); 
4779        case 890074740:  return getBillcode(); 
4780        case -615513385:  return addModifier(); 
4781        case 1010065041:  return addProgramCode(); 
4782        case -1927922223:  return getServiced(); 
4783        case 1379209295:  return getServiced(); 
4784        case 552316075:  return getLocation(); 
4785        case 1901043637:  return getLocation(); 
4786        case -1285004149:  return getQuantity(); 
4787        case -486196699:  return getUnitPrice(); 
4788        case -1282148017:  return getFactorElement();
4789        case 108957:  return getNet(); 
4790        case 115642:  return addUdi(); 
4791        case 1702620169:  return getBodySite(); 
4792        case -1868566105:  return addSubSite(); 
4793        case 1524132147:  return addEncounter(); 
4794        case -1110033957:  return addNoteNumberElement();
4795        case -231349275:  return addAdjudication(); 
4796        case -1335224239:  return addDetail(); 
4797        default: return super.makeProperty(hash, name);
4798        }
4799
4800      }
4801
4802      @Override
4803      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4804        switch (hash) {
4805        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
4806        case 1070083823: /*careTeamSequence*/ return new String[] {"positiveInt"};
4807        case -909769262: /*diagnosisSequence*/ return new String[] {"positiveInt"};
4808        case -808920140: /*procedureSequence*/ return new String[] {"positiveInt"};
4809        case -702585587: /*informationSequence*/ return new String[] {"positiveInt"};
4810        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
4811        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
4812        case 890074740: /*billcode*/ return new String[] {"CodeableConcept"};
4813        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
4814        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
4815        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
4816        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
4817        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
4818        case -486196699: /*unitPrice*/ return new String[] {"Money"};
4819        case -1282148017: /*factor*/ return new String[] {"decimal"};
4820        case 108957: /*net*/ return new String[] {"Money"};
4821        case 115642: /*udi*/ return new String[] {"Reference"};
4822        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
4823        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
4824        case 1524132147: /*encounter*/ return new String[] {"Reference"};
4825        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
4826        case -231349275: /*adjudication*/ return new String[] {};
4827        case -1335224239: /*detail*/ return new String[] {};
4828        default: return super.getTypesForProperty(hash, name);
4829        }
4830
4831      }
4832
4833      @Override
4834      public Base addChild(String name) throws FHIRException {
4835        if (name.equals("sequence")) {
4836          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
4837        }
4838        else if (name.equals("careTeamSequence")) {
4839          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.careTeamSequence");
4840        }
4841        else if (name.equals("diagnosisSequence")) {
4842          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.diagnosisSequence");
4843        }
4844        else if (name.equals("procedureSequence")) {
4845          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedureSequence");
4846        }
4847        else if (name.equals("informationSequence")) {
4848          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.informationSequence");
4849        }
4850        else if (name.equals("revenue")) {
4851          this.revenue = new CodeableConcept();
4852          return this.revenue;
4853        }
4854        else if (name.equals("category")) {
4855          this.category = new CodeableConcept();
4856          return this.category;
4857        }
4858        else if (name.equals("billcode")) {
4859          this.billcode = new CodeableConcept();
4860          return this.billcode;
4861        }
4862        else if (name.equals("modifier")) {
4863          return addModifier();
4864        }
4865        else if (name.equals("programCode")) {
4866          return addProgramCode();
4867        }
4868        else if (name.equals("servicedDate")) {
4869          this.serviced = new DateType();
4870          return this.serviced;
4871        }
4872        else if (name.equals("servicedPeriod")) {
4873          this.serviced = new Period();
4874          return this.serviced;
4875        }
4876        else if (name.equals("locationCodeableConcept")) {
4877          this.location = new CodeableConcept();
4878          return this.location;
4879        }
4880        else if (name.equals("locationAddress")) {
4881          this.location = new Address();
4882          return this.location;
4883        }
4884        else if (name.equals("locationReference")) {
4885          this.location = new Reference();
4886          return this.location;
4887        }
4888        else if (name.equals("quantity")) {
4889          this.quantity = new Quantity();
4890          return this.quantity;
4891        }
4892        else if (name.equals("unitPrice")) {
4893          this.unitPrice = new Money();
4894          return this.unitPrice;
4895        }
4896        else if (name.equals("factor")) {
4897          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
4898        }
4899        else if (name.equals("net")) {
4900          this.net = new Money();
4901          return this.net;
4902        }
4903        else if (name.equals("udi")) {
4904          return addUdi();
4905        }
4906        else if (name.equals("bodySite")) {
4907          this.bodySite = new CodeableConcept();
4908          return this.bodySite;
4909        }
4910        else if (name.equals("subSite")) {
4911          return addSubSite();
4912        }
4913        else if (name.equals("encounter")) {
4914          return addEncounter();
4915        }
4916        else if (name.equals("noteNumber")) {
4917          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
4918        }
4919        else if (name.equals("adjudication")) {
4920          return addAdjudication();
4921        }
4922        else if (name.equals("detail")) {
4923          return addDetail();
4924        }
4925        else
4926          return super.addChild(name);
4927      }
4928
4929      public ItemComponent copy() {
4930        ItemComponent dst = new ItemComponent();
4931        copyValues(dst);
4932        dst.sequence = sequence == null ? null : sequence.copy();
4933        if (careTeamSequence != null) {
4934          dst.careTeamSequence = new ArrayList<PositiveIntType>();
4935          for (PositiveIntType i : careTeamSequence)
4936            dst.careTeamSequence.add(i.copy());
4937        };
4938        if (diagnosisSequence != null) {
4939          dst.diagnosisSequence = new ArrayList<PositiveIntType>();
4940          for (PositiveIntType i : diagnosisSequence)
4941            dst.diagnosisSequence.add(i.copy());
4942        };
4943        if (procedureSequence != null) {
4944          dst.procedureSequence = new ArrayList<PositiveIntType>();
4945          for (PositiveIntType i : procedureSequence)
4946            dst.procedureSequence.add(i.copy());
4947        };
4948        if (informationSequence != null) {
4949          dst.informationSequence = new ArrayList<PositiveIntType>();
4950          for (PositiveIntType i : informationSequence)
4951            dst.informationSequence.add(i.copy());
4952        };
4953        dst.revenue = revenue == null ? null : revenue.copy();
4954        dst.category = category == null ? null : category.copy();
4955        dst.billcode = billcode == null ? null : billcode.copy();
4956        if (modifier != null) {
4957          dst.modifier = new ArrayList<CodeableConcept>();
4958          for (CodeableConcept i : modifier)
4959            dst.modifier.add(i.copy());
4960        };
4961        if (programCode != null) {
4962          dst.programCode = new ArrayList<CodeableConcept>();
4963          for (CodeableConcept i : programCode)
4964            dst.programCode.add(i.copy());
4965        };
4966        dst.serviced = serviced == null ? null : serviced.copy();
4967        dst.location = location == null ? null : location.copy();
4968        dst.quantity = quantity == null ? null : quantity.copy();
4969        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
4970        dst.factor = factor == null ? null : factor.copy();
4971        dst.net = net == null ? null : net.copy();
4972        if (udi != null) {
4973          dst.udi = new ArrayList<Reference>();
4974          for (Reference i : udi)
4975            dst.udi.add(i.copy());
4976        };
4977        dst.bodySite = bodySite == null ? null : bodySite.copy();
4978        if (subSite != null) {
4979          dst.subSite = new ArrayList<CodeableConcept>();
4980          for (CodeableConcept i : subSite)
4981            dst.subSite.add(i.copy());
4982        };
4983        if (encounter != null) {
4984          dst.encounter = new ArrayList<Reference>();
4985          for (Reference i : encounter)
4986            dst.encounter.add(i.copy());
4987        };
4988        if (noteNumber != null) {
4989          dst.noteNumber = new ArrayList<PositiveIntType>();
4990          for (PositiveIntType i : noteNumber)
4991            dst.noteNumber.add(i.copy());
4992        };
4993        if (adjudication != null) {
4994          dst.adjudication = new ArrayList<AdjudicationComponent>();
4995          for (AdjudicationComponent i : adjudication)
4996            dst.adjudication.add(i.copy());
4997        };
4998        if (detail != null) {
4999          dst.detail = new ArrayList<DetailComponent>();
5000          for (DetailComponent i : detail)
5001            dst.detail.add(i.copy());
5002        };
5003        return dst;
5004      }
5005
5006      @Override
5007      public boolean equalsDeep(Base other_) {
5008        if (!super.equalsDeep(other_))
5009          return false;
5010        if (!(other_ instanceof ItemComponent))
5011          return false;
5012        ItemComponent o = (ItemComponent) other_;
5013        return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamSequence, o.careTeamSequence, true)
5014           && compareDeep(diagnosisSequence, o.diagnosisSequence, true) && compareDeep(procedureSequence, o.procedureSequence, true)
5015           && compareDeep(informationSequence, o.informationSequence, true) && compareDeep(revenue, o.revenue, true)
5016           && compareDeep(category, o.category, true) && compareDeep(billcode, o.billcode, true) && compareDeep(modifier, o.modifier, true)
5017           && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
5018           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
5019           && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true) && compareDeep(bodySite, o.bodySite, true)
5020           && compareDeep(subSite, o.subSite, true) && compareDeep(encounter, o.encounter, true) && compareDeep(noteNumber, o.noteNumber, true)
5021           && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true);
5022      }
5023
5024      @Override
5025      public boolean equalsShallow(Base other_) {
5026        if (!super.equalsShallow(other_))
5027          return false;
5028        if (!(other_ instanceof ItemComponent))
5029          return false;
5030        ItemComponent o = (ItemComponent) other_;
5031        return compareValues(sequence, o.sequence, true) && compareValues(careTeamSequence, o.careTeamSequence, true)
5032           && compareValues(diagnosisSequence, o.diagnosisSequence, true) && compareValues(procedureSequence, o.procedureSequence, true)
5033           && compareValues(informationSequence, o.informationSequence, true) && compareValues(factor, o.factor, true)
5034           && compareValues(noteNumber, o.noteNumber, true);
5035      }
5036
5037      public boolean isEmpty() {
5038        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamSequence
5039          , diagnosisSequence, procedureSequence, informationSequence, revenue, category, billcode
5040          , modifier, programCode, serviced, location, quantity, unitPrice, factor, net
5041          , udi, bodySite, subSite, encounter, noteNumber, adjudication, detail);
5042      }
5043
5044  public String fhirType() {
5045    return "ExplanationOfBenefit.item";
5046
5047  }
5048
5049  }
5050
5051    @Block()
5052    public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
5053        /**
5054         * Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.
5055         */
5056        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
5057        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc." )
5058        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
5059        protected CodeableConcept category;
5060
5061        /**
5062         * Adjudication reason such as limit reached.
5063         */
5064        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5065        @Description(shortDefinition="Explanation of Adjudication outcome", formalDefinition="Adjudication reason such as limit reached." )
5066        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-reason")
5067        protected CodeableConcept reason;
5068
5069        /**
5070         * Monitory amount associated with the code.
5071         */
5072        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
5073        @Description(shortDefinition="Monetary amount", formalDefinition="Monitory amount associated with the code." )
5074        protected Money amount;
5075
5076        /**
5077         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5078         */
5079        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
5080        @Description(shortDefinition="Non-monitory value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
5081        protected DecimalType value;
5082
5083        private static final long serialVersionUID = 1559898786L;
5084
5085    /**
5086     * Constructor
5087     */
5088      public AdjudicationComponent() {
5089        super();
5090      }
5091
5092    /**
5093     * Constructor
5094     */
5095      public AdjudicationComponent(CodeableConcept category) {
5096        super();
5097        this.category = category;
5098      }
5099
5100        /**
5101         * @return {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
5102         */
5103        public CodeableConcept getCategory() { 
5104          if (this.category == null)
5105            if (Configuration.errorOnAutoCreate())
5106              throw new Error("Attempt to auto-create AdjudicationComponent.category");
5107            else if (Configuration.doAutoCreate())
5108              this.category = new CodeableConcept(); // cc
5109          return this.category;
5110        }
5111
5112        public boolean hasCategory() { 
5113          return this.category != null && !this.category.isEmpty();
5114        }
5115
5116        /**
5117         * @param value {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
5118         */
5119        public AdjudicationComponent setCategory(CodeableConcept value) { 
5120          this.category = value;
5121          return this;
5122        }
5123
5124        /**
5125         * @return {@link #reason} (Adjudication reason such as limit reached.)
5126         */
5127        public CodeableConcept getReason() { 
5128          if (this.reason == null)
5129            if (Configuration.errorOnAutoCreate())
5130              throw new Error("Attempt to auto-create AdjudicationComponent.reason");
5131            else if (Configuration.doAutoCreate())
5132              this.reason = new CodeableConcept(); // cc
5133          return this.reason;
5134        }
5135
5136        public boolean hasReason() { 
5137          return this.reason != null && !this.reason.isEmpty();
5138        }
5139
5140        /**
5141         * @param value {@link #reason} (Adjudication reason such as limit reached.)
5142         */
5143        public AdjudicationComponent setReason(CodeableConcept value) { 
5144          this.reason = value;
5145          return this;
5146        }
5147
5148        /**
5149         * @return {@link #amount} (Monitory amount associated with the code.)
5150         */
5151        public Money getAmount() { 
5152          if (this.amount == null)
5153            if (Configuration.errorOnAutoCreate())
5154              throw new Error("Attempt to auto-create AdjudicationComponent.amount");
5155            else if (Configuration.doAutoCreate())
5156              this.amount = new Money(); // cc
5157          return this.amount;
5158        }
5159
5160        public boolean hasAmount() { 
5161          return this.amount != null && !this.amount.isEmpty();
5162        }
5163
5164        /**
5165         * @param value {@link #amount} (Monitory amount associated with the code.)
5166         */
5167        public AdjudicationComponent setAmount(Money value) { 
5168          this.amount = value;
5169          return this;
5170        }
5171
5172        /**
5173         * @return {@link #value} (A non-monetary value for example a percentage. 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
5174         */
5175        public DecimalType getValueElement() { 
5176          if (this.value == null)
5177            if (Configuration.errorOnAutoCreate())
5178              throw new Error("Attempt to auto-create AdjudicationComponent.value");
5179            else if (Configuration.doAutoCreate())
5180              this.value = new DecimalType(); // bb
5181          return this.value;
5182        }
5183
5184        public boolean hasValueElement() { 
5185          return this.value != null && !this.value.isEmpty();
5186        }
5187
5188        public boolean hasValue() { 
5189          return this.value != null && !this.value.isEmpty();
5190        }
5191
5192        /**
5193         * @param value {@link #value} (A non-monetary value for example a percentage. 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
5194         */
5195        public AdjudicationComponent setValueElement(DecimalType value) { 
5196          this.value = value;
5197          return this;
5198        }
5199
5200        /**
5201         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5202         */
5203        public BigDecimal getValue() { 
5204          return this.value == null ? null : this.value.getValue();
5205        }
5206
5207        /**
5208         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5209         */
5210        public AdjudicationComponent setValue(BigDecimal value) { 
5211          if (value == null)
5212            this.value = null;
5213          else {
5214            if (this.value == null)
5215              this.value = new DecimalType();
5216            this.value.setValue(value);
5217          }
5218          return this;
5219        }
5220
5221        /**
5222         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5223         */
5224        public AdjudicationComponent setValue(long value) { 
5225              this.value = new DecimalType();
5226            this.value.setValue(value);
5227          return this;
5228        }
5229
5230        /**
5231         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5232         */
5233        public AdjudicationComponent setValue(double value) { 
5234              this.value = new DecimalType();
5235            this.value.setValue(value);
5236          return this;
5237        }
5238
5239        protected void listChildren(List<Property> children) {
5240          super.listChildren(children);
5241          children.add(new Property("category", "CodeableConcept", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, 1, category));
5242          children.add(new Property("reason", "CodeableConcept", "Adjudication reason such as limit reached.", 0, 1, reason));
5243          children.add(new Property("amount", "Money", "Monitory amount associated with the code.", 0, 1, amount));
5244          children.add(new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, 1, value));
5245        }
5246
5247        @Override
5248        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5249          switch (_hash) {
5250          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, 1, category);
5251          case -934964668: /*reason*/  return new Property("reason", "CodeableConcept", "Adjudication reason such as limit reached.", 0, 1, reason);
5252          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monitory amount associated with the code.", 0, 1, amount);
5253          case 111972721: /*value*/  return new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, 1, value);
5254          default: return super.getNamedProperty(_hash, _name, _checkValid);
5255          }
5256
5257        }
5258
5259      @Override
5260      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5261        switch (hash) {
5262        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
5263        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
5264        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
5265        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
5266        default: return super.getProperty(hash, name, checkValid);
5267        }
5268
5269      }
5270
5271      @Override
5272      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5273        switch (hash) {
5274        case 50511102: // category
5275          this.category = castToCodeableConcept(value); // CodeableConcept
5276          return value;
5277        case -934964668: // reason
5278          this.reason = castToCodeableConcept(value); // CodeableConcept
5279          return value;
5280        case -1413853096: // amount
5281          this.amount = castToMoney(value); // Money
5282          return value;
5283        case 111972721: // value
5284          this.value = castToDecimal(value); // DecimalType
5285          return value;
5286        default: return super.setProperty(hash, name, value);
5287        }
5288
5289      }
5290
5291      @Override
5292      public Base setProperty(String name, Base value) throws FHIRException {
5293        if (name.equals("category")) {
5294          this.category = castToCodeableConcept(value); // CodeableConcept
5295        } else if (name.equals("reason")) {
5296          this.reason = castToCodeableConcept(value); // CodeableConcept
5297        } else if (name.equals("amount")) {
5298          this.amount = castToMoney(value); // Money
5299        } else if (name.equals("value")) {
5300          this.value = castToDecimal(value); // DecimalType
5301        } else
5302          return super.setProperty(name, value);
5303        return value;
5304      }
5305
5306      @Override
5307      public Base makeProperty(int hash, String name) throws FHIRException {
5308        switch (hash) {
5309        case 50511102:  return getCategory(); 
5310        case -934964668:  return getReason(); 
5311        case -1413853096:  return getAmount(); 
5312        case 111972721:  return getValueElement();
5313        default: return super.makeProperty(hash, name);
5314        }
5315
5316      }
5317
5318      @Override
5319      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5320        switch (hash) {
5321        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5322        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
5323        case -1413853096: /*amount*/ return new String[] {"Money"};
5324        case 111972721: /*value*/ return new String[] {"decimal"};
5325        default: return super.getTypesForProperty(hash, name);
5326        }
5327
5328      }
5329
5330      @Override
5331      public Base addChild(String name) throws FHIRException {
5332        if (name.equals("category")) {
5333          this.category = new CodeableConcept();
5334          return this.category;
5335        }
5336        else if (name.equals("reason")) {
5337          this.reason = new CodeableConcept();
5338          return this.reason;
5339        }
5340        else if (name.equals("amount")) {
5341          this.amount = new Money();
5342          return this.amount;
5343        }
5344        else if (name.equals("value")) {
5345          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
5346        }
5347        else
5348          return super.addChild(name);
5349      }
5350
5351      public AdjudicationComponent copy() {
5352        AdjudicationComponent dst = new AdjudicationComponent();
5353        copyValues(dst);
5354        dst.category = category == null ? null : category.copy();
5355        dst.reason = reason == null ? null : reason.copy();
5356        dst.amount = amount == null ? null : amount.copy();
5357        dst.value = value == null ? null : value.copy();
5358        return dst;
5359      }
5360
5361      @Override
5362      public boolean equalsDeep(Base other_) {
5363        if (!super.equalsDeep(other_))
5364          return false;
5365        if (!(other_ instanceof AdjudicationComponent))
5366          return false;
5367        AdjudicationComponent o = (AdjudicationComponent) other_;
5368        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
5369           && compareDeep(value, o.value, true);
5370      }
5371
5372      @Override
5373      public boolean equalsShallow(Base other_) {
5374        if (!super.equalsShallow(other_))
5375          return false;
5376        if (!(other_ instanceof AdjudicationComponent))
5377          return false;
5378        AdjudicationComponent o = (AdjudicationComponent) other_;
5379        return compareValues(value, o.value, true);
5380      }
5381
5382      public boolean isEmpty() {
5383        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount
5384          , value);
5385      }
5386
5387  public String fhirType() {
5388    return "ExplanationOfBenefit.item.adjudication";
5389
5390  }
5391
5392  }
5393
5394    @Block()
5395    public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
5396        /**
5397         * A service line number.
5398         */
5399        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
5400        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
5401        protected PositiveIntType sequence;
5402
5403        /**
5404         * The type of revenue or cost center providing the product and/or service.
5405         */
5406        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5407        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
5408        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
5409        protected CodeableConcept revenue;
5410
5411        /**
5412         * Health Care Service Type Codes to identify the classification of service or benefits.
5413         */
5414        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
5415        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes to identify the classification of service or benefits." )
5416        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
5417        protected CodeableConcept category;
5418
5419        /**
5420         * If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.
5421         */
5422        @Child(name = "billcode", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
5423        @Description(shortDefinition="Billing Code", formalDefinition="If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'." )
5424        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
5425        protected CodeableConcept billcode;
5426
5427        /**
5428         * Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.
5429         */
5430        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5431        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours." )
5432        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
5433        protected List<CodeableConcept> modifier;
5434
5435        /**
5436         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
5437         */
5438        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5439        @Description(shortDefinition="Program specific reason for item inclusion", formalDefinition="For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program." )
5440        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
5441        protected List<CodeableConcept> programCode;
5442
5443        /**
5444         * The number of repetitions of a service or product.
5445         */
5446        @Child(name = "quantity", type = {Quantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
5447        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
5448        protected Quantity quantity;
5449
5450        /**
5451         * If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.
5452         */
5453        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
5454        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group." )
5455        protected Money unitPrice;
5456
5457        /**
5458         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
5459         */
5460        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
5461        @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." )
5462        protected DecimalType factor;
5463
5464        /**
5465         * The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
5466         */
5467        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
5468        @Description(shortDefinition="Total additional item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
5469        protected Money net;
5470
5471        /**
5472         * List of Unique Device Identifiers associated with this line item.
5473         */
5474        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5475        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
5476        protected List<Reference> udi;
5477        /**
5478         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
5479         */
5480        protected List<Device> udiTarget;
5481
5482
5483        /**
5484         * A list of note references to the notes provided below.
5485         */
5486        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5487        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
5488        protected List<PositiveIntType> noteNumber;
5489
5490        /**
5491         * The adjudication results.
5492         */
5493        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5494        @Description(shortDefinition="Detail level adjudication details", formalDefinition="The adjudication results." )
5495        protected List<AdjudicationComponent> adjudication;
5496
5497        /**
5498         * Third-tier of goods and services.
5499         */
5500        @Child(name = "subDetail", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5501        @Description(shortDefinition="Additional items", formalDefinition="Third-tier of goods and services." )
5502        protected List<SubDetailComponent> subDetail;
5503
5504        private static final long serialVersionUID = -299169019L;
5505
5506    /**
5507     * Constructor
5508     */
5509      public DetailComponent() {
5510        super();
5511      }
5512
5513    /**
5514     * Constructor
5515     */
5516      public DetailComponent(PositiveIntType sequence) {
5517        super();
5518        this.sequence = sequence;
5519      }
5520
5521        /**
5522         * @return {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
5523         */
5524        public PositiveIntType getSequenceElement() { 
5525          if (this.sequence == null)
5526            if (Configuration.errorOnAutoCreate())
5527              throw new Error("Attempt to auto-create DetailComponent.sequence");
5528            else if (Configuration.doAutoCreate())
5529              this.sequence = new PositiveIntType(); // bb
5530          return this.sequence;
5531        }
5532
5533        public boolean hasSequenceElement() { 
5534          return this.sequence != null && !this.sequence.isEmpty();
5535        }
5536
5537        public boolean hasSequence() { 
5538          return this.sequence != null && !this.sequence.isEmpty();
5539        }
5540
5541        /**
5542         * @param value {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
5543         */
5544        public DetailComponent setSequenceElement(PositiveIntType value) { 
5545          this.sequence = value;
5546          return this;
5547        }
5548
5549        /**
5550         * @return A service line number.
5551         */
5552        public int getSequence() { 
5553          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
5554        }
5555
5556        /**
5557         * @param value A service line number.
5558         */
5559        public DetailComponent setSequence(int value) { 
5560            if (this.sequence == null)
5561              this.sequence = new PositiveIntType();
5562            this.sequence.setValue(value);
5563          return this;
5564        }
5565
5566        /**
5567         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5568         */
5569        public CodeableConcept getRevenue() { 
5570          if (this.revenue == null)
5571            if (Configuration.errorOnAutoCreate())
5572              throw new Error("Attempt to auto-create DetailComponent.revenue");
5573            else if (Configuration.doAutoCreate())
5574              this.revenue = new CodeableConcept(); // cc
5575          return this.revenue;
5576        }
5577
5578        public boolean hasRevenue() { 
5579          return this.revenue != null && !this.revenue.isEmpty();
5580        }
5581
5582        /**
5583         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5584         */
5585        public DetailComponent setRevenue(CodeableConcept value) { 
5586          this.revenue = value;
5587          return this;
5588        }
5589
5590        /**
5591         * @return {@link #category} (Health Care Service Type Codes to identify the classification of service or benefits.)
5592         */
5593        public CodeableConcept getCategory() { 
5594          if (this.category == null)
5595            if (Configuration.errorOnAutoCreate())
5596              throw new Error("Attempt to auto-create DetailComponent.category");
5597            else if (Configuration.doAutoCreate())
5598              this.category = new CodeableConcept(); // cc
5599          return this.category;
5600        }
5601
5602        public boolean hasCategory() { 
5603          return this.category != null && !this.category.isEmpty();
5604        }
5605
5606        /**
5607         * @param value {@link #category} (Health Care Service Type Codes to identify the classification of service or benefits.)
5608         */
5609        public DetailComponent setCategory(CodeableConcept value) { 
5610          this.category = value;
5611          return this;
5612        }
5613
5614        /**
5615         * @return {@link #billcode} (If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.)
5616         */
5617        public CodeableConcept getBillcode() { 
5618          if (this.billcode == null)
5619            if (Configuration.errorOnAutoCreate())
5620              throw new Error("Attempt to auto-create DetailComponent.billcode");
5621            else if (Configuration.doAutoCreate())
5622              this.billcode = new CodeableConcept(); // cc
5623          return this.billcode;
5624        }
5625
5626        public boolean hasBillcode() { 
5627          return this.billcode != null && !this.billcode.isEmpty();
5628        }
5629
5630        /**
5631         * @param value {@link #billcode} (If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.)
5632         */
5633        public DetailComponent setBillcode(CodeableConcept value) { 
5634          this.billcode = value;
5635          return this;
5636        }
5637
5638        /**
5639         * @return {@link #modifier} (Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.)
5640         */
5641        public List<CodeableConcept> getModifier() { 
5642          if (this.modifier == null)
5643            this.modifier = new ArrayList<CodeableConcept>();
5644          return this.modifier;
5645        }
5646
5647        /**
5648         * @return Returns a reference to <code>this</code> for easy method chaining
5649         */
5650        public DetailComponent setModifier(List<CodeableConcept> theModifier) { 
5651          this.modifier = theModifier;
5652          return this;
5653        }
5654
5655        public boolean hasModifier() { 
5656          if (this.modifier == null)
5657            return false;
5658          for (CodeableConcept item : this.modifier)
5659            if (!item.isEmpty())
5660              return true;
5661          return false;
5662        }
5663
5664        public CodeableConcept addModifier() { //3
5665          CodeableConcept t = new CodeableConcept();
5666          if (this.modifier == null)
5667            this.modifier = new ArrayList<CodeableConcept>();
5668          this.modifier.add(t);
5669          return t;
5670        }
5671
5672        public DetailComponent addModifier(CodeableConcept t) { //3
5673          if (t == null)
5674            return this;
5675          if (this.modifier == null)
5676            this.modifier = new ArrayList<CodeableConcept>();
5677          this.modifier.add(t);
5678          return this;
5679        }
5680
5681        /**
5682         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
5683         */
5684        public CodeableConcept getModifierFirstRep() { 
5685          if (getModifier().isEmpty()) {
5686            addModifier();
5687          }
5688          return getModifier().get(0);
5689        }
5690
5691        /**
5692         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
5693         */
5694        public List<CodeableConcept> getProgramCode() { 
5695          if (this.programCode == null)
5696            this.programCode = new ArrayList<CodeableConcept>();
5697          return this.programCode;
5698        }
5699
5700        /**
5701         * @return Returns a reference to <code>this</code> for easy method chaining
5702         */
5703        public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
5704          this.programCode = theProgramCode;
5705          return this;
5706        }
5707
5708        public boolean hasProgramCode() { 
5709          if (this.programCode == null)
5710            return false;
5711          for (CodeableConcept item : this.programCode)
5712            if (!item.isEmpty())
5713              return true;
5714          return false;
5715        }
5716
5717        public CodeableConcept addProgramCode() { //3
5718          CodeableConcept t = new CodeableConcept();
5719          if (this.programCode == null)
5720            this.programCode = new ArrayList<CodeableConcept>();
5721          this.programCode.add(t);
5722          return t;
5723        }
5724
5725        public DetailComponent addProgramCode(CodeableConcept t) { //3
5726          if (t == null)
5727            return this;
5728          if (this.programCode == null)
5729            this.programCode = new ArrayList<CodeableConcept>();
5730          this.programCode.add(t);
5731          return this;
5732        }
5733
5734        /**
5735         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
5736         */
5737        public CodeableConcept getProgramCodeFirstRep() { 
5738          if (getProgramCode().isEmpty()) {
5739            addProgramCode();
5740          }
5741          return getProgramCode().get(0);
5742        }
5743
5744        /**
5745         * @return {@link #quantity} (The number of repetitions of a service or product.)
5746         */
5747        public Quantity getQuantity() { 
5748          if (this.quantity == null)
5749            if (Configuration.errorOnAutoCreate())
5750              throw new Error("Attempt to auto-create DetailComponent.quantity");
5751            else if (Configuration.doAutoCreate())
5752              this.quantity = new Quantity(); // cc
5753          return this.quantity;
5754        }
5755
5756        public boolean hasQuantity() { 
5757          return this.quantity != null && !this.quantity.isEmpty();
5758        }
5759
5760        /**
5761         * @param value {@link #quantity} (The number of repetitions of a service or product.)
5762         */
5763        public DetailComponent setQuantity(Quantity value) { 
5764          this.quantity = value;
5765          return this;
5766        }
5767
5768        /**
5769         * @return {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
5770         */
5771        public Money getUnitPrice() { 
5772          if (this.unitPrice == null)
5773            if (Configuration.errorOnAutoCreate())
5774              throw new Error("Attempt to auto-create DetailComponent.unitPrice");
5775            else if (Configuration.doAutoCreate())
5776              this.unitPrice = new Money(); // cc
5777          return this.unitPrice;
5778        }
5779
5780        public boolean hasUnitPrice() { 
5781          return this.unitPrice != null && !this.unitPrice.isEmpty();
5782        }
5783
5784        /**
5785         * @param value {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
5786         */
5787        public DetailComponent setUnitPrice(Money value) { 
5788          this.unitPrice = value;
5789          return this;
5790        }
5791
5792        /**
5793         * @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
5794         */
5795        public DecimalType getFactorElement() { 
5796          if (this.factor == null)
5797            if (Configuration.errorOnAutoCreate())
5798              throw new Error("Attempt to auto-create DetailComponent.factor");
5799            else if (Configuration.doAutoCreate())
5800              this.factor = new DecimalType(); // bb
5801          return this.factor;
5802        }
5803
5804        public boolean hasFactorElement() { 
5805          return this.factor != null && !this.factor.isEmpty();
5806        }
5807
5808        public boolean hasFactor() { 
5809          return this.factor != null && !this.factor.isEmpty();
5810        }
5811
5812        /**
5813         * @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
5814         */
5815        public DetailComponent setFactorElement(DecimalType value) { 
5816          this.factor = value;
5817          return this;
5818        }
5819
5820        /**
5821         * @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.
5822         */
5823        public BigDecimal getFactor() { 
5824          return this.factor == null ? null : this.factor.getValue();
5825        }
5826
5827        /**
5828         * @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.
5829         */
5830        public DetailComponent setFactor(BigDecimal value) { 
5831          if (value == null)
5832            this.factor = null;
5833          else {
5834            if (this.factor == null)
5835              this.factor = new DecimalType();
5836            this.factor.setValue(value);
5837          }
5838          return this;
5839        }
5840
5841        /**
5842         * @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.
5843         */
5844        public DetailComponent setFactor(long value) { 
5845              this.factor = new DecimalType();
5846            this.factor.setValue(value);
5847          return this;
5848        }
5849
5850        /**
5851         * @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.
5852         */
5853        public DetailComponent setFactor(double value) { 
5854              this.factor = new DecimalType();
5855            this.factor.setValue(value);
5856          return this;
5857        }
5858
5859        /**
5860         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
5861         */
5862        public Money getNet() { 
5863          if (this.net == null)
5864            if (Configuration.errorOnAutoCreate())
5865              throw new Error("Attempt to auto-create DetailComponent.net");
5866            else if (Configuration.doAutoCreate())
5867              this.net = new Money(); // cc
5868          return this.net;
5869        }
5870
5871        public boolean hasNet() { 
5872          return this.net != null && !this.net.isEmpty();
5873        }
5874
5875        /**
5876         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
5877         */
5878        public DetailComponent setNet(Money value) { 
5879          this.net = value;
5880          return this;
5881        }
5882
5883        /**
5884         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
5885         */
5886        public List<Reference> getUdi() { 
5887          if (this.udi == null)
5888            this.udi = new ArrayList<Reference>();
5889          return this.udi;
5890        }
5891
5892        /**
5893         * @return Returns a reference to <code>this</code> for easy method chaining
5894         */
5895        public DetailComponent setUdi(List<Reference> theUdi) { 
5896          this.udi = theUdi;
5897          return this;
5898        }
5899
5900        public boolean hasUdi() { 
5901          if (this.udi == null)
5902            return false;
5903          for (Reference item : this.udi)
5904            if (!item.isEmpty())
5905              return true;
5906          return false;
5907        }
5908
5909        public Reference addUdi() { //3
5910          Reference t = new Reference();
5911          if (this.udi == null)
5912            this.udi = new ArrayList<Reference>();
5913          this.udi.add(t);
5914          return t;
5915        }
5916
5917        public DetailComponent addUdi(Reference t) { //3
5918          if (t == null)
5919            return this;
5920          if (this.udi == null)
5921            this.udi = new ArrayList<Reference>();
5922          this.udi.add(t);
5923          return this;
5924        }
5925
5926        /**
5927         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
5928         */
5929        public Reference getUdiFirstRep() { 
5930          if (getUdi().isEmpty()) {
5931            addUdi();
5932          }
5933          return getUdi().get(0);
5934        }
5935
5936        /**
5937         * @deprecated Use Reference#setResource(IBaseResource) instead
5938         */
5939        @Deprecated
5940        public List<Device> getUdiTarget() { 
5941          if (this.udiTarget == null)
5942            this.udiTarget = new ArrayList<Device>();
5943          return this.udiTarget;
5944        }
5945
5946        /**
5947         * @deprecated Use Reference#setResource(IBaseResource) instead
5948         */
5949        @Deprecated
5950        public Device addUdiTarget() { 
5951          Device r = new Device();
5952          if (this.udiTarget == null)
5953            this.udiTarget = new ArrayList<Device>();
5954          this.udiTarget.add(r);
5955          return r;
5956        }
5957
5958        /**
5959         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
5960         */
5961        public List<PositiveIntType> getNoteNumber() { 
5962          if (this.noteNumber == null)
5963            this.noteNumber = new ArrayList<PositiveIntType>();
5964          return this.noteNumber;
5965        }
5966
5967        /**
5968         * @return Returns a reference to <code>this</code> for easy method chaining
5969         */
5970        public DetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
5971          this.noteNumber = theNoteNumber;
5972          return this;
5973        }
5974
5975        public boolean hasNoteNumber() { 
5976          if (this.noteNumber == null)
5977            return false;
5978          for (PositiveIntType item : this.noteNumber)
5979            if (!item.isEmpty())
5980              return true;
5981          return false;
5982        }
5983
5984        /**
5985         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
5986         */
5987        public PositiveIntType addNoteNumberElement() {//2 
5988          PositiveIntType t = new PositiveIntType();
5989          if (this.noteNumber == null)
5990            this.noteNumber = new ArrayList<PositiveIntType>();
5991          this.noteNumber.add(t);
5992          return t;
5993        }
5994
5995        /**
5996         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
5997         */
5998        public DetailComponent addNoteNumber(int value) { //1
5999          PositiveIntType t = new PositiveIntType();
6000          t.setValue(value);
6001          if (this.noteNumber == null)
6002            this.noteNumber = new ArrayList<PositiveIntType>();
6003          this.noteNumber.add(t);
6004          return this;
6005        }
6006
6007        /**
6008         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
6009         */
6010        public boolean hasNoteNumber(int value) { 
6011          if (this.noteNumber == null)
6012            return false;
6013          for (PositiveIntType v : this.noteNumber)
6014            if (v.getValue().equals(value)) // positiveInt
6015              return true;
6016          return false;
6017        }
6018
6019        /**
6020         * @return {@link #adjudication} (The adjudication results.)
6021         */
6022        public List<AdjudicationComponent> getAdjudication() { 
6023          if (this.adjudication == null)
6024            this.adjudication = new ArrayList<AdjudicationComponent>();
6025          return this.adjudication;
6026        }
6027
6028        /**
6029         * @return Returns a reference to <code>this</code> for easy method chaining
6030         */
6031        public DetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
6032          this.adjudication = theAdjudication;
6033          return this;
6034        }
6035
6036        public boolean hasAdjudication() { 
6037          if (this.adjudication == null)
6038            return false;
6039          for (AdjudicationComponent item : this.adjudication)
6040            if (!item.isEmpty())
6041              return true;
6042          return false;
6043        }
6044
6045        public AdjudicationComponent addAdjudication() { //3
6046          AdjudicationComponent t = new AdjudicationComponent();
6047          if (this.adjudication == null)
6048            this.adjudication = new ArrayList<AdjudicationComponent>();
6049          this.adjudication.add(t);
6050          return t;
6051        }
6052
6053        public DetailComponent addAdjudication(AdjudicationComponent t) { //3
6054          if (t == null)
6055            return this;
6056          if (this.adjudication == null)
6057            this.adjudication = new ArrayList<AdjudicationComponent>();
6058          this.adjudication.add(t);
6059          return this;
6060        }
6061
6062        /**
6063         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
6064         */
6065        public AdjudicationComponent getAdjudicationFirstRep() { 
6066          if (getAdjudication().isEmpty()) {
6067            addAdjudication();
6068          }
6069          return getAdjudication().get(0);
6070        }
6071
6072        /**
6073         * @return {@link #subDetail} (Third-tier of goods and services.)
6074         */
6075        public List<SubDetailComponent> getSubDetail() { 
6076          if (this.subDetail == null)
6077            this.subDetail = new ArrayList<SubDetailComponent>();
6078          return this.subDetail;
6079        }
6080
6081        /**
6082         * @return Returns a reference to <code>this</code> for easy method chaining
6083         */
6084        public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) { 
6085          this.subDetail = theSubDetail;
6086          return this;
6087        }
6088
6089        public boolean hasSubDetail() { 
6090          if (this.subDetail == null)
6091            return false;
6092          for (SubDetailComponent item : this.subDetail)
6093            if (!item.isEmpty())
6094              return true;
6095          return false;
6096        }
6097
6098        public SubDetailComponent addSubDetail() { //3
6099          SubDetailComponent t = new SubDetailComponent();
6100          if (this.subDetail == null)
6101            this.subDetail = new ArrayList<SubDetailComponent>();
6102          this.subDetail.add(t);
6103          return t;
6104        }
6105
6106        public DetailComponent addSubDetail(SubDetailComponent t) { //3
6107          if (t == null)
6108            return this;
6109          if (this.subDetail == null)
6110            this.subDetail = new ArrayList<SubDetailComponent>();
6111          this.subDetail.add(t);
6112          return this;
6113        }
6114
6115        /**
6116         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist
6117         */
6118        public SubDetailComponent getSubDetailFirstRep() { 
6119          if (getSubDetail().isEmpty()) {
6120            addSubDetail();
6121          }
6122          return getSubDetail().get(0);
6123        }
6124
6125        protected void listChildren(List<Property> children) {
6126          super.listChildren(children);
6127          children.add(new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence));
6128          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
6129          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes to identify the classification of service or benefits.", 0, 1, category));
6130          children.add(new Property("billcode", "CodeableConcept", "If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, billcode));
6131          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier));
6132          children.add(new Property("programCode", "CodeableConcept", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode));
6133          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
6134          children.add(new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, 1, unitPrice));
6135          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));
6136          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net));
6137          children.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
6138          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
6139          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6140          children.add(new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
6141        }
6142
6143        @Override
6144        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6145          switch (_hash) {
6146          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence);
6147          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
6148          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes to identify the classification of service or benefits.", 0, 1, category);
6149          case 890074740: /*billcode*/  return new Property("billcode", "CodeableConcept", "If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, billcode);
6150          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier);
6151          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode);
6152          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
6153          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, 1, unitPrice);
6154          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);
6155          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net);
6156          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
6157          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
6158          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
6159          case -828829007: /*subDetail*/  return new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
6160          default: return super.getNamedProperty(_hash, _name, _checkValid);
6161          }
6162
6163        }
6164
6165      @Override
6166      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6167        switch (hash) {
6168        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
6169        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
6170        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
6171        case 890074740: /*billcode*/ return this.billcode == null ? new Base[0] : new Base[] {this.billcode}; // CodeableConcept
6172        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
6173        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
6174        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
6175        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6176        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6177        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6178        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
6179        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
6180        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
6181        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
6182        default: return super.getProperty(hash, name, checkValid);
6183        }
6184
6185      }
6186
6187      @Override
6188      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6189        switch (hash) {
6190        case 1349547969: // sequence
6191          this.sequence = castToPositiveInt(value); // PositiveIntType
6192          return value;
6193        case 1099842588: // revenue
6194          this.revenue = castToCodeableConcept(value); // CodeableConcept
6195          return value;
6196        case 50511102: // category
6197          this.category = castToCodeableConcept(value); // CodeableConcept
6198          return value;
6199        case 890074740: // billcode
6200          this.billcode = castToCodeableConcept(value); // CodeableConcept
6201          return value;
6202        case -615513385: // modifier
6203          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
6204          return value;
6205        case 1010065041: // programCode
6206          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
6207          return value;
6208        case -1285004149: // quantity
6209          this.quantity = castToQuantity(value); // Quantity
6210          return value;
6211        case -486196699: // unitPrice
6212          this.unitPrice = castToMoney(value); // Money
6213          return value;
6214        case -1282148017: // factor
6215          this.factor = castToDecimal(value); // DecimalType
6216          return value;
6217        case 108957: // net
6218          this.net = castToMoney(value); // Money
6219          return value;
6220        case 115642: // udi
6221          this.getUdi().add(castToReference(value)); // Reference
6222          return value;
6223        case -1110033957: // noteNumber
6224          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
6225          return value;
6226        case -231349275: // adjudication
6227          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
6228          return value;
6229        case -828829007: // subDetail
6230          this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
6231          return value;
6232        default: return super.setProperty(hash, name, value);
6233        }
6234
6235      }
6236
6237      @Override
6238      public Base setProperty(String name, Base value) throws FHIRException {
6239        if (name.equals("sequence")) {
6240          this.sequence = castToPositiveInt(value); // PositiveIntType
6241        } else if (name.equals("revenue")) {
6242          this.revenue = castToCodeableConcept(value); // CodeableConcept
6243        } else if (name.equals("category")) {
6244          this.category = castToCodeableConcept(value); // CodeableConcept
6245        } else if (name.equals("billcode")) {
6246          this.billcode = castToCodeableConcept(value); // CodeableConcept
6247        } else if (name.equals("modifier")) {
6248          this.getModifier().add(castToCodeableConcept(value));
6249        } else if (name.equals("programCode")) {
6250          this.getProgramCode().add(castToCodeableConcept(value));
6251        } else if (name.equals("quantity")) {
6252          this.quantity = castToQuantity(value); // Quantity
6253        } else if (name.equals("unitPrice")) {
6254          this.unitPrice = castToMoney(value); // Money
6255        } else if (name.equals("factor")) {
6256          this.factor = castToDecimal(value); // DecimalType
6257        } else if (name.equals("net")) {
6258          this.net = castToMoney(value); // Money
6259        } else if (name.equals("udi")) {
6260          this.getUdi().add(castToReference(value));
6261        } else if (name.equals("noteNumber")) {
6262          this.getNoteNumber().add(castToPositiveInt(value));
6263        } else if (name.equals("adjudication")) {
6264          this.getAdjudication().add((AdjudicationComponent) value);
6265        } else if (name.equals("subDetail")) {
6266          this.getSubDetail().add((SubDetailComponent) value);
6267        } else
6268          return super.setProperty(name, value);
6269        return value;
6270      }
6271
6272      @Override
6273      public Base makeProperty(int hash, String name) throws FHIRException {
6274        switch (hash) {
6275        case 1349547969:  return getSequenceElement();
6276        case 1099842588:  return getRevenue(); 
6277        case 50511102:  return getCategory(); 
6278        case 890074740:  return getBillcode(); 
6279        case -615513385:  return addModifier(); 
6280        case 1010065041:  return addProgramCode(); 
6281        case -1285004149:  return getQuantity(); 
6282        case -486196699:  return getUnitPrice(); 
6283        case -1282148017:  return getFactorElement();
6284        case 108957:  return getNet(); 
6285        case 115642:  return addUdi(); 
6286        case -1110033957:  return addNoteNumberElement();
6287        case -231349275:  return addAdjudication(); 
6288        case -828829007:  return addSubDetail(); 
6289        default: return super.makeProperty(hash, name);
6290        }
6291
6292      }
6293
6294      @Override
6295      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6296        switch (hash) {
6297        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
6298        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
6299        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
6300        case 890074740: /*billcode*/ return new String[] {"CodeableConcept"};
6301        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
6302        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
6303        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
6304        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6305        case -1282148017: /*factor*/ return new String[] {"decimal"};
6306        case 108957: /*net*/ return new String[] {"Money"};
6307        case 115642: /*udi*/ return new String[] {"Reference"};
6308        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
6309        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
6310        case -828829007: /*subDetail*/ return new String[] {};
6311        default: return super.getTypesForProperty(hash, name);
6312        }
6313
6314      }
6315
6316      @Override
6317      public Base addChild(String name) throws FHIRException {
6318        if (name.equals("sequence")) {
6319          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
6320        }
6321        else if (name.equals("revenue")) {
6322          this.revenue = new CodeableConcept();
6323          return this.revenue;
6324        }
6325        else if (name.equals("category")) {
6326          this.category = new CodeableConcept();
6327          return this.category;
6328        }
6329        else if (name.equals("billcode")) {
6330          this.billcode = new CodeableConcept();
6331          return this.billcode;
6332        }
6333        else if (name.equals("modifier")) {
6334          return addModifier();
6335        }
6336        else if (name.equals("programCode")) {
6337          return addProgramCode();
6338        }
6339        else if (name.equals("quantity")) {
6340          this.quantity = new Quantity();
6341          return this.quantity;
6342        }
6343        else if (name.equals("unitPrice")) {
6344          this.unitPrice = new Money();
6345          return this.unitPrice;
6346        }
6347        else if (name.equals("factor")) {
6348          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
6349        }
6350        else if (name.equals("net")) {
6351          this.net = new Money();
6352          return this.net;
6353        }
6354        else if (name.equals("udi")) {
6355          return addUdi();
6356        }
6357        else if (name.equals("noteNumber")) {
6358          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
6359        }
6360        else if (name.equals("adjudication")) {
6361          return addAdjudication();
6362        }
6363        else if (name.equals("subDetail")) {
6364          return addSubDetail();
6365        }
6366        else
6367          return super.addChild(name);
6368      }
6369
6370      public DetailComponent copy() {
6371        DetailComponent dst = new DetailComponent();
6372        copyValues(dst);
6373        dst.sequence = sequence == null ? null : sequence.copy();
6374        dst.revenue = revenue == null ? null : revenue.copy();
6375        dst.category = category == null ? null : category.copy();
6376        dst.billcode = billcode == null ? null : billcode.copy();
6377        if (modifier != null) {
6378          dst.modifier = new ArrayList<CodeableConcept>();
6379          for (CodeableConcept i : modifier)
6380            dst.modifier.add(i.copy());
6381        };
6382        if (programCode != null) {
6383          dst.programCode = new ArrayList<CodeableConcept>();
6384          for (CodeableConcept i : programCode)
6385            dst.programCode.add(i.copy());
6386        };
6387        dst.quantity = quantity == null ? null : quantity.copy();
6388        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6389        dst.factor = factor == null ? null : factor.copy();
6390        dst.net = net == null ? null : net.copy();
6391        if (udi != null) {
6392          dst.udi = new ArrayList<Reference>();
6393          for (Reference i : udi)
6394            dst.udi.add(i.copy());
6395        };
6396        if (noteNumber != null) {
6397          dst.noteNumber = new ArrayList<PositiveIntType>();
6398          for (PositiveIntType i : noteNumber)
6399            dst.noteNumber.add(i.copy());
6400        };
6401        if (adjudication != null) {
6402          dst.adjudication = new ArrayList<AdjudicationComponent>();
6403          for (AdjudicationComponent i : adjudication)
6404            dst.adjudication.add(i.copy());
6405        };
6406        if (subDetail != null) {
6407          dst.subDetail = new ArrayList<SubDetailComponent>();
6408          for (SubDetailComponent i : subDetail)
6409            dst.subDetail.add(i.copy());
6410        };
6411        return dst;
6412      }
6413
6414      @Override
6415      public boolean equalsDeep(Base other_) {
6416        if (!super.equalsDeep(other_))
6417          return false;
6418        if (!(other_ instanceof DetailComponent))
6419          return false;
6420        DetailComponent o = (DetailComponent) other_;
6421        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
6422           && compareDeep(billcode, o.billcode, true) && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
6423           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
6424           && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true) && compareDeep(noteNumber, o.noteNumber, true)
6425           && compareDeep(adjudication, o.adjudication, true) && compareDeep(subDetail, o.subDetail, true)
6426          ;
6427      }
6428
6429      @Override
6430      public boolean equalsShallow(Base other_) {
6431        if (!super.equalsShallow(other_))
6432          return false;
6433        if (!(other_ instanceof DetailComponent))
6434          return false;
6435        DetailComponent o = (DetailComponent) other_;
6436        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
6437          ;
6438      }
6439
6440      public boolean isEmpty() {
6441        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
6442          , billcode, modifier, programCode, quantity, unitPrice, factor, net, udi, noteNumber
6443          , adjudication, subDetail);
6444      }
6445
6446  public String fhirType() {
6447    return "ExplanationOfBenefit.item.detail";
6448
6449  }
6450
6451  }
6452
6453    @Block()
6454    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
6455        /**
6456         * A service line number.
6457         */
6458        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
6459        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
6460        protected PositiveIntType sequence;
6461
6462        /**
6463         * The type of revenue or cost center providing the product and/or service.
6464         */
6465        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
6466        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
6467        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
6468        protected CodeableConcept revenue;
6469
6470        /**
6471         * Health Care Service Type Codes to identify the classification of service or benefits.
6472         */
6473        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
6474        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes to identify the classification of service or benefits." )
6475        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
6476        protected CodeableConcept category;
6477
6478        /**
6479         * A code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).
6480         */
6481        @Child(name = "billcode", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
6482        @Description(shortDefinition="Billing Code", formalDefinition="A code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI)." )
6483        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
6484        protected CodeableConcept billcode;
6485
6486        /**
6487         * Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.
6488         */
6489        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6490        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours." )
6491        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
6492        protected List<CodeableConcept> modifier;
6493
6494        /**
6495         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
6496         */
6497        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6498        @Description(shortDefinition="Program specific reason for item inclusion", formalDefinition="For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program." )
6499        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
6500        protected List<CodeableConcept> programCode;
6501
6502        /**
6503         * The number of repetitions of a service or product.
6504         */
6505        @Child(name = "quantity", type = {Quantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
6506        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
6507        protected Quantity quantity;
6508
6509        /**
6510         * The fee for an addittional service or product or charge.
6511         */
6512        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
6513        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="The fee for an addittional service or product or charge." )
6514        protected Money unitPrice;
6515
6516        /**
6517         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
6518         */
6519        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
6520        @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." )
6521        protected DecimalType factor;
6522
6523        /**
6524         * The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
6525         */
6526        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
6527        @Description(shortDefinition="Net additional item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
6528        protected Money net;
6529
6530        /**
6531         * List of Unique Device Identifiers associated with this line item.
6532         */
6533        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6534        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
6535        protected List<Reference> udi;
6536        /**
6537         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
6538         */
6539        protected List<Device> udiTarget;
6540
6541
6542        /**
6543         * A list of note references to the notes provided below.
6544         */
6545        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6546        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
6547        protected List<PositiveIntType> noteNumber;
6548
6549        /**
6550         * The adjudication results.
6551         */
6552        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6553        @Description(shortDefinition="Language if different from the resource", formalDefinition="The adjudication results." )
6554        protected List<AdjudicationComponent> adjudication;
6555
6556        private static final long serialVersionUID = -319838820L;
6557
6558    /**
6559     * Constructor
6560     */
6561      public SubDetailComponent() {
6562        super();
6563      }
6564
6565    /**
6566     * Constructor
6567     */
6568      public SubDetailComponent(PositiveIntType sequence) {
6569        super();
6570        this.sequence = sequence;
6571      }
6572
6573        /**
6574         * @return {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
6575         */
6576        public PositiveIntType getSequenceElement() { 
6577          if (this.sequence == null)
6578            if (Configuration.errorOnAutoCreate())
6579              throw new Error("Attempt to auto-create SubDetailComponent.sequence");
6580            else if (Configuration.doAutoCreate())
6581              this.sequence = new PositiveIntType(); // bb
6582          return this.sequence;
6583        }
6584
6585        public boolean hasSequenceElement() { 
6586          return this.sequence != null && !this.sequence.isEmpty();
6587        }
6588
6589        public boolean hasSequence() { 
6590          return this.sequence != null && !this.sequence.isEmpty();
6591        }
6592
6593        /**
6594         * @param value {@link #sequence} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
6595         */
6596        public SubDetailComponent setSequenceElement(PositiveIntType value) { 
6597          this.sequence = value;
6598          return this;
6599        }
6600
6601        /**
6602         * @return A service line number.
6603         */
6604        public int getSequence() { 
6605          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
6606        }
6607
6608        /**
6609         * @param value A service line number.
6610         */
6611        public SubDetailComponent setSequence(int value) { 
6612            if (this.sequence == null)
6613              this.sequence = new PositiveIntType();
6614            this.sequence.setValue(value);
6615          return this;
6616        }
6617
6618        /**
6619         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
6620         */
6621        public CodeableConcept getRevenue() { 
6622          if (this.revenue == null)
6623            if (Configuration.errorOnAutoCreate())
6624              throw new Error("Attempt to auto-create SubDetailComponent.revenue");
6625            else if (Configuration.doAutoCreate())
6626              this.revenue = new CodeableConcept(); // cc
6627          return this.revenue;
6628        }
6629
6630        public boolean hasRevenue() { 
6631          return this.revenue != null && !this.revenue.isEmpty();
6632        }
6633
6634        /**
6635         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
6636         */
6637        public SubDetailComponent setRevenue(CodeableConcept value) { 
6638          this.revenue = value;
6639          return this;
6640        }
6641
6642        /**
6643         * @return {@link #category} (Health Care Service Type Codes to identify the classification of service or benefits.)
6644         */
6645        public CodeableConcept getCategory() { 
6646          if (this.category == null)
6647            if (Configuration.errorOnAutoCreate())
6648              throw new Error("Attempt to auto-create SubDetailComponent.category");
6649            else if (Configuration.doAutoCreate())
6650              this.category = new CodeableConcept(); // cc
6651          return this.category;
6652        }
6653
6654        public boolean hasCategory() { 
6655          return this.category != null && !this.category.isEmpty();
6656        }
6657
6658        /**
6659         * @param value {@link #category} (Health Care Service Type Codes to identify the classification of service or benefits.)
6660         */
6661        public SubDetailComponent setCategory(CodeableConcept value) { 
6662          this.category = value;
6663          return this;
6664        }
6665
6666        /**
6667         * @return {@link #billcode} (A code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
6668         */
6669        public CodeableConcept getBillcode() { 
6670          if (this.billcode == null)
6671            if (Configuration.errorOnAutoCreate())
6672              throw new Error("Attempt to auto-create SubDetailComponent.billcode");
6673            else if (Configuration.doAutoCreate())
6674              this.billcode = new CodeableConcept(); // cc
6675          return this.billcode;
6676        }
6677
6678        public boolean hasBillcode() { 
6679          return this.billcode != null && !this.billcode.isEmpty();
6680        }
6681
6682        /**
6683         * @param value {@link #billcode} (A code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
6684         */
6685        public SubDetailComponent setBillcode(CodeableConcept value) { 
6686          this.billcode = value;
6687          return this;
6688        }
6689
6690        /**
6691         * @return {@link #modifier} (Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.)
6692         */
6693        public List<CodeableConcept> getModifier() { 
6694          if (this.modifier == null)
6695            this.modifier = new ArrayList<CodeableConcept>();
6696          return this.modifier;
6697        }
6698
6699        /**
6700         * @return Returns a reference to <code>this</code> for easy method chaining
6701         */
6702        public SubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
6703          this.modifier = theModifier;
6704          return this;
6705        }
6706
6707        public boolean hasModifier() { 
6708          if (this.modifier == null)
6709            return false;
6710          for (CodeableConcept item : this.modifier)
6711            if (!item.isEmpty())
6712              return true;
6713          return false;
6714        }
6715
6716        public CodeableConcept addModifier() { //3
6717          CodeableConcept t = new CodeableConcept();
6718          if (this.modifier == null)
6719            this.modifier = new ArrayList<CodeableConcept>();
6720          this.modifier.add(t);
6721          return t;
6722        }
6723
6724        public SubDetailComponent addModifier(CodeableConcept t) { //3
6725          if (t == null)
6726            return this;
6727          if (this.modifier == null)
6728            this.modifier = new ArrayList<CodeableConcept>();
6729          this.modifier.add(t);
6730          return this;
6731        }
6732
6733        /**
6734         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
6735         */
6736        public CodeableConcept getModifierFirstRep() { 
6737          if (getModifier().isEmpty()) {
6738            addModifier();
6739          }
6740          return getModifier().get(0);
6741        }
6742
6743        /**
6744         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
6745         */
6746        public List<CodeableConcept> getProgramCode() { 
6747          if (this.programCode == null)
6748            this.programCode = new ArrayList<CodeableConcept>();
6749          return this.programCode;
6750        }
6751
6752        /**
6753         * @return Returns a reference to <code>this</code> for easy method chaining
6754         */
6755        public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
6756          this.programCode = theProgramCode;
6757          return this;
6758        }
6759
6760        public boolean hasProgramCode() { 
6761          if (this.programCode == null)
6762            return false;
6763          for (CodeableConcept item : this.programCode)
6764            if (!item.isEmpty())
6765              return true;
6766          return false;
6767        }
6768
6769        public CodeableConcept addProgramCode() { //3
6770          CodeableConcept t = new CodeableConcept();
6771          if (this.programCode == null)
6772            this.programCode = new ArrayList<CodeableConcept>();
6773          this.programCode.add(t);
6774          return t;
6775        }
6776
6777        public SubDetailComponent addProgramCode(CodeableConcept t) { //3
6778          if (t == null)
6779            return this;
6780          if (this.programCode == null)
6781            this.programCode = new ArrayList<CodeableConcept>();
6782          this.programCode.add(t);
6783          return this;
6784        }
6785
6786        /**
6787         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
6788         */
6789        public CodeableConcept getProgramCodeFirstRep() { 
6790          if (getProgramCode().isEmpty()) {
6791            addProgramCode();
6792          }
6793          return getProgramCode().get(0);
6794        }
6795
6796        /**
6797         * @return {@link #quantity} (The number of repetitions of a service or product.)
6798         */
6799        public Quantity getQuantity() { 
6800          if (this.quantity == null)
6801            if (Configuration.errorOnAutoCreate())
6802              throw new Error("Attempt to auto-create SubDetailComponent.quantity");
6803            else if (Configuration.doAutoCreate())
6804              this.quantity = new Quantity(); // cc
6805          return this.quantity;
6806        }
6807
6808        public boolean hasQuantity() { 
6809          return this.quantity != null && !this.quantity.isEmpty();
6810        }
6811
6812        /**
6813         * @param value {@link #quantity} (The number of repetitions of a service or product.)
6814         */
6815        public SubDetailComponent setQuantity(Quantity value) { 
6816          this.quantity = value;
6817          return this;
6818        }
6819
6820        /**
6821         * @return {@link #unitPrice} (The fee for an addittional service or product or charge.)
6822         */
6823        public Money getUnitPrice() { 
6824          if (this.unitPrice == null)
6825            if (Configuration.errorOnAutoCreate())
6826              throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
6827            else if (Configuration.doAutoCreate())
6828              this.unitPrice = new Money(); // cc
6829          return this.unitPrice;
6830        }
6831
6832        public boolean hasUnitPrice() { 
6833          return this.unitPrice != null && !this.unitPrice.isEmpty();
6834        }
6835
6836        /**
6837         * @param value {@link #unitPrice} (The fee for an addittional service or product or charge.)
6838         */
6839        public SubDetailComponent setUnitPrice(Money value) { 
6840          this.unitPrice = value;
6841          return this;
6842        }
6843
6844        /**
6845         * @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
6846         */
6847        public DecimalType getFactorElement() { 
6848          if (this.factor == null)
6849            if (Configuration.errorOnAutoCreate())
6850              throw new Error("Attempt to auto-create SubDetailComponent.factor");
6851            else if (Configuration.doAutoCreate())
6852              this.factor = new DecimalType(); // bb
6853          return this.factor;
6854        }
6855
6856        public boolean hasFactorElement() { 
6857          return this.factor != null && !this.factor.isEmpty();
6858        }
6859
6860        public boolean hasFactor() { 
6861          return this.factor != null && !this.factor.isEmpty();
6862        }
6863
6864        /**
6865         * @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
6866         */
6867        public SubDetailComponent setFactorElement(DecimalType value) { 
6868          this.factor = value;
6869          return this;
6870        }
6871
6872        /**
6873         * @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.
6874         */
6875        public BigDecimal getFactor() { 
6876          return this.factor == null ? null : this.factor.getValue();
6877        }
6878
6879        /**
6880         * @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.
6881         */
6882        public SubDetailComponent setFactor(BigDecimal value) { 
6883          if (value == null)
6884            this.factor = null;
6885          else {
6886            if (this.factor == null)
6887              this.factor = new DecimalType();
6888            this.factor.setValue(value);
6889          }
6890          return this;
6891        }
6892
6893        /**
6894         * @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.
6895         */
6896        public SubDetailComponent setFactor(long value) { 
6897              this.factor = new DecimalType();
6898            this.factor.setValue(value);
6899          return this;
6900        }
6901
6902        /**
6903         * @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.
6904         */
6905        public SubDetailComponent setFactor(double value) { 
6906              this.factor = new DecimalType();
6907            this.factor.setValue(value);
6908          return this;
6909        }
6910
6911        /**
6912         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
6913         */
6914        public Money getNet() { 
6915          if (this.net == null)
6916            if (Configuration.errorOnAutoCreate())
6917              throw new Error("Attempt to auto-create SubDetailComponent.net");
6918            else if (Configuration.doAutoCreate())
6919              this.net = new Money(); // cc
6920          return this.net;
6921        }
6922
6923        public boolean hasNet() { 
6924          return this.net != null && !this.net.isEmpty();
6925        }
6926
6927        /**
6928         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
6929         */
6930        public SubDetailComponent setNet(Money value) { 
6931          this.net = value;
6932          return this;
6933        }
6934
6935        /**
6936         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
6937         */
6938        public List<Reference> getUdi() { 
6939          if (this.udi == null)
6940            this.udi = new ArrayList<Reference>();
6941          return this.udi;
6942        }
6943
6944        /**
6945         * @return Returns a reference to <code>this</code> for easy method chaining
6946         */
6947        public SubDetailComponent setUdi(List<Reference> theUdi) { 
6948          this.udi = theUdi;
6949          return this;
6950        }
6951
6952        public boolean hasUdi() { 
6953          if (this.udi == null)
6954            return false;
6955          for (Reference item : this.udi)
6956            if (!item.isEmpty())
6957              return true;
6958          return false;
6959        }
6960
6961        public Reference addUdi() { //3
6962          Reference t = new Reference();
6963          if (this.udi == null)
6964            this.udi = new ArrayList<Reference>();
6965          this.udi.add(t);
6966          return t;
6967        }
6968
6969        public SubDetailComponent addUdi(Reference t) { //3
6970          if (t == null)
6971            return this;
6972          if (this.udi == null)
6973            this.udi = new ArrayList<Reference>();
6974          this.udi.add(t);
6975          return this;
6976        }
6977
6978        /**
6979         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
6980         */
6981        public Reference getUdiFirstRep() { 
6982          if (getUdi().isEmpty()) {
6983            addUdi();
6984          }
6985          return getUdi().get(0);
6986        }
6987
6988        /**
6989         * @deprecated Use Reference#setResource(IBaseResource) instead
6990         */
6991        @Deprecated
6992        public List<Device> getUdiTarget() { 
6993          if (this.udiTarget == null)
6994            this.udiTarget = new ArrayList<Device>();
6995          return this.udiTarget;
6996        }
6997
6998        /**
6999         * @deprecated Use Reference#setResource(IBaseResource) instead
7000         */
7001        @Deprecated
7002        public Device addUdiTarget() { 
7003          Device r = new Device();
7004          if (this.udiTarget == null)
7005            this.udiTarget = new ArrayList<Device>();
7006          this.udiTarget.add(r);
7007          return r;
7008        }
7009
7010        /**
7011         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
7012         */
7013        public List<PositiveIntType> getNoteNumber() { 
7014          if (this.noteNumber == null)
7015            this.noteNumber = new ArrayList<PositiveIntType>();
7016          return this.noteNumber;
7017        }
7018
7019        /**
7020         * @return Returns a reference to <code>this</code> for easy method chaining
7021         */
7022        public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
7023          this.noteNumber = theNoteNumber;
7024          return this;
7025        }
7026
7027        public boolean hasNoteNumber() { 
7028          if (this.noteNumber == null)
7029            return false;
7030          for (PositiveIntType item : this.noteNumber)
7031            if (!item.isEmpty())
7032              return true;
7033          return false;
7034        }
7035
7036        /**
7037         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
7038         */
7039        public PositiveIntType addNoteNumberElement() {//2 
7040          PositiveIntType t = new PositiveIntType();
7041          if (this.noteNumber == null)
7042            this.noteNumber = new ArrayList<PositiveIntType>();
7043          this.noteNumber.add(t);
7044          return t;
7045        }
7046
7047        /**
7048         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
7049         */
7050        public SubDetailComponent addNoteNumber(int value) { //1
7051          PositiveIntType t = new PositiveIntType();
7052          t.setValue(value);
7053          if (this.noteNumber == null)
7054            this.noteNumber = new ArrayList<PositiveIntType>();
7055          this.noteNumber.add(t);
7056          return this;
7057        }
7058
7059        /**
7060         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
7061         */
7062        public boolean hasNoteNumber(int value) { 
7063          if (this.noteNumber == null)
7064            return false;
7065          for (PositiveIntType v : this.noteNumber)
7066            if (v.getValue().equals(value)) // positiveInt
7067              return true;
7068          return false;
7069        }
7070
7071        /**
7072         * @return {@link #adjudication} (The adjudication results.)
7073         */
7074        public List<AdjudicationComponent> getAdjudication() { 
7075          if (this.adjudication == null)
7076            this.adjudication = new ArrayList<AdjudicationComponent>();
7077          return this.adjudication;
7078        }
7079
7080        /**
7081         * @return Returns a reference to <code>this</code> for easy method chaining
7082         */
7083        public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
7084          this.adjudication = theAdjudication;
7085          return this;
7086        }
7087
7088        public boolean hasAdjudication() { 
7089          if (this.adjudication == null)
7090            return false;
7091          for (AdjudicationComponent item : this.adjudication)
7092            if (!item.isEmpty())
7093              return true;
7094          return false;
7095        }
7096
7097        public AdjudicationComponent addAdjudication() { //3
7098          AdjudicationComponent t = new AdjudicationComponent();
7099          if (this.adjudication == null)
7100            this.adjudication = new ArrayList<AdjudicationComponent>();
7101          this.adjudication.add(t);
7102          return t;
7103        }
7104
7105        public SubDetailComponent addAdjudication(AdjudicationComponent t) { //3
7106          if (t == null)
7107            return this;
7108          if (this.adjudication == null)
7109            this.adjudication = new ArrayList<AdjudicationComponent>();
7110          this.adjudication.add(t);
7111          return this;
7112        }
7113
7114        /**
7115         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
7116         */
7117        public AdjudicationComponent getAdjudicationFirstRep() { 
7118          if (getAdjudication().isEmpty()) {
7119            addAdjudication();
7120          }
7121          return getAdjudication().get(0);
7122        }
7123
7124        protected void listChildren(List<Property> children) {
7125          super.listChildren(children);
7126          children.add(new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence));
7127          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
7128          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes to identify the classification of service or benefits.", 0, 1, category));
7129          children.add(new Property("billcode", "CodeableConcept", "A code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).", 0, 1, billcode));
7130          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier));
7131          children.add(new Property("programCode", "CodeableConcept", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode));
7132          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
7133          children.add(new Property("unitPrice", "Money", "The fee for an addittional service or product or charge.", 0, 1, unitPrice));
7134          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));
7135          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net));
7136          children.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
7137          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
7138          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
7139        }
7140
7141        @Override
7142        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7143          switch (_hash) {
7144          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence);
7145          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
7146          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes to identify the classification of service or benefits.", 0, 1, category);
7147          case 890074740: /*billcode*/  return new Property("billcode", "CodeableConcept", "A code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).", 0, 1, billcode);
7148          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier);
7149          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode);
7150          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
7151          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "The fee for an addittional service or product or charge.", 0, 1, unitPrice);
7152          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);
7153          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net);
7154          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
7155          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
7156          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
7157          default: return super.getNamedProperty(_hash, _name, _checkValid);
7158          }
7159
7160        }
7161
7162      @Override
7163      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7164        switch (hash) {
7165        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
7166        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
7167        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
7168        case 890074740: /*billcode*/ return this.billcode == null ? new Base[0] : new Base[] {this.billcode}; // CodeableConcept
7169        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7170        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
7171        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
7172        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
7173        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
7174        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
7175        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
7176        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
7177        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
7178        default: return super.getProperty(hash, name, checkValid);
7179        }
7180
7181      }
7182
7183      @Override
7184      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7185        switch (hash) {
7186        case 1349547969: // sequence
7187          this.sequence = castToPositiveInt(value); // PositiveIntType
7188          return value;
7189        case 1099842588: // revenue
7190          this.revenue = castToCodeableConcept(value); // CodeableConcept
7191          return value;
7192        case 50511102: // category
7193          this.category = castToCodeableConcept(value); // CodeableConcept
7194          return value;
7195        case 890074740: // billcode
7196          this.billcode = castToCodeableConcept(value); // CodeableConcept
7197          return value;
7198        case -615513385: // modifier
7199          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
7200          return value;
7201        case 1010065041: // programCode
7202          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
7203          return value;
7204        case -1285004149: // quantity
7205          this.quantity = castToQuantity(value); // Quantity
7206          return value;
7207        case -486196699: // unitPrice
7208          this.unitPrice = castToMoney(value); // Money
7209          return value;
7210        case -1282148017: // factor
7211          this.factor = castToDecimal(value); // DecimalType
7212          return value;
7213        case 108957: // net
7214          this.net = castToMoney(value); // Money
7215          return value;
7216        case 115642: // udi
7217          this.getUdi().add(castToReference(value)); // Reference
7218          return value;
7219        case -1110033957: // noteNumber
7220          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
7221          return value;
7222        case -231349275: // adjudication
7223          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7224          return value;
7225        default: return super.setProperty(hash, name, value);
7226        }
7227
7228      }
7229
7230      @Override
7231      public Base setProperty(String name, Base value) throws FHIRException {
7232        if (name.equals("sequence")) {
7233          this.sequence = castToPositiveInt(value); // PositiveIntType
7234        } else if (name.equals("revenue")) {
7235          this.revenue = castToCodeableConcept(value); // CodeableConcept
7236        } else if (name.equals("category")) {
7237          this.category = castToCodeableConcept(value); // CodeableConcept
7238        } else if (name.equals("billcode")) {
7239          this.billcode = castToCodeableConcept(value); // CodeableConcept
7240        } else if (name.equals("modifier")) {
7241          this.getModifier().add(castToCodeableConcept(value));
7242        } else if (name.equals("programCode")) {
7243          this.getProgramCode().add(castToCodeableConcept(value));
7244        } else if (name.equals("quantity")) {
7245          this.quantity = castToQuantity(value); // Quantity
7246        } else if (name.equals("unitPrice")) {
7247          this.unitPrice = castToMoney(value); // Money
7248        } else if (name.equals("factor")) {
7249          this.factor = castToDecimal(value); // DecimalType
7250        } else if (name.equals("net")) {
7251          this.net = castToMoney(value); // Money
7252        } else if (name.equals("udi")) {
7253          this.getUdi().add(castToReference(value));
7254        } else if (name.equals("noteNumber")) {
7255          this.getNoteNumber().add(castToPositiveInt(value));
7256        } else if (name.equals("adjudication")) {
7257          this.getAdjudication().add((AdjudicationComponent) value);
7258        } else
7259          return super.setProperty(name, value);
7260        return value;
7261      }
7262
7263      @Override
7264      public Base makeProperty(int hash, String name) throws FHIRException {
7265        switch (hash) {
7266        case 1349547969:  return getSequenceElement();
7267        case 1099842588:  return getRevenue(); 
7268        case 50511102:  return getCategory(); 
7269        case 890074740:  return getBillcode(); 
7270        case -615513385:  return addModifier(); 
7271        case 1010065041:  return addProgramCode(); 
7272        case -1285004149:  return getQuantity(); 
7273        case -486196699:  return getUnitPrice(); 
7274        case -1282148017:  return getFactorElement();
7275        case 108957:  return getNet(); 
7276        case 115642:  return addUdi(); 
7277        case -1110033957:  return addNoteNumberElement();
7278        case -231349275:  return addAdjudication(); 
7279        default: return super.makeProperty(hash, name);
7280        }
7281
7282      }
7283
7284      @Override
7285      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7286        switch (hash) {
7287        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
7288        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
7289        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
7290        case 890074740: /*billcode*/ return new String[] {"CodeableConcept"};
7291        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
7292        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
7293        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
7294        case -486196699: /*unitPrice*/ return new String[] {"Money"};
7295        case -1282148017: /*factor*/ return new String[] {"decimal"};
7296        case 108957: /*net*/ return new String[] {"Money"};
7297        case 115642: /*udi*/ return new String[] {"Reference"};
7298        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
7299        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
7300        default: return super.getTypesForProperty(hash, name);
7301        }
7302
7303      }
7304
7305      @Override
7306      public Base addChild(String name) throws FHIRException {
7307        if (name.equals("sequence")) {
7308          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
7309        }
7310        else if (name.equals("revenue")) {
7311          this.revenue = new CodeableConcept();
7312          return this.revenue;
7313        }
7314        else if (name.equals("category")) {
7315          this.category = new CodeableConcept();
7316          return this.category;
7317        }
7318        else if (name.equals("billcode")) {
7319          this.billcode = new CodeableConcept();
7320          return this.billcode;
7321        }
7322        else if (name.equals("modifier")) {
7323          return addModifier();
7324        }
7325        else if (name.equals("programCode")) {
7326          return addProgramCode();
7327        }
7328        else if (name.equals("quantity")) {
7329          this.quantity = new Quantity();
7330          return this.quantity;
7331        }
7332        else if (name.equals("unitPrice")) {
7333          this.unitPrice = new Money();
7334          return this.unitPrice;
7335        }
7336        else if (name.equals("factor")) {
7337          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
7338        }
7339        else if (name.equals("net")) {
7340          this.net = new Money();
7341          return this.net;
7342        }
7343        else if (name.equals("udi")) {
7344          return addUdi();
7345        }
7346        else if (name.equals("noteNumber")) {
7347          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
7348        }
7349        else if (name.equals("adjudication")) {
7350          return addAdjudication();
7351        }
7352        else
7353          return super.addChild(name);
7354      }
7355
7356      public SubDetailComponent copy() {
7357        SubDetailComponent dst = new SubDetailComponent();
7358        copyValues(dst);
7359        dst.sequence = sequence == null ? null : sequence.copy();
7360        dst.revenue = revenue == null ? null : revenue.copy();
7361        dst.category = category == null ? null : category.copy();
7362        dst.billcode = billcode == null ? null : billcode.copy();
7363        if (modifier != null) {
7364          dst.modifier = new ArrayList<CodeableConcept>();
7365          for (CodeableConcept i : modifier)
7366            dst.modifier.add(i.copy());
7367        };
7368        if (programCode != null) {
7369          dst.programCode = new ArrayList<CodeableConcept>();
7370          for (CodeableConcept i : programCode)
7371            dst.programCode.add(i.copy());
7372        };
7373        dst.quantity = quantity == null ? null : quantity.copy();
7374        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7375        dst.factor = factor == null ? null : factor.copy();
7376        dst.net = net == null ? null : net.copy();
7377        if (udi != null) {
7378          dst.udi = new ArrayList<Reference>();
7379          for (Reference i : udi)
7380            dst.udi.add(i.copy());
7381        };
7382        if (noteNumber != null) {
7383          dst.noteNumber = new ArrayList<PositiveIntType>();
7384          for (PositiveIntType i : noteNumber)
7385            dst.noteNumber.add(i.copy());
7386        };
7387        if (adjudication != null) {
7388          dst.adjudication = new ArrayList<AdjudicationComponent>();
7389          for (AdjudicationComponent i : adjudication)
7390            dst.adjudication.add(i.copy());
7391        };
7392        return dst;
7393      }
7394
7395      @Override
7396      public boolean equalsDeep(Base other_) {
7397        if (!super.equalsDeep(other_))
7398          return false;
7399        if (!(other_ instanceof SubDetailComponent))
7400          return false;
7401        SubDetailComponent o = (SubDetailComponent) other_;
7402        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
7403           && compareDeep(billcode, o.billcode, true) && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
7404           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
7405           && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true) && compareDeep(noteNumber, o.noteNumber, true)
7406           && compareDeep(adjudication, o.adjudication, true);
7407      }
7408
7409      @Override
7410      public boolean equalsShallow(Base other_) {
7411        if (!super.equalsShallow(other_))
7412          return false;
7413        if (!(other_ instanceof SubDetailComponent))
7414          return false;
7415        SubDetailComponent o = (SubDetailComponent) other_;
7416        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
7417          ;
7418      }
7419
7420      public boolean isEmpty() {
7421        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
7422          , billcode, modifier, programCode, quantity, unitPrice, factor, net, udi, noteNumber
7423          , adjudication);
7424      }
7425
7426  public String fhirType() {
7427    return "ExplanationOfBenefit.item.detail.subDetail";
7428
7429  }
7430
7431  }
7432
7433    @Block()
7434    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
7435        /**
7436         * List of input service items which this service line is intended to replace.
7437         */
7438        @Child(name = "itemSequence", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7439        @Description(shortDefinition="Service instances", formalDefinition="List of input service items which this service line is intended to replace." )
7440        protected List<PositiveIntType> itemSequence;
7441
7442        /**
7443         * The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.
7444         */
7445        @Child(name = "detailSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7446        @Description(shortDefinition="Detail sequence number", formalDefinition="The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition." )
7447        protected List<PositiveIntType> detailSequence;
7448
7449        /**
7450         * The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.
7451         */
7452        @Child(name = "subDetailSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7453        @Description(shortDefinition="Subdetail sequence number", formalDefinition="The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition." )
7454        protected List<PositiveIntType> subDetailSequence;
7455
7456        /**
7457         * The providers who are authorized for the services rendered to the patient.
7458         */
7459        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7460        @Description(shortDefinition="Authorized providers", formalDefinition="The providers who are authorized for the services rendered to the patient." )
7461        protected List<Reference> provider;
7462        /**
7463         * The actual objects that are the target of the reference (The providers who are authorized for the services rendered to the patient.)
7464         */
7465        protected List<Resource> providerTarget;
7466
7467
7468        /**
7469         * If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.
7470         */
7471        @Child(name = "billcode", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
7472        @Description(shortDefinition="Billing Code", formalDefinition="If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'." )
7473        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
7474        protected CodeableConcept billcode;
7475
7476        /**
7477         * Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.
7478         */
7479        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7480        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours." )
7481        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
7482        protected List<CodeableConcept> modifier;
7483
7484        /**
7485         * For programs which require reason codes for the inclusion or covering of this billed item under the program or sub-program.
7486         */
7487        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7488        @Description(shortDefinition="Program specific reason for item inclusion", formalDefinition="For programs which require reason codes for the inclusion or covering of this billed item under the program or sub-program." )
7489        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
7490        protected List<CodeableConcept> programCode;
7491
7492        /**
7493         * The date or dates when the service or product was supplied, performed or completed.
7494         */
7495        @Child(name = "serviced", type = {DateType.class, Period.class}, order=8, min=0, max=1, modifier=false, summary=false)
7496        @Description(shortDefinition="Date or dates of Service", formalDefinition="The date or dates when the service or product was supplied, performed or completed." )
7497        protected Type serviced;
7498
7499        /**
7500         * Where the service was provided.
7501         */
7502        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=9, min=0, max=1, modifier=false, summary=false)
7503        @Description(shortDefinition="Place of service", formalDefinition="Where the service was provided." )
7504        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
7505        protected Type location;
7506
7507        /**
7508         * The number of repetitions of a service or product.
7509         */
7510        @Child(name = "quantity", type = {Quantity.class}, order=10, min=0, max=1, modifier=false, summary=false)
7511        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
7512        protected Quantity quantity;
7513
7514        /**
7515         * If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.
7516         */
7517        @Child(name = "unitPrice", type = {Money.class}, order=11, min=0, max=1, modifier=false, summary=false)
7518        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group." )
7519        protected Money unitPrice;
7520
7521        /**
7522         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
7523         */
7524        @Child(name = "factor", type = {DecimalType.class}, order=12, min=0, max=1, modifier=false, summary=false)
7525        @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." )
7526        protected DecimalType factor;
7527
7528        /**
7529         * The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
7530         */
7531        @Child(name = "net", type = {Money.class}, order=13, min=0, max=1, modifier=false, summary=false)
7532        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
7533        protected Money net;
7534
7535        /**
7536         * Physical service site on the patient (limb, tooth, etc.).
7537         */
7538        @Child(name = "bodySite", type = {CodeableConcept.class}, order=14, min=0, max=1, modifier=false, summary=false)
7539        @Description(shortDefinition="Service Location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
7540        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
7541        protected CodeableConcept bodySite;
7542
7543        /**
7544         * A region or surface of the site, e.g. limb region or tooth surface(s).
7545         */
7546        @Child(name = "subSite", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7547        @Description(shortDefinition="Service Sub-location", formalDefinition="A region or surface of the site, e.g. limb region or tooth surface(s)." )
7548        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
7549        protected List<CodeableConcept> subSite;
7550
7551        /**
7552         * A list of note references to the notes provided below.
7553         */
7554        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7555        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
7556        protected List<PositiveIntType> noteNumber;
7557
7558        /**
7559         * The adjudication results.
7560         */
7561        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7562        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
7563        protected List<AdjudicationComponent> adjudication;
7564
7565        /**
7566         * The second-tier service adjudications for payor added services.
7567         */
7568        @Child(name = "detail", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7569        @Description(shortDefinition="Insurer added line items", formalDefinition="The second-tier service adjudications for payor added services." )
7570        protected List<AddedItemDetailComponent> detail;
7571
7572        private static final long serialVersionUID = 1857131999L;
7573
7574    /**
7575     * Constructor
7576     */
7577      public AddedItemComponent() {
7578        super();
7579      }
7580
7581        /**
7582         * @return {@link #itemSequence} (List of input service items which this service line is intended to replace.)
7583         */
7584        public List<PositiveIntType> getItemSequence() { 
7585          if (this.itemSequence == null)
7586            this.itemSequence = new ArrayList<PositiveIntType>();
7587          return this.itemSequence;
7588        }
7589
7590        /**
7591         * @return Returns a reference to <code>this</code> for easy method chaining
7592         */
7593        public AddedItemComponent setItemSequence(List<PositiveIntType> theItemSequence) { 
7594          this.itemSequence = theItemSequence;
7595          return this;
7596        }
7597
7598        public boolean hasItemSequence() { 
7599          if (this.itemSequence == null)
7600            return false;
7601          for (PositiveIntType item : this.itemSequence)
7602            if (!item.isEmpty())
7603              return true;
7604          return false;
7605        }
7606
7607        /**
7608         * @return {@link #itemSequence} (List of input service items which this service line is intended to replace.)
7609         */
7610        public PositiveIntType addItemSequenceElement() {//2 
7611          PositiveIntType t = new PositiveIntType();
7612          if (this.itemSequence == null)
7613            this.itemSequence = new ArrayList<PositiveIntType>();
7614          this.itemSequence.add(t);
7615          return t;
7616        }
7617
7618        /**
7619         * @param value {@link #itemSequence} (List of input service items which this service line is intended to replace.)
7620         */
7621        public AddedItemComponent addItemSequence(int value) { //1
7622          PositiveIntType t = new PositiveIntType();
7623          t.setValue(value);
7624          if (this.itemSequence == null)
7625            this.itemSequence = new ArrayList<PositiveIntType>();
7626          this.itemSequence.add(t);
7627          return this;
7628        }
7629
7630        /**
7631         * @param value {@link #itemSequence} (List of input service items which this service line is intended to replace.)
7632         */
7633        public boolean hasItemSequence(int value) { 
7634          if (this.itemSequence == null)
7635            return false;
7636          for (PositiveIntType v : this.itemSequence)
7637            if (v.getValue().equals(value)) // positiveInt
7638              return true;
7639          return false;
7640        }
7641
7642        /**
7643         * @return {@link #detailSequence} (The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.)
7644         */
7645        public List<PositiveIntType> getDetailSequence() { 
7646          if (this.detailSequence == null)
7647            this.detailSequence = new ArrayList<PositiveIntType>();
7648          return this.detailSequence;
7649        }
7650
7651        /**
7652         * @return Returns a reference to <code>this</code> for easy method chaining
7653         */
7654        public AddedItemComponent setDetailSequence(List<PositiveIntType> theDetailSequence) { 
7655          this.detailSequence = theDetailSequence;
7656          return this;
7657        }
7658
7659        public boolean hasDetailSequence() { 
7660          if (this.detailSequence == null)
7661            return false;
7662          for (PositiveIntType item : this.detailSequence)
7663            if (!item.isEmpty())
7664              return true;
7665          return false;
7666        }
7667
7668        /**
7669         * @return {@link #detailSequence} (The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.)
7670         */
7671        public PositiveIntType addDetailSequenceElement() {//2 
7672          PositiveIntType t = new PositiveIntType();
7673          if (this.detailSequence == null)
7674            this.detailSequence = new ArrayList<PositiveIntType>();
7675          this.detailSequence.add(t);
7676          return t;
7677        }
7678
7679        /**
7680         * @param value {@link #detailSequence} (The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.)
7681         */
7682        public AddedItemComponent addDetailSequence(int value) { //1
7683          PositiveIntType t = new PositiveIntType();
7684          t.setValue(value);
7685          if (this.detailSequence == null)
7686            this.detailSequence = new ArrayList<PositiveIntType>();
7687          this.detailSequence.add(t);
7688          return this;
7689        }
7690
7691        /**
7692         * @param value {@link #detailSequence} (The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.)
7693         */
7694        public boolean hasDetailSequence(int value) { 
7695          if (this.detailSequence == null)
7696            return false;
7697          for (PositiveIntType v : this.detailSequence)
7698            if (v.getValue().equals(value)) // positiveInt
7699              return true;
7700          return false;
7701        }
7702
7703        /**
7704         * @return {@link #subDetailSequence} (The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.)
7705         */
7706        public List<PositiveIntType> getSubDetailSequence() { 
7707          if (this.subDetailSequence == null)
7708            this.subDetailSequence = new ArrayList<PositiveIntType>();
7709          return this.subDetailSequence;
7710        }
7711
7712        /**
7713         * @return Returns a reference to <code>this</code> for easy method chaining
7714         */
7715        public AddedItemComponent setSubDetailSequence(List<PositiveIntType> theSubDetailSequence) { 
7716          this.subDetailSequence = theSubDetailSequence;
7717          return this;
7718        }
7719
7720        public boolean hasSubDetailSequence() { 
7721          if (this.subDetailSequence == null)
7722            return false;
7723          for (PositiveIntType item : this.subDetailSequence)
7724            if (!item.isEmpty())
7725              return true;
7726          return false;
7727        }
7728
7729        /**
7730         * @return {@link #subDetailSequence} (The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.)
7731         */
7732        public PositiveIntType addSubDetailSequenceElement() {//2 
7733          PositiveIntType t = new PositiveIntType();
7734          if (this.subDetailSequence == null)
7735            this.subDetailSequence = new ArrayList<PositiveIntType>();
7736          this.subDetailSequence.add(t);
7737          return t;
7738        }
7739
7740        /**
7741         * @param value {@link #subDetailSequence} (The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.)
7742         */
7743        public AddedItemComponent addSubDetailSequence(int value) { //1
7744          PositiveIntType t = new PositiveIntType();
7745          t.setValue(value);
7746          if (this.subDetailSequence == null)
7747            this.subDetailSequence = new ArrayList<PositiveIntType>();
7748          this.subDetailSequence.add(t);
7749          return this;
7750        }
7751
7752        /**
7753         * @param value {@link #subDetailSequence} (The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.)
7754         */
7755        public boolean hasSubDetailSequence(int value) { 
7756          if (this.subDetailSequence == null)
7757            return false;
7758          for (PositiveIntType v : this.subDetailSequence)
7759            if (v.getValue().equals(value)) // positiveInt
7760              return true;
7761          return false;
7762        }
7763
7764        /**
7765         * @return {@link #provider} (The providers who are authorized for the services rendered to the patient.)
7766         */
7767        public List<Reference> getProvider() { 
7768          if (this.provider == null)
7769            this.provider = new ArrayList<Reference>();
7770          return this.provider;
7771        }
7772
7773        /**
7774         * @return Returns a reference to <code>this</code> for easy method chaining
7775         */
7776        public AddedItemComponent setProvider(List<Reference> theProvider) { 
7777          this.provider = theProvider;
7778          return this;
7779        }
7780
7781        public boolean hasProvider() { 
7782          if (this.provider == null)
7783            return false;
7784          for (Reference item : this.provider)
7785            if (!item.isEmpty())
7786              return true;
7787          return false;
7788        }
7789
7790        public Reference addProvider() { //3
7791          Reference t = new Reference();
7792          if (this.provider == null)
7793            this.provider = new ArrayList<Reference>();
7794          this.provider.add(t);
7795          return t;
7796        }
7797
7798        public AddedItemComponent addProvider(Reference t) { //3
7799          if (t == null)
7800            return this;
7801          if (this.provider == null)
7802            this.provider = new ArrayList<Reference>();
7803          this.provider.add(t);
7804          return this;
7805        }
7806
7807        /**
7808         * @return The first repetition of repeating field {@link #provider}, creating it if it does not already exist
7809         */
7810        public Reference getProviderFirstRep() { 
7811          if (getProvider().isEmpty()) {
7812            addProvider();
7813          }
7814          return getProvider().get(0);
7815        }
7816
7817        /**
7818         * @deprecated Use Reference#setResource(IBaseResource) instead
7819         */
7820        @Deprecated
7821        public List<Resource> getProviderTarget() { 
7822          if (this.providerTarget == null)
7823            this.providerTarget = new ArrayList<Resource>();
7824          return this.providerTarget;
7825        }
7826
7827        /**
7828         * @return {@link #billcode} (If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.)
7829         */
7830        public CodeableConcept getBillcode() { 
7831          if (this.billcode == null)
7832            if (Configuration.errorOnAutoCreate())
7833              throw new Error("Attempt to auto-create AddedItemComponent.billcode");
7834            else if (Configuration.doAutoCreate())
7835              this.billcode = new CodeableConcept(); // cc
7836          return this.billcode;
7837        }
7838
7839        public boolean hasBillcode() { 
7840          return this.billcode != null && !this.billcode.isEmpty();
7841        }
7842
7843        /**
7844         * @param value {@link #billcode} (If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.)
7845         */
7846        public AddedItemComponent setBillcode(CodeableConcept value) { 
7847          this.billcode = value;
7848          return this;
7849        }
7850
7851        /**
7852         * @return {@link #modifier} (Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.)
7853         */
7854        public List<CodeableConcept> getModifier() { 
7855          if (this.modifier == null)
7856            this.modifier = new ArrayList<CodeableConcept>();
7857          return this.modifier;
7858        }
7859
7860        /**
7861         * @return Returns a reference to <code>this</code> for easy method chaining
7862         */
7863        public AddedItemComponent setModifier(List<CodeableConcept> theModifier) { 
7864          this.modifier = theModifier;
7865          return this;
7866        }
7867
7868        public boolean hasModifier() { 
7869          if (this.modifier == null)
7870            return false;
7871          for (CodeableConcept item : this.modifier)
7872            if (!item.isEmpty())
7873              return true;
7874          return false;
7875        }
7876
7877        public CodeableConcept addModifier() { //3
7878          CodeableConcept t = new CodeableConcept();
7879          if (this.modifier == null)
7880            this.modifier = new ArrayList<CodeableConcept>();
7881          this.modifier.add(t);
7882          return t;
7883        }
7884
7885        public AddedItemComponent addModifier(CodeableConcept t) { //3
7886          if (t == null)
7887            return this;
7888          if (this.modifier == null)
7889            this.modifier = new ArrayList<CodeableConcept>();
7890          this.modifier.add(t);
7891          return this;
7892        }
7893
7894        /**
7895         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
7896         */
7897        public CodeableConcept getModifierFirstRep() { 
7898          if (getModifier().isEmpty()) {
7899            addModifier();
7900          }
7901          return getModifier().get(0);
7902        }
7903
7904        /**
7905         * @return {@link #programCode} (For programs which require reason codes for the inclusion or covering of this billed item under the program or sub-program.)
7906         */
7907        public List<CodeableConcept> getProgramCode() { 
7908          if (this.programCode == null)
7909            this.programCode = new ArrayList<CodeableConcept>();
7910          return this.programCode;
7911        }
7912
7913        /**
7914         * @return Returns a reference to <code>this</code> for easy method chaining
7915         */
7916        public AddedItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
7917          this.programCode = theProgramCode;
7918          return this;
7919        }
7920
7921        public boolean hasProgramCode() { 
7922          if (this.programCode == null)
7923            return false;
7924          for (CodeableConcept item : this.programCode)
7925            if (!item.isEmpty())
7926              return true;
7927          return false;
7928        }
7929
7930        public CodeableConcept addProgramCode() { //3
7931          CodeableConcept t = new CodeableConcept();
7932          if (this.programCode == null)
7933            this.programCode = new ArrayList<CodeableConcept>();
7934          this.programCode.add(t);
7935          return t;
7936        }
7937
7938        public AddedItemComponent addProgramCode(CodeableConcept t) { //3
7939          if (t == null)
7940            return this;
7941          if (this.programCode == null)
7942            this.programCode = new ArrayList<CodeableConcept>();
7943          this.programCode.add(t);
7944          return this;
7945        }
7946
7947        /**
7948         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
7949         */
7950        public CodeableConcept getProgramCodeFirstRep() { 
7951          if (getProgramCode().isEmpty()) {
7952            addProgramCode();
7953          }
7954          return getProgramCode().get(0);
7955        }
7956
7957        /**
7958         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
7959         */
7960        public Type getServiced() { 
7961          return this.serviced;
7962        }
7963
7964        /**
7965         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
7966         */
7967        public DateType getServicedDateType() throws FHIRException { 
7968          if (this.serviced == null)
7969            return null;
7970          if (!(this.serviced instanceof DateType))
7971            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
7972          return (DateType) this.serviced;
7973        }
7974
7975        public boolean hasServicedDateType() { 
7976          return this != null && this.serviced instanceof DateType;
7977        }
7978
7979        /**
7980         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
7981         */
7982        public Period getServicedPeriod() throws FHIRException { 
7983          if (this.serviced == null)
7984            return null;
7985          if (!(this.serviced instanceof Period))
7986            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
7987          return (Period) this.serviced;
7988        }
7989
7990        public boolean hasServicedPeriod() { 
7991          return this != null && this.serviced instanceof Period;
7992        }
7993
7994        public boolean hasServiced() { 
7995          return this.serviced != null && !this.serviced.isEmpty();
7996        }
7997
7998        /**
7999         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8000         */
8001        public AddedItemComponent setServiced(Type value) { 
8002          if (value != null && !(value instanceof DateType || value instanceof Period))
8003            throw new Error("Not the right type for ExplanationOfBenefit.addItem.serviced[x]: "+value.fhirType());
8004          this.serviced = value;
8005          return this;
8006        }
8007
8008        /**
8009         * @return {@link #location} (Where the service was provided.)
8010         */
8011        public Type getLocation() { 
8012          return this.location;
8013        }
8014
8015        /**
8016         * @return {@link #location} (Where the service was provided.)
8017         */
8018        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
8019          if (this.location == null)
8020            return null;
8021          if (!(this.location instanceof CodeableConcept))
8022            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
8023          return (CodeableConcept) this.location;
8024        }
8025
8026        public boolean hasLocationCodeableConcept() { 
8027          return this != null && this.location instanceof CodeableConcept;
8028        }
8029
8030        /**
8031         * @return {@link #location} (Where the service was provided.)
8032         */
8033        public Address getLocationAddress() throws FHIRException { 
8034          if (this.location == null)
8035            return null;
8036          if (!(this.location instanceof Address))
8037            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
8038          return (Address) this.location;
8039        }
8040
8041        public boolean hasLocationAddress() { 
8042          return this != null && this.location instanceof Address;
8043        }
8044
8045        /**
8046         * @return {@link #location} (Where the service was provided.)
8047         */
8048        public Reference getLocationReference() throws FHIRException { 
8049          if (this.location == null)
8050            return null;
8051          if (!(this.location instanceof Reference))
8052            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
8053          return (Reference) this.location;
8054        }
8055
8056        public boolean hasLocationReference() { 
8057          return this != null && this.location instanceof Reference;
8058        }
8059
8060        public boolean hasLocation() { 
8061          return this.location != null && !this.location.isEmpty();
8062        }
8063
8064        /**
8065         * @param value {@link #location} (Where the service was provided.)
8066         */
8067        public AddedItemComponent setLocation(Type value) { 
8068          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
8069            throw new Error("Not the right type for ExplanationOfBenefit.addItem.location[x]: "+value.fhirType());
8070          this.location = value;
8071          return this;
8072        }
8073
8074        /**
8075         * @return {@link #quantity} (The number of repetitions of a service or product.)
8076         */
8077        public Quantity getQuantity() { 
8078          if (this.quantity == null)
8079            if (Configuration.errorOnAutoCreate())
8080              throw new Error("Attempt to auto-create AddedItemComponent.quantity");
8081            else if (Configuration.doAutoCreate())
8082              this.quantity = new Quantity(); // cc
8083          return this.quantity;
8084        }
8085
8086        public boolean hasQuantity() { 
8087          return this.quantity != null && !this.quantity.isEmpty();
8088        }
8089
8090        /**
8091         * @param value {@link #quantity} (The number of repetitions of a service or product.)
8092         */
8093        public AddedItemComponent setQuantity(Quantity value) { 
8094          this.quantity = value;
8095          return this;
8096        }
8097
8098        /**
8099         * @return {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
8100         */
8101        public Money getUnitPrice() { 
8102          if (this.unitPrice == null)
8103            if (Configuration.errorOnAutoCreate())
8104              throw new Error("Attempt to auto-create AddedItemComponent.unitPrice");
8105            else if (Configuration.doAutoCreate())
8106              this.unitPrice = new Money(); // cc
8107          return this.unitPrice;
8108        }
8109
8110        public boolean hasUnitPrice() { 
8111          return this.unitPrice != null && !this.unitPrice.isEmpty();
8112        }
8113
8114        /**
8115         * @param value {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
8116         */
8117        public AddedItemComponent setUnitPrice(Money value) { 
8118          this.unitPrice = value;
8119          return this;
8120        }
8121
8122        /**
8123         * @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
8124         */
8125        public DecimalType getFactorElement() { 
8126          if (this.factor == null)
8127            if (Configuration.errorOnAutoCreate())
8128              throw new Error("Attempt to auto-create AddedItemComponent.factor");
8129            else if (Configuration.doAutoCreate())
8130              this.factor = new DecimalType(); // bb
8131          return this.factor;
8132        }
8133
8134        public boolean hasFactorElement() { 
8135          return this.factor != null && !this.factor.isEmpty();
8136        }
8137
8138        public boolean hasFactor() { 
8139          return this.factor != null && !this.factor.isEmpty();
8140        }
8141
8142        /**
8143         * @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
8144         */
8145        public AddedItemComponent setFactorElement(DecimalType value) { 
8146          this.factor = value;
8147          return this;
8148        }
8149
8150        /**
8151         * @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.
8152         */
8153        public BigDecimal getFactor() { 
8154          return this.factor == null ? null : this.factor.getValue();
8155        }
8156
8157        /**
8158         * @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.
8159         */
8160        public AddedItemComponent setFactor(BigDecimal value) { 
8161          if (value == null)
8162            this.factor = null;
8163          else {
8164            if (this.factor == null)
8165              this.factor = new DecimalType();
8166            this.factor.setValue(value);
8167          }
8168          return this;
8169        }
8170
8171        /**
8172         * @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.
8173         */
8174        public AddedItemComponent setFactor(long value) { 
8175              this.factor = new DecimalType();
8176            this.factor.setValue(value);
8177          return this;
8178        }
8179
8180        /**
8181         * @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.
8182         */
8183        public AddedItemComponent setFactor(double value) { 
8184              this.factor = new DecimalType();
8185            this.factor.setValue(value);
8186          return this;
8187        }
8188
8189        /**
8190         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
8191         */
8192        public Money getNet() { 
8193          if (this.net == null)
8194            if (Configuration.errorOnAutoCreate())
8195              throw new Error("Attempt to auto-create AddedItemComponent.net");
8196            else if (Configuration.doAutoCreate())
8197              this.net = new Money(); // cc
8198          return this.net;
8199        }
8200
8201        public boolean hasNet() { 
8202          return this.net != null && !this.net.isEmpty();
8203        }
8204
8205        /**
8206         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
8207         */
8208        public AddedItemComponent setNet(Money value) { 
8209          this.net = value;
8210          return this;
8211        }
8212
8213        /**
8214         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
8215         */
8216        public CodeableConcept getBodySite() { 
8217          if (this.bodySite == null)
8218            if (Configuration.errorOnAutoCreate())
8219              throw new Error("Attempt to auto-create AddedItemComponent.bodySite");
8220            else if (Configuration.doAutoCreate())
8221              this.bodySite = new CodeableConcept(); // cc
8222          return this.bodySite;
8223        }
8224
8225        public boolean hasBodySite() { 
8226          return this.bodySite != null && !this.bodySite.isEmpty();
8227        }
8228
8229        /**
8230         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
8231         */
8232        public AddedItemComponent setBodySite(CodeableConcept value) { 
8233          this.bodySite = value;
8234          return this;
8235        }
8236
8237        /**
8238         * @return {@link #subSite} (A region or surface of the site, e.g. limb region or tooth surface(s).)
8239         */
8240        public List<CodeableConcept> getSubSite() { 
8241          if (this.subSite == null)
8242            this.subSite = new ArrayList<CodeableConcept>();
8243          return this.subSite;
8244        }
8245
8246        /**
8247         * @return Returns a reference to <code>this</code> for easy method chaining
8248         */
8249        public AddedItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
8250          this.subSite = theSubSite;
8251          return this;
8252        }
8253
8254        public boolean hasSubSite() { 
8255          if (this.subSite == null)
8256            return false;
8257          for (CodeableConcept item : this.subSite)
8258            if (!item.isEmpty())
8259              return true;
8260          return false;
8261        }
8262
8263        public CodeableConcept addSubSite() { //3
8264          CodeableConcept t = new CodeableConcept();
8265          if (this.subSite == null)
8266            this.subSite = new ArrayList<CodeableConcept>();
8267          this.subSite.add(t);
8268          return t;
8269        }
8270
8271        public AddedItemComponent addSubSite(CodeableConcept t) { //3
8272          if (t == null)
8273            return this;
8274          if (this.subSite == null)
8275            this.subSite = new ArrayList<CodeableConcept>();
8276          this.subSite.add(t);
8277          return this;
8278        }
8279
8280        /**
8281         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist
8282         */
8283        public CodeableConcept getSubSiteFirstRep() { 
8284          if (getSubSite().isEmpty()) {
8285            addSubSite();
8286          }
8287          return getSubSite().get(0);
8288        }
8289
8290        /**
8291         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
8292         */
8293        public List<PositiveIntType> getNoteNumber() { 
8294          if (this.noteNumber == null)
8295            this.noteNumber = new ArrayList<PositiveIntType>();
8296          return this.noteNumber;
8297        }
8298
8299        /**
8300         * @return Returns a reference to <code>this</code> for easy method chaining
8301         */
8302        public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
8303          this.noteNumber = theNoteNumber;
8304          return this;
8305        }
8306
8307        public boolean hasNoteNumber() { 
8308          if (this.noteNumber == null)
8309            return false;
8310          for (PositiveIntType item : this.noteNumber)
8311            if (!item.isEmpty())
8312              return true;
8313          return false;
8314        }
8315
8316        /**
8317         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
8318         */
8319        public PositiveIntType addNoteNumberElement() {//2 
8320          PositiveIntType t = new PositiveIntType();
8321          if (this.noteNumber == null)
8322            this.noteNumber = new ArrayList<PositiveIntType>();
8323          this.noteNumber.add(t);
8324          return t;
8325        }
8326
8327        /**
8328         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
8329         */
8330        public AddedItemComponent addNoteNumber(int value) { //1
8331          PositiveIntType t = new PositiveIntType();
8332          t.setValue(value);
8333          if (this.noteNumber == null)
8334            this.noteNumber = new ArrayList<PositiveIntType>();
8335          this.noteNumber.add(t);
8336          return this;
8337        }
8338
8339        /**
8340         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
8341         */
8342        public boolean hasNoteNumber(int value) { 
8343          if (this.noteNumber == null)
8344            return false;
8345          for (PositiveIntType v : this.noteNumber)
8346            if (v.getValue().equals(value)) // positiveInt
8347              return true;
8348          return false;
8349        }
8350
8351        /**
8352         * @return {@link #adjudication} (The adjudication results.)
8353         */
8354        public List<AdjudicationComponent> getAdjudication() { 
8355          if (this.adjudication == null)
8356            this.adjudication = new ArrayList<AdjudicationComponent>();
8357          return this.adjudication;
8358        }
8359
8360        /**
8361         * @return Returns a reference to <code>this</code> for easy method chaining
8362         */
8363        public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
8364          this.adjudication = theAdjudication;
8365          return this;
8366        }
8367
8368        public boolean hasAdjudication() { 
8369          if (this.adjudication == null)
8370            return false;
8371          for (AdjudicationComponent item : this.adjudication)
8372            if (!item.isEmpty())
8373              return true;
8374          return false;
8375        }
8376
8377        public AdjudicationComponent addAdjudication() { //3
8378          AdjudicationComponent t = new AdjudicationComponent();
8379          if (this.adjudication == null)
8380            this.adjudication = new ArrayList<AdjudicationComponent>();
8381          this.adjudication.add(t);
8382          return t;
8383        }
8384
8385        public AddedItemComponent addAdjudication(AdjudicationComponent t) { //3
8386          if (t == null)
8387            return this;
8388          if (this.adjudication == null)
8389            this.adjudication = new ArrayList<AdjudicationComponent>();
8390          this.adjudication.add(t);
8391          return this;
8392        }
8393
8394        /**
8395         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
8396         */
8397        public AdjudicationComponent getAdjudicationFirstRep() { 
8398          if (getAdjudication().isEmpty()) {
8399            addAdjudication();
8400          }
8401          return getAdjudication().get(0);
8402        }
8403
8404        /**
8405         * @return {@link #detail} (The second-tier service adjudications for payor added services.)
8406         */
8407        public List<AddedItemDetailComponent> getDetail() { 
8408          if (this.detail == null)
8409            this.detail = new ArrayList<AddedItemDetailComponent>();
8410          return this.detail;
8411        }
8412
8413        /**
8414         * @return Returns a reference to <code>this</code> for easy method chaining
8415         */
8416        public AddedItemComponent setDetail(List<AddedItemDetailComponent> theDetail) { 
8417          this.detail = theDetail;
8418          return this;
8419        }
8420
8421        public boolean hasDetail() { 
8422          if (this.detail == null)
8423            return false;
8424          for (AddedItemDetailComponent item : this.detail)
8425            if (!item.isEmpty())
8426              return true;
8427          return false;
8428        }
8429
8430        public AddedItemDetailComponent addDetail() { //3
8431          AddedItemDetailComponent t = new AddedItemDetailComponent();
8432          if (this.detail == null)
8433            this.detail = new ArrayList<AddedItemDetailComponent>();
8434          this.detail.add(t);
8435          return t;
8436        }
8437
8438        public AddedItemComponent addDetail(AddedItemDetailComponent t) { //3
8439          if (t == null)
8440            return this;
8441          if (this.detail == null)
8442            this.detail = new ArrayList<AddedItemDetailComponent>();
8443          this.detail.add(t);
8444          return this;
8445        }
8446
8447        /**
8448         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
8449         */
8450        public AddedItemDetailComponent getDetailFirstRep() { 
8451          if (getDetail().isEmpty()) {
8452            addDetail();
8453          }
8454          return getDetail().get(0);
8455        }
8456
8457        protected void listChildren(List<Property> children) {
8458          super.listChildren(children);
8459          children.add(new Property("itemSequence", "positiveInt", "List of input service items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, itemSequence));
8460          children.add(new Property("detailSequence", "positiveInt", "The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.", 0, java.lang.Integer.MAX_VALUE, detailSequence));
8461          children.add(new Property("subDetailSequence", "positiveInt", "The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.", 0, java.lang.Integer.MAX_VALUE, subDetailSequence));
8462          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));
8463          children.add(new Property("billcode", "CodeableConcept", "If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, billcode));
8464          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier));
8465          children.add(new Property("programCode", "CodeableConcept", "For programs which require reason codes for the inclusion or covering of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode));
8466          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));
8467          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location));
8468          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
8469          children.add(new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, 1, unitPrice));
8470          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));
8471          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net));
8472          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
8473          children.add(new Property("subSite", "CodeableConcept", "A region or surface of the site, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite));
8474          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
8475          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
8476          children.add(new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail));
8477        }
8478
8479        @Override
8480        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8481          switch (_hash) {
8482          case 1977979892: /*itemSequence*/  return new Property("itemSequence", "positiveInt", "List of input service items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, itemSequence);
8483          case 1321472818: /*detailSequence*/  return new Property("detailSequence", "positiveInt", "The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.", 0, java.lang.Integer.MAX_VALUE, detailSequence);
8484          case -855462510: /*subDetailSequence*/  return new Property("subDetailSequence", "positiveInt", "The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.", 0, java.lang.Integer.MAX_VALUE, subDetailSequence);
8485          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);
8486          case 890074740: /*billcode*/  return new Property("billcode", "CodeableConcept", "If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, billcode);
8487          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier);
8488          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "For programs which require reason codes for the inclusion or covering of this billed item under the program or sub-program.", 0, java.lang.Integer.MAX_VALUE, programCode);
8489          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);
8490          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);
8491          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);
8492          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);
8493          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
8494          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
8495          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
8496          case -1280020865: /*locationAddress*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
8497          case 755866390: /*locationReference*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
8498          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
8499          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, 1, unitPrice);
8500          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);
8501          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net);
8502          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
8503          case -1868566105: /*subSite*/  return new Property("subSite", "CodeableConcept", "A region or surface of the site, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite);
8504          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
8505          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
8506          case -1335224239: /*detail*/  return new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail);
8507          default: return super.getNamedProperty(_hash, _name, _checkValid);
8508          }
8509
8510        }
8511
8512      @Override
8513      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8514        switch (hash) {
8515        case 1977979892: /*itemSequence*/ return this.itemSequence == null ? new Base[0] : this.itemSequence.toArray(new Base[this.itemSequence.size()]); // PositiveIntType
8516        case 1321472818: /*detailSequence*/ return this.detailSequence == null ? new Base[0] : this.detailSequence.toArray(new Base[this.detailSequence.size()]); // PositiveIntType
8517        case -855462510: /*subDetailSequence*/ return this.subDetailSequence == null ? new Base[0] : this.subDetailSequence.toArray(new Base[this.subDetailSequence.size()]); // PositiveIntType
8518        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : this.provider.toArray(new Base[this.provider.size()]); // Reference
8519        case 890074740: /*billcode*/ return this.billcode == null ? new Base[0] : new Base[] {this.billcode}; // CodeableConcept
8520        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
8521        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
8522        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
8523        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
8524        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
8525        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
8526        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
8527        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
8528        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
8529        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
8530        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
8531        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
8532        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemDetailComponent
8533        default: return super.getProperty(hash, name, checkValid);
8534        }
8535
8536      }
8537
8538      @Override
8539      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8540        switch (hash) {
8541        case 1977979892: // itemSequence
8542          this.getItemSequence().add(castToPositiveInt(value)); // PositiveIntType
8543          return value;
8544        case 1321472818: // detailSequence
8545          this.getDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
8546          return value;
8547        case -855462510: // subDetailSequence
8548          this.getSubDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
8549          return value;
8550        case -987494927: // provider
8551          this.getProvider().add(castToReference(value)); // Reference
8552          return value;
8553        case 890074740: // billcode
8554          this.billcode = castToCodeableConcept(value); // CodeableConcept
8555          return value;
8556        case -615513385: // modifier
8557          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
8558          return value;
8559        case 1010065041: // programCode
8560          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
8561          return value;
8562        case 1379209295: // serviced
8563          this.serviced = castToType(value); // Type
8564          return value;
8565        case 1901043637: // location
8566          this.location = castToType(value); // Type
8567          return value;
8568        case -1285004149: // quantity
8569          this.quantity = castToQuantity(value); // Quantity
8570          return value;
8571        case -486196699: // unitPrice
8572          this.unitPrice = castToMoney(value); // Money
8573          return value;
8574        case -1282148017: // factor
8575          this.factor = castToDecimal(value); // DecimalType
8576          return value;
8577        case 108957: // net
8578          this.net = castToMoney(value); // Money
8579          return value;
8580        case 1702620169: // bodySite
8581          this.bodySite = castToCodeableConcept(value); // CodeableConcept
8582          return value;
8583        case -1868566105: // subSite
8584          this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
8585          return value;
8586        case -1110033957: // noteNumber
8587          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
8588          return value;
8589        case -231349275: // adjudication
8590          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
8591          return value;
8592        case -1335224239: // detail
8593          this.getDetail().add((AddedItemDetailComponent) value); // AddedItemDetailComponent
8594          return value;
8595        default: return super.setProperty(hash, name, value);
8596        }
8597
8598      }
8599
8600      @Override
8601      public Base setProperty(String name, Base value) throws FHIRException {
8602        if (name.equals("itemSequence")) {
8603          this.getItemSequence().add(castToPositiveInt(value));
8604        } else if (name.equals("detailSequence")) {
8605          this.getDetailSequence().add(castToPositiveInt(value));
8606        } else if (name.equals("subDetailSequence")) {
8607          this.getSubDetailSequence().add(castToPositiveInt(value));
8608        } else if (name.equals("provider")) {
8609          this.getProvider().add(castToReference(value));
8610        } else if (name.equals("billcode")) {
8611          this.billcode = castToCodeableConcept(value); // CodeableConcept
8612        } else if (name.equals("modifier")) {
8613          this.getModifier().add(castToCodeableConcept(value));
8614        } else if (name.equals("programCode")) {
8615          this.getProgramCode().add(castToCodeableConcept(value));
8616        } else if (name.equals("serviced[x]")) {
8617          this.serviced = castToType(value); // Type
8618        } else if (name.equals("location[x]")) {
8619          this.location = castToType(value); // Type
8620        } else if (name.equals("quantity")) {
8621          this.quantity = castToQuantity(value); // Quantity
8622        } else if (name.equals("unitPrice")) {
8623          this.unitPrice = castToMoney(value); // Money
8624        } else if (name.equals("factor")) {
8625          this.factor = castToDecimal(value); // DecimalType
8626        } else if (name.equals("net")) {
8627          this.net = castToMoney(value); // Money
8628        } else if (name.equals("bodySite")) {
8629          this.bodySite = castToCodeableConcept(value); // CodeableConcept
8630        } else if (name.equals("subSite")) {
8631          this.getSubSite().add(castToCodeableConcept(value));
8632        } else if (name.equals("noteNumber")) {
8633          this.getNoteNumber().add(castToPositiveInt(value));
8634        } else if (name.equals("adjudication")) {
8635          this.getAdjudication().add((AdjudicationComponent) value);
8636        } else if (name.equals("detail")) {
8637          this.getDetail().add((AddedItemDetailComponent) value);
8638        } else
8639          return super.setProperty(name, value);
8640        return value;
8641      }
8642
8643      @Override
8644      public Base makeProperty(int hash, String name) throws FHIRException {
8645        switch (hash) {
8646        case 1977979892:  return addItemSequenceElement();
8647        case 1321472818:  return addDetailSequenceElement();
8648        case -855462510:  return addSubDetailSequenceElement();
8649        case -987494927:  return addProvider(); 
8650        case 890074740:  return getBillcode(); 
8651        case -615513385:  return addModifier(); 
8652        case 1010065041:  return addProgramCode(); 
8653        case -1927922223:  return getServiced(); 
8654        case 1379209295:  return getServiced(); 
8655        case 552316075:  return getLocation(); 
8656        case 1901043637:  return getLocation(); 
8657        case -1285004149:  return getQuantity(); 
8658        case -486196699:  return getUnitPrice(); 
8659        case -1282148017:  return getFactorElement();
8660        case 108957:  return getNet(); 
8661        case 1702620169:  return getBodySite(); 
8662        case -1868566105:  return addSubSite(); 
8663        case -1110033957:  return addNoteNumberElement();
8664        case -231349275:  return addAdjudication(); 
8665        case -1335224239:  return addDetail(); 
8666        default: return super.makeProperty(hash, name);
8667        }
8668
8669      }
8670
8671      @Override
8672      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8673        switch (hash) {
8674        case 1977979892: /*itemSequence*/ return new String[] {"positiveInt"};
8675        case 1321472818: /*detailSequence*/ return new String[] {"positiveInt"};
8676        case -855462510: /*subDetailSequence*/ return new String[] {"positiveInt"};
8677        case -987494927: /*provider*/ return new String[] {"Reference"};
8678        case 890074740: /*billcode*/ return new String[] {"CodeableConcept"};
8679        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
8680        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
8681        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
8682        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
8683        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
8684        case -486196699: /*unitPrice*/ return new String[] {"Money"};
8685        case -1282148017: /*factor*/ return new String[] {"decimal"};
8686        case 108957: /*net*/ return new String[] {"Money"};
8687        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
8688        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
8689        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
8690        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
8691        case -1335224239: /*detail*/ return new String[] {};
8692        default: return super.getTypesForProperty(hash, name);
8693        }
8694
8695      }
8696
8697      @Override
8698      public Base addChild(String name) throws FHIRException {
8699        if (name.equals("itemSequence")) {
8700          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.itemSequence");
8701        }
8702        else if (name.equals("detailSequence")) {
8703          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.detailSequence");
8704        }
8705        else if (name.equals("subDetailSequence")) {
8706          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.subDetailSequence");
8707        }
8708        else if (name.equals("provider")) {
8709          return addProvider();
8710        }
8711        else if (name.equals("billcode")) {
8712          this.billcode = new CodeableConcept();
8713          return this.billcode;
8714        }
8715        else if (name.equals("modifier")) {
8716          return addModifier();
8717        }
8718        else if (name.equals("programCode")) {
8719          return addProgramCode();
8720        }
8721        else if (name.equals("servicedDate")) {
8722          this.serviced = new DateType();
8723          return this.serviced;
8724        }
8725        else if (name.equals("servicedPeriod")) {
8726          this.serviced = new Period();
8727          return this.serviced;
8728        }
8729        else if (name.equals("locationCodeableConcept")) {
8730          this.location = new CodeableConcept();
8731          return this.location;
8732        }
8733        else if (name.equals("locationAddress")) {
8734          this.location = new Address();
8735          return this.location;
8736        }
8737        else if (name.equals("locationReference")) {
8738          this.location = new Reference();
8739          return this.location;
8740        }
8741        else if (name.equals("quantity")) {
8742          this.quantity = new Quantity();
8743          return this.quantity;
8744        }
8745        else if (name.equals("unitPrice")) {
8746          this.unitPrice = new Money();
8747          return this.unitPrice;
8748        }
8749        else if (name.equals("factor")) {
8750          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
8751        }
8752        else if (name.equals("net")) {
8753          this.net = new Money();
8754          return this.net;
8755        }
8756        else if (name.equals("bodySite")) {
8757          this.bodySite = new CodeableConcept();
8758          return this.bodySite;
8759        }
8760        else if (name.equals("subSite")) {
8761          return addSubSite();
8762        }
8763        else if (name.equals("noteNumber")) {
8764          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
8765        }
8766        else if (name.equals("adjudication")) {
8767          return addAdjudication();
8768        }
8769        else if (name.equals("detail")) {
8770          return addDetail();
8771        }
8772        else
8773          return super.addChild(name);
8774      }
8775
8776      public AddedItemComponent copy() {
8777        AddedItemComponent dst = new AddedItemComponent();
8778        copyValues(dst);
8779        if (itemSequence != null) {
8780          dst.itemSequence = new ArrayList<PositiveIntType>();
8781          for (PositiveIntType i : itemSequence)
8782            dst.itemSequence.add(i.copy());
8783        };
8784        if (detailSequence != null) {
8785          dst.detailSequence = new ArrayList<PositiveIntType>();
8786          for (PositiveIntType i : detailSequence)
8787            dst.detailSequence.add(i.copy());
8788        };
8789        if (subDetailSequence != null) {
8790          dst.subDetailSequence = new ArrayList<PositiveIntType>();
8791          for (PositiveIntType i : subDetailSequence)
8792            dst.subDetailSequence.add(i.copy());
8793        };
8794        if (provider != null) {
8795          dst.provider = new ArrayList<Reference>();
8796          for (Reference i : provider)
8797            dst.provider.add(i.copy());
8798        };
8799        dst.billcode = billcode == null ? null : billcode.copy();
8800        if (modifier != null) {
8801          dst.modifier = new ArrayList<CodeableConcept>();
8802          for (CodeableConcept i : modifier)
8803            dst.modifier.add(i.copy());
8804        };
8805        if (programCode != null) {
8806          dst.programCode = new ArrayList<CodeableConcept>();
8807          for (CodeableConcept i : programCode)
8808            dst.programCode.add(i.copy());
8809        };
8810        dst.serviced = serviced == null ? null : serviced.copy();
8811        dst.location = location == null ? null : location.copy();
8812        dst.quantity = quantity == null ? null : quantity.copy();
8813        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
8814        dst.factor = factor == null ? null : factor.copy();
8815        dst.net = net == null ? null : net.copy();
8816        dst.bodySite = bodySite == null ? null : bodySite.copy();
8817        if (subSite != null) {
8818          dst.subSite = new ArrayList<CodeableConcept>();
8819          for (CodeableConcept i : subSite)
8820            dst.subSite.add(i.copy());
8821        };
8822        if (noteNumber != null) {
8823          dst.noteNumber = new ArrayList<PositiveIntType>();
8824          for (PositiveIntType i : noteNumber)
8825            dst.noteNumber.add(i.copy());
8826        };
8827        if (adjudication != null) {
8828          dst.adjudication = new ArrayList<AdjudicationComponent>();
8829          for (AdjudicationComponent i : adjudication)
8830            dst.adjudication.add(i.copy());
8831        };
8832        if (detail != null) {
8833          dst.detail = new ArrayList<AddedItemDetailComponent>();
8834          for (AddedItemDetailComponent i : detail)
8835            dst.detail.add(i.copy());
8836        };
8837        return dst;
8838      }
8839
8840      @Override
8841      public boolean equalsDeep(Base other_) {
8842        if (!super.equalsDeep(other_))
8843          return false;
8844        if (!(other_ instanceof AddedItemComponent))
8845          return false;
8846        AddedItemComponent o = (AddedItemComponent) other_;
8847        return compareDeep(itemSequence, o.itemSequence, true) && compareDeep(detailSequence, o.detailSequence, true)
8848           && compareDeep(subDetailSequence, o.subDetailSequence, true) && compareDeep(provider, o.provider, true)
8849           && compareDeep(billcode, o.billcode, true) && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
8850           && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true) && compareDeep(quantity, o.quantity, true)
8851           && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true)
8852           && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true) && compareDeep(noteNumber, o.noteNumber, true)
8853           && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true);
8854      }
8855
8856      @Override
8857      public boolean equalsShallow(Base other_) {
8858        if (!super.equalsShallow(other_))
8859          return false;
8860        if (!(other_ instanceof AddedItemComponent))
8861          return false;
8862        AddedItemComponent o = (AddedItemComponent) other_;
8863        return compareValues(itemSequence, o.itemSequence, true) && compareValues(detailSequence, o.detailSequence, true)
8864           && compareValues(subDetailSequence, o.subDetailSequence, true) && compareValues(factor, o.factor, true)
8865           && compareValues(noteNumber, o.noteNumber, true);
8866      }
8867
8868      public boolean isEmpty() {
8869        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(itemSequence, detailSequence
8870          , subDetailSequence, provider, billcode, modifier, programCode, serviced, location
8871          , quantity, unitPrice, factor, net, bodySite, subSite, noteNumber, adjudication
8872          , detail);
8873      }
8874
8875  public String fhirType() {
8876    return "ExplanationOfBenefit.addItem";
8877
8878  }
8879
8880  }
8881
8882    @Block()
8883    public static class AddedItemDetailComponent extends BackboneElement implements IBaseBackboneElement {
8884        /**
8885         * If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.
8886         */
8887        @Child(name = "billcode", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
8888        @Description(shortDefinition="Billing Code", formalDefinition="If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'." )
8889        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
8890        protected CodeableConcept billcode;
8891
8892        /**
8893         * Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.
8894         */
8895        @Child(name = "modifier", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8896        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours." )
8897        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
8898        protected List<CodeableConcept> modifier;
8899
8900        /**
8901         * The number of repetitions of a service or product.
8902         */
8903        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
8904        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
8905        protected Quantity quantity;
8906
8907        /**
8908         * If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.
8909         */
8910        @Child(name = "unitPrice", type = {Money.class}, order=4, min=0, max=1, modifier=false, summary=false)
8911        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group." )
8912        protected Money unitPrice;
8913
8914        /**
8915         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
8916         */
8917        @Child(name = "factor", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=false)
8918        @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." )
8919        protected DecimalType factor;
8920
8921        /**
8922         * The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
8923         */
8924        @Child(name = "net", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
8925        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
8926        protected Money net;
8927
8928        /**
8929         * A list of note references to the notes provided below.
8930         */
8931        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8932        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
8933        protected List<PositiveIntType> noteNumber;
8934
8935        /**
8936         * The adjudication results.
8937         */
8938        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8939        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
8940        protected List<AdjudicationComponent> adjudication;
8941
8942        /**
8943         * The third-tier service adjudications for payor added services.
8944         */
8945        @Child(name = "subDetail", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8946        @Description(shortDefinition="Insurer added line items", formalDefinition="The third-tier service adjudications for payor added services." )
8947        protected List<AddedItemDetailSubDetailComponent> subDetail;
8948
8949        private static final long serialVersionUID = -387896540L;
8950
8951    /**
8952     * Constructor
8953     */
8954      public AddedItemDetailComponent() {
8955        super();
8956      }
8957
8958        /**
8959         * @return {@link #billcode} (If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.)
8960         */
8961        public CodeableConcept getBillcode() { 
8962          if (this.billcode == null)
8963            if (Configuration.errorOnAutoCreate())
8964              throw new Error("Attempt to auto-create AddedItemDetailComponent.billcode");
8965            else if (Configuration.doAutoCreate())
8966              this.billcode = new CodeableConcept(); // cc
8967          return this.billcode;
8968        }
8969
8970        public boolean hasBillcode() { 
8971          return this.billcode != null && !this.billcode.isEmpty();
8972        }
8973
8974        /**
8975         * @param value {@link #billcode} (If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.)
8976         */
8977        public AddedItemDetailComponent setBillcode(CodeableConcept value) { 
8978          this.billcode = value;
8979          return this;
8980        }
8981
8982        /**
8983         * @return {@link #modifier} (Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.)
8984         */
8985        public List<CodeableConcept> getModifier() { 
8986          if (this.modifier == null)
8987            this.modifier = new ArrayList<CodeableConcept>();
8988          return this.modifier;
8989        }
8990
8991        /**
8992         * @return Returns a reference to <code>this</code> for easy method chaining
8993         */
8994        public AddedItemDetailComponent setModifier(List<CodeableConcept> theModifier) { 
8995          this.modifier = theModifier;
8996          return this;
8997        }
8998
8999        public boolean hasModifier() { 
9000          if (this.modifier == null)
9001            return false;
9002          for (CodeableConcept item : this.modifier)
9003            if (!item.isEmpty())
9004              return true;
9005          return false;
9006        }
9007
9008        public CodeableConcept addModifier() { //3
9009          CodeableConcept t = new CodeableConcept();
9010          if (this.modifier == null)
9011            this.modifier = new ArrayList<CodeableConcept>();
9012          this.modifier.add(t);
9013          return t;
9014        }
9015
9016        public AddedItemDetailComponent addModifier(CodeableConcept t) { //3
9017          if (t == null)
9018            return this;
9019          if (this.modifier == null)
9020            this.modifier = new ArrayList<CodeableConcept>();
9021          this.modifier.add(t);
9022          return this;
9023        }
9024
9025        /**
9026         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
9027         */
9028        public CodeableConcept getModifierFirstRep() { 
9029          if (getModifier().isEmpty()) {
9030            addModifier();
9031          }
9032          return getModifier().get(0);
9033        }
9034
9035        /**
9036         * @return {@link #quantity} (The number of repetitions of a service or product.)
9037         */
9038        public Quantity getQuantity() { 
9039          if (this.quantity == null)
9040            if (Configuration.errorOnAutoCreate())
9041              throw new Error("Attempt to auto-create AddedItemDetailComponent.quantity");
9042            else if (Configuration.doAutoCreate())
9043              this.quantity = new Quantity(); // cc
9044          return this.quantity;
9045        }
9046
9047        public boolean hasQuantity() { 
9048          return this.quantity != null && !this.quantity.isEmpty();
9049        }
9050
9051        /**
9052         * @param value {@link #quantity} (The number of repetitions of a service or product.)
9053         */
9054        public AddedItemDetailComponent setQuantity(Quantity value) { 
9055          this.quantity = value;
9056          return this;
9057        }
9058
9059        /**
9060         * @return {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
9061         */
9062        public Money getUnitPrice() { 
9063          if (this.unitPrice == null)
9064            if (Configuration.errorOnAutoCreate())
9065              throw new Error("Attempt to auto-create AddedItemDetailComponent.unitPrice");
9066            else if (Configuration.doAutoCreate())
9067              this.unitPrice = new Money(); // cc
9068          return this.unitPrice;
9069        }
9070
9071        public boolean hasUnitPrice() { 
9072          return this.unitPrice != null && !this.unitPrice.isEmpty();
9073        }
9074
9075        /**
9076         * @param value {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
9077         */
9078        public AddedItemDetailComponent setUnitPrice(Money value) { 
9079          this.unitPrice = value;
9080          return this;
9081        }
9082
9083        /**
9084         * @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
9085         */
9086        public DecimalType getFactorElement() { 
9087          if (this.factor == null)
9088            if (Configuration.errorOnAutoCreate())
9089              throw new Error("Attempt to auto-create AddedItemDetailComponent.factor");
9090            else if (Configuration.doAutoCreate())
9091              this.factor = new DecimalType(); // bb
9092          return this.factor;
9093        }
9094
9095        public boolean hasFactorElement() { 
9096          return this.factor != null && !this.factor.isEmpty();
9097        }
9098
9099        public boolean hasFactor() { 
9100          return this.factor != null && !this.factor.isEmpty();
9101        }
9102
9103        /**
9104         * @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
9105         */
9106        public AddedItemDetailComponent setFactorElement(DecimalType value) { 
9107          this.factor = value;
9108          return this;
9109        }
9110
9111        /**
9112         * @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.
9113         */
9114        public BigDecimal getFactor() { 
9115          return this.factor == null ? null : this.factor.getValue();
9116        }
9117
9118        /**
9119         * @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.
9120         */
9121        public AddedItemDetailComponent setFactor(BigDecimal value) { 
9122          if (value == null)
9123            this.factor = null;
9124          else {
9125            if (this.factor == null)
9126              this.factor = new DecimalType();
9127            this.factor.setValue(value);
9128          }
9129          return this;
9130        }
9131
9132        /**
9133         * @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.
9134         */
9135        public AddedItemDetailComponent setFactor(long value) { 
9136              this.factor = new DecimalType();
9137            this.factor.setValue(value);
9138          return this;
9139        }
9140
9141        /**
9142         * @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.
9143         */
9144        public AddedItemDetailComponent setFactor(double value) { 
9145              this.factor = new DecimalType();
9146            this.factor.setValue(value);
9147          return this;
9148        }
9149
9150        /**
9151         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
9152         */
9153        public Money getNet() { 
9154          if (this.net == null)
9155            if (Configuration.errorOnAutoCreate())
9156              throw new Error("Attempt to auto-create AddedItemDetailComponent.net");
9157            else if (Configuration.doAutoCreate())
9158              this.net = new Money(); // cc
9159          return this.net;
9160        }
9161
9162        public boolean hasNet() { 
9163          return this.net != null && !this.net.isEmpty();
9164        }
9165
9166        /**
9167         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
9168         */
9169        public AddedItemDetailComponent setNet(Money value) { 
9170          this.net = value;
9171          return this;
9172        }
9173
9174        /**
9175         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
9176         */
9177        public List<PositiveIntType> getNoteNumber() { 
9178          if (this.noteNumber == null)
9179            this.noteNumber = new ArrayList<PositiveIntType>();
9180          return this.noteNumber;
9181        }
9182
9183        /**
9184         * @return Returns a reference to <code>this</code> for easy method chaining
9185         */
9186        public AddedItemDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
9187          this.noteNumber = theNoteNumber;
9188          return this;
9189        }
9190
9191        public boolean hasNoteNumber() { 
9192          if (this.noteNumber == null)
9193            return false;
9194          for (PositiveIntType item : this.noteNumber)
9195            if (!item.isEmpty())
9196              return true;
9197          return false;
9198        }
9199
9200        /**
9201         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
9202         */
9203        public PositiveIntType addNoteNumberElement() {//2 
9204          PositiveIntType t = new PositiveIntType();
9205          if (this.noteNumber == null)
9206            this.noteNumber = new ArrayList<PositiveIntType>();
9207          this.noteNumber.add(t);
9208          return t;
9209        }
9210
9211        /**
9212         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
9213         */
9214        public AddedItemDetailComponent addNoteNumber(int value) { //1
9215          PositiveIntType t = new PositiveIntType();
9216          t.setValue(value);
9217          if (this.noteNumber == null)
9218            this.noteNumber = new ArrayList<PositiveIntType>();
9219          this.noteNumber.add(t);
9220          return this;
9221        }
9222
9223        /**
9224         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
9225         */
9226        public boolean hasNoteNumber(int value) { 
9227          if (this.noteNumber == null)
9228            return false;
9229          for (PositiveIntType v : this.noteNumber)
9230            if (v.getValue().equals(value)) // positiveInt
9231              return true;
9232          return false;
9233        }
9234
9235        /**
9236         * @return {@link #adjudication} (The adjudication results.)
9237         */
9238        public List<AdjudicationComponent> getAdjudication() { 
9239          if (this.adjudication == null)
9240            this.adjudication = new ArrayList<AdjudicationComponent>();
9241          return this.adjudication;
9242        }
9243
9244        /**
9245         * @return Returns a reference to <code>this</code> for easy method chaining
9246         */
9247        public AddedItemDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
9248          this.adjudication = theAdjudication;
9249          return this;
9250        }
9251
9252        public boolean hasAdjudication() { 
9253          if (this.adjudication == null)
9254            return false;
9255          for (AdjudicationComponent item : this.adjudication)
9256            if (!item.isEmpty())
9257              return true;
9258          return false;
9259        }
9260
9261        public AdjudicationComponent addAdjudication() { //3
9262          AdjudicationComponent t = new AdjudicationComponent();
9263          if (this.adjudication == null)
9264            this.adjudication = new ArrayList<AdjudicationComponent>();
9265          this.adjudication.add(t);
9266          return t;
9267        }
9268
9269        public AddedItemDetailComponent addAdjudication(AdjudicationComponent t) { //3
9270          if (t == null)
9271            return this;
9272          if (this.adjudication == null)
9273            this.adjudication = new ArrayList<AdjudicationComponent>();
9274          this.adjudication.add(t);
9275          return this;
9276        }
9277
9278        /**
9279         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
9280         */
9281        public AdjudicationComponent getAdjudicationFirstRep() { 
9282          if (getAdjudication().isEmpty()) {
9283            addAdjudication();
9284          }
9285          return getAdjudication().get(0);
9286        }
9287
9288        /**
9289         * @return {@link #subDetail} (The third-tier service adjudications for payor added services.)
9290         */
9291        public List<AddedItemDetailSubDetailComponent> getSubDetail() { 
9292          if (this.subDetail == null)
9293            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9294          return this.subDetail;
9295        }
9296
9297        /**
9298         * @return Returns a reference to <code>this</code> for easy method chaining
9299         */
9300        public AddedItemDetailComponent setSubDetail(List<AddedItemDetailSubDetailComponent> theSubDetail) { 
9301          this.subDetail = theSubDetail;
9302          return this;
9303        }
9304
9305        public boolean hasSubDetail() { 
9306          if (this.subDetail == null)
9307            return false;
9308          for (AddedItemDetailSubDetailComponent item : this.subDetail)
9309            if (!item.isEmpty())
9310              return true;
9311          return false;
9312        }
9313
9314        public AddedItemDetailSubDetailComponent addSubDetail() { //3
9315          AddedItemDetailSubDetailComponent t = new AddedItemDetailSubDetailComponent();
9316          if (this.subDetail == null)
9317            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9318          this.subDetail.add(t);
9319          return t;
9320        }
9321
9322        public AddedItemDetailComponent addSubDetail(AddedItemDetailSubDetailComponent t) { //3
9323          if (t == null)
9324            return this;
9325          if (this.subDetail == null)
9326            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9327          this.subDetail.add(t);
9328          return this;
9329        }
9330
9331        /**
9332         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist
9333         */
9334        public AddedItemDetailSubDetailComponent getSubDetailFirstRep() { 
9335          if (getSubDetail().isEmpty()) {
9336            addSubDetail();
9337          }
9338          return getSubDetail().get(0);
9339        }
9340
9341        protected void listChildren(List<Property> children) {
9342          super.listChildren(children);
9343          children.add(new Property("billcode", "CodeableConcept", "If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, billcode));
9344          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier));
9345          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
9346          children.add(new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, 1, unitPrice));
9347          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));
9348          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net));
9349          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
9350          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
9351          children.add(new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
9352        }
9353
9354        @Override
9355        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9356          switch (_hash) {
9357          case 890074740: /*billcode*/  return new Property("billcode", "CodeableConcept", "If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, billcode);
9358          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier);
9359          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
9360          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, 1, unitPrice);
9361          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);
9362          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net);
9363          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
9364          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
9365          case -828829007: /*subDetail*/  return new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
9366          default: return super.getNamedProperty(_hash, _name, _checkValid);
9367          }
9368
9369        }
9370
9371      @Override
9372      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9373        switch (hash) {
9374        case 890074740: /*billcode*/ return this.billcode == null ? new Base[0] : new Base[] {this.billcode}; // CodeableConcept
9375        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
9376        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
9377        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
9378        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
9379        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
9380        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
9381        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
9382        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // AddedItemDetailSubDetailComponent
9383        default: return super.getProperty(hash, name, checkValid);
9384        }
9385
9386      }
9387
9388      @Override
9389      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9390        switch (hash) {
9391        case 890074740: // billcode
9392          this.billcode = castToCodeableConcept(value); // CodeableConcept
9393          return value;
9394        case -615513385: // modifier
9395          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
9396          return value;
9397        case -1285004149: // quantity
9398          this.quantity = castToQuantity(value); // Quantity
9399          return value;
9400        case -486196699: // unitPrice
9401          this.unitPrice = castToMoney(value); // Money
9402          return value;
9403        case -1282148017: // factor
9404          this.factor = castToDecimal(value); // DecimalType
9405          return value;
9406        case 108957: // net
9407          this.net = castToMoney(value); // Money
9408          return value;
9409        case -1110033957: // noteNumber
9410          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
9411          return value;
9412        case -231349275: // adjudication
9413          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
9414          return value;
9415        case -828829007: // subDetail
9416          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value); // AddedItemDetailSubDetailComponent
9417          return value;
9418        default: return super.setProperty(hash, name, value);
9419        }
9420
9421      }
9422
9423      @Override
9424      public Base setProperty(String name, Base value) throws FHIRException {
9425        if (name.equals("billcode")) {
9426          this.billcode = castToCodeableConcept(value); // CodeableConcept
9427        } else if (name.equals("modifier")) {
9428          this.getModifier().add(castToCodeableConcept(value));
9429        } else if (name.equals("quantity")) {
9430          this.quantity = castToQuantity(value); // Quantity
9431        } else if (name.equals("unitPrice")) {
9432          this.unitPrice = castToMoney(value); // Money
9433        } else if (name.equals("factor")) {
9434          this.factor = castToDecimal(value); // DecimalType
9435        } else if (name.equals("net")) {
9436          this.net = castToMoney(value); // Money
9437        } else if (name.equals("noteNumber")) {
9438          this.getNoteNumber().add(castToPositiveInt(value));
9439        } else if (name.equals("adjudication")) {
9440          this.getAdjudication().add((AdjudicationComponent) value);
9441        } else if (name.equals("subDetail")) {
9442          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value);
9443        } else
9444          return super.setProperty(name, value);
9445        return value;
9446      }
9447
9448      @Override
9449      public Base makeProperty(int hash, String name) throws FHIRException {
9450        switch (hash) {
9451        case 890074740:  return getBillcode(); 
9452        case -615513385:  return addModifier(); 
9453        case -1285004149:  return getQuantity(); 
9454        case -486196699:  return getUnitPrice(); 
9455        case -1282148017:  return getFactorElement();
9456        case 108957:  return getNet(); 
9457        case -1110033957:  return addNoteNumberElement();
9458        case -231349275:  return addAdjudication(); 
9459        case -828829007:  return addSubDetail(); 
9460        default: return super.makeProperty(hash, name);
9461        }
9462
9463      }
9464
9465      @Override
9466      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9467        switch (hash) {
9468        case 890074740: /*billcode*/ return new String[] {"CodeableConcept"};
9469        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
9470        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
9471        case -486196699: /*unitPrice*/ return new String[] {"Money"};
9472        case -1282148017: /*factor*/ return new String[] {"decimal"};
9473        case 108957: /*net*/ return new String[] {"Money"};
9474        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
9475        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
9476        case -828829007: /*subDetail*/ return new String[] {};
9477        default: return super.getTypesForProperty(hash, name);
9478        }
9479
9480      }
9481
9482      @Override
9483      public Base addChild(String name) throws FHIRException {
9484        if (name.equals("billcode")) {
9485          this.billcode = new CodeableConcept();
9486          return this.billcode;
9487        }
9488        else if (name.equals("modifier")) {
9489          return addModifier();
9490        }
9491        else if (name.equals("quantity")) {
9492          this.quantity = new Quantity();
9493          return this.quantity;
9494        }
9495        else if (name.equals("unitPrice")) {
9496          this.unitPrice = new Money();
9497          return this.unitPrice;
9498        }
9499        else if (name.equals("factor")) {
9500          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
9501        }
9502        else if (name.equals("net")) {
9503          this.net = new Money();
9504          return this.net;
9505        }
9506        else if (name.equals("noteNumber")) {
9507          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
9508        }
9509        else if (name.equals("adjudication")) {
9510          return addAdjudication();
9511        }
9512        else if (name.equals("subDetail")) {
9513          return addSubDetail();
9514        }
9515        else
9516          return super.addChild(name);
9517      }
9518
9519      public AddedItemDetailComponent copy() {
9520        AddedItemDetailComponent dst = new AddedItemDetailComponent();
9521        copyValues(dst);
9522        dst.billcode = billcode == null ? null : billcode.copy();
9523        if (modifier != null) {
9524          dst.modifier = new ArrayList<CodeableConcept>();
9525          for (CodeableConcept i : modifier)
9526            dst.modifier.add(i.copy());
9527        };
9528        dst.quantity = quantity == null ? null : quantity.copy();
9529        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
9530        dst.factor = factor == null ? null : factor.copy();
9531        dst.net = net == null ? null : net.copy();
9532        if (noteNumber != null) {
9533          dst.noteNumber = new ArrayList<PositiveIntType>();
9534          for (PositiveIntType i : noteNumber)
9535            dst.noteNumber.add(i.copy());
9536        };
9537        if (adjudication != null) {
9538          dst.adjudication = new ArrayList<AdjudicationComponent>();
9539          for (AdjudicationComponent i : adjudication)
9540            dst.adjudication.add(i.copy());
9541        };
9542        if (subDetail != null) {
9543          dst.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9544          for (AddedItemDetailSubDetailComponent i : subDetail)
9545            dst.subDetail.add(i.copy());
9546        };
9547        return dst;
9548      }
9549
9550      @Override
9551      public boolean equalsDeep(Base other_) {
9552        if (!super.equalsDeep(other_))
9553          return false;
9554        if (!(other_ instanceof AddedItemDetailComponent))
9555          return false;
9556        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
9557        return compareDeep(billcode, o.billcode, true) && compareDeep(modifier, o.modifier, true) && compareDeep(quantity, o.quantity, true)
9558           && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true)
9559           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
9560           && compareDeep(subDetail, o.subDetail, true);
9561      }
9562
9563      @Override
9564      public boolean equalsShallow(Base other_) {
9565        if (!super.equalsShallow(other_))
9566          return false;
9567        if (!(other_ instanceof AddedItemDetailComponent))
9568          return false;
9569        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
9570        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
9571      }
9572
9573      public boolean isEmpty() {
9574        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(billcode, modifier, quantity
9575          , unitPrice, factor, net, noteNumber, adjudication, subDetail);
9576      }
9577
9578  public String fhirType() {
9579    return "ExplanationOfBenefit.addItem.detail";
9580
9581  }
9582
9583  }
9584
9585    @Block()
9586    public static class AddedItemDetailSubDetailComponent extends BackboneElement implements IBaseBackboneElement {
9587        /**
9588         * If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.
9589         */
9590        @Child(name = "billcode", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
9591        @Description(shortDefinition="Billing Code", formalDefinition="If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'." )
9592        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
9593        protected CodeableConcept billcode;
9594
9595        /**
9596         * Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.
9597         */
9598        @Child(name = "modifier", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9599        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours." )
9600        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
9601        protected List<CodeableConcept> modifier;
9602
9603        /**
9604         * The number of repetitions of a service or product.
9605         */
9606        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
9607        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
9608        protected Quantity quantity;
9609
9610        /**
9611         * If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.
9612         */
9613        @Child(name = "unitPrice", type = {Money.class}, order=4, min=0, max=1, modifier=false, summary=false)
9614        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group." )
9615        protected Money unitPrice;
9616
9617        /**
9618         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
9619         */
9620        @Child(name = "factor", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=false)
9621        @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." )
9622        protected DecimalType factor;
9623
9624        /**
9625         * The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.
9626         */
9627        @Child(name = "net", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
9628        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied." )
9629        protected Money net;
9630
9631        /**
9632         * A list of note references to the notes provided below.
9633         */
9634        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9635        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
9636        protected List<PositiveIntType> noteNumber;
9637
9638        /**
9639         * The adjudication results.
9640         */
9641        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9642        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
9643        protected List<AdjudicationComponent> adjudication;
9644
9645        private static final long serialVersionUID = 374278167L;
9646
9647    /**
9648     * Constructor
9649     */
9650      public AddedItemDetailSubDetailComponent() {
9651        super();
9652      }
9653
9654        /**
9655         * @return {@link #billcode} (If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.)
9656         */
9657        public CodeableConcept getBillcode() { 
9658          if (this.billcode == null)
9659            if (Configuration.errorOnAutoCreate())
9660              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.billcode");
9661            else if (Configuration.doAutoCreate())
9662              this.billcode = new CodeableConcept(); // cc
9663          return this.billcode;
9664        }
9665
9666        public boolean hasBillcode() { 
9667          return this.billcode != null && !this.billcode.isEmpty();
9668        }
9669
9670        /**
9671         * @param value {@link #billcode} (If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.)
9672         */
9673        public AddedItemDetailSubDetailComponent setBillcode(CodeableConcept value) { 
9674          this.billcode = value;
9675          return this;
9676        }
9677
9678        /**
9679         * @return {@link #modifier} (Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.)
9680         */
9681        public List<CodeableConcept> getModifier() { 
9682          if (this.modifier == null)
9683            this.modifier = new ArrayList<CodeableConcept>();
9684          return this.modifier;
9685        }
9686
9687        /**
9688         * @return Returns a reference to <code>this</code> for easy method chaining
9689         */
9690        public AddedItemDetailSubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
9691          this.modifier = theModifier;
9692          return this;
9693        }
9694
9695        public boolean hasModifier() { 
9696          if (this.modifier == null)
9697            return false;
9698          for (CodeableConcept item : this.modifier)
9699            if (!item.isEmpty())
9700              return true;
9701          return false;
9702        }
9703
9704        public CodeableConcept addModifier() { //3
9705          CodeableConcept t = new CodeableConcept();
9706          if (this.modifier == null)
9707            this.modifier = new ArrayList<CodeableConcept>();
9708          this.modifier.add(t);
9709          return t;
9710        }
9711
9712        public AddedItemDetailSubDetailComponent addModifier(CodeableConcept t) { //3
9713          if (t == null)
9714            return this;
9715          if (this.modifier == null)
9716            this.modifier = new ArrayList<CodeableConcept>();
9717          this.modifier.add(t);
9718          return this;
9719        }
9720
9721        /**
9722         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
9723         */
9724        public CodeableConcept getModifierFirstRep() { 
9725          if (getModifier().isEmpty()) {
9726            addModifier();
9727          }
9728          return getModifier().get(0);
9729        }
9730
9731        /**
9732         * @return {@link #quantity} (The number of repetitions of a service or product.)
9733         */
9734        public Quantity getQuantity() { 
9735          if (this.quantity == null)
9736            if (Configuration.errorOnAutoCreate())
9737              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.quantity");
9738            else if (Configuration.doAutoCreate())
9739              this.quantity = new Quantity(); // cc
9740          return this.quantity;
9741        }
9742
9743        public boolean hasQuantity() { 
9744          return this.quantity != null && !this.quantity.isEmpty();
9745        }
9746
9747        /**
9748         * @param value {@link #quantity} (The number of repetitions of a service or product.)
9749         */
9750        public AddedItemDetailSubDetailComponent setQuantity(Quantity value) { 
9751          this.quantity = value;
9752          return this;
9753        }
9754
9755        /**
9756         * @return {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
9757         */
9758        public Money getUnitPrice() { 
9759          if (this.unitPrice == null)
9760            if (Configuration.errorOnAutoCreate())
9761              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.unitPrice");
9762            else if (Configuration.doAutoCreate())
9763              this.unitPrice = new Money(); // cc
9764          return this.unitPrice;
9765        }
9766
9767        public boolean hasUnitPrice() { 
9768          return this.unitPrice != null && !this.unitPrice.isEmpty();
9769        }
9770
9771        /**
9772         * @param value {@link #unitPrice} (If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.)
9773         */
9774        public AddedItemDetailSubDetailComponent setUnitPrice(Money value) { 
9775          this.unitPrice = value;
9776          return this;
9777        }
9778
9779        /**
9780         * @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
9781         */
9782        public DecimalType getFactorElement() { 
9783          if (this.factor == null)
9784            if (Configuration.errorOnAutoCreate())
9785              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.factor");
9786            else if (Configuration.doAutoCreate())
9787              this.factor = new DecimalType(); // bb
9788          return this.factor;
9789        }
9790
9791        public boolean hasFactorElement() { 
9792          return this.factor != null && !this.factor.isEmpty();
9793        }
9794
9795        public boolean hasFactor() { 
9796          return this.factor != null && !this.factor.isEmpty();
9797        }
9798
9799        /**
9800         * @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
9801         */
9802        public AddedItemDetailSubDetailComponent setFactorElement(DecimalType value) { 
9803          this.factor = value;
9804          return this;
9805        }
9806
9807        /**
9808         * @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.
9809         */
9810        public BigDecimal getFactor() { 
9811          return this.factor == null ? null : this.factor.getValue();
9812        }
9813
9814        /**
9815         * @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.
9816         */
9817        public AddedItemDetailSubDetailComponent setFactor(BigDecimal value) { 
9818          if (value == null)
9819            this.factor = null;
9820          else {
9821            if (this.factor == null)
9822              this.factor = new DecimalType();
9823            this.factor.setValue(value);
9824          }
9825          return this;
9826        }
9827
9828        /**
9829         * @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.
9830         */
9831        public AddedItemDetailSubDetailComponent setFactor(long value) { 
9832              this.factor = new DecimalType();
9833            this.factor.setValue(value);
9834          return this;
9835        }
9836
9837        /**
9838         * @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.
9839         */
9840        public AddedItemDetailSubDetailComponent setFactor(double value) { 
9841              this.factor = new DecimalType();
9842            this.factor.setValue(value);
9843          return this;
9844        }
9845
9846        /**
9847         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
9848         */
9849        public Money getNet() { 
9850          if (this.net == null)
9851            if (Configuration.errorOnAutoCreate())
9852              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.net");
9853            else if (Configuration.doAutoCreate())
9854              this.net = new Money(); // cc
9855          return this.net;
9856        }
9857
9858        public boolean hasNet() { 
9859          return this.net != null && !this.net.isEmpty();
9860        }
9861
9862        /**
9863         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.)
9864         */
9865        public AddedItemDetailSubDetailComponent setNet(Money value) { 
9866          this.net = value;
9867          return this;
9868        }
9869
9870        /**
9871         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
9872         */
9873        public List<PositiveIntType> getNoteNumber() { 
9874          if (this.noteNumber == null)
9875            this.noteNumber = new ArrayList<PositiveIntType>();
9876          return this.noteNumber;
9877        }
9878
9879        /**
9880         * @return Returns a reference to <code>this</code> for easy method chaining
9881         */
9882        public AddedItemDetailSubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
9883          this.noteNumber = theNoteNumber;
9884          return this;
9885        }
9886
9887        public boolean hasNoteNumber() { 
9888          if (this.noteNumber == null)
9889            return false;
9890          for (PositiveIntType item : this.noteNumber)
9891            if (!item.isEmpty())
9892              return true;
9893          return false;
9894        }
9895
9896        /**
9897         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
9898         */
9899        public PositiveIntType addNoteNumberElement() {//2 
9900          PositiveIntType t = new PositiveIntType();
9901          if (this.noteNumber == null)
9902            this.noteNumber = new ArrayList<PositiveIntType>();
9903          this.noteNumber.add(t);
9904          return t;
9905        }
9906
9907        /**
9908         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
9909         */
9910        public AddedItemDetailSubDetailComponent addNoteNumber(int value) { //1
9911          PositiveIntType t = new PositiveIntType();
9912          t.setValue(value);
9913          if (this.noteNumber == null)
9914            this.noteNumber = new ArrayList<PositiveIntType>();
9915          this.noteNumber.add(t);
9916          return this;
9917        }
9918
9919        /**
9920         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
9921         */
9922        public boolean hasNoteNumber(int value) { 
9923          if (this.noteNumber == null)
9924            return false;
9925          for (PositiveIntType v : this.noteNumber)
9926            if (v.getValue().equals(value)) // positiveInt
9927              return true;
9928          return false;
9929        }
9930
9931        /**
9932         * @return {@link #adjudication} (The adjudication results.)
9933         */
9934        public List<AdjudicationComponent> getAdjudication() { 
9935          if (this.adjudication == null)
9936            this.adjudication = new ArrayList<AdjudicationComponent>();
9937          return this.adjudication;
9938        }
9939
9940        /**
9941         * @return Returns a reference to <code>this</code> for easy method chaining
9942         */
9943        public AddedItemDetailSubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
9944          this.adjudication = theAdjudication;
9945          return this;
9946        }
9947
9948        public boolean hasAdjudication() { 
9949          if (this.adjudication == null)
9950            return false;
9951          for (AdjudicationComponent item : this.adjudication)
9952            if (!item.isEmpty())
9953              return true;
9954          return false;
9955        }
9956
9957        public AdjudicationComponent addAdjudication() { //3
9958          AdjudicationComponent t = new AdjudicationComponent();
9959          if (this.adjudication == null)
9960            this.adjudication = new ArrayList<AdjudicationComponent>();
9961          this.adjudication.add(t);
9962          return t;
9963        }
9964
9965        public AddedItemDetailSubDetailComponent addAdjudication(AdjudicationComponent t) { //3
9966          if (t == null)
9967            return this;
9968          if (this.adjudication == null)
9969            this.adjudication = new ArrayList<AdjudicationComponent>();
9970          this.adjudication.add(t);
9971          return this;
9972        }
9973
9974        /**
9975         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
9976         */
9977        public AdjudicationComponent getAdjudicationFirstRep() { 
9978          if (getAdjudication().isEmpty()) {
9979            addAdjudication();
9980          }
9981          return getAdjudication().get(0);
9982        }
9983
9984        protected void listChildren(List<Property> children) {
9985          super.listChildren(children);
9986          children.add(new Property("billcode", "CodeableConcept", "If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, billcode));
9987          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier));
9988          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
9989          children.add(new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, 1, unitPrice));
9990          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));
9991          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net));
9992          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
9993          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
9994        }
9995
9996        @Override
9997        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9998          switch (_hash) {
9999          case 890074740: /*billcode*/  return new Property("billcode", "CodeableConcept", "If this is an actual service or product line, i.e. not a Group, then use code to indicate the Professional Service or Product supplied (e.g. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.", 0, 1, billcode);
10000          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, e.g. for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier);
10001          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
10002          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.", 0, 1, unitPrice);
10003          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);
10004          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.", 0, 1, net);
10005          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
10006          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
10007          default: return super.getNamedProperty(_hash, _name, _checkValid);
10008          }
10009
10010        }
10011
10012      @Override
10013      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10014        switch (hash) {
10015        case 890074740: /*billcode*/ return this.billcode == null ? new Base[0] : new Base[] {this.billcode}; // CodeableConcept
10016        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
10017        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
10018        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
10019        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
10020        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
10021        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
10022        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
10023        default: return super.getProperty(hash, name, checkValid);
10024        }
10025
10026      }
10027
10028      @Override
10029      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10030        switch (hash) {
10031        case 890074740: // billcode
10032          this.billcode = castToCodeableConcept(value); // CodeableConcept
10033          return value;
10034        case -615513385: // modifier
10035          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
10036          return value;
10037        case -1285004149: // quantity
10038          this.quantity = castToQuantity(value); // Quantity
10039          return value;
10040        case -486196699: // unitPrice
10041          this.unitPrice = castToMoney(value); // Money
10042          return value;
10043        case -1282148017: // factor
10044          this.factor = castToDecimal(value); // DecimalType
10045          return value;
10046        case 108957: // net
10047          this.net = castToMoney(value); // Money
10048          return value;
10049        case -1110033957: // noteNumber
10050          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
10051          return value;
10052        case -231349275: // adjudication
10053          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
10054          return value;
10055        default: return super.setProperty(hash, name, value);
10056        }
10057
10058      }
10059
10060      @Override
10061      public Base setProperty(String name, Base value) throws FHIRException {
10062        if (name.equals("billcode")) {
10063          this.billcode = castToCodeableConcept(value); // CodeableConcept
10064        } else if (name.equals("modifier")) {
10065          this.getModifier().add(castToCodeableConcept(value));
10066        } else if (name.equals("quantity")) {
10067          this.quantity = castToQuantity(value); // Quantity
10068        } else if (name.equals("unitPrice")) {
10069          this.unitPrice = castToMoney(value); // Money
10070        } else if (name.equals("factor")) {
10071          this.factor = castToDecimal(value); // DecimalType
10072        } else if (name.equals("net")) {
10073          this.net = castToMoney(value); // Money
10074        } else if (name.equals("noteNumber")) {
10075          this.getNoteNumber().add(castToPositiveInt(value));
10076        } else if (name.equals("adjudication")) {
10077          this.getAdjudication().add((AdjudicationComponent) value);
10078        } else
10079          return super.setProperty(name, value);
10080        return value;
10081      }
10082
10083      @Override
10084      public Base makeProperty(int hash, String name) throws FHIRException {
10085        switch (hash) {
10086        case 890074740:  return getBillcode(); 
10087        case -615513385:  return addModifier(); 
10088        case -1285004149:  return getQuantity(); 
10089        case -486196699:  return getUnitPrice(); 
10090        case -1282148017:  return getFactorElement();
10091        case 108957:  return getNet(); 
10092        case -1110033957:  return addNoteNumberElement();
10093        case -231349275:  return addAdjudication(); 
10094        default: return super.makeProperty(hash, name);
10095        }
10096
10097      }
10098
10099      @Override
10100      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10101        switch (hash) {
10102        case 890074740: /*billcode*/ return new String[] {"CodeableConcept"};
10103        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
10104        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
10105        case -486196699: /*unitPrice*/ return new String[] {"Money"};
10106        case -1282148017: /*factor*/ return new String[] {"decimal"};
10107        case 108957: /*net*/ return new String[] {"Money"};
10108        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
10109        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
10110        default: return super.getTypesForProperty(hash, name);
10111        }
10112
10113      }
10114
10115      @Override
10116      public Base addChild(String name) throws FHIRException {
10117        if (name.equals("billcode")) {
10118          this.billcode = new CodeableConcept();
10119          return this.billcode;
10120        }
10121        else if (name.equals("modifier")) {
10122          return addModifier();
10123        }
10124        else if (name.equals("quantity")) {
10125          this.quantity = new Quantity();
10126          return this.quantity;
10127        }
10128        else if (name.equals("unitPrice")) {
10129          this.unitPrice = new Money();
10130          return this.unitPrice;
10131        }
10132        else if (name.equals("factor")) {
10133          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
10134        }
10135        else if (name.equals("net")) {
10136          this.net = new Money();
10137          return this.net;
10138        }
10139        else if (name.equals("noteNumber")) {
10140          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
10141        }
10142        else if (name.equals("adjudication")) {
10143          return addAdjudication();
10144        }
10145        else
10146          return super.addChild(name);
10147      }
10148
10149      public AddedItemDetailSubDetailComponent copy() {
10150        AddedItemDetailSubDetailComponent dst = new AddedItemDetailSubDetailComponent();
10151        copyValues(dst);
10152        dst.billcode = billcode == null ? null : billcode.copy();
10153        if (modifier != null) {
10154          dst.modifier = new ArrayList<CodeableConcept>();
10155          for (CodeableConcept i : modifier)
10156            dst.modifier.add(i.copy());
10157        };
10158        dst.quantity = quantity == null ? null : quantity.copy();
10159        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
10160        dst.factor = factor == null ? null : factor.copy();
10161        dst.net = net == null ? null : net.copy();
10162        if (noteNumber != null) {
10163          dst.noteNumber = new ArrayList<PositiveIntType>();
10164          for (PositiveIntType i : noteNumber)
10165            dst.noteNumber.add(i.copy());
10166        };
10167        if (adjudication != null) {
10168          dst.adjudication = new ArrayList<AdjudicationComponent>();
10169          for (AdjudicationComponent i : adjudication)
10170            dst.adjudication.add(i.copy());
10171        };
10172        return dst;
10173      }
10174
10175      @Override
10176      public boolean equalsDeep(Base other_) {
10177        if (!super.equalsDeep(other_))
10178          return false;
10179        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
10180          return false;
10181        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
10182        return compareDeep(billcode, o.billcode, true) && compareDeep(modifier, o.modifier, true) && compareDeep(quantity, o.quantity, true)
10183           && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true)
10184           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
10185          ;
10186      }
10187
10188      @Override
10189      public boolean equalsShallow(Base other_) {
10190        if (!super.equalsShallow(other_))
10191          return false;
10192        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
10193          return false;
10194        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
10195        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
10196      }
10197
10198      public boolean isEmpty() {
10199        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(billcode, modifier, quantity
10200          , unitPrice, factor, net, noteNumber, adjudication);
10201      }
10202
10203  public String fhirType() {
10204    return "ExplanationOfBenefit.addItem.detail.subDetail";
10205
10206  }
10207
10208  }
10209
10210    @Block()
10211    public static class TotalComponent extends BackboneElement implements IBaseBackboneElement {
10212        /**
10213         * Code indicating: Submitted, Co-Pay, deductible, eligible, benefit, tax, etc.
10214         */
10215        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
10216        @Description(shortDefinition="Adjudication category such as submitted, co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Submitted, Co-Pay, deductible, eligible, benefit, tax, etc." )
10217        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
10218        protected CodeableConcept category;
10219
10220        /**
10221         * Monitory amount associated with the code.
10222         */
10223        @Child(name = "amount", type = {Money.class}, order=2, min=1, max=1, modifier=false, summary=false)
10224        @Description(shortDefinition="Monetary amount", formalDefinition="Monitory amount associated with the code." )
10225        protected Money amount;
10226
10227        private static final long serialVersionUID = 2012310309L;
10228
10229    /**
10230     * Constructor
10231     */
10232      public TotalComponent() {
10233        super();
10234      }
10235
10236    /**
10237     * Constructor
10238     */
10239      public TotalComponent(CodeableConcept category, Money amount) {
10240        super();
10241        this.category = category;
10242        this.amount = amount;
10243      }
10244
10245        /**
10246         * @return {@link #category} (Code indicating: Submitted, Co-Pay, deductible, eligible, benefit, tax, etc.)
10247         */
10248        public CodeableConcept getCategory() { 
10249          if (this.category == null)
10250            if (Configuration.errorOnAutoCreate())
10251              throw new Error("Attempt to auto-create TotalComponent.category");
10252            else if (Configuration.doAutoCreate())
10253              this.category = new CodeableConcept(); // cc
10254          return this.category;
10255        }
10256
10257        public boolean hasCategory() { 
10258          return this.category != null && !this.category.isEmpty();
10259        }
10260
10261        /**
10262         * @param value {@link #category} (Code indicating: Submitted, Co-Pay, deductible, eligible, benefit, tax, etc.)
10263         */
10264        public TotalComponent setCategory(CodeableConcept value) { 
10265          this.category = value;
10266          return this;
10267        }
10268
10269        /**
10270         * @return {@link #amount} (Monitory amount associated with the code.)
10271         */
10272        public Money getAmount() { 
10273          if (this.amount == null)
10274            if (Configuration.errorOnAutoCreate())
10275              throw new Error("Attempt to auto-create TotalComponent.amount");
10276            else if (Configuration.doAutoCreate())
10277              this.amount = new Money(); // cc
10278          return this.amount;
10279        }
10280
10281        public boolean hasAmount() { 
10282          return this.amount != null && !this.amount.isEmpty();
10283        }
10284
10285        /**
10286         * @param value {@link #amount} (Monitory amount associated with the code.)
10287         */
10288        public TotalComponent setAmount(Money value) { 
10289          this.amount = value;
10290          return this;
10291        }
10292
10293        protected void listChildren(List<Property> children) {
10294          super.listChildren(children);
10295          children.add(new Property("category", "CodeableConcept", "Code indicating: Submitted, Co-Pay, deductible, eligible, benefit, tax, etc.", 0, 1, category));
10296          children.add(new Property("amount", "Money", "Monitory amount associated with the code.", 0, 1, amount));
10297        }
10298
10299        @Override
10300        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10301          switch (_hash) {
10302          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Code indicating: Submitted, Co-Pay, deductible, eligible, benefit, tax, etc.", 0, 1, category);
10303          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monitory amount associated with the code.", 0, 1, amount);
10304          default: return super.getNamedProperty(_hash, _name, _checkValid);
10305          }
10306
10307        }
10308
10309      @Override
10310      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10311        switch (hash) {
10312        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
10313        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
10314        default: return super.getProperty(hash, name, checkValid);
10315        }
10316
10317      }
10318
10319      @Override
10320      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10321        switch (hash) {
10322        case 50511102: // category
10323          this.category = castToCodeableConcept(value); // CodeableConcept
10324          return value;
10325        case -1413853096: // amount
10326          this.amount = castToMoney(value); // Money
10327          return value;
10328        default: return super.setProperty(hash, name, value);
10329        }
10330
10331      }
10332
10333      @Override
10334      public Base setProperty(String name, Base value) throws FHIRException {
10335        if (name.equals("category")) {
10336          this.category = castToCodeableConcept(value); // CodeableConcept
10337        } else if (name.equals("amount")) {
10338          this.amount = castToMoney(value); // Money
10339        } else
10340          return super.setProperty(name, value);
10341        return value;
10342      }
10343
10344      @Override
10345      public Base makeProperty(int hash, String name) throws FHIRException {
10346        switch (hash) {
10347        case 50511102:  return getCategory(); 
10348        case -1413853096:  return getAmount(); 
10349        default: return super.makeProperty(hash, name);
10350        }
10351
10352      }
10353
10354      @Override
10355      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10356        switch (hash) {
10357        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
10358        case -1413853096: /*amount*/ return new String[] {"Money"};
10359        default: return super.getTypesForProperty(hash, name);
10360        }
10361
10362      }
10363
10364      @Override
10365      public Base addChild(String name) throws FHIRException {
10366        if (name.equals("category")) {
10367          this.category = new CodeableConcept();
10368          return this.category;
10369        }
10370        else if (name.equals("amount")) {
10371          this.amount = new Money();
10372          return this.amount;
10373        }
10374        else
10375          return super.addChild(name);
10376      }
10377
10378      public TotalComponent copy() {
10379        TotalComponent dst = new TotalComponent();
10380        copyValues(dst);
10381        dst.category = category == null ? null : category.copy();
10382        dst.amount = amount == null ? null : amount.copy();
10383        return dst;
10384      }
10385
10386      @Override
10387      public boolean equalsDeep(Base other_) {
10388        if (!super.equalsDeep(other_))
10389          return false;
10390        if (!(other_ instanceof TotalComponent))
10391          return false;
10392        TotalComponent o = (TotalComponent) other_;
10393        return compareDeep(category, o.category, true) && compareDeep(amount, o.amount, true);
10394      }
10395
10396      @Override
10397      public boolean equalsShallow(Base other_) {
10398        if (!super.equalsShallow(other_))
10399          return false;
10400        if (!(other_ instanceof TotalComponent))
10401          return false;
10402        TotalComponent o = (TotalComponent) other_;
10403        return true;
10404      }
10405
10406      public boolean isEmpty() {
10407        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, amount);
10408      }
10409
10410  public String fhirType() {
10411    return "ExplanationOfBenefit.total";
10412
10413  }
10414
10415  }
10416
10417    @Block()
10418    public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
10419        /**
10420         * Whether this represents partial or complete payment of the claim.
10421         */
10422        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
10423        @Description(shortDefinition="Partial or Complete", formalDefinition="Whether this represents partial or complete payment of the claim." )
10424        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-paymenttype")
10425        protected CodeableConcept type;
10426
10427        /**
10428         * Adjustment to the payment of this transaction which is not related to adjudication of this transaction.
10429         */
10430        @Child(name = "adjustment", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
10431        @Description(shortDefinition="Payment adjustment for non-Claim issues", formalDefinition="Adjustment to the payment of this transaction which is not related to adjudication of this transaction." )
10432        protected Money adjustment;
10433
10434        /**
10435         * Reason for the payment adjustment.
10436         */
10437        @Child(name = "adjustmentReason", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
10438        @Description(shortDefinition="Explanation for the non-claim adjustment", formalDefinition="Reason for the payment adjustment." )
10439        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
10440        protected CodeableConcept adjustmentReason;
10441
10442        /**
10443         * Estimated payment date.
10444         */
10445        @Child(name = "date", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=false)
10446        @Description(shortDefinition="Expected date of Payment", formalDefinition="Estimated payment date." )
10447        protected DateType date;
10448
10449        /**
10450         * Payable less any payment adjustment.
10451         */
10452        @Child(name = "amount", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
10453        @Description(shortDefinition="Payable amount after adjustment", formalDefinition="Payable less any payment adjustment." )
10454        protected Money amount;
10455
10456        /**
10457         * Payment identifier.
10458         */
10459        @Child(name = "identifier", type = {Identifier.class}, order=6, min=0, max=1, modifier=false, summary=false)
10460        @Description(shortDefinition="Identifier of the payment instrument", formalDefinition="Payment identifier." )
10461        protected Identifier identifier;
10462
10463        private static final long serialVersionUID = 1539906026L;
10464
10465    /**
10466     * Constructor
10467     */
10468      public PaymentComponent() {
10469        super();
10470      }
10471
10472        /**
10473         * @return {@link #type} (Whether this represents partial or complete payment of the claim.)
10474         */
10475        public CodeableConcept getType() { 
10476          if (this.type == null)
10477            if (Configuration.errorOnAutoCreate())
10478              throw new Error("Attempt to auto-create PaymentComponent.type");
10479            else if (Configuration.doAutoCreate())
10480              this.type = new CodeableConcept(); // cc
10481          return this.type;
10482        }
10483
10484        public boolean hasType() { 
10485          return this.type != null && !this.type.isEmpty();
10486        }
10487
10488        /**
10489         * @param value {@link #type} (Whether this represents partial or complete payment of the claim.)
10490         */
10491        public PaymentComponent setType(CodeableConcept value) { 
10492          this.type = value;
10493          return this;
10494        }
10495
10496        /**
10497         * @return {@link #adjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
10498         */
10499        public Money getAdjustment() { 
10500          if (this.adjustment == null)
10501            if (Configuration.errorOnAutoCreate())
10502              throw new Error("Attempt to auto-create PaymentComponent.adjustment");
10503            else if (Configuration.doAutoCreate())
10504              this.adjustment = new Money(); // cc
10505          return this.adjustment;
10506        }
10507
10508        public boolean hasAdjustment() { 
10509          return this.adjustment != null && !this.adjustment.isEmpty();
10510        }
10511
10512        /**
10513         * @param value {@link #adjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
10514         */
10515        public PaymentComponent setAdjustment(Money value) { 
10516          this.adjustment = value;
10517          return this;
10518        }
10519
10520        /**
10521         * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
10522         */
10523        public CodeableConcept getAdjustmentReason() { 
10524          if (this.adjustmentReason == null)
10525            if (Configuration.errorOnAutoCreate())
10526              throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
10527            else if (Configuration.doAutoCreate())
10528              this.adjustmentReason = new CodeableConcept(); // cc
10529          return this.adjustmentReason;
10530        }
10531
10532        public boolean hasAdjustmentReason() { 
10533          return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
10534        }
10535
10536        /**
10537         * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
10538         */
10539        public PaymentComponent setAdjustmentReason(CodeableConcept value) { 
10540          this.adjustmentReason = value;
10541          return this;
10542        }
10543
10544        /**
10545         * @return {@link #date} (Estimated payment date.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
10546         */
10547        public DateType getDateElement() { 
10548          if (this.date == null)
10549            if (Configuration.errorOnAutoCreate())
10550              throw new Error("Attempt to auto-create PaymentComponent.date");
10551            else if (Configuration.doAutoCreate())
10552              this.date = new DateType(); // bb
10553          return this.date;
10554        }
10555
10556        public boolean hasDateElement() { 
10557          return this.date != null && !this.date.isEmpty();
10558        }
10559
10560        public boolean hasDate() { 
10561          return this.date != null && !this.date.isEmpty();
10562        }
10563
10564        /**
10565         * @param value {@link #date} (Estimated payment date.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
10566         */
10567        public PaymentComponent setDateElement(DateType value) { 
10568          this.date = value;
10569          return this;
10570        }
10571
10572        /**
10573         * @return Estimated payment date.
10574         */
10575        public Date getDate() { 
10576          return this.date == null ? null : this.date.getValue();
10577        }
10578
10579        /**
10580         * @param value Estimated payment date.
10581         */
10582        public PaymentComponent setDate(Date value) { 
10583          if (value == null)
10584            this.date = null;
10585          else {
10586            if (this.date == null)
10587              this.date = new DateType();
10588            this.date.setValue(value);
10589          }
10590          return this;
10591        }
10592
10593        /**
10594         * @return {@link #amount} (Payable less any payment adjustment.)
10595         */
10596        public Money getAmount() { 
10597          if (this.amount == null)
10598            if (Configuration.errorOnAutoCreate())
10599              throw new Error("Attempt to auto-create PaymentComponent.amount");
10600            else if (Configuration.doAutoCreate())
10601              this.amount = new Money(); // cc
10602          return this.amount;
10603        }
10604
10605        public boolean hasAmount() { 
10606          return this.amount != null && !this.amount.isEmpty();
10607        }
10608
10609        /**
10610         * @param value {@link #amount} (Payable less any payment adjustment.)
10611         */
10612        public PaymentComponent setAmount(Money value) { 
10613          this.amount = value;
10614          return this;
10615        }
10616
10617        /**
10618         * @return {@link #identifier} (Payment identifier.)
10619         */
10620        public Identifier getIdentifier() { 
10621          if (this.identifier == null)
10622            if (Configuration.errorOnAutoCreate())
10623              throw new Error("Attempt to auto-create PaymentComponent.identifier");
10624            else if (Configuration.doAutoCreate())
10625              this.identifier = new Identifier(); // cc
10626          return this.identifier;
10627        }
10628
10629        public boolean hasIdentifier() { 
10630          return this.identifier != null && !this.identifier.isEmpty();
10631        }
10632
10633        /**
10634         * @param value {@link #identifier} (Payment identifier.)
10635         */
10636        public PaymentComponent setIdentifier(Identifier value) { 
10637          this.identifier = value;
10638          return this;
10639        }
10640
10641        protected void listChildren(List<Property> children) {
10642          super.listChildren(children);
10643          children.add(new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the claim.", 0, 1, type));
10644          children.add(new Property("adjustment", "Money", "Adjustment to the payment of this transaction which is not related to adjudication of this transaction.", 0, 1, adjustment));
10645          children.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason));
10646          children.add(new Property("date", "date", "Estimated payment date.", 0, 1, date));
10647          children.add(new Property("amount", "Money", "Payable less any payment adjustment.", 0, 1, amount));
10648          children.add(new Property("identifier", "Identifier", "Payment identifier.", 0, 1, identifier));
10649        }
10650
10651        @Override
10652        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10653          switch (_hash) {
10654          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the claim.", 0, 1, type);
10655          case 1977085293: /*adjustment*/  return new Property("adjustment", "Money", "Adjustment to the payment of this transaction which is not related to adjudication of this transaction.", 0, 1, adjustment);
10656          case -1255938543: /*adjustmentReason*/  return new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason);
10657          case 3076014: /*date*/  return new Property("date", "date", "Estimated payment date.", 0, 1, date);
10658          case -1413853096: /*amount*/  return new Property("amount", "Money", "Payable less any payment adjustment.", 0, 1, amount);
10659          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Payment identifier.", 0, 1, identifier);
10660          default: return super.getNamedProperty(_hash, _name, _checkValid);
10661          }
10662
10663        }
10664
10665      @Override
10666      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10667        switch (hash) {
10668        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
10669        case 1977085293: /*adjustment*/ return this.adjustment == null ? new Base[0] : new Base[] {this.adjustment}; // Money
10670        case -1255938543: /*adjustmentReason*/ return this.adjustmentReason == null ? new Base[0] : new Base[] {this.adjustmentReason}; // CodeableConcept
10671        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
10672        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
10673        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
10674        default: return super.getProperty(hash, name, checkValid);
10675        }
10676
10677      }
10678
10679      @Override
10680      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10681        switch (hash) {
10682        case 3575610: // type
10683          this.type = castToCodeableConcept(value); // CodeableConcept
10684          return value;
10685        case 1977085293: // adjustment
10686          this.adjustment = castToMoney(value); // Money
10687          return value;
10688        case -1255938543: // adjustmentReason
10689          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
10690          return value;
10691        case 3076014: // date
10692          this.date = castToDate(value); // DateType
10693          return value;
10694        case -1413853096: // amount
10695          this.amount = castToMoney(value); // Money
10696          return value;
10697        case -1618432855: // identifier
10698          this.identifier = castToIdentifier(value); // Identifier
10699          return value;
10700        default: return super.setProperty(hash, name, value);
10701        }
10702
10703      }
10704
10705      @Override
10706      public Base setProperty(String name, Base value) throws FHIRException {
10707        if (name.equals("type")) {
10708          this.type = castToCodeableConcept(value); // CodeableConcept
10709        } else if (name.equals("adjustment")) {
10710          this.adjustment = castToMoney(value); // Money
10711        } else if (name.equals("adjustmentReason")) {
10712          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
10713        } else if (name.equals("date")) {
10714          this.date = castToDate(value); // DateType
10715        } else if (name.equals("amount")) {
10716          this.amount = castToMoney(value); // Money
10717        } else if (name.equals("identifier")) {
10718          this.identifier = castToIdentifier(value); // Identifier
10719        } else
10720          return super.setProperty(name, value);
10721        return value;
10722      }
10723
10724      @Override
10725      public Base makeProperty(int hash, String name) throws FHIRException {
10726        switch (hash) {
10727        case 3575610:  return getType(); 
10728        case 1977085293:  return getAdjustment(); 
10729        case -1255938543:  return getAdjustmentReason(); 
10730        case 3076014:  return getDateElement();
10731        case -1413853096:  return getAmount(); 
10732        case -1618432855:  return getIdentifier(); 
10733        default: return super.makeProperty(hash, name);
10734        }
10735
10736      }
10737
10738      @Override
10739      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10740        switch (hash) {
10741        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
10742        case 1977085293: /*adjustment*/ return new String[] {"Money"};
10743        case -1255938543: /*adjustmentReason*/ return new String[] {"CodeableConcept"};
10744        case 3076014: /*date*/ return new String[] {"date"};
10745        case -1413853096: /*amount*/ return new String[] {"Money"};
10746        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
10747        default: return super.getTypesForProperty(hash, name);
10748        }
10749
10750      }
10751
10752      @Override
10753      public Base addChild(String name) throws FHIRException {
10754        if (name.equals("type")) {
10755          this.type = new CodeableConcept();
10756          return this.type;
10757        }
10758        else if (name.equals("adjustment")) {
10759          this.adjustment = new Money();
10760          return this.adjustment;
10761        }
10762        else if (name.equals("adjustmentReason")) {
10763          this.adjustmentReason = new CodeableConcept();
10764          return this.adjustmentReason;
10765        }
10766        else if (name.equals("date")) {
10767          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
10768        }
10769        else if (name.equals("amount")) {
10770          this.amount = new Money();
10771          return this.amount;
10772        }
10773        else if (name.equals("identifier")) {
10774          this.identifier = new Identifier();
10775          return this.identifier;
10776        }
10777        else
10778          return super.addChild(name);
10779      }
10780
10781      public PaymentComponent copy() {
10782        PaymentComponent dst = new PaymentComponent();
10783        copyValues(dst);
10784        dst.type = type == null ? null : type.copy();
10785        dst.adjustment = adjustment == null ? null : adjustment.copy();
10786        dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
10787        dst.date = date == null ? null : date.copy();
10788        dst.amount = amount == null ? null : amount.copy();
10789        dst.identifier = identifier == null ? null : identifier.copy();
10790        return dst;
10791      }
10792
10793      @Override
10794      public boolean equalsDeep(Base other_) {
10795        if (!super.equalsDeep(other_))
10796          return false;
10797        if (!(other_ instanceof PaymentComponent))
10798          return false;
10799        PaymentComponent o = (PaymentComponent) other_;
10800        return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true) && compareDeep(adjustmentReason, o.adjustmentReason, true)
10801           && compareDeep(date, o.date, true) && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true)
10802          ;
10803      }
10804
10805      @Override
10806      public boolean equalsShallow(Base other_) {
10807        if (!super.equalsShallow(other_))
10808          return false;
10809        if (!(other_ instanceof PaymentComponent))
10810          return false;
10811        PaymentComponent o = (PaymentComponent) other_;
10812        return compareValues(date, o.date, true);
10813      }
10814
10815      public boolean isEmpty() {
10816        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason
10817          , date, amount, identifier);
10818      }
10819
10820  public String fhirType() {
10821    return "ExplanationOfBenefit.payment";
10822
10823  }
10824
10825  }
10826
10827    @Block()
10828    public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
10829        /**
10830         * An integer associated with each note which may be referred to from each service line item.
10831         */
10832        @Child(name = "number", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
10833        @Description(shortDefinition="Sequence number for this note", formalDefinition="An integer associated with each note which may be referred to from each service line item." )
10834        protected PositiveIntType number;
10835
10836        /**
10837         * The note purpose: Print/Display.
10838         */
10839        @Child(name = "type", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
10840        @Description(shortDefinition="display | print | printoper", formalDefinition="The note purpose: Print/Display." )
10841        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/note-type")
10842        protected Enumeration<NoteType> type;
10843
10844        /**
10845         * The note text.
10846         */
10847        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
10848        @Description(shortDefinition="Note explanitory text", formalDefinition="The note text." )
10849        protected StringType text;
10850
10851        /**
10852         * The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.
10853         */
10854        @Child(name = "language", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
10855        @Description(shortDefinition="Language if different from the resource", formalDefinition="The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. \"en\" for English, or \"en-US\" for American English versus \"en-EN\" for England English." )
10856        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
10857        protected CodeableConcept language;
10858
10859        private static final long serialVersionUID = -385184277L;
10860
10861    /**
10862     * Constructor
10863     */
10864      public NoteComponent() {
10865        super();
10866      }
10867
10868        /**
10869         * @return {@link #number} (An integer associated with each note which may be referred to from each service line item.). This is the underlying object with id, value and extensions. The accessor "getNumber" gives direct access to the value
10870         */
10871        public PositiveIntType getNumberElement() { 
10872          if (this.number == null)
10873            if (Configuration.errorOnAutoCreate())
10874              throw new Error("Attempt to auto-create NoteComponent.number");
10875            else if (Configuration.doAutoCreate())
10876              this.number = new PositiveIntType(); // bb
10877          return this.number;
10878        }
10879
10880        public boolean hasNumberElement() { 
10881          return this.number != null && !this.number.isEmpty();
10882        }
10883
10884        public boolean hasNumber() { 
10885          return this.number != null && !this.number.isEmpty();
10886        }
10887
10888        /**
10889         * @param value {@link #number} (An integer associated with each note which may be referred to from each service line item.). This is the underlying object with id, value and extensions. The accessor "getNumber" gives direct access to the value
10890         */
10891        public NoteComponent setNumberElement(PositiveIntType value) { 
10892          this.number = value;
10893          return this;
10894        }
10895
10896        /**
10897         * @return An integer associated with each note which may be referred to from each service line item.
10898         */
10899        public int getNumber() { 
10900          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
10901        }
10902
10903        /**
10904         * @param value An integer associated with each note which may be referred to from each service line item.
10905         */
10906        public NoteComponent setNumber(int value) { 
10907            if (this.number == null)
10908              this.number = new PositiveIntType();
10909            this.number.setValue(value);
10910          return this;
10911        }
10912
10913        /**
10914         * @return {@link #type} (The note purpose: Print/Display.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
10915         */
10916        public Enumeration<NoteType> getTypeElement() { 
10917          if (this.type == null)
10918            if (Configuration.errorOnAutoCreate())
10919              throw new Error("Attempt to auto-create NoteComponent.type");
10920            else if (Configuration.doAutoCreate())
10921              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory()); // bb
10922          return this.type;
10923        }
10924
10925        public boolean hasTypeElement() { 
10926          return this.type != null && !this.type.isEmpty();
10927        }
10928
10929        public boolean hasType() { 
10930          return this.type != null && !this.type.isEmpty();
10931        }
10932
10933        /**
10934         * @param value {@link #type} (The note purpose: Print/Display.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
10935         */
10936        public NoteComponent setTypeElement(Enumeration<NoteType> value) { 
10937          this.type = value;
10938          return this;
10939        }
10940
10941        /**
10942         * @return The note purpose: Print/Display.
10943         */
10944        public NoteType getType() { 
10945          return this.type == null ? null : this.type.getValue();
10946        }
10947
10948        /**
10949         * @param value The note purpose: Print/Display.
10950         */
10951        public NoteComponent setType(NoteType value) { 
10952          if (value == null)
10953            this.type = null;
10954          else {
10955            if (this.type == null)
10956              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory());
10957            this.type.setValue(value);
10958          }
10959          return this;
10960        }
10961
10962        /**
10963         * @return {@link #text} (The note text.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
10964         */
10965        public StringType getTextElement() { 
10966          if (this.text == null)
10967            if (Configuration.errorOnAutoCreate())
10968              throw new Error("Attempt to auto-create NoteComponent.text");
10969            else if (Configuration.doAutoCreate())
10970              this.text = new StringType(); // bb
10971          return this.text;
10972        }
10973
10974        public boolean hasTextElement() { 
10975          return this.text != null && !this.text.isEmpty();
10976        }
10977
10978        public boolean hasText() { 
10979          return this.text != null && !this.text.isEmpty();
10980        }
10981
10982        /**
10983         * @param value {@link #text} (The note text.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
10984         */
10985        public NoteComponent setTextElement(StringType value) { 
10986          this.text = value;
10987          return this;
10988        }
10989
10990        /**
10991         * @return The note text.
10992         */
10993        public String getText() { 
10994          return this.text == null ? null : this.text.getValue();
10995        }
10996
10997        /**
10998         * @param value The note text.
10999         */
11000        public NoteComponent setText(String value) { 
11001          if (Utilities.noString(value))
11002            this.text = null;
11003          else {
11004            if (this.text == null)
11005              this.text = new StringType();
11006            this.text.setValue(value);
11007          }
11008          return this;
11009        }
11010
11011        /**
11012         * @return {@link #language} (The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.)
11013         */
11014        public CodeableConcept getLanguage() { 
11015          if (this.language == null)
11016            if (Configuration.errorOnAutoCreate())
11017              throw new Error("Attempt to auto-create NoteComponent.language");
11018            else if (Configuration.doAutoCreate())
11019              this.language = new CodeableConcept(); // cc
11020          return this.language;
11021        }
11022
11023        public boolean hasLanguage() { 
11024          return this.language != null && !this.language.isEmpty();
11025        }
11026
11027        /**
11028         * @param value {@link #language} (The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.)
11029         */
11030        public NoteComponent setLanguage(CodeableConcept value) { 
11031          this.language = value;
11032          return this;
11033        }
11034
11035        protected void listChildren(List<Property> children) {
11036          super.listChildren(children);
11037          children.add(new Property("number", "positiveInt", "An integer associated with each note which may be referred to from each service line item.", 0, 1, number));
11038          children.add(new Property("type", "code", "The note purpose: Print/Display.", 0, 1, type));
11039          children.add(new Property("text", "string", "The note text.", 0, 1, text));
11040          children.add(new Property("language", "CodeableConcept", "The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. \"en\" for English, or \"en-US\" for American English versus \"en-EN\" for England English.", 0, 1, language));
11041        }
11042
11043        @Override
11044        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11045          switch (_hash) {
11046          case -1034364087: /*number*/  return new Property("number", "positiveInt", "An integer associated with each note which may be referred to from each service line item.", 0, 1, number);
11047          case 3575610: /*type*/  return new Property("type", "code", "The note purpose: Print/Display.", 0, 1, type);
11048          case 3556653: /*text*/  return new Property("text", "string", "The note text.", 0, 1, text);
11049          case -1613589672: /*language*/  return new Property("language", "CodeableConcept", "The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. \"en\" for English, or \"en-US\" for American English versus \"en-EN\" for England English.", 0, 1, language);
11050          default: return super.getNamedProperty(_hash, _name, _checkValid);
11051          }
11052
11053        }
11054
11055      @Override
11056      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11057        switch (hash) {
11058        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // PositiveIntType
11059        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<NoteType>
11060        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
11061        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeableConcept
11062        default: return super.getProperty(hash, name, checkValid);
11063        }
11064
11065      }
11066
11067      @Override
11068      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11069        switch (hash) {
11070        case -1034364087: // number
11071          this.number = castToPositiveInt(value); // PositiveIntType
11072          return value;
11073        case 3575610: // type
11074          value = new NoteTypeEnumFactory().fromType(castToCode(value));
11075          this.type = (Enumeration) value; // Enumeration<NoteType>
11076          return value;
11077        case 3556653: // text
11078          this.text = castToString(value); // StringType
11079          return value;
11080        case -1613589672: // language
11081          this.language = castToCodeableConcept(value); // CodeableConcept
11082          return value;
11083        default: return super.setProperty(hash, name, value);
11084        }
11085
11086      }
11087
11088      @Override
11089      public Base setProperty(String name, Base value) throws FHIRException {
11090        if (name.equals("number")) {
11091          this.number = castToPositiveInt(value); // PositiveIntType
11092        } else if (name.equals("type")) {
11093          value = new NoteTypeEnumFactory().fromType(castToCode(value));
11094          this.type = (Enumeration) value; // Enumeration<NoteType>
11095        } else if (name.equals("text")) {
11096          this.text = castToString(value); // StringType
11097        } else if (name.equals("language")) {
11098          this.language = castToCodeableConcept(value); // CodeableConcept
11099        } else
11100          return super.setProperty(name, value);
11101        return value;
11102      }
11103
11104      @Override
11105      public Base makeProperty(int hash, String name) throws FHIRException {
11106        switch (hash) {
11107        case -1034364087:  return getNumberElement();
11108        case 3575610:  return getTypeElement();
11109        case 3556653:  return getTextElement();
11110        case -1613589672:  return getLanguage(); 
11111        default: return super.makeProperty(hash, name);
11112        }
11113
11114      }
11115
11116      @Override
11117      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11118        switch (hash) {
11119        case -1034364087: /*number*/ return new String[] {"positiveInt"};
11120        case 3575610: /*type*/ return new String[] {"code"};
11121        case 3556653: /*text*/ return new String[] {"string"};
11122        case -1613589672: /*language*/ return new String[] {"CodeableConcept"};
11123        default: return super.getTypesForProperty(hash, name);
11124        }
11125
11126      }
11127
11128      @Override
11129      public Base addChild(String name) throws FHIRException {
11130        if (name.equals("number")) {
11131          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.number");
11132        }
11133        else if (name.equals("type")) {
11134          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.type");
11135        }
11136        else if (name.equals("text")) {
11137          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.text");
11138        }
11139        else if (name.equals("language")) {
11140          this.language = new CodeableConcept();
11141          return this.language;
11142        }
11143        else
11144          return super.addChild(name);
11145      }
11146
11147      public NoteComponent copy() {
11148        NoteComponent dst = new NoteComponent();
11149        copyValues(dst);
11150        dst.number = number == null ? null : number.copy();
11151        dst.type = type == null ? null : type.copy();
11152        dst.text = text == null ? null : text.copy();
11153        dst.language = language == null ? null : language.copy();
11154        return dst;
11155      }
11156
11157      @Override
11158      public boolean equalsDeep(Base other_) {
11159        if (!super.equalsDeep(other_))
11160          return false;
11161        if (!(other_ instanceof NoteComponent))
11162          return false;
11163        NoteComponent o = (NoteComponent) other_;
11164        return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
11165           && compareDeep(language, o.language, true);
11166      }
11167
11168      @Override
11169      public boolean equalsShallow(Base other_) {
11170        if (!super.equalsShallow(other_))
11171          return false;
11172        if (!(other_ instanceof NoteComponent))
11173          return false;
11174        NoteComponent o = (NoteComponent) other_;
11175        return compareValues(number, o.number, true) && compareValues(type, o.type, true) && compareValues(text, o.text, true)
11176          ;
11177      }
11178
11179      public boolean isEmpty() {
11180        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language
11181          );
11182      }
11183
11184  public String fhirType() {
11185    return "ExplanationOfBenefit.processNote";
11186
11187  }
11188
11189  }
11190
11191    @Block()
11192    public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
11193        /**
11194         * Dental, Vision, Medical, Pharmacy, Rehab etc.
11195         */
11196        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
11197        @Description(shortDefinition="Type of services covered", formalDefinition="Dental, Vision, Medical, Pharmacy, Rehab etc." )
11198        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
11199        protected CodeableConcept category;
11200
11201        /**
11202         * True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.
11203         */
11204        @Child(name = "excluded", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
11205        @Description(shortDefinition="Excluded from the plan", formalDefinition="True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage." )
11206        protected BooleanType excluded;
11207
11208        /**
11209         * A short name or tag for the benefit, for example MED01, or DENT2.
11210         */
11211        @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
11212        @Description(shortDefinition="Short name for the benefit", formalDefinition="A short name or tag for the benefit, for example MED01, or DENT2." )
11213        protected StringType name;
11214
11215        /**
11216         * A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.
11217         */
11218        @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
11219        @Description(shortDefinition="Description of the benefit or services covered", formalDefinition="A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'." )
11220        protected StringType description;
11221
11222        /**
11223         * Network designation.
11224         */
11225        @Child(name = "network", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
11226        @Description(shortDefinition="In or out of network", formalDefinition="Network designation." )
11227        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-network")
11228        protected CodeableConcept network;
11229
11230        /**
11231         * Unit designation: individual or family.
11232         */
11233        @Child(name = "unit", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
11234        @Description(shortDefinition="Individual or family", formalDefinition="Unit designation: individual or family." )
11235        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-unit")
11236        protected CodeableConcept unit;
11237
11238        /**
11239         * The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.
11240         */
11241        @Child(name = "term", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
11242        @Description(shortDefinition="Annual or lifetime", formalDefinition="The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'." )
11243        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-term")
11244        protected CodeableConcept term;
11245
11246        /**
11247         * Benefits Used to date.
11248         */
11249        @Child(name = "financial", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
11250        @Description(shortDefinition="Benefit Summary", formalDefinition="Benefits Used to date." )
11251        protected List<BenefitComponent> financial;
11252
11253        private static final long serialVersionUID = -1889655824L;
11254
11255    /**
11256     * Constructor
11257     */
11258      public BenefitBalanceComponent() {
11259        super();
11260      }
11261
11262    /**
11263     * Constructor
11264     */
11265      public BenefitBalanceComponent(CodeableConcept category) {
11266        super();
11267        this.category = category;
11268      }
11269
11270        /**
11271         * @return {@link #category} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
11272         */
11273        public CodeableConcept getCategory() { 
11274          if (this.category == null)
11275            if (Configuration.errorOnAutoCreate())
11276              throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
11277            else if (Configuration.doAutoCreate())
11278              this.category = new CodeableConcept(); // cc
11279          return this.category;
11280        }
11281
11282        public boolean hasCategory() { 
11283          return this.category != null && !this.category.isEmpty();
11284        }
11285
11286        /**
11287         * @param value {@link #category} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
11288         */
11289        public BenefitBalanceComponent setCategory(CodeableConcept value) { 
11290          this.category = value;
11291          return this;
11292        }
11293
11294        /**
11295         * @return {@link #excluded} (True if the indicated class of service is excluded from the plan, missing or False indicated the 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
11296         */
11297        public BooleanType getExcludedElement() { 
11298          if (this.excluded == null)
11299            if (Configuration.errorOnAutoCreate())
11300              throw new Error("Attempt to auto-create BenefitBalanceComponent.excluded");
11301            else if (Configuration.doAutoCreate())
11302              this.excluded = new BooleanType(); // bb
11303          return this.excluded;
11304        }
11305
11306        public boolean hasExcludedElement() { 
11307          return this.excluded != null && !this.excluded.isEmpty();
11308        }
11309
11310        public boolean hasExcluded() { 
11311          return this.excluded != null && !this.excluded.isEmpty();
11312        }
11313
11314        /**
11315         * @param value {@link #excluded} (True if the indicated class of service is excluded from the plan, missing or False indicated the 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
11316         */
11317        public BenefitBalanceComponent setExcludedElement(BooleanType value) { 
11318          this.excluded = value;
11319          return this;
11320        }
11321
11322        /**
11323         * @return True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.
11324         */
11325        public boolean getExcluded() { 
11326          return this.excluded == null || this.excluded.isEmpty() ? false : this.excluded.getValue();
11327        }
11328
11329        /**
11330         * @param value True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.
11331         */
11332        public BenefitBalanceComponent setExcluded(boolean value) { 
11333            if (this.excluded == null)
11334              this.excluded = new BooleanType();
11335            this.excluded.setValue(value);
11336          return this;
11337        }
11338
11339        /**
11340         * @return {@link #name} (A short name or tag for the benefit, for example MED01, or DENT2.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
11341         */
11342        public StringType getNameElement() { 
11343          if (this.name == null)
11344            if (Configuration.errorOnAutoCreate())
11345              throw new Error("Attempt to auto-create BenefitBalanceComponent.name");
11346            else if (Configuration.doAutoCreate())
11347              this.name = new StringType(); // bb
11348          return this.name;
11349        }
11350
11351        public boolean hasNameElement() { 
11352          return this.name != null && !this.name.isEmpty();
11353        }
11354
11355        public boolean hasName() { 
11356          return this.name != null && !this.name.isEmpty();
11357        }
11358
11359        /**
11360         * @param value {@link #name} (A short name or tag for the benefit, for example MED01, or DENT2.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
11361         */
11362        public BenefitBalanceComponent setNameElement(StringType value) { 
11363          this.name = value;
11364          return this;
11365        }
11366
11367        /**
11368         * @return A short name or tag for the benefit, for example MED01, or DENT2.
11369         */
11370        public String getName() { 
11371          return this.name == null ? null : this.name.getValue();
11372        }
11373
11374        /**
11375         * @param value A short name or tag for the benefit, for example MED01, or DENT2.
11376         */
11377        public BenefitBalanceComponent setName(String value) { 
11378          if (Utilities.noString(value))
11379            this.name = null;
11380          else {
11381            if (this.name == null)
11382              this.name = new StringType();
11383            this.name.setValue(value);
11384          }
11385          return this;
11386        }
11387
11388        /**
11389         * @return {@link #description} (A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
11390         */
11391        public StringType getDescriptionElement() { 
11392          if (this.description == null)
11393            if (Configuration.errorOnAutoCreate())
11394              throw new Error("Attempt to auto-create BenefitBalanceComponent.description");
11395            else if (Configuration.doAutoCreate())
11396              this.description = new StringType(); // bb
11397          return this.description;
11398        }
11399
11400        public boolean hasDescriptionElement() { 
11401          return this.description != null && !this.description.isEmpty();
11402        }
11403
11404        public boolean hasDescription() { 
11405          return this.description != null && !this.description.isEmpty();
11406        }
11407
11408        /**
11409         * @param value {@link #description} (A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
11410         */
11411        public BenefitBalanceComponent setDescriptionElement(StringType value) { 
11412          this.description = value;
11413          return this;
11414        }
11415
11416        /**
11417         * @return A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.
11418         */
11419        public String getDescription() { 
11420          return this.description == null ? null : this.description.getValue();
11421        }
11422
11423        /**
11424         * @param value A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.
11425         */
11426        public BenefitBalanceComponent setDescription(String value) { 
11427          if (Utilities.noString(value))
11428            this.description = null;
11429          else {
11430            if (this.description == null)
11431              this.description = new StringType();
11432            this.description.setValue(value);
11433          }
11434          return this;
11435        }
11436
11437        /**
11438         * @return {@link #network} (Network designation.)
11439         */
11440        public CodeableConcept getNetwork() { 
11441          if (this.network == null)
11442            if (Configuration.errorOnAutoCreate())
11443              throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
11444            else if (Configuration.doAutoCreate())
11445              this.network = new CodeableConcept(); // cc
11446          return this.network;
11447        }
11448
11449        public boolean hasNetwork() { 
11450          return this.network != null && !this.network.isEmpty();
11451        }
11452
11453        /**
11454         * @param value {@link #network} (Network designation.)
11455         */
11456        public BenefitBalanceComponent setNetwork(CodeableConcept value) { 
11457          this.network = value;
11458          return this;
11459        }
11460
11461        /**
11462         * @return {@link #unit} (Unit designation: individual or family.)
11463         */
11464        public CodeableConcept getUnit() { 
11465          if (this.unit == null)
11466            if (Configuration.errorOnAutoCreate())
11467              throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
11468            else if (Configuration.doAutoCreate())
11469              this.unit = new CodeableConcept(); // cc
11470          return this.unit;
11471        }
11472
11473        public boolean hasUnit() { 
11474          return this.unit != null && !this.unit.isEmpty();
11475        }
11476
11477        /**
11478         * @param value {@link #unit} (Unit designation: individual or family.)
11479         */
11480        public BenefitBalanceComponent setUnit(CodeableConcept value) { 
11481          this.unit = value;
11482          return this;
11483        }
11484
11485        /**
11486         * @return {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.)
11487         */
11488        public CodeableConcept getTerm() { 
11489          if (this.term == null)
11490            if (Configuration.errorOnAutoCreate())
11491              throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
11492            else if (Configuration.doAutoCreate())
11493              this.term = new CodeableConcept(); // cc
11494          return this.term;
11495        }
11496
11497        public boolean hasTerm() { 
11498          return this.term != null && !this.term.isEmpty();
11499        }
11500
11501        /**
11502         * @param value {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.)
11503         */
11504        public BenefitBalanceComponent setTerm(CodeableConcept value) { 
11505          this.term = value;
11506          return this;
11507        }
11508
11509        /**
11510         * @return {@link #financial} (Benefits Used to date.)
11511         */
11512        public List<BenefitComponent> getFinancial() { 
11513          if (this.financial == null)
11514            this.financial = new ArrayList<BenefitComponent>();
11515          return this.financial;
11516        }
11517
11518        /**
11519         * @return Returns a reference to <code>this</code> for easy method chaining
11520         */
11521        public BenefitBalanceComponent setFinancial(List<BenefitComponent> theFinancial) { 
11522          this.financial = theFinancial;
11523          return this;
11524        }
11525
11526        public boolean hasFinancial() { 
11527          if (this.financial == null)
11528            return false;
11529          for (BenefitComponent item : this.financial)
11530            if (!item.isEmpty())
11531              return true;
11532          return false;
11533        }
11534
11535        public BenefitComponent addFinancial() { //3
11536          BenefitComponent t = new BenefitComponent();
11537          if (this.financial == null)
11538            this.financial = new ArrayList<BenefitComponent>();
11539          this.financial.add(t);
11540          return t;
11541        }
11542
11543        public BenefitBalanceComponent addFinancial(BenefitComponent t) { //3
11544          if (t == null)
11545            return this;
11546          if (this.financial == null)
11547            this.financial = new ArrayList<BenefitComponent>();
11548          this.financial.add(t);
11549          return this;
11550        }
11551
11552        /**
11553         * @return The first repetition of repeating field {@link #financial}, creating it if it does not already exist
11554         */
11555        public BenefitComponent getFinancialFirstRep() { 
11556          if (getFinancial().isEmpty()) {
11557            addFinancial();
11558          }
11559          return getFinancial().get(0);
11560        }
11561
11562        protected void listChildren(List<Property> children) {
11563          super.listChildren(children);
11564          children.add(new Property("category", "CodeableConcept", "Dental, Vision, Medical, Pharmacy, Rehab etc.", 0, 1, category));
11565          children.add(new Property("excluded", "boolean", "True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.", 0, 1, excluded));
11566          children.add(new Property("name", "string", "A short name or tag for the benefit, for example MED01, or DENT2.", 0, 1, name));
11567          children.add(new Property("description", "string", "A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.", 0, 1, description));
11568          children.add(new Property("network", "CodeableConcept", "Network designation.", 0, 1, network));
11569          children.add(new Property("unit", "CodeableConcept", "Unit designation: individual or family.", 0, 1, unit));
11570          children.add(new Property("term", "CodeableConcept", "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.", 0, 1, term));
11571          children.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
11572        }
11573
11574        @Override
11575        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11576          switch (_hash) {
11577          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Dental, Vision, Medical, Pharmacy, Rehab etc.", 0, 1, category);
11578          case 1994055114: /*excluded*/  return new Property("excluded", "boolean", "True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.", 0, 1, excluded);
11579          case 3373707: /*name*/  return new Property("name", "string", "A short name or tag for the benefit, for example MED01, or DENT2.", 0, 1, name);
11580          case -1724546052: /*description*/  return new Property("description", "string", "A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.", 0, 1, description);
11581          case 1843485230: /*network*/  return new Property("network", "CodeableConcept", "Network designation.", 0, 1, network);
11582          case 3594628: /*unit*/  return new Property("unit", "CodeableConcept", "Unit designation: individual or family.", 0, 1, unit);
11583          case 3556460: /*term*/  return new Property("term", "CodeableConcept", "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.", 0, 1, term);
11584          case 357555337: /*financial*/  return new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial);
11585          default: return super.getNamedProperty(_hash, _name, _checkValid);
11586          }
11587
11588        }
11589
11590      @Override
11591      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11592        switch (hash) {
11593        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
11594        case 1994055114: /*excluded*/ return this.excluded == null ? new Base[0] : new Base[] {this.excluded}; // BooleanType
11595        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
11596        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
11597        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // CodeableConcept
11598        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // CodeableConcept
11599        case 3556460: /*term*/ return this.term == null ? new Base[0] : new Base[] {this.term}; // CodeableConcept
11600        case 357555337: /*financial*/ return this.financial == null ? new Base[0] : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
11601        default: return super.getProperty(hash, name, checkValid);
11602        }
11603
11604      }
11605
11606      @Override
11607      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11608        switch (hash) {
11609        case 50511102: // category
11610          this.category = castToCodeableConcept(value); // CodeableConcept
11611          return value;
11612        case 1994055114: // excluded
11613          this.excluded = castToBoolean(value); // BooleanType
11614          return value;
11615        case 3373707: // name
11616          this.name = castToString(value); // StringType
11617          return value;
11618        case -1724546052: // description
11619          this.description = castToString(value); // StringType
11620          return value;
11621        case 1843485230: // network
11622          this.network = castToCodeableConcept(value); // CodeableConcept
11623          return value;
11624        case 3594628: // unit
11625          this.unit = castToCodeableConcept(value); // CodeableConcept
11626          return value;
11627        case 3556460: // term
11628          this.term = castToCodeableConcept(value); // CodeableConcept
11629          return value;
11630        case 357555337: // financial
11631          this.getFinancial().add((BenefitComponent) value); // BenefitComponent
11632          return value;
11633        default: return super.setProperty(hash, name, value);
11634        }
11635
11636      }
11637
11638      @Override
11639      public Base setProperty(String name, Base value) throws FHIRException {
11640        if (name.equals("category")) {
11641          this.category = castToCodeableConcept(value); // CodeableConcept
11642        } else if (name.equals("excluded")) {
11643          this.excluded = castToBoolean(value); // BooleanType
11644        } else if (name.equals("name")) {
11645          this.name = castToString(value); // StringType
11646        } else if (name.equals("description")) {
11647          this.description = castToString(value); // StringType
11648        } else if (name.equals("network")) {
11649          this.network = castToCodeableConcept(value); // CodeableConcept
11650        } else if (name.equals("unit")) {
11651          this.unit = castToCodeableConcept(value); // CodeableConcept
11652        } else if (name.equals("term")) {
11653          this.term = castToCodeableConcept(value); // CodeableConcept
11654        } else if (name.equals("financial")) {
11655          this.getFinancial().add((BenefitComponent) value);
11656        } else
11657          return super.setProperty(name, value);
11658        return value;
11659      }
11660
11661      @Override
11662      public Base makeProperty(int hash, String name) throws FHIRException {
11663        switch (hash) {
11664        case 50511102:  return getCategory(); 
11665        case 1994055114:  return getExcludedElement();
11666        case 3373707:  return getNameElement();
11667        case -1724546052:  return getDescriptionElement();
11668        case 1843485230:  return getNetwork(); 
11669        case 3594628:  return getUnit(); 
11670        case 3556460:  return getTerm(); 
11671        case 357555337:  return addFinancial(); 
11672        default: return super.makeProperty(hash, name);
11673        }
11674
11675      }
11676
11677      @Override
11678      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11679        switch (hash) {
11680        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
11681        case 1994055114: /*excluded*/ return new String[] {"boolean"};
11682        case 3373707: /*name*/ return new String[] {"string"};
11683        case -1724546052: /*description*/ return new String[] {"string"};
11684        case 1843485230: /*network*/ return new String[] {"CodeableConcept"};
11685        case 3594628: /*unit*/ return new String[] {"CodeableConcept"};
11686        case 3556460: /*term*/ return new String[] {"CodeableConcept"};
11687        case 357555337: /*financial*/ return new String[] {};
11688        default: return super.getTypesForProperty(hash, name);
11689        }
11690
11691      }
11692
11693      @Override
11694      public Base addChild(String name) throws FHIRException {
11695        if (name.equals("category")) {
11696          this.category = new CodeableConcept();
11697          return this.category;
11698        }
11699        else if (name.equals("excluded")) {
11700          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.excluded");
11701        }
11702        else if (name.equals("name")) {
11703          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.name");
11704        }
11705        else if (name.equals("description")) {
11706          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.description");
11707        }
11708        else if (name.equals("network")) {
11709          this.network = new CodeableConcept();
11710          return this.network;
11711        }
11712        else if (name.equals("unit")) {
11713          this.unit = new CodeableConcept();
11714          return this.unit;
11715        }
11716        else if (name.equals("term")) {
11717          this.term = new CodeableConcept();
11718          return this.term;
11719        }
11720        else if (name.equals("financial")) {
11721          return addFinancial();
11722        }
11723        else
11724          return super.addChild(name);
11725      }
11726
11727      public BenefitBalanceComponent copy() {
11728        BenefitBalanceComponent dst = new BenefitBalanceComponent();
11729        copyValues(dst);
11730        dst.category = category == null ? null : category.copy();
11731        dst.excluded = excluded == null ? null : excluded.copy();
11732        dst.name = name == null ? null : name.copy();
11733        dst.description = description == null ? null : description.copy();
11734        dst.network = network == null ? null : network.copy();
11735        dst.unit = unit == null ? null : unit.copy();
11736        dst.term = term == null ? null : term.copy();
11737        if (financial != null) {
11738          dst.financial = new ArrayList<BenefitComponent>();
11739          for (BenefitComponent i : financial)
11740            dst.financial.add(i.copy());
11741        };
11742        return dst;
11743      }
11744
11745      @Override
11746      public boolean equalsDeep(Base other_) {
11747        if (!super.equalsDeep(other_))
11748          return false;
11749        if (!(other_ instanceof BenefitBalanceComponent))
11750          return false;
11751        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
11752        return compareDeep(category, o.category, true) && compareDeep(excluded, o.excluded, true) && compareDeep(name, o.name, true)
11753           && compareDeep(description, o.description, true) && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true)
11754           && compareDeep(term, o.term, true) && compareDeep(financial, o.financial, true);
11755      }
11756
11757      @Override
11758      public boolean equalsShallow(Base other_) {
11759        if (!super.equalsShallow(other_))
11760          return false;
11761        if (!(other_ instanceof BenefitBalanceComponent))
11762          return false;
11763        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
11764        return compareValues(excluded, o.excluded, true) && compareValues(name, o.name, true) && compareValues(description, o.description, true)
11765          ;
11766      }
11767
11768      public boolean isEmpty() {
11769        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, excluded, name
11770          , description, network, unit, term, financial);
11771      }
11772
11773  public String fhirType() {
11774    return "ExplanationOfBenefit.benefitBalance";
11775
11776  }
11777
11778  }
11779
11780    @Block()
11781    public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
11782        /**
11783         * Deductable, visits, benefit amount.
11784         */
11785        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
11786        @Description(shortDefinition="Deductable, visits, benefit amount", formalDefinition="Deductable, visits, benefit amount." )
11787        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-type")
11788        protected CodeableConcept type;
11789
11790        /**
11791         * Benefits allowed.
11792         */
11793        @Child(name = "allowed", type = {UnsignedIntType.class, StringType.class, Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
11794        @Description(shortDefinition="Benefits allowed", formalDefinition="Benefits allowed." )
11795        protected Type allowed;
11796
11797        /**
11798         * Benefits used.
11799         */
11800        @Child(name = "used", type = {UnsignedIntType.class, Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
11801        @Description(shortDefinition="Benefits used", formalDefinition="Benefits used." )
11802        protected Type used;
11803
11804        private static final long serialVersionUID = -1506285314L;
11805
11806    /**
11807     * Constructor
11808     */
11809      public BenefitComponent() {
11810        super();
11811      }
11812
11813    /**
11814     * Constructor
11815     */
11816      public BenefitComponent(CodeableConcept type) {
11817        super();
11818        this.type = type;
11819      }
11820
11821        /**
11822         * @return {@link #type} (Deductable, visits, benefit amount.)
11823         */
11824        public CodeableConcept getType() { 
11825          if (this.type == null)
11826            if (Configuration.errorOnAutoCreate())
11827              throw new Error("Attempt to auto-create BenefitComponent.type");
11828            else if (Configuration.doAutoCreate())
11829              this.type = new CodeableConcept(); // cc
11830          return this.type;
11831        }
11832
11833        public boolean hasType() { 
11834          return this.type != null && !this.type.isEmpty();
11835        }
11836
11837        /**
11838         * @param value {@link #type} (Deductable, visits, benefit amount.)
11839         */
11840        public BenefitComponent setType(CodeableConcept value) { 
11841          this.type = value;
11842          return this;
11843        }
11844
11845        /**
11846         * @return {@link #allowed} (Benefits allowed.)
11847         */
11848        public Type getAllowed() { 
11849          return this.allowed;
11850        }
11851
11852        /**
11853         * @return {@link #allowed} (Benefits allowed.)
11854         */
11855        public UnsignedIntType getAllowedUnsignedIntType() throws FHIRException { 
11856          if (this.allowed == null)
11857            return null;
11858          if (!(this.allowed instanceof UnsignedIntType))
11859            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.allowed.getClass().getName()+" was encountered");
11860          return (UnsignedIntType) this.allowed;
11861        }
11862
11863        public boolean hasAllowedUnsignedIntType() { 
11864          return this != null && this.allowed instanceof UnsignedIntType;
11865        }
11866
11867        /**
11868         * @return {@link #allowed} (Benefits allowed.)
11869         */
11870        public StringType getAllowedStringType() throws FHIRException { 
11871          if (this.allowed == null)
11872            return null;
11873          if (!(this.allowed instanceof StringType))
11874            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.allowed.getClass().getName()+" was encountered");
11875          return (StringType) this.allowed;
11876        }
11877
11878        public boolean hasAllowedStringType() { 
11879          return this != null && this.allowed instanceof StringType;
11880        }
11881
11882        /**
11883         * @return {@link #allowed} (Benefits allowed.)
11884         */
11885        public Money getAllowedMoney() throws FHIRException { 
11886          if (this.allowed == null)
11887            return null;
11888          if (!(this.allowed instanceof Money))
11889            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.allowed.getClass().getName()+" was encountered");
11890          return (Money) this.allowed;
11891        }
11892
11893        public boolean hasAllowedMoney() { 
11894          return this != null && this.allowed instanceof Money;
11895        }
11896
11897        public boolean hasAllowed() { 
11898          return this.allowed != null && !this.allowed.isEmpty();
11899        }
11900
11901        /**
11902         * @param value {@link #allowed} (Benefits allowed.)
11903         */
11904        public BenefitComponent setAllowed(Type value) { 
11905          if (value != null && !(value instanceof UnsignedIntType || value instanceof StringType || value instanceof Money))
11906            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.allowed[x]: "+value.fhirType());
11907          this.allowed = value;
11908          return this;
11909        }
11910
11911        /**
11912         * @return {@link #used} (Benefits used.)
11913         */
11914        public Type getUsed() { 
11915          return this.used;
11916        }
11917
11918        /**
11919         * @return {@link #used} (Benefits used.)
11920         */
11921        public UnsignedIntType getUsedUnsignedIntType() throws FHIRException { 
11922          if (this.used == null)
11923            return null;
11924          if (!(this.used instanceof UnsignedIntType))
11925            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.used.getClass().getName()+" was encountered");
11926          return (UnsignedIntType) this.used;
11927        }
11928
11929        public boolean hasUsedUnsignedIntType() { 
11930          return this != null && this.used instanceof UnsignedIntType;
11931        }
11932
11933        /**
11934         * @return {@link #used} (Benefits used.)
11935         */
11936        public Money getUsedMoney() throws FHIRException { 
11937          if (this.used == null)
11938            return null;
11939          if (!(this.used instanceof Money))
11940            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.used.getClass().getName()+" was encountered");
11941          return (Money) this.used;
11942        }
11943
11944        public boolean hasUsedMoney() { 
11945          return this != null && this.used instanceof Money;
11946        }
11947
11948        public boolean hasUsed() { 
11949          return this.used != null && !this.used.isEmpty();
11950        }
11951
11952        /**
11953         * @param value {@link #used} (Benefits used.)
11954         */
11955        public BenefitComponent setUsed(Type value) { 
11956          if (value != null && !(value instanceof UnsignedIntType || value instanceof Money))
11957            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.used[x]: "+value.fhirType());
11958          this.used = value;
11959          return this;
11960        }
11961
11962        protected void listChildren(List<Property> children) {
11963          super.listChildren(children);
11964          children.add(new Property("type", "CodeableConcept", "Deductable, visits, benefit amount.", 0, 1, type));
11965          children.add(new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed));
11966          children.add(new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used));
11967        }
11968
11969        @Override
11970        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11971          switch (_hash) {
11972          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Deductable, visits, benefit amount.", 0, 1, type);
11973          case -1336663592: /*allowed[x]*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
11974          case -911343192: /*allowed*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
11975          case 1668802034: /*allowedUnsignedInt*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
11976          case -2135265319: /*allowedString*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
11977          case -351668232: /*allowedMoney*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
11978          case -147553373: /*used[x]*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
11979          case 3599293: /*used*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
11980          case 1252740285: /*usedUnsignedInt*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
11981          case -78048509: /*usedMoney*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
11982          default: return super.getNamedProperty(_hash, _name, _checkValid);
11983          }
11984
11985        }
11986
11987      @Override
11988      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11989        switch (hash) {
11990        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
11991        case -911343192: /*allowed*/ return this.allowed == null ? new Base[0] : new Base[] {this.allowed}; // Type
11992        case 3599293: /*used*/ return this.used == null ? new Base[0] : new Base[] {this.used}; // Type
11993        default: return super.getProperty(hash, name, checkValid);
11994        }
11995
11996      }
11997
11998      @Override
11999      public Base setProperty(int hash, String name, Base value) throws FHIRException {
12000        switch (hash) {
12001        case 3575610: // type
12002          this.type = castToCodeableConcept(value); // CodeableConcept
12003          return value;
12004        case -911343192: // allowed
12005          this.allowed = castToType(value); // Type
12006          return value;
12007        case 3599293: // used
12008          this.used = castToType(value); // Type
12009          return value;
12010        default: return super.setProperty(hash, name, value);
12011        }
12012
12013      }
12014
12015      @Override
12016      public Base setProperty(String name, Base value) throws FHIRException {
12017        if (name.equals("type")) {
12018          this.type = castToCodeableConcept(value); // CodeableConcept
12019        } else if (name.equals("allowed[x]")) {
12020          this.allowed = castToType(value); // Type
12021        } else if (name.equals("used[x]")) {
12022          this.used = castToType(value); // Type
12023        } else
12024          return super.setProperty(name, value);
12025        return value;
12026      }
12027
12028      @Override
12029      public Base makeProperty(int hash, String name) throws FHIRException {
12030        switch (hash) {
12031        case 3575610:  return getType(); 
12032        case -1336663592:  return getAllowed(); 
12033        case -911343192:  return getAllowed(); 
12034        case -147553373:  return getUsed(); 
12035        case 3599293:  return getUsed(); 
12036        default: return super.makeProperty(hash, name);
12037        }
12038
12039      }
12040
12041      @Override
12042      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12043        switch (hash) {
12044        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
12045        case -911343192: /*allowed*/ return new String[] {"unsignedInt", "string", "Money"};
12046        case 3599293: /*used*/ return new String[] {"unsignedInt", "Money"};
12047        default: return super.getTypesForProperty(hash, name);
12048        }
12049
12050      }
12051
12052      @Override
12053      public Base addChild(String name) throws FHIRException {
12054        if (name.equals("type")) {
12055          this.type = new CodeableConcept();
12056          return this.type;
12057        }
12058        else if (name.equals("allowedUnsignedInt")) {
12059          this.allowed = new UnsignedIntType();
12060          return this.allowed;
12061        }
12062        else if (name.equals("allowedString")) {
12063          this.allowed = new StringType();
12064          return this.allowed;
12065        }
12066        else if (name.equals("allowedMoney")) {
12067          this.allowed = new Money();
12068          return this.allowed;
12069        }
12070        else if (name.equals("usedUnsignedInt")) {
12071          this.used = new UnsignedIntType();
12072          return this.used;
12073        }
12074        else if (name.equals("usedMoney")) {
12075          this.used = new Money();
12076          return this.used;
12077        }
12078        else
12079          return super.addChild(name);
12080      }
12081
12082      public BenefitComponent copy() {
12083        BenefitComponent dst = new BenefitComponent();
12084        copyValues(dst);
12085        dst.type = type == null ? null : type.copy();
12086        dst.allowed = allowed == null ? null : allowed.copy();
12087        dst.used = used == null ? null : used.copy();
12088        return dst;
12089      }
12090
12091      @Override
12092      public boolean equalsDeep(Base other_) {
12093        if (!super.equalsDeep(other_))
12094          return false;
12095        if (!(other_ instanceof BenefitComponent))
12096          return false;
12097        BenefitComponent o = (BenefitComponent) other_;
12098        return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true) && compareDeep(used, o.used, true)
12099          ;
12100      }
12101
12102      @Override
12103      public boolean equalsShallow(Base other_) {
12104        if (!super.equalsShallow(other_))
12105          return false;
12106        if (!(other_ instanceof BenefitComponent))
12107          return false;
12108        BenefitComponent o = (BenefitComponent) other_;
12109        return true;
12110      }
12111
12112      public boolean isEmpty() {
12113        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed, used);
12114      }
12115
12116  public String fhirType() {
12117    return "ExplanationOfBenefit.benefitBalance.financial";
12118
12119  }
12120
12121  }
12122
12123    /**
12124     * The EOB Business Identifier.
12125     */
12126    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12127    @Description(shortDefinition="Business Identifier", formalDefinition="The EOB Business Identifier." )
12128    protected List<Identifier> identifier;
12129
12130    /**
12131     * The status of the resource instance.
12132     */
12133    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
12134    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
12135    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/explanationofbenefit-status")
12136    protected Enumeration<ExplanationOfBenefitStatus> status;
12137
12138    /**
12139     * The category of claim, e.g, oral, pharmacy, vision, institutional, professional.
12140     */
12141    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
12142    @Description(shortDefinition="Type or discipline", formalDefinition="The category of claim, e.g, oral, pharmacy, vision, institutional, professional." )
12143    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-type")
12144    protected CodeableConcept type;
12145
12146    /**
12147     * A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the CMS Bill Type.
12148     */
12149    @Child(name = "subType", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
12150    @Description(shortDefinition="Finer grained claim type information", formalDefinition="A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the CMS Bill Type." )
12151    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-subtype")
12152    protected CodeableConcept subType;
12153
12154    /**
12155     * A claim, a list of completed goods and services; a preauthorization, a list or proposed goods and services; or a predetermination, a set of goods and services being considered, for which insurer adjudication is sought.
12156     */
12157    @Child(name = "use", type = {CodeType.class}, order=4, min=0, max=1, modifier=false, summary=true)
12158    @Description(shortDefinition="claim | preauthorization | predetermination", formalDefinition="A claim, a list of completed goods and services; a preauthorization, a list or proposed goods and services; or a predetermination, a set of goods and services being considered, for which insurer adjudication is sought." )
12159    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-use")
12160    protected Enumeration<Use> use;
12161
12162    /**
12163     * Patient Resource.
12164     */
12165    @Child(name = "patient", type = {Patient.class}, order=5, min=0, max=1, modifier=false, summary=false)
12166    @Description(shortDefinition="The subject of the Products and Services", formalDefinition="Patient Resource." )
12167    protected Reference patient;
12168
12169    /**
12170     * The actual object that is the target of the reference (Patient Resource.)
12171     */
12172    protected Patient patientTarget;
12173
12174    /**
12175     * The billable period for which charges are being submitted.
12176     */
12177    @Child(name = "billablePeriod", type = {Period.class}, order=6, min=0, max=1, modifier=false, summary=false)
12178    @Description(shortDefinition="Period for charge submission", formalDefinition="The billable period for which charges are being submitted." )
12179    protected Period billablePeriod;
12180
12181    /**
12182     * The date when this resource was created.
12183     */
12184    @Child(name = "created", type = {DateTimeType.class}, order=7, min=0, max=1, modifier=false, summary=false)
12185    @Description(shortDefinition="Creation date", formalDefinition="The date when this resource was created." )
12186    protected DateTimeType created;
12187
12188    /**
12189     * The person who created the explanation of benefit.
12190     */
12191    @Child(name = "enterer", type = {Practitioner.class, PractitionerRole.class}, order=8, min=0, max=1, modifier=false, summary=false)
12192    @Description(shortDefinition="Author", formalDefinition="The person who created the explanation of benefit." )
12193    protected Reference enterer;
12194
12195    /**
12196     * The actual object that is the target of the reference (The person who created the explanation of benefit.)
12197     */
12198    protected Resource entererTarget;
12199
12200    /**
12201     * The insurer which is responsible for the explanation of benefit.
12202     */
12203    @Child(name = "insurer", type = {Organization.class}, order=9, min=0, max=1, modifier=false, summary=false)
12204    @Description(shortDefinition="Insurer responsible for the EOB", formalDefinition="The insurer which is responsible for the explanation of benefit." )
12205    protected Reference insurer;
12206
12207    /**
12208     * The actual object that is the target of the reference (The insurer which is responsible for the explanation of benefit.)
12209     */
12210    protected Organization insurerTarget;
12211
12212    /**
12213     * The provider which is responsible for the claim.
12214     */
12215    @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=10, min=0, max=1, modifier=false, summary=false)
12216    @Description(shortDefinition="Responsible provider for the claim", formalDefinition="The provider which is responsible for the claim." )
12217    protected Reference provider;
12218
12219    /**
12220     * The actual object that is the target of the reference (The provider which is responsible for the claim.)
12221     */
12222    protected Resource providerTarget;
12223
12224    /**
12225     * The referral resource which lists the date, practitioner, reason and other supporting information.
12226     */
12227    @Child(name = "referral", type = {ServiceRequest.class}, order=11, min=0, max=1, modifier=false, summary=false)
12228    @Description(shortDefinition="Treatment Referral", formalDefinition="The referral resource which lists the date, practitioner, reason and other supporting information." )
12229    protected Reference referral;
12230
12231    /**
12232     * The actual object that is the target of the reference (The referral resource which lists the date, practitioner, reason and other supporting information.)
12233     */
12234    protected ServiceRequest referralTarget;
12235
12236    /**
12237     * Facility where the services were provided.
12238     */
12239    @Child(name = "facility", type = {Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
12240    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
12241    protected Reference facility;
12242
12243    /**
12244     * The actual object that is the target of the reference (Facility where the services were provided.)
12245     */
12246    protected Location facilityTarget;
12247
12248    /**
12249     * The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.
12250     */
12251    @Child(name = "claim", type = {Claim.class}, order=13, min=0, max=1, modifier=false, summary=false)
12252    @Description(shortDefinition="Claim reference", formalDefinition="The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number." )
12253    protected Reference claim;
12254
12255    /**
12256     * The actual object that is the target of the reference (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
12257     */
12258    protected Claim claimTarget;
12259
12260    /**
12261     * The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.
12262     */
12263    @Child(name = "claimResponse", type = {ClaimResponse.class}, order=14, min=0, max=1, modifier=false, summary=false)
12264    @Description(shortDefinition="Claim response reference", formalDefinition="The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number." )
12265    protected Reference claimResponse;
12266
12267    /**
12268     * The actual object that is the target of the reference (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
12269     */
12270    protected ClaimResponse claimResponseTarget;
12271
12272    /**
12273     * Processing outcome errror, partial or complete processing.
12274     */
12275    @Child(name = "outcome", type = {CodeType.class}, order=15, min=0, max=1, modifier=false, summary=false)
12276    @Description(shortDefinition="queued | complete | error | partial", formalDefinition="Processing outcome errror, partial or complete processing." )
12277    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/remittance-outcome")
12278    protected Enumeration<RemittanceOutcome> outcome;
12279
12280    /**
12281     * A description of the status of the adjudication.
12282     */
12283    @Child(name = "disposition", type = {StringType.class}, order=16, min=0, max=1, modifier=false, summary=false)
12284    @Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication." )
12285    protected StringType disposition;
12286
12287    /**
12288     * Other claims which are related to this claim such as prior claim versions or for related services.
12289     */
12290    @Child(name = "related", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12291    @Description(shortDefinition="Related Claims which may be revelant to processing this claim", formalDefinition="Other claims which are related to this claim such as prior claim versions or for related services." )
12292    protected List<RelatedClaimComponent> related;
12293
12294    /**
12295     * Prescription to support the dispensing of Pharmacy or Vision products.
12296     */
12297    @Child(name = "prescription", type = {MedicationRequest.class, VisionPrescription.class}, order=18, min=0, max=1, modifier=false, summary=false)
12298    @Description(shortDefinition="Prescription authorizing services or products", formalDefinition="Prescription to support the dispensing of Pharmacy or Vision products." )
12299    protected Reference prescription;
12300
12301    /**
12302     * The actual object that is the target of the reference (Prescription to support the dispensing of Pharmacy or Vision products.)
12303     */
12304    protected Resource prescriptionTarget;
12305
12306    /**
12307     * Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.
12308     */
12309    @Child(name = "originalPrescription", type = {MedicationRequest.class}, order=19, min=0, max=1, modifier=false, summary=false)
12310    @Description(shortDefinition="Original prescription if superceded by fulfiller", formalDefinition="Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'." )
12311    protected Reference originalPrescription;
12312
12313    /**
12314     * The actual object that is the target of the reference (Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.)
12315     */
12316    protected MedicationRequest originalPrescriptionTarget;
12317
12318    /**
12319     * The party to be reimbursed for the services.
12320     */
12321    @Child(name = "payee", type = {}, order=20, min=0, max=1, modifier=false, summary=false)
12322    @Description(shortDefinition="Party to be paid any benefits payable", formalDefinition="The party to be reimbursed for the services." )
12323    protected PayeeComponent payee;
12324
12325    /**
12326     * Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required.
12327     */
12328    @Child(name = "information", type = {}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12329    @Description(shortDefinition="Exceptions, special considerations, the condition, situation, prior or concurrent issues", formalDefinition="Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required." )
12330    protected List<SupportingInformationComponent> information;
12331
12332    /**
12333     * The members of the team who provided the overall service as well as their role and whether responsible and qualifications.
12334     */
12335    @Child(name = "careTeam", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12336    @Description(shortDefinition="Care Team members", formalDefinition="The members of the team who provided the overall service as well as their role and whether responsible and qualifications." )
12337    protected List<CareTeamComponent> careTeam;
12338
12339    /**
12340     * Ordered list of patient diagnosis for which care is sought.
12341     */
12342    @Child(name = "diagnosis", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12343    @Description(shortDefinition="List of Diagnosis", formalDefinition="Ordered list of patient diagnosis for which care is sought." )
12344    protected List<DiagnosisComponent> diagnosis;
12345
12346    /**
12347     * Ordered list of patient procedures performed to support the adjudication.
12348     */
12349    @Child(name = "procedure", type = {}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12350    @Description(shortDefinition="Procedures performed", formalDefinition="Ordered list of patient procedures performed to support the adjudication." )
12351    protected List<ProcedureComponent> procedure;
12352
12353    /**
12354     * Precedence (primary, secondary, etc.).
12355     */
12356    @Child(name = "precedence", type = {PositiveIntType.class}, order=25, min=0, max=1, modifier=false, summary=false)
12357    @Description(shortDefinition="Precedence (primary, secondary, etc.)", formalDefinition="Precedence (primary, secondary, etc.)." )
12358    protected PositiveIntType precedence;
12359
12360    /**
12361     * Financial instrument by which payment information for health care.
12362     */
12363    @Child(name = "insurance", type = {}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12364    @Description(shortDefinition="Insurance or medical plan", formalDefinition="Financial instrument by which payment information for health care." )
12365    protected List<InsuranceComponent> insurance;
12366
12367    /**
12368     * An accident which resulted in the need for healthcare services.
12369     */
12370    @Child(name = "accident", type = {}, order=27, min=0, max=1, modifier=false, summary=false)
12371    @Description(shortDefinition="Details of an accident", formalDefinition="An accident which resulted in the need for healthcare services." )
12372    protected AccidentComponent accident;
12373
12374    /**
12375     * First-tier of goods and services.
12376     */
12377    @Child(name = "item", type = {}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12378    @Description(shortDefinition="Goods and Services", formalDefinition="First-tier of goods and services." )
12379    protected List<ItemComponent> item;
12380
12381    /**
12382     * The first-tier service adjudications for payor added services.
12383     */
12384    @Child(name = "addItem", type = {}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12385    @Description(shortDefinition="Insurer added line items", formalDefinition="The first-tier service adjudications for payor added services." )
12386    protected List<AddedItemComponent> addItem;
12387
12388    /**
12389     * Totals for amounts submitted, co-pays, benefits payable etc.
12390     */
12391    @Child(name = "total", type = {}, order=30, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12392    @Description(shortDefinition="Adjudication totals", formalDefinition="Totals for amounts submitted, co-pays, benefits payable etc." )
12393    protected List<TotalComponent> total;
12394
12395    /**
12396     * Payment details for the claim if the claim has been paid.
12397     */
12398    @Child(name = "payment", type = {}, order=31, min=0, max=1, modifier=false, summary=false)
12399    @Description(shortDefinition="Payment Details", formalDefinition="Payment details for the claim if the claim has been paid." )
12400    protected PaymentComponent payment;
12401
12402    /**
12403     * The form to be used for printing the content.
12404     */
12405    @Child(name = "form", type = {CodeableConcept.class}, order=32, min=0, max=1, modifier=false, summary=false)
12406    @Description(shortDefinition="Printed Form Identifier", formalDefinition="The form to be used for printing the content." )
12407    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/forms")
12408    protected CodeableConcept form;
12409
12410    /**
12411     * Note text.
12412     */
12413    @Child(name = "processNote", type = {}, order=33, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12414    @Description(shortDefinition="Processing notes", formalDefinition="Note text." )
12415    protected List<NoteComponent> processNote;
12416
12417    /**
12418     * Balance by Benefit Category.
12419     */
12420    @Child(name = "benefitBalance", type = {}, order=34, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12421    @Description(shortDefinition="Balance by Benefit Category", formalDefinition="Balance by Benefit Category." )
12422    protected List<BenefitBalanceComponent> benefitBalance;
12423
12424    private static final long serialVersionUID = 459572084L;
12425
12426  /**
12427   * Constructor
12428   */
12429    public ExplanationOfBenefit() {
12430      super();
12431    }
12432
12433    /**
12434     * @return {@link #identifier} (The EOB Business Identifier.)
12435     */
12436    public List<Identifier> getIdentifier() { 
12437      if (this.identifier == null)
12438        this.identifier = new ArrayList<Identifier>();
12439      return this.identifier;
12440    }
12441
12442    /**
12443     * @return Returns a reference to <code>this</code> for easy method chaining
12444     */
12445    public ExplanationOfBenefit setIdentifier(List<Identifier> theIdentifier) { 
12446      this.identifier = theIdentifier;
12447      return this;
12448    }
12449
12450    public boolean hasIdentifier() { 
12451      if (this.identifier == null)
12452        return false;
12453      for (Identifier item : this.identifier)
12454        if (!item.isEmpty())
12455          return true;
12456      return false;
12457    }
12458
12459    public Identifier addIdentifier() { //3
12460      Identifier t = new Identifier();
12461      if (this.identifier == null)
12462        this.identifier = new ArrayList<Identifier>();
12463      this.identifier.add(t);
12464      return t;
12465    }
12466
12467    public ExplanationOfBenefit addIdentifier(Identifier t) { //3
12468      if (t == null)
12469        return this;
12470      if (this.identifier == null)
12471        this.identifier = new ArrayList<Identifier>();
12472      this.identifier.add(t);
12473      return this;
12474    }
12475
12476    /**
12477     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
12478     */
12479    public Identifier getIdentifierFirstRep() { 
12480      if (getIdentifier().isEmpty()) {
12481        addIdentifier();
12482      }
12483      return getIdentifier().get(0);
12484    }
12485
12486    /**
12487     * @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
12488     */
12489    public Enumeration<ExplanationOfBenefitStatus> getStatusElement() { 
12490      if (this.status == null)
12491        if (Configuration.errorOnAutoCreate())
12492          throw new Error("Attempt to auto-create ExplanationOfBenefit.status");
12493        else if (Configuration.doAutoCreate())
12494          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory()); // bb
12495      return this.status;
12496    }
12497
12498    public boolean hasStatusElement() { 
12499      return this.status != null && !this.status.isEmpty();
12500    }
12501
12502    public boolean hasStatus() { 
12503      return this.status != null && !this.status.isEmpty();
12504    }
12505
12506    /**
12507     * @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
12508     */
12509    public ExplanationOfBenefit setStatusElement(Enumeration<ExplanationOfBenefitStatus> value) { 
12510      this.status = value;
12511      return this;
12512    }
12513
12514    /**
12515     * @return The status of the resource instance.
12516     */
12517    public ExplanationOfBenefitStatus getStatus() { 
12518      return this.status == null ? null : this.status.getValue();
12519    }
12520
12521    /**
12522     * @param value The status of the resource instance.
12523     */
12524    public ExplanationOfBenefit setStatus(ExplanationOfBenefitStatus value) { 
12525      if (value == null)
12526        this.status = null;
12527      else {
12528        if (this.status == null)
12529          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory());
12530        this.status.setValue(value);
12531      }
12532      return this;
12533    }
12534
12535    /**
12536     * @return {@link #type} (The category of claim, e.g, oral, pharmacy, vision, institutional, professional.)
12537     */
12538    public CodeableConcept getType() { 
12539      if (this.type == null)
12540        if (Configuration.errorOnAutoCreate())
12541          throw new Error("Attempt to auto-create ExplanationOfBenefit.type");
12542        else if (Configuration.doAutoCreate())
12543          this.type = new CodeableConcept(); // cc
12544      return this.type;
12545    }
12546
12547    public boolean hasType() { 
12548      return this.type != null && !this.type.isEmpty();
12549    }
12550
12551    /**
12552     * @param value {@link #type} (The category of claim, e.g, oral, pharmacy, vision, institutional, professional.)
12553     */
12554    public ExplanationOfBenefit setType(CodeableConcept value) { 
12555      this.type = value;
12556      return this;
12557    }
12558
12559    /**
12560     * @return {@link #subType} (A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the CMS Bill Type.)
12561     */
12562    public CodeableConcept getSubType() { 
12563      if (this.subType == null)
12564        if (Configuration.errorOnAutoCreate())
12565          throw new Error("Attempt to auto-create ExplanationOfBenefit.subType");
12566        else if (Configuration.doAutoCreate())
12567          this.subType = new CodeableConcept(); // cc
12568      return this.subType;
12569    }
12570
12571    public boolean hasSubType() { 
12572      return this.subType != null && !this.subType.isEmpty();
12573    }
12574
12575    /**
12576     * @param value {@link #subType} (A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the CMS Bill Type.)
12577     */
12578    public ExplanationOfBenefit setSubType(CodeableConcept value) { 
12579      this.subType = value;
12580      return this;
12581    }
12582
12583    /**
12584     * @return {@link #use} (A claim, a list of completed goods and services; a preauthorization, a list or proposed goods and services; or a predetermination, a set of goods and services being considered, for which insurer adjudication is sought.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
12585     */
12586    public Enumeration<Use> getUseElement() { 
12587      if (this.use == null)
12588        if (Configuration.errorOnAutoCreate())
12589          throw new Error("Attempt to auto-create ExplanationOfBenefit.use");
12590        else if (Configuration.doAutoCreate())
12591          this.use = new Enumeration<Use>(new UseEnumFactory()); // bb
12592      return this.use;
12593    }
12594
12595    public boolean hasUseElement() { 
12596      return this.use != null && !this.use.isEmpty();
12597    }
12598
12599    public boolean hasUse() { 
12600      return this.use != null && !this.use.isEmpty();
12601    }
12602
12603    /**
12604     * @param value {@link #use} (A claim, a list of completed goods and services; a preauthorization, a list or proposed goods and services; or a predetermination, a set of goods and services being considered, for which insurer adjudication is sought.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
12605     */
12606    public ExplanationOfBenefit setUseElement(Enumeration<Use> value) { 
12607      this.use = value;
12608      return this;
12609    }
12610
12611    /**
12612     * @return A claim, a list of completed goods and services; a preauthorization, a list or proposed goods and services; or a predetermination, a set of goods and services being considered, for which insurer adjudication is sought.
12613     */
12614    public Use getUse() { 
12615      return this.use == null ? null : this.use.getValue();
12616    }
12617
12618    /**
12619     * @param value A claim, a list of completed goods and services; a preauthorization, a list or proposed goods and services; or a predetermination, a set of goods and services being considered, for which insurer adjudication is sought.
12620     */
12621    public ExplanationOfBenefit setUse(Use value) { 
12622      if (value == null)
12623        this.use = null;
12624      else {
12625        if (this.use == null)
12626          this.use = new Enumeration<Use>(new UseEnumFactory());
12627        this.use.setValue(value);
12628      }
12629      return this;
12630    }
12631
12632    /**
12633     * @return {@link #patient} (Patient Resource.)
12634     */
12635    public Reference getPatient() { 
12636      if (this.patient == null)
12637        if (Configuration.errorOnAutoCreate())
12638          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
12639        else if (Configuration.doAutoCreate())
12640          this.patient = new Reference(); // cc
12641      return this.patient;
12642    }
12643
12644    public boolean hasPatient() { 
12645      return this.patient != null && !this.patient.isEmpty();
12646    }
12647
12648    /**
12649     * @param value {@link #patient} (Patient Resource.)
12650     */
12651    public ExplanationOfBenefit setPatient(Reference value) { 
12652      this.patient = value;
12653      return this;
12654    }
12655
12656    /**
12657     * @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. (Patient Resource.)
12658     */
12659    public Patient getPatientTarget() { 
12660      if (this.patientTarget == null)
12661        if (Configuration.errorOnAutoCreate())
12662          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
12663        else if (Configuration.doAutoCreate())
12664          this.patientTarget = new Patient(); // aa
12665      return this.patientTarget;
12666    }
12667
12668    /**
12669     * @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. (Patient Resource.)
12670     */
12671    public ExplanationOfBenefit setPatientTarget(Patient value) { 
12672      this.patientTarget = value;
12673      return this;
12674    }
12675
12676    /**
12677     * @return {@link #billablePeriod} (The billable period for which charges are being submitted.)
12678     */
12679    public Period getBillablePeriod() { 
12680      if (this.billablePeriod == null)
12681        if (Configuration.errorOnAutoCreate())
12682          throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
12683        else if (Configuration.doAutoCreate())
12684          this.billablePeriod = new Period(); // cc
12685      return this.billablePeriod;
12686    }
12687
12688    public boolean hasBillablePeriod() { 
12689      return this.billablePeriod != null && !this.billablePeriod.isEmpty();
12690    }
12691
12692    /**
12693     * @param value {@link #billablePeriod} (The billable period for which charges are being submitted.)
12694     */
12695    public ExplanationOfBenefit setBillablePeriod(Period value) { 
12696      this.billablePeriod = value;
12697      return this;
12698    }
12699
12700    /**
12701     * @return {@link #created} (The date when this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
12702     */
12703    public DateTimeType getCreatedElement() { 
12704      if (this.created == null)
12705        if (Configuration.errorOnAutoCreate())
12706          throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
12707        else if (Configuration.doAutoCreate())
12708          this.created = new DateTimeType(); // bb
12709      return this.created;
12710    }
12711
12712    public boolean hasCreatedElement() { 
12713      return this.created != null && !this.created.isEmpty();
12714    }
12715
12716    public boolean hasCreated() { 
12717      return this.created != null && !this.created.isEmpty();
12718    }
12719
12720    /**
12721     * @param value {@link #created} (The date when this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
12722     */
12723    public ExplanationOfBenefit setCreatedElement(DateTimeType value) { 
12724      this.created = value;
12725      return this;
12726    }
12727
12728    /**
12729     * @return The date when this resource was created.
12730     */
12731    public Date getCreated() { 
12732      return this.created == null ? null : this.created.getValue();
12733    }
12734
12735    /**
12736     * @param value The date when this resource was created.
12737     */
12738    public ExplanationOfBenefit setCreated(Date value) { 
12739      if (value == null)
12740        this.created = null;
12741      else {
12742        if (this.created == null)
12743          this.created = new DateTimeType();
12744        this.created.setValue(value);
12745      }
12746      return this;
12747    }
12748
12749    /**
12750     * @return {@link #enterer} (The person who created the explanation of benefit.)
12751     */
12752    public Reference getEnterer() { 
12753      if (this.enterer == null)
12754        if (Configuration.errorOnAutoCreate())
12755          throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
12756        else if (Configuration.doAutoCreate())
12757          this.enterer = new Reference(); // cc
12758      return this.enterer;
12759    }
12760
12761    public boolean hasEnterer() { 
12762      return this.enterer != null && !this.enterer.isEmpty();
12763    }
12764
12765    /**
12766     * @param value {@link #enterer} (The person who created the explanation of benefit.)
12767     */
12768    public ExplanationOfBenefit setEnterer(Reference value) { 
12769      this.enterer = value;
12770      return this;
12771    }
12772
12773    /**
12774     * @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. (The person who created the explanation of benefit.)
12775     */
12776    public Resource getEntererTarget() { 
12777      return this.entererTarget;
12778    }
12779
12780    /**
12781     * @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. (The person who created the explanation of benefit.)
12782     */
12783    public ExplanationOfBenefit setEntererTarget(Resource value) { 
12784      this.entererTarget = value;
12785      return this;
12786    }
12787
12788    /**
12789     * @return {@link #insurer} (The insurer which is responsible for the explanation of benefit.)
12790     */
12791    public Reference getInsurer() { 
12792      if (this.insurer == null)
12793        if (Configuration.errorOnAutoCreate())
12794          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
12795        else if (Configuration.doAutoCreate())
12796          this.insurer = new Reference(); // cc
12797      return this.insurer;
12798    }
12799
12800    public boolean hasInsurer() { 
12801      return this.insurer != null && !this.insurer.isEmpty();
12802    }
12803
12804    /**
12805     * @param value {@link #insurer} (The insurer which is responsible for the explanation of benefit.)
12806     */
12807    public ExplanationOfBenefit setInsurer(Reference value) { 
12808      this.insurer = value;
12809      return this;
12810    }
12811
12812    /**
12813     * @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 insurer which is responsible for the explanation of benefit.)
12814     */
12815    public Organization getInsurerTarget() { 
12816      if (this.insurerTarget == null)
12817        if (Configuration.errorOnAutoCreate())
12818          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
12819        else if (Configuration.doAutoCreate())
12820          this.insurerTarget = new Organization(); // aa
12821      return this.insurerTarget;
12822    }
12823
12824    /**
12825     * @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 insurer which is responsible for the explanation of benefit.)
12826     */
12827    public ExplanationOfBenefit setInsurerTarget(Organization value) { 
12828      this.insurerTarget = value;
12829      return this;
12830    }
12831
12832    /**
12833     * @return {@link #provider} (The provider which is responsible for the claim.)
12834     */
12835    public Reference getProvider() { 
12836      if (this.provider == null)
12837        if (Configuration.errorOnAutoCreate())
12838          throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
12839        else if (Configuration.doAutoCreate())
12840          this.provider = new Reference(); // cc
12841      return this.provider;
12842    }
12843
12844    public boolean hasProvider() { 
12845      return this.provider != null && !this.provider.isEmpty();
12846    }
12847
12848    /**
12849     * @param value {@link #provider} (The provider which is responsible for the claim.)
12850     */
12851    public ExplanationOfBenefit setProvider(Reference value) { 
12852      this.provider = value;
12853      return this;
12854    }
12855
12856    /**
12857     * @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.)
12858     */
12859    public Resource getProviderTarget() { 
12860      return this.providerTarget;
12861    }
12862
12863    /**
12864     * @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.)
12865     */
12866    public ExplanationOfBenefit setProviderTarget(Resource value) { 
12867      this.providerTarget = value;
12868      return this;
12869    }
12870
12871    /**
12872     * @return {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
12873     */
12874    public Reference getReferral() { 
12875      if (this.referral == null)
12876        if (Configuration.errorOnAutoCreate())
12877          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
12878        else if (Configuration.doAutoCreate())
12879          this.referral = new Reference(); // cc
12880      return this.referral;
12881    }
12882
12883    public boolean hasReferral() { 
12884      return this.referral != null && !this.referral.isEmpty();
12885    }
12886
12887    /**
12888     * @param value {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
12889     */
12890    public ExplanationOfBenefit setReferral(Reference value) { 
12891      this.referral = value;
12892      return this;
12893    }
12894
12895    /**
12896     * @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. (The referral resource which lists the date, practitioner, reason and other supporting information.)
12897     */
12898    public ServiceRequest getReferralTarget() { 
12899      if (this.referralTarget == null)
12900        if (Configuration.errorOnAutoCreate())
12901          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
12902        else if (Configuration.doAutoCreate())
12903          this.referralTarget = new ServiceRequest(); // aa
12904      return this.referralTarget;
12905    }
12906
12907    /**
12908     * @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. (The referral resource which lists the date, practitioner, reason and other supporting information.)
12909     */
12910    public ExplanationOfBenefit setReferralTarget(ServiceRequest value) { 
12911      this.referralTarget = value;
12912      return this;
12913    }
12914
12915    /**
12916     * @return {@link #facility} (Facility where the services were provided.)
12917     */
12918    public Reference getFacility() { 
12919      if (this.facility == null)
12920        if (Configuration.errorOnAutoCreate())
12921          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
12922        else if (Configuration.doAutoCreate())
12923          this.facility = new Reference(); // cc
12924      return this.facility;
12925    }
12926
12927    public boolean hasFacility() { 
12928      return this.facility != null && !this.facility.isEmpty();
12929    }
12930
12931    /**
12932     * @param value {@link #facility} (Facility where the services were provided.)
12933     */
12934    public ExplanationOfBenefit setFacility(Reference value) { 
12935      this.facility = value;
12936      return this;
12937    }
12938
12939    /**
12940     * @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.)
12941     */
12942    public Location getFacilityTarget() { 
12943      if (this.facilityTarget == null)
12944        if (Configuration.errorOnAutoCreate())
12945          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
12946        else if (Configuration.doAutoCreate())
12947          this.facilityTarget = new Location(); // aa
12948      return this.facilityTarget;
12949    }
12950
12951    /**
12952     * @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.)
12953     */
12954    public ExplanationOfBenefit setFacilityTarget(Location value) { 
12955      this.facilityTarget = value;
12956      return this;
12957    }
12958
12959    /**
12960     * @return {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
12961     */
12962    public Reference getClaim() { 
12963      if (this.claim == null)
12964        if (Configuration.errorOnAutoCreate())
12965          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
12966        else if (Configuration.doAutoCreate())
12967          this.claim = new Reference(); // cc
12968      return this.claim;
12969    }
12970
12971    public boolean hasClaim() { 
12972      return this.claim != null && !this.claim.isEmpty();
12973    }
12974
12975    /**
12976     * @param value {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
12977     */
12978    public ExplanationOfBenefit setClaim(Reference value) { 
12979      this.claim = value;
12980      return this;
12981    }
12982
12983    /**
12984     * @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: invoice number, claim number, pre-determination or pre-authorization number.)
12985     */
12986    public Claim getClaimTarget() { 
12987      if (this.claimTarget == null)
12988        if (Configuration.errorOnAutoCreate())
12989          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
12990        else if (Configuration.doAutoCreate())
12991          this.claimTarget = new Claim(); // aa
12992      return this.claimTarget;
12993    }
12994
12995    /**
12996     * @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: invoice number, claim number, pre-determination or pre-authorization number.)
12997     */
12998    public ExplanationOfBenefit setClaimTarget(Claim value) { 
12999      this.claimTarget = value;
13000      return this;
13001    }
13002
13003    /**
13004     * @return {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
13005     */
13006    public Reference getClaimResponse() { 
13007      if (this.claimResponse == null)
13008        if (Configuration.errorOnAutoCreate())
13009          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
13010        else if (Configuration.doAutoCreate())
13011          this.claimResponse = new Reference(); // cc
13012      return this.claimResponse;
13013    }
13014
13015    public boolean hasClaimResponse() { 
13016      return this.claimResponse != null && !this.claimResponse.isEmpty();
13017    }
13018
13019    /**
13020     * @param value {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
13021     */
13022    public ExplanationOfBenefit setClaimResponse(Reference value) { 
13023      this.claimResponse = value;
13024      return this;
13025    }
13026
13027    /**
13028     * @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: invoice number, claim number, pre-determination or pre-authorization number.)
13029     */
13030    public ClaimResponse getClaimResponseTarget() { 
13031      if (this.claimResponseTarget == null)
13032        if (Configuration.errorOnAutoCreate())
13033          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
13034        else if (Configuration.doAutoCreate())
13035          this.claimResponseTarget = new ClaimResponse(); // aa
13036      return this.claimResponseTarget;
13037    }
13038
13039    /**
13040     * @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: invoice number, claim number, pre-determination or pre-authorization number.)
13041     */
13042    public ExplanationOfBenefit setClaimResponseTarget(ClaimResponse value) { 
13043      this.claimResponseTarget = value;
13044      return this;
13045    }
13046
13047    /**
13048     * @return {@link #outcome} (Processing outcome errror, partial or complete processing.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
13049     */
13050    public Enumeration<RemittanceOutcome> getOutcomeElement() { 
13051      if (this.outcome == null)
13052        if (Configuration.errorOnAutoCreate())
13053          throw new Error("Attempt to auto-create ExplanationOfBenefit.outcome");
13054        else if (Configuration.doAutoCreate())
13055          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory()); // bb
13056      return this.outcome;
13057    }
13058
13059    public boolean hasOutcomeElement() { 
13060      return this.outcome != null && !this.outcome.isEmpty();
13061    }
13062
13063    public boolean hasOutcome() { 
13064      return this.outcome != null && !this.outcome.isEmpty();
13065    }
13066
13067    /**
13068     * @param value {@link #outcome} (Processing outcome errror, partial or complete processing.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
13069     */
13070    public ExplanationOfBenefit setOutcomeElement(Enumeration<RemittanceOutcome> value) { 
13071      this.outcome = value;
13072      return this;
13073    }
13074
13075    /**
13076     * @return Processing outcome errror, partial or complete processing.
13077     */
13078    public RemittanceOutcome getOutcome() { 
13079      return this.outcome == null ? null : this.outcome.getValue();
13080    }
13081
13082    /**
13083     * @param value Processing outcome errror, partial or complete processing.
13084     */
13085    public ExplanationOfBenefit setOutcome(RemittanceOutcome value) { 
13086      if (value == null)
13087        this.outcome = null;
13088      else {
13089        if (this.outcome == null)
13090          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory());
13091        this.outcome.setValue(value);
13092      }
13093      return this;
13094    }
13095
13096    /**
13097     * @return {@link #disposition} (A 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
13098     */
13099    public StringType getDispositionElement() { 
13100      if (this.disposition == null)
13101        if (Configuration.errorOnAutoCreate())
13102          throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
13103        else if (Configuration.doAutoCreate())
13104          this.disposition = new StringType(); // bb
13105      return this.disposition;
13106    }
13107
13108    public boolean hasDispositionElement() { 
13109      return this.disposition != null && !this.disposition.isEmpty();
13110    }
13111
13112    public boolean hasDisposition() { 
13113      return this.disposition != null && !this.disposition.isEmpty();
13114    }
13115
13116    /**
13117     * @param value {@link #disposition} (A 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
13118     */
13119    public ExplanationOfBenefit setDispositionElement(StringType value) { 
13120      this.disposition = value;
13121      return this;
13122    }
13123
13124    /**
13125     * @return A description of the status of the adjudication.
13126     */
13127    public String getDisposition() { 
13128      return this.disposition == null ? null : this.disposition.getValue();
13129    }
13130
13131    /**
13132     * @param value A description of the status of the adjudication.
13133     */
13134    public ExplanationOfBenefit setDisposition(String value) { 
13135      if (Utilities.noString(value))
13136        this.disposition = null;
13137      else {
13138        if (this.disposition == null)
13139          this.disposition = new StringType();
13140        this.disposition.setValue(value);
13141      }
13142      return this;
13143    }
13144
13145    /**
13146     * @return {@link #related} (Other claims which are related to this claim such as prior claim versions or for related services.)
13147     */
13148    public List<RelatedClaimComponent> getRelated() { 
13149      if (this.related == null)
13150        this.related = new ArrayList<RelatedClaimComponent>();
13151      return this.related;
13152    }
13153
13154    /**
13155     * @return Returns a reference to <code>this</code> for easy method chaining
13156     */
13157    public ExplanationOfBenefit setRelated(List<RelatedClaimComponent> theRelated) { 
13158      this.related = theRelated;
13159      return this;
13160    }
13161
13162    public boolean hasRelated() { 
13163      if (this.related == null)
13164        return false;
13165      for (RelatedClaimComponent item : this.related)
13166        if (!item.isEmpty())
13167          return true;
13168      return false;
13169    }
13170
13171    public RelatedClaimComponent addRelated() { //3
13172      RelatedClaimComponent t = new RelatedClaimComponent();
13173      if (this.related == null)
13174        this.related = new ArrayList<RelatedClaimComponent>();
13175      this.related.add(t);
13176      return t;
13177    }
13178
13179    public ExplanationOfBenefit addRelated(RelatedClaimComponent t) { //3
13180      if (t == null)
13181        return this;
13182      if (this.related == null)
13183        this.related = new ArrayList<RelatedClaimComponent>();
13184      this.related.add(t);
13185      return this;
13186    }
13187
13188    /**
13189     * @return The first repetition of repeating field {@link #related}, creating it if it does not already exist
13190     */
13191    public RelatedClaimComponent getRelatedFirstRep() { 
13192      if (getRelated().isEmpty()) {
13193        addRelated();
13194      }
13195      return getRelated().get(0);
13196    }
13197
13198    /**
13199     * @return {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
13200     */
13201    public Reference getPrescription() { 
13202      if (this.prescription == null)
13203        if (Configuration.errorOnAutoCreate())
13204          throw new Error("Attempt to auto-create ExplanationOfBenefit.prescription");
13205        else if (Configuration.doAutoCreate())
13206          this.prescription = new Reference(); // cc
13207      return this.prescription;
13208    }
13209
13210    public boolean hasPrescription() { 
13211      return this.prescription != null && !this.prescription.isEmpty();
13212    }
13213
13214    /**
13215     * @param value {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
13216     */
13217    public ExplanationOfBenefit setPrescription(Reference value) { 
13218      this.prescription = value;
13219      return this;
13220    }
13221
13222    /**
13223     * @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 or Vision products.)
13224     */
13225    public Resource getPrescriptionTarget() { 
13226      return this.prescriptionTarget;
13227    }
13228
13229    /**
13230     * @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 or Vision products.)
13231     */
13232    public ExplanationOfBenefit setPrescriptionTarget(Resource value) { 
13233      this.prescriptionTarget = value;
13234      return this;
13235    }
13236
13237    /**
13238     * @return {@link #originalPrescription} (Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.)
13239     */
13240    public Reference getOriginalPrescription() { 
13241      if (this.originalPrescription == null)
13242        if (Configuration.errorOnAutoCreate())
13243          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
13244        else if (Configuration.doAutoCreate())
13245          this.originalPrescription = new Reference(); // cc
13246      return this.originalPrescription;
13247    }
13248
13249    public boolean hasOriginalPrescription() { 
13250      return this.originalPrescription != null && !this.originalPrescription.isEmpty();
13251    }
13252
13253    /**
13254     * @param value {@link #originalPrescription} (Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.)
13255     */
13256    public ExplanationOfBenefit setOriginalPrescription(Reference value) { 
13257      this.originalPrescription = value;
13258      return this;
13259    }
13260
13261    /**
13262     * @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 superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.)
13263     */
13264    public MedicationRequest getOriginalPrescriptionTarget() { 
13265      if (this.originalPrescriptionTarget == null)
13266        if (Configuration.errorOnAutoCreate())
13267          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
13268        else if (Configuration.doAutoCreate())
13269          this.originalPrescriptionTarget = new MedicationRequest(); // aa
13270      return this.originalPrescriptionTarget;
13271    }
13272
13273    /**
13274     * @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 superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.)
13275     */
13276    public ExplanationOfBenefit setOriginalPrescriptionTarget(MedicationRequest value) { 
13277      this.originalPrescriptionTarget = value;
13278      return this;
13279    }
13280
13281    /**
13282     * @return {@link #payee} (The party to be reimbursed for the services.)
13283     */
13284    public PayeeComponent getPayee() { 
13285      if (this.payee == null)
13286        if (Configuration.errorOnAutoCreate())
13287          throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
13288        else if (Configuration.doAutoCreate())
13289          this.payee = new PayeeComponent(); // cc
13290      return this.payee;
13291    }
13292
13293    public boolean hasPayee() { 
13294      return this.payee != null && !this.payee.isEmpty();
13295    }
13296
13297    /**
13298     * @param value {@link #payee} (The party to be reimbursed for the services.)
13299     */
13300    public ExplanationOfBenefit setPayee(PayeeComponent value) { 
13301      this.payee = value;
13302      return this;
13303    }
13304
13305    /**
13306     * @return {@link #information} (Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required.)
13307     */
13308    public List<SupportingInformationComponent> getInformation() { 
13309      if (this.information == null)
13310        this.information = new ArrayList<SupportingInformationComponent>();
13311      return this.information;
13312    }
13313
13314    /**
13315     * @return Returns a reference to <code>this</code> for easy method chaining
13316     */
13317    public ExplanationOfBenefit setInformation(List<SupportingInformationComponent> theInformation) { 
13318      this.information = theInformation;
13319      return this;
13320    }
13321
13322    public boolean hasInformation() { 
13323      if (this.information == null)
13324        return false;
13325      for (SupportingInformationComponent item : this.information)
13326        if (!item.isEmpty())
13327          return true;
13328      return false;
13329    }
13330
13331    public SupportingInformationComponent addInformation() { //3
13332      SupportingInformationComponent t = new SupportingInformationComponent();
13333      if (this.information == null)
13334        this.information = new ArrayList<SupportingInformationComponent>();
13335      this.information.add(t);
13336      return t;
13337    }
13338
13339    public ExplanationOfBenefit addInformation(SupportingInformationComponent t) { //3
13340      if (t == null)
13341        return this;
13342      if (this.information == null)
13343        this.information = new ArrayList<SupportingInformationComponent>();
13344      this.information.add(t);
13345      return this;
13346    }
13347
13348    /**
13349     * @return The first repetition of repeating field {@link #information}, creating it if it does not already exist
13350     */
13351    public SupportingInformationComponent getInformationFirstRep() { 
13352      if (getInformation().isEmpty()) {
13353        addInformation();
13354      }
13355      return getInformation().get(0);
13356    }
13357
13358    /**
13359     * @return {@link #careTeam} (The members of the team who provided the overall service as well as their role and whether responsible and qualifications.)
13360     */
13361    public List<CareTeamComponent> getCareTeam() { 
13362      if (this.careTeam == null)
13363        this.careTeam = new ArrayList<CareTeamComponent>();
13364      return this.careTeam;
13365    }
13366
13367    /**
13368     * @return Returns a reference to <code>this</code> for easy method chaining
13369     */
13370    public ExplanationOfBenefit setCareTeam(List<CareTeamComponent> theCareTeam) { 
13371      this.careTeam = theCareTeam;
13372      return this;
13373    }
13374
13375    public boolean hasCareTeam() { 
13376      if (this.careTeam == null)
13377        return false;
13378      for (CareTeamComponent item : this.careTeam)
13379        if (!item.isEmpty())
13380          return true;
13381      return false;
13382    }
13383
13384    public CareTeamComponent addCareTeam() { //3
13385      CareTeamComponent t = new CareTeamComponent();
13386      if (this.careTeam == null)
13387        this.careTeam = new ArrayList<CareTeamComponent>();
13388      this.careTeam.add(t);
13389      return t;
13390    }
13391
13392    public ExplanationOfBenefit addCareTeam(CareTeamComponent t) { //3
13393      if (t == null)
13394        return this;
13395      if (this.careTeam == null)
13396        this.careTeam = new ArrayList<CareTeamComponent>();
13397      this.careTeam.add(t);
13398      return this;
13399    }
13400
13401    /**
13402     * @return The first repetition of repeating field {@link #careTeam}, creating it if it does not already exist
13403     */
13404    public CareTeamComponent getCareTeamFirstRep() { 
13405      if (getCareTeam().isEmpty()) {
13406        addCareTeam();
13407      }
13408      return getCareTeam().get(0);
13409    }
13410
13411    /**
13412     * @return {@link #diagnosis} (Ordered list of patient diagnosis for which care is sought.)
13413     */
13414    public List<DiagnosisComponent> getDiagnosis() { 
13415      if (this.diagnosis == null)
13416        this.diagnosis = new ArrayList<DiagnosisComponent>();
13417      return this.diagnosis;
13418    }
13419
13420    /**
13421     * @return Returns a reference to <code>this</code> for easy method chaining
13422     */
13423    public ExplanationOfBenefit setDiagnosis(List<DiagnosisComponent> theDiagnosis) { 
13424      this.diagnosis = theDiagnosis;
13425      return this;
13426    }
13427
13428    public boolean hasDiagnosis() { 
13429      if (this.diagnosis == null)
13430        return false;
13431      for (DiagnosisComponent item : this.diagnosis)
13432        if (!item.isEmpty())
13433          return true;
13434      return false;
13435    }
13436
13437    public DiagnosisComponent addDiagnosis() { //3
13438      DiagnosisComponent t = new DiagnosisComponent();
13439      if (this.diagnosis == null)
13440        this.diagnosis = new ArrayList<DiagnosisComponent>();
13441      this.diagnosis.add(t);
13442      return t;
13443    }
13444
13445    public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { //3
13446      if (t == null)
13447        return this;
13448      if (this.diagnosis == null)
13449        this.diagnosis = new ArrayList<DiagnosisComponent>();
13450      this.diagnosis.add(t);
13451      return this;
13452    }
13453
13454    /**
13455     * @return The first repetition of repeating field {@link #diagnosis}, creating it if it does not already exist
13456     */
13457    public DiagnosisComponent getDiagnosisFirstRep() { 
13458      if (getDiagnosis().isEmpty()) {
13459        addDiagnosis();
13460      }
13461      return getDiagnosis().get(0);
13462    }
13463
13464    /**
13465     * @return {@link #procedure} (Ordered list of patient procedures performed to support the adjudication.)
13466     */
13467    public List<ProcedureComponent> getProcedure() { 
13468      if (this.procedure == null)
13469        this.procedure = new ArrayList<ProcedureComponent>();
13470      return this.procedure;
13471    }
13472
13473    /**
13474     * @return Returns a reference to <code>this</code> for easy method chaining
13475     */
13476    public ExplanationOfBenefit setProcedure(List<ProcedureComponent> theProcedure) { 
13477      this.procedure = theProcedure;
13478      return this;
13479    }
13480
13481    public boolean hasProcedure() { 
13482      if (this.procedure == null)
13483        return false;
13484      for (ProcedureComponent item : this.procedure)
13485        if (!item.isEmpty())
13486          return true;
13487      return false;
13488    }
13489
13490    public ProcedureComponent addProcedure() { //3
13491      ProcedureComponent t = new ProcedureComponent();
13492      if (this.procedure == null)
13493        this.procedure = new ArrayList<ProcedureComponent>();
13494      this.procedure.add(t);
13495      return t;
13496    }
13497
13498    public ExplanationOfBenefit addProcedure(ProcedureComponent t) { //3
13499      if (t == null)
13500        return this;
13501      if (this.procedure == null)
13502        this.procedure = new ArrayList<ProcedureComponent>();
13503      this.procedure.add(t);
13504      return this;
13505    }
13506
13507    /**
13508     * @return The first repetition of repeating field {@link #procedure}, creating it if it does not already exist
13509     */
13510    public ProcedureComponent getProcedureFirstRep() { 
13511      if (getProcedure().isEmpty()) {
13512        addProcedure();
13513      }
13514      return getProcedure().get(0);
13515    }
13516
13517    /**
13518     * @return {@link #precedence} (Precedence (primary, secondary, etc.).). This is the underlying object with id, value and extensions. The accessor "getPrecedence" gives direct access to the value
13519     */
13520    public PositiveIntType getPrecedenceElement() { 
13521      if (this.precedence == null)
13522        if (Configuration.errorOnAutoCreate())
13523          throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
13524        else if (Configuration.doAutoCreate())
13525          this.precedence = new PositiveIntType(); // bb
13526      return this.precedence;
13527    }
13528
13529    public boolean hasPrecedenceElement() { 
13530      return this.precedence != null && !this.precedence.isEmpty();
13531    }
13532
13533    public boolean hasPrecedence() { 
13534      return this.precedence != null && !this.precedence.isEmpty();
13535    }
13536
13537    /**
13538     * @param value {@link #precedence} (Precedence (primary, secondary, etc.).). This is the underlying object with id, value and extensions. The accessor "getPrecedence" gives direct access to the value
13539     */
13540    public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) { 
13541      this.precedence = value;
13542      return this;
13543    }
13544
13545    /**
13546     * @return Precedence (primary, secondary, etc.).
13547     */
13548    public int getPrecedence() { 
13549      return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
13550    }
13551
13552    /**
13553     * @param value Precedence (primary, secondary, etc.).
13554     */
13555    public ExplanationOfBenefit setPrecedence(int value) { 
13556        if (this.precedence == null)
13557          this.precedence = new PositiveIntType();
13558        this.precedence.setValue(value);
13559      return this;
13560    }
13561
13562    /**
13563     * @return {@link #insurance} (Financial instrument by which payment information for health care.)
13564     */
13565    public List<InsuranceComponent> getInsurance() { 
13566      if (this.insurance == null)
13567        this.insurance = new ArrayList<InsuranceComponent>();
13568      return this.insurance;
13569    }
13570
13571    /**
13572     * @return Returns a reference to <code>this</code> for easy method chaining
13573     */
13574    public ExplanationOfBenefit setInsurance(List<InsuranceComponent> theInsurance) { 
13575      this.insurance = theInsurance;
13576      return this;
13577    }
13578
13579    public boolean hasInsurance() { 
13580      if (this.insurance == null)
13581        return false;
13582      for (InsuranceComponent item : this.insurance)
13583        if (!item.isEmpty())
13584          return true;
13585      return false;
13586    }
13587
13588    public InsuranceComponent addInsurance() { //3
13589      InsuranceComponent t = new InsuranceComponent();
13590      if (this.insurance == null)
13591        this.insurance = new ArrayList<InsuranceComponent>();
13592      this.insurance.add(t);
13593      return t;
13594    }
13595
13596    public ExplanationOfBenefit addInsurance(InsuranceComponent t) { //3
13597      if (t == null)
13598        return this;
13599      if (this.insurance == null)
13600        this.insurance = new ArrayList<InsuranceComponent>();
13601      this.insurance.add(t);
13602      return this;
13603    }
13604
13605    /**
13606     * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist
13607     */
13608    public InsuranceComponent getInsuranceFirstRep() { 
13609      if (getInsurance().isEmpty()) {
13610        addInsurance();
13611      }
13612      return getInsurance().get(0);
13613    }
13614
13615    /**
13616     * @return {@link #accident} (An accident which resulted in the need for healthcare services.)
13617     */
13618    public AccidentComponent getAccident() { 
13619      if (this.accident == null)
13620        if (Configuration.errorOnAutoCreate())
13621          throw new Error("Attempt to auto-create ExplanationOfBenefit.accident");
13622        else if (Configuration.doAutoCreate())
13623          this.accident = new AccidentComponent(); // cc
13624      return this.accident;
13625    }
13626
13627    public boolean hasAccident() { 
13628      return this.accident != null && !this.accident.isEmpty();
13629    }
13630
13631    /**
13632     * @param value {@link #accident} (An accident which resulted in the need for healthcare services.)
13633     */
13634    public ExplanationOfBenefit setAccident(AccidentComponent value) { 
13635      this.accident = value;
13636      return this;
13637    }
13638
13639    /**
13640     * @return {@link #item} (First-tier of goods and services.)
13641     */
13642    public List<ItemComponent> getItem() { 
13643      if (this.item == null)
13644        this.item = new ArrayList<ItemComponent>();
13645      return this.item;
13646    }
13647
13648    /**
13649     * @return Returns a reference to <code>this</code> for easy method chaining
13650     */
13651    public ExplanationOfBenefit setItem(List<ItemComponent> theItem) { 
13652      this.item = theItem;
13653      return this;
13654    }
13655
13656    public boolean hasItem() { 
13657      if (this.item == null)
13658        return false;
13659      for (ItemComponent item : this.item)
13660        if (!item.isEmpty())
13661          return true;
13662      return false;
13663    }
13664
13665    public ItemComponent addItem() { //3
13666      ItemComponent t = new ItemComponent();
13667      if (this.item == null)
13668        this.item = new ArrayList<ItemComponent>();
13669      this.item.add(t);
13670      return t;
13671    }
13672
13673    public ExplanationOfBenefit addItem(ItemComponent t) { //3
13674      if (t == null)
13675        return this;
13676      if (this.item == null)
13677        this.item = new ArrayList<ItemComponent>();
13678      this.item.add(t);
13679      return this;
13680    }
13681
13682    /**
13683     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
13684     */
13685    public ItemComponent getItemFirstRep() { 
13686      if (getItem().isEmpty()) {
13687        addItem();
13688      }
13689      return getItem().get(0);
13690    }
13691
13692    /**
13693     * @return {@link #addItem} (The first-tier service adjudications for payor added services.)
13694     */
13695    public List<AddedItemComponent> getAddItem() { 
13696      if (this.addItem == null)
13697        this.addItem = new ArrayList<AddedItemComponent>();
13698      return this.addItem;
13699    }
13700
13701    /**
13702     * @return Returns a reference to <code>this</code> for easy method chaining
13703     */
13704    public ExplanationOfBenefit setAddItem(List<AddedItemComponent> theAddItem) { 
13705      this.addItem = theAddItem;
13706      return this;
13707    }
13708
13709    public boolean hasAddItem() { 
13710      if (this.addItem == null)
13711        return false;
13712      for (AddedItemComponent item : this.addItem)
13713        if (!item.isEmpty())
13714          return true;
13715      return false;
13716    }
13717
13718    public AddedItemComponent addAddItem() { //3
13719      AddedItemComponent t = new AddedItemComponent();
13720      if (this.addItem == null)
13721        this.addItem = new ArrayList<AddedItemComponent>();
13722      this.addItem.add(t);
13723      return t;
13724    }
13725
13726    public ExplanationOfBenefit addAddItem(AddedItemComponent t) { //3
13727      if (t == null)
13728        return this;
13729      if (this.addItem == null)
13730        this.addItem = new ArrayList<AddedItemComponent>();
13731      this.addItem.add(t);
13732      return this;
13733    }
13734
13735    /**
13736     * @return The first repetition of repeating field {@link #addItem}, creating it if it does not already exist
13737     */
13738    public AddedItemComponent getAddItemFirstRep() { 
13739      if (getAddItem().isEmpty()) {
13740        addAddItem();
13741      }
13742      return getAddItem().get(0);
13743    }
13744
13745    /**
13746     * @return {@link #total} (Totals for amounts submitted, co-pays, benefits payable etc.)
13747     */
13748    public List<TotalComponent> getTotal() { 
13749      if (this.total == null)
13750        this.total = new ArrayList<TotalComponent>();
13751      return this.total;
13752    }
13753
13754    /**
13755     * @return Returns a reference to <code>this</code> for easy method chaining
13756     */
13757    public ExplanationOfBenefit setTotal(List<TotalComponent> theTotal) { 
13758      this.total = theTotal;
13759      return this;
13760    }
13761
13762    public boolean hasTotal() { 
13763      if (this.total == null)
13764        return false;
13765      for (TotalComponent item : this.total)
13766        if (!item.isEmpty())
13767          return true;
13768      return false;
13769    }
13770
13771    public TotalComponent addTotal() { //3
13772      TotalComponent t = new TotalComponent();
13773      if (this.total == null)
13774        this.total = new ArrayList<TotalComponent>();
13775      this.total.add(t);
13776      return t;
13777    }
13778
13779    public ExplanationOfBenefit addTotal(TotalComponent t) { //3
13780      if (t == null)
13781        return this;
13782      if (this.total == null)
13783        this.total = new ArrayList<TotalComponent>();
13784      this.total.add(t);
13785      return this;
13786    }
13787
13788    /**
13789     * @return The first repetition of repeating field {@link #total}, creating it if it does not already exist
13790     */
13791    public TotalComponent getTotalFirstRep() { 
13792      if (getTotal().isEmpty()) {
13793        addTotal();
13794      }
13795      return getTotal().get(0);
13796    }
13797
13798    /**
13799     * @return {@link #payment} (Payment details for the claim if the claim has been paid.)
13800     */
13801    public PaymentComponent getPayment() { 
13802      if (this.payment == null)
13803        if (Configuration.errorOnAutoCreate())
13804          throw new Error("Attempt to auto-create ExplanationOfBenefit.payment");
13805        else if (Configuration.doAutoCreate())
13806          this.payment = new PaymentComponent(); // cc
13807      return this.payment;
13808    }
13809
13810    public boolean hasPayment() { 
13811      return this.payment != null && !this.payment.isEmpty();
13812    }
13813
13814    /**
13815     * @param value {@link #payment} (Payment details for the claim if the claim has been paid.)
13816     */
13817    public ExplanationOfBenefit setPayment(PaymentComponent value) { 
13818      this.payment = value;
13819      return this;
13820    }
13821
13822    /**
13823     * @return {@link #form} (The form to be used for printing the content.)
13824     */
13825    public CodeableConcept getForm() { 
13826      if (this.form == null)
13827        if (Configuration.errorOnAutoCreate())
13828          throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
13829        else if (Configuration.doAutoCreate())
13830          this.form = new CodeableConcept(); // cc
13831      return this.form;
13832    }
13833
13834    public boolean hasForm() { 
13835      return this.form != null && !this.form.isEmpty();
13836    }
13837
13838    /**
13839     * @param value {@link #form} (The form to be used for printing the content.)
13840     */
13841    public ExplanationOfBenefit setForm(CodeableConcept value) { 
13842      this.form = value;
13843      return this;
13844    }
13845
13846    /**
13847     * @return {@link #processNote} (Note text.)
13848     */
13849    public List<NoteComponent> getProcessNote() { 
13850      if (this.processNote == null)
13851        this.processNote = new ArrayList<NoteComponent>();
13852      return this.processNote;
13853    }
13854
13855    /**
13856     * @return Returns a reference to <code>this</code> for easy method chaining
13857     */
13858    public ExplanationOfBenefit setProcessNote(List<NoteComponent> theProcessNote) { 
13859      this.processNote = theProcessNote;
13860      return this;
13861    }
13862
13863    public boolean hasProcessNote() { 
13864      if (this.processNote == null)
13865        return false;
13866      for (NoteComponent item : this.processNote)
13867        if (!item.isEmpty())
13868          return true;
13869      return false;
13870    }
13871
13872    public NoteComponent addProcessNote() { //3
13873      NoteComponent t = new NoteComponent();
13874      if (this.processNote == null)
13875        this.processNote = new ArrayList<NoteComponent>();
13876      this.processNote.add(t);
13877      return t;
13878    }
13879
13880    public ExplanationOfBenefit addProcessNote(NoteComponent t) { //3
13881      if (t == null)
13882        return this;
13883      if (this.processNote == null)
13884        this.processNote = new ArrayList<NoteComponent>();
13885      this.processNote.add(t);
13886      return this;
13887    }
13888
13889    /**
13890     * @return The first repetition of repeating field {@link #processNote}, creating it if it does not already exist
13891     */
13892    public NoteComponent getProcessNoteFirstRep() { 
13893      if (getProcessNote().isEmpty()) {
13894        addProcessNote();
13895      }
13896      return getProcessNote().get(0);
13897    }
13898
13899    /**
13900     * @return {@link #benefitBalance} (Balance by Benefit Category.)
13901     */
13902    public List<BenefitBalanceComponent> getBenefitBalance() { 
13903      if (this.benefitBalance == null)
13904        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
13905      return this.benefitBalance;
13906    }
13907
13908    /**
13909     * @return Returns a reference to <code>this</code> for easy method chaining
13910     */
13911    public ExplanationOfBenefit setBenefitBalance(List<BenefitBalanceComponent> theBenefitBalance) { 
13912      this.benefitBalance = theBenefitBalance;
13913      return this;
13914    }
13915
13916    public boolean hasBenefitBalance() { 
13917      if (this.benefitBalance == null)
13918        return false;
13919      for (BenefitBalanceComponent item : this.benefitBalance)
13920        if (!item.isEmpty())
13921          return true;
13922      return false;
13923    }
13924
13925    public BenefitBalanceComponent addBenefitBalance() { //3
13926      BenefitBalanceComponent t = new BenefitBalanceComponent();
13927      if (this.benefitBalance == null)
13928        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
13929      this.benefitBalance.add(t);
13930      return t;
13931    }
13932
13933    public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { //3
13934      if (t == null)
13935        return this;
13936      if (this.benefitBalance == null)
13937        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
13938      this.benefitBalance.add(t);
13939      return this;
13940    }
13941
13942    /**
13943     * @return The first repetition of repeating field {@link #benefitBalance}, creating it if it does not already exist
13944     */
13945    public BenefitBalanceComponent getBenefitBalanceFirstRep() { 
13946      if (getBenefitBalance().isEmpty()) {
13947        addBenefitBalance();
13948      }
13949      return getBenefitBalance().get(0);
13950    }
13951
13952      protected void listChildren(List<Property> children) {
13953        super.listChildren(children);
13954        children.add(new Property("identifier", "Identifier", "The EOB Business Identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
13955        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
13956        children.add(new Property("type", "CodeableConcept", "The category of claim, e.g, oral, pharmacy, vision, institutional, professional.", 0, 1, type));
13957        children.add(new Property("subType", "CodeableConcept", "A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the CMS Bill Type.", 0, 1, subType));
13958        children.add(new Property("use", "code", "A claim, a list of completed goods and services; a preauthorization, a list or proposed goods and services; or a predetermination, a set of goods and services being considered, for which insurer adjudication is sought.", 0, 1, use));
13959        children.add(new Property("patient", "Reference(Patient)", "Patient Resource.", 0, 1, patient));
13960        children.add(new Property("billablePeriod", "Period", "The billable period for which charges are being submitted.", 0, 1, billablePeriod));
13961        children.add(new Property("created", "dateTime", "The date when this resource was created.", 0, 1, created));
13962        children.add(new Property("enterer", "Reference(Practitioner|PractitionerRole)", "The person who created the explanation of benefit.", 0, 1, enterer));
13963        children.add(new Property("insurer", "Reference(Organization)", "The insurer which is responsible for the explanation of benefit.", 0, 1, insurer));
13964        children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The provider which is responsible for the claim.", 0, 1, provider));
13965        children.add(new Property("referral", "Reference(ServiceRequest)", "The referral resource which lists the date, practitioner, reason and other supporting information.", 0, 1, referral));
13966        children.add(new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility));
13967        children.add(new Property("claim", "Reference(Claim)", "The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.", 0, 1, claim));
13968        children.add(new Property("claimResponse", "Reference(ClaimResponse)", "The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.", 0, 1, claimResponse));
13969        children.add(new Property("outcome", "code", "Processing outcome errror, partial or complete processing.", 0, 1, outcome));
13970        children.add(new Property("disposition", "string", "A description of the status of the adjudication.", 0, 1, disposition));
13971        children.add(new Property("related", "", "Other claims which are related to this claim such as prior claim versions or for related services.", 0, java.lang.Integer.MAX_VALUE, related));
13972        children.add(new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of Pharmacy or Vision products.", 0, 1, prescription));
13973        children.add(new Property("originalPrescription", "Reference(MedicationRequest)", "Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.", 0, 1, originalPrescription));
13974        children.add(new Property("payee", "", "The party to be reimbursed for the services.", 0, 1, payee));
13975        children.add(new Property("information", "", "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required.", 0, java.lang.Integer.MAX_VALUE, information));
13976        children.add(new Property("careTeam", "", "The members of the team who provided the overall service as well as their role and whether responsible and qualifications.", 0, java.lang.Integer.MAX_VALUE, careTeam));
13977        children.add(new Property("diagnosis", "", "Ordered list of patient diagnosis for which care is sought.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
13978        children.add(new Property("procedure", "", "Ordered list of patient procedures performed to support the adjudication.", 0, java.lang.Integer.MAX_VALUE, procedure));
13979        children.add(new Property("precedence", "positiveInt", "Precedence (primary, secondary, etc.).", 0, 1, precedence));
13980        children.add(new Property("insurance", "", "Financial instrument by which payment information for health care.", 0, java.lang.Integer.MAX_VALUE, insurance));
13981        children.add(new Property("accident", "", "An accident which resulted in the need for healthcare services.", 0, 1, accident));
13982        children.add(new Property("item", "", "First-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, item));
13983        children.add(new Property("addItem", "", "The first-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, addItem));
13984        children.add(new Property("total", "", "Totals for amounts submitted, co-pays, benefits payable etc.", 0, java.lang.Integer.MAX_VALUE, total));
13985        children.add(new Property("payment", "", "Payment details for the claim if the claim has been paid.", 0, 1, payment));
13986        children.add(new Property("form", "CodeableConcept", "The form to be used for printing the content.", 0, 1, form));
13987        children.add(new Property("processNote", "", "Note text.", 0, java.lang.Integer.MAX_VALUE, processNote));
13988        children.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance));
13989      }
13990
13991      @Override
13992      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
13993        switch (_hash) {
13994        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The EOB Business Identifier.", 0, java.lang.Integer.MAX_VALUE, identifier);
13995        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
13996        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The category of claim, e.g, oral, pharmacy, vision, institutional, professional.", 0, 1, type);
13997        case -1868521062: /*subType*/  return new Property("subType", "CodeableConcept", "A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the CMS Bill Type.", 0, 1, subType);
13998        case 116103: /*use*/  return new Property("use", "code", "A claim, a list of completed goods and services; a preauthorization, a list or proposed goods and services; or a predetermination, a set of goods and services being considered, for which insurer adjudication is sought.", 0, 1, use);
13999        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "Patient Resource.", 0, 1, patient);
14000        case -332066046: /*billablePeriod*/  return new Property("billablePeriod", "Period", "The billable period for which charges are being submitted.", 0, 1, billablePeriod);
14001        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date when this resource was created.", 0, 1, created);
14002        case -1591951995: /*enterer*/  return new Property("enterer", "Reference(Practitioner|PractitionerRole)", "The person who created the explanation of benefit.", 0, 1, enterer);
14003        case 1957615864: /*insurer*/  return new Property("insurer", "Reference(Organization)", "The insurer which is responsible for the explanation of benefit.", 0, 1, insurer);
14004        case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The provider which is responsible for the claim.", 0, 1, provider);
14005        case -722568291: /*referral*/  return new Property("referral", "Reference(ServiceRequest)", "The referral resource which lists the date, practitioner, reason and other supporting information.", 0, 1, referral);
14006        case 501116579: /*facility*/  return new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility);
14007        case 94742588: /*claim*/  return new Property("claim", "Reference(Claim)", "The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.", 0, 1, claim);
14008        case 689513629: /*claimResponse*/  return new Property("claimResponse", "Reference(ClaimResponse)", "The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.", 0, 1, claimResponse);
14009        case -1106507950: /*outcome*/  return new Property("outcome", "code", "Processing outcome errror, partial or complete processing.", 0, 1, outcome);
14010        case 583380919: /*disposition*/  return new Property("disposition", "string", "A description of the status of the adjudication.", 0, 1, disposition);
14011        case 1090493483: /*related*/  return new Property("related", "", "Other claims which are related to this claim such as prior claim versions or for related services.", 0, java.lang.Integer.MAX_VALUE, related);
14012        case 460301338: /*prescription*/  return new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of Pharmacy or Vision products.", 0, 1, prescription);
14013        case -1814015861: /*originalPrescription*/  return new Property("originalPrescription", "Reference(MedicationRequest)", "Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.", 0, 1, originalPrescription);
14014        case 106443592: /*payee*/  return new Property("payee", "", "The party to be reimbursed for the services.", 0, 1, payee);
14015        case 1968600364: /*information*/  return new Property("information", "", "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required.", 0, java.lang.Integer.MAX_VALUE, information);
14016        case -7323378: /*careTeam*/  return new Property("careTeam", "", "The members of the team who provided the overall service as well as their role and whether responsible and qualifications.", 0, java.lang.Integer.MAX_VALUE, careTeam);
14017        case 1196993265: /*diagnosis*/  return new Property("diagnosis", "", "Ordered list of patient diagnosis for which care is sought.", 0, java.lang.Integer.MAX_VALUE, diagnosis);
14018        case -1095204141: /*procedure*/  return new Property("procedure", "", "Ordered list of patient procedures performed to support the adjudication.", 0, java.lang.Integer.MAX_VALUE, procedure);
14019        case 159695370: /*precedence*/  return new Property("precedence", "positiveInt", "Precedence (primary, secondary, etc.).", 0, 1, precedence);
14020        case 73049818: /*insurance*/  return new Property("insurance", "", "Financial instrument by which payment information for health care.", 0, java.lang.Integer.MAX_VALUE, insurance);
14021        case -2143202801: /*accident*/  return new Property("accident", "", "An accident which resulted in the need for healthcare services.", 0, 1, accident);
14022        case 3242771: /*item*/  return new Property("item", "", "First-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, item);
14023        case -1148899500: /*addItem*/  return new Property("addItem", "", "The first-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, addItem);
14024        case 110549828: /*total*/  return new Property("total", "", "Totals for amounts submitted, co-pays, benefits payable etc.", 0, java.lang.Integer.MAX_VALUE, total);
14025        case -786681338: /*payment*/  return new Property("payment", "", "Payment details for the claim if the claim has been paid.", 0, 1, payment);
14026        case 3148996: /*form*/  return new Property("form", "CodeableConcept", "The form to be used for printing the content.", 0, 1, form);
14027        case 202339073: /*processNote*/  return new Property("processNote", "", "Note text.", 0, java.lang.Integer.MAX_VALUE, processNote);
14028        case 596003397: /*benefitBalance*/  return new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance);
14029        default: return super.getNamedProperty(_hash, _name, _checkValid);
14030        }
14031
14032      }
14033
14034      @Override
14035      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
14036        switch (hash) {
14037        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
14038        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ExplanationOfBenefitStatus>
14039        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
14040        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
14041        case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<Use>
14042        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
14043        case -332066046: /*billablePeriod*/ return this.billablePeriod == null ? new Base[0] : new Base[] {this.billablePeriod}; // Period
14044        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
14045        case -1591951995: /*enterer*/ return this.enterer == null ? new Base[0] : new Base[] {this.enterer}; // Reference
14046        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
14047        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
14048        case -722568291: /*referral*/ return this.referral == null ? new Base[0] : new Base[] {this.referral}; // Reference
14049        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Reference
14050        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
14051        case 689513629: /*claimResponse*/ return this.claimResponse == null ? new Base[0] : new Base[] {this.claimResponse}; // Reference
14052        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // Enumeration<RemittanceOutcome>
14053        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
14054        case 1090493483: /*related*/ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimComponent
14055        case 460301338: /*prescription*/ return this.prescription == null ? new Base[0] : new Base[] {this.prescription}; // Reference
14056        case -1814015861: /*originalPrescription*/ return this.originalPrescription == null ? new Base[0] : new Base[] {this.originalPrescription}; // Reference
14057        case 106443592: /*payee*/ return this.payee == null ? new Base[0] : new Base[] {this.payee}; // PayeeComponent
14058        case 1968600364: /*information*/ return this.information == null ? new Base[0] : this.information.toArray(new Base[this.information.size()]); // SupportingInformationComponent
14059        case -7323378: /*careTeam*/ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // CareTeamComponent
14060        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
14061        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
14062        case 159695370: /*precedence*/ return this.precedence == null ? new Base[0] : new Base[] {this.precedence}; // PositiveIntType
14063        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // InsuranceComponent
14064        case -2143202801: /*accident*/ return this.accident == null ? new Base[0] : new Base[] {this.accident}; // AccidentComponent
14065        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
14066        case -1148899500: /*addItem*/ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
14067        case 110549828: /*total*/ return this.total == null ? new Base[0] : this.total.toArray(new Base[this.total.size()]); // TotalComponent
14068        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // PaymentComponent
14069        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // CodeableConcept
14070        case 202339073: /*processNote*/ return this.processNote == null ? new Base[0] : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
14071        case 596003397: /*benefitBalance*/ return this.benefitBalance == null ? new Base[0] : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
14072        default: return super.getProperty(hash, name, checkValid);
14073        }
14074
14075      }
14076
14077      @Override
14078      public Base setProperty(int hash, String name, Base value) throws FHIRException {
14079        switch (hash) {
14080        case -1618432855: // identifier
14081          this.getIdentifier().add(castToIdentifier(value)); // Identifier
14082          return value;
14083        case -892481550: // status
14084          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
14085          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
14086          return value;
14087        case 3575610: // type
14088          this.type = castToCodeableConcept(value); // CodeableConcept
14089          return value;
14090        case -1868521062: // subType
14091          this.subType = castToCodeableConcept(value); // CodeableConcept
14092          return value;
14093        case 116103: // use
14094          value = new UseEnumFactory().fromType(castToCode(value));
14095          this.use = (Enumeration) value; // Enumeration<Use>
14096          return value;
14097        case -791418107: // patient
14098          this.patient = castToReference(value); // Reference
14099          return value;
14100        case -332066046: // billablePeriod
14101          this.billablePeriod = castToPeriod(value); // Period
14102          return value;
14103        case 1028554472: // created
14104          this.created = castToDateTime(value); // DateTimeType
14105          return value;
14106        case -1591951995: // enterer
14107          this.enterer = castToReference(value); // Reference
14108          return value;
14109        case 1957615864: // insurer
14110          this.insurer = castToReference(value); // Reference
14111          return value;
14112        case -987494927: // provider
14113          this.provider = castToReference(value); // Reference
14114          return value;
14115        case -722568291: // referral
14116          this.referral = castToReference(value); // Reference
14117          return value;
14118        case 501116579: // facility
14119          this.facility = castToReference(value); // Reference
14120          return value;
14121        case 94742588: // claim
14122          this.claim = castToReference(value); // Reference
14123          return value;
14124        case 689513629: // claimResponse
14125          this.claimResponse = castToReference(value); // Reference
14126          return value;
14127        case -1106507950: // outcome
14128          value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
14129          this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
14130          return value;
14131        case 583380919: // disposition
14132          this.disposition = castToString(value); // StringType
14133          return value;
14134        case 1090493483: // related
14135          this.getRelated().add((RelatedClaimComponent) value); // RelatedClaimComponent
14136          return value;
14137        case 460301338: // prescription
14138          this.prescription = castToReference(value); // Reference
14139          return value;
14140        case -1814015861: // originalPrescription
14141          this.originalPrescription = castToReference(value); // Reference
14142          return value;
14143        case 106443592: // payee
14144          this.payee = (PayeeComponent) value; // PayeeComponent
14145          return value;
14146        case 1968600364: // information
14147          this.getInformation().add((SupportingInformationComponent) value); // SupportingInformationComponent
14148          return value;
14149        case -7323378: // careTeam
14150          this.getCareTeam().add((CareTeamComponent) value); // CareTeamComponent
14151          return value;
14152        case 1196993265: // diagnosis
14153          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
14154          return value;
14155        case -1095204141: // procedure
14156          this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
14157          return value;
14158        case 159695370: // precedence
14159          this.precedence = castToPositiveInt(value); // PositiveIntType
14160          return value;
14161        case 73049818: // insurance
14162          this.getInsurance().add((InsuranceComponent) value); // InsuranceComponent
14163          return value;
14164        case -2143202801: // accident
14165          this.accident = (AccidentComponent) value; // AccidentComponent
14166          return value;
14167        case 3242771: // item
14168          this.getItem().add((ItemComponent) value); // ItemComponent
14169          return value;
14170        case -1148899500: // addItem
14171          this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
14172          return value;
14173        case 110549828: // total
14174          this.getTotal().add((TotalComponent) value); // TotalComponent
14175          return value;
14176        case -786681338: // payment
14177          this.payment = (PaymentComponent) value; // PaymentComponent
14178          return value;
14179        case 3148996: // form
14180          this.form = castToCodeableConcept(value); // CodeableConcept
14181          return value;
14182        case 202339073: // processNote
14183          this.getProcessNote().add((NoteComponent) value); // NoteComponent
14184          return value;
14185        case 596003397: // benefitBalance
14186          this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
14187          return value;
14188        default: return super.setProperty(hash, name, value);
14189        }
14190
14191      }
14192
14193      @Override
14194      public Base setProperty(String name, Base value) throws FHIRException {
14195        if (name.equals("identifier")) {
14196          this.getIdentifier().add(castToIdentifier(value));
14197        } else if (name.equals("status")) {
14198          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
14199          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
14200        } else if (name.equals("type")) {
14201          this.type = castToCodeableConcept(value); // CodeableConcept
14202        } else if (name.equals("subType")) {
14203          this.subType = castToCodeableConcept(value); // CodeableConcept
14204        } else if (name.equals("use")) {
14205          value = new UseEnumFactory().fromType(castToCode(value));
14206          this.use = (Enumeration) value; // Enumeration<Use>
14207        } else if (name.equals("patient")) {
14208          this.patient = castToReference(value); // Reference
14209        } else if (name.equals("billablePeriod")) {
14210          this.billablePeriod = castToPeriod(value); // Period
14211        } else if (name.equals("created")) {
14212          this.created = castToDateTime(value); // DateTimeType
14213        } else if (name.equals("enterer")) {
14214          this.enterer = castToReference(value); // Reference
14215        } else if (name.equals("insurer")) {
14216          this.insurer = castToReference(value); // Reference
14217        } else if (name.equals("provider")) {
14218          this.provider = castToReference(value); // Reference
14219        } else if (name.equals("referral")) {
14220          this.referral = castToReference(value); // Reference
14221        } else if (name.equals("facility")) {
14222          this.facility = castToReference(value); // Reference
14223        } else if (name.equals("claim")) {
14224          this.claim = castToReference(value); // Reference
14225        } else if (name.equals("claimResponse")) {
14226          this.claimResponse = castToReference(value); // Reference
14227        } else if (name.equals("outcome")) {
14228          value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
14229          this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
14230        } else if (name.equals("disposition")) {
14231          this.disposition = castToString(value); // StringType
14232        } else if (name.equals("related")) {
14233          this.getRelated().add((RelatedClaimComponent) value);
14234        } else if (name.equals("prescription")) {
14235          this.prescription = castToReference(value); // Reference
14236        } else if (name.equals("originalPrescription")) {
14237          this.originalPrescription = castToReference(value); // Reference
14238        } else if (name.equals("payee")) {
14239          this.payee = (PayeeComponent) value; // PayeeComponent
14240        } else if (name.equals("information")) {
14241          this.getInformation().add((SupportingInformationComponent) value);
14242        } else if (name.equals("careTeam")) {
14243          this.getCareTeam().add((CareTeamComponent) value);
14244        } else if (name.equals("diagnosis")) {
14245          this.getDiagnosis().add((DiagnosisComponent) value);
14246        } else if (name.equals("procedure")) {
14247          this.getProcedure().add((ProcedureComponent) value);
14248        } else if (name.equals("precedence")) {
14249          this.precedence = castToPositiveInt(value); // PositiveIntType
14250        } else if (name.equals("insurance")) {
14251          this.getInsurance().add((InsuranceComponent) value);
14252        } else if (name.equals("accident")) {
14253          this.accident = (AccidentComponent) value; // AccidentComponent
14254        } else if (name.equals("item")) {
14255          this.getItem().add((ItemComponent) value);
14256        } else if (name.equals("addItem")) {
14257          this.getAddItem().add((AddedItemComponent) value);
14258        } else if (name.equals("total")) {
14259          this.getTotal().add((TotalComponent) value);
14260        } else if (name.equals("payment")) {
14261          this.payment = (PaymentComponent) value; // PaymentComponent
14262        } else if (name.equals("form")) {
14263          this.form = castToCodeableConcept(value); // CodeableConcept
14264        } else if (name.equals("processNote")) {
14265          this.getProcessNote().add((NoteComponent) value);
14266        } else if (name.equals("benefitBalance")) {
14267          this.getBenefitBalance().add((BenefitBalanceComponent) value);
14268        } else
14269          return super.setProperty(name, value);
14270        return value;
14271      }
14272
14273      @Override
14274      public Base makeProperty(int hash, String name) throws FHIRException {
14275        switch (hash) {
14276        case -1618432855:  return addIdentifier(); 
14277        case -892481550:  return getStatusElement();
14278        case 3575610:  return getType(); 
14279        case -1868521062:  return getSubType(); 
14280        case 116103:  return getUseElement();
14281        case -791418107:  return getPatient(); 
14282        case -332066046:  return getBillablePeriod(); 
14283        case 1028554472:  return getCreatedElement();
14284        case -1591951995:  return getEnterer(); 
14285        case 1957615864:  return getInsurer(); 
14286        case -987494927:  return getProvider(); 
14287        case -722568291:  return getReferral(); 
14288        case 501116579:  return getFacility(); 
14289        case 94742588:  return getClaim(); 
14290        case 689513629:  return getClaimResponse(); 
14291        case -1106507950:  return getOutcomeElement();
14292        case 583380919:  return getDispositionElement();
14293        case 1090493483:  return addRelated(); 
14294        case 460301338:  return getPrescription(); 
14295        case -1814015861:  return getOriginalPrescription(); 
14296        case 106443592:  return getPayee(); 
14297        case 1968600364:  return addInformation(); 
14298        case -7323378:  return addCareTeam(); 
14299        case 1196993265:  return addDiagnosis(); 
14300        case -1095204141:  return addProcedure(); 
14301        case 159695370:  return getPrecedenceElement();
14302        case 73049818:  return addInsurance(); 
14303        case -2143202801:  return getAccident(); 
14304        case 3242771:  return addItem(); 
14305        case -1148899500:  return addAddItem(); 
14306        case 110549828:  return addTotal(); 
14307        case -786681338:  return getPayment(); 
14308        case 3148996:  return getForm(); 
14309        case 202339073:  return addProcessNote(); 
14310        case 596003397:  return addBenefitBalance(); 
14311        default: return super.makeProperty(hash, name);
14312        }
14313
14314      }
14315
14316      @Override
14317      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
14318        switch (hash) {
14319        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
14320        case -892481550: /*status*/ return new String[] {"code"};
14321        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
14322        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
14323        case 116103: /*use*/ return new String[] {"code"};
14324        case -791418107: /*patient*/ return new String[] {"Reference"};
14325        case -332066046: /*billablePeriod*/ return new String[] {"Period"};
14326        case 1028554472: /*created*/ return new String[] {"dateTime"};
14327        case -1591951995: /*enterer*/ return new String[] {"Reference"};
14328        case 1957615864: /*insurer*/ return new String[] {"Reference"};
14329        case -987494927: /*provider*/ return new String[] {"Reference"};
14330        case -722568291: /*referral*/ return new String[] {"Reference"};
14331        case 501116579: /*facility*/ return new String[] {"Reference"};
14332        case 94742588: /*claim*/ return new String[] {"Reference"};
14333        case 689513629: /*claimResponse*/ return new String[] {"Reference"};
14334        case -1106507950: /*outcome*/ return new String[] {"code"};
14335        case 583380919: /*disposition*/ return new String[] {"string"};
14336        case 1090493483: /*related*/ return new String[] {};
14337        case 460301338: /*prescription*/ return new String[] {"Reference"};
14338        case -1814015861: /*originalPrescription*/ return new String[] {"Reference"};
14339        case 106443592: /*payee*/ return new String[] {};
14340        case 1968600364: /*information*/ return new String[] {};
14341        case -7323378: /*careTeam*/ return new String[] {};
14342        case 1196993265: /*diagnosis*/ return new String[] {};
14343        case -1095204141: /*procedure*/ return new String[] {};
14344        case 159695370: /*precedence*/ return new String[] {"positiveInt"};
14345        case 73049818: /*insurance*/ return new String[] {};
14346        case -2143202801: /*accident*/ return new String[] {};
14347        case 3242771: /*item*/ return new String[] {};
14348        case -1148899500: /*addItem*/ return new String[] {};
14349        case 110549828: /*total*/ return new String[] {};
14350        case -786681338: /*payment*/ return new String[] {};
14351        case 3148996: /*form*/ return new String[] {"CodeableConcept"};
14352        case 202339073: /*processNote*/ return new String[] {};
14353        case 596003397: /*benefitBalance*/ return new String[] {};
14354        default: return super.getTypesForProperty(hash, name);
14355        }
14356
14357      }
14358
14359      @Override
14360      public Base addChild(String name) throws FHIRException {
14361        if (name.equals("identifier")) {
14362          return addIdentifier();
14363        }
14364        else if (name.equals("status")) {
14365          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.status");
14366        }
14367        else if (name.equals("type")) {
14368          this.type = new CodeableConcept();
14369          return this.type;
14370        }
14371        else if (name.equals("subType")) {
14372          this.subType = new CodeableConcept();
14373          return this.subType;
14374        }
14375        else if (name.equals("use")) {
14376          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.use");
14377        }
14378        else if (name.equals("patient")) {
14379          this.patient = new Reference();
14380          return this.patient;
14381        }
14382        else if (name.equals("billablePeriod")) {
14383          this.billablePeriod = new Period();
14384          return this.billablePeriod;
14385        }
14386        else if (name.equals("created")) {
14387          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.created");
14388        }
14389        else if (name.equals("enterer")) {
14390          this.enterer = new Reference();
14391          return this.enterer;
14392        }
14393        else if (name.equals("insurer")) {
14394          this.insurer = new Reference();
14395          return this.insurer;
14396        }
14397        else if (name.equals("provider")) {
14398          this.provider = new Reference();
14399          return this.provider;
14400        }
14401        else if (name.equals("referral")) {
14402          this.referral = new Reference();
14403          return this.referral;
14404        }
14405        else if (name.equals("facility")) {
14406          this.facility = new Reference();
14407          return this.facility;
14408        }
14409        else if (name.equals("claim")) {
14410          this.claim = new Reference();
14411          return this.claim;
14412        }
14413        else if (name.equals("claimResponse")) {
14414          this.claimResponse = new Reference();
14415          return this.claimResponse;
14416        }
14417        else if (name.equals("outcome")) {
14418          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.outcome");
14419        }
14420        else if (name.equals("disposition")) {
14421          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.disposition");
14422        }
14423        else if (name.equals("related")) {
14424          return addRelated();
14425        }
14426        else if (name.equals("prescription")) {
14427          this.prescription = new Reference();
14428          return this.prescription;
14429        }
14430        else if (name.equals("originalPrescription")) {
14431          this.originalPrescription = new Reference();
14432          return this.originalPrescription;
14433        }
14434        else if (name.equals("payee")) {
14435          this.payee = new PayeeComponent();
14436          return this.payee;
14437        }
14438        else if (name.equals("information")) {
14439          return addInformation();
14440        }
14441        else if (name.equals("careTeam")) {
14442          return addCareTeam();
14443        }
14444        else if (name.equals("diagnosis")) {
14445          return addDiagnosis();
14446        }
14447        else if (name.equals("procedure")) {
14448          return addProcedure();
14449        }
14450        else if (name.equals("precedence")) {
14451          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.precedence");
14452        }
14453        else if (name.equals("insurance")) {
14454          return addInsurance();
14455        }
14456        else if (name.equals("accident")) {
14457          this.accident = new AccidentComponent();
14458          return this.accident;
14459        }
14460        else if (name.equals("item")) {
14461          return addItem();
14462        }
14463        else if (name.equals("addItem")) {
14464          return addAddItem();
14465        }
14466        else if (name.equals("total")) {
14467          return addTotal();
14468        }
14469        else if (name.equals("payment")) {
14470          this.payment = new PaymentComponent();
14471          return this.payment;
14472        }
14473        else if (name.equals("form")) {
14474          this.form = new CodeableConcept();
14475          return this.form;
14476        }
14477        else if (name.equals("processNote")) {
14478          return addProcessNote();
14479        }
14480        else if (name.equals("benefitBalance")) {
14481          return addBenefitBalance();
14482        }
14483        else
14484          return super.addChild(name);
14485      }
14486
14487  public String fhirType() {
14488    return "ExplanationOfBenefit";
14489
14490  }
14491
14492      public ExplanationOfBenefit copy() {
14493        ExplanationOfBenefit dst = new ExplanationOfBenefit();
14494        copyValues(dst);
14495        if (identifier != null) {
14496          dst.identifier = new ArrayList<Identifier>();
14497          for (Identifier i : identifier)
14498            dst.identifier.add(i.copy());
14499        };
14500        dst.status = status == null ? null : status.copy();
14501        dst.type = type == null ? null : type.copy();
14502        dst.subType = subType == null ? null : subType.copy();
14503        dst.use = use == null ? null : use.copy();
14504        dst.patient = patient == null ? null : patient.copy();
14505        dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
14506        dst.created = created == null ? null : created.copy();
14507        dst.enterer = enterer == null ? null : enterer.copy();
14508        dst.insurer = insurer == null ? null : insurer.copy();
14509        dst.provider = provider == null ? null : provider.copy();
14510        dst.referral = referral == null ? null : referral.copy();
14511        dst.facility = facility == null ? null : facility.copy();
14512        dst.claim = claim == null ? null : claim.copy();
14513        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
14514        dst.outcome = outcome == null ? null : outcome.copy();
14515        dst.disposition = disposition == null ? null : disposition.copy();
14516        if (related != null) {
14517          dst.related = new ArrayList<RelatedClaimComponent>();
14518          for (RelatedClaimComponent i : related)
14519            dst.related.add(i.copy());
14520        };
14521        dst.prescription = prescription == null ? null : prescription.copy();
14522        dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
14523        dst.payee = payee == null ? null : payee.copy();
14524        if (information != null) {
14525          dst.information = new ArrayList<SupportingInformationComponent>();
14526          for (SupportingInformationComponent i : information)
14527            dst.information.add(i.copy());
14528        };
14529        if (careTeam != null) {
14530          dst.careTeam = new ArrayList<CareTeamComponent>();
14531          for (CareTeamComponent i : careTeam)
14532            dst.careTeam.add(i.copy());
14533        };
14534        if (diagnosis != null) {
14535          dst.diagnosis = new ArrayList<DiagnosisComponent>();
14536          for (DiagnosisComponent i : diagnosis)
14537            dst.diagnosis.add(i.copy());
14538        };
14539        if (procedure != null) {
14540          dst.procedure = new ArrayList<ProcedureComponent>();
14541          for (ProcedureComponent i : procedure)
14542            dst.procedure.add(i.copy());
14543        };
14544        dst.precedence = precedence == null ? null : precedence.copy();
14545        if (insurance != null) {
14546          dst.insurance = new ArrayList<InsuranceComponent>();
14547          for (InsuranceComponent i : insurance)
14548            dst.insurance.add(i.copy());
14549        };
14550        dst.accident = accident == null ? null : accident.copy();
14551        if (item != null) {
14552          dst.item = new ArrayList<ItemComponent>();
14553          for (ItemComponent i : item)
14554            dst.item.add(i.copy());
14555        };
14556        if (addItem != null) {
14557          dst.addItem = new ArrayList<AddedItemComponent>();
14558          for (AddedItemComponent i : addItem)
14559            dst.addItem.add(i.copy());
14560        };
14561        if (total != null) {
14562          dst.total = new ArrayList<TotalComponent>();
14563          for (TotalComponent i : total)
14564            dst.total.add(i.copy());
14565        };
14566        dst.payment = payment == null ? null : payment.copy();
14567        dst.form = form == null ? null : form.copy();
14568        if (processNote != null) {
14569          dst.processNote = new ArrayList<NoteComponent>();
14570          for (NoteComponent i : processNote)
14571            dst.processNote.add(i.copy());
14572        };
14573        if (benefitBalance != null) {
14574          dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14575          for (BenefitBalanceComponent i : benefitBalance)
14576            dst.benefitBalance.add(i.copy());
14577        };
14578        return dst;
14579      }
14580
14581      protected ExplanationOfBenefit typedCopy() {
14582        return copy();
14583      }
14584
14585      @Override
14586      public boolean equalsDeep(Base other_) {
14587        if (!super.equalsDeep(other_))
14588          return false;
14589        if (!(other_ instanceof ExplanationOfBenefit))
14590          return false;
14591        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
14592        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
14593           && compareDeep(subType, o.subType, true) && compareDeep(use, o.use, true) && compareDeep(patient, o.patient, true)
14594           && compareDeep(billablePeriod, o.billablePeriod, true) && compareDeep(created, o.created, true)
14595           && compareDeep(enterer, o.enterer, true) && compareDeep(insurer, o.insurer, true) && compareDeep(provider, o.provider, true)
14596           && compareDeep(referral, o.referral, true) && compareDeep(facility, o.facility, true) && compareDeep(claim, o.claim, true)
14597           && compareDeep(claimResponse, o.claimResponse, true) && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true)
14598           && compareDeep(related, o.related, true) && compareDeep(prescription, o.prescription, true) && compareDeep(originalPrescription, o.originalPrescription, true)
14599           && compareDeep(payee, o.payee, true) && compareDeep(information, o.information, true) && compareDeep(careTeam, o.careTeam, true)
14600           && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true) && compareDeep(precedence, o.precedence, true)
14601           && compareDeep(insurance, o.insurance, true) && compareDeep(accident, o.accident, true) && compareDeep(item, o.item, true)
14602           && compareDeep(addItem, o.addItem, true) && compareDeep(total, o.total, true) && compareDeep(payment, o.payment, true)
14603           && compareDeep(form, o.form, true) && compareDeep(processNote, o.processNote, true) && compareDeep(benefitBalance, o.benefitBalance, true)
14604          ;
14605      }
14606
14607      @Override
14608      public boolean equalsShallow(Base other_) {
14609        if (!super.equalsShallow(other_))
14610          return false;
14611        if (!(other_ instanceof ExplanationOfBenefit))
14612          return false;
14613        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
14614        return compareValues(status, o.status, true) && compareValues(use, o.use, true) && compareValues(created, o.created, true)
14615           && compareValues(outcome, o.outcome, true) && compareValues(disposition, o.disposition, true) && compareValues(precedence, o.precedence, true)
14616          ;
14617      }
14618
14619      public boolean isEmpty() {
14620        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
14621          , subType, use, patient, billablePeriod, created, enterer, insurer, provider
14622          , referral, facility, claim, claimResponse, outcome, disposition, related, prescription
14623          , originalPrescription, payee, information, careTeam, diagnosis, procedure, precedence
14624          , insurance, accident, item, addItem, total, payment, form, processNote, benefitBalance
14625          );
14626      }
14627
14628  @Override
14629  public ResourceType getResourceType() {
14630    return ResourceType.ExplanationOfBenefit;
14631   }
14632
14633 /**
14634   * Search parameter: <b>coverage</b>
14635   * <p>
14636   * Description: <b>The plan under which the claim was adjudicated</b><br>
14637   * Type: <b>reference</b><br>
14638   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
14639   * </p>
14640   */
14641  @SearchParamDefinition(name="coverage", path="ExplanationOfBenefit.insurance.coverage", description="The plan under which the claim was adjudicated", type="reference", target={Coverage.class } )
14642  public static final String SP_COVERAGE = "coverage";
14643 /**
14644   * <b>Fluent Client</b> search parameter constant for <b>coverage</b>
14645   * <p>
14646   * Description: <b>The plan under which the claim was adjudicated</b><br>
14647   * Type: <b>reference</b><br>
14648   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
14649   * </p>
14650   */
14651  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COVERAGE);
14652
14653/**
14654   * Constant for fluent queries to be used to add include statements. Specifies
14655   * the path value of "<b>ExplanationOfBenefit:coverage</b>".
14656   */
14657  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:coverage").toLocked();
14658
14659 /**
14660   * Search parameter: <b>care-team</b>
14661   * <p>
14662   * Description: <b>Member of the CareTeam</b><br>
14663   * Type: <b>reference</b><br>
14664   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
14665   * </p>
14666   */
14667  @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 } )
14668  public static final String SP_CARE_TEAM = "care-team";
14669 /**
14670   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
14671   * <p>
14672   * Description: <b>Member of the CareTeam</b><br>
14673   * Type: <b>reference</b><br>
14674   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
14675   * </p>
14676   */
14677  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CARE_TEAM);
14678
14679/**
14680   * Constant for fluent queries to be used to add include statements. Specifies
14681   * the path value of "<b>ExplanationOfBenefit:care-team</b>".
14682   */
14683  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:care-team").toLocked();
14684
14685 /**
14686   * Search parameter: <b>identifier</b>
14687   * <p>
14688   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
14689   * Type: <b>token</b><br>
14690   * Path: <b>ExplanationOfBenefit.identifier</b><br>
14691   * </p>
14692   */
14693  @SearchParamDefinition(name="identifier", path="ExplanationOfBenefit.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
14694  public static final String SP_IDENTIFIER = "identifier";
14695 /**
14696   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
14697   * <p>
14698   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
14699   * Type: <b>token</b><br>
14700   * Path: <b>ExplanationOfBenefit.identifier</b><br>
14701   * </p>
14702   */
14703  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
14704
14705 /**
14706   * Search parameter: <b>created</b>
14707   * <p>
14708   * Description: <b>The creation date for the EOB</b><br>
14709   * Type: <b>date</b><br>
14710   * Path: <b>ExplanationOfBenefit.created</b><br>
14711   * </p>
14712   */
14713  @SearchParamDefinition(name="created", path="ExplanationOfBenefit.created", description="The creation date for the EOB", type="date" )
14714  public static final String SP_CREATED = "created";
14715 /**
14716   * <b>Fluent Client</b> search parameter constant for <b>created</b>
14717   * <p>
14718   * Description: <b>The creation date for the EOB</b><br>
14719   * Type: <b>date</b><br>
14720   * Path: <b>ExplanationOfBenefit.created</b><br>
14721   * </p>
14722   */
14723  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
14724
14725 /**
14726   * Search parameter: <b>encounter</b>
14727   * <p>
14728   * Description: <b>Encounters associated with a billed line item</b><br>
14729   * Type: <b>reference</b><br>
14730   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
14731   * </p>
14732   */
14733  @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 } )
14734  public static final String SP_ENCOUNTER = "encounter";
14735 /**
14736   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
14737   * <p>
14738   * Description: <b>Encounters associated with a billed line item</b><br>
14739   * Type: <b>reference</b><br>
14740   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
14741   * </p>
14742   */
14743  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
14744
14745/**
14746   * Constant for fluent queries to be used to add include statements. Specifies
14747   * the path value of "<b>ExplanationOfBenefit:encounter</b>".
14748   */
14749  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:encounter").toLocked();
14750
14751 /**
14752   * Search parameter: <b>payee</b>
14753   * <p>
14754   * Description: <b>The party receiving any payment for the Claim</b><br>
14755   * Type: <b>reference</b><br>
14756   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
14757   * </p>
14758   */
14759  @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 } )
14760  public static final String SP_PAYEE = "payee";
14761 /**
14762   * <b>Fluent Client</b> search parameter constant for <b>payee</b>
14763   * <p>
14764   * Description: <b>The party receiving any payment for the Claim</b><br>
14765   * Type: <b>reference</b><br>
14766   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
14767   * </p>
14768   */
14769  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PAYEE);
14770
14771/**
14772   * Constant for fluent queries to be used to add include statements. Specifies
14773   * the path value of "<b>ExplanationOfBenefit:payee</b>".
14774   */
14775  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYEE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:payee").toLocked();
14776
14777 /**
14778   * Search parameter: <b>disposition</b>
14779   * <p>
14780   * Description: <b>The contents of the disposition message</b><br>
14781   * Type: <b>string</b><br>
14782   * Path: <b>ExplanationOfBenefit.disposition</b><br>
14783   * </p>
14784   */
14785  @SearchParamDefinition(name="disposition", path="ExplanationOfBenefit.disposition", description="The contents of the disposition message", type="string" )
14786  public static final String SP_DISPOSITION = "disposition";
14787 /**
14788   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
14789   * <p>
14790   * Description: <b>The contents of the disposition message</b><br>
14791   * Type: <b>string</b><br>
14792   * Path: <b>ExplanationOfBenefit.disposition</b><br>
14793   * </p>
14794   */
14795  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
14796
14797 /**
14798   * Search parameter: <b>provider</b>
14799   * <p>
14800   * Description: <b>The reference to the provider</b><br>
14801   * Type: <b>reference</b><br>
14802   * Path: <b>ExplanationOfBenefit.provider</b><br>
14803   * </p>
14804   */
14805  @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 } )
14806  public static final String SP_PROVIDER = "provider";
14807 /**
14808   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
14809   * <p>
14810   * Description: <b>The reference to the provider</b><br>
14811   * Type: <b>reference</b><br>
14812   * Path: <b>ExplanationOfBenefit.provider</b><br>
14813   * </p>
14814   */
14815  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
14816
14817/**
14818   * Constant for fluent queries to be used to add include statements. Specifies
14819   * the path value of "<b>ExplanationOfBenefit:provider</b>".
14820   */
14821  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:provider").toLocked();
14822
14823 /**
14824   * Search parameter: <b>patient</b>
14825   * <p>
14826   * Description: <b>The reference to the patient</b><br>
14827   * Type: <b>reference</b><br>
14828   * Path: <b>ExplanationOfBenefit.patient</b><br>
14829   * </p>
14830   */
14831  @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 } )
14832  public static final String SP_PATIENT = "patient";
14833 /**
14834   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
14835   * <p>
14836   * Description: <b>The reference to the patient</b><br>
14837   * Type: <b>reference</b><br>
14838   * Path: <b>ExplanationOfBenefit.patient</b><br>
14839   * </p>
14840   */
14841  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
14842
14843/**
14844   * Constant for fluent queries to be used to add include statements. Specifies
14845   * the path value of "<b>ExplanationOfBenefit:patient</b>".
14846   */
14847  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:patient").toLocked();
14848
14849 /**
14850   * Search parameter: <b>claim</b>
14851   * <p>
14852   * Description: <b>The reference to the claim</b><br>
14853   * Type: <b>reference</b><br>
14854   * Path: <b>ExplanationOfBenefit.claim</b><br>
14855   * </p>
14856   */
14857  @SearchParamDefinition(name="claim", path="ExplanationOfBenefit.claim", description="The reference to the claim", type="reference", target={Claim.class } )
14858  public static final String SP_CLAIM = "claim";
14859 /**
14860   * <b>Fluent Client</b> search parameter constant for <b>claim</b>
14861   * <p>
14862   * Description: <b>The reference to the claim</b><br>
14863   * Type: <b>reference</b><br>
14864   * Path: <b>ExplanationOfBenefit.claim</b><br>
14865   * </p>
14866   */
14867  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CLAIM);
14868
14869/**
14870   * Constant for fluent queries to be used to add include statements. Specifies
14871   * the path value of "<b>ExplanationOfBenefit:claim</b>".
14872   */
14873  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:claim").toLocked();
14874
14875 /**
14876   * Search parameter: <b>enterer</b>
14877   * <p>
14878   * Description: <b>The party responsible for the entry of the Claim</b><br>
14879   * Type: <b>reference</b><br>
14880   * Path: <b>ExplanationOfBenefit.enterer</b><br>
14881   * </p>
14882   */
14883  @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 } )
14884  public static final String SP_ENTERER = "enterer";
14885 /**
14886   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
14887   * <p>
14888   * Description: <b>The party responsible for the entry of the Claim</b><br>
14889   * Type: <b>reference</b><br>
14890   * Path: <b>ExplanationOfBenefit.enterer</b><br>
14891   * </p>
14892   */
14893  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTERER);
14894
14895/**
14896   * Constant for fluent queries to be used to add include statements. Specifies
14897   * the path value of "<b>ExplanationOfBenefit:enterer</b>".
14898   */
14899  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:enterer").toLocked();
14900
14901 /**
14902   * Search parameter: <b>facility</b>
14903   * <p>
14904   * Description: <b>Facility responsible for the goods and services</b><br>
14905   * Type: <b>reference</b><br>
14906   * Path: <b>ExplanationOfBenefit.facility</b><br>
14907   * </p>
14908   */
14909  @SearchParamDefinition(name="facility", path="ExplanationOfBenefit.facility", description="Facility responsible for the goods and services", type="reference", target={Location.class } )
14910  public static final String SP_FACILITY = "facility";
14911 /**
14912   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
14913   * <p>
14914   * Description: <b>Facility responsible for the goods and services</b><br>
14915   * Type: <b>reference</b><br>
14916   * Path: <b>ExplanationOfBenefit.facility</b><br>
14917   * </p>
14918   */
14919  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITY);
14920
14921/**
14922   * Constant for fluent queries to be used to add include statements. Specifies
14923   * the path value of "<b>ExplanationOfBenefit:facility</b>".
14924   */
14925  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:facility").toLocked();
14926
14927 /**
14928   * Search parameter: <b>status</b>
14929   * <p>
14930   * Description: <b>Status of the instance</b><br>
14931   * Type: <b>token</b><br>
14932   * Path: <b>ExplanationOfBenefit.status</b><br>
14933   * </p>
14934   */
14935  @SearchParamDefinition(name="status", path="ExplanationOfBenefit.status", description="Status of the instance", type="token" )
14936  public static final String SP_STATUS = "status";
14937 /**
14938   * <b>Fluent Client</b> search parameter constant for <b>status</b>
14939   * <p>
14940   * Description: <b>Status of the instance</b><br>
14941   * Type: <b>token</b><br>
14942   * Path: <b>ExplanationOfBenefit.status</b><br>
14943   * </p>
14944   */
14945  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
14946
14947
14948}
14949