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 Sun, May 6, 2018 17:51-0400 for FHIR v3.4.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/Profile/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        COMPLETE, 
182        /**
183         * The treatment is proposed and this represents a Pre-authorization for the services.
184         */
185        PROPOSED, 
186        /**
187         * The treatment is proposed and this represents a Pre-determination for the services.
188         */
189        EXPLORATORY, 
190        /**
191         * A locally defined or otherwise resolved status.
192         */
193        OTHER, 
194        /**
195         * added to help the parsers with the generic types
196         */
197        NULL;
198        public static Use fromCode(String codeString) throws FHIRException {
199            if (codeString == null || "".equals(codeString))
200                return null;
201        if ("complete".equals(codeString))
202          return COMPLETE;
203        if ("proposed".equals(codeString))
204          return PROPOSED;
205        if ("exploratory".equals(codeString))
206          return EXPLORATORY;
207        if ("other".equals(codeString))
208          return OTHER;
209        if (Configuration.isAcceptInvalidEnums())
210          return null;
211        else
212          throw new FHIRException("Unknown Use code '"+codeString+"'");
213        }
214        public String toCode() {
215          switch (this) {
216            case COMPLETE: return "complete";
217            case PROPOSED: return "proposed";
218            case EXPLORATORY: return "exploratory";
219            case OTHER: return "other";
220            default: return "?";
221          }
222        }
223        public String getSystem() {
224          switch (this) {
225            case COMPLETE: return "http://hl7.org/fhir/claim-use";
226            case PROPOSED: return "http://hl7.org/fhir/claim-use";
227            case EXPLORATORY: return "http://hl7.org/fhir/claim-use";
228            case OTHER: return "http://hl7.org/fhir/claim-use";
229            default: return "?";
230          }
231        }
232        public String getDefinition() {
233          switch (this) {
234            case COMPLETE: return "The treatment is complete and this represents a Claim for the services.";
235            case PROPOSED: return "The treatment is proposed and this represents a Pre-authorization for the services.";
236            case EXPLORATORY: return "The treatment is proposed and this represents a Pre-determination for the services.";
237            case OTHER: return "A locally defined or otherwise resolved status.";
238            default: return "?";
239          }
240        }
241        public String getDisplay() {
242          switch (this) {
243            case COMPLETE: return "Complete";
244            case PROPOSED: return "Proposed";
245            case EXPLORATORY: return "Exploratory";
246            case OTHER: return "Other";
247            default: return "?";
248          }
249        }
250    }
251
252  public static class UseEnumFactory implements EnumFactory<Use> {
253    public Use fromCode(String codeString) throws IllegalArgumentException {
254      if (codeString == null || "".equals(codeString))
255            if (codeString == null || "".equals(codeString))
256                return null;
257        if ("complete".equals(codeString))
258          return Use.COMPLETE;
259        if ("proposed".equals(codeString))
260          return Use.PROPOSED;
261        if ("exploratory".equals(codeString))
262          return Use.EXPLORATORY;
263        if ("other".equals(codeString))
264          return Use.OTHER;
265        throw new IllegalArgumentException("Unknown Use code '"+codeString+"'");
266        }
267        public Enumeration<Use> fromType(Base code) throws FHIRException {
268          if (code == null)
269            return null;
270          if (code.isEmpty())
271            return new Enumeration<Use>(this);
272          String codeString = ((PrimitiveType) code).asStringValue();
273          if (codeString == null || "".equals(codeString))
274            return null;
275        if ("complete".equals(codeString))
276          return new Enumeration<Use>(this, Use.COMPLETE);
277        if ("proposed".equals(codeString))
278          return new Enumeration<Use>(this, Use.PROPOSED);
279        if ("exploratory".equals(codeString))
280          return new Enumeration<Use>(this, Use.EXPLORATORY);
281        if ("other".equals(codeString))
282          return new Enumeration<Use>(this, Use.OTHER);
283        throw new FHIRException("Unknown Use code '"+codeString+"'");
284        }
285    public String toCode(Use code) {
286      if (code == Use.COMPLETE)
287        return "complete";
288      if (code == Use.PROPOSED)
289        return "proposed";
290      if (code == Use.EXPLORATORY)
291        return "exploratory";
292      if (code == Use.OTHER)
293        return "other";
294      return "?";
295      }
296    public String toSystem(Use code) {
297      return code.getSystem();
298      }
299    }
300
301    public enum RemittanceOutcome {
302        /**
303         * The Claim/Pre-authorization/Pre-determination has been received but processing has not begun.
304         */
305        QUEUED, 
306        /**
307         * The processing has completed without errors
308         */
309        COMPLETE, 
310        /**
311         * One or more errors have been detected in the Claim
312         */
313        ERROR, 
314        /**
315         * No errors have been detected in the Claim and some of the adjudication has been performed.
316         */
317        PARTIAL, 
318        /**
319         * added to help the parsers with the generic types
320         */
321        NULL;
322        public static RemittanceOutcome fromCode(String codeString) throws FHIRException {
323            if (codeString == null || "".equals(codeString))
324                return null;
325        if ("queued".equals(codeString))
326          return QUEUED;
327        if ("complete".equals(codeString))
328          return COMPLETE;
329        if ("error".equals(codeString))
330          return ERROR;
331        if ("partial".equals(codeString))
332          return PARTIAL;
333        if (Configuration.isAcceptInvalidEnums())
334          return null;
335        else
336          throw new FHIRException("Unknown RemittanceOutcome code '"+codeString+"'");
337        }
338        public String toCode() {
339          switch (this) {
340            case QUEUED: return "queued";
341            case COMPLETE: return "complete";
342            case ERROR: return "error";
343            case PARTIAL: return "partial";
344            default: return "?";
345          }
346        }
347        public String getSystem() {
348          switch (this) {
349            case QUEUED: return "http://hl7.org/fhir/remittance-outcome";
350            case COMPLETE: return "http://hl7.org/fhir/remittance-outcome";
351            case ERROR: return "http://hl7.org/fhir/remittance-outcome";
352            case PARTIAL: return "http://hl7.org/fhir/remittance-outcome";
353            default: return "?";
354          }
355        }
356        public String getDefinition() {
357          switch (this) {
358            case QUEUED: return "The Claim/Pre-authorization/Pre-determination has been received but processing has not begun.";
359            case COMPLETE: return "The processing has completed without errors";
360            case ERROR: return "One or more errors have been detected in the Claim";
361            case PARTIAL: return "No errors have been detected in the Claim and some of the adjudication has been performed.";
362            default: return "?";
363          }
364        }
365        public String getDisplay() {
366          switch (this) {
367            case QUEUED: return "Queued";
368            case COMPLETE: return "Processing Complete";
369            case ERROR: return "Error";
370            case PARTIAL: return "Partial Processing";
371            default: return "?";
372          }
373        }
374    }
375
376  public static class RemittanceOutcomeEnumFactory implements EnumFactory<RemittanceOutcome> {
377    public RemittanceOutcome fromCode(String codeString) throws IllegalArgumentException {
378      if (codeString == null || "".equals(codeString))
379            if (codeString == null || "".equals(codeString))
380                return null;
381        if ("queued".equals(codeString))
382          return RemittanceOutcome.QUEUED;
383        if ("complete".equals(codeString))
384          return RemittanceOutcome.COMPLETE;
385        if ("error".equals(codeString))
386          return RemittanceOutcome.ERROR;
387        if ("partial".equals(codeString))
388          return RemittanceOutcome.PARTIAL;
389        throw new IllegalArgumentException("Unknown RemittanceOutcome code '"+codeString+"'");
390        }
391        public Enumeration<RemittanceOutcome> fromType(Base code) throws FHIRException {
392          if (code == null)
393            return null;
394          if (code.isEmpty())
395            return new Enumeration<RemittanceOutcome>(this);
396          String codeString = ((PrimitiveType) code).asStringValue();
397          if (codeString == null || "".equals(codeString))
398            return null;
399        if ("queued".equals(codeString))
400          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.QUEUED);
401        if ("complete".equals(codeString))
402          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.COMPLETE);
403        if ("error".equals(codeString))
404          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.ERROR);
405        if ("partial".equals(codeString))
406          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.PARTIAL);
407        throw new FHIRException("Unknown RemittanceOutcome code '"+codeString+"'");
408        }
409    public String toCode(RemittanceOutcome code) {
410      if (code == RemittanceOutcome.QUEUED)
411        return "queued";
412      if (code == RemittanceOutcome.COMPLETE)
413        return "complete";
414      if (code == RemittanceOutcome.ERROR)
415        return "error";
416      if (code == RemittanceOutcome.PARTIAL)
417        return "partial";
418      return "?";
419      }
420    public String toSystem(RemittanceOutcome code) {
421      return code.getSystem();
422      }
423    }
424
425    @Block()
426    public static class RelatedClaimComponent extends BackboneElement implements IBaseBackboneElement {
427        /**
428         * Other claims which are related to this claim such as prior claim versions or for related services.
429         */
430        @Child(name = "claim", type = {Claim.class}, order=1, min=0, max=1, modifier=false, summary=false)
431        @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." )
432        protected Reference claim;
433
434        /**
435         * 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.)
436         */
437        protected Claim claimTarget;
438
439        /**
440         * For example prior or umbrella.
441         */
442        @Child(name = "relationship", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
443        @Description(shortDefinition="How the reference claim is related", formalDefinition="For example prior or umbrella." )
444        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-claim-relationship")
445        protected CodeableConcept relationship;
446
447        /**
448         * An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .
449         */
450        @Child(name = "reference", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=false)
451        @Description(shortDefinition="Related file or case reference", formalDefinition="An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # ." )
452        protected Identifier reference;
453
454        private static final long serialVersionUID = -379338905L;
455
456    /**
457     * Constructor
458     */
459      public RelatedClaimComponent() {
460        super();
461      }
462
463        /**
464         * @return {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
465         */
466        public Reference getClaim() { 
467          if (this.claim == null)
468            if (Configuration.errorOnAutoCreate())
469              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
470            else if (Configuration.doAutoCreate())
471              this.claim = new Reference(); // cc
472          return this.claim;
473        }
474
475        public boolean hasClaim() { 
476          return this.claim != null && !this.claim.isEmpty();
477        }
478
479        /**
480         * @param value {@link #claim} (Other claims which are related to this claim such as prior claim versions or for related services.)
481         */
482        public RelatedClaimComponent setClaim(Reference value) { 
483          this.claim = value;
484          return this;
485        }
486
487        /**
488         * @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.)
489         */
490        public Claim getClaimTarget() { 
491          if (this.claimTarget == null)
492            if (Configuration.errorOnAutoCreate())
493              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
494            else if (Configuration.doAutoCreate())
495              this.claimTarget = new Claim(); // aa
496          return this.claimTarget;
497        }
498
499        /**
500         * @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.)
501         */
502        public RelatedClaimComponent setClaimTarget(Claim value) { 
503          this.claimTarget = value;
504          return this;
505        }
506
507        /**
508         * @return {@link #relationship} (For example prior or umbrella.)
509         */
510        public CodeableConcept getRelationship() { 
511          if (this.relationship == null)
512            if (Configuration.errorOnAutoCreate())
513              throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
514            else if (Configuration.doAutoCreate())
515              this.relationship = new CodeableConcept(); // cc
516          return this.relationship;
517        }
518
519        public boolean hasRelationship() { 
520          return this.relationship != null && !this.relationship.isEmpty();
521        }
522
523        /**
524         * @param value {@link #relationship} (For example prior or umbrella.)
525         */
526        public RelatedClaimComponent setRelationship(CodeableConcept value) { 
527          this.relationship = value;
528          return this;
529        }
530
531        /**
532         * @return {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .)
533         */
534        public Identifier getReference() { 
535          if (this.reference == null)
536            if (Configuration.errorOnAutoCreate())
537              throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
538            else if (Configuration.doAutoCreate())
539              this.reference = new Identifier(); // cc
540          return this.reference;
541        }
542
543        public boolean hasReference() { 
544          return this.reference != null && !this.reference.isEmpty();
545        }
546
547        /**
548         * @param value {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .)
549         */
550        public RelatedClaimComponent setReference(Identifier value) { 
551          this.reference = value;
552          return this;
553        }
554
555        protected void listChildren(List<Property> children) {
556          super.listChildren(children);
557          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));
558          children.add(new Property("relationship", "CodeableConcept", "For example prior or umbrella.", 0, 1, relationship));
559          children.add(new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .", 0, 1, reference));
560        }
561
562        @Override
563        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
564          switch (_hash) {
565          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);
566          case -261851592: /*relationship*/  return new Property("relationship", "CodeableConcept", "For example prior or umbrella.", 0, 1, relationship);
567          case -925155509: /*reference*/  return new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .", 0, 1, reference);
568          default: return super.getNamedProperty(_hash, _name, _checkValid);
569          }
570
571        }
572
573      @Override
574      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
575        switch (hash) {
576        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
577        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
578        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Identifier
579        default: return super.getProperty(hash, name, checkValid);
580        }
581
582      }
583
584      @Override
585      public Base setProperty(int hash, String name, Base value) throws FHIRException {
586        switch (hash) {
587        case 94742588: // claim
588          this.claim = castToReference(value); // Reference
589          return value;
590        case -261851592: // relationship
591          this.relationship = castToCodeableConcept(value); // CodeableConcept
592          return value;
593        case -925155509: // reference
594          this.reference = castToIdentifier(value); // Identifier
595          return value;
596        default: return super.setProperty(hash, name, value);
597        }
598
599      }
600
601      @Override
602      public Base setProperty(String name, Base value) throws FHIRException {
603        if (name.equals("claim")) {
604          this.claim = castToReference(value); // Reference
605        } else if (name.equals("relationship")) {
606          this.relationship = castToCodeableConcept(value); // CodeableConcept
607        } else if (name.equals("reference")) {
608          this.reference = castToIdentifier(value); // Identifier
609        } else
610          return super.setProperty(name, value);
611        return value;
612      }
613
614      @Override
615      public Base makeProperty(int hash, String name) throws FHIRException {
616        switch (hash) {
617        case 94742588:  return getClaim(); 
618        case -261851592:  return getRelationship(); 
619        case -925155509:  return getReference(); 
620        default: return super.makeProperty(hash, name);
621        }
622
623      }
624
625      @Override
626      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
627        switch (hash) {
628        case 94742588: /*claim*/ return new String[] {"Reference"};
629        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
630        case -925155509: /*reference*/ return new String[] {"Identifier"};
631        default: return super.getTypesForProperty(hash, name);
632        }
633
634      }
635
636      @Override
637      public Base addChild(String name) throws FHIRException {
638        if (name.equals("claim")) {
639          this.claim = new Reference();
640          return this.claim;
641        }
642        else if (name.equals("relationship")) {
643          this.relationship = new CodeableConcept();
644          return this.relationship;
645        }
646        else if (name.equals("reference")) {
647          this.reference = new Identifier();
648          return this.reference;
649        }
650        else
651          return super.addChild(name);
652      }
653
654      public RelatedClaimComponent copy() {
655        RelatedClaimComponent dst = new RelatedClaimComponent();
656        copyValues(dst);
657        dst.claim = claim == null ? null : claim.copy();
658        dst.relationship = relationship == null ? null : relationship.copy();
659        dst.reference = reference == null ? null : reference.copy();
660        return dst;
661      }
662
663      @Override
664      public boolean equalsDeep(Base other_) {
665        if (!super.equalsDeep(other_))
666          return false;
667        if (!(other_ instanceof RelatedClaimComponent))
668          return false;
669        RelatedClaimComponent o = (RelatedClaimComponent) other_;
670        return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true) && compareDeep(reference, o.reference, true)
671          ;
672      }
673
674      @Override
675      public boolean equalsShallow(Base other_) {
676        if (!super.equalsShallow(other_))
677          return false;
678        if (!(other_ instanceof RelatedClaimComponent))
679          return false;
680        RelatedClaimComponent o = (RelatedClaimComponent) other_;
681        return true;
682      }
683
684      public boolean isEmpty() {
685        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference
686          );
687      }
688
689  public String fhirType() {
690    return "ExplanationOfBenefit.related";
691
692  }
693
694  }
695
696    @Block()
697    public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
698        /**
699         * Type of Party to be reimbursed: Subscriber, provider, other.
700         */
701        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
702        @Description(shortDefinition="Type of party: Subscriber, Provider, other", formalDefinition="Type of Party to be reimbursed: Subscriber, provider, other." )
703        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payeetype")
704        protected CodeableConcept type;
705
706        /**
707         * organization | patient | practitioner | relatedperson.
708         */
709        @Child(name = "resource", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=false)
710        @Description(shortDefinition="organization | patient | practitioner | relatedperson", formalDefinition="organization | patient | practitioner | relatedperson." )
711        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-type-link")
712        protected Coding resource;
713
714        /**
715         * Party to be reimbursed: Subscriber, provider, other.
716         */
717        @Child(name = "party", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, RelatedPerson.class}, order=3, min=0, max=1, modifier=false, summary=false)
718        @Description(shortDefinition="Party to receive the payable", formalDefinition="Party to be reimbursed: Subscriber, provider, other." )
719        protected Reference party;
720
721        /**
722         * The actual object that is the target of the reference (Party to be reimbursed: Subscriber, provider, other.)
723         */
724        protected Resource partyTarget;
725
726        private static final long serialVersionUID = -553403531L;
727
728    /**
729     * Constructor
730     */
731      public PayeeComponent() {
732        super();
733      }
734
735        /**
736         * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
737         */
738        public CodeableConcept getType() { 
739          if (this.type == null)
740            if (Configuration.errorOnAutoCreate())
741              throw new Error("Attempt to auto-create PayeeComponent.type");
742            else if (Configuration.doAutoCreate())
743              this.type = new CodeableConcept(); // cc
744          return this.type;
745        }
746
747        public boolean hasType() { 
748          return this.type != null && !this.type.isEmpty();
749        }
750
751        /**
752         * @param value {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
753         */
754        public PayeeComponent setType(CodeableConcept value) { 
755          this.type = value;
756          return this;
757        }
758
759        /**
760         * @return {@link #resource} (organization | patient | practitioner | relatedperson.)
761         */
762        public Coding getResource() { 
763          if (this.resource == null)
764            if (Configuration.errorOnAutoCreate())
765              throw new Error("Attempt to auto-create PayeeComponent.resource");
766            else if (Configuration.doAutoCreate())
767              this.resource = new Coding(); // cc
768          return this.resource;
769        }
770
771        public boolean hasResource() { 
772          return this.resource != null && !this.resource.isEmpty();
773        }
774
775        /**
776         * @param value {@link #resource} (organization | patient | practitioner | relatedperson.)
777         */
778        public PayeeComponent setResource(Coding value) { 
779          this.resource = value;
780          return this;
781        }
782
783        /**
784         * @return {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
785         */
786        public Reference getParty() { 
787          if (this.party == null)
788            if (Configuration.errorOnAutoCreate())
789              throw new Error("Attempt to auto-create PayeeComponent.party");
790            else if (Configuration.doAutoCreate())
791              this.party = new Reference(); // cc
792          return this.party;
793        }
794
795        public boolean hasParty() { 
796          return this.party != null && !this.party.isEmpty();
797        }
798
799        /**
800         * @param value {@link #party} (Party to be reimbursed: Subscriber, provider, other.)
801         */
802        public PayeeComponent setParty(Reference value) { 
803          this.party = value;
804          return this;
805        }
806
807        /**
808         * @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.)
809         */
810        public Resource getPartyTarget() { 
811          return this.partyTarget;
812        }
813
814        /**
815         * @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.)
816         */
817        public PayeeComponent setPartyTarget(Resource value) { 
818          this.partyTarget = value;
819          return this;
820        }
821
822        protected void listChildren(List<Property> children) {
823          super.listChildren(children);
824          children.add(new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type));
825          children.add(new Property("resource", "Coding", "organization | patient | practitioner | relatedperson.", 0, 1, resource));
826          children.add(new Property("party", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)", "Party to be reimbursed: Subscriber, provider, other.", 0, 1, party));
827        }
828
829        @Override
830        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
831          switch (_hash) {
832          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type);
833          case -341064690: /*resource*/  return new Property("resource", "Coding", "organization | patient | practitioner | relatedperson.", 0, 1, resource);
834          case 106437350: /*party*/  return new Property("party", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)", "Party to be reimbursed: Subscriber, provider, other.", 0, 1, party);
835          default: return super.getNamedProperty(_hash, _name, _checkValid);
836          }
837
838        }
839
840      @Override
841      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
842        switch (hash) {
843        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
844        case -341064690: /*resource*/ return this.resource == null ? new Base[0] : new Base[] {this.resource}; // Coding
845        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
846        default: return super.getProperty(hash, name, checkValid);
847        }
848
849      }
850
851      @Override
852      public Base setProperty(int hash, String name, Base value) throws FHIRException {
853        switch (hash) {
854        case 3575610: // type
855          this.type = castToCodeableConcept(value); // CodeableConcept
856          return value;
857        case -341064690: // resource
858          this.resource = castToCoding(value); // Coding
859          return value;
860        case 106437350: // party
861          this.party = castToReference(value); // Reference
862          return value;
863        default: return super.setProperty(hash, name, value);
864        }
865
866      }
867
868      @Override
869      public Base setProperty(String name, Base value) throws FHIRException {
870        if (name.equals("type")) {
871          this.type = castToCodeableConcept(value); // CodeableConcept
872        } else if (name.equals("resource")) {
873          this.resource = castToCoding(value); // Coding
874        } else if (name.equals("party")) {
875          this.party = castToReference(value); // Reference
876        } else
877          return super.setProperty(name, value);
878        return value;
879      }
880
881      @Override
882      public Base makeProperty(int hash, String name) throws FHIRException {
883        switch (hash) {
884        case 3575610:  return getType(); 
885        case -341064690:  return getResource(); 
886        case 106437350:  return getParty(); 
887        default: return super.makeProperty(hash, name);
888        }
889
890      }
891
892      @Override
893      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
894        switch (hash) {
895        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
896        case -341064690: /*resource*/ return new String[] {"Coding"};
897        case 106437350: /*party*/ return new String[] {"Reference"};
898        default: return super.getTypesForProperty(hash, name);
899        }
900
901      }
902
903      @Override
904      public Base addChild(String name) throws FHIRException {
905        if (name.equals("type")) {
906          this.type = new CodeableConcept();
907          return this.type;
908        }
909        else if (name.equals("resource")) {
910          this.resource = new Coding();
911          return this.resource;
912        }
913        else if (name.equals("party")) {
914          this.party = new Reference();
915          return this.party;
916        }
917        else
918          return super.addChild(name);
919      }
920
921      public PayeeComponent copy() {
922        PayeeComponent dst = new PayeeComponent();
923        copyValues(dst);
924        dst.type = type == null ? null : type.copy();
925        dst.resource = resource == null ? null : resource.copy();
926        dst.party = party == null ? null : party.copy();
927        return dst;
928      }
929
930      @Override
931      public boolean equalsDeep(Base other_) {
932        if (!super.equalsDeep(other_))
933          return false;
934        if (!(other_ instanceof PayeeComponent))
935          return false;
936        PayeeComponent o = (PayeeComponent) other_;
937        return compareDeep(type, o.type, true) && compareDeep(resource, o.resource, true) && compareDeep(party, o.party, true)
938          ;
939      }
940
941      @Override
942      public boolean equalsShallow(Base other_) {
943        if (!super.equalsShallow(other_))
944          return false;
945        if (!(other_ instanceof PayeeComponent))
946          return false;
947        PayeeComponent o = (PayeeComponent) other_;
948        return true;
949      }
950
951      public boolean isEmpty() {
952        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, resource, party);
953      }
954
955  public String fhirType() {
956    return "ExplanationOfBenefit.payee";
957
958  }
959
960  }
961
962    @Block()
963    public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
964        /**
965         * Sequence of the information element which serves to provide a link.
966         */
967        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
968        @Description(shortDefinition="Information instance identifier", formalDefinition="Sequence of the information element which serves to provide a link." )
969        protected PositiveIntType sequence;
970
971        /**
972         * The general class of the information supplied: information; exception; accident, employment; onset, etc.
973         */
974        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
975        @Description(shortDefinition="General class of information", formalDefinition="The general class of the information supplied: information; exception; accident, employment; onset, etc." )
976        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-informationcategory")
977        protected CodeableConcept category;
978
979        /**
980         * 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.
981         */
982        @Child(name = "code", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
983        @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." )
984        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-exception")
985        protected CodeableConcept code;
986
987        /**
988         * The date when or period to which this information refers.
989         */
990        @Child(name = "timing", type = {DateType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
991        @Description(shortDefinition="When it occurred", formalDefinition="The date when or period to which this information refers." )
992        protected Type timing;
993
994        /**
995         * Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.
996         */
997        @Child(name = "value", type = {BooleanType.class, StringType.class, Quantity.class, Attachment.class, Reference.class}, order=5, min=0, max=1, modifier=false, summary=false)
998        @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." )
999        protected Type value;
1000
1001        /**
1002         * 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.
1003         */
1004        @Child(name = "reason", type = {Coding.class}, order=6, min=0, max=1, modifier=false, summary=false)
1005        @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." )
1006        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/missing-tooth-reason")
1007        protected Coding reason;
1008
1009        private static final long serialVersionUID = -410136661L;
1010
1011    /**
1012     * Constructor
1013     */
1014      public SupportingInformationComponent() {
1015        super();
1016      }
1017
1018    /**
1019     * Constructor
1020     */
1021      public SupportingInformationComponent(PositiveIntType sequence, CodeableConcept category) {
1022        super();
1023        this.sequence = sequence;
1024        this.category = category;
1025      }
1026
1027        /**
1028         * @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
1029         */
1030        public PositiveIntType getSequenceElement() { 
1031          if (this.sequence == null)
1032            if (Configuration.errorOnAutoCreate())
1033              throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
1034            else if (Configuration.doAutoCreate())
1035              this.sequence = new PositiveIntType(); // bb
1036          return this.sequence;
1037        }
1038
1039        public boolean hasSequenceElement() { 
1040          return this.sequence != null && !this.sequence.isEmpty();
1041        }
1042
1043        public boolean hasSequence() { 
1044          return this.sequence != null && !this.sequence.isEmpty();
1045        }
1046
1047        /**
1048         * @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
1049         */
1050        public SupportingInformationComponent setSequenceElement(PositiveIntType value) { 
1051          this.sequence = value;
1052          return this;
1053        }
1054
1055        /**
1056         * @return Sequence of the information element which serves to provide a link.
1057         */
1058        public int getSequence() { 
1059          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1060        }
1061
1062        /**
1063         * @param value Sequence of the information element which serves to provide a link.
1064         */
1065        public SupportingInformationComponent setSequence(int value) { 
1066            if (this.sequence == null)
1067              this.sequence = new PositiveIntType();
1068            this.sequence.setValue(value);
1069          return this;
1070        }
1071
1072        /**
1073         * @return {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1074         */
1075        public CodeableConcept getCategory() { 
1076          if (this.category == null)
1077            if (Configuration.errorOnAutoCreate())
1078              throw new Error("Attempt to auto-create SupportingInformationComponent.category");
1079            else if (Configuration.doAutoCreate())
1080              this.category = new CodeableConcept(); // cc
1081          return this.category;
1082        }
1083
1084        public boolean hasCategory() { 
1085          return this.category != null && !this.category.isEmpty();
1086        }
1087
1088        /**
1089         * @param value {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1090         */
1091        public SupportingInformationComponent setCategory(CodeableConcept value) { 
1092          this.category = value;
1093          return this;
1094        }
1095
1096        /**
1097         * @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.)
1098         */
1099        public CodeableConcept getCode() { 
1100          if (this.code == null)
1101            if (Configuration.errorOnAutoCreate())
1102              throw new Error("Attempt to auto-create SupportingInformationComponent.code");
1103            else if (Configuration.doAutoCreate())
1104              this.code = new CodeableConcept(); // cc
1105          return this.code;
1106        }
1107
1108        public boolean hasCode() { 
1109          return this.code != null && !this.code.isEmpty();
1110        }
1111
1112        /**
1113         * @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.)
1114         */
1115        public SupportingInformationComponent setCode(CodeableConcept value) { 
1116          this.code = value;
1117          return this;
1118        }
1119
1120        /**
1121         * @return {@link #timing} (The date when or period to which this information refers.)
1122         */
1123        public Type getTiming() { 
1124          return this.timing;
1125        }
1126
1127        /**
1128         * @return {@link #timing} (The date when or period to which this information refers.)
1129         */
1130        public DateType getTimingDateType() throws FHIRException { 
1131          if (this.timing == null)
1132            return null;
1133          if (!(this.timing instanceof DateType))
1134            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.timing.getClass().getName()+" was encountered");
1135          return (DateType) this.timing;
1136        }
1137
1138        public boolean hasTimingDateType() { 
1139          return this != null && this.timing instanceof DateType;
1140        }
1141
1142        /**
1143         * @return {@link #timing} (The date when or period to which this information refers.)
1144         */
1145        public Period getTimingPeriod() throws FHIRException { 
1146          if (this.timing == null)
1147            return null;
1148          if (!(this.timing instanceof Period))
1149            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
1150          return (Period) this.timing;
1151        }
1152
1153        public boolean hasTimingPeriod() { 
1154          return this != null && this.timing instanceof Period;
1155        }
1156
1157        public boolean hasTiming() { 
1158          return this.timing != null && !this.timing.isEmpty();
1159        }
1160
1161        /**
1162         * @param value {@link #timing} (The date when or period to which this information refers.)
1163         */
1164        public SupportingInformationComponent setTiming(Type value) { 
1165          if (value != null && !(value instanceof DateType || value instanceof Period))
1166            throw new Error("Not the right type for ExplanationOfBenefit.information.timing[x]: "+value.fhirType());
1167          this.timing = value;
1168          return this;
1169        }
1170
1171        /**
1172         * @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.)
1173         */
1174        public Type getValue() { 
1175          return this.value;
1176        }
1177
1178        /**
1179         * @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.)
1180         */
1181        public BooleanType getValueBooleanType() throws FHIRException { 
1182          if (this.value == null)
1183            return null;
1184          if (!(this.value instanceof BooleanType))
1185            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
1186          return (BooleanType) this.value;
1187        }
1188
1189        public boolean hasValueBooleanType() { 
1190          return this != null && this.value instanceof BooleanType;
1191        }
1192
1193        /**
1194         * @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.)
1195         */
1196        public StringType getValueStringType() throws FHIRException { 
1197          if (this.value == null)
1198            return null;
1199          if (!(this.value instanceof StringType))
1200            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
1201          return (StringType) this.value;
1202        }
1203
1204        public boolean hasValueStringType() { 
1205          return this != null && this.value instanceof StringType;
1206        }
1207
1208        /**
1209         * @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.)
1210         */
1211        public Quantity getValueQuantity() throws FHIRException { 
1212          if (this.value == null)
1213            return null;
1214          if (!(this.value instanceof Quantity))
1215            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
1216          return (Quantity) this.value;
1217        }
1218
1219        public boolean hasValueQuantity() { 
1220          return this != null && this.value instanceof Quantity;
1221        }
1222
1223        /**
1224         * @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.)
1225         */
1226        public Attachment getValueAttachment() throws FHIRException { 
1227          if (this.value == null)
1228            return null;
1229          if (!(this.value instanceof Attachment))
1230            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
1231          return (Attachment) this.value;
1232        }
1233
1234        public boolean hasValueAttachment() { 
1235          return this != null && this.value instanceof Attachment;
1236        }
1237
1238        /**
1239         * @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.)
1240         */
1241        public Reference getValueReference() throws FHIRException { 
1242          if (this.value == null)
1243            return null;
1244          if (!(this.value instanceof Reference))
1245            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
1246          return (Reference) this.value;
1247        }
1248
1249        public boolean hasValueReference() { 
1250          return this != null && this.value instanceof Reference;
1251        }
1252
1253        public boolean hasValue() { 
1254          return this.value != null && !this.value.isEmpty();
1255        }
1256
1257        /**
1258         * @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.)
1259         */
1260        public SupportingInformationComponent setValue(Type value) { 
1261          if (value != null && !(value instanceof BooleanType || value instanceof StringType || value instanceof Quantity || value instanceof Attachment || value instanceof Reference))
1262            throw new Error("Not the right type for ExplanationOfBenefit.information.value[x]: "+value.fhirType());
1263          this.value = value;
1264          return this;
1265        }
1266
1267        /**
1268         * @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.)
1269         */
1270        public Coding getReason() { 
1271          if (this.reason == null)
1272            if (Configuration.errorOnAutoCreate())
1273              throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1274            else if (Configuration.doAutoCreate())
1275              this.reason = new Coding(); // cc
1276          return this.reason;
1277        }
1278
1279        public boolean hasReason() { 
1280          return this.reason != null && !this.reason.isEmpty();
1281        }
1282
1283        /**
1284         * @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.)
1285         */
1286        public SupportingInformationComponent setReason(Coding value) { 
1287          this.reason = value;
1288          return this;
1289        }
1290
1291        protected void listChildren(List<Property> children) {
1292          super.listChildren(children);
1293          children.add(new Property("sequence", "positiveInt", "Sequence of the information element which serves to provide a link.", 0, 1, sequence));
1294          children.add(new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category));
1295          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));
1296          children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing));
1297          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));
1298          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));
1299        }
1300
1301        @Override
1302        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1303          switch (_hash) {
1304          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of the information element which serves to provide a link.", 0, 1, sequence);
1305          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category);
1306          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);
1307          case 164632566: /*timing[x]*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1308          case -873664438: /*timing*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1309          case 807935768: /*timingDate*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1310          case -615615829: /*timingPeriod*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1311          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);
1312          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);
1313          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);
1314          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);
1315          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);
1316          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);
1317          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);
1318          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);
1319          default: return super.getNamedProperty(_hash, _name, _checkValid);
1320          }
1321
1322        }
1323
1324      @Override
1325      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1326        switch (hash) {
1327        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1328        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1329        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1330        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Type
1331        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
1332        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
1333        default: return super.getProperty(hash, name, checkValid);
1334        }
1335
1336      }
1337
1338      @Override
1339      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1340        switch (hash) {
1341        case 1349547969: // sequence
1342          this.sequence = castToPositiveInt(value); // PositiveIntType
1343          return value;
1344        case 50511102: // category
1345          this.category = castToCodeableConcept(value); // CodeableConcept
1346          return value;
1347        case 3059181: // code
1348          this.code = castToCodeableConcept(value); // CodeableConcept
1349          return value;
1350        case -873664438: // timing
1351          this.timing = castToType(value); // Type
1352          return value;
1353        case 111972721: // value
1354          this.value = castToType(value); // Type
1355          return value;
1356        case -934964668: // reason
1357          this.reason = castToCoding(value); // Coding
1358          return value;
1359        default: return super.setProperty(hash, name, value);
1360        }
1361
1362      }
1363
1364      @Override
1365      public Base setProperty(String name, Base value) throws FHIRException {
1366        if (name.equals("sequence")) {
1367          this.sequence = castToPositiveInt(value); // PositiveIntType
1368        } else if (name.equals("category")) {
1369          this.category = castToCodeableConcept(value); // CodeableConcept
1370        } else if (name.equals("code")) {
1371          this.code = castToCodeableConcept(value); // CodeableConcept
1372        } else if (name.equals("timing[x]")) {
1373          this.timing = castToType(value); // Type
1374        } else if (name.equals("value[x]")) {
1375          this.value = castToType(value); // Type
1376        } else if (name.equals("reason")) {
1377          this.reason = castToCoding(value); // Coding
1378        } else
1379          return super.setProperty(name, value);
1380        return value;
1381      }
1382
1383      @Override
1384      public Base makeProperty(int hash, String name) throws FHIRException {
1385        switch (hash) {
1386        case 1349547969:  return getSequenceElement();
1387        case 50511102:  return getCategory(); 
1388        case 3059181:  return getCode(); 
1389        case 164632566:  return getTiming(); 
1390        case -873664438:  return getTiming(); 
1391        case -1410166417:  return getValue(); 
1392        case 111972721:  return getValue(); 
1393        case -934964668:  return getReason(); 
1394        default: return super.makeProperty(hash, name);
1395        }
1396
1397      }
1398
1399      @Override
1400      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1401        switch (hash) {
1402        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1403        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1404        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1405        case -873664438: /*timing*/ return new String[] {"date", "Period"};
1406        case 111972721: /*value*/ return new String[] {"boolean", "string", "Quantity", "Attachment", "Reference"};
1407        case -934964668: /*reason*/ return new String[] {"Coding"};
1408        default: return super.getTypesForProperty(hash, name);
1409        }
1410
1411      }
1412
1413      @Override
1414      public Base addChild(String name) throws FHIRException {
1415        if (name.equals("sequence")) {
1416          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1417        }
1418        else if (name.equals("category")) {
1419          this.category = new CodeableConcept();
1420          return this.category;
1421        }
1422        else if (name.equals("code")) {
1423          this.code = new CodeableConcept();
1424          return this.code;
1425        }
1426        else if (name.equals("timingDate")) {
1427          this.timing = new DateType();
1428          return this.timing;
1429        }
1430        else if (name.equals("timingPeriod")) {
1431          this.timing = new Period();
1432          return this.timing;
1433        }
1434        else if (name.equals("valueBoolean")) {
1435          this.value = new BooleanType();
1436          return this.value;
1437        }
1438        else if (name.equals("valueString")) {
1439          this.value = new StringType();
1440          return this.value;
1441        }
1442        else if (name.equals("valueQuantity")) {
1443          this.value = new Quantity();
1444          return this.value;
1445        }
1446        else if (name.equals("valueAttachment")) {
1447          this.value = new Attachment();
1448          return this.value;
1449        }
1450        else if (name.equals("valueReference")) {
1451          this.value = new Reference();
1452          return this.value;
1453        }
1454        else if (name.equals("reason")) {
1455          this.reason = new Coding();
1456          return this.reason;
1457        }
1458        else
1459          return super.addChild(name);
1460      }
1461
1462      public SupportingInformationComponent copy() {
1463        SupportingInformationComponent dst = new SupportingInformationComponent();
1464        copyValues(dst);
1465        dst.sequence = sequence == null ? null : sequence.copy();
1466        dst.category = category == null ? null : category.copy();
1467        dst.code = code == null ? null : code.copy();
1468        dst.timing = timing == null ? null : timing.copy();
1469        dst.value = value == null ? null : value.copy();
1470        dst.reason = reason == null ? null : reason.copy();
1471        return dst;
1472      }
1473
1474      @Override
1475      public boolean equalsDeep(Base other_) {
1476        if (!super.equalsDeep(other_))
1477          return false;
1478        if (!(other_ instanceof SupportingInformationComponent))
1479          return false;
1480        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1481        return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true) && compareDeep(code, o.code, true)
1482           && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true) && compareDeep(reason, o.reason, true)
1483          ;
1484      }
1485
1486      @Override
1487      public boolean equalsShallow(Base other_) {
1488        if (!super.equalsShallow(other_))
1489          return false;
1490        if (!(other_ instanceof SupportingInformationComponent))
1491          return false;
1492        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1493        return compareValues(sequence, o.sequence, true);
1494      }
1495
1496      public boolean isEmpty() {
1497        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code
1498          , timing, value, reason);
1499      }
1500
1501  public String fhirType() {
1502    return "ExplanationOfBenefit.information";
1503
1504  }
1505
1506  }
1507
1508    @Block()
1509    public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
1510        /**
1511         * Sequence of careteam which serves to order and provide a link.
1512         */
1513        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1514        @Description(shortDefinition="Number to convey order of careteam", formalDefinition="Sequence of careteam which serves to order and provide a link." )
1515        protected PositiveIntType sequence;
1516
1517        /**
1518         * The members of the team who provided the overall service.
1519         */
1520        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=2, min=1, max=1, modifier=false, summary=false)
1521        @Description(shortDefinition="Member of the Care Team", formalDefinition="The members of the team who provided the overall service." )
1522        protected Reference provider;
1523
1524        /**
1525         * The actual object that is the target of the reference (The members of the team who provided the overall service.)
1526         */
1527        protected Resource providerTarget;
1528
1529        /**
1530         * The practitioner who is billing and responsible for the claimed services rendered to the patient.
1531         */
1532        @Child(name = "responsible", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
1533        @Description(shortDefinition="Billing practitioner", formalDefinition="The practitioner who is billing and responsible for the claimed services rendered to the patient." )
1534        protected BooleanType responsible;
1535
1536        /**
1537         * The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.
1538         */
1539        @Child(name = "role", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1540        @Description(shortDefinition="Role on the team", formalDefinition="The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team." )
1541        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-careteamrole")
1542        protected CodeableConcept role;
1543
1544        /**
1545         * The qualification which is applicable for this service.
1546         */
1547        @Child(name = "qualification", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1548        @Description(shortDefinition="Type, classification or Specialization", formalDefinition="The qualification which is applicable for this service." )
1549        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provider-qualification")
1550        protected CodeableConcept qualification;
1551
1552        private static final long serialVersionUID = 1758966968L;
1553
1554    /**
1555     * Constructor
1556     */
1557      public CareTeamComponent() {
1558        super();
1559      }
1560
1561    /**
1562     * Constructor
1563     */
1564      public CareTeamComponent(PositiveIntType sequence, Reference provider) {
1565        super();
1566        this.sequence = sequence;
1567        this.provider = provider;
1568      }
1569
1570        /**
1571         * @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
1572         */
1573        public PositiveIntType getSequenceElement() { 
1574          if (this.sequence == null)
1575            if (Configuration.errorOnAutoCreate())
1576              throw new Error("Attempt to auto-create CareTeamComponent.sequence");
1577            else if (Configuration.doAutoCreate())
1578              this.sequence = new PositiveIntType(); // bb
1579          return this.sequence;
1580        }
1581
1582        public boolean hasSequenceElement() { 
1583          return this.sequence != null && !this.sequence.isEmpty();
1584        }
1585
1586        public boolean hasSequence() { 
1587          return this.sequence != null && !this.sequence.isEmpty();
1588        }
1589
1590        /**
1591         * @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
1592         */
1593        public CareTeamComponent setSequenceElement(PositiveIntType value) { 
1594          this.sequence = value;
1595          return this;
1596        }
1597
1598        /**
1599         * @return Sequence of careteam which serves to order and provide a link.
1600         */
1601        public int getSequence() { 
1602          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1603        }
1604
1605        /**
1606         * @param value Sequence of careteam which serves to order and provide a link.
1607         */
1608        public CareTeamComponent setSequence(int value) { 
1609            if (this.sequence == null)
1610              this.sequence = new PositiveIntType();
1611            this.sequence.setValue(value);
1612          return this;
1613        }
1614
1615        /**
1616         * @return {@link #provider} (The members of the team who provided the overall service.)
1617         */
1618        public Reference getProvider() { 
1619          if (this.provider == null)
1620            if (Configuration.errorOnAutoCreate())
1621              throw new Error("Attempt to auto-create CareTeamComponent.provider");
1622            else if (Configuration.doAutoCreate())
1623              this.provider = new Reference(); // cc
1624          return this.provider;
1625        }
1626
1627        public boolean hasProvider() { 
1628          return this.provider != null && !this.provider.isEmpty();
1629        }
1630
1631        /**
1632         * @param value {@link #provider} (The members of the team who provided the overall service.)
1633         */
1634        public CareTeamComponent setProvider(Reference value) { 
1635          this.provider = value;
1636          return this;
1637        }
1638
1639        /**
1640         * @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.)
1641         */
1642        public Resource getProviderTarget() { 
1643          return this.providerTarget;
1644        }
1645
1646        /**
1647         * @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.)
1648         */
1649        public CareTeamComponent setProviderTarget(Resource value) { 
1650          this.providerTarget = value;
1651          return this;
1652        }
1653
1654        /**
1655         * @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
1656         */
1657        public BooleanType getResponsibleElement() { 
1658          if (this.responsible == null)
1659            if (Configuration.errorOnAutoCreate())
1660              throw new Error("Attempt to auto-create CareTeamComponent.responsible");
1661            else if (Configuration.doAutoCreate())
1662              this.responsible = new BooleanType(); // bb
1663          return this.responsible;
1664        }
1665
1666        public boolean hasResponsibleElement() { 
1667          return this.responsible != null && !this.responsible.isEmpty();
1668        }
1669
1670        public boolean hasResponsible() { 
1671          return this.responsible != null && !this.responsible.isEmpty();
1672        }
1673
1674        /**
1675         * @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
1676         */
1677        public CareTeamComponent setResponsibleElement(BooleanType value) { 
1678          this.responsible = value;
1679          return this;
1680        }
1681
1682        /**
1683         * @return The practitioner who is billing and responsible for the claimed services rendered to the patient.
1684         */
1685        public boolean getResponsible() { 
1686          return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
1687        }
1688
1689        /**
1690         * @param value The practitioner who is billing and responsible for the claimed services rendered to the patient.
1691         */
1692        public CareTeamComponent setResponsible(boolean value) { 
1693            if (this.responsible == null)
1694              this.responsible = new BooleanType();
1695            this.responsible.setValue(value);
1696          return this;
1697        }
1698
1699        /**
1700         * @return {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.)
1701         */
1702        public CodeableConcept getRole() { 
1703          if (this.role == null)
1704            if (Configuration.errorOnAutoCreate())
1705              throw new Error("Attempt to auto-create CareTeamComponent.role");
1706            else if (Configuration.doAutoCreate())
1707              this.role = new CodeableConcept(); // cc
1708          return this.role;
1709        }
1710
1711        public boolean hasRole() { 
1712          return this.role != null && !this.role.isEmpty();
1713        }
1714
1715        /**
1716         * @param value {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.)
1717         */
1718        public CareTeamComponent setRole(CodeableConcept value) { 
1719          this.role = value;
1720          return this;
1721        }
1722
1723        /**
1724         * @return {@link #qualification} (The qualification which is applicable for this service.)
1725         */
1726        public CodeableConcept getQualification() { 
1727          if (this.qualification == null)
1728            if (Configuration.errorOnAutoCreate())
1729              throw new Error("Attempt to auto-create CareTeamComponent.qualification");
1730            else if (Configuration.doAutoCreate())
1731              this.qualification = new CodeableConcept(); // cc
1732          return this.qualification;
1733        }
1734
1735        public boolean hasQualification() { 
1736          return this.qualification != null && !this.qualification.isEmpty();
1737        }
1738
1739        /**
1740         * @param value {@link #qualification} (The qualification which is applicable for this service.)
1741         */
1742        public CareTeamComponent setQualification(CodeableConcept value) { 
1743          this.qualification = value;
1744          return this;
1745        }
1746
1747        protected void listChildren(List<Property> children) {
1748          super.listChildren(children);
1749          children.add(new Property("sequence", "positiveInt", "Sequence of careteam which serves to order and provide a link.", 0, 1, sequence));
1750          children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The members of the team who provided the overall service.", 0, 1, provider));
1751          children.add(new Property("responsible", "boolean", "The practitioner who is billing and responsible for the claimed services rendered to the patient.", 0, 1, responsible));
1752          children.add(new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.", 0, 1, role));
1753          children.add(new Property("qualification", "CodeableConcept", "The qualification which is applicable for this service.", 0, 1, qualification));
1754        }
1755
1756        @Override
1757        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1758          switch (_hash) {
1759          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of careteam which serves to order and provide a link.", 0, 1, sequence);
1760          case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The members of the team who provided the overall service.", 0, 1, provider);
1761          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);
1762          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.", 0, 1, role);
1763          case -631333393: /*qualification*/  return new Property("qualification", "CodeableConcept", "The qualification which is applicable for this service.", 0, 1, qualification);
1764          default: return super.getNamedProperty(_hash, _name, _checkValid);
1765          }
1766
1767        }
1768
1769      @Override
1770      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1771        switch (hash) {
1772        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1773        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
1774        case 1847674614: /*responsible*/ return this.responsible == null ? new Base[0] : new Base[] {this.responsible}; // BooleanType
1775        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
1776        case -631333393: /*qualification*/ return this.qualification == null ? new Base[0] : new Base[] {this.qualification}; // CodeableConcept
1777        default: return super.getProperty(hash, name, checkValid);
1778        }
1779
1780      }
1781
1782      @Override
1783      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1784        switch (hash) {
1785        case 1349547969: // sequence
1786          this.sequence = castToPositiveInt(value); // PositiveIntType
1787          return value;
1788        case -987494927: // provider
1789          this.provider = castToReference(value); // Reference
1790          return value;
1791        case 1847674614: // responsible
1792          this.responsible = castToBoolean(value); // BooleanType
1793          return value;
1794        case 3506294: // role
1795          this.role = castToCodeableConcept(value); // CodeableConcept
1796          return value;
1797        case -631333393: // qualification
1798          this.qualification = castToCodeableConcept(value); // CodeableConcept
1799          return value;
1800        default: return super.setProperty(hash, name, value);
1801        }
1802
1803      }
1804
1805      @Override
1806      public Base setProperty(String name, Base value) throws FHIRException {
1807        if (name.equals("sequence")) {
1808          this.sequence = castToPositiveInt(value); // PositiveIntType
1809        } else if (name.equals("provider")) {
1810          this.provider = castToReference(value); // Reference
1811        } else if (name.equals("responsible")) {
1812          this.responsible = castToBoolean(value); // BooleanType
1813        } else if (name.equals("role")) {
1814          this.role = castToCodeableConcept(value); // CodeableConcept
1815        } else if (name.equals("qualification")) {
1816          this.qualification = castToCodeableConcept(value); // CodeableConcept
1817        } else
1818          return super.setProperty(name, value);
1819        return value;
1820      }
1821
1822      @Override
1823      public Base makeProperty(int hash, String name) throws FHIRException {
1824        switch (hash) {
1825        case 1349547969:  return getSequenceElement();
1826        case -987494927:  return getProvider(); 
1827        case 1847674614:  return getResponsibleElement();
1828        case 3506294:  return getRole(); 
1829        case -631333393:  return getQualification(); 
1830        default: return super.makeProperty(hash, name);
1831        }
1832
1833      }
1834
1835      @Override
1836      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1837        switch (hash) {
1838        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1839        case -987494927: /*provider*/ return new String[] {"Reference"};
1840        case 1847674614: /*responsible*/ return new String[] {"boolean"};
1841        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
1842        case -631333393: /*qualification*/ return new String[] {"CodeableConcept"};
1843        default: return super.getTypesForProperty(hash, name);
1844        }
1845
1846      }
1847
1848      @Override
1849      public Base addChild(String name) throws FHIRException {
1850        if (name.equals("sequence")) {
1851          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1852        }
1853        else if (name.equals("provider")) {
1854          this.provider = new Reference();
1855          return this.provider;
1856        }
1857        else if (name.equals("responsible")) {
1858          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.responsible");
1859        }
1860        else if (name.equals("role")) {
1861          this.role = new CodeableConcept();
1862          return this.role;
1863        }
1864        else if (name.equals("qualification")) {
1865          this.qualification = new CodeableConcept();
1866          return this.qualification;
1867        }
1868        else
1869          return super.addChild(name);
1870      }
1871
1872      public CareTeamComponent copy() {
1873        CareTeamComponent dst = new CareTeamComponent();
1874        copyValues(dst);
1875        dst.sequence = sequence == null ? null : sequence.copy();
1876        dst.provider = provider == null ? null : provider.copy();
1877        dst.responsible = responsible == null ? null : responsible.copy();
1878        dst.role = role == null ? null : role.copy();
1879        dst.qualification = qualification == null ? null : qualification.copy();
1880        return dst;
1881      }
1882
1883      @Override
1884      public boolean equalsDeep(Base other_) {
1885        if (!super.equalsDeep(other_))
1886          return false;
1887        if (!(other_ instanceof CareTeamComponent))
1888          return false;
1889        CareTeamComponent o = (CareTeamComponent) other_;
1890        return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true) && compareDeep(responsible, o.responsible, true)
1891           && compareDeep(role, o.role, true) && compareDeep(qualification, o.qualification, true);
1892      }
1893
1894      @Override
1895      public boolean equalsShallow(Base other_) {
1896        if (!super.equalsShallow(other_))
1897          return false;
1898        if (!(other_ instanceof CareTeamComponent))
1899          return false;
1900        CareTeamComponent o = (CareTeamComponent) other_;
1901        return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true)
1902          ;
1903      }
1904
1905      public boolean isEmpty() {
1906        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible
1907          , role, qualification);
1908      }
1909
1910  public String fhirType() {
1911    return "ExplanationOfBenefit.careTeam";
1912
1913  }
1914
1915  }
1916
1917    @Block()
1918    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
1919        /**
1920         * Sequence of diagnosis which serves to provide a link.
1921         */
1922        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1923        @Description(shortDefinition="Number to convey order of diagnosis", formalDefinition="Sequence of diagnosis which serves to provide a link." )
1924        protected PositiveIntType sequence;
1925
1926        /**
1927         * The diagnosis.
1928         */
1929        @Child(name = "diagnosis", type = {CodeableConcept.class, Condition.class}, order=2, min=1, max=1, modifier=false, summary=false)
1930        @Description(shortDefinition="Patient's diagnosis", formalDefinition="The diagnosis." )
1931        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10")
1932        protected Type diagnosis;
1933
1934        /**
1935         * The type of the Diagnosis, for example: admitting, primary, secondary, discharge.
1936         */
1937        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1938        @Description(shortDefinition="Timing or nature of the diagnosis", formalDefinition="The type of the Diagnosis, for example: admitting, primary, secondary, discharge." )
1939        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosistype")
1940        protected List<CodeableConcept> type;
1941
1942        /**
1943         * The package billing code, for example DRG, based on the assigned grouping code system.
1944         */
1945        @Child(name = "packageCode", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1946        @Description(shortDefinition="Package billing code", formalDefinition="The package billing code, for example DRG, based on the assigned grouping code system." )
1947        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
1948        protected CodeableConcept packageCode;
1949
1950        private static final long serialVersionUID = -350960873L;
1951
1952    /**
1953     * Constructor
1954     */
1955      public DiagnosisComponent() {
1956        super();
1957      }
1958
1959    /**
1960     * Constructor
1961     */
1962      public DiagnosisComponent(PositiveIntType sequence, Type diagnosis) {
1963        super();
1964        this.sequence = sequence;
1965        this.diagnosis = diagnosis;
1966      }
1967
1968        /**
1969         * @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
1970         */
1971        public PositiveIntType getSequenceElement() { 
1972          if (this.sequence == null)
1973            if (Configuration.errorOnAutoCreate())
1974              throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
1975            else if (Configuration.doAutoCreate())
1976              this.sequence = new PositiveIntType(); // bb
1977          return this.sequence;
1978        }
1979
1980        public boolean hasSequenceElement() { 
1981          return this.sequence != null && !this.sequence.isEmpty();
1982        }
1983
1984        public boolean hasSequence() { 
1985          return this.sequence != null && !this.sequence.isEmpty();
1986        }
1987
1988        /**
1989         * @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
1990         */
1991        public DiagnosisComponent setSequenceElement(PositiveIntType value) { 
1992          this.sequence = value;
1993          return this;
1994        }
1995
1996        /**
1997         * @return Sequence of diagnosis which serves to provide a link.
1998         */
1999        public int getSequence() { 
2000          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2001        }
2002
2003        /**
2004         * @param value Sequence of diagnosis which serves to provide a link.
2005         */
2006        public DiagnosisComponent setSequence(int value) { 
2007            if (this.sequence == null)
2008              this.sequence = new PositiveIntType();
2009            this.sequence.setValue(value);
2010          return this;
2011        }
2012
2013        /**
2014         * @return {@link #diagnosis} (The diagnosis.)
2015         */
2016        public Type getDiagnosis() { 
2017          return this.diagnosis;
2018        }
2019
2020        /**
2021         * @return {@link #diagnosis} (The diagnosis.)
2022         */
2023        public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException { 
2024          if (this.diagnosis == null)
2025            return null;
2026          if (!(this.diagnosis instanceof CodeableConcept))
2027            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
2028          return (CodeableConcept) this.diagnosis;
2029        }
2030
2031        public boolean hasDiagnosisCodeableConcept() { 
2032          return this != null && this.diagnosis instanceof CodeableConcept;
2033        }
2034
2035        /**
2036         * @return {@link #diagnosis} (The diagnosis.)
2037         */
2038        public Reference getDiagnosisReference() throws FHIRException { 
2039          if (this.diagnosis == null)
2040            return null;
2041          if (!(this.diagnosis instanceof Reference))
2042            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
2043          return (Reference) this.diagnosis;
2044        }
2045
2046        public boolean hasDiagnosisReference() { 
2047          return this != null && this.diagnosis instanceof Reference;
2048        }
2049
2050        public boolean hasDiagnosis() { 
2051          return this.diagnosis != null && !this.diagnosis.isEmpty();
2052        }
2053
2054        /**
2055         * @param value {@link #diagnosis} (The diagnosis.)
2056         */
2057        public DiagnosisComponent setDiagnosis(Type value) { 
2058          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2059            throw new Error("Not the right type for ExplanationOfBenefit.diagnosis.diagnosis[x]: "+value.fhirType());
2060          this.diagnosis = value;
2061          return this;
2062        }
2063
2064        /**
2065         * @return {@link #type} (The type of the Diagnosis, for example: admitting, primary, secondary, discharge.)
2066         */
2067        public List<CodeableConcept> getType() { 
2068          if (this.type == null)
2069            this.type = new ArrayList<CodeableConcept>();
2070          return this.type;
2071        }
2072
2073        /**
2074         * @return Returns a reference to <code>this</code> for easy method chaining
2075         */
2076        public DiagnosisComponent setType(List<CodeableConcept> theType) { 
2077          this.type = theType;
2078          return this;
2079        }
2080
2081        public boolean hasType() { 
2082          if (this.type == null)
2083            return false;
2084          for (CodeableConcept item : this.type)
2085            if (!item.isEmpty())
2086              return true;
2087          return false;
2088        }
2089
2090        public CodeableConcept addType() { //3
2091          CodeableConcept t = new CodeableConcept();
2092          if (this.type == null)
2093            this.type = new ArrayList<CodeableConcept>();
2094          this.type.add(t);
2095          return t;
2096        }
2097
2098        public DiagnosisComponent addType(CodeableConcept t) { //3
2099          if (t == null)
2100            return this;
2101          if (this.type == null)
2102            this.type = new ArrayList<CodeableConcept>();
2103          this.type.add(t);
2104          return this;
2105        }
2106
2107        /**
2108         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
2109         */
2110        public CodeableConcept getTypeFirstRep() { 
2111          if (getType().isEmpty()) {
2112            addType();
2113          }
2114          return getType().get(0);
2115        }
2116
2117        /**
2118         * @return {@link #packageCode} (The package billing code, for example DRG, based on the assigned grouping code system.)
2119         */
2120        public CodeableConcept getPackageCode() { 
2121          if (this.packageCode == null)
2122            if (Configuration.errorOnAutoCreate())
2123              throw new Error("Attempt to auto-create DiagnosisComponent.packageCode");
2124            else if (Configuration.doAutoCreate())
2125              this.packageCode = new CodeableConcept(); // cc
2126          return this.packageCode;
2127        }
2128
2129        public boolean hasPackageCode() { 
2130          return this.packageCode != null && !this.packageCode.isEmpty();
2131        }
2132
2133        /**
2134         * @param value {@link #packageCode} (The package billing code, for example DRG, based on the assigned grouping code system.)
2135         */
2136        public DiagnosisComponent setPackageCode(CodeableConcept value) { 
2137          this.packageCode = value;
2138          return this;
2139        }
2140
2141        protected void listChildren(List<Property> children) {
2142          super.listChildren(children);
2143          children.add(new Property("sequence", "positiveInt", "Sequence of diagnosis which serves to provide a link.", 0, 1, sequence));
2144          children.add(new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis));
2145          children.add(new Property("type", "CodeableConcept", "The type of the Diagnosis, for example: admitting, primary, secondary, discharge.", 0, java.lang.Integer.MAX_VALUE, type));
2146          children.add(new Property("packageCode", "CodeableConcept", "The package billing code, for example DRG, based on the assigned grouping code system.", 0, 1, packageCode));
2147        }
2148
2149        @Override
2150        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2151          switch (_hash) {
2152          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of diagnosis which serves to provide a link.", 0, 1, sequence);
2153          case -1487009809: /*diagnosis[x]*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
2154          case 1196993265: /*diagnosis*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
2155          case 277781616: /*diagnosisCodeableConcept*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
2156          case 2050454362: /*diagnosisReference*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The diagnosis.", 0, 1, diagnosis);
2157          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);
2158          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);
2159          default: return super.getNamedProperty(_hash, _name, _checkValid);
2160          }
2161
2162        }
2163
2164      @Override
2165      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2166        switch (hash) {
2167        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2168        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // Type
2169        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2170        case 908444499: /*packageCode*/ return this.packageCode == null ? new Base[0] : new Base[] {this.packageCode}; // CodeableConcept
2171        default: return super.getProperty(hash, name, checkValid);
2172        }
2173
2174      }
2175
2176      @Override
2177      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2178        switch (hash) {
2179        case 1349547969: // sequence
2180          this.sequence = castToPositiveInt(value); // PositiveIntType
2181          return value;
2182        case 1196993265: // diagnosis
2183          this.diagnosis = castToType(value); // Type
2184          return value;
2185        case 3575610: // type
2186          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
2187          return value;
2188        case 908444499: // packageCode
2189          this.packageCode = castToCodeableConcept(value); // CodeableConcept
2190          return value;
2191        default: return super.setProperty(hash, name, value);
2192        }
2193
2194      }
2195
2196      @Override
2197      public Base setProperty(String name, Base value) throws FHIRException {
2198        if (name.equals("sequence")) {
2199          this.sequence = castToPositiveInt(value); // PositiveIntType
2200        } else if (name.equals("diagnosis[x]")) {
2201          this.diagnosis = castToType(value); // Type
2202        } else if (name.equals("type")) {
2203          this.getType().add(castToCodeableConcept(value));
2204        } else if (name.equals("packageCode")) {
2205          this.packageCode = castToCodeableConcept(value); // CodeableConcept
2206        } else
2207          return super.setProperty(name, value);
2208        return value;
2209      }
2210
2211      @Override
2212      public Base makeProperty(int hash, String name) throws FHIRException {
2213        switch (hash) {
2214        case 1349547969:  return getSequenceElement();
2215        case -1487009809:  return getDiagnosis(); 
2216        case 1196993265:  return getDiagnosis(); 
2217        case 3575610:  return addType(); 
2218        case 908444499:  return getPackageCode(); 
2219        default: return super.makeProperty(hash, name);
2220        }
2221
2222      }
2223
2224      @Override
2225      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2226        switch (hash) {
2227        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2228        case 1196993265: /*diagnosis*/ return new String[] {"CodeableConcept", "Reference"};
2229        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2230        case 908444499: /*packageCode*/ return new String[] {"CodeableConcept"};
2231        default: return super.getTypesForProperty(hash, name);
2232        }
2233
2234      }
2235
2236      @Override
2237      public Base addChild(String name) throws FHIRException {
2238        if (name.equals("sequence")) {
2239          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
2240        }
2241        else if (name.equals("diagnosisCodeableConcept")) {
2242          this.diagnosis = new CodeableConcept();
2243          return this.diagnosis;
2244        }
2245        else if (name.equals("diagnosisReference")) {
2246          this.diagnosis = new Reference();
2247          return this.diagnosis;
2248        }
2249        else if (name.equals("type")) {
2250          return addType();
2251        }
2252        else if (name.equals("packageCode")) {
2253          this.packageCode = new CodeableConcept();
2254          return this.packageCode;
2255        }
2256        else
2257          return super.addChild(name);
2258      }
2259
2260      public DiagnosisComponent copy() {
2261        DiagnosisComponent dst = new DiagnosisComponent();
2262        copyValues(dst);
2263        dst.sequence = sequence == null ? null : sequence.copy();
2264        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
2265        if (type != null) {
2266          dst.type = new ArrayList<CodeableConcept>();
2267          for (CodeableConcept i : type)
2268            dst.type.add(i.copy());
2269        };
2270        dst.packageCode = packageCode == null ? null : packageCode.copy();
2271        return dst;
2272      }
2273
2274      @Override
2275      public boolean equalsDeep(Base other_) {
2276        if (!super.equalsDeep(other_))
2277          return false;
2278        if (!(other_ instanceof DiagnosisComponent))
2279          return false;
2280        DiagnosisComponent o = (DiagnosisComponent) other_;
2281        return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(type, o.type, true)
2282           && compareDeep(packageCode, o.packageCode, true);
2283      }
2284
2285      @Override
2286      public boolean equalsShallow(Base other_) {
2287        if (!super.equalsShallow(other_))
2288          return false;
2289        if (!(other_ instanceof DiagnosisComponent))
2290          return false;
2291        DiagnosisComponent o = (DiagnosisComponent) other_;
2292        return compareValues(sequence, o.sequence, true);
2293      }
2294
2295      public boolean isEmpty() {
2296        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type
2297          , packageCode);
2298      }
2299
2300  public String fhirType() {
2301    return "ExplanationOfBenefit.diagnosis";
2302
2303  }
2304
2305  }
2306
2307    @Block()
2308    public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
2309        /**
2310         * Sequence of procedures which serves to order and provide a link.
2311         */
2312        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2313        @Description(shortDefinition="Procedure sequence for reference", formalDefinition="Sequence of procedures which serves to order and provide a link." )
2314        protected PositiveIntType sequence;
2315
2316        /**
2317         * Date and optionally time the procedure was performed .
2318         */
2319        @Child(name = "date", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
2320        @Description(shortDefinition="When the procedure was performed", formalDefinition="Date and optionally time the procedure was performed ." )
2321        protected DateTimeType date;
2322
2323        /**
2324         * The procedure code.
2325         */
2326        @Child(name = "procedure", type = {CodeableConcept.class, Procedure.class}, order=3, min=1, max=1, modifier=false, summary=false)
2327        @Description(shortDefinition="Patient's list of procedures performed", formalDefinition="The procedure code." )
2328        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10-procedures")
2329        protected Type procedure;
2330
2331        private static final long serialVersionUID = 864307347L;
2332
2333    /**
2334     * Constructor
2335     */
2336      public ProcedureComponent() {
2337        super();
2338      }
2339
2340    /**
2341     * Constructor
2342     */
2343      public ProcedureComponent(PositiveIntType sequence, Type procedure) {
2344        super();
2345        this.sequence = sequence;
2346        this.procedure = procedure;
2347      }
2348
2349        /**
2350         * @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
2351         */
2352        public PositiveIntType getSequenceElement() { 
2353          if (this.sequence == null)
2354            if (Configuration.errorOnAutoCreate())
2355              throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2356            else if (Configuration.doAutoCreate())
2357              this.sequence = new PositiveIntType(); // bb
2358          return this.sequence;
2359        }
2360
2361        public boolean hasSequenceElement() { 
2362          return this.sequence != null && !this.sequence.isEmpty();
2363        }
2364
2365        public boolean hasSequence() { 
2366          return this.sequence != null && !this.sequence.isEmpty();
2367        }
2368
2369        /**
2370         * @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
2371         */
2372        public ProcedureComponent setSequenceElement(PositiveIntType value) { 
2373          this.sequence = value;
2374          return this;
2375        }
2376
2377        /**
2378         * @return Sequence of procedures which serves to order and provide a link.
2379         */
2380        public int getSequence() { 
2381          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2382        }
2383
2384        /**
2385         * @param value Sequence of procedures which serves to order and provide a link.
2386         */
2387        public ProcedureComponent setSequence(int value) { 
2388            if (this.sequence == null)
2389              this.sequence = new PositiveIntType();
2390            this.sequence.setValue(value);
2391          return this;
2392        }
2393
2394        /**
2395         * @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
2396         */
2397        public DateTimeType getDateElement() { 
2398          if (this.date == null)
2399            if (Configuration.errorOnAutoCreate())
2400              throw new Error("Attempt to auto-create ProcedureComponent.date");
2401            else if (Configuration.doAutoCreate())
2402              this.date = new DateTimeType(); // bb
2403          return this.date;
2404        }
2405
2406        public boolean hasDateElement() { 
2407          return this.date != null && !this.date.isEmpty();
2408        }
2409
2410        public boolean hasDate() { 
2411          return this.date != null && !this.date.isEmpty();
2412        }
2413
2414        /**
2415         * @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
2416         */
2417        public ProcedureComponent setDateElement(DateTimeType value) { 
2418          this.date = value;
2419          return this;
2420        }
2421
2422        /**
2423         * @return Date and optionally time the procedure was performed .
2424         */
2425        public Date getDate() { 
2426          return this.date == null ? null : this.date.getValue();
2427        }
2428
2429        /**
2430         * @param value Date and optionally time the procedure was performed .
2431         */
2432        public ProcedureComponent setDate(Date value) { 
2433          if (value == null)
2434            this.date = null;
2435          else {
2436            if (this.date == null)
2437              this.date = new DateTimeType();
2438            this.date.setValue(value);
2439          }
2440          return this;
2441        }
2442
2443        /**
2444         * @return {@link #procedure} (The procedure code.)
2445         */
2446        public Type getProcedure() { 
2447          return this.procedure;
2448        }
2449
2450        /**
2451         * @return {@link #procedure} (The procedure code.)
2452         */
2453        public CodeableConcept getProcedureCodeableConcept() throws FHIRException { 
2454          if (this.procedure == null)
2455            return null;
2456          if (!(this.procedure instanceof CodeableConcept))
2457            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.procedure.getClass().getName()+" was encountered");
2458          return (CodeableConcept) this.procedure;
2459        }
2460
2461        public boolean hasProcedureCodeableConcept() { 
2462          return this != null && this.procedure instanceof CodeableConcept;
2463        }
2464
2465        /**
2466         * @return {@link #procedure} (The procedure code.)
2467         */
2468        public Reference getProcedureReference() throws FHIRException { 
2469          if (this.procedure == null)
2470            return null;
2471          if (!(this.procedure instanceof Reference))
2472            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.procedure.getClass().getName()+" was encountered");
2473          return (Reference) this.procedure;
2474        }
2475
2476        public boolean hasProcedureReference() { 
2477          return this != null && this.procedure instanceof Reference;
2478        }
2479
2480        public boolean hasProcedure() { 
2481          return this.procedure != null && !this.procedure.isEmpty();
2482        }
2483
2484        /**
2485         * @param value {@link #procedure} (The procedure code.)
2486         */
2487        public ProcedureComponent setProcedure(Type value) { 
2488          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2489            throw new Error("Not the right type for ExplanationOfBenefit.procedure.procedure[x]: "+value.fhirType());
2490          this.procedure = value;
2491          return this;
2492        }
2493
2494        protected void listChildren(List<Property> children) {
2495          super.listChildren(children);
2496          children.add(new Property("sequence", "positiveInt", "Sequence of procedures which serves to order and provide a link.", 0, 1, sequence));
2497          children.add(new Property("date", "dateTime", "Date and optionally time the procedure was performed .", 0, 1, date));
2498          children.add(new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure));
2499        }
2500
2501        @Override
2502        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2503          switch (_hash) {
2504          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "Sequence of procedures which serves to order and provide a link.", 0, 1, sequence);
2505          case 3076014: /*date*/  return new Property("date", "dateTime", "Date and optionally time the procedure was performed .", 0, 1, date);
2506          case 1640074445: /*procedure[x]*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2507          case -1095204141: /*procedure*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2508          case -1284783026: /*procedureCodeableConcept*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2509          case 881809848: /*procedureReference*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The procedure code.", 0, 1, procedure);
2510          default: return super.getNamedProperty(_hash, _name, _checkValid);
2511          }
2512
2513        }
2514
2515      @Override
2516      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2517        switch (hash) {
2518        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2519        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2520        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // Type
2521        default: return super.getProperty(hash, name, checkValid);
2522        }
2523
2524      }
2525
2526      @Override
2527      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2528        switch (hash) {
2529        case 1349547969: // sequence
2530          this.sequence = castToPositiveInt(value); // PositiveIntType
2531          return value;
2532        case 3076014: // date
2533          this.date = castToDateTime(value); // DateTimeType
2534          return value;
2535        case -1095204141: // procedure
2536          this.procedure = castToType(value); // Type
2537          return value;
2538        default: return super.setProperty(hash, name, value);
2539        }
2540
2541      }
2542
2543      @Override
2544      public Base setProperty(String name, Base value) throws FHIRException {
2545        if (name.equals("sequence")) {
2546          this.sequence = castToPositiveInt(value); // PositiveIntType
2547        } else if (name.equals("date")) {
2548          this.date = castToDateTime(value); // DateTimeType
2549        } else if (name.equals("procedure[x]")) {
2550          this.procedure = castToType(value); // Type
2551        } else
2552          return super.setProperty(name, value);
2553        return value;
2554      }
2555
2556      @Override
2557      public Base makeProperty(int hash, String name) throws FHIRException {
2558        switch (hash) {
2559        case 1349547969:  return getSequenceElement();
2560        case 3076014:  return getDateElement();
2561        case 1640074445:  return getProcedure(); 
2562        case -1095204141:  return getProcedure(); 
2563        default: return super.makeProperty(hash, name);
2564        }
2565
2566      }
2567
2568      @Override
2569      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2570        switch (hash) {
2571        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2572        case 3076014: /*date*/ return new String[] {"dateTime"};
2573        case -1095204141: /*procedure*/ return new String[] {"CodeableConcept", "Reference"};
2574        default: return super.getTypesForProperty(hash, name);
2575        }
2576
2577      }
2578
2579      @Override
2580      public Base addChild(String name) throws FHIRException {
2581        if (name.equals("sequence")) {
2582          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
2583        }
2584        else if (name.equals("date")) {
2585          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
2586        }
2587        else if (name.equals("procedureCodeableConcept")) {
2588          this.procedure = new CodeableConcept();
2589          return this.procedure;
2590        }
2591        else if (name.equals("procedureReference")) {
2592          this.procedure = new Reference();
2593          return this.procedure;
2594        }
2595        else
2596          return super.addChild(name);
2597      }
2598
2599      public ProcedureComponent copy() {
2600        ProcedureComponent dst = new ProcedureComponent();
2601        copyValues(dst);
2602        dst.sequence = sequence == null ? null : sequence.copy();
2603        dst.date = date == null ? null : date.copy();
2604        dst.procedure = procedure == null ? null : procedure.copy();
2605        return dst;
2606      }
2607
2608      @Override
2609      public boolean equalsDeep(Base other_) {
2610        if (!super.equalsDeep(other_))
2611          return false;
2612        if (!(other_ instanceof ProcedureComponent))
2613          return false;
2614        ProcedureComponent o = (ProcedureComponent) other_;
2615        return compareDeep(sequence, o.sequence, true) && compareDeep(date, o.date, true) && compareDeep(procedure, o.procedure, true)
2616          ;
2617      }
2618
2619      @Override
2620      public boolean equalsShallow(Base other_) {
2621        if (!super.equalsShallow(other_))
2622          return false;
2623        if (!(other_ instanceof ProcedureComponent))
2624          return false;
2625        ProcedureComponent o = (ProcedureComponent) other_;
2626        return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
2627      }
2628
2629      public boolean isEmpty() {
2630        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, date, procedure
2631          );
2632      }
2633
2634  public String fhirType() {
2635    return "ExplanationOfBenefit.procedure";
2636
2637  }
2638
2639  }
2640
2641    @Block()
2642    public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
2643        /**
2644         * Reference to the program or plan identification, underwriter or payor.
2645         */
2646        @Child(name = "coverage", type = {Coverage.class}, order=1, min=0, max=1, modifier=false, summary=false)
2647        @Description(shortDefinition="Insurance information", formalDefinition="Reference to the program or plan identification, underwriter or payor." )
2648        protected Reference coverage;
2649
2650        /**
2651         * The actual object that is the target of the reference (Reference to the program or plan identification, underwriter or payor.)
2652         */
2653        protected Coverage coverageTarget;
2654
2655        /**
2656         * A list of references from the Insurer to which these services pertain.
2657         */
2658        @Child(name = "preAuthRef", type = {StringType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2659        @Description(shortDefinition="Pre-Authorization/Determination Reference", formalDefinition="A list of references from the Insurer to which these services pertain." )
2660        protected List<StringType> preAuthRef;
2661
2662        private static final long serialVersionUID = -870298727L;
2663
2664    /**
2665     * Constructor
2666     */
2667      public InsuranceComponent() {
2668        super();
2669      }
2670
2671        /**
2672         * @return {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
2673         */
2674        public Reference getCoverage() { 
2675          if (this.coverage == null)
2676            if (Configuration.errorOnAutoCreate())
2677              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2678            else if (Configuration.doAutoCreate())
2679              this.coverage = new Reference(); // cc
2680          return this.coverage;
2681        }
2682
2683        public boolean hasCoverage() { 
2684          return this.coverage != null && !this.coverage.isEmpty();
2685        }
2686
2687        /**
2688         * @param value {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
2689         */
2690        public InsuranceComponent setCoverage(Reference value) { 
2691          this.coverage = value;
2692          return this;
2693        }
2694
2695        /**
2696         * @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.)
2697         */
2698        public Coverage getCoverageTarget() { 
2699          if (this.coverageTarget == null)
2700            if (Configuration.errorOnAutoCreate())
2701              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2702            else if (Configuration.doAutoCreate())
2703              this.coverageTarget = new Coverage(); // aa
2704          return this.coverageTarget;
2705        }
2706
2707        /**
2708         * @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.)
2709         */
2710        public InsuranceComponent setCoverageTarget(Coverage value) { 
2711          this.coverageTarget = value;
2712          return this;
2713        }
2714
2715        /**
2716         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2717         */
2718        public List<StringType> getPreAuthRef() { 
2719          if (this.preAuthRef == null)
2720            this.preAuthRef = new ArrayList<StringType>();
2721          return this.preAuthRef;
2722        }
2723
2724        /**
2725         * @return Returns a reference to <code>this</code> for easy method chaining
2726         */
2727        public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) { 
2728          this.preAuthRef = thePreAuthRef;
2729          return this;
2730        }
2731
2732        public boolean hasPreAuthRef() { 
2733          if (this.preAuthRef == null)
2734            return false;
2735          for (StringType item : this.preAuthRef)
2736            if (!item.isEmpty())
2737              return true;
2738          return false;
2739        }
2740
2741        /**
2742         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2743         */
2744        public StringType addPreAuthRefElement() {//2 
2745          StringType t = new StringType();
2746          if (this.preAuthRef == null)
2747            this.preAuthRef = new ArrayList<StringType>();
2748          this.preAuthRef.add(t);
2749          return t;
2750        }
2751
2752        /**
2753         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2754         */
2755        public InsuranceComponent addPreAuthRef(String value) { //1
2756          StringType t = new StringType();
2757          t.setValue(value);
2758          if (this.preAuthRef == null)
2759            this.preAuthRef = new ArrayList<StringType>();
2760          this.preAuthRef.add(t);
2761          return this;
2762        }
2763
2764        /**
2765         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
2766         */
2767        public boolean hasPreAuthRef(String value) { 
2768          if (this.preAuthRef == null)
2769            return false;
2770          for (StringType v : this.preAuthRef)
2771            if (v.getValue().equals(value)) // string
2772              return true;
2773          return false;
2774        }
2775
2776        protected void listChildren(List<Property> children) {
2777          super.listChildren(children);
2778          children.add(new Property("coverage", "Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, 1, coverage));
2779          children.add(new Property("preAuthRef", "string", "A list of references from the Insurer to which these services pertain.", 0, java.lang.Integer.MAX_VALUE, preAuthRef));
2780        }
2781
2782        @Override
2783        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2784          switch (_hash) {
2785          case -351767064: /*coverage*/  return new Property("coverage", "Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, 1, coverage);
2786          case 522246568: /*preAuthRef*/  return new Property("preAuthRef", "string", "A list of references from the Insurer to which these services pertain.", 0, java.lang.Integer.MAX_VALUE, preAuthRef);
2787          default: return super.getNamedProperty(_hash, _name, _checkValid);
2788          }
2789
2790        }
2791
2792      @Override
2793      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2794        switch (hash) {
2795        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
2796        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
2797        default: return super.getProperty(hash, name, checkValid);
2798        }
2799
2800      }
2801
2802      @Override
2803      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2804        switch (hash) {
2805        case -351767064: // coverage
2806          this.coverage = castToReference(value); // Reference
2807          return value;
2808        case 522246568: // preAuthRef
2809          this.getPreAuthRef().add(castToString(value)); // StringType
2810          return value;
2811        default: return super.setProperty(hash, name, value);
2812        }
2813
2814      }
2815
2816      @Override
2817      public Base setProperty(String name, Base value) throws FHIRException {
2818        if (name.equals("coverage")) {
2819          this.coverage = castToReference(value); // Reference
2820        } else if (name.equals("preAuthRef")) {
2821          this.getPreAuthRef().add(castToString(value));
2822        } else
2823          return super.setProperty(name, value);
2824        return value;
2825      }
2826
2827      @Override
2828      public Base makeProperty(int hash, String name) throws FHIRException {
2829        switch (hash) {
2830        case -351767064:  return getCoverage(); 
2831        case 522246568:  return addPreAuthRefElement();
2832        default: return super.makeProperty(hash, name);
2833        }
2834
2835      }
2836
2837      @Override
2838      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2839        switch (hash) {
2840        case -351767064: /*coverage*/ return new String[] {"Reference"};
2841        case 522246568: /*preAuthRef*/ return new String[] {"string"};
2842        default: return super.getTypesForProperty(hash, name);
2843        }
2844
2845      }
2846
2847      @Override
2848      public Base addChild(String name) throws FHIRException {
2849        if (name.equals("coverage")) {
2850          this.coverage = new Reference();
2851          return this.coverage;
2852        }
2853        else if (name.equals("preAuthRef")) {
2854          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
2855        }
2856        else
2857          return super.addChild(name);
2858      }
2859
2860      public InsuranceComponent copy() {
2861        InsuranceComponent dst = new InsuranceComponent();
2862        copyValues(dst);
2863        dst.coverage = coverage == null ? null : coverage.copy();
2864        if (preAuthRef != null) {
2865          dst.preAuthRef = new ArrayList<StringType>();
2866          for (StringType i : preAuthRef)
2867            dst.preAuthRef.add(i.copy());
2868        };
2869        return dst;
2870      }
2871
2872      @Override
2873      public boolean equalsDeep(Base other_) {
2874        if (!super.equalsDeep(other_))
2875          return false;
2876        if (!(other_ instanceof InsuranceComponent))
2877          return false;
2878        InsuranceComponent o = (InsuranceComponent) other_;
2879        return compareDeep(coverage, o.coverage, true) && compareDeep(preAuthRef, o.preAuthRef, true);
2880      }
2881
2882      @Override
2883      public boolean equalsShallow(Base other_) {
2884        if (!super.equalsShallow(other_))
2885          return false;
2886        if (!(other_ instanceof InsuranceComponent))
2887          return false;
2888        InsuranceComponent o = (InsuranceComponent) other_;
2889        return compareValues(preAuthRef, o.preAuthRef, true);
2890      }
2891
2892      public boolean isEmpty() {
2893        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(coverage, preAuthRef);
2894      }
2895
2896  public String fhirType() {
2897    return "ExplanationOfBenefit.insurance";
2898
2899  }
2900
2901  }
2902
2903    @Block()
2904    public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
2905        /**
2906         * Date of an accident which these services are addressing.
2907         */
2908        @Child(name = "date", type = {DateType.class}, order=1, min=0, max=1, modifier=false, summary=false)
2909        @Description(shortDefinition="When the accident occurred", formalDefinition="Date of an accident which these services are addressing." )
2910        protected DateType date;
2911
2912        /**
2913         * Type of accident: work, auto, etc.
2914         */
2915        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
2916        @Description(shortDefinition="The nature of the accident", formalDefinition="Type of accident: work, auto, etc." )
2917        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActIncidentCode")
2918        protected CodeableConcept type;
2919
2920        /**
2921         * Where the accident occurred.
2922         */
2923        @Child(name = "location", type = {Address.class, Location.class}, order=3, min=0, max=1, modifier=false, summary=false)
2924        @Description(shortDefinition="Accident Place", formalDefinition="Where the accident occurred." )
2925        protected Type location;
2926
2927        private static final long serialVersionUID = 622904984L;
2928
2929    /**
2930     * Constructor
2931     */
2932      public AccidentComponent() {
2933        super();
2934      }
2935
2936        /**
2937         * @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
2938         */
2939        public DateType getDateElement() { 
2940          if (this.date == null)
2941            if (Configuration.errorOnAutoCreate())
2942              throw new Error("Attempt to auto-create AccidentComponent.date");
2943            else if (Configuration.doAutoCreate())
2944              this.date = new DateType(); // bb
2945          return this.date;
2946        }
2947
2948        public boolean hasDateElement() { 
2949          return this.date != null && !this.date.isEmpty();
2950        }
2951
2952        public boolean hasDate() { 
2953          return this.date != null && !this.date.isEmpty();
2954        }
2955
2956        /**
2957         * @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
2958         */
2959        public AccidentComponent setDateElement(DateType value) { 
2960          this.date = value;
2961          return this;
2962        }
2963
2964        /**
2965         * @return Date of an accident which these services are addressing.
2966         */
2967        public Date getDate() { 
2968          return this.date == null ? null : this.date.getValue();
2969        }
2970
2971        /**
2972         * @param value Date of an accident which these services are addressing.
2973         */
2974        public AccidentComponent setDate(Date value) { 
2975          if (value == null)
2976            this.date = null;
2977          else {
2978            if (this.date == null)
2979              this.date = new DateType();
2980            this.date.setValue(value);
2981          }
2982          return this;
2983        }
2984
2985        /**
2986         * @return {@link #type} (Type of accident: work, auto, etc.)
2987         */
2988        public CodeableConcept getType() { 
2989          if (this.type == null)
2990            if (Configuration.errorOnAutoCreate())
2991              throw new Error("Attempt to auto-create AccidentComponent.type");
2992            else if (Configuration.doAutoCreate())
2993              this.type = new CodeableConcept(); // cc
2994          return this.type;
2995        }
2996
2997        public boolean hasType() { 
2998          return this.type != null && !this.type.isEmpty();
2999        }
3000
3001        /**
3002         * @param value {@link #type} (Type of accident: work, auto, etc.)
3003         */
3004        public AccidentComponent setType(CodeableConcept value) { 
3005          this.type = value;
3006          return this;
3007        }
3008
3009        /**
3010         * @return {@link #location} (Where the accident occurred.)
3011         */
3012        public Type getLocation() { 
3013          return this.location;
3014        }
3015
3016        /**
3017         * @return {@link #location} (Where the accident occurred.)
3018         */
3019        public Address getLocationAddress() throws FHIRException { 
3020          if (this.location == null)
3021            return null;
3022          if (!(this.location instanceof Address))
3023            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
3024          return (Address) this.location;
3025        }
3026
3027        public boolean hasLocationAddress() { 
3028          return this != null && this.location instanceof Address;
3029        }
3030
3031        /**
3032         * @return {@link #location} (Where the accident occurred.)
3033         */
3034        public Reference getLocationReference() throws FHIRException { 
3035          if (this.location == null)
3036            return null;
3037          if (!(this.location instanceof Reference))
3038            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
3039          return (Reference) this.location;
3040        }
3041
3042        public boolean hasLocationReference() { 
3043          return this != null && this.location instanceof Reference;
3044        }
3045
3046        public boolean hasLocation() { 
3047          return this.location != null && !this.location.isEmpty();
3048        }
3049
3050        /**
3051         * @param value {@link #location} (Where the accident occurred.)
3052         */
3053        public AccidentComponent setLocation(Type value) { 
3054          if (value != null && !(value instanceof Address || value instanceof Reference))
3055            throw new Error("Not the right type for ExplanationOfBenefit.accident.location[x]: "+value.fhirType());
3056          this.location = value;
3057          return this;
3058        }
3059
3060        protected void listChildren(List<Property> children) {
3061          super.listChildren(children);
3062          children.add(new Property("date", "date", "Date of an accident which these services are addressing.", 0, 1, date));
3063          children.add(new Property("type", "CodeableConcept", "Type of accident: work, auto, etc.", 0, 1, type));
3064          children.add(new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location));
3065        }
3066
3067        @Override
3068        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3069          switch (_hash) {
3070          case 3076014: /*date*/  return new Property("date", "date", "Date of an accident which these services are addressing.", 0, 1, date);
3071          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of accident: work, auto, etc.", 0, 1, type);
3072          case 552316075: /*location[x]*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
3073          case 1901043637: /*location*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
3074          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
3075          case 755866390: /*locationReference*/  return new Property("location[x]", "Address|Reference(Location)", "Where the accident occurred.", 0, 1, location);
3076          default: return super.getNamedProperty(_hash, _name, _checkValid);
3077          }
3078
3079        }
3080
3081      @Override
3082      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3083        switch (hash) {
3084        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
3085        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3086        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
3087        default: return super.getProperty(hash, name, checkValid);
3088        }
3089
3090      }
3091
3092      @Override
3093      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3094        switch (hash) {
3095        case 3076014: // date
3096          this.date = castToDate(value); // DateType
3097          return value;
3098        case 3575610: // type
3099          this.type = castToCodeableConcept(value); // CodeableConcept
3100          return value;
3101        case 1901043637: // location
3102          this.location = castToType(value); // Type
3103          return value;
3104        default: return super.setProperty(hash, name, value);
3105        }
3106
3107      }
3108
3109      @Override
3110      public Base setProperty(String name, Base value) throws FHIRException {
3111        if (name.equals("date")) {
3112          this.date = castToDate(value); // DateType
3113        } else if (name.equals("type")) {
3114          this.type = castToCodeableConcept(value); // CodeableConcept
3115        } else if (name.equals("location[x]")) {
3116          this.location = castToType(value); // Type
3117        } else
3118          return super.setProperty(name, value);
3119        return value;
3120      }
3121
3122      @Override
3123      public Base makeProperty(int hash, String name) throws FHIRException {
3124        switch (hash) {
3125        case 3076014:  return getDateElement();
3126        case 3575610:  return getType(); 
3127        case 552316075:  return getLocation(); 
3128        case 1901043637:  return getLocation(); 
3129        default: return super.makeProperty(hash, name);
3130        }
3131
3132      }
3133
3134      @Override
3135      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3136        switch (hash) {
3137        case 3076014: /*date*/ return new String[] {"date"};
3138        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3139        case 1901043637: /*location*/ return new String[] {"Address", "Reference"};
3140        default: return super.getTypesForProperty(hash, name);
3141        }
3142
3143      }
3144
3145      @Override
3146      public Base addChild(String name) throws FHIRException {
3147        if (name.equals("date")) {
3148          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
3149        }
3150        else if (name.equals("type")) {
3151          this.type = new CodeableConcept();
3152          return this.type;
3153        }
3154        else if (name.equals("locationAddress")) {
3155          this.location = new Address();
3156          return this.location;
3157        }
3158        else if (name.equals("locationReference")) {
3159          this.location = new Reference();
3160          return this.location;
3161        }
3162        else
3163          return super.addChild(name);
3164      }
3165
3166      public AccidentComponent copy() {
3167        AccidentComponent dst = new AccidentComponent();
3168        copyValues(dst);
3169        dst.date = date == null ? null : date.copy();
3170        dst.type = type == null ? null : type.copy();
3171        dst.location = location == null ? null : location.copy();
3172        return dst;
3173      }
3174
3175      @Override
3176      public boolean equalsDeep(Base other_) {
3177        if (!super.equalsDeep(other_))
3178          return false;
3179        if (!(other_ instanceof AccidentComponent))
3180          return false;
3181        AccidentComponent o = (AccidentComponent) other_;
3182        return compareDeep(date, o.date, true) && compareDeep(type, o.type, true) && compareDeep(location, o.location, true)
3183          ;
3184      }
3185
3186      @Override
3187      public boolean equalsShallow(Base other_) {
3188        if (!super.equalsShallow(other_))
3189          return false;
3190        if (!(other_ instanceof AccidentComponent))
3191          return false;
3192        AccidentComponent o = (AccidentComponent) other_;
3193        return compareValues(date, o.date, true);
3194      }
3195
3196      public boolean isEmpty() {
3197        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
3198      }
3199
3200  public String fhirType() {
3201    return "ExplanationOfBenefit.accident";
3202
3203  }
3204
3205  }
3206
3207    @Block()
3208    public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
3209        /**
3210         * A service line number.
3211         */
3212        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
3213        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
3214        protected PositiveIntType sequence;
3215
3216        /**
3217         * Careteam applicable for this service or product line.
3218         */
3219        @Child(name = "careTeamSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3220        @Description(shortDefinition="Applicable careteam members", formalDefinition="Careteam applicable for this service or product line." )
3221        protected List<PositiveIntType> careTeamSequence;
3222
3223        /**
3224         * Diagnosis applicable for this service or product line.
3225         */
3226        @Child(name = "diagnosisSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3227        @Description(shortDefinition="Applicable diagnoses", formalDefinition="Diagnosis applicable for this service or product line." )
3228        protected List<PositiveIntType> diagnosisSequence;
3229
3230        /**
3231         * Procedures applicable for this service or product line.
3232         */
3233        @Child(name = "procedureSequence", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3234        @Description(shortDefinition="Applicable procedures", formalDefinition="Procedures applicable for this service or product line." )
3235        protected List<PositiveIntType> procedureSequence;
3236
3237        /**
3238         * Exceptions, special conditions and supporting information pplicable for this service or product line.
3239         */
3240        @Child(name = "informationSequence", type = {PositiveIntType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3241        @Description(shortDefinition="Applicable exception and supporting information", formalDefinition="Exceptions, special conditions and supporting information pplicable for this service or product line." )
3242        protected List<PositiveIntType> informationSequence;
3243
3244        /**
3245         * The type of reveneu or cost center providing the product and/or service.
3246         */
3247        @Child(name = "revenue", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
3248        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
3249        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
3250        protected CodeableConcept revenue;
3251
3252        /**
3253         * Health Care Service Type Codes  to identify the classification of service or benefits.
3254         */
3255        @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
3256        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
3257        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
3258        protected CodeableConcept category;
3259
3260        /**
3261         * If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. 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'.
3262         */
3263        @Child(name = "service", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
3264        @Description(shortDefinition="Billing Code", formalDefinition="If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. 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'." )
3265        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
3266        protected CodeableConcept service;
3267
3268        /**
3269         * Item typification or modifiers codes, eg 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.
3270         */
3271        @Child(name = "modifier", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3272        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, eg 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." )
3273        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
3274        protected List<CodeableConcept> modifier;
3275
3276        /**
3277         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
3278         */
3279        @Child(name = "programCode", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3280        @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." )
3281        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
3282        protected List<CodeableConcept> programCode;
3283
3284        /**
3285         * The date or dates when the enclosed suite of services were performed or completed.
3286         */
3287        @Child(name = "serviced", type = {DateType.class, Period.class}, order=11, min=0, max=1, modifier=false, summary=false)
3288        @Description(shortDefinition="Date or dates of Service", formalDefinition="The date or dates when the enclosed suite of services were performed or completed." )
3289        protected Type serviced;
3290
3291        /**
3292         * Where the service was provided.
3293         */
3294        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
3295        @Description(shortDefinition="Place of service", formalDefinition="Where the service was provided." )
3296        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
3297        protected Type location;
3298
3299        /**
3300         * The number of repetitions of a service or product.
3301         */
3302        @Child(name = "quantity", type = {SimpleQuantity.class}, order=13, min=0, max=1, modifier=false, summary=false)
3303        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
3304        protected SimpleQuantity quantity;
3305
3306        /**
3307         * 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.
3308         */
3309        @Child(name = "unitPrice", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
3310        @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." )
3311        protected Money unitPrice;
3312
3313        /**
3314         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3315         */
3316        @Child(name = "factor", type = {DecimalType.class}, order=15, min=0, max=1, modifier=false, summary=false)
3317        @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." )
3318        protected DecimalType factor;
3319
3320        /**
3321         * The quantity times the unit price for an addittional 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.
3322         */
3323        @Child(name = "net", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=false)
3324        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an addittional 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." )
3325        protected Money net;
3326
3327        /**
3328         * List of Unique Device Identifiers associated with this line item.
3329         */
3330        @Child(name = "udi", type = {Device.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3331        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
3332        protected List<Reference> udi;
3333        /**
3334         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
3335         */
3336        protected List<Device> udiTarget;
3337
3338
3339        /**
3340         * Physical service site on the patient (limb, tooth, etc.).
3341         */
3342        @Child(name = "bodySite", type = {CodeableConcept.class}, order=18, min=0, max=1, modifier=false, summary=false)
3343        @Description(shortDefinition="Service Location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
3344        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
3345        protected CodeableConcept bodySite;
3346
3347        /**
3348         * A region or surface of the site, eg. limb region or tooth surface(s).
3349         */
3350        @Child(name = "subSite", type = {CodeableConcept.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3351        @Description(shortDefinition="Service Sub-location", formalDefinition="A region or surface of the site, eg. limb region or tooth surface(s)." )
3352        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
3353        protected List<CodeableConcept> subSite;
3354
3355        /**
3356         * A billed item may include goods or services provided in multiple encounters.
3357         */
3358        @Child(name = "encounter", type = {Encounter.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3359        @Description(shortDefinition="Encounters related to this billed item", formalDefinition="A billed item may include goods or services provided in multiple encounters." )
3360        protected List<Reference> encounter;
3361        /**
3362         * The actual objects that are the target of the reference (A billed item may include goods or services provided in multiple encounters.)
3363         */
3364        protected List<Encounter> encounterTarget;
3365
3366
3367        /**
3368         * A list of note references to the notes provided below.
3369         */
3370        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3371        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
3372        protected List<PositiveIntType> noteNumber;
3373
3374        /**
3375         * The adjudications results.
3376         */
3377        @Child(name = "adjudication", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3378        @Description(shortDefinition="Adjudication details", formalDefinition="The adjudications results." )
3379        protected List<AdjudicationComponent> adjudication;
3380
3381        /**
3382         * Second tier of goods and services.
3383         */
3384        @Child(name = "detail", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3385        @Description(shortDefinition="Additional items", formalDefinition="Second tier of goods and services." )
3386        protected List<DetailComponent> detail;
3387
3388        private static final long serialVersionUID = -1654543805L;
3389
3390    /**
3391     * Constructor
3392     */
3393      public ItemComponent() {
3394        super();
3395      }
3396
3397    /**
3398     * Constructor
3399     */
3400      public ItemComponent(PositiveIntType sequence) {
3401        super();
3402        this.sequence = sequence;
3403      }
3404
3405        /**
3406         * @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
3407         */
3408        public PositiveIntType getSequenceElement() { 
3409          if (this.sequence == null)
3410            if (Configuration.errorOnAutoCreate())
3411              throw new Error("Attempt to auto-create ItemComponent.sequence");
3412            else if (Configuration.doAutoCreate())
3413              this.sequence = new PositiveIntType(); // bb
3414          return this.sequence;
3415        }
3416
3417        public boolean hasSequenceElement() { 
3418          return this.sequence != null && !this.sequence.isEmpty();
3419        }
3420
3421        public boolean hasSequence() { 
3422          return this.sequence != null && !this.sequence.isEmpty();
3423        }
3424
3425        /**
3426         * @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
3427         */
3428        public ItemComponent setSequenceElement(PositiveIntType value) { 
3429          this.sequence = value;
3430          return this;
3431        }
3432
3433        /**
3434         * @return A service line number.
3435         */
3436        public int getSequence() { 
3437          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3438        }
3439
3440        /**
3441         * @param value A service line number.
3442         */
3443        public ItemComponent setSequence(int value) { 
3444            if (this.sequence == null)
3445              this.sequence = new PositiveIntType();
3446            this.sequence.setValue(value);
3447          return this;
3448        }
3449
3450        /**
3451         * @return {@link #careTeamSequence} (Careteam applicable for this service or product line.)
3452         */
3453        public List<PositiveIntType> getCareTeamSequence() { 
3454          if (this.careTeamSequence == null)
3455            this.careTeamSequence = new ArrayList<PositiveIntType>();
3456          return this.careTeamSequence;
3457        }
3458
3459        /**
3460         * @return Returns a reference to <code>this</code> for easy method chaining
3461         */
3462        public ItemComponent setCareTeamSequence(List<PositiveIntType> theCareTeamSequence) { 
3463          this.careTeamSequence = theCareTeamSequence;
3464          return this;
3465        }
3466
3467        public boolean hasCareTeamSequence() { 
3468          if (this.careTeamSequence == null)
3469            return false;
3470          for (PositiveIntType item : this.careTeamSequence)
3471            if (!item.isEmpty())
3472              return true;
3473          return false;
3474        }
3475
3476        /**
3477         * @return {@link #careTeamSequence} (Careteam applicable for this service or product line.)
3478         */
3479        public PositiveIntType addCareTeamSequenceElement() {//2 
3480          PositiveIntType t = new PositiveIntType();
3481          if (this.careTeamSequence == null)
3482            this.careTeamSequence = new ArrayList<PositiveIntType>();
3483          this.careTeamSequence.add(t);
3484          return t;
3485        }
3486
3487        /**
3488         * @param value {@link #careTeamSequence} (Careteam applicable for this service or product line.)
3489         */
3490        public ItemComponent addCareTeamSequence(int value) { //1
3491          PositiveIntType t = new PositiveIntType();
3492          t.setValue(value);
3493          if (this.careTeamSequence == null)
3494            this.careTeamSequence = new ArrayList<PositiveIntType>();
3495          this.careTeamSequence.add(t);
3496          return this;
3497        }
3498
3499        /**
3500         * @param value {@link #careTeamSequence} (Careteam applicable for this service or product line.)
3501         */
3502        public boolean hasCareTeamSequence(int value) { 
3503          if (this.careTeamSequence == null)
3504            return false;
3505          for (PositiveIntType v : this.careTeamSequence)
3506            if (v.getValue().equals(value)) // positiveInt
3507              return true;
3508          return false;
3509        }
3510
3511        /**
3512         * @return {@link #diagnosisSequence} (Diagnosis applicable for this service or product line.)
3513         */
3514        public List<PositiveIntType> getDiagnosisSequence() { 
3515          if (this.diagnosisSequence == null)
3516            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3517          return this.diagnosisSequence;
3518        }
3519
3520        /**
3521         * @return Returns a reference to <code>this</code> for easy method chaining
3522         */
3523        public ItemComponent setDiagnosisSequence(List<PositiveIntType> theDiagnosisSequence) { 
3524          this.diagnosisSequence = theDiagnosisSequence;
3525          return this;
3526        }
3527
3528        public boolean hasDiagnosisSequence() { 
3529          if (this.diagnosisSequence == null)
3530            return false;
3531          for (PositiveIntType item : this.diagnosisSequence)
3532            if (!item.isEmpty())
3533              return true;
3534          return false;
3535        }
3536
3537        /**
3538         * @return {@link #diagnosisSequence} (Diagnosis applicable for this service or product line.)
3539         */
3540        public PositiveIntType addDiagnosisSequenceElement() {//2 
3541          PositiveIntType t = new PositiveIntType();
3542          if (this.diagnosisSequence == null)
3543            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3544          this.diagnosisSequence.add(t);
3545          return t;
3546        }
3547
3548        /**
3549         * @param value {@link #diagnosisSequence} (Diagnosis applicable for this service or product line.)
3550         */
3551        public ItemComponent addDiagnosisSequence(int value) { //1
3552          PositiveIntType t = new PositiveIntType();
3553          t.setValue(value);
3554          if (this.diagnosisSequence == null)
3555            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3556          this.diagnosisSequence.add(t);
3557          return this;
3558        }
3559
3560        /**
3561         * @param value {@link #diagnosisSequence} (Diagnosis applicable for this service or product line.)
3562         */
3563        public boolean hasDiagnosisSequence(int value) { 
3564          if (this.diagnosisSequence == null)
3565            return false;
3566          for (PositiveIntType v : this.diagnosisSequence)
3567            if (v.getValue().equals(value)) // positiveInt
3568              return true;
3569          return false;
3570        }
3571
3572        /**
3573         * @return {@link #procedureSequence} (Procedures applicable for this service or product line.)
3574         */
3575        public List<PositiveIntType> getProcedureSequence() { 
3576          if (this.procedureSequence == null)
3577            this.procedureSequence = new ArrayList<PositiveIntType>();
3578          return this.procedureSequence;
3579        }
3580
3581        /**
3582         * @return Returns a reference to <code>this</code> for easy method chaining
3583         */
3584        public ItemComponent setProcedureSequence(List<PositiveIntType> theProcedureSequence) { 
3585          this.procedureSequence = theProcedureSequence;
3586          return this;
3587        }
3588
3589        public boolean hasProcedureSequence() { 
3590          if (this.procedureSequence == null)
3591            return false;
3592          for (PositiveIntType item : this.procedureSequence)
3593            if (!item.isEmpty())
3594              return true;
3595          return false;
3596        }
3597
3598        /**
3599         * @return {@link #procedureSequence} (Procedures applicable for this service or product line.)
3600         */
3601        public PositiveIntType addProcedureSequenceElement() {//2 
3602          PositiveIntType t = new PositiveIntType();
3603          if (this.procedureSequence == null)
3604            this.procedureSequence = new ArrayList<PositiveIntType>();
3605          this.procedureSequence.add(t);
3606          return t;
3607        }
3608
3609        /**
3610         * @param value {@link #procedureSequence} (Procedures applicable for this service or product line.)
3611         */
3612        public ItemComponent addProcedureSequence(int value) { //1
3613          PositiveIntType t = new PositiveIntType();
3614          t.setValue(value);
3615          if (this.procedureSequence == null)
3616            this.procedureSequence = new ArrayList<PositiveIntType>();
3617          this.procedureSequence.add(t);
3618          return this;
3619        }
3620
3621        /**
3622         * @param value {@link #procedureSequence} (Procedures applicable for this service or product line.)
3623         */
3624        public boolean hasProcedureSequence(int value) { 
3625          if (this.procedureSequence == null)
3626            return false;
3627          for (PositiveIntType v : this.procedureSequence)
3628            if (v.getValue().equals(value)) // positiveInt
3629              return true;
3630          return false;
3631        }
3632
3633        /**
3634         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3635         */
3636        public List<PositiveIntType> getInformationSequence() { 
3637          if (this.informationSequence == null)
3638            this.informationSequence = new ArrayList<PositiveIntType>();
3639          return this.informationSequence;
3640        }
3641
3642        /**
3643         * @return Returns a reference to <code>this</code> for easy method chaining
3644         */
3645        public ItemComponent setInformationSequence(List<PositiveIntType> theInformationSequence) { 
3646          this.informationSequence = theInformationSequence;
3647          return this;
3648        }
3649
3650        public boolean hasInformationSequence() { 
3651          if (this.informationSequence == null)
3652            return false;
3653          for (PositiveIntType item : this.informationSequence)
3654            if (!item.isEmpty())
3655              return true;
3656          return false;
3657        }
3658
3659        /**
3660         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3661         */
3662        public PositiveIntType addInformationSequenceElement() {//2 
3663          PositiveIntType t = new PositiveIntType();
3664          if (this.informationSequence == null)
3665            this.informationSequence = new ArrayList<PositiveIntType>();
3666          this.informationSequence.add(t);
3667          return t;
3668        }
3669
3670        /**
3671         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3672         */
3673        public ItemComponent addInformationSequence(int value) { //1
3674          PositiveIntType t = new PositiveIntType();
3675          t.setValue(value);
3676          if (this.informationSequence == null)
3677            this.informationSequence = new ArrayList<PositiveIntType>();
3678          this.informationSequence.add(t);
3679          return this;
3680        }
3681
3682        /**
3683         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information pplicable for this service or product line.)
3684         */
3685        public boolean hasInformationSequence(int value) { 
3686          if (this.informationSequence == null)
3687            return false;
3688          for (PositiveIntType v : this.informationSequence)
3689            if (v.getValue().equals(value)) // positiveInt
3690              return true;
3691          return false;
3692        }
3693
3694        /**
3695         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
3696         */
3697        public CodeableConcept getRevenue() { 
3698          if (this.revenue == null)
3699            if (Configuration.errorOnAutoCreate())
3700              throw new Error("Attempt to auto-create ItemComponent.revenue");
3701            else if (Configuration.doAutoCreate())
3702              this.revenue = new CodeableConcept(); // cc
3703          return this.revenue;
3704        }
3705
3706        public boolean hasRevenue() { 
3707          return this.revenue != null && !this.revenue.isEmpty();
3708        }
3709
3710        /**
3711         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
3712         */
3713        public ItemComponent setRevenue(CodeableConcept value) { 
3714          this.revenue = value;
3715          return this;
3716        }
3717
3718        /**
3719         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
3720         */
3721        public CodeableConcept getCategory() { 
3722          if (this.category == null)
3723            if (Configuration.errorOnAutoCreate())
3724              throw new Error("Attempt to auto-create ItemComponent.category");
3725            else if (Configuration.doAutoCreate())
3726              this.category = new CodeableConcept(); // cc
3727          return this.category;
3728        }
3729
3730        public boolean hasCategory() { 
3731          return this.category != null && !this.category.isEmpty();
3732        }
3733
3734        /**
3735         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
3736         */
3737        public ItemComponent setCategory(CodeableConcept value) { 
3738          this.category = value;
3739          return this;
3740        }
3741
3742        /**
3743         * @return {@link #service} (If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. 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'.)
3744         */
3745        public CodeableConcept getService() { 
3746          if (this.service == null)
3747            if (Configuration.errorOnAutoCreate())
3748              throw new Error("Attempt to auto-create ItemComponent.service");
3749            else if (Configuration.doAutoCreate())
3750              this.service = new CodeableConcept(); // cc
3751          return this.service;
3752        }
3753
3754        public boolean hasService() { 
3755          return this.service != null && !this.service.isEmpty();
3756        }
3757
3758        /**
3759         * @param value {@link #service} (If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. 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'.)
3760         */
3761        public ItemComponent setService(CodeableConcept value) { 
3762          this.service = value;
3763          return this;
3764        }
3765
3766        /**
3767         * @return {@link #modifier} (Item typification or modifiers codes, eg 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.)
3768         */
3769        public List<CodeableConcept> getModifier() { 
3770          if (this.modifier == null)
3771            this.modifier = new ArrayList<CodeableConcept>();
3772          return this.modifier;
3773        }
3774
3775        /**
3776         * @return Returns a reference to <code>this</code> for easy method chaining
3777         */
3778        public ItemComponent setModifier(List<CodeableConcept> theModifier) { 
3779          this.modifier = theModifier;
3780          return this;
3781        }
3782
3783        public boolean hasModifier() { 
3784          if (this.modifier == null)
3785            return false;
3786          for (CodeableConcept item : this.modifier)
3787            if (!item.isEmpty())
3788              return true;
3789          return false;
3790        }
3791
3792        public CodeableConcept addModifier() { //3
3793          CodeableConcept t = new CodeableConcept();
3794          if (this.modifier == null)
3795            this.modifier = new ArrayList<CodeableConcept>();
3796          this.modifier.add(t);
3797          return t;
3798        }
3799
3800        public ItemComponent addModifier(CodeableConcept t) { //3
3801          if (t == null)
3802            return this;
3803          if (this.modifier == null)
3804            this.modifier = new ArrayList<CodeableConcept>();
3805          this.modifier.add(t);
3806          return this;
3807        }
3808
3809        /**
3810         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
3811         */
3812        public CodeableConcept getModifierFirstRep() { 
3813          if (getModifier().isEmpty()) {
3814            addModifier();
3815          }
3816          return getModifier().get(0);
3817        }
3818
3819        /**
3820         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
3821         */
3822        public List<CodeableConcept> getProgramCode() { 
3823          if (this.programCode == null)
3824            this.programCode = new ArrayList<CodeableConcept>();
3825          return this.programCode;
3826        }
3827
3828        /**
3829         * @return Returns a reference to <code>this</code> for easy method chaining
3830         */
3831        public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
3832          this.programCode = theProgramCode;
3833          return this;
3834        }
3835
3836        public boolean hasProgramCode() { 
3837          if (this.programCode == null)
3838            return false;
3839          for (CodeableConcept item : this.programCode)
3840            if (!item.isEmpty())
3841              return true;
3842          return false;
3843        }
3844
3845        public CodeableConcept addProgramCode() { //3
3846          CodeableConcept t = new CodeableConcept();
3847          if (this.programCode == null)
3848            this.programCode = new ArrayList<CodeableConcept>();
3849          this.programCode.add(t);
3850          return t;
3851        }
3852
3853        public ItemComponent addProgramCode(CodeableConcept t) { //3
3854          if (t == null)
3855            return this;
3856          if (this.programCode == null)
3857            this.programCode = new ArrayList<CodeableConcept>();
3858          this.programCode.add(t);
3859          return this;
3860        }
3861
3862        /**
3863         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
3864         */
3865        public CodeableConcept getProgramCodeFirstRep() { 
3866          if (getProgramCode().isEmpty()) {
3867            addProgramCode();
3868          }
3869          return getProgramCode().get(0);
3870        }
3871
3872        /**
3873         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3874         */
3875        public Type getServiced() { 
3876          return this.serviced;
3877        }
3878
3879        /**
3880         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3881         */
3882        public DateType getServicedDateType() throws FHIRException { 
3883          if (this.serviced == null)
3884            return null;
3885          if (!(this.serviced instanceof DateType))
3886            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
3887          return (DateType) this.serviced;
3888        }
3889
3890        public boolean hasServicedDateType() { 
3891          return this != null && this.serviced instanceof DateType;
3892        }
3893
3894        /**
3895         * @return {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3896         */
3897        public Period getServicedPeriod() throws FHIRException { 
3898          if (this.serviced == null)
3899            return null;
3900          if (!(this.serviced instanceof Period))
3901            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
3902          return (Period) this.serviced;
3903        }
3904
3905        public boolean hasServicedPeriod() { 
3906          return this != null && this.serviced instanceof Period;
3907        }
3908
3909        public boolean hasServiced() { 
3910          return this.serviced != null && !this.serviced.isEmpty();
3911        }
3912
3913        /**
3914         * @param value {@link #serviced} (The date or dates when the enclosed suite of services were performed or completed.)
3915         */
3916        public ItemComponent setServiced(Type value) { 
3917          if (value != null && !(value instanceof DateType || value instanceof Period))
3918            throw new Error("Not the right type for ExplanationOfBenefit.item.serviced[x]: "+value.fhirType());
3919          this.serviced = value;
3920          return this;
3921        }
3922
3923        /**
3924         * @return {@link #location} (Where the service was provided.)
3925         */
3926        public Type getLocation() { 
3927          return this.location;
3928        }
3929
3930        /**
3931         * @return {@link #location} (Where the service was provided.)
3932         */
3933        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
3934          if (this.location == null)
3935            return null;
3936          if (!(this.location instanceof CodeableConcept))
3937            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
3938          return (CodeableConcept) this.location;
3939        }
3940
3941        public boolean hasLocationCodeableConcept() { 
3942          return this != null && this.location instanceof CodeableConcept;
3943        }
3944
3945        /**
3946         * @return {@link #location} (Where the service was provided.)
3947         */
3948        public Address getLocationAddress() throws FHIRException { 
3949          if (this.location == null)
3950            return null;
3951          if (!(this.location instanceof Address))
3952            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
3953          return (Address) this.location;
3954        }
3955
3956        public boolean hasLocationAddress() { 
3957          return this != null && this.location instanceof Address;
3958        }
3959
3960        /**
3961         * @return {@link #location} (Where the service was provided.)
3962         */
3963        public Reference getLocationReference() throws FHIRException { 
3964          if (this.location == null)
3965            return null;
3966          if (!(this.location instanceof Reference))
3967            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
3968          return (Reference) this.location;
3969        }
3970
3971        public boolean hasLocationReference() { 
3972          return this != null && this.location instanceof Reference;
3973        }
3974
3975        public boolean hasLocation() { 
3976          return this.location != null && !this.location.isEmpty();
3977        }
3978
3979        /**
3980         * @param value {@link #location} (Where the service was provided.)
3981         */
3982        public ItemComponent setLocation(Type value) { 
3983          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
3984            throw new Error("Not the right type for ExplanationOfBenefit.item.location[x]: "+value.fhirType());
3985          this.location = value;
3986          return this;
3987        }
3988
3989        /**
3990         * @return {@link #quantity} (The number of repetitions of a service or product.)
3991         */
3992        public SimpleQuantity getQuantity() { 
3993          if (this.quantity == null)
3994            if (Configuration.errorOnAutoCreate())
3995              throw new Error("Attempt to auto-create ItemComponent.quantity");
3996            else if (Configuration.doAutoCreate())
3997              this.quantity = new SimpleQuantity(); // cc
3998          return this.quantity;
3999        }
4000
4001        public boolean hasQuantity() { 
4002          return this.quantity != null && !this.quantity.isEmpty();
4003        }
4004
4005        /**
4006         * @param value {@link #quantity} (The number of repetitions of a service or product.)
4007         */
4008        public ItemComponent setQuantity(SimpleQuantity value) { 
4009          this.quantity = value;
4010          return this;
4011        }
4012
4013        /**
4014         * @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.)
4015         */
4016        public Money getUnitPrice() { 
4017          if (this.unitPrice == null)
4018            if (Configuration.errorOnAutoCreate())
4019              throw new Error("Attempt to auto-create ItemComponent.unitPrice");
4020            else if (Configuration.doAutoCreate())
4021              this.unitPrice = new Money(); // cc
4022          return this.unitPrice;
4023        }
4024
4025        public boolean hasUnitPrice() { 
4026          return this.unitPrice != null && !this.unitPrice.isEmpty();
4027        }
4028
4029        /**
4030         * @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.)
4031         */
4032        public ItemComponent setUnitPrice(Money value) { 
4033          this.unitPrice = value;
4034          return this;
4035        }
4036
4037        /**
4038         * @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
4039         */
4040        public DecimalType getFactorElement() { 
4041          if (this.factor == null)
4042            if (Configuration.errorOnAutoCreate())
4043              throw new Error("Attempt to auto-create ItemComponent.factor");
4044            else if (Configuration.doAutoCreate())
4045              this.factor = new DecimalType(); // bb
4046          return this.factor;
4047        }
4048
4049        public boolean hasFactorElement() { 
4050          return this.factor != null && !this.factor.isEmpty();
4051        }
4052
4053        public boolean hasFactor() { 
4054          return this.factor != null && !this.factor.isEmpty();
4055        }
4056
4057        /**
4058         * @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
4059         */
4060        public ItemComponent setFactorElement(DecimalType value) { 
4061          this.factor = value;
4062          return this;
4063        }
4064
4065        /**
4066         * @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.
4067         */
4068        public BigDecimal getFactor() { 
4069          return this.factor == null ? null : this.factor.getValue();
4070        }
4071
4072        /**
4073         * @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.
4074         */
4075        public ItemComponent setFactor(BigDecimal value) { 
4076          if (value == null)
4077            this.factor = null;
4078          else {
4079            if (this.factor == null)
4080              this.factor = new DecimalType();
4081            this.factor.setValue(value);
4082          }
4083          return this;
4084        }
4085
4086        /**
4087         * @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.
4088         */
4089        public ItemComponent setFactor(long value) { 
4090              this.factor = new DecimalType();
4091            this.factor.setValue(value);
4092          return this;
4093        }
4094
4095        /**
4096         * @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.
4097         */
4098        public ItemComponent setFactor(double value) { 
4099              this.factor = new DecimalType();
4100            this.factor.setValue(value);
4101          return this;
4102        }
4103
4104        /**
4105         * @return {@link #net} (The quantity times the unit price for an addittional 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.)
4106         */
4107        public Money getNet() { 
4108          if (this.net == null)
4109            if (Configuration.errorOnAutoCreate())
4110              throw new Error("Attempt to auto-create ItemComponent.net");
4111            else if (Configuration.doAutoCreate())
4112              this.net = new Money(); // cc
4113          return this.net;
4114        }
4115
4116        public boolean hasNet() { 
4117          return this.net != null && !this.net.isEmpty();
4118        }
4119
4120        /**
4121         * @param value {@link #net} (The quantity times the unit price for an addittional 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.)
4122         */
4123        public ItemComponent setNet(Money value) { 
4124          this.net = value;
4125          return this;
4126        }
4127
4128        /**
4129         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
4130         */
4131        public List<Reference> getUdi() { 
4132          if (this.udi == null)
4133            this.udi = new ArrayList<Reference>();
4134          return this.udi;
4135        }
4136
4137        /**
4138         * @return Returns a reference to <code>this</code> for easy method chaining
4139         */
4140        public ItemComponent setUdi(List<Reference> theUdi) { 
4141          this.udi = theUdi;
4142          return this;
4143        }
4144
4145        public boolean hasUdi() { 
4146          if (this.udi == null)
4147            return false;
4148          for (Reference item : this.udi)
4149            if (!item.isEmpty())
4150              return true;
4151          return false;
4152        }
4153
4154        public Reference addUdi() { //3
4155          Reference t = new Reference();
4156          if (this.udi == null)
4157            this.udi = new ArrayList<Reference>();
4158          this.udi.add(t);
4159          return t;
4160        }
4161
4162        public ItemComponent addUdi(Reference t) { //3
4163          if (t == null)
4164            return this;
4165          if (this.udi == null)
4166            this.udi = new ArrayList<Reference>();
4167          this.udi.add(t);
4168          return this;
4169        }
4170
4171        /**
4172         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
4173         */
4174        public Reference getUdiFirstRep() { 
4175          if (getUdi().isEmpty()) {
4176            addUdi();
4177          }
4178          return getUdi().get(0);
4179        }
4180
4181        /**
4182         * @deprecated Use Reference#setResource(IBaseResource) instead
4183         */
4184        @Deprecated
4185        public List<Device> getUdiTarget() { 
4186          if (this.udiTarget == null)
4187            this.udiTarget = new ArrayList<Device>();
4188          return this.udiTarget;
4189        }
4190
4191        /**
4192         * @deprecated Use Reference#setResource(IBaseResource) instead
4193         */
4194        @Deprecated
4195        public Device addUdiTarget() { 
4196          Device r = new Device();
4197          if (this.udiTarget == null)
4198            this.udiTarget = new ArrayList<Device>();
4199          this.udiTarget.add(r);
4200          return r;
4201        }
4202
4203        /**
4204         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4205         */
4206        public CodeableConcept getBodySite() { 
4207          if (this.bodySite == null)
4208            if (Configuration.errorOnAutoCreate())
4209              throw new Error("Attempt to auto-create ItemComponent.bodySite");
4210            else if (Configuration.doAutoCreate())
4211              this.bodySite = new CodeableConcept(); // cc
4212          return this.bodySite;
4213        }
4214
4215        public boolean hasBodySite() { 
4216          return this.bodySite != null && !this.bodySite.isEmpty();
4217        }
4218
4219        /**
4220         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4221         */
4222        public ItemComponent setBodySite(CodeableConcept value) { 
4223          this.bodySite = value;
4224          return this;
4225        }
4226
4227        /**
4228         * @return {@link #subSite} (A region or surface of the site, eg. limb region or tooth surface(s).)
4229         */
4230        public List<CodeableConcept> getSubSite() { 
4231          if (this.subSite == null)
4232            this.subSite = new ArrayList<CodeableConcept>();
4233          return this.subSite;
4234        }
4235
4236        /**
4237         * @return Returns a reference to <code>this</code> for easy method chaining
4238         */
4239        public ItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
4240          this.subSite = theSubSite;
4241          return this;
4242        }
4243
4244        public boolean hasSubSite() { 
4245          if (this.subSite == null)
4246            return false;
4247          for (CodeableConcept item : this.subSite)
4248            if (!item.isEmpty())
4249              return true;
4250          return false;
4251        }
4252
4253        public CodeableConcept addSubSite() { //3
4254          CodeableConcept t = new CodeableConcept();
4255          if (this.subSite == null)
4256            this.subSite = new ArrayList<CodeableConcept>();
4257          this.subSite.add(t);
4258          return t;
4259        }
4260
4261        public ItemComponent addSubSite(CodeableConcept t) { //3
4262          if (t == null)
4263            return this;
4264          if (this.subSite == null)
4265            this.subSite = new ArrayList<CodeableConcept>();
4266          this.subSite.add(t);
4267          return this;
4268        }
4269
4270        /**
4271         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist
4272         */
4273        public CodeableConcept getSubSiteFirstRep() { 
4274          if (getSubSite().isEmpty()) {
4275            addSubSite();
4276          }
4277          return getSubSite().get(0);
4278        }
4279
4280        /**
4281         * @return {@link #encounter} (A billed item may include goods or services provided in multiple encounters.)
4282         */
4283        public List<Reference> getEncounter() { 
4284          if (this.encounter == null)
4285            this.encounter = new ArrayList<Reference>();
4286          return this.encounter;
4287        }
4288
4289        /**
4290         * @return Returns a reference to <code>this</code> for easy method chaining
4291         */
4292        public ItemComponent setEncounter(List<Reference> theEncounter) { 
4293          this.encounter = theEncounter;
4294          return this;
4295        }
4296
4297        public boolean hasEncounter() { 
4298          if (this.encounter == null)
4299            return false;
4300          for (Reference item : this.encounter)
4301            if (!item.isEmpty())
4302              return true;
4303          return false;
4304        }
4305
4306        public Reference addEncounter() { //3
4307          Reference t = new Reference();
4308          if (this.encounter == null)
4309            this.encounter = new ArrayList<Reference>();
4310          this.encounter.add(t);
4311          return t;
4312        }
4313
4314        public ItemComponent addEncounter(Reference t) { //3
4315          if (t == null)
4316            return this;
4317          if (this.encounter == null)
4318            this.encounter = new ArrayList<Reference>();
4319          this.encounter.add(t);
4320          return this;
4321        }
4322
4323        /**
4324         * @return The first repetition of repeating field {@link #encounter}, creating it if it does not already exist
4325         */
4326        public Reference getEncounterFirstRep() { 
4327          if (getEncounter().isEmpty()) {
4328            addEncounter();
4329          }
4330          return getEncounter().get(0);
4331        }
4332
4333        /**
4334         * @deprecated Use Reference#setResource(IBaseResource) instead
4335         */
4336        @Deprecated
4337        public List<Encounter> getEncounterTarget() { 
4338          if (this.encounterTarget == null)
4339            this.encounterTarget = new ArrayList<Encounter>();
4340          return this.encounterTarget;
4341        }
4342
4343        /**
4344         * @deprecated Use Reference#setResource(IBaseResource) instead
4345         */
4346        @Deprecated
4347        public Encounter addEncounterTarget() { 
4348          Encounter r = new Encounter();
4349          if (this.encounterTarget == null)
4350            this.encounterTarget = new ArrayList<Encounter>();
4351          this.encounterTarget.add(r);
4352          return r;
4353        }
4354
4355        /**
4356         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
4357         */
4358        public List<PositiveIntType> getNoteNumber() { 
4359          if (this.noteNumber == null)
4360            this.noteNumber = new ArrayList<PositiveIntType>();
4361          return this.noteNumber;
4362        }
4363
4364        /**
4365         * @return Returns a reference to <code>this</code> for easy method chaining
4366         */
4367        public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
4368          this.noteNumber = theNoteNumber;
4369          return this;
4370        }
4371
4372        public boolean hasNoteNumber() { 
4373          if (this.noteNumber == null)
4374            return false;
4375          for (PositiveIntType item : this.noteNumber)
4376            if (!item.isEmpty())
4377              return true;
4378          return false;
4379        }
4380
4381        /**
4382         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
4383         */
4384        public PositiveIntType addNoteNumberElement() {//2 
4385          PositiveIntType t = new PositiveIntType();
4386          if (this.noteNumber == null)
4387            this.noteNumber = new ArrayList<PositiveIntType>();
4388          this.noteNumber.add(t);
4389          return t;
4390        }
4391
4392        /**
4393         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
4394         */
4395        public ItemComponent addNoteNumber(int value) { //1
4396          PositiveIntType t = new PositiveIntType();
4397          t.setValue(value);
4398          if (this.noteNumber == null)
4399            this.noteNumber = new ArrayList<PositiveIntType>();
4400          this.noteNumber.add(t);
4401          return this;
4402        }
4403
4404        /**
4405         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
4406         */
4407        public boolean hasNoteNumber(int value) { 
4408          if (this.noteNumber == null)
4409            return false;
4410          for (PositiveIntType v : this.noteNumber)
4411            if (v.getValue().equals(value)) // positiveInt
4412              return true;
4413          return false;
4414        }
4415
4416        /**
4417         * @return {@link #adjudication} (The adjudications results.)
4418         */
4419        public List<AdjudicationComponent> getAdjudication() { 
4420          if (this.adjudication == null)
4421            this.adjudication = new ArrayList<AdjudicationComponent>();
4422          return this.adjudication;
4423        }
4424
4425        /**
4426         * @return Returns a reference to <code>this</code> for easy method chaining
4427         */
4428        public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
4429          this.adjudication = theAdjudication;
4430          return this;
4431        }
4432
4433        public boolean hasAdjudication() { 
4434          if (this.adjudication == null)
4435            return false;
4436          for (AdjudicationComponent item : this.adjudication)
4437            if (!item.isEmpty())
4438              return true;
4439          return false;
4440        }
4441
4442        public AdjudicationComponent addAdjudication() { //3
4443          AdjudicationComponent t = new AdjudicationComponent();
4444          if (this.adjudication == null)
4445            this.adjudication = new ArrayList<AdjudicationComponent>();
4446          this.adjudication.add(t);
4447          return t;
4448        }
4449
4450        public ItemComponent addAdjudication(AdjudicationComponent t) { //3
4451          if (t == null)
4452            return this;
4453          if (this.adjudication == null)
4454            this.adjudication = new ArrayList<AdjudicationComponent>();
4455          this.adjudication.add(t);
4456          return this;
4457        }
4458
4459        /**
4460         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
4461         */
4462        public AdjudicationComponent getAdjudicationFirstRep() { 
4463          if (getAdjudication().isEmpty()) {
4464            addAdjudication();
4465          }
4466          return getAdjudication().get(0);
4467        }
4468
4469        /**
4470         * @return {@link #detail} (Second tier of goods and services.)
4471         */
4472        public List<DetailComponent> getDetail() { 
4473          if (this.detail == null)
4474            this.detail = new ArrayList<DetailComponent>();
4475          return this.detail;
4476        }
4477
4478        /**
4479         * @return Returns a reference to <code>this</code> for easy method chaining
4480         */
4481        public ItemComponent setDetail(List<DetailComponent> theDetail) { 
4482          this.detail = theDetail;
4483          return this;
4484        }
4485
4486        public boolean hasDetail() { 
4487          if (this.detail == null)
4488            return false;
4489          for (DetailComponent item : this.detail)
4490            if (!item.isEmpty())
4491              return true;
4492          return false;
4493        }
4494
4495        public DetailComponent addDetail() { //3
4496          DetailComponent t = new DetailComponent();
4497          if (this.detail == null)
4498            this.detail = new ArrayList<DetailComponent>();
4499          this.detail.add(t);
4500          return t;
4501        }
4502
4503        public ItemComponent addDetail(DetailComponent t) { //3
4504          if (t == null)
4505            return this;
4506          if (this.detail == null)
4507            this.detail = new ArrayList<DetailComponent>();
4508          this.detail.add(t);
4509          return this;
4510        }
4511
4512        /**
4513         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
4514         */
4515        public DetailComponent getDetailFirstRep() { 
4516          if (getDetail().isEmpty()) {
4517            addDetail();
4518          }
4519          return getDetail().get(0);
4520        }
4521
4522        protected void listChildren(List<Property> children) {
4523          super.listChildren(children);
4524          children.add(new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence));
4525          children.add(new Property("careTeamSequence", "positiveInt", "Careteam applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence));
4526          children.add(new Property("diagnosisSequence", "positiveInt", "Diagnosis applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence));
4527          children.add(new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, procedureSequence));
4528          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));
4529          children.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue));
4530          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category));
4531          children.add(new Property("service", "CodeableConcept", "If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. 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, service));
4532          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg 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));
4533          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));
4534          children.add(new Property("serviced[x]", "date|Period", "The date or dates when the enclosed suite of services were performed or completed.", 0, 1, serviced));
4535          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location));
4536          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
4537          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));
4538          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));
4539          children.add(new Property("net", "Money", "The quantity times the unit price for an addittional 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));
4540          children.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
4541          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
4542          children.add(new Property("subSite", "CodeableConcept", "A region or surface of the site, eg. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite));
4543          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));
4544          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
4545          children.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
4546          children.add(new Property("detail", "", "Second tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
4547        }
4548
4549        @Override
4550        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4551          switch (_hash) {
4552          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence);
4553          case 1070083823: /*careTeamSequence*/  return new Property("careTeamSequence", "positiveInt", "Careteam applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence);
4554          case -909769262: /*diagnosisSequence*/  return new Property("diagnosisSequence", "positiveInt", "Diagnosis applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence);
4555          case -808920140: /*procedureSequence*/  return new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product line.", 0, java.lang.Integer.MAX_VALUE, procedureSequence);
4556          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);
4557          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue);
4558          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category);
4559          case 1984153269: /*service*/  return new Property("service", "CodeableConcept", "If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. 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, service);
4560          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg 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);
4561          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);
4562          case -1927922223: /*serviced[x]*/  return new Property("serviced[x]", "date|Period", "The date or dates when the enclosed suite of services were performed or completed.", 0, 1, serviced);
4563          case 1379209295: /*serviced*/  return new Property("serviced[x]", "date|Period", "The date or dates when the enclosed suite of services were performed or completed.", 0, 1, serviced);
4564          case 363246749: /*servicedDate*/  return new Property("serviced[x]", "date|Period", "The date or dates when the enclosed suite of services were performed or completed.", 0, 1, serviced);
4565          case 1534966512: /*servicedPeriod*/  return new Property("serviced[x]", "date|Period", "The date or dates when the enclosed suite of services were performed or completed.", 0, 1, serviced);
4566          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4567          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4568          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4569          case -1280020865: /*locationAddress*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4570          case 755866390: /*locationReference*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the service was provided.", 0, 1, location);
4571          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
4572          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);
4573          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);
4574          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an addittional 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);
4575          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);
4576          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
4577          case -1868566105: /*subSite*/  return new Property("subSite", "CodeableConcept", "A region or surface of the site, eg. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite);
4578          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);
4579          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);
4580          case -231349275: /*adjudication*/  return new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
4581          case -1335224239: /*detail*/  return new Property("detail", "", "Second tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail);
4582          default: return super.getNamedProperty(_hash, _name, _checkValid);
4583          }
4584
4585        }
4586
4587      @Override
4588      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4589        switch (hash) {
4590        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
4591        case 1070083823: /*careTeamSequence*/ return this.careTeamSequence == null ? new Base[0] : this.careTeamSequence.toArray(new Base[this.careTeamSequence.size()]); // PositiveIntType
4592        case -909769262: /*diagnosisSequence*/ return this.diagnosisSequence == null ? new Base[0] : this.diagnosisSequence.toArray(new Base[this.diagnosisSequence.size()]); // PositiveIntType
4593        case -808920140: /*procedureSequence*/ return this.procedureSequence == null ? new Base[0] : this.procedureSequence.toArray(new Base[this.procedureSequence.size()]); // PositiveIntType
4594        case -702585587: /*informationSequence*/ return this.informationSequence == null ? new Base[0] : this.informationSequence.toArray(new Base[this.informationSequence.size()]); // PositiveIntType
4595        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
4596        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4597        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
4598        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
4599        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
4600        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
4601        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
4602        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
4603        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
4604        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
4605        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
4606        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
4607        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
4608        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
4609        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
4610        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
4611        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
4612        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
4613        default: return super.getProperty(hash, name, checkValid);
4614        }
4615
4616      }
4617
4618      @Override
4619      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4620        switch (hash) {
4621        case 1349547969: // sequence
4622          this.sequence = castToPositiveInt(value); // PositiveIntType
4623          return value;
4624        case 1070083823: // careTeamSequence
4625          this.getCareTeamSequence().add(castToPositiveInt(value)); // PositiveIntType
4626          return value;
4627        case -909769262: // diagnosisSequence
4628          this.getDiagnosisSequence().add(castToPositiveInt(value)); // PositiveIntType
4629          return value;
4630        case -808920140: // procedureSequence
4631          this.getProcedureSequence().add(castToPositiveInt(value)); // PositiveIntType
4632          return value;
4633        case -702585587: // informationSequence
4634          this.getInformationSequence().add(castToPositiveInt(value)); // PositiveIntType
4635          return value;
4636        case 1099842588: // revenue
4637          this.revenue = castToCodeableConcept(value); // CodeableConcept
4638          return value;
4639        case 50511102: // category
4640          this.category = castToCodeableConcept(value); // CodeableConcept
4641          return value;
4642        case 1984153269: // service
4643          this.service = castToCodeableConcept(value); // CodeableConcept
4644          return value;
4645        case -615513385: // modifier
4646          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
4647          return value;
4648        case 1010065041: // programCode
4649          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
4650          return value;
4651        case 1379209295: // serviced
4652          this.serviced = castToType(value); // Type
4653          return value;
4654        case 1901043637: // location
4655          this.location = castToType(value); // Type
4656          return value;
4657        case -1285004149: // quantity
4658          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
4659          return value;
4660        case -486196699: // unitPrice
4661          this.unitPrice = castToMoney(value); // Money
4662          return value;
4663        case -1282148017: // factor
4664          this.factor = castToDecimal(value); // DecimalType
4665          return value;
4666        case 108957: // net
4667          this.net = castToMoney(value); // Money
4668          return value;
4669        case 115642: // udi
4670          this.getUdi().add(castToReference(value)); // Reference
4671          return value;
4672        case 1702620169: // bodySite
4673          this.bodySite = castToCodeableConcept(value); // CodeableConcept
4674          return value;
4675        case -1868566105: // subSite
4676          this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
4677          return value;
4678        case 1524132147: // encounter
4679          this.getEncounter().add(castToReference(value)); // Reference
4680          return value;
4681        case -1110033957: // noteNumber
4682          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
4683          return value;
4684        case -231349275: // adjudication
4685          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
4686          return value;
4687        case -1335224239: // detail
4688          this.getDetail().add((DetailComponent) value); // DetailComponent
4689          return value;
4690        default: return super.setProperty(hash, name, value);
4691        }
4692
4693      }
4694
4695      @Override
4696      public Base setProperty(String name, Base value) throws FHIRException {
4697        if (name.equals("sequence")) {
4698          this.sequence = castToPositiveInt(value); // PositiveIntType
4699        } else if (name.equals("careTeamSequence")) {
4700          this.getCareTeamSequence().add(castToPositiveInt(value));
4701        } else if (name.equals("diagnosisSequence")) {
4702          this.getDiagnosisSequence().add(castToPositiveInt(value));
4703        } else if (name.equals("procedureSequence")) {
4704          this.getProcedureSequence().add(castToPositiveInt(value));
4705        } else if (name.equals("informationSequence")) {
4706          this.getInformationSequence().add(castToPositiveInt(value));
4707        } else if (name.equals("revenue")) {
4708          this.revenue = castToCodeableConcept(value); // CodeableConcept
4709        } else if (name.equals("category")) {
4710          this.category = castToCodeableConcept(value); // CodeableConcept
4711        } else if (name.equals("service")) {
4712          this.service = castToCodeableConcept(value); // CodeableConcept
4713        } else if (name.equals("modifier")) {
4714          this.getModifier().add(castToCodeableConcept(value));
4715        } else if (name.equals("programCode")) {
4716          this.getProgramCode().add(castToCodeableConcept(value));
4717        } else if (name.equals("serviced[x]")) {
4718          this.serviced = castToType(value); // Type
4719        } else if (name.equals("location[x]")) {
4720          this.location = castToType(value); // Type
4721        } else if (name.equals("quantity")) {
4722          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
4723        } else if (name.equals("unitPrice")) {
4724          this.unitPrice = castToMoney(value); // Money
4725        } else if (name.equals("factor")) {
4726          this.factor = castToDecimal(value); // DecimalType
4727        } else if (name.equals("net")) {
4728          this.net = castToMoney(value); // Money
4729        } else if (name.equals("udi")) {
4730          this.getUdi().add(castToReference(value));
4731        } else if (name.equals("bodySite")) {
4732          this.bodySite = castToCodeableConcept(value); // CodeableConcept
4733        } else if (name.equals("subSite")) {
4734          this.getSubSite().add(castToCodeableConcept(value));
4735        } else if (name.equals("encounter")) {
4736          this.getEncounter().add(castToReference(value));
4737        } else if (name.equals("noteNumber")) {
4738          this.getNoteNumber().add(castToPositiveInt(value));
4739        } else if (name.equals("adjudication")) {
4740          this.getAdjudication().add((AdjudicationComponent) value);
4741        } else if (name.equals("detail")) {
4742          this.getDetail().add((DetailComponent) value);
4743        } else
4744          return super.setProperty(name, value);
4745        return value;
4746      }
4747
4748      @Override
4749      public Base makeProperty(int hash, String name) throws FHIRException {
4750        switch (hash) {
4751        case 1349547969:  return getSequenceElement();
4752        case 1070083823:  return addCareTeamSequenceElement();
4753        case -909769262:  return addDiagnosisSequenceElement();
4754        case -808920140:  return addProcedureSequenceElement();
4755        case -702585587:  return addInformationSequenceElement();
4756        case 1099842588:  return getRevenue(); 
4757        case 50511102:  return getCategory(); 
4758        case 1984153269:  return getService(); 
4759        case -615513385:  return addModifier(); 
4760        case 1010065041:  return addProgramCode(); 
4761        case -1927922223:  return getServiced(); 
4762        case 1379209295:  return getServiced(); 
4763        case 552316075:  return getLocation(); 
4764        case 1901043637:  return getLocation(); 
4765        case -1285004149:  return getQuantity(); 
4766        case -486196699:  return getUnitPrice(); 
4767        case -1282148017:  return getFactorElement();
4768        case 108957:  return getNet(); 
4769        case 115642:  return addUdi(); 
4770        case 1702620169:  return getBodySite(); 
4771        case -1868566105:  return addSubSite(); 
4772        case 1524132147:  return addEncounter(); 
4773        case -1110033957:  return addNoteNumberElement();
4774        case -231349275:  return addAdjudication(); 
4775        case -1335224239:  return addDetail(); 
4776        default: return super.makeProperty(hash, name);
4777        }
4778
4779      }
4780
4781      @Override
4782      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4783        switch (hash) {
4784        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
4785        case 1070083823: /*careTeamSequence*/ return new String[] {"positiveInt"};
4786        case -909769262: /*diagnosisSequence*/ return new String[] {"positiveInt"};
4787        case -808920140: /*procedureSequence*/ return new String[] {"positiveInt"};
4788        case -702585587: /*informationSequence*/ return new String[] {"positiveInt"};
4789        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
4790        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
4791        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
4792        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
4793        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
4794        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
4795        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
4796        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
4797        case -486196699: /*unitPrice*/ return new String[] {"Money"};
4798        case -1282148017: /*factor*/ return new String[] {"decimal"};
4799        case 108957: /*net*/ return new String[] {"Money"};
4800        case 115642: /*udi*/ return new String[] {"Reference"};
4801        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
4802        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
4803        case 1524132147: /*encounter*/ return new String[] {"Reference"};
4804        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
4805        case -231349275: /*adjudication*/ return new String[] {};
4806        case -1335224239: /*detail*/ return new String[] {};
4807        default: return super.getTypesForProperty(hash, name);
4808        }
4809
4810      }
4811
4812      @Override
4813      public Base addChild(String name) throws FHIRException {
4814        if (name.equals("sequence")) {
4815          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
4816        }
4817        else if (name.equals("careTeamSequence")) {
4818          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.careTeamSequence");
4819        }
4820        else if (name.equals("diagnosisSequence")) {
4821          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.diagnosisSequence");
4822        }
4823        else if (name.equals("procedureSequence")) {
4824          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedureSequence");
4825        }
4826        else if (name.equals("informationSequence")) {
4827          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.informationSequence");
4828        }
4829        else if (name.equals("revenue")) {
4830          this.revenue = new CodeableConcept();
4831          return this.revenue;
4832        }
4833        else if (name.equals("category")) {
4834          this.category = new CodeableConcept();
4835          return this.category;
4836        }
4837        else if (name.equals("service")) {
4838          this.service = new CodeableConcept();
4839          return this.service;
4840        }
4841        else if (name.equals("modifier")) {
4842          return addModifier();
4843        }
4844        else if (name.equals("programCode")) {
4845          return addProgramCode();
4846        }
4847        else if (name.equals("servicedDate")) {
4848          this.serviced = new DateType();
4849          return this.serviced;
4850        }
4851        else if (name.equals("servicedPeriod")) {
4852          this.serviced = new Period();
4853          return this.serviced;
4854        }
4855        else if (name.equals("locationCodeableConcept")) {
4856          this.location = new CodeableConcept();
4857          return this.location;
4858        }
4859        else if (name.equals("locationAddress")) {
4860          this.location = new Address();
4861          return this.location;
4862        }
4863        else if (name.equals("locationReference")) {
4864          this.location = new Reference();
4865          return this.location;
4866        }
4867        else if (name.equals("quantity")) {
4868          this.quantity = new SimpleQuantity();
4869          return this.quantity;
4870        }
4871        else if (name.equals("unitPrice")) {
4872          this.unitPrice = new Money();
4873          return this.unitPrice;
4874        }
4875        else if (name.equals("factor")) {
4876          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
4877        }
4878        else if (name.equals("net")) {
4879          this.net = new Money();
4880          return this.net;
4881        }
4882        else if (name.equals("udi")) {
4883          return addUdi();
4884        }
4885        else if (name.equals("bodySite")) {
4886          this.bodySite = new CodeableConcept();
4887          return this.bodySite;
4888        }
4889        else if (name.equals("subSite")) {
4890          return addSubSite();
4891        }
4892        else if (name.equals("encounter")) {
4893          return addEncounter();
4894        }
4895        else if (name.equals("noteNumber")) {
4896          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
4897        }
4898        else if (name.equals("adjudication")) {
4899          return addAdjudication();
4900        }
4901        else if (name.equals("detail")) {
4902          return addDetail();
4903        }
4904        else
4905          return super.addChild(name);
4906      }
4907
4908      public ItemComponent copy() {
4909        ItemComponent dst = new ItemComponent();
4910        copyValues(dst);
4911        dst.sequence = sequence == null ? null : sequence.copy();
4912        if (careTeamSequence != null) {
4913          dst.careTeamSequence = new ArrayList<PositiveIntType>();
4914          for (PositiveIntType i : careTeamSequence)
4915            dst.careTeamSequence.add(i.copy());
4916        };
4917        if (diagnosisSequence != null) {
4918          dst.diagnosisSequence = new ArrayList<PositiveIntType>();
4919          for (PositiveIntType i : diagnosisSequence)
4920            dst.diagnosisSequence.add(i.copy());
4921        };
4922        if (procedureSequence != null) {
4923          dst.procedureSequence = new ArrayList<PositiveIntType>();
4924          for (PositiveIntType i : procedureSequence)
4925            dst.procedureSequence.add(i.copy());
4926        };
4927        if (informationSequence != null) {
4928          dst.informationSequence = new ArrayList<PositiveIntType>();
4929          for (PositiveIntType i : informationSequence)
4930            dst.informationSequence.add(i.copy());
4931        };
4932        dst.revenue = revenue == null ? null : revenue.copy();
4933        dst.category = category == null ? null : category.copy();
4934        dst.service = service == null ? null : service.copy();
4935        if (modifier != null) {
4936          dst.modifier = new ArrayList<CodeableConcept>();
4937          for (CodeableConcept i : modifier)
4938            dst.modifier.add(i.copy());
4939        };
4940        if (programCode != null) {
4941          dst.programCode = new ArrayList<CodeableConcept>();
4942          for (CodeableConcept i : programCode)
4943            dst.programCode.add(i.copy());
4944        };
4945        dst.serviced = serviced == null ? null : serviced.copy();
4946        dst.location = location == null ? null : location.copy();
4947        dst.quantity = quantity == null ? null : quantity.copy();
4948        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
4949        dst.factor = factor == null ? null : factor.copy();
4950        dst.net = net == null ? null : net.copy();
4951        if (udi != null) {
4952          dst.udi = new ArrayList<Reference>();
4953          for (Reference i : udi)
4954            dst.udi.add(i.copy());
4955        };
4956        dst.bodySite = bodySite == null ? null : bodySite.copy();
4957        if (subSite != null) {
4958          dst.subSite = new ArrayList<CodeableConcept>();
4959          for (CodeableConcept i : subSite)
4960            dst.subSite.add(i.copy());
4961        };
4962        if (encounter != null) {
4963          dst.encounter = new ArrayList<Reference>();
4964          for (Reference i : encounter)
4965            dst.encounter.add(i.copy());
4966        };
4967        if (noteNumber != null) {
4968          dst.noteNumber = new ArrayList<PositiveIntType>();
4969          for (PositiveIntType i : noteNumber)
4970            dst.noteNumber.add(i.copy());
4971        };
4972        if (adjudication != null) {
4973          dst.adjudication = new ArrayList<AdjudicationComponent>();
4974          for (AdjudicationComponent i : adjudication)
4975            dst.adjudication.add(i.copy());
4976        };
4977        if (detail != null) {
4978          dst.detail = new ArrayList<DetailComponent>();
4979          for (DetailComponent i : detail)
4980            dst.detail.add(i.copy());
4981        };
4982        return dst;
4983      }
4984
4985      @Override
4986      public boolean equalsDeep(Base other_) {
4987        if (!super.equalsDeep(other_))
4988          return false;
4989        if (!(other_ instanceof ItemComponent))
4990          return false;
4991        ItemComponent o = (ItemComponent) other_;
4992        return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamSequence, o.careTeamSequence, true)
4993           && compareDeep(diagnosisSequence, o.diagnosisSequence, true) && compareDeep(procedureSequence, o.procedureSequence, true)
4994           && compareDeep(informationSequence, o.informationSequence, true) && compareDeep(revenue, o.revenue, true)
4995           && compareDeep(category, o.category, true) && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true)
4996           && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
4997           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
4998           && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true) && compareDeep(bodySite, o.bodySite, true)
4999           && compareDeep(subSite, o.subSite, true) && compareDeep(encounter, o.encounter, true) && compareDeep(noteNumber, o.noteNumber, true)
5000           && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true);
5001      }
5002
5003      @Override
5004      public boolean equalsShallow(Base other_) {
5005        if (!super.equalsShallow(other_))
5006          return false;
5007        if (!(other_ instanceof ItemComponent))
5008          return false;
5009        ItemComponent o = (ItemComponent) other_;
5010        return compareValues(sequence, o.sequence, true) && compareValues(careTeamSequence, o.careTeamSequence, true)
5011           && compareValues(diagnosisSequence, o.diagnosisSequence, true) && compareValues(procedureSequence, o.procedureSequence, true)
5012           && compareValues(informationSequence, o.informationSequence, true) && compareValues(factor, o.factor, true)
5013           && compareValues(noteNumber, o.noteNumber, true);
5014      }
5015
5016      public boolean isEmpty() {
5017        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamSequence
5018          , diagnosisSequence, procedureSequence, informationSequence, revenue, category, service
5019          , modifier, programCode, serviced, location, quantity, unitPrice, factor, net
5020          , udi, bodySite, subSite, encounter, noteNumber, adjudication, detail);
5021      }
5022
5023  public String fhirType() {
5024    return "ExplanationOfBenefit.item";
5025
5026  }
5027
5028  }
5029
5030    @Block()
5031    public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
5032        /**
5033         * Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.
5034         */
5035        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
5036        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc." )
5037        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
5038        protected CodeableConcept category;
5039
5040        /**
5041         * Adjudication reason such as limit reached.
5042         */
5043        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5044        @Description(shortDefinition="Explanation of Adjudication outcome", formalDefinition="Adjudication reason such as limit reached." )
5045        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-reason")
5046        protected CodeableConcept reason;
5047
5048        /**
5049         * Monitory amount associated with the code.
5050         */
5051        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
5052        @Description(shortDefinition="Monetary amount", formalDefinition="Monitory amount associated with the code." )
5053        protected Money amount;
5054
5055        /**
5056         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5057         */
5058        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
5059        @Description(shortDefinition="Non-monitory value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
5060        protected DecimalType value;
5061
5062        private static final long serialVersionUID = 1559898786L;
5063
5064    /**
5065     * Constructor
5066     */
5067      public AdjudicationComponent() {
5068        super();
5069      }
5070
5071    /**
5072     * Constructor
5073     */
5074      public AdjudicationComponent(CodeableConcept category) {
5075        super();
5076        this.category = category;
5077      }
5078
5079        /**
5080         * @return {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
5081         */
5082        public CodeableConcept getCategory() { 
5083          if (this.category == null)
5084            if (Configuration.errorOnAutoCreate())
5085              throw new Error("Attempt to auto-create AdjudicationComponent.category");
5086            else if (Configuration.doAutoCreate())
5087              this.category = new CodeableConcept(); // cc
5088          return this.category;
5089        }
5090
5091        public boolean hasCategory() { 
5092          return this.category != null && !this.category.isEmpty();
5093        }
5094
5095        /**
5096         * @param value {@link #category} (Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.)
5097         */
5098        public AdjudicationComponent setCategory(CodeableConcept value) { 
5099          this.category = value;
5100          return this;
5101        }
5102
5103        /**
5104         * @return {@link #reason} (Adjudication reason such as limit reached.)
5105         */
5106        public CodeableConcept getReason() { 
5107          if (this.reason == null)
5108            if (Configuration.errorOnAutoCreate())
5109              throw new Error("Attempt to auto-create AdjudicationComponent.reason");
5110            else if (Configuration.doAutoCreate())
5111              this.reason = new CodeableConcept(); // cc
5112          return this.reason;
5113        }
5114
5115        public boolean hasReason() { 
5116          return this.reason != null && !this.reason.isEmpty();
5117        }
5118
5119        /**
5120         * @param value {@link #reason} (Adjudication reason such as limit reached.)
5121         */
5122        public AdjudicationComponent setReason(CodeableConcept value) { 
5123          this.reason = value;
5124          return this;
5125        }
5126
5127        /**
5128         * @return {@link #amount} (Monitory amount associated with the code.)
5129         */
5130        public Money getAmount() { 
5131          if (this.amount == null)
5132            if (Configuration.errorOnAutoCreate())
5133              throw new Error("Attempt to auto-create AdjudicationComponent.amount");
5134            else if (Configuration.doAutoCreate())
5135              this.amount = new Money(); // cc
5136          return this.amount;
5137        }
5138
5139        public boolean hasAmount() { 
5140          return this.amount != null && !this.amount.isEmpty();
5141        }
5142
5143        /**
5144         * @param value {@link #amount} (Monitory amount associated with the code.)
5145         */
5146        public AdjudicationComponent setAmount(Money value) { 
5147          this.amount = value;
5148          return this;
5149        }
5150
5151        /**
5152         * @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
5153         */
5154        public DecimalType getValueElement() { 
5155          if (this.value == null)
5156            if (Configuration.errorOnAutoCreate())
5157              throw new Error("Attempt to auto-create AdjudicationComponent.value");
5158            else if (Configuration.doAutoCreate())
5159              this.value = new DecimalType(); // bb
5160          return this.value;
5161        }
5162
5163        public boolean hasValueElement() { 
5164          return this.value != null && !this.value.isEmpty();
5165        }
5166
5167        public boolean hasValue() { 
5168          return this.value != null && !this.value.isEmpty();
5169        }
5170
5171        /**
5172         * @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
5173         */
5174        public AdjudicationComponent setValueElement(DecimalType value) { 
5175          this.value = value;
5176          return this;
5177        }
5178
5179        /**
5180         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5181         */
5182        public BigDecimal getValue() { 
5183          return this.value == null ? null : this.value.getValue();
5184        }
5185
5186        /**
5187         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5188         */
5189        public AdjudicationComponent setValue(BigDecimal value) { 
5190          if (value == null)
5191            this.value = null;
5192          else {
5193            if (this.value == null)
5194              this.value = new DecimalType();
5195            this.value.setValue(value);
5196          }
5197          return this;
5198        }
5199
5200        /**
5201         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5202         */
5203        public AdjudicationComponent setValue(long value) { 
5204              this.value = new DecimalType();
5205            this.value.setValue(value);
5206          return this;
5207        }
5208
5209        /**
5210         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
5211         */
5212        public AdjudicationComponent setValue(double value) { 
5213              this.value = new DecimalType();
5214            this.value.setValue(value);
5215          return this;
5216        }
5217
5218        protected void listChildren(List<Property> children) {
5219          super.listChildren(children);
5220          children.add(new Property("category", "CodeableConcept", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, 1, category));
5221          children.add(new Property("reason", "CodeableConcept", "Adjudication reason such as limit reached.", 0, 1, reason));
5222          children.add(new Property("amount", "Money", "Monitory amount associated with the code.", 0, 1, amount));
5223          children.add(new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, 1, value));
5224        }
5225
5226        @Override
5227        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5228          switch (_hash) {
5229          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.", 0, 1, category);
5230          case -934964668: /*reason*/  return new Property("reason", "CodeableConcept", "Adjudication reason such as limit reached.", 0, 1, reason);
5231          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monitory amount associated with the code.", 0, 1, amount);
5232          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);
5233          default: return super.getNamedProperty(_hash, _name, _checkValid);
5234          }
5235
5236        }
5237
5238      @Override
5239      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5240        switch (hash) {
5241        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
5242        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
5243        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
5244        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
5245        default: return super.getProperty(hash, name, checkValid);
5246        }
5247
5248      }
5249
5250      @Override
5251      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5252        switch (hash) {
5253        case 50511102: // category
5254          this.category = castToCodeableConcept(value); // CodeableConcept
5255          return value;
5256        case -934964668: // reason
5257          this.reason = castToCodeableConcept(value); // CodeableConcept
5258          return value;
5259        case -1413853096: // amount
5260          this.amount = castToMoney(value); // Money
5261          return value;
5262        case 111972721: // value
5263          this.value = castToDecimal(value); // DecimalType
5264          return value;
5265        default: return super.setProperty(hash, name, value);
5266        }
5267
5268      }
5269
5270      @Override
5271      public Base setProperty(String name, Base value) throws FHIRException {
5272        if (name.equals("category")) {
5273          this.category = castToCodeableConcept(value); // CodeableConcept
5274        } else if (name.equals("reason")) {
5275          this.reason = castToCodeableConcept(value); // CodeableConcept
5276        } else if (name.equals("amount")) {
5277          this.amount = castToMoney(value); // Money
5278        } else if (name.equals("value")) {
5279          this.value = castToDecimal(value); // DecimalType
5280        } else
5281          return super.setProperty(name, value);
5282        return value;
5283      }
5284
5285      @Override
5286      public Base makeProperty(int hash, String name) throws FHIRException {
5287        switch (hash) {
5288        case 50511102:  return getCategory(); 
5289        case -934964668:  return getReason(); 
5290        case -1413853096:  return getAmount(); 
5291        case 111972721:  return getValueElement();
5292        default: return super.makeProperty(hash, name);
5293        }
5294
5295      }
5296
5297      @Override
5298      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5299        switch (hash) {
5300        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5301        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
5302        case -1413853096: /*amount*/ return new String[] {"Money"};
5303        case 111972721: /*value*/ return new String[] {"decimal"};
5304        default: return super.getTypesForProperty(hash, name);
5305        }
5306
5307      }
5308
5309      @Override
5310      public Base addChild(String name) throws FHIRException {
5311        if (name.equals("category")) {
5312          this.category = new CodeableConcept();
5313          return this.category;
5314        }
5315        else if (name.equals("reason")) {
5316          this.reason = new CodeableConcept();
5317          return this.reason;
5318        }
5319        else if (name.equals("amount")) {
5320          this.amount = new Money();
5321          return this.amount;
5322        }
5323        else if (name.equals("value")) {
5324          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
5325        }
5326        else
5327          return super.addChild(name);
5328      }
5329
5330      public AdjudicationComponent copy() {
5331        AdjudicationComponent dst = new AdjudicationComponent();
5332        copyValues(dst);
5333        dst.category = category == null ? null : category.copy();
5334        dst.reason = reason == null ? null : reason.copy();
5335        dst.amount = amount == null ? null : amount.copy();
5336        dst.value = value == null ? null : value.copy();
5337        return dst;
5338      }
5339
5340      @Override
5341      public boolean equalsDeep(Base other_) {
5342        if (!super.equalsDeep(other_))
5343          return false;
5344        if (!(other_ instanceof AdjudicationComponent))
5345          return false;
5346        AdjudicationComponent o = (AdjudicationComponent) other_;
5347        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
5348           && compareDeep(value, o.value, true);
5349      }
5350
5351      @Override
5352      public boolean equalsShallow(Base other_) {
5353        if (!super.equalsShallow(other_))
5354          return false;
5355        if (!(other_ instanceof AdjudicationComponent))
5356          return false;
5357        AdjudicationComponent o = (AdjudicationComponent) other_;
5358        return compareValues(value, o.value, true);
5359      }
5360
5361      public boolean isEmpty() {
5362        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount
5363          , value);
5364      }
5365
5366  public String fhirType() {
5367    return "ExplanationOfBenefit.item.adjudication";
5368
5369  }
5370
5371  }
5372
5373    @Block()
5374    public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
5375        /**
5376         * A service line number.
5377         */
5378        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
5379        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
5380        protected PositiveIntType sequence;
5381
5382        /**
5383         * The type of reveneu or cost center providing the product and/or service.
5384         */
5385        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5386        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
5387        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
5388        protected CodeableConcept revenue;
5389
5390        /**
5391         * Health Care Service Type Codes  to identify the classification of service or benefits.
5392         */
5393        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
5394        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
5395        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
5396        protected CodeableConcept category;
5397
5398        /**
5399         * If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. 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'.
5400         */
5401        @Child(name = "service", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
5402        @Description(shortDefinition="Billing Code", formalDefinition="If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. 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'." )
5403        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
5404        protected CodeableConcept service;
5405
5406        /**
5407         * Item typification or modifiers codes, eg 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.
5408         */
5409        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5410        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, eg 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." )
5411        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
5412        protected List<CodeableConcept> modifier;
5413
5414        /**
5415         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
5416         */
5417        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5418        @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." )
5419        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
5420        protected List<CodeableConcept> programCode;
5421
5422        /**
5423         * The number of repetitions of a service or product.
5424         */
5425        @Child(name = "quantity", type = {SimpleQuantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
5426        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
5427        protected SimpleQuantity quantity;
5428
5429        /**
5430         * 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.
5431         */
5432        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
5433        @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." )
5434        protected Money unitPrice;
5435
5436        /**
5437         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
5438         */
5439        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
5440        @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." )
5441        protected DecimalType factor;
5442
5443        /**
5444         * The quantity times the unit price for an addittional 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.
5445         */
5446        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
5447        @Description(shortDefinition="Total additional item cost", formalDefinition="The quantity times the unit price for an addittional 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." )
5448        protected Money net;
5449
5450        /**
5451         * List of Unique Device Identifiers associated with this line item.
5452         */
5453        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5454        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
5455        protected List<Reference> udi;
5456        /**
5457         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
5458         */
5459        protected List<Device> udiTarget;
5460
5461
5462        /**
5463         * A list of note references to the notes provided below.
5464         */
5465        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5466        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
5467        protected List<PositiveIntType> noteNumber;
5468
5469        /**
5470         * The adjudications results.
5471         */
5472        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5473        @Description(shortDefinition="Detail level adjudication details", formalDefinition="The adjudications results." )
5474        protected List<AdjudicationComponent> adjudication;
5475
5476        /**
5477         * Third tier of goods and services.
5478         */
5479        @Child(name = "subDetail", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5480        @Description(shortDefinition="Additional items", formalDefinition="Third tier of goods and services." )
5481        protected List<SubDetailComponent> subDetail;
5482
5483        private static final long serialVersionUID = 1856934466L;
5484
5485    /**
5486     * Constructor
5487     */
5488      public DetailComponent() {
5489        super();
5490      }
5491
5492    /**
5493     * Constructor
5494     */
5495      public DetailComponent(PositiveIntType sequence) {
5496        super();
5497        this.sequence = sequence;
5498      }
5499
5500        /**
5501         * @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
5502         */
5503        public PositiveIntType getSequenceElement() { 
5504          if (this.sequence == null)
5505            if (Configuration.errorOnAutoCreate())
5506              throw new Error("Attempt to auto-create DetailComponent.sequence");
5507            else if (Configuration.doAutoCreate())
5508              this.sequence = new PositiveIntType(); // bb
5509          return this.sequence;
5510        }
5511
5512        public boolean hasSequenceElement() { 
5513          return this.sequence != null && !this.sequence.isEmpty();
5514        }
5515
5516        public boolean hasSequence() { 
5517          return this.sequence != null && !this.sequence.isEmpty();
5518        }
5519
5520        /**
5521         * @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
5522         */
5523        public DetailComponent setSequenceElement(PositiveIntType value) { 
5524          this.sequence = value;
5525          return this;
5526        }
5527
5528        /**
5529         * @return A service line number.
5530         */
5531        public int getSequence() { 
5532          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
5533        }
5534
5535        /**
5536         * @param value A service line number.
5537         */
5538        public DetailComponent setSequence(int value) { 
5539            if (this.sequence == null)
5540              this.sequence = new PositiveIntType();
5541            this.sequence.setValue(value);
5542          return this;
5543        }
5544
5545        /**
5546         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
5547         */
5548        public CodeableConcept getRevenue() { 
5549          if (this.revenue == null)
5550            if (Configuration.errorOnAutoCreate())
5551              throw new Error("Attempt to auto-create DetailComponent.revenue");
5552            else if (Configuration.doAutoCreate())
5553              this.revenue = new CodeableConcept(); // cc
5554          return this.revenue;
5555        }
5556
5557        public boolean hasRevenue() { 
5558          return this.revenue != null && !this.revenue.isEmpty();
5559        }
5560
5561        /**
5562         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
5563         */
5564        public DetailComponent setRevenue(CodeableConcept value) { 
5565          this.revenue = value;
5566          return this;
5567        }
5568
5569        /**
5570         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
5571         */
5572        public CodeableConcept getCategory() { 
5573          if (this.category == null)
5574            if (Configuration.errorOnAutoCreate())
5575              throw new Error("Attempt to auto-create DetailComponent.category");
5576            else if (Configuration.doAutoCreate())
5577              this.category = new CodeableConcept(); // cc
5578          return this.category;
5579        }
5580
5581        public boolean hasCategory() { 
5582          return this.category != null && !this.category.isEmpty();
5583        }
5584
5585        /**
5586         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
5587         */
5588        public DetailComponent setCategory(CodeableConcept value) { 
5589          this.category = value;
5590          return this;
5591        }
5592
5593        /**
5594         * @return {@link #service} (If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. 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'.)
5595         */
5596        public CodeableConcept getService() { 
5597          if (this.service == null)
5598            if (Configuration.errorOnAutoCreate())
5599              throw new Error("Attempt to auto-create DetailComponent.service");
5600            else if (Configuration.doAutoCreate())
5601              this.service = new CodeableConcept(); // cc
5602          return this.service;
5603        }
5604
5605        public boolean hasService() { 
5606          return this.service != null && !this.service.isEmpty();
5607        }
5608
5609        /**
5610         * @param value {@link #service} (If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. 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'.)
5611         */
5612        public DetailComponent setService(CodeableConcept value) { 
5613          this.service = value;
5614          return this;
5615        }
5616
5617        /**
5618         * @return {@link #modifier} (Item typification or modifiers codes, eg 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.)
5619         */
5620        public List<CodeableConcept> getModifier() { 
5621          if (this.modifier == null)
5622            this.modifier = new ArrayList<CodeableConcept>();
5623          return this.modifier;
5624        }
5625
5626        /**
5627         * @return Returns a reference to <code>this</code> for easy method chaining
5628         */
5629        public DetailComponent setModifier(List<CodeableConcept> theModifier) { 
5630          this.modifier = theModifier;
5631          return this;
5632        }
5633
5634        public boolean hasModifier() { 
5635          if (this.modifier == null)
5636            return false;
5637          for (CodeableConcept item : this.modifier)
5638            if (!item.isEmpty())
5639              return true;
5640          return false;
5641        }
5642
5643        public CodeableConcept addModifier() { //3
5644          CodeableConcept t = new CodeableConcept();
5645          if (this.modifier == null)
5646            this.modifier = new ArrayList<CodeableConcept>();
5647          this.modifier.add(t);
5648          return t;
5649        }
5650
5651        public DetailComponent addModifier(CodeableConcept t) { //3
5652          if (t == null)
5653            return this;
5654          if (this.modifier == null)
5655            this.modifier = new ArrayList<CodeableConcept>();
5656          this.modifier.add(t);
5657          return this;
5658        }
5659
5660        /**
5661         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
5662         */
5663        public CodeableConcept getModifierFirstRep() { 
5664          if (getModifier().isEmpty()) {
5665            addModifier();
5666          }
5667          return getModifier().get(0);
5668        }
5669
5670        /**
5671         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
5672         */
5673        public List<CodeableConcept> getProgramCode() { 
5674          if (this.programCode == null)
5675            this.programCode = new ArrayList<CodeableConcept>();
5676          return this.programCode;
5677        }
5678
5679        /**
5680         * @return Returns a reference to <code>this</code> for easy method chaining
5681         */
5682        public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
5683          this.programCode = theProgramCode;
5684          return this;
5685        }
5686
5687        public boolean hasProgramCode() { 
5688          if (this.programCode == null)
5689            return false;
5690          for (CodeableConcept item : this.programCode)
5691            if (!item.isEmpty())
5692              return true;
5693          return false;
5694        }
5695
5696        public CodeableConcept addProgramCode() { //3
5697          CodeableConcept t = new CodeableConcept();
5698          if (this.programCode == null)
5699            this.programCode = new ArrayList<CodeableConcept>();
5700          this.programCode.add(t);
5701          return t;
5702        }
5703
5704        public DetailComponent addProgramCode(CodeableConcept t) { //3
5705          if (t == null)
5706            return this;
5707          if (this.programCode == null)
5708            this.programCode = new ArrayList<CodeableConcept>();
5709          this.programCode.add(t);
5710          return this;
5711        }
5712
5713        /**
5714         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
5715         */
5716        public CodeableConcept getProgramCodeFirstRep() { 
5717          if (getProgramCode().isEmpty()) {
5718            addProgramCode();
5719          }
5720          return getProgramCode().get(0);
5721        }
5722
5723        /**
5724         * @return {@link #quantity} (The number of repetitions of a service or product.)
5725         */
5726        public SimpleQuantity getQuantity() { 
5727          if (this.quantity == null)
5728            if (Configuration.errorOnAutoCreate())
5729              throw new Error("Attempt to auto-create DetailComponent.quantity");
5730            else if (Configuration.doAutoCreate())
5731              this.quantity = new SimpleQuantity(); // cc
5732          return this.quantity;
5733        }
5734
5735        public boolean hasQuantity() { 
5736          return this.quantity != null && !this.quantity.isEmpty();
5737        }
5738
5739        /**
5740         * @param value {@link #quantity} (The number of repetitions of a service or product.)
5741         */
5742        public DetailComponent setQuantity(SimpleQuantity value) { 
5743          this.quantity = value;
5744          return this;
5745        }
5746
5747        /**
5748         * @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.)
5749         */
5750        public Money getUnitPrice() { 
5751          if (this.unitPrice == null)
5752            if (Configuration.errorOnAutoCreate())
5753              throw new Error("Attempt to auto-create DetailComponent.unitPrice");
5754            else if (Configuration.doAutoCreate())
5755              this.unitPrice = new Money(); // cc
5756          return this.unitPrice;
5757        }
5758
5759        public boolean hasUnitPrice() { 
5760          return this.unitPrice != null && !this.unitPrice.isEmpty();
5761        }
5762
5763        /**
5764         * @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.)
5765         */
5766        public DetailComponent setUnitPrice(Money value) { 
5767          this.unitPrice = value;
5768          return this;
5769        }
5770
5771        /**
5772         * @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
5773         */
5774        public DecimalType getFactorElement() { 
5775          if (this.factor == null)
5776            if (Configuration.errorOnAutoCreate())
5777              throw new Error("Attempt to auto-create DetailComponent.factor");
5778            else if (Configuration.doAutoCreate())
5779              this.factor = new DecimalType(); // bb
5780          return this.factor;
5781        }
5782
5783        public boolean hasFactorElement() { 
5784          return this.factor != null && !this.factor.isEmpty();
5785        }
5786
5787        public boolean hasFactor() { 
5788          return this.factor != null && !this.factor.isEmpty();
5789        }
5790
5791        /**
5792         * @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
5793         */
5794        public DetailComponent setFactorElement(DecimalType value) { 
5795          this.factor = value;
5796          return this;
5797        }
5798
5799        /**
5800         * @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.
5801         */
5802        public BigDecimal getFactor() { 
5803          return this.factor == null ? null : this.factor.getValue();
5804        }
5805
5806        /**
5807         * @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.
5808         */
5809        public DetailComponent setFactor(BigDecimal value) { 
5810          if (value == null)
5811            this.factor = null;
5812          else {
5813            if (this.factor == null)
5814              this.factor = new DecimalType();
5815            this.factor.setValue(value);
5816          }
5817          return this;
5818        }
5819
5820        /**
5821         * @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.
5822         */
5823        public DetailComponent setFactor(long value) { 
5824              this.factor = new DecimalType();
5825            this.factor.setValue(value);
5826          return this;
5827        }
5828
5829        /**
5830         * @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.
5831         */
5832        public DetailComponent setFactor(double value) { 
5833              this.factor = new DecimalType();
5834            this.factor.setValue(value);
5835          return this;
5836        }
5837
5838        /**
5839         * @return {@link #net} (The quantity times the unit price for an addittional 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.)
5840         */
5841        public Money getNet() { 
5842          if (this.net == null)
5843            if (Configuration.errorOnAutoCreate())
5844              throw new Error("Attempt to auto-create DetailComponent.net");
5845            else if (Configuration.doAutoCreate())
5846              this.net = new Money(); // cc
5847          return this.net;
5848        }
5849
5850        public boolean hasNet() { 
5851          return this.net != null && !this.net.isEmpty();
5852        }
5853
5854        /**
5855         * @param value {@link #net} (The quantity times the unit price for an addittional 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.)
5856         */
5857        public DetailComponent setNet(Money value) { 
5858          this.net = value;
5859          return this;
5860        }
5861
5862        /**
5863         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
5864         */
5865        public List<Reference> getUdi() { 
5866          if (this.udi == null)
5867            this.udi = new ArrayList<Reference>();
5868          return this.udi;
5869        }
5870
5871        /**
5872         * @return Returns a reference to <code>this</code> for easy method chaining
5873         */
5874        public DetailComponent setUdi(List<Reference> theUdi) { 
5875          this.udi = theUdi;
5876          return this;
5877        }
5878
5879        public boolean hasUdi() { 
5880          if (this.udi == null)
5881            return false;
5882          for (Reference item : this.udi)
5883            if (!item.isEmpty())
5884              return true;
5885          return false;
5886        }
5887
5888        public Reference addUdi() { //3
5889          Reference t = new Reference();
5890          if (this.udi == null)
5891            this.udi = new ArrayList<Reference>();
5892          this.udi.add(t);
5893          return t;
5894        }
5895
5896        public DetailComponent addUdi(Reference t) { //3
5897          if (t == null)
5898            return this;
5899          if (this.udi == null)
5900            this.udi = new ArrayList<Reference>();
5901          this.udi.add(t);
5902          return this;
5903        }
5904
5905        /**
5906         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
5907         */
5908        public Reference getUdiFirstRep() { 
5909          if (getUdi().isEmpty()) {
5910            addUdi();
5911          }
5912          return getUdi().get(0);
5913        }
5914
5915        /**
5916         * @deprecated Use Reference#setResource(IBaseResource) instead
5917         */
5918        @Deprecated
5919        public List<Device> getUdiTarget() { 
5920          if (this.udiTarget == null)
5921            this.udiTarget = new ArrayList<Device>();
5922          return this.udiTarget;
5923        }
5924
5925        /**
5926         * @deprecated Use Reference#setResource(IBaseResource) instead
5927         */
5928        @Deprecated
5929        public Device addUdiTarget() { 
5930          Device r = new Device();
5931          if (this.udiTarget == null)
5932            this.udiTarget = new ArrayList<Device>();
5933          this.udiTarget.add(r);
5934          return r;
5935        }
5936
5937        /**
5938         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
5939         */
5940        public List<PositiveIntType> getNoteNumber() { 
5941          if (this.noteNumber == null)
5942            this.noteNumber = new ArrayList<PositiveIntType>();
5943          return this.noteNumber;
5944        }
5945
5946        /**
5947         * @return Returns a reference to <code>this</code> for easy method chaining
5948         */
5949        public DetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
5950          this.noteNumber = theNoteNumber;
5951          return this;
5952        }
5953
5954        public boolean hasNoteNumber() { 
5955          if (this.noteNumber == null)
5956            return false;
5957          for (PositiveIntType item : this.noteNumber)
5958            if (!item.isEmpty())
5959              return true;
5960          return false;
5961        }
5962
5963        /**
5964         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
5965         */
5966        public PositiveIntType addNoteNumberElement() {//2 
5967          PositiveIntType t = new PositiveIntType();
5968          if (this.noteNumber == null)
5969            this.noteNumber = new ArrayList<PositiveIntType>();
5970          this.noteNumber.add(t);
5971          return t;
5972        }
5973
5974        /**
5975         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
5976         */
5977        public DetailComponent addNoteNumber(int value) { //1
5978          PositiveIntType t = new PositiveIntType();
5979          t.setValue(value);
5980          if (this.noteNumber == null)
5981            this.noteNumber = new ArrayList<PositiveIntType>();
5982          this.noteNumber.add(t);
5983          return this;
5984        }
5985
5986        /**
5987         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
5988         */
5989        public boolean hasNoteNumber(int value) { 
5990          if (this.noteNumber == null)
5991            return false;
5992          for (PositiveIntType v : this.noteNumber)
5993            if (v.getValue().equals(value)) // positiveInt
5994              return true;
5995          return false;
5996        }
5997
5998        /**
5999         * @return {@link #adjudication} (The adjudications results.)
6000         */
6001        public List<AdjudicationComponent> getAdjudication() { 
6002          if (this.adjudication == null)
6003            this.adjudication = new ArrayList<AdjudicationComponent>();
6004          return this.adjudication;
6005        }
6006
6007        /**
6008         * @return Returns a reference to <code>this</code> for easy method chaining
6009         */
6010        public DetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
6011          this.adjudication = theAdjudication;
6012          return this;
6013        }
6014
6015        public boolean hasAdjudication() { 
6016          if (this.adjudication == null)
6017            return false;
6018          for (AdjudicationComponent item : this.adjudication)
6019            if (!item.isEmpty())
6020              return true;
6021          return false;
6022        }
6023
6024        public AdjudicationComponent addAdjudication() { //3
6025          AdjudicationComponent t = new AdjudicationComponent();
6026          if (this.adjudication == null)
6027            this.adjudication = new ArrayList<AdjudicationComponent>();
6028          this.adjudication.add(t);
6029          return t;
6030        }
6031
6032        public DetailComponent addAdjudication(AdjudicationComponent t) { //3
6033          if (t == null)
6034            return this;
6035          if (this.adjudication == null)
6036            this.adjudication = new ArrayList<AdjudicationComponent>();
6037          this.adjudication.add(t);
6038          return this;
6039        }
6040
6041        /**
6042         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
6043         */
6044        public AdjudicationComponent getAdjudicationFirstRep() { 
6045          if (getAdjudication().isEmpty()) {
6046            addAdjudication();
6047          }
6048          return getAdjudication().get(0);
6049        }
6050
6051        /**
6052         * @return {@link #subDetail} (Third tier of goods and services.)
6053         */
6054        public List<SubDetailComponent> getSubDetail() { 
6055          if (this.subDetail == null)
6056            this.subDetail = new ArrayList<SubDetailComponent>();
6057          return this.subDetail;
6058        }
6059
6060        /**
6061         * @return Returns a reference to <code>this</code> for easy method chaining
6062         */
6063        public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) { 
6064          this.subDetail = theSubDetail;
6065          return this;
6066        }
6067
6068        public boolean hasSubDetail() { 
6069          if (this.subDetail == null)
6070            return false;
6071          for (SubDetailComponent item : this.subDetail)
6072            if (!item.isEmpty())
6073              return true;
6074          return false;
6075        }
6076
6077        public SubDetailComponent addSubDetail() { //3
6078          SubDetailComponent t = new SubDetailComponent();
6079          if (this.subDetail == null)
6080            this.subDetail = new ArrayList<SubDetailComponent>();
6081          this.subDetail.add(t);
6082          return t;
6083        }
6084
6085        public DetailComponent addSubDetail(SubDetailComponent t) { //3
6086          if (t == null)
6087            return this;
6088          if (this.subDetail == null)
6089            this.subDetail = new ArrayList<SubDetailComponent>();
6090          this.subDetail.add(t);
6091          return this;
6092        }
6093
6094        /**
6095         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist
6096         */
6097        public SubDetailComponent getSubDetailFirstRep() { 
6098          if (getSubDetail().isEmpty()) {
6099            addSubDetail();
6100          }
6101          return getSubDetail().get(0);
6102        }
6103
6104        protected void listChildren(List<Property> children) {
6105          super.listChildren(children);
6106          children.add(new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence));
6107          children.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue));
6108          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category));
6109          children.add(new Property("service", "CodeableConcept", "If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. 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, service));
6110          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg 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));
6111          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));
6112          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
6113          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));
6114          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));
6115          children.add(new Property("net", "Money", "The quantity times the unit price for an addittional 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));
6116          children.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
6117          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
6118          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6119          children.add(new Property("subDetail", "", "Third tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
6120        }
6121
6122        @Override
6123        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6124          switch (_hash) {
6125          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence);
6126          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue);
6127          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category);
6128          case 1984153269: /*service*/  return new Property("service", "CodeableConcept", "If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. 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, service);
6129          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg 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);
6130          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);
6131          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
6132          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);
6133          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);
6134          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an addittional 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);
6135          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);
6136          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);
6137          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
6138          case -828829007: /*subDetail*/  return new Property("subDetail", "", "Third tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
6139          default: return super.getNamedProperty(_hash, _name, _checkValid);
6140          }
6141
6142        }
6143
6144      @Override
6145      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6146        switch (hash) {
6147        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
6148        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
6149        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
6150        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
6151        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
6152        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
6153        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
6154        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6155        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6156        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6157        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
6158        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
6159        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
6160        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
6161        default: return super.getProperty(hash, name, checkValid);
6162        }
6163
6164      }
6165
6166      @Override
6167      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6168        switch (hash) {
6169        case 1349547969: // sequence
6170          this.sequence = castToPositiveInt(value); // PositiveIntType
6171          return value;
6172        case 1099842588: // revenue
6173          this.revenue = castToCodeableConcept(value); // CodeableConcept
6174          return value;
6175        case 50511102: // category
6176          this.category = castToCodeableConcept(value); // CodeableConcept
6177          return value;
6178        case 1984153269: // service
6179          this.service = castToCodeableConcept(value); // CodeableConcept
6180          return value;
6181        case -615513385: // modifier
6182          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
6183          return value;
6184        case 1010065041: // programCode
6185          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
6186          return value;
6187        case -1285004149: // quantity
6188          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
6189          return value;
6190        case -486196699: // unitPrice
6191          this.unitPrice = castToMoney(value); // Money
6192          return value;
6193        case -1282148017: // factor
6194          this.factor = castToDecimal(value); // DecimalType
6195          return value;
6196        case 108957: // net
6197          this.net = castToMoney(value); // Money
6198          return value;
6199        case 115642: // udi
6200          this.getUdi().add(castToReference(value)); // Reference
6201          return value;
6202        case -1110033957: // noteNumber
6203          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
6204          return value;
6205        case -231349275: // adjudication
6206          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
6207          return value;
6208        case -828829007: // subDetail
6209          this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
6210          return value;
6211        default: return super.setProperty(hash, name, value);
6212        }
6213
6214      }
6215
6216      @Override
6217      public Base setProperty(String name, Base value) throws FHIRException {
6218        if (name.equals("sequence")) {
6219          this.sequence = castToPositiveInt(value); // PositiveIntType
6220        } else if (name.equals("revenue")) {
6221          this.revenue = castToCodeableConcept(value); // CodeableConcept
6222        } else if (name.equals("category")) {
6223          this.category = castToCodeableConcept(value); // CodeableConcept
6224        } else if (name.equals("service")) {
6225          this.service = castToCodeableConcept(value); // CodeableConcept
6226        } else if (name.equals("modifier")) {
6227          this.getModifier().add(castToCodeableConcept(value));
6228        } else if (name.equals("programCode")) {
6229          this.getProgramCode().add(castToCodeableConcept(value));
6230        } else if (name.equals("quantity")) {
6231          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
6232        } else if (name.equals("unitPrice")) {
6233          this.unitPrice = castToMoney(value); // Money
6234        } else if (name.equals("factor")) {
6235          this.factor = castToDecimal(value); // DecimalType
6236        } else if (name.equals("net")) {
6237          this.net = castToMoney(value); // Money
6238        } else if (name.equals("udi")) {
6239          this.getUdi().add(castToReference(value));
6240        } else if (name.equals("noteNumber")) {
6241          this.getNoteNumber().add(castToPositiveInt(value));
6242        } else if (name.equals("adjudication")) {
6243          this.getAdjudication().add((AdjudicationComponent) value);
6244        } else if (name.equals("subDetail")) {
6245          this.getSubDetail().add((SubDetailComponent) value);
6246        } else
6247          return super.setProperty(name, value);
6248        return value;
6249      }
6250
6251      @Override
6252      public Base makeProperty(int hash, String name) throws FHIRException {
6253        switch (hash) {
6254        case 1349547969:  return getSequenceElement();
6255        case 1099842588:  return getRevenue(); 
6256        case 50511102:  return getCategory(); 
6257        case 1984153269:  return getService(); 
6258        case -615513385:  return addModifier(); 
6259        case 1010065041:  return addProgramCode(); 
6260        case -1285004149:  return getQuantity(); 
6261        case -486196699:  return getUnitPrice(); 
6262        case -1282148017:  return getFactorElement();
6263        case 108957:  return getNet(); 
6264        case 115642:  return addUdi(); 
6265        case -1110033957:  return addNoteNumberElement();
6266        case -231349275:  return addAdjudication(); 
6267        case -828829007:  return addSubDetail(); 
6268        default: return super.makeProperty(hash, name);
6269        }
6270
6271      }
6272
6273      @Override
6274      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6275        switch (hash) {
6276        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
6277        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
6278        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
6279        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
6280        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
6281        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
6282        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
6283        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6284        case -1282148017: /*factor*/ return new String[] {"decimal"};
6285        case 108957: /*net*/ return new String[] {"Money"};
6286        case 115642: /*udi*/ return new String[] {"Reference"};
6287        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
6288        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
6289        case -828829007: /*subDetail*/ return new String[] {};
6290        default: return super.getTypesForProperty(hash, name);
6291        }
6292
6293      }
6294
6295      @Override
6296      public Base addChild(String name) throws FHIRException {
6297        if (name.equals("sequence")) {
6298          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
6299        }
6300        else if (name.equals("revenue")) {
6301          this.revenue = new CodeableConcept();
6302          return this.revenue;
6303        }
6304        else if (name.equals("category")) {
6305          this.category = new CodeableConcept();
6306          return this.category;
6307        }
6308        else if (name.equals("service")) {
6309          this.service = new CodeableConcept();
6310          return this.service;
6311        }
6312        else if (name.equals("modifier")) {
6313          return addModifier();
6314        }
6315        else if (name.equals("programCode")) {
6316          return addProgramCode();
6317        }
6318        else if (name.equals("quantity")) {
6319          this.quantity = new SimpleQuantity();
6320          return this.quantity;
6321        }
6322        else if (name.equals("unitPrice")) {
6323          this.unitPrice = new Money();
6324          return this.unitPrice;
6325        }
6326        else if (name.equals("factor")) {
6327          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
6328        }
6329        else if (name.equals("net")) {
6330          this.net = new Money();
6331          return this.net;
6332        }
6333        else if (name.equals("udi")) {
6334          return addUdi();
6335        }
6336        else if (name.equals("noteNumber")) {
6337          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
6338        }
6339        else if (name.equals("adjudication")) {
6340          return addAdjudication();
6341        }
6342        else if (name.equals("subDetail")) {
6343          return addSubDetail();
6344        }
6345        else
6346          return super.addChild(name);
6347      }
6348
6349      public DetailComponent copy() {
6350        DetailComponent dst = new DetailComponent();
6351        copyValues(dst);
6352        dst.sequence = sequence == null ? null : sequence.copy();
6353        dst.revenue = revenue == null ? null : revenue.copy();
6354        dst.category = category == null ? null : category.copy();
6355        dst.service = service == null ? null : service.copy();
6356        if (modifier != null) {
6357          dst.modifier = new ArrayList<CodeableConcept>();
6358          for (CodeableConcept i : modifier)
6359            dst.modifier.add(i.copy());
6360        };
6361        if (programCode != null) {
6362          dst.programCode = new ArrayList<CodeableConcept>();
6363          for (CodeableConcept i : programCode)
6364            dst.programCode.add(i.copy());
6365        };
6366        dst.quantity = quantity == null ? null : quantity.copy();
6367        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6368        dst.factor = factor == null ? null : factor.copy();
6369        dst.net = net == null ? null : net.copy();
6370        if (udi != null) {
6371          dst.udi = new ArrayList<Reference>();
6372          for (Reference i : udi)
6373            dst.udi.add(i.copy());
6374        };
6375        if (noteNumber != null) {
6376          dst.noteNumber = new ArrayList<PositiveIntType>();
6377          for (PositiveIntType i : noteNumber)
6378            dst.noteNumber.add(i.copy());
6379        };
6380        if (adjudication != null) {
6381          dst.adjudication = new ArrayList<AdjudicationComponent>();
6382          for (AdjudicationComponent i : adjudication)
6383            dst.adjudication.add(i.copy());
6384        };
6385        if (subDetail != null) {
6386          dst.subDetail = new ArrayList<SubDetailComponent>();
6387          for (SubDetailComponent i : subDetail)
6388            dst.subDetail.add(i.copy());
6389        };
6390        return dst;
6391      }
6392
6393      @Override
6394      public boolean equalsDeep(Base other_) {
6395        if (!super.equalsDeep(other_))
6396          return false;
6397        if (!(other_ instanceof DetailComponent))
6398          return false;
6399        DetailComponent o = (DetailComponent) other_;
6400        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
6401           && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
6402           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
6403           && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true) && compareDeep(noteNumber, o.noteNumber, true)
6404           && compareDeep(adjudication, o.adjudication, true) && compareDeep(subDetail, o.subDetail, true)
6405          ;
6406      }
6407
6408      @Override
6409      public boolean equalsShallow(Base other_) {
6410        if (!super.equalsShallow(other_))
6411          return false;
6412        if (!(other_ instanceof DetailComponent))
6413          return false;
6414        DetailComponent o = (DetailComponent) other_;
6415        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
6416          ;
6417      }
6418
6419      public boolean isEmpty() {
6420        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
6421          , service, modifier, programCode, quantity, unitPrice, factor, net, udi, noteNumber
6422          , adjudication, subDetail);
6423      }
6424
6425  public String fhirType() {
6426    return "ExplanationOfBenefit.item.detail";
6427
6428  }
6429
6430  }
6431
6432    @Block()
6433    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
6434        /**
6435         * A service line number.
6436         */
6437        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
6438        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
6439        protected PositiveIntType sequence;
6440
6441        /**
6442         * The type of reveneu or cost center providing the product and/or service.
6443         */
6444        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
6445        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
6446        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
6447        protected CodeableConcept revenue;
6448
6449        /**
6450         * Health Care Service Type Codes  to identify the classification of service or benefits.
6451         */
6452        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
6453        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
6454        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
6455        protected CodeableConcept category;
6456
6457        /**
6458         * A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).
6459         */
6460        @Child(name = "service", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
6461        @Description(shortDefinition="Billing Code", formalDefinition="A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI)." )
6462        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
6463        protected CodeableConcept service;
6464
6465        /**
6466         * Item typification or modifiers codes, eg 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.
6467         */
6468        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6469        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, eg 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." )
6470        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
6471        protected List<CodeableConcept> modifier;
6472
6473        /**
6474         * For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.
6475         */
6476        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6477        @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." )
6478        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
6479        protected List<CodeableConcept> programCode;
6480
6481        /**
6482         * The number of repetitions of a service or product.
6483         */
6484        @Child(name = "quantity", type = {SimpleQuantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
6485        @Description(shortDefinition="Count of Products or Services", formalDefinition="The number of repetitions of a service or product." )
6486        protected SimpleQuantity quantity;
6487
6488        /**
6489         * The fee for an addittional service or product or charge.
6490         */
6491        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
6492        @Description(shortDefinition="Fee, charge or cost per point", formalDefinition="The fee for an addittional service or product or charge." )
6493        protected Money unitPrice;
6494
6495        /**
6496         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
6497         */
6498        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
6499        @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." )
6500        protected DecimalType factor;
6501
6502        /**
6503         * The quantity times the unit price for an addittional 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.
6504         */
6505        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
6506        @Description(shortDefinition="Net additional item cost", formalDefinition="The quantity times the unit price for an addittional 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." )
6507        protected Money net;
6508
6509        /**
6510         * List of Unique Device Identifiers associated with this line item.
6511         */
6512        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6513        @Description(shortDefinition="Unique Device Identifier", formalDefinition="List of Unique Device Identifiers associated with this line item." )
6514        protected List<Reference> udi;
6515        /**
6516         * The actual objects that are the target of the reference (List of Unique Device Identifiers associated with this line item.)
6517         */
6518        protected List<Device> udiTarget;
6519
6520
6521        /**
6522         * A list of note references to the notes provided below.
6523         */
6524        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6525        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
6526        protected List<PositiveIntType> noteNumber;
6527
6528        /**
6529         * The adjudications results.
6530         */
6531        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6532        @Description(shortDefinition="Language if different from the resource", formalDefinition="The adjudications results." )
6533        protected List<AdjudicationComponent> adjudication;
6534
6535        private static final long serialVersionUID = -393180417L;
6536
6537    /**
6538     * Constructor
6539     */
6540      public SubDetailComponent() {
6541        super();
6542      }
6543
6544    /**
6545     * Constructor
6546     */
6547      public SubDetailComponent(PositiveIntType sequence) {
6548        super();
6549        this.sequence = sequence;
6550      }
6551
6552        /**
6553         * @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
6554         */
6555        public PositiveIntType getSequenceElement() { 
6556          if (this.sequence == null)
6557            if (Configuration.errorOnAutoCreate())
6558              throw new Error("Attempt to auto-create SubDetailComponent.sequence");
6559            else if (Configuration.doAutoCreate())
6560              this.sequence = new PositiveIntType(); // bb
6561          return this.sequence;
6562        }
6563
6564        public boolean hasSequenceElement() { 
6565          return this.sequence != null && !this.sequence.isEmpty();
6566        }
6567
6568        public boolean hasSequence() { 
6569          return this.sequence != null && !this.sequence.isEmpty();
6570        }
6571
6572        /**
6573         * @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
6574         */
6575        public SubDetailComponent setSequenceElement(PositiveIntType value) { 
6576          this.sequence = value;
6577          return this;
6578        }
6579
6580        /**
6581         * @return A service line number.
6582         */
6583        public int getSequence() { 
6584          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
6585        }
6586
6587        /**
6588         * @param value A service line number.
6589         */
6590        public SubDetailComponent setSequence(int value) { 
6591            if (this.sequence == null)
6592              this.sequence = new PositiveIntType();
6593            this.sequence.setValue(value);
6594          return this;
6595        }
6596
6597        /**
6598         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
6599         */
6600        public CodeableConcept getRevenue() { 
6601          if (this.revenue == null)
6602            if (Configuration.errorOnAutoCreate())
6603              throw new Error("Attempt to auto-create SubDetailComponent.revenue");
6604            else if (Configuration.doAutoCreate())
6605              this.revenue = new CodeableConcept(); // cc
6606          return this.revenue;
6607        }
6608
6609        public boolean hasRevenue() { 
6610          return this.revenue != null && !this.revenue.isEmpty();
6611        }
6612
6613        /**
6614         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
6615         */
6616        public SubDetailComponent setRevenue(CodeableConcept value) { 
6617          this.revenue = value;
6618          return this;
6619        }
6620
6621        /**
6622         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
6623         */
6624        public CodeableConcept getCategory() { 
6625          if (this.category == null)
6626            if (Configuration.errorOnAutoCreate())
6627              throw new Error("Attempt to auto-create SubDetailComponent.category");
6628            else if (Configuration.doAutoCreate())
6629              this.category = new CodeableConcept(); // cc
6630          return this.category;
6631        }
6632
6633        public boolean hasCategory() { 
6634          return this.category != null && !this.category.isEmpty();
6635        }
6636
6637        /**
6638         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
6639         */
6640        public SubDetailComponent setCategory(CodeableConcept value) { 
6641          this.category = value;
6642          return this;
6643        }
6644
6645        /**
6646         * @return {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
6647         */
6648        public CodeableConcept getService() { 
6649          if (this.service == null)
6650            if (Configuration.errorOnAutoCreate())
6651              throw new Error("Attempt to auto-create SubDetailComponent.service");
6652            else if (Configuration.doAutoCreate())
6653              this.service = new CodeableConcept(); // cc
6654          return this.service;
6655        }
6656
6657        public boolean hasService() { 
6658          return this.service != null && !this.service.isEmpty();
6659        }
6660
6661        /**
6662         * @param value {@link #service} (A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).)
6663         */
6664        public SubDetailComponent setService(CodeableConcept value) { 
6665          this.service = value;
6666          return this;
6667        }
6668
6669        /**
6670         * @return {@link #modifier} (Item typification or modifiers codes, eg 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.)
6671         */
6672        public List<CodeableConcept> getModifier() { 
6673          if (this.modifier == null)
6674            this.modifier = new ArrayList<CodeableConcept>();
6675          return this.modifier;
6676        }
6677
6678        /**
6679         * @return Returns a reference to <code>this</code> for easy method chaining
6680         */
6681        public SubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
6682          this.modifier = theModifier;
6683          return this;
6684        }
6685
6686        public boolean hasModifier() { 
6687          if (this.modifier == null)
6688            return false;
6689          for (CodeableConcept item : this.modifier)
6690            if (!item.isEmpty())
6691              return true;
6692          return false;
6693        }
6694
6695        public CodeableConcept addModifier() { //3
6696          CodeableConcept t = new CodeableConcept();
6697          if (this.modifier == null)
6698            this.modifier = new ArrayList<CodeableConcept>();
6699          this.modifier.add(t);
6700          return t;
6701        }
6702
6703        public SubDetailComponent addModifier(CodeableConcept t) { //3
6704          if (t == null)
6705            return this;
6706          if (this.modifier == null)
6707            this.modifier = new ArrayList<CodeableConcept>();
6708          this.modifier.add(t);
6709          return this;
6710        }
6711
6712        /**
6713         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
6714         */
6715        public CodeableConcept getModifierFirstRep() { 
6716          if (getModifier().isEmpty()) {
6717            addModifier();
6718          }
6719          return getModifier().get(0);
6720        }
6721
6722        /**
6723         * @return {@link #programCode} (For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.)
6724         */
6725        public List<CodeableConcept> getProgramCode() { 
6726          if (this.programCode == null)
6727            this.programCode = new ArrayList<CodeableConcept>();
6728          return this.programCode;
6729        }
6730
6731        /**
6732         * @return Returns a reference to <code>this</code> for easy method chaining
6733         */
6734        public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
6735          this.programCode = theProgramCode;
6736          return this;
6737        }
6738
6739        public boolean hasProgramCode() { 
6740          if (this.programCode == null)
6741            return false;
6742          for (CodeableConcept item : this.programCode)
6743            if (!item.isEmpty())
6744              return true;
6745          return false;
6746        }
6747
6748        public CodeableConcept addProgramCode() { //3
6749          CodeableConcept t = new CodeableConcept();
6750          if (this.programCode == null)
6751            this.programCode = new ArrayList<CodeableConcept>();
6752          this.programCode.add(t);
6753          return t;
6754        }
6755
6756        public SubDetailComponent addProgramCode(CodeableConcept t) { //3
6757          if (t == null)
6758            return this;
6759          if (this.programCode == null)
6760            this.programCode = new ArrayList<CodeableConcept>();
6761          this.programCode.add(t);
6762          return this;
6763        }
6764
6765        /**
6766         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
6767         */
6768        public CodeableConcept getProgramCodeFirstRep() { 
6769          if (getProgramCode().isEmpty()) {
6770            addProgramCode();
6771          }
6772          return getProgramCode().get(0);
6773        }
6774
6775        /**
6776         * @return {@link #quantity} (The number of repetitions of a service or product.)
6777         */
6778        public SimpleQuantity getQuantity() { 
6779          if (this.quantity == null)
6780            if (Configuration.errorOnAutoCreate())
6781              throw new Error("Attempt to auto-create SubDetailComponent.quantity");
6782            else if (Configuration.doAutoCreate())
6783              this.quantity = new SimpleQuantity(); // cc
6784          return this.quantity;
6785        }
6786
6787        public boolean hasQuantity() { 
6788          return this.quantity != null && !this.quantity.isEmpty();
6789        }
6790
6791        /**
6792         * @param value {@link #quantity} (The number of repetitions of a service or product.)
6793         */
6794        public SubDetailComponent setQuantity(SimpleQuantity value) { 
6795          this.quantity = value;
6796          return this;
6797        }
6798
6799        /**
6800         * @return {@link #unitPrice} (The fee for an addittional service or product or charge.)
6801         */
6802        public Money getUnitPrice() { 
6803          if (this.unitPrice == null)
6804            if (Configuration.errorOnAutoCreate())
6805              throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
6806            else if (Configuration.doAutoCreate())
6807              this.unitPrice = new Money(); // cc
6808          return this.unitPrice;
6809        }
6810
6811        public boolean hasUnitPrice() { 
6812          return this.unitPrice != null && !this.unitPrice.isEmpty();
6813        }
6814
6815        /**
6816         * @param value {@link #unitPrice} (The fee for an addittional service or product or charge.)
6817         */
6818        public SubDetailComponent setUnitPrice(Money value) { 
6819          this.unitPrice = value;
6820          return this;
6821        }
6822
6823        /**
6824         * @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
6825         */
6826        public DecimalType getFactorElement() { 
6827          if (this.factor == null)
6828            if (Configuration.errorOnAutoCreate())
6829              throw new Error("Attempt to auto-create SubDetailComponent.factor");
6830            else if (Configuration.doAutoCreate())
6831              this.factor = new DecimalType(); // bb
6832          return this.factor;
6833        }
6834
6835        public boolean hasFactorElement() { 
6836          return this.factor != null && !this.factor.isEmpty();
6837        }
6838
6839        public boolean hasFactor() { 
6840          return this.factor != null && !this.factor.isEmpty();
6841        }
6842
6843        /**
6844         * @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
6845         */
6846        public SubDetailComponent setFactorElement(DecimalType value) { 
6847          this.factor = value;
6848          return this;
6849        }
6850
6851        /**
6852         * @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.
6853         */
6854        public BigDecimal getFactor() { 
6855          return this.factor == null ? null : this.factor.getValue();
6856        }
6857
6858        /**
6859         * @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.
6860         */
6861        public SubDetailComponent setFactor(BigDecimal value) { 
6862          if (value == null)
6863            this.factor = null;
6864          else {
6865            if (this.factor == null)
6866              this.factor = new DecimalType();
6867            this.factor.setValue(value);
6868          }
6869          return this;
6870        }
6871
6872        /**
6873         * @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.
6874         */
6875        public SubDetailComponent setFactor(long value) { 
6876              this.factor = new DecimalType();
6877            this.factor.setValue(value);
6878          return this;
6879        }
6880
6881        /**
6882         * @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.
6883         */
6884        public SubDetailComponent setFactor(double value) { 
6885              this.factor = new DecimalType();
6886            this.factor.setValue(value);
6887          return this;
6888        }
6889
6890        /**
6891         * @return {@link #net} (The quantity times the unit price for an addittional 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.)
6892         */
6893        public Money getNet() { 
6894          if (this.net == null)
6895            if (Configuration.errorOnAutoCreate())
6896              throw new Error("Attempt to auto-create SubDetailComponent.net");
6897            else if (Configuration.doAutoCreate())
6898              this.net = new Money(); // cc
6899          return this.net;
6900        }
6901
6902        public boolean hasNet() { 
6903          return this.net != null && !this.net.isEmpty();
6904        }
6905
6906        /**
6907         * @param value {@link #net} (The quantity times the unit price for an addittional 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.)
6908         */
6909        public SubDetailComponent setNet(Money value) { 
6910          this.net = value;
6911          return this;
6912        }
6913
6914        /**
6915         * @return {@link #udi} (List of Unique Device Identifiers associated with this line item.)
6916         */
6917        public List<Reference> getUdi() { 
6918          if (this.udi == null)
6919            this.udi = new ArrayList<Reference>();
6920          return this.udi;
6921        }
6922
6923        /**
6924         * @return Returns a reference to <code>this</code> for easy method chaining
6925         */
6926        public SubDetailComponent setUdi(List<Reference> theUdi) { 
6927          this.udi = theUdi;
6928          return this;
6929        }
6930
6931        public boolean hasUdi() { 
6932          if (this.udi == null)
6933            return false;
6934          for (Reference item : this.udi)
6935            if (!item.isEmpty())
6936              return true;
6937          return false;
6938        }
6939
6940        public Reference addUdi() { //3
6941          Reference t = new Reference();
6942          if (this.udi == null)
6943            this.udi = new ArrayList<Reference>();
6944          this.udi.add(t);
6945          return t;
6946        }
6947
6948        public SubDetailComponent addUdi(Reference t) { //3
6949          if (t == null)
6950            return this;
6951          if (this.udi == null)
6952            this.udi = new ArrayList<Reference>();
6953          this.udi.add(t);
6954          return this;
6955        }
6956
6957        /**
6958         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
6959         */
6960        public Reference getUdiFirstRep() { 
6961          if (getUdi().isEmpty()) {
6962            addUdi();
6963          }
6964          return getUdi().get(0);
6965        }
6966
6967        /**
6968         * @deprecated Use Reference#setResource(IBaseResource) instead
6969         */
6970        @Deprecated
6971        public List<Device> getUdiTarget() { 
6972          if (this.udiTarget == null)
6973            this.udiTarget = new ArrayList<Device>();
6974          return this.udiTarget;
6975        }
6976
6977        /**
6978         * @deprecated Use Reference#setResource(IBaseResource) instead
6979         */
6980        @Deprecated
6981        public Device addUdiTarget() { 
6982          Device r = new Device();
6983          if (this.udiTarget == null)
6984            this.udiTarget = new ArrayList<Device>();
6985          this.udiTarget.add(r);
6986          return r;
6987        }
6988
6989        /**
6990         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
6991         */
6992        public List<PositiveIntType> getNoteNumber() { 
6993          if (this.noteNumber == null)
6994            this.noteNumber = new ArrayList<PositiveIntType>();
6995          return this.noteNumber;
6996        }
6997
6998        /**
6999         * @return Returns a reference to <code>this</code> for easy method chaining
7000         */
7001        public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
7002          this.noteNumber = theNoteNumber;
7003          return this;
7004        }
7005
7006        public boolean hasNoteNumber() { 
7007          if (this.noteNumber == null)
7008            return false;
7009          for (PositiveIntType item : this.noteNumber)
7010            if (!item.isEmpty())
7011              return true;
7012          return false;
7013        }
7014
7015        /**
7016         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
7017         */
7018        public PositiveIntType addNoteNumberElement() {//2 
7019          PositiveIntType t = new PositiveIntType();
7020          if (this.noteNumber == null)
7021            this.noteNumber = new ArrayList<PositiveIntType>();
7022          this.noteNumber.add(t);
7023          return t;
7024        }
7025
7026        /**
7027         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
7028         */
7029        public SubDetailComponent addNoteNumber(int value) { //1
7030          PositiveIntType t = new PositiveIntType();
7031          t.setValue(value);
7032          if (this.noteNumber == null)
7033            this.noteNumber = new ArrayList<PositiveIntType>();
7034          this.noteNumber.add(t);
7035          return this;
7036        }
7037
7038        /**
7039         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
7040         */
7041        public boolean hasNoteNumber(int value) { 
7042          if (this.noteNumber == null)
7043            return false;
7044          for (PositiveIntType v : this.noteNumber)
7045            if (v.getValue().equals(value)) // positiveInt
7046              return true;
7047          return false;
7048        }
7049
7050        /**
7051         * @return {@link #adjudication} (The adjudications results.)
7052         */
7053        public List<AdjudicationComponent> getAdjudication() { 
7054          if (this.adjudication == null)
7055            this.adjudication = new ArrayList<AdjudicationComponent>();
7056          return this.adjudication;
7057        }
7058
7059        /**
7060         * @return Returns a reference to <code>this</code> for easy method chaining
7061         */
7062        public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
7063          this.adjudication = theAdjudication;
7064          return this;
7065        }
7066
7067        public boolean hasAdjudication() { 
7068          if (this.adjudication == null)
7069            return false;
7070          for (AdjudicationComponent item : this.adjudication)
7071            if (!item.isEmpty())
7072              return true;
7073          return false;
7074        }
7075
7076        public AdjudicationComponent addAdjudication() { //3
7077          AdjudicationComponent t = new AdjudicationComponent();
7078          if (this.adjudication == null)
7079            this.adjudication = new ArrayList<AdjudicationComponent>();
7080          this.adjudication.add(t);
7081          return t;
7082        }
7083
7084        public SubDetailComponent addAdjudication(AdjudicationComponent t) { //3
7085          if (t == null)
7086            return this;
7087          if (this.adjudication == null)
7088            this.adjudication = new ArrayList<AdjudicationComponent>();
7089          this.adjudication.add(t);
7090          return this;
7091        }
7092
7093        /**
7094         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
7095         */
7096        public AdjudicationComponent getAdjudicationFirstRep() { 
7097          if (getAdjudication().isEmpty()) {
7098            addAdjudication();
7099          }
7100          return getAdjudication().get(0);
7101        }
7102
7103        protected void listChildren(List<Property> children) {
7104          super.listChildren(children);
7105          children.add(new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence));
7106          children.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue));
7107          children.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category));
7108          children.add(new Property("service", "CodeableConcept", "A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).", 0, 1, service));
7109          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg 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));
7110          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));
7111          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
7112          children.add(new Property("unitPrice", "Money", "The fee for an addittional service or product or charge.", 0, 1, unitPrice));
7113          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));
7114          children.add(new Property("net", "Money", "The quantity times the unit price for an addittional 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));
7115          children.add(new Property("udi", "Reference(Device)", "List of Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
7116          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
7117          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
7118        }
7119
7120        @Override
7121        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7122          switch (_hash) {
7123          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A service line number.", 0, 1, sequence);
7124          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, 1, revenue);
7125          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, 1, category);
7126          case 1984153269: /*service*/  return new Property("service", "CodeableConcept", "A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).", 0, 1, service);
7127          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg 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);
7128          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);
7129          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
7130          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "The fee for an addittional service or product or charge.", 0, 1, unitPrice);
7131          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);
7132          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an addittional 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);
7133          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);
7134          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);
7135          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
7136          default: return super.getNamedProperty(_hash, _name, _checkValid);
7137          }
7138
7139        }
7140
7141      @Override
7142      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7143        switch (hash) {
7144        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
7145        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
7146        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
7147        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
7148        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7149        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
7150        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
7151        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
7152        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
7153        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
7154        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
7155        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
7156        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
7157        default: return super.getProperty(hash, name, checkValid);
7158        }
7159
7160      }
7161
7162      @Override
7163      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7164        switch (hash) {
7165        case 1349547969: // sequence
7166          this.sequence = castToPositiveInt(value); // PositiveIntType
7167          return value;
7168        case 1099842588: // revenue
7169          this.revenue = castToCodeableConcept(value); // CodeableConcept
7170          return value;
7171        case 50511102: // category
7172          this.category = castToCodeableConcept(value); // CodeableConcept
7173          return value;
7174        case 1984153269: // service
7175          this.service = castToCodeableConcept(value); // CodeableConcept
7176          return value;
7177        case -615513385: // modifier
7178          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
7179          return value;
7180        case 1010065041: // programCode
7181          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
7182          return value;
7183        case -1285004149: // quantity
7184          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
7185          return value;
7186        case -486196699: // unitPrice
7187          this.unitPrice = castToMoney(value); // Money
7188          return value;
7189        case -1282148017: // factor
7190          this.factor = castToDecimal(value); // DecimalType
7191          return value;
7192        case 108957: // net
7193          this.net = castToMoney(value); // Money
7194          return value;
7195        case 115642: // udi
7196          this.getUdi().add(castToReference(value)); // Reference
7197          return value;
7198        case -1110033957: // noteNumber
7199          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
7200          return value;
7201        case -231349275: // adjudication
7202          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7203          return value;
7204        default: return super.setProperty(hash, name, value);
7205        }
7206
7207      }
7208
7209      @Override
7210      public Base setProperty(String name, Base value) throws FHIRException {
7211        if (name.equals("sequence")) {
7212          this.sequence = castToPositiveInt(value); // PositiveIntType
7213        } else if (name.equals("revenue")) {
7214          this.revenue = castToCodeableConcept(value); // CodeableConcept
7215        } else if (name.equals("category")) {
7216          this.category = castToCodeableConcept(value); // CodeableConcept
7217        } else if (name.equals("service")) {
7218          this.service = castToCodeableConcept(value); // CodeableConcept
7219        } else if (name.equals("modifier")) {
7220          this.getModifier().add(castToCodeableConcept(value));
7221        } else if (name.equals("programCode")) {
7222          this.getProgramCode().add(castToCodeableConcept(value));
7223        } else if (name.equals("quantity")) {
7224          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
7225        } else if (name.equals("unitPrice")) {
7226          this.unitPrice = castToMoney(value); // Money
7227        } else if (name.equals("factor")) {
7228          this.factor = castToDecimal(value); // DecimalType
7229        } else if (name.equals("net")) {
7230          this.net = castToMoney(value); // Money
7231        } else if (name.equals("udi")) {
7232          this.getUdi().add(castToReference(value));
7233        } else if (name.equals("noteNumber")) {
7234          this.getNoteNumber().add(castToPositiveInt(value));
7235        } else if (name.equals("adjudication")) {
7236          this.getAdjudication().add((AdjudicationComponent) value);
7237        } else
7238          return super.setProperty(name, value);
7239        return value;
7240      }
7241
7242      @Override
7243      public Base makeProperty(int hash, String name) throws FHIRException {
7244        switch (hash) {
7245        case 1349547969:  return getSequenceElement();
7246        case 1099842588:  return getRevenue(); 
7247        case 50511102:  return getCategory(); 
7248        case 1984153269:  return getService(); 
7249        case -615513385:  return addModifier(); 
7250        case 1010065041:  return addProgramCode(); 
7251        case -1285004149:  return getQuantity(); 
7252        case -486196699:  return getUnitPrice(); 
7253        case -1282148017:  return getFactorElement();
7254        case 108957:  return getNet(); 
7255        case 115642:  return addUdi(); 
7256        case -1110033957:  return addNoteNumberElement();
7257        case -231349275:  return addAdjudication(); 
7258        default: return super.makeProperty(hash, name);
7259        }
7260
7261      }
7262
7263      @Override
7264      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7265        switch (hash) {
7266        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
7267        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
7268        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
7269        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
7270        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
7271        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
7272        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
7273        case -486196699: /*unitPrice*/ return new String[] {"Money"};
7274        case -1282148017: /*factor*/ return new String[] {"decimal"};
7275        case 108957: /*net*/ return new String[] {"Money"};
7276        case 115642: /*udi*/ return new String[] {"Reference"};
7277        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
7278        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
7279        default: return super.getTypesForProperty(hash, name);
7280        }
7281
7282      }
7283
7284      @Override
7285      public Base addChild(String name) throws FHIRException {
7286        if (name.equals("sequence")) {
7287          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
7288        }
7289        else if (name.equals("revenue")) {
7290          this.revenue = new CodeableConcept();
7291          return this.revenue;
7292        }
7293        else if (name.equals("category")) {
7294          this.category = new CodeableConcept();
7295          return this.category;
7296        }
7297        else if (name.equals("service")) {
7298          this.service = new CodeableConcept();
7299          return this.service;
7300        }
7301        else if (name.equals("modifier")) {
7302          return addModifier();
7303        }
7304        else if (name.equals("programCode")) {
7305          return addProgramCode();
7306        }
7307        else if (name.equals("quantity")) {
7308          this.quantity = new SimpleQuantity();
7309          return this.quantity;
7310        }
7311        else if (name.equals("unitPrice")) {
7312          this.unitPrice = new Money();
7313          return this.unitPrice;
7314        }
7315        else if (name.equals("factor")) {
7316          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
7317        }
7318        else if (name.equals("net")) {
7319          this.net = new Money();
7320          return this.net;
7321        }
7322        else if (name.equals("udi")) {
7323          return addUdi();
7324        }
7325        else if (name.equals("noteNumber")) {
7326          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
7327        }
7328        else if (name.equals("adjudication")) {
7329          return addAdjudication();
7330        }
7331        else
7332          return super.addChild(name);
7333      }
7334
7335      public SubDetailComponent copy() {
7336        SubDetailComponent dst = new SubDetailComponent();
7337        copyValues(dst);
7338        dst.sequence = sequence == null ? null : sequence.copy();
7339        dst.revenue = revenue == null ? null : revenue.copy();
7340        dst.category = category == null ? null : category.copy();
7341        dst.service = service == null ? null : service.copy();
7342        if (modifier != null) {
7343          dst.modifier = new ArrayList<CodeableConcept>();
7344          for (CodeableConcept i : modifier)
7345            dst.modifier.add(i.copy());
7346        };
7347        if (programCode != null) {
7348          dst.programCode = new ArrayList<CodeableConcept>();
7349          for (CodeableConcept i : programCode)
7350            dst.programCode.add(i.copy());
7351        };
7352        dst.quantity = quantity == null ? null : quantity.copy();
7353        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7354        dst.factor = factor == null ? null : factor.copy();
7355        dst.net = net == null ? null : net.copy();
7356        if (udi != null) {
7357          dst.udi = new ArrayList<Reference>();
7358          for (Reference i : udi)
7359            dst.udi.add(i.copy());
7360        };
7361        if (noteNumber != null) {
7362          dst.noteNumber = new ArrayList<PositiveIntType>();
7363          for (PositiveIntType i : noteNumber)
7364            dst.noteNumber.add(i.copy());
7365        };
7366        if (adjudication != null) {
7367          dst.adjudication = new ArrayList<AdjudicationComponent>();
7368          for (AdjudicationComponent i : adjudication)
7369            dst.adjudication.add(i.copy());
7370        };
7371        return dst;
7372      }
7373
7374      @Override
7375      public boolean equalsDeep(Base other_) {
7376        if (!super.equalsDeep(other_))
7377          return false;
7378        if (!(other_ instanceof SubDetailComponent))
7379          return false;
7380        SubDetailComponent o = (SubDetailComponent) other_;
7381        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
7382           && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
7383           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
7384           && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true) && compareDeep(noteNumber, o.noteNumber, true)
7385           && compareDeep(adjudication, o.adjudication, true);
7386      }
7387
7388      @Override
7389      public boolean equalsShallow(Base other_) {
7390        if (!super.equalsShallow(other_))
7391          return false;
7392        if (!(other_ instanceof SubDetailComponent))
7393          return false;
7394        SubDetailComponent o = (SubDetailComponent) other_;
7395        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
7396          ;
7397      }
7398
7399      public boolean isEmpty() {
7400        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
7401          , service, modifier, programCode, quantity, unitPrice, factor, net, udi, noteNumber
7402          , adjudication);
7403      }
7404
7405  public String fhirType() {
7406    return "ExplanationOfBenefit.item.detail.subDetail";
7407
7408  }
7409
7410  }
7411
7412    @Block()
7413    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
7414        /**
7415         * List of input service items which this service line is intended to replace.
7416         */
7417        @Child(name = "itemSequence", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7418        @Description(shortDefinition="Service instances", formalDefinition="List of input service items which this service line is intended to replace." )
7419        protected List<PositiveIntType> itemSequence;
7420
7421        /**
7422         * 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.
7423         */
7424        @Child(name = "detailSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7425        @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." )
7426        protected List<PositiveIntType> detailSequence;
7427
7428        /**
7429         * 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.
7430         */
7431        @Child(name = "subDetailSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7432        @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." )
7433        protected List<PositiveIntType> subDetailSequence;
7434
7435        /**
7436         * If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. 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'.
7437         */
7438        @Child(name = "service", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
7439        @Description(shortDefinition="Billing Code", formalDefinition="If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. 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'." )
7440        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
7441        protected CodeableConcept service;
7442
7443        /**
7444         * Item typification or modifiers codes, eg 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.
7445         */
7446        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7447        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, eg 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." )
7448        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
7449        protected List<CodeableConcept> modifier;
7450
7451        /**
7452         * The fee charged for the professional service or product.
7453         */
7454        @Child(name = "fee", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
7455        @Description(shortDefinition="Professional fee or Product charge", formalDefinition="The fee charged for the professional service or product." )
7456        protected Money fee;
7457
7458        /**
7459         * A list of note references to the notes provided below.
7460         */
7461        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7462        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
7463        protected List<PositiveIntType> noteNumber;
7464
7465        /**
7466         * The adjudications results.
7467         */
7468        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7469        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudications results." )
7470        protected List<AdjudicationComponent> adjudication;
7471
7472        private static final long serialVersionUID = 715679098L;
7473
7474    /**
7475     * Constructor
7476     */
7477      public AddedItemComponent() {
7478        super();
7479      }
7480
7481        /**
7482         * @return {@link #itemSequence} (List of input service items which this service line is intended to replace.)
7483         */
7484        public List<PositiveIntType> getItemSequence() { 
7485          if (this.itemSequence == null)
7486            this.itemSequence = new ArrayList<PositiveIntType>();
7487          return this.itemSequence;
7488        }
7489
7490        /**
7491         * @return Returns a reference to <code>this</code> for easy method chaining
7492         */
7493        public AddedItemComponent setItemSequence(List<PositiveIntType> theItemSequence) { 
7494          this.itemSequence = theItemSequence;
7495          return this;
7496        }
7497
7498        public boolean hasItemSequence() { 
7499          if (this.itemSequence == null)
7500            return false;
7501          for (PositiveIntType item : this.itemSequence)
7502            if (!item.isEmpty())
7503              return true;
7504          return false;
7505        }
7506
7507        /**
7508         * @return {@link #itemSequence} (List of input service items which this service line is intended to replace.)
7509         */
7510        public PositiveIntType addItemSequenceElement() {//2 
7511          PositiveIntType t = new PositiveIntType();
7512          if (this.itemSequence == null)
7513            this.itemSequence = new ArrayList<PositiveIntType>();
7514          this.itemSequence.add(t);
7515          return t;
7516        }
7517
7518        /**
7519         * @param value {@link #itemSequence} (List of input service items which this service line is intended to replace.)
7520         */
7521        public AddedItemComponent addItemSequence(int value) { //1
7522          PositiveIntType t = new PositiveIntType();
7523          t.setValue(value);
7524          if (this.itemSequence == null)
7525            this.itemSequence = new ArrayList<PositiveIntType>();
7526          this.itemSequence.add(t);
7527          return this;
7528        }
7529
7530        /**
7531         * @param value {@link #itemSequence} (List of input service items which this service line is intended to replace.)
7532         */
7533        public boolean hasItemSequence(int value) { 
7534          if (this.itemSequence == null)
7535            return false;
7536          for (PositiveIntType v : this.itemSequence)
7537            if (v.getValue().equals(value)) // positiveInt
7538              return true;
7539          return false;
7540        }
7541
7542        /**
7543         * @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.)
7544         */
7545        public List<PositiveIntType> getDetailSequence() { 
7546          if (this.detailSequence == null)
7547            this.detailSequence = new ArrayList<PositiveIntType>();
7548          return this.detailSequence;
7549        }
7550
7551        /**
7552         * @return Returns a reference to <code>this</code> for easy method chaining
7553         */
7554        public AddedItemComponent setDetailSequence(List<PositiveIntType> theDetailSequence) { 
7555          this.detailSequence = theDetailSequence;
7556          return this;
7557        }
7558
7559        public boolean hasDetailSequence() { 
7560          if (this.detailSequence == null)
7561            return false;
7562          for (PositiveIntType item : this.detailSequence)
7563            if (!item.isEmpty())
7564              return true;
7565          return false;
7566        }
7567
7568        /**
7569         * @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.)
7570         */
7571        public PositiveIntType addDetailSequenceElement() {//2 
7572          PositiveIntType t = new PositiveIntType();
7573          if (this.detailSequence == null)
7574            this.detailSequence = new ArrayList<PositiveIntType>();
7575          this.detailSequence.add(t);
7576          return t;
7577        }
7578
7579        /**
7580         * @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.)
7581         */
7582        public AddedItemComponent addDetailSequence(int value) { //1
7583          PositiveIntType t = new PositiveIntType();
7584          t.setValue(value);
7585          if (this.detailSequence == null)
7586            this.detailSequence = new ArrayList<PositiveIntType>();
7587          this.detailSequence.add(t);
7588          return this;
7589        }
7590
7591        /**
7592         * @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.)
7593         */
7594        public boolean hasDetailSequence(int value) { 
7595          if (this.detailSequence == null)
7596            return false;
7597          for (PositiveIntType v : this.detailSequence)
7598            if (v.getValue().equals(value)) // positiveInt
7599              return true;
7600          return false;
7601        }
7602
7603        /**
7604         * @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.)
7605         */
7606        public List<PositiveIntType> getSubDetailSequence() { 
7607          if (this.subDetailSequence == null)
7608            this.subDetailSequence = new ArrayList<PositiveIntType>();
7609          return this.subDetailSequence;
7610        }
7611
7612        /**
7613         * @return Returns a reference to <code>this</code> for easy method chaining
7614         */
7615        public AddedItemComponent setSubDetailSequence(List<PositiveIntType> theSubDetailSequence) { 
7616          this.subDetailSequence = theSubDetailSequence;
7617          return this;
7618        }
7619
7620        public boolean hasSubDetailSequence() { 
7621          if (this.subDetailSequence == null)
7622            return false;
7623          for (PositiveIntType item : this.subDetailSequence)
7624            if (!item.isEmpty())
7625              return true;
7626          return false;
7627        }
7628
7629        /**
7630         * @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.)
7631         */
7632        public PositiveIntType addSubDetailSequenceElement() {//2 
7633          PositiveIntType t = new PositiveIntType();
7634          if (this.subDetailSequence == null)
7635            this.subDetailSequence = new ArrayList<PositiveIntType>();
7636          this.subDetailSequence.add(t);
7637          return t;
7638        }
7639
7640        /**
7641         * @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.)
7642         */
7643        public AddedItemComponent addSubDetailSequence(int value) { //1
7644          PositiveIntType t = new PositiveIntType();
7645          t.setValue(value);
7646          if (this.subDetailSequence == null)
7647            this.subDetailSequence = new ArrayList<PositiveIntType>();
7648          this.subDetailSequence.add(t);
7649          return this;
7650        }
7651
7652        /**
7653         * @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.)
7654         */
7655        public boolean hasSubDetailSequence(int value) { 
7656          if (this.subDetailSequence == null)
7657            return false;
7658          for (PositiveIntType v : this.subDetailSequence)
7659            if (v.getValue().equals(value)) // positiveInt
7660              return true;
7661          return false;
7662        }
7663
7664        /**
7665         * @return {@link #service} (If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. 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'.)
7666         */
7667        public CodeableConcept getService() { 
7668          if (this.service == null)
7669            if (Configuration.errorOnAutoCreate())
7670              throw new Error("Attempt to auto-create AddedItemComponent.service");
7671            else if (Configuration.doAutoCreate())
7672              this.service = new CodeableConcept(); // cc
7673          return this.service;
7674        }
7675
7676        public boolean hasService() { 
7677          return this.service != null && !this.service.isEmpty();
7678        }
7679
7680        /**
7681         * @param value {@link #service} (If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. 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'.)
7682         */
7683        public AddedItemComponent setService(CodeableConcept value) { 
7684          this.service = value;
7685          return this;
7686        }
7687
7688        /**
7689         * @return {@link #modifier} (Item typification or modifiers codes, eg 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.)
7690         */
7691        public List<CodeableConcept> getModifier() { 
7692          if (this.modifier == null)
7693            this.modifier = new ArrayList<CodeableConcept>();
7694          return this.modifier;
7695        }
7696
7697        /**
7698         * @return Returns a reference to <code>this</code> for easy method chaining
7699         */
7700        public AddedItemComponent setModifier(List<CodeableConcept> theModifier) { 
7701          this.modifier = theModifier;
7702          return this;
7703        }
7704
7705        public boolean hasModifier() { 
7706          if (this.modifier == null)
7707            return false;
7708          for (CodeableConcept item : this.modifier)
7709            if (!item.isEmpty())
7710              return true;
7711          return false;
7712        }
7713
7714        public CodeableConcept addModifier() { //3
7715          CodeableConcept t = new CodeableConcept();
7716          if (this.modifier == null)
7717            this.modifier = new ArrayList<CodeableConcept>();
7718          this.modifier.add(t);
7719          return t;
7720        }
7721
7722        public AddedItemComponent addModifier(CodeableConcept t) { //3
7723          if (t == null)
7724            return this;
7725          if (this.modifier == null)
7726            this.modifier = new ArrayList<CodeableConcept>();
7727          this.modifier.add(t);
7728          return this;
7729        }
7730
7731        /**
7732         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
7733         */
7734        public CodeableConcept getModifierFirstRep() { 
7735          if (getModifier().isEmpty()) {
7736            addModifier();
7737          }
7738          return getModifier().get(0);
7739        }
7740
7741        /**
7742         * @return {@link #fee} (The fee charged for the professional service or product.)
7743         */
7744        public Money getFee() { 
7745          if (this.fee == null)
7746            if (Configuration.errorOnAutoCreate())
7747              throw new Error("Attempt to auto-create AddedItemComponent.fee");
7748            else if (Configuration.doAutoCreate())
7749              this.fee = new Money(); // cc
7750          return this.fee;
7751        }
7752
7753        public boolean hasFee() { 
7754          return this.fee != null && !this.fee.isEmpty();
7755        }
7756
7757        /**
7758         * @param value {@link #fee} (The fee charged for the professional service or product.)
7759         */
7760        public AddedItemComponent setFee(Money value) { 
7761          this.fee = value;
7762          return this;
7763        }
7764
7765        /**
7766         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
7767         */
7768        public List<PositiveIntType> getNoteNumber() { 
7769          if (this.noteNumber == null)
7770            this.noteNumber = new ArrayList<PositiveIntType>();
7771          return this.noteNumber;
7772        }
7773
7774        /**
7775         * @return Returns a reference to <code>this</code> for easy method chaining
7776         */
7777        public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
7778          this.noteNumber = theNoteNumber;
7779          return this;
7780        }
7781
7782        public boolean hasNoteNumber() { 
7783          if (this.noteNumber == null)
7784            return false;
7785          for (PositiveIntType item : this.noteNumber)
7786            if (!item.isEmpty())
7787              return true;
7788          return false;
7789        }
7790
7791        /**
7792         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
7793         */
7794        public PositiveIntType addNoteNumberElement() {//2 
7795          PositiveIntType t = new PositiveIntType();
7796          if (this.noteNumber == null)
7797            this.noteNumber = new ArrayList<PositiveIntType>();
7798          this.noteNumber.add(t);
7799          return t;
7800        }
7801
7802        /**
7803         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
7804         */
7805        public AddedItemComponent addNoteNumber(int value) { //1
7806          PositiveIntType t = new PositiveIntType();
7807          t.setValue(value);
7808          if (this.noteNumber == null)
7809            this.noteNumber = new ArrayList<PositiveIntType>();
7810          this.noteNumber.add(t);
7811          return this;
7812        }
7813
7814        /**
7815         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
7816         */
7817        public boolean hasNoteNumber(int value) { 
7818          if (this.noteNumber == null)
7819            return false;
7820          for (PositiveIntType v : this.noteNumber)
7821            if (v.getValue().equals(value)) // positiveInt
7822              return true;
7823          return false;
7824        }
7825
7826        /**
7827         * @return {@link #adjudication} (The adjudications results.)
7828         */
7829        public List<AdjudicationComponent> getAdjudication() { 
7830          if (this.adjudication == null)
7831            this.adjudication = new ArrayList<AdjudicationComponent>();
7832          return this.adjudication;
7833        }
7834
7835        /**
7836         * @return Returns a reference to <code>this</code> for easy method chaining
7837         */
7838        public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
7839          this.adjudication = theAdjudication;
7840          return this;
7841        }
7842
7843        public boolean hasAdjudication() { 
7844          if (this.adjudication == null)
7845            return false;
7846          for (AdjudicationComponent item : this.adjudication)
7847            if (!item.isEmpty())
7848              return true;
7849          return false;
7850        }
7851
7852        public AdjudicationComponent addAdjudication() { //3
7853          AdjudicationComponent t = new AdjudicationComponent();
7854          if (this.adjudication == null)
7855            this.adjudication = new ArrayList<AdjudicationComponent>();
7856          this.adjudication.add(t);
7857          return t;
7858        }
7859
7860        public AddedItemComponent addAdjudication(AdjudicationComponent t) { //3
7861          if (t == null)
7862            return this;
7863          if (this.adjudication == null)
7864            this.adjudication = new ArrayList<AdjudicationComponent>();
7865          this.adjudication.add(t);
7866          return this;
7867        }
7868
7869        /**
7870         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
7871         */
7872        public AdjudicationComponent getAdjudicationFirstRep() { 
7873          if (getAdjudication().isEmpty()) {
7874            addAdjudication();
7875          }
7876          return getAdjudication().get(0);
7877        }
7878
7879        protected void listChildren(List<Property> children) {
7880          super.listChildren(children);
7881          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));
7882          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));
7883          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));
7884          children.add(new Property("service", "CodeableConcept", "If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. 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, service));
7885          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg 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));
7886          children.add(new Property("fee", "Money", "The fee charged for the professional service or product.", 0, 1, fee));
7887          children.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
7888          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
7889        }
7890
7891        @Override
7892        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7893          switch (_hash) {
7894          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);
7895          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);
7896          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);
7897          case 1984153269: /*service*/  return new Property("service", "CodeableConcept", "If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. 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, service);
7898          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg 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);
7899          case 101254: /*fee*/  return new Property("fee", "Money", "The fee charged for the professional service or product.", 0, 1, fee);
7900          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);
7901          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
7902          default: return super.getNamedProperty(_hash, _name, _checkValid);
7903          }
7904
7905        }
7906
7907      @Override
7908      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7909        switch (hash) {
7910        case 1977979892: /*itemSequence*/ return this.itemSequence == null ? new Base[0] : this.itemSequence.toArray(new Base[this.itemSequence.size()]); // PositiveIntType
7911        case 1321472818: /*detailSequence*/ return this.detailSequence == null ? new Base[0] : this.detailSequence.toArray(new Base[this.detailSequence.size()]); // PositiveIntType
7912        case -855462510: /*subDetailSequence*/ return this.subDetailSequence == null ? new Base[0] : this.subDetailSequence.toArray(new Base[this.subDetailSequence.size()]); // PositiveIntType
7913        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
7914        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7915        case 101254: /*fee*/ return this.fee == null ? new Base[0] : new Base[] {this.fee}; // Money
7916        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
7917        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
7918        default: return super.getProperty(hash, name, checkValid);
7919        }
7920
7921      }
7922
7923      @Override
7924      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7925        switch (hash) {
7926        case 1977979892: // itemSequence
7927          this.getItemSequence().add(castToPositiveInt(value)); // PositiveIntType
7928          return value;
7929        case 1321472818: // detailSequence
7930          this.getDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
7931          return value;
7932        case -855462510: // subDetailSequence
7933          this.getSubDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
7934          return value;
7935        case 1984153269: // service
7936          this.service = castToCodeableConcept(value); // CodeableConcept
7937          return value;
7938        case -615513385: // modifier
7939          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
7940          return value;
7941        case 101254: // fee
7942          this.fee = castToMoney(value); // Money
7943          return value;
7944        case -1110033957: // noteNumber
7945          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
7946          return value;
7947        case -231349275: // adjudication
7948          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7949          return value;
7950        default: return super.setProperty(hash, name, value);
7951        }
7952
7953      }
7954
7955      @Override
7956      public Base setProperty(String name, Base value) throws FHIRException {
7957        if (name.equals("itemSequence")) {
7958          this.getItemSequence().add(castToPositiveInt(value));
7959        } else if (name.equals("detailSequence")) {
7960          this.getDetailSequence().add(castToPositiveInt(value));
7961        } else if (name.equals("subDetailSequence")) {
7962          this.getSubDetailSequence().add(castToPositiveInt(value));
7963        } else if (name.equals("service")) {
7964          this.service = castToCodeableConcept(value); // CodeableConcept
7965        } else if (name.equals("modifier")) {
7966          this.getModifier().add(castToCodeableConcept(value));
7967        } else if (name.equals("fee")) {
7968          this.fee = castToMoney(value); // Money
7969        } else if (name.equals("noteNumber")) {
7970          this.getNoteNumber().add(castToPositiveInt(value));
7971        } else if (name.equals("adjudication")) {
7972          this.getAdjudication().add((AdjudicationComponent) value);
7973        } else
7974          return super.setProperty(name, value);
7975        return value;
7976      }
7977
7978      @Override
7979      public Base makeProperty(int hash, String name) throws FHIRException {
7980        switch (hash) {
7981        case 1977979892:  return addItemSequenceElement();
7982        case 1321472818:  return addDetailSequenceElement();
7983        case -855462510:  return addSubDetailSequenceElement();
7984        case 1984153269:  return getService(); 
7985        case -615513385:  return addModifier(); 
7986        case 101254:  return getFee(); 
7987        case -1110033957:  return addNoteNumberElement();
7988        case -231349275:  return addAdjudication(); 
7989        default: return super.makeProperty(hash, name);
7990        }
7991
7992      }
7993
7994      @Override
7995      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7996        switch (hash) {
7997        case 1977979892: /*itemSequence*/ return new String[] {"positiveInt"};
7998        case 1321472818: /*detailSequence*/ return new String[] {"positiveInt"};
7999        case -855462510: /*subDetailSequence*/ return new String[] {"positiveInt"};
8000        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
8001        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
8002        case 101254: /*fee*/ return new String[] {"Money"};
8003        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
8004        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
8005        default: return super.getTypesForProperty(hash, name);
8006        }
8007
8008      }
8009
8010      @Override
8011      public Base addChild(String name) throws FHIRException {
8012        if (name.equals("itemSequence")) {
8013          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.itemSequence");
8014        }
8015        else if (name.equals("detailSequence")) {
8016          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.detailSequence");
8017        }
8018        else if (name.equals("subDetailSequence")) {
8019          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.subDetailSequence");
8020        }
8021        else if (name.equals("service")) {
8022          this.service = new CodeableConcept();
8023          return this.service;
8024        }
8025        else if (name.equals("modifier")) {
8026          return addModifier();
8027        }
8028        else if (name.equals("fee")) {
8029          this.fee = new Money();
8030          return this.fee;
8031        }
8032        else if (name.equals("noteNumber")) {
8033          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
8034        }
8035        else if (name.equals("adjudication")) {
8036          return addAdjudication();
8037        }
8038        else
8039          return super.addChild(name);
8040      }
8041
8042      public AddedItemComponent copy() {
8043        AddedItemComponent dst = new AddedItemComponent();
8044        copyValues(dst);
8045        if (itemSequence != null) {
8046          dst.itemSequence = new ArrayList<PositiveIntType>();
8047          for (PositiveIntType i : itemSequence)
8048            dst.itemSequence.add(i.copy());
8049        };
8050        if (detailSequence != null) {
8051          dst.detailSequence = new ArrayList<PositiveIntType>();
8052          for (PositiveIntType i : detailSequence)
8053            dst.detailSequence.add(i.copy());
8054        };
8055        if (subDetailSequence != null) {
8056          dst.subDetailSequence = new ArrayList<PositiveIntType>();
8057          for (PositiveIntType i : subDetailSequence)
8058            dst.subDetailSequence.add(i.copy());
8059        };
8060        dst.service = service == null ? null : service.copy();
8061        if (modifier != null) {
8062          dst.modifier = new ArrayList<CodeableConcept>();
8063          for (CodeableConcept i : modifier)
8064            dst.modifier.add(i.copy());
8065        };
8066        dst.fee = fee == null ? null : fee.copy();
8067        if (noteNumber != null) {
8068          dst.noteNumber = new ArrayList<PositiveIntType>();
8069          for (PositiveIntType i : noteNumber)
8070            dst.noteNumber.add(i.copy());
8071        };
8072        if (adjudication != null) {
8073          dst.adjudication = new ArrayList<AdjudicationComponent>();
8074          for (AdjudicationComponent i : adjudication)
8075            dst.adjudication.add(i.copy());
8076        };
8077        return dst;
8078      }
8079
8080      @Override
8081      public boolean equalsDeep(Base other_) {
8082        if (!super.equalsDeep(other_))
8083          return false;
8084        if (!(other_ instanceof AddedItemComponent))
8085          return false;
8086        AddedItemComponent o = (AddedItemComponent) other_;
8087        return compareDeep(itemSequence, o.itemSequence, true) && compareDeep(detailSequence, o.detailSequence, true)
8088           && compareDeep(subDetailSequence, o.subDetailSequence, true) && compareDeep(service, o.service, true)
8089           && compareDeep(modifier, o.modifier, true) && compareDeep(fee, o.fee, true) && compareDeep(noteNumber, o.noteNumber, true)
8090           && compareDeep(adjudication, o.adjudication, true);
8091      }
8092
8093      @Override
8094      public boolean equalsShallow(Base other_) {
8095        if (!super.equalsShallow(other_))
8096          return false;
8097        if (!(other_ instanceof AddedItemComponent))
8098          return false;
8099        AddedItemComponent o = (AddedItemComponent) other_;
8100        return compareValues(itemSequence, o.itemSequence, true) && compareValues(detailSequence, o.detailSequence, true)
8101           && compareValues(subDetailSequence, o.subDetailSequence, true) && compareValues(noteNumber, o.noteNumber, true)
8102          ;
8103      }
8104
8105      public boolean isEmpty() {
8106        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(itemSequence, detailSequence
8107          , subDetailSequence, service, modifier, fee, noteNumber, adjudication);
8108      }
8109
8110  public String fhirType() {
8111    return "ExplanationOfBenefit.addItem";
8112
8113  }
8114
8115  }
8116
8117    @Block()
8118    public static class TotalComponent extends BackboneElement implements IBaseBackboneElement {
8119        /**
8120         * Code indicating: Submitted, Co-Pay, deductable, elegible, benefit, tax, etc.
8121         */
8122        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
8123        @Description(shortDefinition="Adjudication category such as submitted, co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Submitted, Co-Pay, deductable, elegible, benefit, tax, etc." )
8124        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
8125        protected CodeableConcept category;
8126
8127        /**
8128         * Monitory amount associated with the code.
8129         */
8130        @Child(name = "amount", type = {Money.class}, order=2, min=1, max=1, modifier=false, summary=false)
8131        @Description(shortDefinition="Monetary amount", formalDefinition="Monitory amount associated with the code." )
8132        protected Money amount;
8133
8134        private static final long serialVersionUID = 2012310309L;
8135
8136    /**
8137     * Constructor
8138     */
8139      public TotalComponent() {
8140        super();
8141      }
8142
8143    /**
8144     * Constructor
8145     */
8146      public TotalComponent(CodeableConcept category, Money amount) {
8147        super();
8148        this.category = category;
8149        this.amount = amount;
8150      }
8151
8152        /**
8153         * @return {@link #category} (Code indicating: Submitted, Co-Pay, deductable, elegible, benefit, tax, etc.)
8154         */
8155        public CodeableConcept getCategory() { 
8156          if (this.category == null)
8157            if (Configuration.errorOnAutoCreate())
8158              throw new Error("Attempt to auto-create TotalComponent.category");
8159            else if (Configuration.doAutoCreate())
8160              this.category = new CodeableConcept(); // cc
8161          return this.category;
8162        }
8163
8164        public boolean hasCategory() { 
8165          return this.category != null && !this.category.isEmpty();
8166        }
8167
8168        /**
8169         * @param value {@link #category} (Code indicating: Submitted, Co-Pay, deductable, elegible, benefit, tax, etc.)
8170         */
8171        public TotalComponent setCategory(CodeableConcept value) { 
8172          this.category = value;
8173          return this;
8174        }
8175
8176        /**
8177         * @return {@link #amount} (Monitory amount associated with the code.)
8178         */
8179        public Money getAmount() { 
8180          if (this.amount == null)
8181            if (Configuration.errorOnAutoCreate())
8182              throw new Error("Attempt to auto-create TotalComponent.amount");
8183            else if (Configuration.doAutoCreate())
8184              this.amount = new Money(); // cc
8185          return this.amount;
8186        }
8187
8188        public boolean hasAmount() { 
8189          return this.amount != null && !this.amount.isEmpty();
8190        }
8191
8192        /**
8193         * @param value {@link #amount} (Monitory amount associated with the code.)
8194         */
8195        public TotalComponent setAmount(Money value) { 
8196          this.amount = value;
8197          return this;
8198        }
8199
8200        protected void listChildren(List<Property> children) {
8201          super.listChildren(children);
8202          children.add(new Property("category", "CodeableConcept", "Code indicating: Submitted, Co-Pay, deductable, elegible, benefit, tax, etc.", 0, 1, category));
8203          children.add(new Property("amount", "Money", "Monitory amount associated with the code.", 0, 1, amount));
8204        }
8205
8206        @Override
8207        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8208          switch (_hash) {
8209          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Code indicating: Submitted, Co-Pay, deductable, elegible, benefit, tax, etc.", 0, 1, category);
8210          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monitory amount associated with the code.", 0, 1, amount);
8211          default: return super.getNamedProperty(_hash, _name, _checkValid);
8212          }
8213
8214        }
8215
8216      @Override
8217      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8218        switch (hash) {
8219        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
8220        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
8221        default: return super.getProperty(hash, name, checkValid);
8222        }
8223
8224      }
8225
8226      @Override
8227      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8228        switch (hash) {
8229        case 50511102: // category
8230          this.category = castToCodeableConcept(value); // CodeableConcept
8231          return value;
8232        case -1413853096: // amount
8233          this.amount = castToMoney(value); // Money
8234          return value;
8235        default: return super.setProperty(hash, name, value);
8236        }
8237
8238      }
8239
8240      @Override
8241      public Base setProperty(String name, Base value) throws FHIRException {
8242        if (name.equals("category")) {
8243          this.category = castToCodeableConcept(value); // CodeableConcept
8244        } else if (name.equals("amount")) {
8245          this.amount = castToMoney(value); // Money
8246        } else
8247          return super.setProperty(name, value);
8248        return value;
8249      }
8250
8251      @Override
8252      public Base makeProperty(int hash, String name) throws FHIRException {
8253        switch (hash) {
8254        case 50511102:  return getCategory(); 
8255        case -1413853096:  return getAmount(); 
8256        default: return super.makeProperty(hash, name);
8257        }
8258
8259      }
8260
8261      @Override
8262      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8263        switch (hash) {
8264        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
8265        case -1413853096: /*amount*/ return new String[] {"Money"};
8266        default: return super.getTypesForProperty(hash, name);
8267        }
8268
8269      }
8270
8271      @Override
8272      public Base addChild(String name) throws FHIRException {
8273        if (name.equals("category")) {
8274          this.category = new CodeableConcept();
8275          return this.category;
8276        }
8277        else if (name.equals("amount")) {
8278          this.amount = new Money();
8279          return this.amount;
8280        }
8281        else
8282          return super.addChild(name);
8283      }
8284
8285      public TotalComponent copy() {
8286        TotalComponent dst = new TotalComponent();
8287        copyValues(dst);
8288        dst.category = category == null ? null : category.copy();
8289        dst.amount = amount == null ? null : amount.copy();
8290        return dst;
8291      }
8292
8293      @Override
8294      public boolean equalsDeep(Base other_) {
8295        if (!super.equalsDeep(other_))
8296          return false;
8297        if (!(other_ instanceof TotalComponent))
8298          return false;
8299        TotalComponent o = (TotalComponent) other_;
8300        return compareDeep(category, o.category, true) && compareDeep(amount, o.amount, true);
8301      }
8302
8303      @Override
8304      public boolean equalsShallow(Base other_) {
8305        if (!super.equalsShallow(other_))
8306          return false;
8307        if (!(other_ instanceof TotalComponent))
8308          return false;
8309        TotalComponent o = (TotalComponent) other_;
8310        return true;
8311      }
8312
8313      public boolean isEmpty() {
8314        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, amount);
8315      }
8316
8317  public String fhirType() {
8318    return "ExplanationOfBenefit.total";
8319
8320  }
8321
8322  }
8323
8324    @Block()
8325    public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
8326        /**
8327         * Whether this represents partial or complete payment of the claim.
8328         */
8329        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
8330        @Description(shortDefinition="Partial or Complete", formalDefinition="Whether this represents partial or complete payment of the claim." )
8331        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-paymenttype")
8332        protected CodeableConcept type;
8333
8334        /**
8335         * Adjustment to the payment of this transaction which is not related to adjudication of this transaction.
8336         */
8337        @Child(name = "adjustment", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
8338        @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." )
8339        protected Money adjustment;
8340
8341        /**
8342         * Reason for the payment adjustment.
8343         */
8344        @Child(name = "adjustmentReason", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
8345        @Description(shortDefinition="Explanation for the non-claim adjustment", formalDefinition="Reason for the payment adjustment." )
8346        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
8347        protected CodeableConcept adjustmentReason;
8348
8349        /**
8350         * Estimated payment date.
8351         */
8352        @Child(name = "date", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=false)
8353        @Description(shortDefinition="Expected date of Payment", formalDefinition="Estimated payment date." )
8354        protected DateType date;
8355
8356        /**
8357         * Payable less any payment adjustment.
8358         */
8359        @Child(name = "amount", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
8360        @Description(shortDefinition="Payable amount after adjustment", formalDefinition="Payable less any payment adjustment." )
8361        protected Money amount;
8362
8363        /**
8364         * Payment identifer.
8365         */
8366        @Child(name = "identifier", type = {Identifier.class}, order=6, min=0, max=1, modifier=false, summary=false)
8367        @Description(shortDefinition="Identifier of the payment instrument", formalDefinition="Payment identifer." )
8368        protected Identifier identifier;
8369
8370        private static final long serialVersionUID = 1539906026L;
8371
8372    /**
8373     * Constructor
8374     */
8375      public PaymentComponent() {
8376        super();
8377      }
8378
8379        /**
8380         * @return {@link #type} (Whether this represents partial or complete payment of the claim.)
8381         */
8382        public CodeableConcept getType() { 
8383          if (this.type == null)
8384            if (Configuration.errorOnAutoCreate())
8385              throw new Error("Attempt to auto-create PaymentComponent.type");
8386            else if (Configuration.doAutoCreate())
8387              this.type = new CodeableConcept(); // cc
8388          return this.type;
8389        }
8390
8391        public boolean hasType() { 
8392          return this.type != null && !this.type.isEmpty();
8393        }
8394
8395        /**
8396         * @param value {@link #type} (Whether this represents partial or complete payment of the claim.)
8397         */
8398        public PaymentComponent setType(CodeableConcept value) { 
8399          this.type = value;
8400          return this;
8401        }
8402
8403        /**
8404         * @return {@link #adjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
8405         */
8406        public Money getAdjustment() { 
8407          if (this.adjustment == null)
8408            if (Configuration.errorOnAutoCreate())
8409              throw new Error("Attempt to auto-create PaymentComponent.adjustment");
8410            else if (Configuration.doAutoCreate())
8411              this.adjustment = new Money(); // cc
8412          return this.adjustment;
8413        }
8414
8415        public boolean hasAdjustment() { 
8416          return this.adjustment != null && !this.adjustment.isEmpty();
8417        }
8418
8419        /**
8420         * @param value {@link #adjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
8421         */
8422        public PaymentComponent setAdjustment(Money value) { 
8423          this.adjustment = value;
8424          return this;
8425        }
8426
8427        /**
8428         * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
8429         */
8430        public CodeableConcept getAdjustmentReason() { 
8431          if (this.adjustmentReason == null)
8432            if (Configuration.errorOnAutoCreate())
8433              throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
8434            else if (Configuration.doAutoCreate())
8435              this.adjustmentReason = new CodeableConcept(); // cc
8436          return this.adjustmentReason;
8437        }
8438
8439        public boolean hasAdjustmentReason() { 
8440          return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
8441        }
8442
8443        /**
8444         * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
8445         */
8446        public PaymentComponent setAdjustmentReason(CodeableConcept value) { 
8447          this.adjustmentReason = value;
8448          return this;
8449        }
8450
8451        /**
8452         * @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
8453         */
8454        public DateType getDateElement() { 
8455          if (this.date == null)
8456            if (Configuration.errorOnAutoCreate())
8457              throw new Error("Attempt to auto-create PaymentComponent.date");
8458            else if (Configuration.doAutoCreate())
8459              this.date = new DateType(); // bb
8460          return this.date;
8461        }
8462
8463        public boolean hasDateElement() { 
8464          return this.date != null && !this.date.isEmpty();
8465        }
8466
8467        public boolean hasDate() { 
8468          return this.date != null && !this.date.isEmpty();
8469        }
8470
8471        /**
8472         * @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
8473         */
8474        public PaymentComponent setDateElement(DateType value) { 
8475          this.date = value;
8476          return this;
8477        }
8478
8479        /**
8480         * @return Estimated payment date.
8481         */
8482        public Date getDate() { 
8483          return this.date == null ? null : this.date.getValue();
8484        }
8485
8486        /**
8487         * @param value Estimated payment date.
8488         */
8489        public PaymentComponent setDate(Date value) { 
8490          if (value == null)
8491            this.date = null;
8492          else {
8493            if (this.date == null)
8494              this.date = new DateType();
8495            this.date.setValue(value);
8496          }
8497          return this;
8498        }
8499
8500        /**
8501         * @return {@link #amount} (Payable less any payment adjustment.)
8502         */
8503        public Money getAmount() { 
8504          if (this.amount == null)
8505            if (Configuration.errorOnAutoCreate())
8506              throw new Error("Attempt to auto-create PaymentComponent.amount");
8507            else if (Configuration.doAutoCreate())
8508              this.amount = new Money(); // cc
8509          return this.amount;
8510        }
8511
8512        public boolean hasAmount() { 
8513          return this.amount != null && !this.amount.isEmpty();
8514        }
8515
8516        /**
8517         * @param value {@link #amount} (Payable less any payment adjustment.)
8518         */
8519        public PaymentComponent setAmount(Money value) { 
8520          this.amount = value;
8521          return this;
8522        }
8523
8524        /**
8525         * @return {@link #identifier} (Payment identifer.)
8526         */
8527        public Identifier getIdentifier() { 
8528          if (this.identifier == null)
8529            if (Configuration.errorOnAutoCreate())
8530              throw new Error("Attempt to auto-create PaymentComponent.identifier");
8531            else if (Configuration.doAutoCreate())
8532              this.identifier = new Identifier(); // cc
8533          return this.identifier;
8534        }
8535
8536        public boolean hasIdentifier() { 
8537          return this.identifier != null && !this.identifier.isEmpty();
8538        }
8539
8540        /**
8541         * @param value {@link #identifier} (Payment identifer.)
8542         */
8543        public PaymentComponent setIdentifier(Identifier value) { 
8544          this.identifier = value;
8545          return this;
8546        }
8547
8548        protected void listChildren(List<Property> children) {
8549          super.listChildren(children);
8550          children.add(new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the claim.", 0, 1, type));
8551          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));
8552          children.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason));
8553          children.add(new Property("date", "date", "Estimated payment date.", 0, 1, date));
8554          children.add(new Property("amount", "Money", "Payable less any payment adjustment.", 0, 1, amount));
8555          children.add(new Property("identifier", "Identifier", "Payment identifer.", 0, 1, identifier));
8556        }
8557
8558        @Override
8559        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8560          switch (_hash) {
8561          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the claim.", 0, 1, type);
8562          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);
8563          case -1255938543: /*adjustmentReason*/  return new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason);
8564          case 3076014: /*date*/  return new Property("date", "date", "Estimated payment date.", 0, 1, date);
8565          case -1413853096: /*amount*/  return new Property("amount", "Money", "Payable less any payment adjustment.", 0, 1, amount);
8566          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Payment identifer.", 0, 1, identifier);
8567          default: return super.getNamedProperty(_hash, _name, _checkValid);
8568          }
8569
8570        }
8571
8572      @Override
8573      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8574        switch (hash) {
8575        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
8576        case 1977085293: /*adjustment*/ return this.adjustment == null ? new Base[0] : new Base[] {this.adjustment}; // Money
8577        case -1255938543: /*adjustmentReason*/ return this.adjustmentReason == null ? new Base[0] : new Base[] {this.adjustmentReason}; // CodeableConcept
8578        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
8579        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
8580        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
8581        default: return super.getProperty(hash, name, checkValid);
8582        }
8583
8584      }
8585
8586      @Override
8587      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8588        switch (hash) {
8589        case 3575610: // type
8590          this.type = castToCodeableConcept(value); // CodeableConcept
8591          return value;
8592        case 1977085293: // adjustment
8593          this.adjustment = castToMoney(value); // Money
8594          return value;
8595        case -1255938543: // adjustmentReason
8596          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
8597          return value;
8598        case 3076014: // date
8599          this.date = castToDate(value); // DateType
8600          return value;
8601        case -1413853096: // amount
8602          this.amount = castToMoney(value); // Money
8603          return value;
8604        case -1618432855: // identifier
8605          this.identifier = castToIdentifier(value); // Identifier
8606          return value;
8607        default: return super.setProperty(hash, name, value);
8608        }
8609
8610      }
8611
8612      @Override
8613      public Base setProperty(String name, Base value) throws FHIRException {
8614        if (name.equals("type")) {
8615          this.type = castToCodeableConcept(value); // CodeableConcept
8616        } else if (name.equals("adjustment")) {
8617          this.adjustment = castToMoney(value); // Money
8618        } else if (name.equals("adjustmentReason")) {
8619          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
8620        } else if (name.equals("date")) {
8621          this.date = castToDate(value); // DateType
8622        } else if (name.equals("amount")) {
8623          this.amount = castToMoney(value); // Money
8624        } else if (name.equals("identifier")) {
8625          this.identifier = castToIdentifier(value); // Identifier
8626        } else
8627          return super.setProperty(name, value);
8628        return value;
8629      }
8630
8631      @Override
8632      public Base makeProperty(int hash, String name) throws FHIRException {
8633        switch (hash) {
8634        case 3575610:  return getType(); 
8635        case 1977085293:  return getAdjustment(); 
8636        case -1255938543:  return getAdjustmentReason(); 
8637        case 3076014:  return getDateElement();
8638        case -1413853096:  return getAmount(); 
8639        case -1618432855:  return getIdentifier(); 
8640        default: return super.makeProperty(hash, name);
8641        }
8642
8643      }
8644
8645      @Override
8646      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8647        switch (hash) {
8648        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
8649        case 1977085293: /*adjustment*/ return new String[] {"Money"};
8650        case -1255938543: /*adjustmentReason*/ return new String[] {"CodeableConcept"};
8651        case 3076014: /*date*/ return new String[] {"date"};
8652        case -1413853096: /*amount*/ return new String[] {"Money"};
8653        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
8654        default: return super.getTypesForProperty(hash, name);
8655        }
8656
8657      }
8658
8659      @Override
8660      public Base addChild(String name) throws FHIRException {
8661        if (name.equals("type")) {
8662          this.type = new CodeableConcept();
8663          return this.type;
8664        }
8665        else if (name.equals("adjustment")) {
8666          this.adjustment = new Money();
8667          return this.adjustment;
8668        }
8669        else if (name.equals("adjustmentReason")) {
8670          this.adjustmentReason = new CodeableConcept();
8671          return this.adjustmentReason;
8672        }
8673        else if (name.equals("date")) {
8674          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
8675        }
8676        else if (name.equals("amount")) {
8677          this.amount = new Money();
8678          return this.amount;
8679        }
8680        else if (name.equals("identifier")) {
8681          this.identifier = new Identifier();
8682          return this.identifier;
8683        }
8684        else
8685          return super.addChild(name);
8686      }
8687
8688      public PaymentComponent copy() {
8689        PaymentComponent dst = new PaymentComponent();
8690        copyValues(dst);
8691        dst.type = type == null ? null : type.copy();
8692        dst.adjustment = adjustment == null ? null : adjustment.copy();
8693        dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
8694        dst.date = date == null ? null : date.copy();
8695        dst.amount = amount == null ? null : amount.copy();
8696        dst.identifier = identifier == null ? null : identifier.copy();
8697        return dst;
8698      }
8699
8700      @Override
8701      public boolean equalsDeep(Base other_) {
8702        if (!super.equalsDeep(other_))
8703          return false;
8704        if (!(other_ instanceof PaymentComponent))
8705          return false;
8706        PaymentComponent o = (PaymentComponent) other_;
8707        return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true) && compareDeep(adjustmentReason, o.adjustmentReason, true)
8708           && compareDeep(date, o.date, true) && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true)
8709          ;
8710      }
8711
8712      @Override
8713      public boolean equalsShallow(Base other_) {
8714        if (!super.equalsShallow(other_))
8715          return false;
8716        if (!(other_ instanceof PaymentComponent))
8717          return false;
8718        PaymentComponent o = (PaymentComponent) other_;
8719        return compareValues(date, o.date, true);
8720      }
8721
8722      public boolean isEmpty() {
8723        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason
8724          , date, amount, identifier);
8725      }
8726
8727  public String fhirType() {
8728    return "ExplanationOfBenefit.payment";
8729
8730  }
8731
8732  }
8733
8734    @Block()
8735    public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
8736        /**
8737         * An integer associated with each note which may be referred to from each service line item.
8738         */
8739        @Child(name = "number", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
8740        @Description(shortDefinition="Sequence number for this note", formalDefinition="An integer associated with each note which may be referred to from each service line item." )
8741        protected PositiveIntType number;
8742
8743        /**
8744         * The note purpose: Print/Display.
8745         */
8746        @Child(name = "type", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
8747        @Description(shortDefinition="display | print | printoper", formalDefinition="The note purpose: Print/Display." )
8748        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/note-type")
8749        protected Enumeration<NoteType> type;
8750
8751        /**
8752         * The note text.
8753         */
8754        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
8755        @Description(shortDefinition="Note explanitory text", formalDefinition="The note text." )
8756        protected StringType text;
8757
8758        /**
8759         * 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.
8760         */
8761        @Child(name = "language", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
8762        @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." )
8763        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
8764        protected CodeableConcept language;
8765
8766        private static final long serialVersionUID = -385184277L;
8767
8768    /**
8769     * Constructor
8770     */
8771      public NoteComponent() {
8772        super();
8773      }
8774
8775        /**
8776         * @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
8777         */
8778        public PositiveIntType getNumberElement() { 
8779          if (this.number == null)
8780            if (Configuration.errorOnAutoCreate())
8781              throw new Error("Attempt to auto-create NoteComponent.number");
8782            else if (Configuration.doAutoCreate())
8783              this.number = new PositiveIntType(); // bb
8784          return this.number;
8785        }
8786
8787        public boolean hasNumberElement() { 
8788          return this.number != null && !this.number.isEmpty();
8789        }
8790
8791        public boolean hasNumber() { 
8792          return this.number != null && !this.number.isEmpty();
8793        }
8794
8795        /**
8796         * @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
8797         */
8798        public NoteComponent setNumberElement(PositiveIntType value) { 
8799          this.number = value;
8800          return this;
8801        }
8802
8803        /**
8804         * @return An integer associated with each note which may be referred to from each service line item.
8805         */
8806        public int getNumber() { 
8807          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
8808        }
8809
8810        /**
8811         * @param value An integer associated with each note which may be referred to from each service line item.
8812         */
8813        public NoteComponent setNumber(int value) { 
8814            if (this.number == null)
8815              this.number = new PositiveIntType();
8816            this.number.setValue(value);
8817          return this;
8818        }
8819
8820        /**
8821         * @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
8822         */
8823        public Enumeration<NoteType> getTypeElement() { 
8824          if (this.type == null)
8825            if (Configuration.errorOnAutoCreate())
8826              throw new Error("Attempt to auto-create NoteComponent.type");
8827            else if (Configuration.doAutoCreate())
8828              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory()); // bb
8829          return this.type;
8830        }
8831
8832        public boolean hasTypeElement() { 
8833          return this.type != null && !this.type.isEmpty();
8834        }
8835
8836        public boolean hasType() { 
8837          return this.type != null && !this.type.isEmpty();
8838        }
8839
8840        /**
8841         * @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
8842         */
8843        public NoteComponent setTypeElement(Enumeration<NoteType> value) { 
8844          this.type = value;
8845          return this;
8846        }
8847
8848        /**
8849         * @return The note purpose: Print/Display.
8850         */
8851        public NoteType getType() { 
8852          return this.type == null ? null : this.type.getValue();
8853        }
8854
8855        /**
8856         * @param value The note purpose: Print/Display.
8857         */
8858        public NoteComponent setType(NoteType value) { 
8859          if (value == null)
8860            this.type = null;
8861          else {
8862            if (this.type == null)
8863              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory());
8864            this.type.setValue(value);
8865          }
8866          return this;
8867        }
8868
8869        /**
8870         * @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
8871         */
8872        public StringType getTextElement() { 
8873          if (this.text == null)
8874            if (Configuration.errorOnAutoCreate())
8875              throw new Error("Attempt to auto-create NoteComponent.text");
8876            else if (Configuration.doAutoCreate())
8877              this.text = new StringType(); // bb
8878          return this.text;
8879        }
8880
8881        public boolean hasTextElement() { 
8882          return this.text != null && !this.text.isEmpty();
8883        }
8884
8885        public boolean hasText() { 
8886          return this.text != null && !this.text.isEmpty();
8887        }
8888
8889        /**
8890         * @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
8891         */
8892        public NoteComponent setTextElement(StringType value) { 
8893          this.text = value;
8894          return this;
8895        }
8896
8897        /**
8898         * @return The note text.
8899         */
8900        public String getText() { 
8901          return this.text == null ? null : this.text.getValue();
8902        }
8903
8904        /**
8905         * @param value The note text.
8906         */
8907        public NoteComponent setText(String value) { 
8908          if (Utilities.noString(value))
8909            this.text = null;
8910          else {
8911            if (this.text == null)
8912              this.text = new StringType();
8913            this.text.setValue(value);
8914          }
8915          return this;
8916        }
8917
8918        /**
8919         * @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.)
8920         */
8921        public CodeableConcept getLanguage() { 
8922          if (this.language == null)
8923            if (Configuration.errorOnAutoCreate())
8924              throw new Error("Attempt to auto-create NoteComponent.language");
8925            else if (Configuration.doAutoCreate())
8926              this.language = new CodeableConcept(); // cc
8927          return this.language;
8928        }
8929
8930        public boolean hasLanguage() { 
8931          return this.language != null && !this.language.isEmpty();
8932        }
8933
8934        /**
8935         * @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.)
8936         */
8937        public NoteComponent setLanguage(CodeableConcept value) { 
8938          this.language = value;
8939          return this;
8940        }
8941
8942        protected void listChildren(List<Property> children) {
8943          super.listChildren(children);
8944          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));
8945          children.add(new Property("type", "code", "The note purpose: Print/Display.", 0, 1, type));
8946          children.add(new Property("text", "string", "The note text.", 0, 1, text));
8947          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));
8948        }
8949
8950        @Override
8951        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8952          switch (_hash) {
8953          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);
8954          case 3575610: /*type*/  return new Property("type", "code", "The note purpose: Print/Display.", 0, 1, type);
8955          case 3556653: /*text*/  return new Property("text", "string", "The note text.", 0, 1, text);
8956          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);
8957          default: return super.getNamedProperty(_hash, _name, _checkValid);
8958          }
8959
8960        }
8961
8962      @Override
8963      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8964        switch (hash) {
8965        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // PositiveIntType
8966        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<NoteType>
8967        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
8968        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeableConcept
8969        default: return super.getProperty(hash, name, checkValid);
8970        }
8971
8972      }
8973
8974      @Override
8975      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8976        switch (hash) {
8977        case -1034364087: // number
8978          this.number = castToPositiveInt(value); // PositiveIntType
8979          return value;
8980        case 3575610: // type
8981          value = new NoteTypeEnumFactory().fromType(castToCode(value));
8982          this.type = (Enumeration) value; // Enumeration<NoteType>
8983          return value;
8984        case 3556653: // text
8985          this.text = castToString(value); // StringType
8986          return value;
8987        case -1613589672: // language
8988          this.language = castToCodeableConcept(value); // CodeableConcept
8989          return value;
8990        default: return super.setProperty(hash, name, value);
8991        }
8992
8993      }
8994
8995      @Override
8996      public Base setProperty(String name, Base value) throws FHIRException {
8997        if (name.equals("number")) {
8998          this.number = castToPositiveInt(value); // PositiveIntType
8999        } else if (name.equals("type")) {
9000          value = new NoteTypeEnumFactory().fromType(castToCode(value));
9001          this.type = (Enumeration) value; // Enumeration<NoteType>
9002        } else if (name.equals("text")) {
9003          this.text = castToString(value); // StringType
9004        } else if (name.equals("language")) {
9005          this.language = castToCodeableConcept(value); // CodeableConcept
9006        } else
9007          return super.setProperty(name, value);
9008        return value;
9009      }
9010
9011      @Override
9012      public Base makeProperty(int hash, String name) throws FHIRException {
9013        switch (hash) {
9014        case -1034364087:  return getNumberElement();
9015        case 3575610:  return getTypeElement();
9016        case 3556653:  return getTextElement();
9017        case -1613589672:  return getLanguage(); 
9018        default: return super.makeProperty(hash, name);
9019        }
9020
9021      }
9022
9023      @Override
9024      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9025        switch (hash) {
9026        case -1034364087: /*number*/ return new String[] {"positiveInt"};
9027        case 3575610: /*type*/ return new String[] {"code"};
9028        case 3556653: /*text*/ return new String[] {"string"};
9029        case -1613589672: /*language*/ return new String[] {"CodeableConcept"};
9030        default: return super.getTypesForProperty(hash, name);
9031        }
9032
9033      }
9034
9035      @Override
9036      public Base addChild(String name) throws FHIRException {
9037        if (name.equals("number")) {
9038          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.number");
9039        }
9040        else if (name.equals("type")) {
9041          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.type");
9042        }
9043        else if (name.equals("text")) {
9044          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.text");
9045        }
9046        else if (name.equals("language")) {
9047          this.language = new CodeableConcept();
9048          return this.language;
9049        }
9050        else
9051          return super.addChild(name);
9052      }
9053
9054      public NoteComponent copy() {
9055        NoteComponent dst = new NoteComponent();
9056        copyValues(dst);
9057        dst.number = number == null ? null : number.copy();
9058        dst.type = type == null ? null : type.copy();
9059        dst.text = text == null ? null : text.copy();
9060        dst.language = language == null ? null : language.copy();
9061        return dst;
9062      }
9063
9064      @Override
9065      public boolean equalsDeep(Base other_) {
9066        if (!super.equalsDeep(other_))
9067          return false;
9068        if (!(other_ instanceof NoteComponent))
9069          return false;
9070        NoteComponent o = (NoteComponent) other_;
9071        return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
9072           && compareDeep(language, o.language, true);
9073      }
9074
9075      @Override
9076      public boolean equalsShallow(Base other_) {
9077        if (!super.equalsShallow(other_))
9078          return false;
9079        if (!(other_ instanceof NoteComponent))
9080          return false;
9081        NoteComponent o = (NoteComponent) other_;
9082        return compareValues(number, o.number, true) && compareValues(type, o.type, true) && compareValues(text, o.text, true)
9083          ;
9084      }
9085
9086      public boolean isEmpty() {
9087        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language
9088          );
9089      }
9090
9091  public String fhirType() {
9092    return "ExplanationOfBenefit.processNote";
9093
9094  }
9095
9096  }
9097
9098    @Block()
9099    public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
9100        /**
9101         * Dental, Vision, Medical, Pharmacy, Rehab etc.
9102         */
9103        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9104        @Description(shortDefinition="Type of services covered", formalDefinition="Dental, Vision, Medical, Pharmacy, Rehab etc." )
9105        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-category")
9106        protected CodeableConcept category;
9107
9108        /**
9109         * Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.
9110         */
9111        @Child(name = "subCategory", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
9112        @Description(shortDefinition="Detailed services covered within the type", formalDefinition="Dental: basic, major, ortho; Vision exam, glasses, contacts; etc." )
9113        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
9114        protected CodeableConcept subCategory;
9115
9116        /**
9117         * True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.
9118         */
9119        @Child(name = "excluded", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
9120        @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." )
9121        protected BooleanType excluded;
9122
9123        /**
9124         * A short name or tag for the benefit, for example MED01, or DENT2.
9125         */
9126        @Child(name = "name", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
9127        @Description(shortDefinition="Short name for the benefit", formalDefinition="A short name or tag for the benefit, for example MED01, or DENT2." )
9128        protected StringType name;
9129
9130        /**
9131         * A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.
9132         */
9133        @Child(name = "description", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
9134        @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'." )
9135        protected StringType description;
9136
9137        /**
9138         * Network designation.
9139         */
9140        @Child(name = "network", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
9141        @Description(shortDefinition="In or out of network", formalDefinition="Network designation." )
9142        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-network")
9143        protected CodeableConcept network;
9144
9145        /**
9146         * Unit designation: individual or family.
9147         */
9148        @Child(name = "unit", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
9149        @Description(shortDefinition="Individual or family", formalDefinition="Unit designation: individual or family." )
9150        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-unit")
9151        protected CodeableConcept unit;
9152
9153        /**
9154         * The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.
9155         */
9156        @Child(name = "term", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
9157        @Description(shortDefinition="Annual or lifetime", formalDefinition="The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'." )
9158        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-term")
9159        protected CodeableConcept term;
9160
9161        /**
9162         * Benefits Used to date.
9163         */
9164        @Child(name = "financial", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9165        @Description(shortDefinition="Benefit Summary", formalDefinition="Benefits Used to date." )
9166        protected List<BenefitComponent> financial;
9167
9168        private static final long serialVersionUID = 833826021L;
9169
9170    /**
9171     * Constructor
9172     */
9173      public BenefitBalanceComponent() {
9174        super();
9175      }
9176
9177    /**
9178     * Constructor
9179     */
9180      public BenefitBalanceComponent(CodeableConcept category) {
9181        super();
9182        this.category = category;
9183      }
9184
9185        /**
9186         * @return {@link #category} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
9187         */
9188        public CodeableConcept getCategory() { 
9189          if (this.category == null)
9190            if (Configuration.errorOnAutoCreate())
9191              throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
9192            else if (Configuration.doAutoCreate())
9193              this.category = new CodeableConcept(); // cc
9194          return this.category;
9195        }
9196
9197        public boolean hasCategory() { 
9198          return this.category != null && !this.category.isEmpty();
9199        }
9200
9201        /**
9202         * @param value {@link #category} (Dental, Vision, Medical, Pharmacy, Rehab etc.)
9203         */
9204        public BenefitBalanceComponent setCategory(CodeableConcept value) { 
9205          this.category = value;
9206          return this;
9207        }
9208
9209        /**
9210         * @return {@link #subCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
9211         */
9212        public CodeableConcept getSubCategory() { 
9213          if (this.subCategory == null)
9214            if (Configuration.errorOnAutoCreate())
9215              throw new Error("Attempt to auto-create BenefitBalanceComponent.subCategory");
9216            else if (Configuration.doAutoCreate())
9217              this.subCategory = new CodeableConcept(); // cc
9218          return this.subCategory;
9219        }
9220
9221        public boolean hasSubCategory() { 
9222          return this.subCategory != null && !this.subCategory.isEmpty();
9223        }
9224
9225        /**
9226         * @param value {@link #subCategory} (Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.)
9227         */
9228        public BenefitBalanceComponent setSubCategory(CodeableConcept value) { 
9229          this.subCategory = value;
9230          return this;
9231        }
9232
9233        /**
9234         * @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
9235         */
9236        public BooleanType getExcludedElement() { 
9237          if (this.excluded == null)
9238            if (Configuration.errorOnAutoCreate())
9239              throw new Error("Attempt to auto-create BenefitBalanceComponent.excluded");
9240            else if (Configuration.doAutoCreate())
9241              this.excluded = new BooleanType(); // bb
9242          return this.excluded;
9243        }
9244
9245        public boolean hasExcludedElement() { 
9246          return this.excluded != null && !this.excluded.isEmpty();
9247        }
9248
9249        public boolean hasExcluded() { 
9250          return this.excluded != null && !this.excluded.isEmpty();
9251        }
9252
9253        /**
9254         * @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
9255         */
9256        public BenefitBalanceComponent setExcludedElement(BooleanType value) { 
9257          this.excluded = value;
9258          return this;
9259        }
9260
9261        /**
9262         * @return True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.
9263         */
9264        public boolean getExcluded() { 
9265          return this.excluded == null || this.excluded.isEmpty() ? false : this.excluded.getValue();
9266        }
9267
9268        /**
9269         * @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.
9270         */
9271        public BenefitBalanceComponent setExcluded(boolean value) { 
9272            if (this.excluded == null)
9273              this.excluded = new BooleanType();
9274            this.excluded.setValue(value);
9275          return this;
9276        }
9277
9278        /**
9279         * @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
9280         */
9281        public StringType getNameElement() { 
9282          if (this.name == null)
9283            if (Configuration.errorOnAutoCreate())
9284              throw new Error("Attempt to auto-create BenefitBalanceComponent.name");
9285            else if (Configuration.doAutoCreate())
9286              this.name = new StringType(); // bb
9287          return this.name;
9288        }
9289
9290        public boolean hasNameElement() { 
9291          return this.name != null && !this.name.isEmpty();
9292        }
9293
9294        public boolean hasName() { 
9295          return this.name != null && !this.name.isEmpty();
9296        }
9297
9298        /**
9299         * @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
9300         */
9301        public BenefitBalanceComponent setNameElement(StringType value) { 
9302          this.name = value;
9303          return this;
9304        }
9305
9306        /**
9307         * @return A short name or tag for the benefit, for example MED01, or DENT2.
9308         */
9309        public String getName() { 
9310          return this.name == null ? null : this.name.getValue();
9311        }
9312
9313        /**
9314         * @param value A short name or tag for the benefit, for example MED01, or DENT2.
9315         */
9316        public BenefitBalanceComponent setName(String value) { 
9317          if (Utilities.noString(value))
9318            this.name = null;
9319          else {
9320            if (this.name == null)
9321              this.name = new StringType();
9322            this.name.setValue(value);
9323          }
9324          return this;
9325        }
9326
9327        /**
9328         * @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
9329         */
9330        public StringType getDescriptionElement() { 
9331          if (this.description == null)
9332            if (Configuration.errorOnAutoCreate())
9333              throw new Error("Attempt to auto-create BenefitBalanceComponent.description");
9334            else if (Configuration.doAutoCreate())
9335              this.description = new StringType(); // bb
9336          return this.description;
9337        }
9338
9339        public boolean hasDescriptionElement() { 
9340          return this.description != null && !this.description.isEmpty();
9341        }
9342
9343        public boolean hasDescription() { 
9344          return this.description != null && !this.description.isEmpty();
9345        }
9346
9347        /**
9348         * @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
9349         */
9350        public BenefitBalanceComponent setDescriptionElement(StringType value) { 
9351          this.description = value;
9352          return this;
9353        }
9354
9355        /**
9356         * @return A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.
9357         */
9358        public String getDescription() { 
9359          return this.description == null ? null : this.description.getValue();
9360        }
9361
9362        /**
9363         * @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'.
9364         */
9365        public BenefitBalanceComponent setDescription(String value) { 
9366          if (Utilities.noString(value))
9367            this.description = null;
9368          else {
9369            if (this.description == null)
9370              this.description = new StringType();
9371            this.description.setValue(value);
9372          }
9373          return this;
9374        }
9375
9376        /**
9377         * @return {@link #network} (Network designation.)
9378         */
9379        public CodeableConcept getNetwork() { 
9380          if (this.network == null)
9381            if (Configuration.errorOnAutoCreate())
9382              throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
9383            else if (Configuration.doAutoCreate())
9384              this.network = new CodeableConcept(); // cc
9385          return this.network;
9386        }
9387
9388        public boolean hasNetwork() { 
9389          return this.network != null && !this.network.isEmpty();
9390        }
9391
9392        /**
9393         * @param value {@link #network} (Network designation.)
9394         */
9395        public BenefitBalanceComponent setNetwork(CodeableConcept value) { 
9396          this.network = value;
9397          return this;
9398        }
9399
9400        /**
9401         * @return {@link #unit} (Unit designation: individual or family.)
9402         */
9403        public CodeableConcept getUnit() { 
9404          if (this.unit == null)
9405            if (Configuration.errorOnAutoCreate())
9406              throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
9407            else if (Configuration.doAutoCreate())
9408              this.unit = new CodeableConcept(); // cc
9409          return this.unit;
9410        }
9411
9412        public boolean hasUnit() { 
9413          return this.unit != null && !this.unit.isEmpty();
9414        }
9415
9416        /**
9417         * @param value {@link #unit} (Unit designation: individual or family.)
9418         */
9419        public BenefitBalanceComponent setUnit(CodeableConcept value) { 
9420          this.unit = value;
9421          return this;
9422        }
9423
9424        /**
9425         * @return {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.)
9426         */
9427        public CodeableConcept getTerm() { 
9428          if (this.term == null)
9429            if (Configuration.errorOnAutoCreate())
9430              throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
9431            else if (Configuration.doAutoCreate())
9432              this.term = new CodeableConcept(); // cc
9433          return this.term;
9434        }
9435
9436        public boolean hasTerm() { 
9437          return this.term != null && !this.term.isEmpty();
9438        }
9439
9440        /**
9441         * @param value {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.)
9442         */
9443        public BenefitBalanceComponent setTerm(CodeableConcept value) { 
9444          this.term = value;
9445          return this;
9446        }
9447
9448        /**
9449         * @return {@link #financial} (Benefits Used to date.)
9450         */
9451        public List<BenefitComponent> getFinancial() { 
9452          if (this.financial == null)
9453            this.financial = new ArrayList<BenefitComponent>();
9454          return this.financial;
9455        }
9456
9457        /**
9458         * @return Returns a reference to <code>this</code> for easy method chaining
9459         */
9460        public BenefitBalanceComponent setFinancial(List<BenefitComponent> theFinancial) { 
9461          this.financial = theFinancial;
9462          return this;
9463        }
9464
9465        public boolean hasFinancial() { 
9466          if (this.financial == null)
9467            return false;
9468          for (BenefitComponent item : this.financial)
9469            if (!item.isEmpty())
9470              return true;
9471          return false;
9472        }
9473
9474        public BenefitComponent addFinancial() { //3
9475          BenefitComponent t = new BenefitComponent();
9476          if (this.financial == null)
9477            this.financial = new ArrayList<BenefitComponent>();
9478          this.financial.add(t);
9479          return t;
9480        }
9481
9482        public BenefitBalanceComponent addFinancial(BenefitComponent t) { //3
9483          if (t == null)
9484            return this;
9485          if (this.financial == null)
9486            this.financial = new ArrayList<BenefitComponent>();
9487          this.financial.add(t);
9488          return this;
9489        }
9490
9491        /**
9492         * @return The first repetition of repeating field {@link #financial}, creating it if it does not already exist
9493         */
9494        public BenefitComponent getFinancialFirstRep() { 
9495          if (getFinancial().isEmpty()) {
9496            addFinancial();
9497          }
9498          return getFinancial().get(0);
9499        }
9500
9501        protected void listChildren(List<Property> children) {
9502          super.listChildren(children);
9503          children.add(new Property("category", "CodeableConcept", "Dental, Vision, Medical, Pharmacy, Rehab etc.", 0, 1, category));
9504          children.add(new Property("subCategory", "CodeableConcept", "Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.", 0, 1, subCategory));
9505          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));
9506          children.add(new Property("name", "string", "A short name or tag for the benefit, for example MED01, or DENT2.", 0, 1, name));
9507          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));
9508          children.add(new Property("network", "CodeableConcept", "Network designation.", 0, 1, network));
9509          children.add(new Property("unit", "CodeableConcept", "Unit designation: individual or family.", 0, 1, unit));
9510          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));
9511          children.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
9512        }
9513
9514        @Override
9515        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9516          switch (_hash) {
9517          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Dental, Vision, Medical, Pharmacy, Rehab etc.", 0, 1, category);
9518          case 1365024606: /*subCategory*/  return new Property("subCategory", "CodeableConcept", "Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.", 0, 1, subCategory);
9519          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);
9520          case 3373707: /*name*/  return new Property("name", "string", "A short name or tag for the benefit, for example MED01, or DENT2.", 0, 1, name);
9521          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);
9522          case 1843485230: /*network*/  return new Property("network", "CodeableConcept", "Network designation.", 0, 1, network);
9523          case 3594628: /*unit*/  return new Property("unit", "CodeableConcept", "Unit designation: individual or family.", 0, 1, unit);
9524          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);
9525          case 357555337: /*financial*/  return new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial);
9526          default: return super.getNamedProperty(_hash, _name, _checkValid);
9527          }
9528
9529        }
9530
9531      @Override
9532      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9533        switch (hash) {
9534        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
9535        case 1365024606: /*subCategory*/ return this.subCategory == null ? new Base[0] : new Base[] {this.subCategory}; // CodeableConcept
9536        case 1994055114: /*excluded*/ return this.excluded == null ? new Base[0] : new Base[] {this.excluded}; // BooleanType
9537        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
9538        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
9539        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // CodeableConcept
9540        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // CodeableConcept
9541        case 3556460: /*term*/ return this.term == null ? new Base[0] : new Base[] {this.term}; // CodeableConcept
9542        case 357555337: /*financial*/ return this.financial == null ? new Base[0] : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
9543        default: return super.getProperty(hash, name, checkValid);
9544        }
9545
9546      }
9547
9548      @Override
9549      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9550        switch (hash) {
9551        case 50511102: // category
9552          this.category = castToCodeableConcept(value); // CodeableConcept
9553          return value;
9554        case 1365024606: // subCategory
9555          this.subCategory = castToCodeableConcept(value); // CodeableConcept
9556          return value;
9557        case 1994055114: // excluded
9558          this.excluded = castToBoolean(value); // BooleanType
9559          return value;
9560        case 3373707: // name
9561          this.name = castToString(value); // StringType
9562          return value;
9563        case -1724546052: // description
9564          this.description = castToString(value); // StringType
9565          return value;
9566        case 1843485230: // network
9567          this.network = castToCodeableConcept(value); // CodeableConcept
9568          return value;
9569        case 3594628: // unit
9570          this.unit = castToCodeableConcept(value); // CodeableConcept
9571          return value;
9572        case 3556460: // term
9573          this.term = castToCodeableConcept(value); // CodeableConcept
9574          return value;
9575        case 357555337: // financial
9576          this.getFinancial().add((BenefitComponent) value); // BenefitComponent
9577          return value;
9578        default: return super.setProperty(hash, name, value);
9579        }
9580
9581      }
9582
9583      @Override
9584      public Base setProperty(String name, Base value) throws FHIRException {
9585        if (name.equals("category")) {
9586          this.category = castToCodeableConcept(value); // CodeableConcept
9587        } else if (name.equals("subCategory")) {
9588          this.subCategory = castToCodeableConcept(value); // CodeableConcept
9589        } else if (name.equals("excluded")) {
9590          this.excluded = castToBoolean(value); // BooleanType
9591        } else if (name.equals("name")) {
9592          this.name = castToString(value); // StringType
9593        } else if (name.equals("description")) {
9594          this.description = castToString(value); // StringType
9595        } else if (name.equals("network")) {
9596          this.network = castToCodeableConcept(value); // CodeableConcept
9597        } else if (name.equals("unit")) {
9598          this.unit = castToCodeableConcept(value); // CodeableConcept
9599        } else if (name.equals("term")) {
9600          this.term = castToCodeableConcept(value); // CodeableConcept
9601        } else if (name.equals("financial")) {
9602          this.getFinancial().add((BenefitComponent) value);
9603        } else
9604          return super.setProperty(name, value);
9605        return value;
9606      }
9607
9608      @Override
9609      public Base makeProperty(int hash, String name) throws FHIRException {
9610        switch (hash) {
9611        case 50511102:  return getCategory(); 
9612        case 1365024606:  return getSubCategory(); 
9613        case 1994055114:  return getExcludedElement();
9614        case 3373707:  return getNameElement();
9615        case -1724546052:  return getDescriptionElement();
9616        case 1843485230:  return getNetwork(); 
9617        case 3594628:  return getUnit(); 
9618        case 3556460:  return getTerm(); 
9619        case 357555337:  return addFinancial(); 
9620        default: return super.makeProperty(hash, name);
9621        }
9622
9623      }
9624
9625      @Override
9626      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9627        switch (hash) {
9628        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
9629        case 1365024606: /*subCategory*/ return new String[] {"CodeableConcept"};
9630        case 1994055114: /*excluded*/ return new String[] {"boolean"};
9631        case 3373707: /*name*/ return new String[] {"string"};
9632        case -1724546052: /*description*/ return new String[] {"string"};
9633        case 1843485230: /*network*/ return new String[] {"CodeableConcept"};
9634        case 3594628: /*unit*/ return new String[] {"CodeableConcept"};
9635        case 3556460: /*term*/ return new String[] {"CodeableConcept"};
9636        case 357555337: /*financial*/ return new String[] {};
9637        default: return super.getTypesForProperty(hash, name);
9638        }
9639
9640      }
9641
9642      @Override
9643      public Base addChild(String name) throws FHIRException {
9644        if (name.equals("category")) {
9645          this.category = new CodeableConcept();
9646          return this.category;
9647        }
9648        else if (name.equals("subCategory")) {
9649          this.subCategory = new CodeableConcept();
9650          return this.subCategory;
9651        }
9652        else if (name.equals("excluded")) {
9653          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.excluded");
9654        }
9655        else if (name.equals("name")) {
9656          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.name");
9657        }
9658        else if (name.equals("description")) {
9659          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.description");
9660        }
9661        else if (name.equals("network")) {
9662          this.network = new CodeableConcept();
9663          return this.network;
9664        }
9665        else if (name.equals("unit")) {
9666          this.unit = new CodeableConcept();
9667          return this.unit;
9668        }
9669        else if (name.equals("term")) {
9670          this.term = new CodeableConcept();
9671          return this.term;
9672        }
9673        else if (name.equals("financial")) {
9674          return addFinancial();
9675        }
9676        else
9677          return super.addChild(name);
9678      }
9679
9680      public BenefitBalanceComponent copy() {
9681        BenefitBalanceComponent dst = new BenefitBalanceComponent();
9682        copyValues(dst);
9683        dst.category = category == null ? null : category.copy();
9684        dst.subCategory = subCategory == null ? null : subCategory.copy();
9685        dst.excluded = excluded == null ? null : excluded.copy();
9686        dst.name = name == null ? null : name.copy();
9687        dst.description = description == null ? null : description.copy();
9688        dst.network = network == null ? null : network.copy();
9689        dst.unit = unit == null ? null : unit.copy();
9690        dst.term = term == null ? null : term.copy();
9691        if (financial != null) {
9692          dst.financial = new ArrayList<BenefitComponent>();
9693          for (BenefitComponent i : financial)
9694            dst.financial.add(i.copy());
9695        };
9696        return dst;
9697      }
9698
9699      @Override
9700      public boolean equalsDeep(Base other_) {
9701        if (!super.equalsDeep(other_))
9702          return false;
9703        if (!(other_ instanceof BenefitBalanceComponent))
9704          return false;
9705        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
9706        return compareDeep(category, o.category, true) && compareDeep(subCategory, o.subCategory, true)
9707           && compareDeep(excluded, o.excluded, true) && compareDeep(name, o.name, true) && compareDeep(description, o.description, true)
9708           && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true) && compareDeep(term, o.term, true)
9709           && compareDeep(financial, o.financial, true);
9710      }
9711
9712      @Override
9713      public boolean equalsShallow(Base other_) {
9714        if (!super.equalsShallow(other_))
9715          return false;
9716        if (!(other_ instanceof BenefitBalanceComponent))
9717          return false;
9718        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
9719        return compareValues(excluded, o.excluded, true) && compareValues(name, o.name, true) && compareValues(description, o.description, true)
9720          ;
9721      }
9722
9723      public boolean isEmpty() {
9724        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, subCategory, excluded
9725          , name, description, network, unit, term, financial);
9726      }
9727
9728  public String fhirType() {
9729    return "ExplanationOfBenefit.benefitBalance";
9730
9731  }
9732
9733  }
9734
9735    @Block()
9736    public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
9737        /**
9738         * Deductable, visits, benefit amount.
9739         */
9740        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9741        @Description(shortDefinition="Deductable, visits, benefit amount", formalDefinition="Deductable, visits, benefit amount." )
9742        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-type")
9743        protected CodeableConcept type;
9744
9745        /**
9746         * Benefits allowed.
9747         */
9748        @Child(name = "allowed", type = {UnsignedIntType.class, StringType.class, Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
9749        @Description(shortDefinition="Benefits allowed", formalDefinition="Benefits allowed." )
9750        protected Type allowed;
9751
9752        /**
9753         * Benefits used.
9754         */
9755        @Child(name = "used", type = {UnsignedIntType.class, Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
9756        @Description(shortDefinition="Benefits used", formalDefinition="Benefits used." )
9757        protected Type used;
9758
9759        private static final long serialVersionUID = -1506285314L;
9760
9761    /**
9762     * Constructor
9763     */
9764      public BenefitComponent() {
9765        super();
9766      }
9767
9768    /**
9769     * Constructor
9770     */
9771      public BenefitComponent(CodeableConcept type) {
9772        super();
9773        this.type = type;
9774      }
9775
9776        /**
9777         * @return {@link #type} (Deductable, visits, benefit amount.)
9778         */
9779        public CodeableConcept getType() { 
9780          if (this.type == null)
9781            if (Configuration.errorOnAutoCreate())
9782              throw new Error("Attempt to auto-create BenefitComponent.type");
9783            else if (Configuration.doAutoCreate())
9784              this.type = new CodeableConcept(); // cc
9785          return this.type;
9786        }
9787
9788        public boolean hasType() { 
9789          return this.type != null && !this.type.isEmpty();
9790        }
9791
9792        /**
9793         * @param value {@link #type} (Deductable, visits, benefit amount.)
9794         */
9795        public BenefitComponent setType(CodeableConcept value) { 
9796          this.type = value;
9797          return this;
9798        }
9799
9800        /**
9801         * @return {@link #allowed} (Benefits allowed.)
9802         */
9803        public Type getAllowed() { 
9804          return this.allowed;
9805        }
9806
9807        /**
9808         * @return {@link #allowed} (Benefits allowed.)
9809         */
9810        public UnsignedIntType getAllowedUnsignedIntType() throws FHIRException { 
9811          if (this.allowed == null)
9812            return null;
9813          if (!(this.allowed instanceof UnsignedIntType))
9814            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.allowed.getClass().getName()+" was encountered");
9815          return (UnsignedIntType) this.allowed;
9816        }
9817
9818        public boolean hasAllowedUnsignedIntType() { 
9819          return this != null && this.allowed instanceof UnsignedIntType;
9820        }
9821
9822        /**
9823         * @return {@link #allowed} (Benefits allowed.)
9824         */
9825        public StringType getAllowedStringType() throws FHIRException { 
9826          if (this.allowed == null)
9827            return null;
9828          if (!(this.allowed instanceof StringType))
9829            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.allowed.getClass().getName()+" was encountered");
9830          return (StringType) this.allowed;
9831        }
9832
9833        public boolean hasAllowedStringType() { 
9834          return this != null && this.allowed instanceof StringType;
9835        }
9836
9837        /**
9838         * @return {@link #allowed} (Benefits allowed.)
9839         */
9840        public Money getAllowedMoney() throws FHIRException { 
9841          if (this.allowed == null)
9842            return null;
9843          if (!(this.allowed instanceof Money))
9844            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.allowed.getClass().getName()+" was encountered");
9845          return (Money) this.allowed;
9846        }
9847
9848        public boolean hasAllowedMoney() { 
9849          return this != null && this.allowed instanceof Money;
9850        }
9851
9852        public boolean hasAllowed() { 
9853          return this.allowed != null && !this.allowed.isEmpty();
9854        }
9855
9856        /**
9857         * @param value {@link #allowed} (Benefits allowed.)
9858         */
9859        public BenefitComponent setAllowed(Type value) { 
9860          if (value != null && !(value instanceof UnsignedIntType || value instanceof StringType || value instanceof Money))
9861            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.allowed[x]: "+value.fhirType());
9862          this.allowed = value;
9863          return this;
9864        }
9865
9866        /**
9867         * @return {@link #used} (Benefits used.)
9868         */
9869        public Type getUsed() { 
9870          return this.used;
9871        }
9872
9873        /**
9874         * @return {@link #used} (Benefits used.)
9875         */
9876        public UnsignedIntType getUsedUnsignedIntType() throws FHIRException { 
9877          if (this.used == null)
9878            return null;
9879          if (!(this.used instanceof UnsignedIntType))
9880            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.used.getClass().getName()+" was encountered");
9881          return (UnsignedIntType) this.used;
9882        }
9883
9884        public boolean hasUsedUnsignedIntType() { 
9885          return this != null && this.used instanceof UnsignedIntType;
9886        }
9887
9888        /**
9889         * @return {@link #used} (Benefits used.)
9890         */
9891        public Money getUsedMoney() throws FHIRException { 
9892          if (this.used == null)
9893            return null;
9894          if (!(this.used instanceof Money))
9895            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.used.getClass().getName()+" was encountered");
9896          return (Money) this.used;
9897        }
9898
9899        public boolean hasUsedMoney() { 
9900          return this != null && this.used instanceof Money;
9901        }
9902
9903        public boolean hasUsed() { 
9904          return this.used != null && !this.used.isEmpty();
9905        }
9906
9907        /**
9908         * @param value {@link #used} (Benefits used.)
9909         */
9910        public BenefitComponent setUsed(Type value) { 
9911          if (value != null && !(value instanceof UnsignedIntType || value instanceof Money))
9912            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.used[x]: "+value.fhirType());
9913          this.used = value;
9914          return this;
9915        }
9916
9917        protected void listChildren(List<Property> children) {
9918          super.listChildren(children);
9919          children.add(new Property("type", "CodeableConcept", "Deductable, visits, benefit amount.", 0, 1, type));
9920          children.add(new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed));
9921          children.add(new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used));
9922        }
9923
9924        @Override
9925        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9926          switch (_hash) {
9927          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Deductable, visits, benefit amount.", 0, 1, type);
9928          case -1336663592: /*allowed[x]*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
9929          case -911343192: /*allowed*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
9930          case 1668802034: /*allowedUnsignedInt*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
9931          case -2135265319: /*allowedString*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
9932          case -351668232: /*allowedMoney*/  return new Property("allowed[x]", "unsignedInt|string|Money", "Benefits allowed.", 0, 1, allowed);
9933          case -147553373: /*used[x]*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
9934          case 3599293: /*used*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
9935          case 1252740285: /*usedUnsignedInt*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
9936          case -78048509: /*usedMoney*/  return new Property("used[x]", "unsignedInt|Money", "Benefits used.", 0, 1, used);
9937          default: return super.getNamedProperty(_hash, _name, _checkValid);
9938          }
9939
9940        }
9941
9942      @Override
9943      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9944        switch (hash) {
9945        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
9946        case -911343192: /*allowed*/ return this.allowed == null ? new Base[0] : new Base[] {this.allowed}; // Type
9947        case 3599293: /*used*/ return this.used == null ? new Base[0] : new Base[] {this.used}; // Type
9948        default: return super.getProperty(hash, name, checkValid);
9949        }
9950
9951      }
9952
9953      @Override
9954      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9955        switch (hash) {
9956        case 3575610: // type
9957          this.type = castToCodeableConcept(value); // CodeableConcept
9958          return value;
9959        case -911343192: // allowed
9960          this.allowed = castToType(value); // Type
9961          return value;
9962        case 3599293: // used
9963          this.used = castToType(value); // Type
9964          return value;
9965        default: return super.setProperty(hash, name, value);
9966        }
9967
9968      }
9969
9970      @Override
9971      public Base setProperty(String name, Base value) throws FHIRException {
9972        if (name.equals("type")) {
9973          this.type = castToCodeableConcept(value); // CodeableConcept
9974        } else if (name.equals("allowed[x]")) {
9975          this.allowed = castToType(value); // Type
9976        } else if (name.equals("used[x]")) {
9977          this.used = castToType(value); // Type
9978        } else
9979          return super.setProperty(name, value);
9980        return value;
9981      }
9982
9983      @Override
9984      public Base makeProperty(int hash, String name) throws FHIRException {
9985        switch (hash) {
9986        case 3575610:  return getType(); 
9987        case -1336663592:  return getAllowed(); 
9988        case -911343192:  return getAllowed(); 
9989        case -147553373:  return getUsed(); 
9990        case 3599293:  return getUsed(); 
9991        default: return super.makeProperty(hash, name);
9992        }
9993
9994      }
9995
9996      @Override
9997      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9998        switch (hash) {
9999        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
10000        case -911343192: /*allowed*/ return new String[] {"unsignedInt", "string", "Money"};
10001        case 3599293: /*used*/ return new String[] {"unsignedInt", "Money"};
10002        default: return super.getTypesForProperty(hash, name);
10003        }
10004
10005      }
10006
10007      @Override
10008      public Base addChild(String name) throws FHIRException {
10009        if (name.equals("type")) {
10010          this.type = new CodeableConcept();
10011          return this.type;
10012        }
10013        else if (name.equals("allowedUnsignedInt")) {
10014          this.allowed = new UnsignedIntType();
10015          return this.allowed;
10016        }
10017        else if (name.equals("allowedString")) {
10018          this.allowed = new StringType();
10019          return this.allowed;
10020        }
10021        else if (name.equals("allowedMoney")) {
10022          this.allowed = new Money();
10023          return this.allowed;
10024        }
10025        else if (name.equals("usedUnsignedInt")) {
10026          this.used = new UnsignedIntType();
10027          return this.used;
10028        }
10029        else if (name.equals("usedMoney")) {
10030          this.used = new Money();
10031          return this.used;
10032        }
10033        else
10034          return super.addChild(name);
10035      }
10036
10037      public BenefitComponent copy() {
10038        BenefitComponent dst = new BenefitComponent();
10039        copyValues(dst);
10040        dst.type = type == null ? null : type.copy();
10041        dst.allowed = allowed == null ? null : allowed.copy();
10042        dst.used = used == null ? null : used.copy();
10043        return dst;
10044      }
10045
10046      @Override
10047      public boolean equalsDeep(Base other_) {
10048        if (!super.equalsDeep(other_))
10049          return false;
10050        if (!(other_ instanceof BenefitComponent))
10051          return false;
10052        BenefitComponent o = (BenefitComponent) other_;
10053        return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true) && compareDeep(used, o.used, true)
10054          ;
10055      }
10056
10057      @Override
10058      public boolean equalsShallow(Base other_) {
10059        if (!super.equalsShallow(other_))
10060          return false;
10061        if (!(other_ instanceof BenefitComponent))
10062          return false;
10063        BenefitComponent o = (BenefitComponent) other_;
10064        return true;
10065      }
10066
10067      public boolean isEmpty() {
10068        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed, used);
10069      }
10070
10071  public String fhirType() {
10072    return "ExplanationOfBenefit.benefitBalance.financial";
10073
10074  }
10075
10076  }
10077
10078    /**
10079     * The EOB Business Identifier.
10080     */
10081    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10082    @Description(shortDefinition="Business Identifier", formalDefinition="The EOB Business Identifier." )
10083    protected List<Identifier> identifier;
10084
10085    /**
10086     * The status of the resource instance.
10087     */
10088    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
10089    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
10090    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/explanationofbenefit-status")
10091    protected Enumeration<ExplanationOfBenefitStatus> status;
10092
10093    /**
10094     * The category of claim, eg, oral, pharmacy, vision, insitutional, professional.
10095     */
10096    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
10097    @Description(shortDefinition="Type or discipline", formalDefinition="The category of claim, eg, oral, pharmacy, vision, insitutional, professional." )
10098    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-type")
10099    protected CodeableConcept type;
10100
10101    /**
10102     * A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the BillType.
10103     */
10104    @Child(name = "subType", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10105    @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 BillType." )
10106    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-subtype")
10107    protected List<CodeableConcept> subType;
10108
10109    /**
10110     * Complete (Bill or Claim), Proposed (Pre-Authorization), Exploratory (Pre-determination).
10111     */
10112    @Child(name = "use", type = {CodeType.class}, order=4, min=0, max=1, modifier=false, summary=false)
10113    @Description(shortDefinition="complete | proposed | exploratory | other", formalDefinition="Complete (Bill or Claim), Proposed (Pre-Authorization), Exploratory (Pre-determination)." )
10114    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-use")
10115    protected Enumeration<Use> use;
10116
10117    /**
10118     * Patient Resource.
10119     */
10120    @Child(name = "patient", type = {Patient.class}, order=5, min=0, max=1, modifier=false, summary=false)
10121    @Description(shortDefinition="The subject of the Products and Services", formalDefinition="Patient Resource." )
10122    protected Reference patient;
10123
10124    /**
10125     * The actual object that is the target of the reference (Patient Resource.)
10126     */
10127    protected Patient patientTarget;
10128
10129    /**
10130     * The billable period for which charges are being submitted.
10131     */
10132    @Child(name = "billablePeriod", type = {Period.class}, order=6, min=0, max=1, modifier=false, summary=false)
10133    @Description(shortDefinition="Period for charge submission", formalDefinition="The billable period for which charges are being submitted." )
10134    protected Period billablePeriod;
10135
10136    /**
10137     * The date when the EOB was created.
10138     */
10139    @Child(name = "created", type = {DateTimeType.class}, order=7, min=0, max=1, modifier=false, summary=false)
10140    @Description(shortDefinition="Creation date", formalDefinition="The date when the EOB was created." )
10141    protected DateTimeType created;
10142
10143    /**
10144     * The person who created the explanation of benefit.
10145     */
10146    @Child(name = "enterer", type = {Practitioner.class, PractitionerRole.class}, order=8, min=0, max=1, modifier=false, summary=false)
10147    @Description(shortDefinition="Author", formalDefinition="The person who created the explanation of benefit." )
10148    protected Reference enterer;
10149
10150    /**
10151     * The actual object that is the target of the reference (The person who created the explanation of benefit.)
10152     */
10153    protected Resource entererTarget;
10154
10155    /**
10156     * The insurer which is responsible for the explanation of benefit.
10157     */
10158    @Child(name = "insurer", type = {Organization.class}, order=9, min=0, max=1, modifier=false, summary=false)
10159    @Description(shortDefinition="Insurer responsible for the EOB", formalDefinition="The insurer which is responsible for the explanation of benefit." )
10160    protected Reference insurer;
10161
10162    /**
10163     * The actual object that is the target of the reference (The insurer which is responsible for the explanation of benefit.)
10164     */
10165    protected Organization insurerTarget;
10166
10167    /**
10168     * The provider which is responsible for the claim.
10169     */
10170    @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=10, min=0, max=1, modifier=false, summary=false)
10171    @Description(shortDefinition="Responsible provider for the claim", formalDefinition="The provider which is responsible for the claim." )
10172    protected Reference provider;
10173
10174    /**
10175     * The actual object that is the target of the reference (The provider which is responsible for the claim.)
10176     */
10177    protected Resource providerTarget;
10178
10179    /**
10180     * The referral resource which lists the date, practitioner, reason and other supporting information.
10181     */
10182    @Child(name = "referral", type = {ServiceRequest.class}, order=11, min=0, max=1, modifier=false, summary=false)
10183    @Description(shortDefinition="Treatment Referral", formalDefinition="The referral resource which lists the date, practitioner, reason and other supporting information." )
10184    protected Reference referral;
10185
10186    /**
10187     * The actual object that is the target of the reference (The referral resource which lists the date, practitioner, reason and other supporting information.)
10188     */
10189    protected ServiceRequest referralTarget;
10190
10191    /**
10192     * Facility where the services were provided.
10193     */
10194    @Child(name = "facility", type = {Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
10195    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
10196    protected Reference facility;
10197
10198    /**
10199     * The actual object that is the target of the reference (Facility where the services were provided.)
10200     */
10201    protected Location facilityTarget;
10202
10203    /**
10204     * The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.
10205     */
10206    @Child(name = "claim", type = {Claim.class}, order=13, min=0, max=1, modifier=false, summary=false)
10207    @Description(shortDefinition="Claim reference", formalDefinition="The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number." )
10208    protected Reference claim;
10209
10210    /**
10211     * 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.)
10212     */
10213    protected Claim claimTarget;
10214
10215    /**
10216     * The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.
10217     */
10218    @Child(name = "claimResponse", type = {ClaimResponse.class}, order=14, min=0, max=1, modifier=false, summary=false)
10219    @Description(shortDefinition="Claim response reference", formalDefinition="The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number." )
10220    protected Reference claimResponse;
10221
10222    /**
10223     * 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.)
10224     */
10225    protected ClaimResponse claimResponseTarget;
10226
10227    /**
10228     * Processing outcome errror, partial or complete processing.
10229     */
10230    @Child(name = "outcome", type = {CodeType.class}, order=15, min=0, max=1, modifier=false, summary=false)
10231    @Description(shortDefinition="queued | complete | error | partial", formalDefinition="Processing outcome errror, partial or complete processing." )
10232    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/remittance-outcome")
10233    protected Enumeration<RemittanceOutcome> outcome;
10234
10235    /**
10236     * A description of the status of the adjudication.
10237     */
10238    @Child(name = "disposition", type = {StringType.class}, order=16, min=0, max=1, modifier=false, summary=false)
10239    @Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication." )
10240    protected StringType disposition;
10241
10242    /**
10243     * Other claims which are related to this claim such as prior claim versions or for related services.
10244     */
10245    @Child(name = "related", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10246    @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." )
10247    protected List<RelatedClaimComponent> related;
10248
10249    /**
10250     * Prescription to support the dispensing of Pharmacy or Vision products.
10251     */
10252    @Child(name = "prescription", type = {MedicationRequest.class, VisionPrescription.class}, order=18, min=0, max=1, modifier=false, summary=false)
10253    @Description(shortDefinition="Prescription authorizing services or products", formalDefinition="Prescription to support the dispensing of Pharmacy or Vision products." )
10254    protected Reference prescription;
10255
10256    /**
10257     * The actual object that is the target of the reference (Prescription to support the dispensing of Pharmacy or Vision products.)
10258     */
10259    protected Resource prescriptionTarget;
10260
10261    /**
10262     * 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'.
10263     */
10264    @Child(name = "originalPrescription", type = {MedicationRequest.class}, order=19, min=0, max=1, modifier=false, summary=false)
10265    @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'." )
10266    protected Reference originalPrescription;
10267
10268    /**
10269     * 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'.)
10270     */
10271    protected MedicationRequest originalPrescriptionTarget;
10272
10273    /**
10274     * The party to be reimbursed for the services.
10275     */
10276    @Child(name = "payee", type = {}, order=20, min=0, max=1, modifier=false, summary=false)
10277    @Description(shortDefinition="Party to be paid any benefits payable", formalDefinition="The party to be reimbursed for the services." )
10278    protected PayeeComponent payee;
10279
10280    /**
10281     * Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required.
10282     */
10283    @Child(name = "information", type = {}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10284    @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." )
10285    protected List<SupportingInformationComponent> information;
10286
10287    /**
10288     * The members of the team who provided the overall service as well as their role and whether responsible and qualifications.
10289     */
10290    @Child(name = "careTeam", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10291    @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." )
10292    protected List<CareTeamComponent> careTeam;
10293
10294    /**
10295     * Ordered list of patient diagnosis for which care is sought.
10296     */
10297    @Child(name = "diagnosis", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10298    @Description(shortDefinition="List of Diagnosis", formalDefinition="Ordered list of patient diagnosis for which care is sought." )
10299    protected List<DiagnosisComponent> diagnosis;
10300
10301    /**
10302     * Ordered list of patient procedures performed to support the adjudication.
10303     */
10304    @Child(name = "procedure", type = {}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10305    @Description(shortDefinition="Procedures performed", formalDefinition="Ordered list of patient procedures performed to support the adjudication." )
10306    protected List<ProcedureComponent> procedure;
10307
10308    /**
10309     * Precedence (primary, secondary, etc.).
10310     */
10311    @Child(name = "precedence", type = {PositiveIntType.class}, order=25, min=0, max=1, modifier=false, summary=false)
10312    @Description(shortDefinition="Precedence (primary, secondary, etc.)", formalDefinition="Precedence (primary, secondary, etc.)." )
10313    protected PositiveIntType precedence;
10314
10315    /**
10316     * Financial instrument by which payment information for health care.
10317     */
10318    @Child(name = "insurance", type = {}, order=26, min=0, max=1, modifier=false, summary=false)
10319    @Description(shortDefinition="Insurance or medical plan", formalDefinition="Financial instrument by which payment information for health care." )
10320    protected InsuranceComponent insurance;
10321
10322    /**
10323     * An accident which resulted in the need for healthcare services.
10324     */
10325    @Child(name = "accident", type = {}, order=27, min=0, max=1, modifier=false, summary=false)
10326    @Description(shortDefinition="Details of an accident", formalDefinition="An accident which resulted in the need for healthcare services." )
10327    protected AccidentComponent accident;
10328
10329    /**
10330     * First tier of goods and services.
10331     */
10332    @Child(name = "item", type = {}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10333    @Description(shortDefinition="Goods and Services", formalDefinition="First tier of goods and services." )
10334    protected List<ItemComponent> item;
10335
10336    /**
10337     * The first tier service adjudications for payor added services.
10338     */
10339    @Child(name = "addItem", type = {}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10340    @Description(shortDefinition="Insurer added line items", formalDefinition="The first tier service adjudications for payor added services." )
10341    protected List<AddedItemComponent> addItem;
10342
10343    /**
10344     * Totals for amounts submitted, co-pays, benefits payable etc.
10345     */
10346    @Child(name = "total", type = {}, order=30, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10347    @Description(shortDefinition="Adjudication totals", formalDefinition="Totals for amounts submitted, co-pays, benefits payable etc." )
10348    protected List<TotalComponent> total;
10349
10350    /**
10351     * Payment details for the claim if the claim has been paid.
10352     */
10353    @Child(name = "payment", type = {}, order=31, min=0, max=1, modifier=false, summary=false)
10354    @Description(shortDefinition="Payment (if paid)", formalDefinition="Payment details for the claim if the claim has been paid." )
10355    protected PaymentComponent payment;
10356
10357    /**
10358     * The form to be used for printing the content.
10359     */
10360    @Child(name = "form", type = {CodeableConcept.class}, order=32, min=0, max=1, modifier=false, summary=false)
10361    @Description(shortDefinition="Printed Form Identifier", formalDefinition="The form to be used for printing the content." )
10362    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/forms")
10363    protected CodeableConcept form;
10364
10365    /**
10366     * Note text.
10367     */
10368    @Child(name = "processNote", type = {}, order=33, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10369    @Description(shortDefinition="Processing notes", formalDefinition="Note text." )
10370    protected List<NoteComponent> processNote;
10371
10372    /**
10373     * Balance by Benefit Category.
10374     */
10375    @Child(name = "benefitBalance", type = {}, order=34, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
10376    @Description(shortDefinition="Balance by Benefit Category", formalDefinition="Balance by Benefit Category." )
10377    protected List<BenefitBalanceComponent> benefitBalance;
10378
10379    private static final long serialVersionUID = -300533824L;
10380
10381  /**
10382   * Constructor
10383   */
10384    public ExplanationOfBenefit() {
10385      super();
10386    }
10387
10388    /**
10389     * @return {@link #identifier} (The EOB Business Identifier.)
10390     */
10391    public List<Identifier> getIdentifier() { 
10392      if (this.identifier == null)
10393        this.identifier = new ArrayList<Identifier>();
10394      return this.identifier;
10395    }
10396
10397    /**
10398     * @return Returns a reference to <code>this</code> for easy method chaining
10399     */
10400    public ExplanationOfBenefit setIdentifier(List<Identifier> theIdentifier) { 
10401      this.identifier = theIdentifier;
10402      return this;
10403    }
10404
10405    public boolean hasIdentifier() { 
10406      if (this.identifier == null)
10407        return false;
10408      for (Identifier item : this.identifier)
10409        if (!item.isEmpty())
10410          return true;
10411      return false;
10412    }
10413
10414    public Identifier addIdentifier() { //3
10415      Identifier t = new Identifier();
10416      if (this.identifier == null)
10417        this.identifier = new ArrayList<Identifier>();
10418      this.identifier.add(t);
10419      return t;
10420    }
10421
10422    public ExplanationOfBenefit addIdentifier(Identifier t) { //3
10423      if (t == null)
10424        return this;
10425      if (this.identifier == null)
10426        this.identifier = new ArrayList<Identifier>();
10427      this.identifier.add(t);
10428      return this;
10429    }
10430
10431    /**
10432     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
10433     */
10434    public Identifier getIdentifierFirstRep() { 
10435      if (getIdentifier().isEmpty()) {
10436        addIdentifier();
10437      }
10438      return getIdentifier().get(0);
10439    }
10440
10441    /**
10442     * @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
10443     */
10444    public Enumeration<ExplanationOfBenefitStatus> getStatusElement() { 
10445      if (this.status == null)
10446        if (Configuration.errorOnAutoCreate())
10447          throw new Error("Attempt to auto-create ExplanationOfBenefit.status");
10448        else if (Configuration.doAutoCreate())
10449          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory()); // bb
10450      return this.status;
10451    }
10452
10453    public boolean hasStatusElement() { 
10454      return this.status != null && !this.status.isEmpty();
10455    }
10456
10457    public boolean hasStatus() { 
10458      return this.status != null && !this.status.isEmpty();
10459    }
10460
10461    /**
10462     * @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
10463     */
10464    public ExplanationOfBenefit setStatusElement(Enumeration<ExplanationOfBenefitStatus> value) { 
10465      this.status = value;
10466      return this;
10467    }
10468
10469    /**
10470     * @return The status of the resource instance.
10471     */
10472    public ExplanationOfBenefitStatus getStatus() { 
10473      return this.status == null ? null : this.status.getValue();
10474    }
10475
10476    /**
10477     * @param value The status of the resource instance.
10478     */
10479    public ExplanationOfBenefit setStatus(ExplanationOfBenefitStatus value) { 
10480      if (value == null)
10481        this.status = null;
10482      else {
10483        if (this.status == null)
10484          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory());
10485        this.status.setValue(value);
10486      }
10487      return this;
10488    }
10489
10490    /**
10491     * @return {@link #type} (The category of claim, eg, oral, pharmacy, vision, insitutional, professional.)
10492     */
10493    public CodeableConcept getType() { 
10494      if (this.type == null)
10495        if (Configuration.errorOnAutoCreate())
10496          throw new Error("Attempt to auto-create ExplanationOfBenefit.type");
10497        else if (Configuration.doAutoCreate())
10498          this.type = new CodeableConcept(); // cc
10499      return this.type;
10500    }
10501
10502    public boolean hasType() { 
10503      return this.type != null && !this.type.isEmpty();
10504    }
10505
10506    /**
10507     * @param value {@link #type} (The category of claim, eg, oral, pharmacy, vision, insitutional, professional.)
10508     */
10509    public ExplanationOfBenefit setType(CodeableConcept value) { 
10510      this.type = value;
10511      return this;
10512    }
10513
10514    /**
10515     * @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 BillType.)
10516     */
10517    public List<CodeableConcept> getSubType() { 
10518      if (this.subType == null)
10519        this.subType = new ArrayList<CodeableConcept>();
10520      return this.subType;
10521    }
10522
10523    /**
10524     * @return Returns a reference to <code>this</code> for easy method chaining
10525     */
10526    public ExplanationOfBenefit setSubType(List<CodeableConcept> theSubType) { 
10527      this.subType = theSubType;
10528      return this;
10529    }
10530
10531    public boolean hasSubType() { 
10532      if (this.subType == null)
10533        return false;
10534      for (CodeableConcept item : this.subType)
10535        if (!item.isEmpty())
10536          return true;
10537      return false;
10538    }
10539
10540    public CodeableConcept addSubType() { //3
10541      CodeableConcept t = new CodeableConcept();
10542      if (this.subType == null)
10543        this.subType = new ArrayList<CodeableConcept>();
10544      this.subType.add(t);
10545      return t;
10546    }
10547
10548    public ExplanationOfBenefit addSubType(CodeableConcept t) { //3
10549      if (t == null)
10550        return this;
10551      if (this.subType == null)
10552        this.subType = new ArrayList<CodeableConcept>();
10553      this.subType.add(t);
10554      return this;
10555    }
10556
10557    /**
10558     * @return The first repetition of repeating field {@link #subType}, creating it if it does not already exist
10559     */
10560    public CodeableConcept getSubTypeFirstRep() { 
10561      if (getSubType().isEmpty()) {
10562        addSubType();
10563      }
10564      return getSubType().get(0);
10565    }
10566
10567    /**
10568     * @return {@link #use} (Complete (Bill or Claim), Proposed (Pre-Authorization), Exploratory (Pre-determination).). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
10569     */
10570    public Enumeration<Use> getUseElement() { 
10571      if (this.use == null)
10572        if (Configuration.errorOnAutoCreate())
10573          throw new Error("Attempt to auto-create ExplanationOfBenefit.use");
10574        else if (Configuration.doAutoCreate())
10575          this.use = new Enumeration<Use>(new UseEnumFactory()); // bb
10576      return this.use;
10577    }
10578
10579    public boolean hasUseElement() { 
10580      return this.use != null && !this.use.isEmpty();
10581    }
10582
10583    public boolean hasUse() { 
10584      return this.use != null && !this.use.isEmpty();
10585    }
10586
10587    /**
10588     * @param value {@link #use} (Complete (Bill or Claim), Proposed (Pre-Authorization), Exploratory (Pre-determination).). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
10589     */
10590    public ExplanationOfBenefit setUseElement(Enumeration<Use> value) { 
10591      this.use = value;
10592      return this;
10593    }
10594
10595    /**
10596     * @return Complete (Bill or Claim), Proposed (Pre-Authorization), Exploratory (Pre-determination).
10597     */
10598    public Use getUse() { 
10599      return this.use == null ? null : this.use.getValue();
10600    }
10601
10602    /**
10603     * @param value Complete (Bill or Claim), Proposed (Pre-Authorization), Exploratory (Pre-determination).
10604     */
10605    public ExplanationOfBenefit setUse(Use value) { 
10606      if (value == null)
10607        this.use = null;
10608      else {
10609        if (this.use == null)
10610          this.use = new Enumeration<Use>(new UseEnumFactory());
10611        this.use.setValue(value);
10612      }
10613      return this;
10614    }
10615
10616    /**
10617     * @return {@link #patient} (Patient Resource.)
10618     */
10619    public Reference getPatient() { 
10620      if (this.patient == null)
10621        if (Configuration.errorOnAutoCreate())
10622          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
10623        else if (Configuration.doAutoCreate())
10624          this.patient = new Reference(); // cc
10625      return this.patient;
10626    }
10627
10628    public boolean hasPatient() { 
10629      return this.patient != null && !this.patient.isEmpty();
10630    }
10631
10632    /**
10633     * @param value {@link #patient} (Patient Resource.)
10634     */
10635    public ExplanationOfBenefit setPatient(Reference value) { 
10636      this.patient = value;
10637      return this;
10638    }
10639
10640    /**
10641     * @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.)
10642     */
10643    public Patient getPatientTarget() { 
10644      if (this.patientTarget == null)
10645        if (Configuration.errorOnAutoCreate())
10646          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
10647        else if (Configuration.doAutoCreate())
10648          this.patientTarget = new Patient(); // aa
10649      return this.patientTarget;
10650    }
10651
10652    /**
10653     * @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.)
10654     */
10655    public ExplanationOfBenefit setPatientTarget(Patient value) { 
10656      this.patientTarget = value;
10657      return this;
10658    }
10659
10660    /**
10661     * @return {@link #billablePeriod} (The billable period for which charges are being submitted.)
10662     */
10663    public Period getBillablePeriod() { 
10664      if (this.billablePeriod == null)
10665        if (Configuration.errorOnAutoCreate())
10666          throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
10667        else if (Configuration.doAutoCreate())
10668          this.billablePeriod = new Period(); // cc
10669      return this.billablePeriod;
10670    }
10671
10672    public boolean hasBillablePeriod() { 
10673      return this.billablePeriod != null && !this.billablePeriod.isEmpty();
10674    }
10675
10676    /**
10677     * @param value {@link #billablePeriod} (The billable period for which charges are being submitted.)
10678     */
10679    public ExplanationOfBenefit setBillablePeriod(Period value) { 
10680      this.billablePeriod = value;
10681      return this;
10682    }
10683
10684    /**
10685     * @return {@link #created} (The date when the EOB was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
10686     */
10687    public DateTimeType getCreatedElement() { 
10688      if (this.created == null)
10689        if (Configuration.errorOnAutoCreate())
10690          throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
10691        else if (Configuration.doAutoCreate())
10692          this.created = new DateTimeType(); // bb
10693      return this.created;
10694    }
10695
10696    public boolean hasCreatedElement() { 
10697      return this.created != null && !this.created.isEmpty();
10698    }
10699
10700    public boolean hasCreated() { 
10701      return this.created != null && !this.created.isEmpty();
10702    }
10703
10704    /**
10705     * @param value {@link #created} (The date when the EOB was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
10706     */
10707    public ExplanationOfBenefit setCreatedElement(DateTimeType value) { 
10708      this.created = value;
10709      return this;
10710    }
10711
10712    /**
10713     * @return The date when the EOB was created.
10714     */
10715    public Date getCreated() { 
10716      return this.created == null ? null : this.created.getValue();
10717    }
10718
10719    /**
10720     * @param value The date when the EOB was created.
10721     */
10722    public ExplanationOfBenefit setCreated(Date value) { 
10723      if (value == null)
10724        this.created = null;
10725      else {
10726        if (this.created == null)
10727          this.created = new DateTimeType();
10728        this.created.setValue(value);
10729      }
10730      return this;
10731    }
10732
10733    /**
10734     * @return {@link #enterer} (The person who created the explanation of benefit.)
10735     */
10736    public Reference getEnterer() { 
10737      if (this.enterer == null)
10738        if (Configuration.errorOnAutoCreate())
10739          throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
10740        else if (Configuration.doAutoCreate())
10741          this.enterer = new Reference(); // cc
10742      return this.enterer;
10743    }
10744
10745    public boolean hasEnterer() { 
10746      return this.enterer != null && !this.enterer.isEmpty();
10747    }
10748
10749    /**
10750     * @param value {@link #enterer} (The person who created the explanation of benefit.)
10751     */
10752    public ExplanationOfBenefit setEnterer(Reference value) { 
10753      this.enterer = value;
10754      return this;
10755    }
10756
10757    /**
10758     * @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.)
10759     */
10760    public Resource getEntererTarget() { 
10761      return this.entererTarget;
10762    }
10763
10764    /**
10765     * @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.)
10766     */
10767    public ExplanationOfBenefit setEntererTarget(Resource value) { 
10768      this.entererTarget = value;
10769      return this;
10770    }
10771
10772    /**
10773     * @return {@link #insurer} (The insurer which is responsible for the explanation of benefit.)
10774     */
10775    public Reference getInsurer() { 
10776      if (this.insurer == null)
10777        if (Configuration.errorOnAutoCreate())
10778          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
10779        else if (Configuration.doAutoCreate())
10780          this.insurer = new Reference(); // cc
10781      return this.insurer;
10782    }
10783
10784    public boolean hasInsurer() { 
10785      return this.insurer != null && !this.insurer.isEmpty();
10786    }
10787
10788    /**
10789     * @param value {@link #insurer} (The insurer which is responsible for the explanation of benefit.)
10790     */
10791    public ExplanationOfBenefit setInsurer(Reference value) { 
10792      this.insurer = value;
10793      return this;
10794    }
10795
10796    /**
10797     * @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.)
10798     */
10799    public Organization getInsurerTarget() { 
10800      if (this.insurerTarget == null)
10801        if (Configuration.errorOnAutoCreate())
10802          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
10803        else if (Configuration.doAutoCreate())
10804          this.insurerTarget = new Organization(); // aa
10805      return this.insurerTarget;
10806    }
10807
10808    /**
10809     * @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.)
10810     */
10811    public ExplanationOfBenefit setInsurerTarget(Organization value) { 
10812      this.insurerTarget = value;
10813      return this;
10814    }
10815
10816    /**
10817     * @return {@link #provider} (The provider which is responsible for the claim.)
10818     */
10819    public Reference getProvider() { 
10820      if (this.provider == null)
10821        if (Configuration.errorOnAutoCreate())
10822          throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
10823        else if (Configuration.doAutoCreate())
10824          this.provider = new Reference(); // cc
10825      return this.provider;
10826    }
10827
10828    public boolean hasProvider() { 
10829      return this.provider != null && !this.provider.isEmpty();
10830    }
10831
10832    /**
10833     * @param value {@link #provider} (The provider which is responsible for the claim.)
10834     */
10835    public ExplanationOfBenefit setProvider(Reference value) { 
10836      this.provider = value;
10837      return this;
10838    }
10839
10840    /**
10841     * @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.)
10842     */
10843    public Resource getProviderTarget() { 
10844      return this.providerTarget;
10845    }
10846
10847    /**
10848     * @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.)
10849     */
10850    public ExplanationOfBenefit setProviderTarget(Resource value) { 
10851      this.providerTarget = value;
10852      return this;
10853    }
10854
10855    /**
10856     * @return {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
10857     */
10858    public Reference getReferral() { 
10859      if (this.referral == null)
10860        if (Configuration.errorOnAutoCreate())
10861          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
10862        else if (Configuration.doAutoCreate())
10863          this.referral = new Reference(); // cc
10864      return this.referral;
10865    }
10866
10867    public boolean hasReferral() { 
10868      return this.referral != null && !this.referral.isEmpty();
10869    }
10870
10871    /**
10872     * @param value {@link #referral} (The referral resource which lists the date, practitioner, reason and other supporting information.)
10873     */
10874    public ExplanationOfBenefit setReferral(Reference value) { 
10875      this.referral = value;
10876      return this;
10877    }
10878
10879    /**
10880     * @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.)
10881     */
10882    public ServiceRequest getReferralTarget() { 
10883      if (this.referralTarget == null)
10884        if (Configuration.errorOnAutoCreate())
10885          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
10886        else if (Configuration.doAutoCreate())
10887          this.referralTarget = new ServiceRequest(); // aa
10888      return this.referralTarget;
10889    }
10890
10891    /**
10892     * @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.)
10893     */
10894    public ExplanationOfBenefit setReferralTarget(ServiceRequest value) { 
10895      this.referralTarget = value;
10896      return this;
10897    }
10898
10899    /**
10900     * @return {@link #facility} (Facility where the services were provided.)
10901     */
10902    public Reference getFacility() { 
10903      if (this.facility == null)
10904        if (Configuration.errorOnAutoCreate())
10905          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
10906        else if (Configuration.doAutoCreate())
10907          this.facility = new Reference(); // cc
10908      return this.facility;
10909    }
10910
10911    public boolean hasFacility() { 
10912      return this.facility != null && !this.facility.isEmpty();
10913    }
10914
10915    /**
10916     * @param value {@link #facility} (Facility where the services were provided.)
10917     */
10918    public ExplanationOfBenefit setFacility(Reference value) { 
10919      this.facility = value;
10920      return this;
10921    }
10922
10923    /**
10924     * @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.)
10925     */
10926    public Location getFacilityTarget() { 
10927      if (this.facilityTarget == null)
10928        if (Configuration.errorOnAutoCreate())
10929          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
10930        else if (Configuration.doAutoCreate())
10931          this.facilityTarget = new Location(); // aa
10932      return this.facilityTarget;
10933    }
10934
10935    /**
10936     * @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.)
10937     */
10938    public ExplanationOfBenefit setFacilityTarget(Location value) { 
10939      this.facilityTarget = value;
10940      return this;
10941    }
10942
10943    /**
10944     * @return {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
10945     */
10946    public Reference getClaim() { 
10947      if (this.claim == null)
10948        if (Configuration.errorOnAutoCreate())
10949          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
10950        else if (Configuration.doAutoCreate())
10951          this.claim = new Reference(); // cc
10952      return this.claim;
10953    }
10954
10955    public boolean hasClaim() { 
10956      return this.claim != null && !this.claim.isEmpty();
10957    }
10958
10959    /**
10960     * @param value {@link #claim} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
10961     */
10962    public ExplanationOfBenefit setClaim(Reference value) { 
10963      this.claim = value;
10964      return this;
10965    }
10966
10967    /**
10968     * @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.)
10969     */
10970    public Claim getClaimTarget() { 
10971      if (this.claimTarget == null)
10972        if (Configuration.errorOnAutoCreate())
10973          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
10974        else if (Configuration.doAutoCreate())
10975          this.claimTarget = new Claim(); // aa
10976      return this.claimTarget;
10977    }
10978
10979    /**
10980     * @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.)
10981     */
10982    public ExplanationOfBenefit setClaimTarget(Claim value) { 
10983      this.claimTarget = value;
10984      return this;
10985    }
10986
10987    /**
10988     * @return {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
10989     */
10990    public Reference getClaimResponse() { 
10991      if (this.claimResponse == null)
10992        if (Configuration.errorOnAutoCreate())
10993          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
10994        else if (Configuration.doAutoCreate())
10995          this.claimResponse = new Reference(); // cc
10996      return this.claimResponse;
10997    }
10998
10999    public boolean hasClaimResponse() { 
11000      return this.claimResponse != null && !this.claimResponse.isEmpty();
11001    }
11002
11003    /**
11004     * @param value {@link #claimResponse} (The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.)
11005     */
11006    public ExplanationOfBenefit setClaimResponse(Reference value) { 
11007      this.claimResponse = value;
11008      return this;
11009    }
11010
11011    /**
11012     * @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.)
11013     */
11014    public ClaimResponse getClaimResponseTarget() { 
11015      if (this.claimResponseTarget == null)
11016        if (Configuration.errorOnAutoCreate())
11017          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
11018        else if (Configuration.doAutoCreate())
11019          this.claimResponseTarget = new ClaimResponse(); // aa
11020      return this.claimResponseTarget;
11021    }
11022
11023    /**
11024     * @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.)
11025     */
11026    public ExplanationOfBenefit setClaimResponseTarget(ClaimResponse value) { 
11027      this.claimResponseTarget = value;
11028      return this;
11029    }
11030
11031    /**
11032     * @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
11033     */
11034    public Enumeration<RemittanceOutcome> getOutcomeElement() { 
11035      if (this.outcome == null)
11036        if (Configuration.errorOnAutoCreate())
11037          throw new Error("Attempt to auto-create ExplanationOfBenefit.outcome");
11038        else if (Configuration.doAutoCreate())
11039          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory()); // bb
11040      return this.outcome;
11041    }
11042
11043    public boolean hasOutcomeElement() { 
11044      return this.outcome != null && !this.outcome.isEmpty();
11045    }
11046
11047    public boolean hasOutcome() { 
11048      return this.outcome != null && !this.outcome.isEmpty();
11049    }
11050
11051    /**
11052     * @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
11053     */
11054    public ExplanationOfBenefit setOutcomeElement(Enumeration<RemittanceOutcome> value) { 
11055      this.outcome = value;
11056      return this;
11057    }
11058
11059    /**
11060     * @return Processing outcome errror, partial or complete processing.
11061     */
11062    public RemittanceOutcome getOutcome() { 
11063      return this.outcome == null ? null : this.outcome.getValue();
11064    }
11065
11066    /**
11067     * @param value Processing outcome errror, partial or complete processing.
11068     */
11069    public ExplanationOfBenefit setOutcome(RemittanceOutcome value) { 
11070      if (value == null)
11071        this.outcome = null;
11072      else {
11073        if (this.outcome == null)
11074          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory());
11075        this.outcome.setValue(value);
11076      }
11077      return this;
11078    }
11079
11080    /**
11081     * @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
11082     */
11083    public StringType getDispositionElement() { 
11084      if (this.disposition == null)
11085        if (Configuration.errorOnAutoCreate())
11086          throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
11087        else if (Configuration.doAutoCreate())
11088          this.disposition = new StringType(); // bb
11089      return this.disposition;
11090    }
11091
11092    public boolean hasDispositionElement() { 
11093      return this.disposition != null && !this.disposition.isEmpty();
11094    }
11095
11096    public boolean hasDisposition() { 
11097      return this.disposition != null && !this.disposition.isEmpty();
11098    }
11099
11100    /**
11101     * @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
11102     */
11103    public ExplanationOfBenefit setDispositionElement(StringType value) { 
11104      this.disposition = value;
11105      return this;
11106    }
11107
11108    /**
11109     * @return A description of the status of the adjudication.
11110     */
11111    public String getDisposition() { 
11112      return this.disposition == null ? null : this.disposition.getValue();
11113    }
11114
11115    /**
11116     * @param value A description of the status of the adjudication.
11117     */
11118    public ExplanationOfBenefit setDisposition(String value) { 
11119      if (Utilities.noString(value))
11120        this.disposition = null;
11121      else {
11122        if (this.disposition == null)
11123          this.disposition = new StringType();
11124        this.disposition.setValue(value);
11125      }
11126      return this;
11127    }
11128
11129    /**
11130     * @return {@link #related} (Other claims which are related to this claim such as prior claim versions or for related services.)
11131     */
11132    public List<RelatedClaimComponent> getRelated() { 
11133      if (this.related == null)
11134        this.related = new ArrayList<RelatedClaimComponent>();
11135      return this.related;
11136    }
11137
11138    /**
11139     * @return Returns a reference to <code>this</code> for easy method chaining
11140     */
11141    public ExplanationOfBenefit setRelated(List<RelatedClaimComponent> theRelated) { 
11142      this.related = theRelated;
11143      return this;
11144    }
11145
11146    public boolean hasRelated() { 
11147      if (this.related == null)
11148        return false;
11149      for (RelatedClaimComponent item : this.related)
11150        if (!item.isEmpty())
11151          return true;
11152      return false;
11153    }
11154
11155    public RelatedClaimComponent addRelated() { //3
11156      RelatedClaimComponent t = new RelatedClaimComponent();
11157      if (this.related == null)
11158        this.related = new ArrayList<RelatedClaimComponent>();
11159      this.related.add(t);
11160      return t;
11161    }
11162
11163    public ExplanationOfBenefit addRelated(RelatedClaimComponent t) { //3
11164      if (t == null)
11165        return this;
11166      if (this.related == null)
11167        this.related = new ArrayList<RelatedClaimComponent>();
11168      this.related.add(t);
11169      return this;
11170    }
11171
11172    /**
11173     * @return The first repetition of repeating field {@link #related}, creating it if it does not already exist
11174     */
11175    public RelatedClaimComponent getRelatedFirstRep() { 
11176      if (getRelated().isEmpty()) {
11177        addRelated();
11178      }
11179      return getRelated().get(0);
11180    }
11181
11182    /**
11183     * @return {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
11184     */
11185    public Reference getPrescription() { 
11186      if (this.prescription == null)
11187        if (Configuration.errorOnAutoCreate())
11188          throw new Error("Attempt to auto-create ExplanationOfBenefit.prescription");
11189        else if (Configuration.doAutoCreate())
11190          this.prescription = new Reference(); // cc
11191      return this.prescription;
11192    }
11193
11194    public boolean hasPrescription() { 
11195      return this.prescription != null && !this.prescription.isEmpty();
11196    }
11197
11198    /**
11199     * @param value {@link #prescription} (Prescription to support the dispensing of Pharmacy or Vision products.)
11200     */
11201    public ExplanationOfBenefit setPrescription(Reference value) { 
11202      this.prescription = value;
11203      return this;
11204    }
11205
11206    /**
11207     * @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.)
11208     */
11209    public Resource getPrescriptionTarget() { 
11210      return this.prescriptionTarget;
11211    }
11212
11213    /**
11214     * @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.)
11215     */
11216    public ExplanationOfBenefit setPrescriptionTarget(Resource value) { 
11217      this.prescriptionTarget = value;
11218      return this;
11219    }
11220
11221    /**
11222     * @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'.)
11223     */
11224    public Reference getOriginalPrescription() { 
11225      if (this.originalPrescription == null)
11226        if (Configuration.errorOnAutoCreate())
11227          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
11228        else if (Configuration.doAutoCreate())
11229          this.originalPrescription = new Reference(); // cc
11230      return this.originalPrescription;
11231    }
11232
11233    public boolean hasOriginalPrescription() { 
11234      return this.originalPrescription != null && !this.originalPrescription.isEmpty();
11235    }
11236
11237    /**
11238     * @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'.)
11239     */
11240    public ExplanationOfBenefit setOriginalPrescription(Reference value) { 
11241      this.originalPrescription = value;
11242      return this;
11243    }
11244
11245    /**
11246     * @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'.)
11247     */
11248    public MedicationRequest getOriginalPrescriptionTarget() { 
11249      if (this.originalPrescriptionTarget == null)
11250        if (Configuration.errorOnAutoCreate())
11251          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
11252        else if (Configuration.doAutoCreate())
11253          this.originalPrescriptionTarget = new MedicationRequest(); // aa
11254      return this.originalPrescriptionTarget;
11255    }
11256
11257    /**
11258     * @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'.)
11259     */
11260    public ExplanationOfBenefit setOriginalPrescriptionTarget(MedicationRequest value) { 
11261      this.originalPrescriptionTarget = value;
11262      return this;
11263    }
11264
11265    /**
11266     * @return {@link #payee} (The party to be reimbursed for the services.)
11267     */
11268    public PayeeComponent getPayee() { 
11269      if (this.payee == null)
11270        if (Configuration.errorOnAutoCreate())
11271          throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
11272        else if (Configuration.doAutoCreate())
11273          this.payee = new PayeeComponent(); // cc
11274      return this.payee;
11275    }
11276
11277    public boolean hasPayee() { 
11278      return this.payee != null && !this.payee.isEmpty();
11279    }
11280
11281    /**
11282     * @param value {@link #payee} (The party to be reimbursed for the services.)
11283     */
11284    public ExplanationOfBenefit setPayee(PayeeComponent value) { 
11285      this.payee = value;
11286      return this;
11287    }
11288
11289    /**
11290     * @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.)
11291     */
11292    public List<SupportingInformationComponent> getInformation() { 
11293      if (this.information == null)
11294        this.information = new ArrayList<SupportingInformationComponent>();
11295      return this.information;
11296    }
11297
11298    /**
11299     * @return Returns a reference to <code>this</code> for easy method chaining
11300     */
11301    public ExplanationOfBenefit setInformation(List<SupportingInformationComponent> theInformation) { 
11302      this.information = theInformation;
11303      return this;
11304    }
11305
11306    public boolean hasInformation() { 
11307      if (this.information == null)
11308        return false;
11309      for (SupportingInformationComponent item : this.information)
11310        if (!item.isEmpty())
11311          return true;
11312      return false;
11313    }
11314
11315    public SupportingInformationComponent addInformation() { //3
11316      SupportingInformationComponent t = new SupportingInformationComponent();
11317      if (this.information == null)
11318        this.information = new ArrayList<SupportingInformationComponent>();
11319      this.information.add(t);
11320      return t;
11321    }
11322
11323    public ExplanationOfBenefit addInformation(SupportingInformationComponent t) { //3
11324      if (t == null)
11325        return this;
11326      if (this.information == null)
11327        this.information = new ArrayList<SupportingInformationComponent>();
11328      this.information.add(t);
11329      return this;
11330    }
11331
11332    /**
11333     * @return The first repetition of repeating field {@link #information}, creating it if it does not already exist
11334     */
11335    public SupportingInformationComponent getInformationFirstRep() { 
11336      if (getInformation().isEmpty()) {
11337        addInformation();
11338      }
11339      return getInformation().get(0);
11340    }
11341
11342    /**
11343     * @return {@link #careTeam} (The members of the team who provided the overall service as well as their role and whether responsible and qualifications.)
11344     */
11345    public List<CareTeamComponent> getCareTeam() { 
11346      if (this.careTeam == null)
11347        this.careTeam = new ArrayList<CareTeamComponent>();
11348      return this.careTeam;
11349    }
11350
11351    /**
11352     * @return Returns a reference to <code>this</code> for easy method chaining
11353     */
11354    public ExplanationOfBenefit setCareTeam(List<CareTeamComponent> theCareTeam) { 
11355      this.careTeam = theCareTeam;
11356      return this;
11357    }
11358
11359    public boolean hasCareTeam() { 
11360      if (this.careTeam == null)
11361        return false;
11362      for (CareTeamComponent item : this.careTeam)
11363        if (!item.isEmpty())
11364          return true;
11365      return false;
11366    }
11367
11368    public CareTeamComponent addCareTeam() { //3
11369      CareTeamComponent t = new CareTeamComponent();
11370      if (this.careTeam == null)
11371        this.careTeam = new ArrayList<CareTeamComponent>();
11372      this.careTeam.add(t);
11373      return t;
11374    }
11375
11376    public ExplanationOfBenefit addCareTeam(CareTeamComponent t) { //3
11377      if (t == null)
11378        return this;
11379      if (this.careTeam == null)
11380        this.careTeam = new ArrayList<CareTeamComponent>();
11381      this.careTeam.add(t);
11382      return this;
11383    }
11384
11385    /**
11386     * @return The first repetition of repeating field {@link #careTeam}, creating it if it does not already exist
11387     */
11388    public CareTeamComponent getCareTeamFirstRep() { 
11389      if (getCareTeam().isEmpty()) {
11390        addCareTeam();
11391      }
11392      return getCareTeam().get(0);
11393    }
11394
11395    /**
11396     * @return {@link #diagnosis} (Ordered list of patient diagnosis for which care is sought.)
11397     */
11398    public List<DiagnosisComponent> getDiagnosis() { 
11399      if (this.diagnosis == null)
11400        this.diagnosis = new ArrayList<DiagnosisComponent>();
11401      return this.diagnosis;
11402    }
11403
11404    /**
11405     * @return Returns a reference to <code>this</code> for easy method chaining
11406     */
11407    public ExplanationOfBenefit setDiagnosis(List<DiagnosisComponent> theDiagnosis) { 
11408      this.diagnosis = theDiagnosis;
11409      return this;
11410    }
11411
11412    public boolean hasDiagnosis() { 
11413      if (this.diagnosis == null)
11414        return false;
11415      for (DiagnosisComponent item : this.diagnosis)
11416        if (!item.isEmpty())
11417          return true;
11418      return false;
11419    }
11420
11421    public DiagnosisComponent addDiagnosis() { //3
11422      DiagnosisComponent t = new DiagnosisComponent();
11423      if (this.diagnosis == null)
11424        this.diagnosis = new ArrayList<DiagnosisComponent>();
11425      this.diagnosis.add(t);
11426      return t;
11427    }
11428
11429    public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { //3
11430      if (t == null)
11431        return this;
11432      if (this.diagnosis == null)
11433        this.diagnosis = new ArrayList<DiagnosisComponent>();
11434      this.diagnosis.add(t);
11435      return this;
11436    }
11437
11438    /**
11439     * @return The first repetition of repeating field {@link #diagnosis}, creating it if it does not already exist
11440     */
11441    public DiagnosisComponent getDiagnosisFirstRep() { 
11442      if (getDiagnosis().isEmpty()) {
11443        addDiagnosis();
11444      }
11445      return getDiagnosis().get(0);
11446    }
11447
11448    /**
11449     * @return {@link #procedure} (Ordered list of patient procedures performed to support the adjudication.)
11450     */
11451    public List<ProcedureComponent> getProcedure() { 
11452      if (this.procedure == null)
11453        this.procedure = new ArrayList<ProcedureComponent>();
11454      return this.procedure;
11455    }
11456
11457    /**
11458     * @return Returns a reference to <code>this</code> for easy method chaining
11459     */
11460    public ExplanationOfBenefit setProcedure(List<ProcedureComponent> theProcedure) { 
11461      this.procedure = theProcedure;
11462      return this;
11463    }
11464
11465    public boolean hasProcedure() { 
11466      if (this.procedure == null)
11467        return false;
11468      for (ProcedureComponent item : this.procedure)
11469        if (!item.isEmpty())
11470          return true;
11471      return false;
11472    }
11473
11474    public ProcedureComponent addProcedure() { //3
11475      ProcedureComponent t = new ProcedureComponent();
11476      if (this.procedure == null)
11477        this.procedure = new ArrayList<ProcedureComponent>();
11478      this.procedure.add(t);
11479      return t;
11480    }
11481
11482    public ExplanationOfBenefit addProcedure(ProcedureComponent t) { //3
11483      if (t == null)
11484        return this;
11485      if (this.procedure == null)
11486        this.procedure = new ArrayList<ProcedureComponent>();
11487      this.procedure.add(t);
11488      return this;
11489    }
11490
11491    /**
11492     * @return The first repetition of repeating field {@link #procedure}, creating it if it does not already exist
11493     */
11494    public ProcedureComponent getProcedureFirstRep() { 
11495      if (getProcedure().isEmpty()) {
11496        addProcedure();
11497      }
11498      return getProcedure().get(0);
11499    }
11500
11501    /**
11502     * @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
11503     */
11504    public PositiveIntType getPrecedenceElement() { 
11505      if (this.precedence == null)
11506        if (Configuration.errorOnAutoCreate())
11507          throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
11508        else if (Configuration.doAutoCreate())
11509          this.precedence = new PositiveIntType(); // bb
11510      return this.precedence;
11511    }
11512
11513    public boolean hasPrecedenceElement() { 
11514      return this.precedence != null && !this.precedence.isEmpty();
11515    }
11516
11517    public boolean hasPrecedence() { 
11518      return this.precedence != null && !this.precedence.isEmpty();
11519    }
11520
11521    /**
11522     * @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
11523     */
11524    public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) { 
11525      this.precedence = value;
11526      return this;
11527    }
11528
11529    /**
11530     * @return Precedence (primary, secondary, etc.).
11531     */
11532    public int getPrecedence() { 
11533      return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
11534    }
11535
11536    /**
11537     * @param value Precedence (primary, secondary, etc.).
11538     */
11539    public ExplanationOfBenefit setPrecedence(int value) { 
11540        if (this.precedence == null)
11541          this.precedence = new PositiveIntType();
11542        this.precedence.setValue(value);
11543      return this;
11544    }
11545
11546    /**
11547     * @return {@link #insurance} (Financial instrument by which payment information for health care.)
11548     */
11549    public InsuranceComponent getInsurance() { 
11550      if (this.insurance == null)
11551        if (Configuration.errorOnAutoCreate())
11552          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurance");
11553        else if (Configuration.doAutoCreate())
11554          this.insurance = new InsuranceComponent(); // cc
11555      return this.insurance;
11556    }
11557
11558    public boolean hasInsurance() { 
11559      return this.insurance != null && !this.insurance.isEmpty();
11560    }
11561
11562    /**
11563     * @param value {@link #insurance} (Financial instrument by which payment information for health care.)
11564     */
11565    public ExplanationOfBenefit setInsurance(InsuranceComponent value) { 
11566      this.insurance = value;
11567      return this;
11568    }
11569
11570    /**
11571     * @return {@link #accident} (An accident which resulted in the need for healthcare services.)
11572     */
11573    public AccidentComponent getAccident() { 
11574      if (this.accident == null)
11575        if (Configuration.errorOnAutoCreate())
11576          throw new Error("Attempt to auto-create ExplanationOfBenefit.accident");
11577        else if (Configuration.doAutoCreate())
11578          this.accident = new AccidentComponent(); // cc
11579      return this.accident;
11580    }
11581
11582    public boolean hasAccident() { 
11583      return this.accident != null && !this.accident.isEmpty();
11584    }
11585
11586    /**
11587     * @param value {@link #accident} (An accident which resulted in the need for healthcare services.)
11588     */
11589    public ExplanationOfBenefit setAccident(AccidentComponent value) { 
11590      this.accident = value;
11591      return this;
11592    }
11593
11594    /**
11595     * @return {@link #item} (First tier of goods and services.)
11596     */
11597    public List<ItemComponent> getItem() { 
11598      if (this.item == null)
11599        this.item = new ArrayList<ItemComponent>();
11600      return this.item;
11601    }
11602
11603    /**
11604     * @return Returns a reference to <code>this</code> for easy method chaining
11605     */
11606    public ExplanationOfBenefit setItem(List<ItemComponent> theItem) { 
11607      this.item = theItem;
11608      return this;
11609    }
11610
11611    public boolean hasItem() { 
11612      if (this.item == null)
11613        return false;
11614      for (ItemComponent item : this.item)
11615        if (!item.isEmpty())
11616          return true;
11617      return false;
11618    }
11619
11620    public ItemComponent addItem() { //3
11621      ItemComponent t = new ItemComponent();
11622      if (this.item == null)
11623        this.item = new ArrayList<ItemComponent>();
11624      this.item.add(t);
11625      return t;
11626    }
11627
11628    public ExplanationOfBenefit addItem(ItemComponent t) { //3
11629      if (t == null)
11630        return this;
11631      if (this.item == null)
11632        this.item = new ArrayList<ItemComponent>();
11633      this.item.add(t);
11634      return this;
11635    }
11636
11637    /**
11638     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
11639     */
11640    public ItemComponent getItemFirstRep() { 
11641      if (getItem().isEmpty()) {
11642        addItem();
11643      }
11644      return getItem().get(0);
11645    }
11646
11647    /**
11648     * @return {@link #addItem} (The first tier service adjudications for payor added services.)
11649     */
11650    public List<AddedItemComponent> getAddItem() { 
11651      if (this.addItem == null)
11652        this.addItem = new ArrayList<AddedItemComponent>();
11653      return this.addItem;
11654    }
11655
11656    /**
11657     * @return Returns a reference to <code>this</code> for easy method chaining
11658     */
11659    public ExplanationOfBenefit setAddItem(List<AddedItemComponent> theAddItem) { 
11660      this.addItem = theAddItem;
11661      return this;
11662    }
11663
11664    public boolean hasAddItem() { 
11665      if (this.addItem == null)
11666        return false;
11667      for (AddedItemComponent item : this.addItem)
11668        if (!item.isEmpty())
11669          return true;
11670      return false;
11671    }
11672
11673    public AddedItemComponent addAddItem() { //3
11674      AddedItemComponent t = new AddedItemComponent();
11675      if (this.addItem == null)
11676        this.addItem = new ArrayList<AddedItemComponent>();
11677      this.addItem.add(t);
11678      return t;
11679    }
11680
11681    public ExplanationOfBenefit addAddItem(AddedItemComponent t) { //3
11682      if (t == null)
11683        return this;
11684      if (this.addItem == null)
11685        this.addItem = new ArrayList<AddedItemComponent>();
11686      this.addItem.add(t);
11687      return this;
11688    }
11689
11690    /**
11691     * @return The first repetition of repeating field {@link #addItem}, creating it if it does not already exist
11692     */
11693    public AddedItemComponent getAddItemFirstRep() { 
11694      if (getAddItem().isEmpty()) {
11695        addAddItem();
11696      }
11697      return getAddItem().get(0);
11698    }
11699
11700    /**
11701     * @return {@link #total} (Totals for amounts submitted, co-pays, benefits payable etc.)
11702     */
11703    public List<TotalComponent> getTotal() { 
11704      if (this.total == null)
11705        this.total = new ArrayList<TotalComponent>();
11706      return this.total;
11707    }
11708
11709    /**
11710     * @return Returns a reference to <code>this</code> for easy method chaining
11711     */
11712    public ExplanationOfBenefit setTotal(List<TotalComponent> theTotal) { 
11713      this.total = theTotal;
11714      return this;
11715    }
11716
11717    public boolean hasTotal() { 
11718      if (this.total == null)
11719        return false;
11720      for (TotalComponent item : this.total)
11721        if (!item.isEmpty())
11722          return true;
11723      return false;
11724    }
11725
11726    public TotalComponent addTotal() { //3
11727      TotalComponent t = new TotalComponent();
11728      if (this.total == null)
11729        this.total = new ArrayList<TotalComponent>();
11730      this.total.add(t);
11731      return t;
11732    }
11733
11734    public ExplanationOfBenefit addTotal(TotalComponent t) { //3
11735      if (t == null)
11736        return this;
11737      if (this.total == null)
11738        this.total = new ArrayList<TotalComponent>();
11739      this.total.add(t);
11740      return this;
11741    }
11742
11743    /**
11744     * @return The first repetition of repeating field {@link #total}, creating it if it does not already exist
11745     */
11746    public TotalComponent getTotalFirstRep() { 
11747      if (getTotal().isEmpty()) {
11748        addTotal();
11749      }
11750      return getTotal().get(0);
11751    }
11752
11753    /**
11754     * @return {@link #payment} (Payment details for the claim if the claim has been paid.)
11755     */
11756    public PaymentComponent getPayment() { 
11757      if (this.payment == null)
11758        if (Configuration.errorOnAutoCreate())
11759          throw new Error("Attempt to auto-create ExplanationOfBenefit.payment");
11760        else if (Configuration.doAutoCreate())
11761          this.payment = new PaymentComponent(); // cc
11762      return this.payment;
11763    }
11764
11765    public boolean hasPayment() { 
11766      return this.payment != null && !this.payment.isEmpty();
11767    }
11768
11769    /**
11770     * @param value {@link #payment} (Payment details for the claim if the claim has been paid.)
11771     */
11772    public ExplanationOfBenefit setPayment(PaymentComponent value) { 
11773      this.payment = value;
11774      return this;
11775    }
11776
11777    /**
11778     * @return {@link #form} (The form to be used for printing the content.)
11779     */
11780    public CodeableConcept getForm() { 
11781      if (this.form == null)
11782        if (Configuration.errorOnAutoCreate())
11783          throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
11784        else if (Configuration.doAutoCreate())
11785          this.form = new CodeableConcept(); // cc
11786      return this.form;
11787    }
11788
11789    public boolean hasForm() { 
11790      return this.form != null && !this.form.isEmpty();
11791    }
11792
11793    /**
11794     * @param value {@link #form} (The form to be used for printing the content.)
11795     */
11796    public ExplanationOfBenefit setForm(CodeableConcept value) { 
11797      this.form = value;
11798      return this;
11799    }
11800
11801    /**
11802     * @return {@link #processNote} (Note text.)
11803     */
11804    public List<NoteComponent> getProcessNote() { 
11805      if (this.processNote == null)
11806        this.processNote = new ArrayList<NoteComponent>();
11807      return this.processNote;
11808    }
11809
11810    /**
11811     * @return Returns a reference to <code>this</code> for easy method chaining
11812     */
11813    public ExplanationOfBenefit setProcessNote(List<NoteComponent> theProcessNote) { 
11814      this.processNote = theProcessNote;
11815      return this;
11816    }
11817
11818    public boolean hasProcessNote() { 
11819      if (this.processNote == null)
11820        return false;
11821      for (NoteComponent item : this.processNote)
11822        if (!item.isEmpty())
11823          return true;
11824      return false;
11825    }
11826
11827    public NoteComponent addProcessNote() { //3
11828      NoteComponent t = new NoteComponent();
11829      if (this.processNote == null)
11830        this.processNote = new ArrayList<NoteComponent>();
11831      this.processNote.add(t);
11832      return t;
11833    }
11834
11835    public ExplanationOfBenefit addProcessNote(NoteComponent t) { //3
11836      if (t == null)
11837        return this;
11838      if (this.processNote == null)
11839        this.processNote = new ArrayList<NoteComponent>();
11840      this.processNote.add(t);
11841      return this;
11842    }
11843
11844    /**
11845     * @return The first repetition of repeating field {@link #processNote}, creating it if it does not already exist
11846     */
11847    public NoteComponent getProcessNoteFirstRep() { 
11848      if (getProcessNote().isEmpty()) {
11849        addProcessNote();
11850      }
11851      return getProcessNote().get(0);
11852    }
11853
11854    /**
11855     * @return {@link #benefitBalance} (Balance by Benefit Category.)
11856     */
11857    public List<BenefitBalanceComponent> getBenefitBalance() { 
11858      if (this.benefitBalance == null)
11859        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
11860      return this.benefitBalance;
11861    }
11862
11863    /**
11864     * @return Returns a reference to <code>this</code> for easy method chaining
11865     */
11866    public ExplanationOfBenefit setBenefitBalance(List<BenefitBalanceComponent> theBenefitBalance) { 
11867      this.benefitBalance = theBenefitBalance;
11868      return this;
11869    }
11870
11871    public boolean hasBenefitBalance() { 
11872      if (this.benefitBalance == null)
11873        return false;
11874      for (BenefitBalanceComponent item : this.benefitBalance)
11875        if (!item.isEmpty())
11876          return true;
11877      return false;
11878    }
11879
11880    public BenefitBalanceComponent addBenefitBalance() { //3
11881      BenefitBalanceComponent t = new BenefitBalanceComponent();
11882      if (this.benefitBalance == null)
11883        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
11884      this.benefitBalance.add(t);
11885      return t;
11886    }
11887
11888    public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { //3
11889      if (t == null)
11890        return this;
11891      if (this.benefitBalance == null)
11892        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
11893      this.benefitBalance.add(t);
11894      return this;
11895    }
11896
11897    /**
11898     * @return The first repetition of repeating field {@link #benefitBalance}, creating it if it does not already exist
11899     */
11900    public BenefitBalanceComponent getBenefitBalanceFirstRep() { 
11901      if (getBenefitBalance().isEmpty()) {
11902        addBenefitBalance();
11903      }
11904      return getBenefitBalance().get(0);
11905    }
11906
11907      protected void listChildren(List<Property> children) {
11908        super.listChildren(children);
11909        children.add(new Property("identifier", "Identifier", "The EOB Business Identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
11910        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
11911        children.add(new Property("type", "CodeableConcept", "The category of claim, eg, oral, pharmacy, vision, insitutional, professional.", 0, 1, type));
11912        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 BillType.", 0, java.lang.Integer.MAX_VALUE, subType));
11913        children.add(new Property("use", "code", "Complete (Bill or Claim), Proposed (Pre-Authorization), Exploratory (Pre-determination).", 0, 1, use));
11914        children.add(new Property("patient", "Reference(Patient)", "Patient Resource.", 0, 1, patient));
11915        children.add(new Property("billablePeriod", "Period", "The billable period for which charges are being submitted.", 0, 1, billablePeriod));
11916        children.add(new Property("created", "dateTime", "The date when the EOB was created.", 0, 1, created));
11917        children.add(new Property("enterer", "Reference(Practitioner|PractitionerRole)", "The person who created the explanation of benefit.", 0, 1, enterer));
11918        children.add(new Property("insurer", "Reference(Organization)", "The insurer which is responsible for the explanation of benefit.", 0, 1, insurer));
11919        children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The provider which is responsible for the claim.", 0, 1, provider));
11920        children.add(new Property("referral", "Reference(ServiceRequest)", "The referral resource which lists the date, practitioner, reason and other supporting information.", 0, 1, referral));
11921        children.add(new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility));
11922        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));
11923        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));
11924        children.add(new Property("outcome", "code", "Processing outcome errror, partial or complete processing.", 0, 1, outcome));
11925        children.add(new Property("disposition", "string", "A description of the status of the adjudication.", 0, 1, disposition));
11926        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));
11927        children.add(new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of Pharmacy or Vision products.", 0, 1, prescription));
11928        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));
11929        children.add(new Property("payee", "", "The party to be reimbursed for the services.", 0, 1, payee));
11930        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));
11931        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));
11932        children.add(new Property("diagnosis", "", "Ordered list of patient diagnosis for which care is sought.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
11933        children.add(new Property("procedure", "", "Ordered list of patient procedures performed to support the adjudication.", 0, java.lang.Integer.MAX_VALUE, procedure));
11934        children.add(new Property("precedence", "positiveInt", "Precedence (primary, secondary, etc.).", 0, 1, precedence));
11935        children.add(new Property("insurance", "", "Financial instrument by which payment information for health care.", 0, 1, insurance));
11936        children.add(new Property("accident", "", "An accident which resulted in the need for healthcare services.", 0, 1, accident));
11937        children.add(new Property("item", "", "First tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, item));
11938        children.add(new Property("addItem", "", "The first tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, addItem));
11939        children.add(new Property("total", "", "Totals for amounts submitted, co-pays, benefits payable etc.", 0, java.lang.Integer.MAX_VALUE, total));
11940        children.add(new Property("payment", "", "Payment details for the claim if the claim has been paid.", 0, 1, payment));
11941        children.add(new Property("form", "CodeableConcept", "The form to be used for printing the content.", 0, 1, form));
11942        children.add(new Property("processNote", "", "Note text.", 0, java.lang.Integer.MAX_VALUE, processNote));
11943        children.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance));
11944      }
11945
11946      @Override
11947      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11948        switch (_hash) {
11949        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The EOB Business Identifier.", 0, java.lang.Integer.MAX_VALUE, identifier);
11950        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
11951        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The category of claim, eg, oral, pharmacy, vision, insitutional, professional.", 0, 1, type);
11952        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 BillType.", 0, java.lang.Integer.MAX_VALUE, subType);
11953        case 116103: /*use*/  return new Property("use", "code", "Complete (Bill or Claim), Proposed (Pre-Authorization), Exploratory (Pre-determination).", 0, 1, use);
11954        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "Patient Resource.", 0, 1, patient);
11955        case -332066046: /*billablePeriod*/  return new Property("billablePeriod", "Period", "The billable period for which charges are being submitted.", 0, 1, billablePeriod);
11956        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date when the EOB was created.", 0, 1, created);
11957        case -1591951995: /*enterer*/  return new Property("enterer", "Reference(Practitioner|PractitionerRole)", "The person who created the explanation of benefit.", 0, 1, enterer);
11958        case 1957615864: /*insurer*/  return new Property("insurer", "Reference(Organization)", "The insurer which is responsible for the explanation of benefit.", 0, 1, insurer);
11959        case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The provider which is responsible for the claim.", 0, 1, provider);
11960        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);
11961        case 501116579: /*facility*/  return new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility);
11962        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);
11963        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);
11964        case -1106507950: /*outcome*/  return new Property("outcome", "code", "Processing outcome errror, partial or complete processing.", 0, 1, outcome);
11965        case 583380919: /*disposition*/  return new Property("disposition", "string", "A description of the status of the adjudication.", 0, 1, disposition);
11966        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);
11967        case 460301338: /*prescription*/  return new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of Pharmacy or Vision products.", 0, 1, prescription);
11968        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);
11969        case 106443592: /*payee*/  return new Property("payee", "", "The party to be reimbursed for the services.", 0, 1, payee);
11970        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);
11971        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);
11972        case 1196993265: /*diagnosis*/  return new Property("diagnosis", "", "Ordered list of patient diagnosis for which care is sought.", 0, java.lang.Integer.MAX_VALUE, diagnosis);
11973        case -1095204141: /*procedure*/  return new Property("procedure", "", "Ordered list of patient procedures performed to support the adjudication.", 0, java.lang.Integer.MAX_VALUE, procedure);
11974        case 159695370: /*precedence*/  return new Property("precedence", "positiveInt", "Precedence (primary, secondary, etc.).", 0, 1, precedence);
11975        case 73049818: /*insurance*/  return new Property("insurance", "", "Financial instrument by which payment information for health care.", 0, 1, insurance);
11976        case -2143202801: /*accident*/  return new Property("accident", "", "An accident which resulted in the need for healthcare services.", 0, 1, accident);
11977        case 3242771: /*item*/  return new Property("item", "", "First tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, item);
11978        case -1148899500: /*addItem*/  return new Property("addItem", "", "The first tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, addItem);
11979        case 110549828: /*total*/  return new Property("total", "", "Totals for amounts submitted, co-pays, benefits payable etc.", 0, java.lang.Integer.MAX_VALUE, total);
11980        case -786681338: /*payment*/  return new Property("payment", "", "Payment details for the claim if the claim has been paid.", 0, 1, payment);
11981        case 3148996: /*form*/  return new Property("form", "CodeableConcept", "The form to be used for printing the content.", 0, 1, form);
11982        case 202339073: /*processNote*/  return new Property("processNote", "", "Note text.", 0, java.lang.Integer.MAX_VALUE, processNote);
11983        case 596003397: /*benefitBalance*/  return new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance);
11984        default: return super.getNamedProperty(_hash, _name, _checkValid);
11985        }
11986
11987      }
11988
11989      @Override
11990      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11991        switch (hash) {
11992        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
11993        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ExplanationOfBenefitStatus>
11994        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
11995        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : this.subType.toArray(new Base[this.subType.size()]); // CodeableConcept
11996        case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<Use>
11997        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
11998        case -332066046: /*billablePeriod*/ return this.billablePeriod == null ? new Base[0] : new Base[] {this.billablePeriod}; // Period
11999        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
12000        case -1591951995: /*enterer*/ return this.enterer == null ? new Base[0] : new Base[] {this.enterer}; // Reference
12001        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
12002        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
12003        case -722568291: /*referral*/ return this.referral == null ? new Base[0] : new Base[] {this.referral}; // Reference
12004        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Reference
12005        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
12006        case 689513629: /*claimResponse*/ return this.claimResponse == null ? new Base[0] : new Base[] {this.claimResponse}; // Reference
12007        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // Enumeration<RemittanceOutcome>
12008        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
12009        case 1090493483: /*related*/ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimComponent
12010        case 460301338: /*prescription*/ return this.prescription == null ? new Base[0] : new Base[] {this.prescription}; // Reference
12011        case -1814015861: /*originalPrescription*/ return this.originalPrescription == null ? new Base[0] : new Base[] {this.originalPrescription}; // Reference
12012        case 106443592: /*payee*/ return this.payee == null ? new Base[0] : new Base[] {this.payee}; // PayeeComponent
12013        case 1968600364: /*information*/ return this.information == null ? new Base[0] : this.information.toArray(new Base[this.information.size()]); // SupportingInformationComponent
12014        case -7323378: /*careTeam*/ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // CareTeamComponent
12015        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
12016        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
12017        case 159695370: /*precedence*/ return this.precedence == null ? new Base[0] : new Base[] {this.precedence}; // PositiveIntType
12018        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : new Base[] {this.insurance}; // InsuranceComponent
12019        case -2143202801: /*accident*/ return this.accident == null ? new Base[0] : new Base[] {this.accident}; // AccidentComponent
12020        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
12021        case -1148899500: /*addItem*/ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
12022        case 110549828: /*total*/ return this.total == null ? new Base[0] : this.total.toArray(new Base[this.total.size()]); // TotalComponent
12023        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // PaymentComponent
12024        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // CodeableConcept
12025        case 202339073: /*processNote*/ return this.processNote == null ? new Base[0] : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
12026        case 596003397: /*benefitBalance*/ return this.benefitBalance == null ? new Base[0] : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
12027        default: return super.getProperty(hash, name, checkValid);
12028        }
12029
12030      }
12031
12032      @Override
12033      public Base setProperty(int hash, String name, Base value) throws FHIRException {
12034        switch (hash) {
12035        case -1618432855: // identifier
12036          this.getIdentifier().add(castToIdentifier(value)); // Identifier
12037          return value;
12038        case -892481550: // status
12039          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
12040          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
12041          return value;
12042        case 3575610: // type
12043          this.type = castToCodeableConcept(value); // CodeableConcept
12044          return value;
12045        case -1868521062: // subType
12046          this.getSubType().add(castToCodeableConcept(value)); // CodeableConcept
12047          return value;
12048        case 116103: // use
12049          value = new UseEnumFactory().fromType(castToCode(value));
12050          this.use = (Enumeration) value; // Enumeration<Use>
12051          return value;
12052        case -791418107: // patient
12053          this.patient = castToReference(value); // Reference
12054          return value;
12055        case -332066046: // billablePeriod
12056          this.billablePeriod = castToPeriod(value); // Period
12057          return value;
12058        case 1028554472: // created
12059          this.created = castToDateTime(value); // DateTimeType
12060          return value;
12061        case -1591951995: // enterer
12062          this.enterer = castToReference(value); // Reference
12063          return value;
12064        case 1957615864: // insurer
12065          this.insurer = castToReference(value); // Reference
12066          return value;
12067        case -987494927: // provider
12068          this.provider = castToReference(value); // Reference
12069          return value;
12070        case -722568291: // referral
12071          this.referral = castToReference(value); // Reference
12072          return value;
12073        case 501116579: // facility
12074          this.facility = castToReference(value); // Reference
12075          return value;
12076        case 94742588: // claim
12077          this.claim = castToReference(value); // Reference
12078          return value;
12079        case 689513629: // claimResponse
12080          this.claimResponse = castToReference(value); // Reference
12081          return value;
12082        case -1106507950: // outcome
12083          value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
12084          this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
12085          return value;
12086        case 583380919: // disposition
12087          this.disposition = castToString(value); // StringType
12088          return value;
12089        case 1090493483: // related
12090          this.getRelated().add((RelatedClaimComponent) value); // RelatedClaimComponent
12091          return value;
12092        case 460301338: // prescription
12093          this.prescription = castToReference(value); // Reference
12094          return value;
12095        case -1814015861: // originalPrescription
12096          this.originalPrescription = castToReference(value); // Reference
12097          return value;
12098        case 106443592: // payee
12099          this.payee = (PayeeComponent) value; // PayeeComponent
12100          return value;
12101        case 1968600364: // information
12102          this.getInformation().add((SupportingInformationComponent) value); // SupportingInformationComponent
12103          return value;
12104        case -7323378: // careTeam
12105          this.getCareTeam().add((CareTeamComponent) value); // CareTeamComponent
12106          return value;
12107        case 1196993265: // diagnosis
12108          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
12109          return value;
12110        case -1095204141: // procedure
12111          this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
12112          return value;
12113        case 159695370: // precedence
12114          this.precedence = castToPositiveInt(value); // PositiveIntType
12115          return value;
12116        case 73049818: // insurance
12117          this.insurance = (InsuranceComponent) value; // InsuranceComponent
12118          return value;
12119        case -2143202801: // accident
12120          this.accident = (AccidentComponent) value; // AccidentComponent
12121          return value;
12122        case 3242771: // item
12123          this.getItem().add((ItemComponent) value); // ItemComponent
12124          return value;
12125        case -1148899500: // addItem
12126          this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
12127          return value;
12128        case 110549828: // total
12129          this.getTotal().add((TotalComponent) value); // TotalComponent
12130          return value;
12131        case -786681338: // payment
12132          this.payment = (PaymentComponent) value; // PaymentComponent
12133          return value;
12134        case 3148996: // form
12135          this.form = castToCodeableConcept(value); // CodeableConcept
12136          return value;
12137        case 202339073: // processNote
12138          this.getProcessNote().add((NoteComponent) value); // NoteComponent
12139          return value;
12140        case 596003397: // benefitBalance
12141          this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
12142          return value;
12143        default: return super.setProperty(hash, name, value);
12144        }
12145
12146      }
12147
12148      @Override
12149      public Base setProperty(String name, Base value) throws FHIRException {
12150        if (name.equals("identifier")) {
12151          this.getIdentifier().add(castToIdentifier(value));
12152        } else if (name.equals("status")) {
12153          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
12154          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
12155        } else if (name.equals("type")) {
12156          this.type = castToCodeableConcept(value); // CodeableConcept
12157        } else if (name.equals("subType")) {
12158          this.getSubType().add(castToCodeableConcept(value));
12159        } else if (name.equals("use")) {
12160          value = new UseEnumFactory().fromType(castToCode(value));
12161          this.use = (Enumeration) value; // Enumeration<Use>
12162        } else if (name.equals("patient")) {
12163          this.patient = castToReference(value); // Reference
12164        } else if (name.equals("billablePeriod")) {
12165          this.billablePeriod = castToPeriod(value); // Period
12166        } else if (name.equals("created")) {
12167          this.created = castToDateTime(value); // DateTimeType
12168        } else if (name.equals("enterer")) {
12169          this.enterer = castToReference(value); // Reference
12170        } else if (name.equals("insurer")) {
12171          this.insurer = castToReference(value); // Reference
12172        } else if (name.equals("provider")) {
12173          this.provider = castToReference(value); // Reference
12174        } else if (name.equals("referral")) {
12175          this.referral = castToReference(value); // Reference
12176        } else if (name.equals("facility")) {
12177          this.facility = castToReference(value); // Reference
12178        } else if (name.equals("claim")) {
12179          this.claim = castToReference(value); // Reference
12180        } else if (name.equals("claimResponse")) {
12181          this.claimResponse = castToReference(value); // Reference
12182        } else if (name.equals("outcome")) {
12183          value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
12184          this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
12185        } else if (name.equals("disposition")) {
12186          this.disposition = castToString(value); // StringType
12187        } else if (name.equals("related")) {
12188          this.getRelated().add((RelatedClaimComponent) value);
12189        } else if (name.equals("prescription")) {
12190          this.prescription = castToReference(value); // Reference
12191        } else if (name.equals("originalPrescription")) {
12192          this.originalPrescription = castToReference(value); // Reference
12193        } else if (name.equals("payee")) {
12194          this.payee = (PayeeComponent) value; // PayeeComponent
12195        } else if (name.equals("information")) {
12196          this.getInformation().add((SupportingInformationComponent) value);
12197        } else if (name.equals("careTeam")) {
12198          this.getCareTeam().add((CareTeamComponent) value);
12199        } else if (name.equals("diagnosis")) {
12200          this.getDiagnosis().add((DiagnosisComponent) value);
12201        } else if (name.equals("procedure")) {
12202          this.getProcedure().add((ProcedureComponent) value);
12203        } else if (name.equals("precedence")) {
12204          this.precedence = castToPositiveInt(value); // PositiveIntType
12205        } else if (name.equals("insurance")) {
12206          this.insurance = (InsuranceComponent) value; // InsuranceComponent
12207        } else if (name.equals("accident")) {
12208          this.accident = (AccidentComponent) value; // AccidentComponent
12209        } else if (name.equals("item")) {
12210          this.getItem().add((ItemComponent) value);
12211        } else if (name.equals("addItem")) {
12212          this.getAddItem().add((AddedItemComponent) value);
12213        } else if (name.equals("total")) {
12214          this.getTotal().add((TotalComponent) value);
12215        } else if (name.equals("payment")) {
12216          this.payment = (PaymentComponent) value; // PaymentComponent
12217        } else if (name.equals("form")) {
12218          this.form = castToCodeableConcept(value); // CodeableConcept
12219        } else if (name.equals("processNote")) {
12220          this.getProcessNote().add((NoteComponent) value);
12221        } else if (name.equals("benefitBalance")) {
12222          this.getBenefitBalance().add((BenefitBalanceComponent) value);
12223        } else
12224          return super.setProperty(name, value);
12225        return value;
12226      }
12227
12228      @Override
12229      public Base makeProperty(int hash, String name) throws FHIRException {
12230        switch (hash) {
12231        case -1618432855:  return addIdentifier(); 
12232        case -892481550:  return getStatusElement();
12233        case 3575610:  return getType(); 
12234        case -1868521062:  return addSubType(); 
12235        case 116103:  return getUseElement();
12236        case -791418107:  return getPatient(); 
12237        case -332066046:  return getBillablePeriod(); 
12238        case 1028554472:  return getCreatedElement();
12239        case -1591951995:  return getEnterer(); 
12240        case 1957615864:  return getInsurer(); 
12241        case -987494927:  return getProvider(); 
12242        case -722568291:  return getReferral(); 
12243        case 501116579:  return getFacility(); 
12244        case 94742588:  return getClaim(); 
12245        case 689513629:  return getClaimResponse(); 
12246        case -1106507950:  return getOutcomeElement();
12247        case 583380919:  return getDispositionElement();
12248        case 1090493483:  return addRelated(); 
12249        case 460301338:  return getPrescription(); 
12250        case -1814015861:  return getOriginalPrescription(); 
12251        case 106443592:  return getPayee(); 
12252        case 1968600364:  return addInformation(); 
12253        case -7323378:  return addCareTeam(); 
12254        case 1196993265:  return addDiagnosis(); 
12255        case -1095204141:  return addProcedure(); 
12256        case 159695370:  return getPrecedenceElement();
12257        case 73049818:  return getInsurance(); 
12258        case -2143202801:  return getAccident(); 
12259        case 3242771:  return addItem(); 
12260        case -1148899500:  return addAddItem(); 
12261        case 110549828:  return addTotal(); 
12262        case -786681338:  return getPayment(); 
12263        case 3148996:  return getForm(); 
12264        case 202339073:  return addProcessNote(); 
12265        case 596003397:  return addBenefitBalance(); 
12266        default: return super.makeProperty(hash, name);
12267        }
12268
12269      }
12270
12271      @Override
12272      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12273        switch (hash) {
12274        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
12275        case -892481550: /*status*/ return new String[] {"code"};
12276        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
12277        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
12278        case 116103: /*use*/ return new String[] {"code"};
12279        case -791418107: /*patient*/ return new String[] {"Reference"};
12280        case -332066046: /*billablePeriod*/ return new String[] {"Period"};
12281        case 1028554472: /*created*/ return new String[] {"dateTime"};
12282        case -1591951995: /*enterer*/ return new String[] {"Reference"};
12283        case 1957615864: /*insurer*/ return new String[] {"Reference"};
12284        case -987494927: /*provider*/ return new String[] {"Reference"};
12285        case -722568291: /*referral*/ return new String[] {"Reference"};
12286        case 501116579: /*facility*/ return new String[] {"Reference"};
12287        case 94742588: /*claim*/ return new String[] {"Reference"};
12288        case 689513629: /*claimResponse*/ return new String[] {"Reference"};
12289        case -1106507950: /*outcome*/ return new String[] {"code"};
12290        case 583380919: /*disposition*/ return new String[] {"string"};
12291        case 1090493483: /*related*/ return new String[] {};
12292        case 460301338: /*prescription*/ return new String[] {"Reference"};
12293        case -1814015861: /*originalPrescription*/ return new String[] {"Reference"};
12294        case 106443592: /*payee*/ return new String[] {};
12295        case 1968600364: /*information*/ return new String[] {};
12296        case -7323378: /*careTeam*/ return new String[] {};
12297        case 1196993265: /*diagnosis*/ return new String[] {};
12298        case -1095204141: /*procedure*/ return new String[] {};
12299        case 159695370: /*precedence*/ return new String[] {"positiveInt"};
12300        case 73049818: /*insurance*/ return new String[] {};
12301        case -2143202801: /*accident*/ return new String[] {};
12302        case 3242771: /*item*/ return new String[] {};
12303        case -1148899500: /*addItem*/ return new String[] {};
12304        case 110549828: /*total*/ return new String[] {};
12305        case -786681338: /*payment*/ return new String[] {};
12306        case 3148996: /*form*/ return new String[] {"CodeableConcept"};
12307        case 202339073: /*processNote*/ return new String[] {};
12308        case 596003397: /*benefitBalance*/ return new String[] {};
12309        default: return super.getTypesForProperty(hash, name);
12310        }
12311
12312      }
12313
12314      @Override
12315      public Base addChild(String name) throws FHIRException {
12316        if (name.equals("identifier")) {
12317          return addIdentifier();
12318        }
12319        else if (name.equals("status")) {
12320          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.status");
12321        }
12322        else if (name.equals("type")) {
12323          this.type = new CodeableConcept();
12324          return this.type;
12325        }
12326        else if (name.equals("subType")) {
12327          return addSubType();
12328        }
12329        else if (name.equals("use")) {
12330          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.use");
12331        }
12332        else if (name.equals("patient")) {
12333          this.patient = new Reference();
12334          return this.patient;
12335        }
12336        else if (name.equals("billablePeriod")) {
12337          this.billablePeriod = new Period();
12338          return this.billablePeriod;
12339        }
12340        else if (name.equals("created")) {
12341          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.created");
12342        }
12343        else if (name.equals("enterer")) {
12344          this.enterer = new Reference();
12345          return this.enterer;
12346        }
12347        else if (name.equals("insurer")) {
12348          this.insurer = new Reference();
12349          return this.insurer;
12350        }
12351        else if (name.equals("provider")) {
12352          this.provider = new Reference();
12353          return this.provider;
12354        }
12355        else if (name.equals("referral")) {
12356          this.referral = new Reference();
12357          return this.referral;
12358        }
12359        else if (name.equals("facility")) {
12360          this.facility = new Reference();
12361          return this.facility;
12362        }
12363        else if (name.equals("claim")) {
12364          this.claim = new Reference();
12365          return this.claim;
12366        }
12367        else if (name.equals("claimResponse")) {
12368          this.claimResponse = new Reference();
12369          return this.claimResponse;
12370        }
12371        else if (name.equals("outcome")) {
12372          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.outcome");
12373        }
12374        else if (name.equals("disposition")) {
12375          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.disposition");
12376        }
12377        else if (name.equals("related")) {
12378          return addRelated();
12379        }
12380        else if (name.equals("prescription")) {
12381          this.prescription = new Reference();
12382          return this.prescription;
12383        }
12384        else if (name.equals("originalPrescription")) {
12385          this.originalPrescription = new Reference();
12386          return this.originalPrescription;
12387        }
12388        else if (name.equals("payee")) {
12389          this.payee = new PayeeComponent();
12390          return this.payee;
12391        }
12392        else if (name.equals("information")) {
12393          return addInformation();
12394        }
12395        else if (name.equals("careTeam")) {
12396          return addCareTeam();
12397        }
12398        else if (name.equals("diagnosis")) {
12399          return addDiagnosis();
12400        }
12401        else if (name.equals("procedure")) {
12402          return addProcedure();
12403        }
12404        else if (name.equals("precedence")) {
12405          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.precedence");
12406        }
12407        else if (name.equals("insurance")) {
12408          this.insurance = new InsuranceComponent();
12409          return this.insurance;
12410        }
12411        else if (name.equals("accident")) {
12412          this.accident = new AccidentComponent();
12413          return this.accident;
12414        }
12415        else if (name.equals("item")) {
12416          return addItem();
12417        }
12418        else if (name.equals("addItem")) {
12419          return addAddItem();
12420        }
12421        else if (name.equals("total")) {
12422          return addTotal();
12423        }
12424        else if (name.equals("payment")) {
12425          this.payment = new PaymentComponent();
12426          return this.payment;
12427        }
12428        else if (name.equals("form")) {
12429          this.form = new CodeableConcept();
12430          return this.form;
12431        }
12432        else if (name.equals("processNote")) {
12433          return addProcessNote();
12434        }
12435        else if (name.equals("benefitBalance")) {
12436          return addBenefitBalance();
12437        }
12438        else
12439          return super.addChild(name);
12440      }
12441
12442  public String fhirType() {
12443    return "ExplanationOfBenefit";
12444
12445  }
12446
12447      public ExplanationOfBenefit copy() {
12448        ExplanationOfBenefit dst = new ExplanationOfBenefit();
12449        copyValues(dst);
12450        if (identifier != null) {
12451          dst.identifier = new ArrayList<Identifier>();
12452          for (Identifier i : identifier)
12453            dst.identifier.add(i.copy());
12454        };
12455        dst.status = status == null ? null : status.copy();
12456        dst.type = type == null ? null : type.copy();
12457        if (subType != null) {
12458          dst.subType = new ArrayList<CodeableConcept>();
12459          for (CodeableConcept i : subType)
12460            dst.subType.add(i.copy());
12461        };
12462        dst.use = use == null ? null : use.copy();
12463        dst.patient = patient == null ? null : patient.copy();
12464        dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
12465        dst.created = created == null ? null : created.copy();
12466        dst.enterer = enterer == null ? null : enterer.copy();
12467        dst.insurer = insurer == null ? null : insurer.copy();
12468        dst.provider = provider == null ? null : provider.copy();
12469        dst.referral = referral == null ? null : referral.copy();
12470        dst.facility = facility == null ? null : facility.copy();
12471        dst.claim = claim == null ? null : claim.copy();
12472        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
12473        dst.outcome = outcome == null ? null : outcome.copy();
12474        dst.disposition = disposition == null ? null : disposition.copy();
12475        if (related != null) {
12476          dst.related = new ArrayList<RelatedClaimComponent>();
12477          for (RelatedClaimComponent i : related)
12478            dst.related.add(i.copy());
12479        };
12480        dst.prescription = prescription == null ? null : prescription.copy();
12481        dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
12482        dst.payee = payee == null ? null : payee.copy();
12483        if (information != null) {
12484          dst.information = new ArrayList<SupportingInformationComponent>();
12485          for (SupportingInformationComponent i : information)
12486            dst.information.add(i.copy());
12487        };
12488        if (careTeam != null) {
12489          dst.careTeam = new ArrayList<CareTeamComponent>();
12490          for (CareTeamComponent i : careTeam)
12491            dst.careTeam.add(i.copy());
12492        };
12493        if (diagnosis != null) {
12494          dst.diagnosis = new ArrayList<DiagnosisComponent>();
12495          for (DiagnosisComponent i : diagnosis)
12496            dst.diagnosis.add(i.copy());
12497        };
12498        if (procedure != null) {
12499          dst.procedure = new ArrayList<ProcedureComponent>();
12500          for (ProcedureComponent i : procedure)
12501            dst.procedure.add(i.copy());
12502        };
12503        dst.precedence = precedence == null ? null : precedence.copy();
12504        dst.insurance = insurance == null ? null : insurance.copy();
12505        dst.accident = accident == null ? null : accident.copy();
12506        if (item != null) {
12507          dst.item = new ArrayList<ItemComponent>();
12508          for (ItemComponent i : item)
12509            dst.item.add(i.copy());
12510        };
12511        if (addItem != null) {
12512          dst.addItem = new ArrayList<AddedItemComponent>();
12513          for (AddedItemComponent i : addItem)
12514            dst.addItem.add(i.copy());
12515        };
12516        if (total != null) {
12517          dst.total = new ArrayList<TotalComponent>();
12518          for (TotalComponent i : total)
12519            dst.total.add(i.copy());
12520        };
12521        dst.payment = payment == null ? null : payment.copy();
12522        dst.form = form == null ? null : form.copy();
12523        if (processNote != null) {
12524          dst.processNote = new ArrayList<NoteComponent>();
12525          for (NoteComponent i : processNote)
12526            dst.processNote.add(i.copy());
12527        };
12528        if (benefitBalance != null) {
12529          dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
12530          for (BenefitBalanceComponent i : benefitBalance)
12531            dst.benefitBalance.add(i.copy());
12532        };
12533        return dst;
12534      }
12535
12536      protected ExplanationOfBenefit typedCopy() {
12537        return copy();
12538      }
12539
12540      @Override
12541      public boolean equalsDeep(Base other_) {
12542        if (!super.equalsDeep(other_))
12543          return false;
12544        if (!(other_ instanceof ExplanationOfBenefit))
12545          return false;
12546        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
12547        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
12548           && compareDeep(subType, o.subType, true) && compareDeep(use, o.use, true) && compareDeep(patient, o.patient, true)
12549           && compareDeep(billablePeriod, o.billablePeriod, true) && compareDeep(created, o.created, true)
12550           && compareDeep(enterer, o.enterer, true) && compareDeep(insurer, o.insurer, true) && compareDeep(provider, o.provider, true)
12551           && compareDeep(referral, o.referral, true) && compareDeep(facility, o.facility, true) && compareDeep(claim, o.claim, true)
12552           && compareDeep(claimResponse, o.claimResponse, true) && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true)
12553           && compareDeep(related, o.related, true) && compareDeep(prescription, o.prescription, true) && compareDeep(originalPrescription, o.originalPrescription, true)
12554           && compareDeep(payee, o.payee, true) && compareDeep(information, o.information, true) && compareDeep(careTeam, o.careTeam, true)
12555           && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true) && compareDeep(precedence, o.precedence, true)
12556           && compareDeep(insurance, o.insurance, true) && compareDeep(accident, o.accident, true) && compareDeep(item, o.item, true)
12557           && compareDeep(addItem, o.addItem, true) && compareDeep(total, o.total, true) && compareDeep(payment, o.payment, true)
12558           && compareDeep(form, o.form, true) && compareDeep(processNote, o.processNote, true) && compareDeep(benefitBalance, o.benefitBalance, true)
12559          ;
12560      }
12561
12562      @Override
12563      public boolean equalsShallow(Base other_) {
12564        if (!super.equalsShallow(other_))
12565          return false;
12566        if (!(other_ instanceof ExplanationOfBenefit))
12567          return false;
12568        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
12569        return compareValues(status, o.status, true) && compareValues(use, o.use, true) && compareValues(created, o.created, true)
12570           && compareValues(outcome, o.outcome, true) && compareValues(disposition, o.disposition, true) && compareValues(precedence, o.precedence, true)
12571          ;
12572      }
12573
12574      public boolean isEmpty() {
12575        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
12576          , subType, use, patient, billablePeriod, created, enterer, insurer, provider
12577          , referral, facility, claim, claimResponse, outcome, disposition, related, prescription
12578          , originalPrescription, payee, information, careTeam, diagnosis, procedure, precedence
12579          , insurance, accident, item, addItem, total, payment, form, processNote, benefitBalance
12580          );
12581      }
12582
12583  @Override
12584  public ResourceType getResourceType() {
12585    return ResourceType.ExplanationOfBenefit;
12586   }
12587
12588 /**
12589   * Search parameter: <b>coverage</b>
12590   * <p>
12591   * Description: <b>The plan under which the claim was adjudicated</b><br>
12592   * Type: <b>reference</b><br>
12593   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
12594   * </p>
12595   */
12596  @SearchParamDefinition(name="coverage", path="ExplanationOfBenefit.insurance.coverage", description="The plan under which the claim was adjudicated", type="reference", target={Coverage.class } )
12597  public static final String SP_COVERAGE = "coverage";
12598 /**
12599   * <b>Fluent Client</b> search parameter constant for <b>coverage</b>
12600   * <p>
12601   * Description: <b>The plan under which the claim was adjudicated</b><br>
12602   * Type: <b>reference</b><br>
12603   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
12604   * </p>
12605   */
12606  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COVERAGE);
12607
12608/**
12609   * Constant for fluent queries to be used to add include statements. Specifies
12610   * the path value of "<b>ExplanationOfBenefit:coverage</b>".
12611   */
12612  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:coverage").toLocked();
12613
12614 /**
12615   * Search parameter: <b>care-team</b>
12616   * <p>
12617   * Description: <b>Member of the CareTeam</b><br>
12618   * Type: <b>reference</b><br>
12619   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
12620   * </p>
12621   */
12622  @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 } )
12623  public static final String SP_CARE_TEAM = "care-team";
12624 /**
12625   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
12626   * <p>
12627   * Description: <b>Member of the CareTeam</b><br>
12628   * Type: <b>reference</b><br>
12629   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
12630   * </p>
12631   */
12632  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CARE_TEAM);
12633
12634/**
12635   * Constant for fluent queries to be used to add include statements. Specifies
12636   * the path value of "<b>ExplanationOfBenefit:care-team</b>".
12637   */
12638  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:care-team").toLocked();
12639
12640 /**
12641   * Search parameter: <b>identifier</b>
12642   * <p>
12643   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
12644   * Type: <b>token</b><br>
12645   * Path: <b>ExplanationOfBenefit.identifier</b><br>
12646   * </p>
12647   */
12648  @SearchParamDefinition(name="identifier", path="ExplanationOfBenefit.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
12649  public static final String SP_IDENTIFIER = "identifier";
12650 /**
12651   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
12652   * <p>
12653   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
12654   * Type: <b>token</b><br>
12655   * Path: <b>ExplanationOfBenefit.identifier</b><br>
12656   * </p>
12657   */
12658  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
12659
12660 /**
12661   * Search parameter: <b>created</b>
12662   * <p>
12663   * Description: <b>The creation date for the EOB</b><br>
12664   * Type: <b>date</b><br>
12665   * Path: <b>ExplanationOfBenefit.created</b><br>
12666   * </p>
12667   */
12668  @SearchParamDefinition(name="created", path="ExplanationOfBenefit.created", description="The creation date for the EOB", type="date" )
12669  public static final String SP_CREATED = "created";
12670 /**
12671   * <b>Fluent Client</b> search parameter constant for <b>created</b>
12672   * <p>
12673   * Description: <b>The creation date for the EOB</b><br>
12674   * Type: <b>date</b><br>
12675   * Path: <b>ExplanationOfBenefit.created</b><br>
12676   * </p>
12677   */
12678  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
12679
12680 /**
12681   * Search parameter: <b>encounter</b>
12682   * <p>
12683   * Description: <b>Encounters associated with a billed line item</b><br>
12684   * Type: <b>reference</b><br>
12685   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
12686   * </p>
12687   */
12688  @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 } )
12689  public static final String SP_ENCOUNTER = "encounter";
12690 /**
12691   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
12692   * <p>
12693   * Description: <b>Encounters associated with a billed line item</b><br>
12694   * Type: <b>reference</b><br>
12695   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
12696   * </p>
12697   */
12698  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
12699
12700/**
12701   * Constant for fluent queries to be used to add include statements. Specifies
12702   * the path value of "<b>ExplanationOfBenefit:encounter</b>".
12703   */
12704  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:encounter").toLocked();
12705
12706 /**
12707   * Search parameter: <b>payee</b>
12708   * <p>
12709   * Description: <b>The party receiving any payment for the Claim</b><br>
12710   * Type: <b>reference</b><br>
12711   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
12712   * </p>
12713   */
12714  @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 } )
12715  public static final String SP_PAYEE = "payee";
12716 /**
12717   * <b>Fluent Client</b> search parameter constant for <b>payee</b>
12718   * <p>
12719   * Description: <b>The party receiving any payment for the Claim</b><br>
12720   * Type: <b>reference</b><br>
12721   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
12722   * </p>
12723   */
12724  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PAYEE);
12725
12726/**
12727   * Constant for fluent queries to be used to add include statements. Specifies
12728   * the path value of "<b>ExplanationOfBenefit:payee</b>".
12729   */
12730  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYEE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:payee").toLocked();
12731
12732 /**
12733   * Search parameter: <b>disposition</b>
12734   * <p>
12735   * Description: <b>The contents of the disposition message</b><br>
12736   * Type: <b>string</b><br>
12737   * Path: <b>ExplanationOfBenefit.disposition</b><br>
12738   * </p>
12739   */
12740  @SearchParamDefinition(name="disposition", path="ExplanationOfBenefit.disposition", description="The contents of the disposition message", type="string" )
12741  public static final String SP_DISPOSITION = "disposition";
12742 /**
12743   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
12744   * <p>
12745   * Description: <b>The contents of the disposition message</b><br>
12746   * Type: <b>string</b><br>
12747   * Path: <b>ExplanationOfBenefit.disposition</b><br>
12748   * </p>
12749   */
12750  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
12751
12752 /**
12753   * Search parameter: <b>provider</b>
12754   * <p>
12755   * Description: <b>The reference to the provider</b><br>
12756   * Type: <b>reference</b><br>
12757   * Path: <b>ExplanationOfBenefit.provider</b><br>
12758   * </p>
12759   */
12760  @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 } )
12761  public static final String SP_PROVIDER = "provider";
12762 /**
12763   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
12764   * <p>
12765   * Description: <b>The reference to the provider</b><br>
12766   * Type: <b>reference</b><br>
12767   * Path: <b>ExplanationOfBenefit.provider</b><br>
12768   * </p>
12769   */
12770  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
12771
12772/**
12773   * Constant for fluent queries to be used to add include statements. Specifies
12774   * the path value of "<b>ExplanationOfBenefit:provider</b>".
12775   */
12776  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:provider").toLocked();
12777
12778 /**
12779   * Search parameter: <b>patient</b>
12780   * <p>
12781   * Description: <b>The reference to the patient</b><br>
12782   * Type: <b>reference</b><br>
12783   * Path: <b>ExplanationOfBenefit.patient</b><br>
12784   * </p>
12785   */
12786  @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 } )
12787  public static final String SP_PATIENT = "patient";
12788 /**
12789   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
12790   * <p>
12791   * Description: <b>The reference to the patient</b><br>
12792   * Type: <b>reference</b><br>
12793   * Path: <b>ExplanationOfBenefit.patient</b><br>
12794   * </p>
12795   */
12796  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
12797
12798/**
12799   * Constant for fluent queries to be used to add include statements. Specifies
12800   * the path value of "<b>ExplanationOfBenefit:patient</b>".
12801   */
12802  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:patient").toLocked();
12803
12804 /**
12805   * Search parameter: <b>claim</b>
12806   * <p>
12807   * Description: <b>The reference to the claim</b><br>
12808   * Type: <b>reference</b><br>
12809   * Path: <b>ExplanationOfBenefit.claim</b><br>
12810   * </p>
12811   */
12812  @SearchParamDefinition(name="claim", path="ExplanationOfBenefit.claim", description="The reference to the claim", type="reference", target={Claim.class } )
12813  public static final String SP_CLAIM = "claim";
12814 /**
12815   * <b>Fluent Client</b> search parameter constant for <b>claim</b>
12816   * <p>
12817   * Description: <b>The reference to the claim</b><br>
12818   * Type: <b>reference</b><br>
12819   * Path: <b>ExplanationOfBenefit.claim</b><br>
12820   * </p>
12821   */
12822  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CLAIM);
12823
12824/**
12825   * Constant for fluent queries to be used to add include statements. Specifies
12826   * the path value of "<b>ExplanationOfBenefit:claim</b>".
12827   */
12828  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:claim").toLocked();
12829
12830 /**
12831   * Search parameter: <b>enterer</b>
12832   * <p>
12833   * Description: <b>The party responsible for the entry of the Claim</b><br>
12834   * Type: <b>reference</b><br>
12835   * Path: <b>ExplanationOfBenefit.enterer</b><br>
12836   * </p>
12837   */
12838  @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 } )
12839  public static final String SP_ENTERER = "enterer";
12840 /**
12841   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
12842   * <p>
12843   * Description: <b>The party responsible for the entry of the Claim</b><br>
12844   * Type: <b>reference</b><br>
12845   * Path: <b>ExplanationOfBenefit.enterer</b><br>
12846   * </p>
12847   */
12848  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTERER);
12849
12850/**
12851   * Constant for fluent queries to be used to add include statements. Specifies
12852   * the path value of "<b>ExplanationOfBenefit:enterer</b>".
12853   */
12854  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:enterer").toLocked();
12855
12856 /**
12857   * Search parameter: <b>facility</b>
12858   * <p>
12859   * Description: <b>Facility responsible for the goods and services</b><br>
12860   * Type: <b>reference</b><br>
12861   * Path: <b>ExplanationOfBenefit.facility</b><br>
12862   * </p>
12863   */
12864  @SearchParamDefinition(name="facility", path="ExplanationOfBenefit.facility", description="Facility responsible for the goods and services", type="reference", target={Location.class } )
12865  public static final String SP_FACILITY = "facility";
12866 /**
12867   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
12868   * <p>
12869   * Description: <b>Facility responsible for the goods and services</b><br>
12870   * Type: <b>reference</b><br>
12871   * Path: <b>ExplanationOfBenefit.facility</b><br>
12872   * </p>
12873   */
12874  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITY);
12875
12876/**
12877   * Constant for fluent queries to be used to add include statements. Specifies
12878   * the path value of "<b>ExplanationOfBenefit:facility</b>".
12879   */
12880  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:facility").toLocked();
12881
12882 /**
12883   * Search parameter: <b>status</b>
12884   * <p>
12885   * Description: <b>Status of the instance</b><br>
12886   * Type: <b>token</b><br>
12887   * Path: <b>ExplanationOfBenefit.status</b><br>
12888   * </p>
12889   */
12890  @SearchParamDefinition(name="status", path="ExplanationOfBenefit.status", description="Status of the instance", type="token" )
12891  public static final String SP_STATUS = "status";
12892 /**
12893   * <b>Fluent Client</b> search parameter constant for <b>status</b>
12894   * <p>
12895   * Description: <b>Status of the instance</b><br>
12896   * Type: <b>token</b><br>
12897   * Path: <b>ExplanationOfBenefit.status</b><br>
12898   * </p>
12899   */
12900  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
12901
12902
12903}
12904