001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Thu, Dec 27, 2018 10:06-0500 for FHIR v4.0.0
033
034import java.util.*;
035
036import java.math.*;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r4.model.Enumerations.*;
039import ca.uhn.fhir.model.api.annotation.ResourceDef;
040import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.ChildOrder;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.Block;
045import org.hl7.fhir.instance.model.api.*;
046import org.hl7.fhir.exceptions.FHIRException;
047/**
048 * This resource provides: the claim details; adjudication details from the processing of a Claim; and optionally account balance information, for informing the subscriber of the benefits provided.
049 */
050@ResourceDef(name="ExplanationOfBenefit", profile="http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit")
051public class ExplanationOfBenefit extends DomainResource {
052
053    public enum ExplanationOfBenefitStatus {
054        /**
055         * The resource instance is currently in-force.
056         */
057        ACTIVE, 
058        /**
059         * The resource instance is withdrawn, rescinded or reversed.
060         */
061        CANCELLED, 
062        /**
063         * A new resource instance the contents of which is not complete.
064         */
065        DRAFT, 
066        /**
067         * The resource instance was entered in error.
068         */
069        ENTEREDINERROR, 
070        /**
071         * added to help the parsers with the generic types
072         */
073        NULL;
074        public static ExplanationOfBenefitStatus fromCode(String codeString) throws FHIRException {
075            if (codeString == null || "".equals(codeString))
076                return null;
077        if ("active".equals(codeString))
078          return ACTIVE;
079        if ("cancelled".equals(codeString))
080          return CANCELLED;
081        if ("draft".equals(codeString))
082          return DRAFT;
083        if ("entered-in-error".equals(codeString))
084          return ENTEREDINERROR;
085        if (Configuration.isAcceptInvalidEnums())
086          return null;
087        else
088          throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
089        }
090        public String toCode() {
091          switch (this) {
092            case ACTIVE: return "active";
093            case CANCELLED: return "cancelled";
094            case DRAFT: return "draft";
095            case ENTEREDINERROR: return "entered-in-error";
096            default: return "?";
097          }
098        }
099        public String getSystem() {
100          switch (this) {
101            case ACTIVE: return "http://hl7.org/fhir/explanationofbenefit-status";
102            case CANCELLED: return "http://hl7.org/fhir/explanationofbenefit-status";
103            case DRAFT: return "http://hl7.org/fhir/explanationofbenefit-status";
104            case ENTEREDINERROR: return "http://hl7.org/fhir/explanationofbenefit-status";
105            default: return "?";
106          }
107        }
108        public String getDefinition() {
109          switch (this) {
110            case ACTIVE: return "The resource instance is currently in-force.";
111            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
112            case DRAFT: return "A new resource instance the contents of which is not complete.";
113            case ENTEREDINERROR: return "The resource instance was entered in error.";
114            default: return "?";
115          }
116        }
117        public String getDisplay() {
118          switch (this) {
119            case ACTIVE: return "Active";
120            case CANCELLED: return "Cancelled";
121            case DRAFT: return "Draft";
122            case ENTEREDINERROR: return "Entered In Error";
123            default: return "?";
124          }
125        }
126    }
127
128  public static class ExplanationOfBenefitStatusEnumFactory implements EnumFactory<ExplanationOfBenefitStatus> {
129    public ExplanationOfBenefitStatus fromCode(String codeString) throws IllegalArgumentException {
130      if (codeString == null || "".equals(codeString))
131            if (codeString == null || "".equals(codeString))
132                return null;
133        if ("active".equals(codeString))
134          return ExplanationOfBenefitStatus.ACTIVE;
135        if ("cancelled".equals(codeString))
136          return ExplanationOfBenefitStatus.CANCELLED;
137        if ("draft".equals(codeString))
138          return ExplanationOfBenefitStatus.DRAFT;
139        if ("entered-in-error".equals(codeString))
140          return ExplanationOfBenefitStatus.ENTEREDINERROR;
141        throw new IllegalArgumentException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
142        }
143        public Enumeration<ExplanationOfBenefitStatus> fromType(Base code) throws FHIRException {
144          if (code == null)
145            return null;
146          if (code.isEmpty())
147            return new Enumeration<ExplanationOfBenefitStatus>(this);
148          String codeString = ((PrimitiveType) code).asStringValue();
149          if (codeString == null || "".equals(codeString))
150            return null;
151        if ("active".equals(codeString))
152          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ACTIVE);
153        if ("cancelled".equals(codeString))
154          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.CANCELLED);
155        if ("draft".equals(codeString))
156          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.DRAFT);
157        if ("entered-in-error".equals(codeString))
158          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ENTEREDINERROR);
159        throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
160        }
161    public String toCode(ExplanationOfBenefitStatus code) {
162      if (code == ExplanationOfBenefitStatus.ACTIVE)
163        return "active";
164      if (code == ExplanationOfBenefitStatus.CANCELLED)
165        return "cancelled";
166      if (code == ExplanationOfBenefitStatus.DRAFT)
167        return "draft";
168      if (code == ExplanationOfBenefitStatus.ENTEREDINERROR)
169        return "entered-in-error";
170      return "?";
171      }
172    public String toSystem(ExplanationOfBenefitStatus code) {
173      return code.getSystem();
174      }
175    }
176
177    public enum Use {
178        /**
179         * The treatment is complete and this represents a Claim for the services.
180         */
181        CLAIM, 
182        /**
183         * The treatment is proposed and this represents a Pre-authorization for the services.
184         */
185        PREAUTHORIZATION, 
186        /**
187         * The treatment is proposed and this represents a Pre-determination for the services.
188         */
189        PREDETERMINATION, 
190        /**
191         * added to help the parsers with the generic types
192         */
193        NULL;
194        public static Use fromCode(String codeString) throws FHIRException {
195            if (codeString == null || "".equals(codeString))
196                return null;
197        if ("claim".equals(codeString))
198          return CLAIM;
199        if ("preauthorization".equals(codeString))
200          return PREAUTHORIZATION;
201        if ("predetermination".equals(codeString))
202          return PREDETERMINATION;
203        if (Configuration.isAcceptInvalidEnums())
204          return null;
205        else
206          throw new FHIRException("Unknown Use code '"+codeString+"'");
207        }
208        public String toCode() {
209          switch (this) {
210            case CLAIM: return "claim";
211            case PREAUTHORIZATION: return "preauthorization";
212            case PREDETERMINATION: return "predetermination";
213            default: return "?";
214          }
215        }
216        public String getSystem() {
217          switch (this) {
218            case CLAIM: return "http://hl7.org/fhir/claim-use";
219            case PREAUTHORIZATION: return "http://hl7.org/fhir/claim-use";
220            case PREDETERMINATION: return "http://hl7.org/fhir/claim-use";
221            default: return "?";
222          }
223        }
224        public String getDefinition() {
225          switch (this) {
226            case CLAIM: return "The treatment is complete and this represents a Claim for the services.";
227            case PREAUTHORIZATION: return "The treatment is proposed and this represents a Pre-authorization for the services.";
228            case PREDETERMINATION: return "The treatment is proposed and this represents a Pre-determination for the services.";
229            default: return "?";
230          }
231        }
232        public String getDisplay() {
233          switch (this) {
234            case CLAIM: return "Claim";
235            case PREAUTHORIZATION: return "Preauthorization";
236            case PREDETERMINATION: return "Predetermination";
237            default: return "?";
238          }
239        }
240    }
241
242  public static class UseEnumFactory implements EnumFactory<Use> {
243    public Use fromCode(String codeString) throws IllegalArgumentException {
244      if (codeString == null || "".equals(codeString))
245            if (codeString == null || "".equals(codeString))
246                return null;
247        if ("claim".equals(codeString))
248          return Use.CLAIM;
249        if ("preauthorization".equals(codeString))
250          return Use.PREAUTHORIZATION;
251        if ("predetermination".equals(codeString))
252          return Use.PREDETERMINATION;
253        throw new IllegalArgumentException("Unknown Use code '"+codeString+"'");
254        }
255        public Enumeration<Use> fromType(Base code) throws FHIRException {
256          if (code == null)
257            return null;
258          if (code.isEmpty())
259            return new Enumeration<Use>(this);
260          String codeString = ((PrimitiveType) code).asStringValue();
261          if (codeString == null || "".equals(codeString))
262            return null;
263        if ("claim".equals(codeString))
264          return new Enumeration<Use>(this, Use.CLAIM);
265        if ("preauthorization".equals(codeString))
266          return new Enumeration<Use>(this, Use.PREAUTHORIZATION);
267        if ("predetermination".equals(codeString))
268          return new Enumeration<Use>(this, Use.PREDETERMINATION);
269        throw new FHIRException("Unknown Use code '"+codeString+"'");
270        }
271    public String toCode(Use code) {
272      if (code == Use.CLAIM)
273        return "claim";
274      if (code == Use.PREAUTHORIZATION)
275        return "preauthorization";
276      if (code == Use.PREDETERMINATION)
277        return "predetermination";
278      return "?";
279      }
280    public String toSystem(Use code) {
281      return code.getSystem();
282      }
283    }
284
285    public enum RemittanceOutcome {
286        /**
287         * The Claim/Pre-authorization/Pre-determination has been received but processing has not begun.
288         */
289        QUEUED, 
290        /**
291         * The processing has completed without errors
292         */
293        COMPLETE, 
294        /**
295         * One or more errors have been detected in the Claim
296         */
297        ERROR, 
298        /**
299         * No errors have been detected in the Claim and some of the adjudication has been performed.
300         */
301        PARTIAL, 
302        /**
303         * added to help the parsers with the generic types
304         */
305        NULL;
306        public static RemittanceOutcome fromCode(String codeString) throws FHIRException {
307            if (codeString == null || "".equals(codeString))
308                return null;
309        if ("queued".equals(codeString))
310          return QUEUED;
311        if ("complete".equals(codeString))
312          return COMPLETE;
313        if ("error".equals(codeString))
314          return ERROR;
315        if ("partial".equals(codeString))
316          return PARTIAL;
317        if (Configuration.isAcceptInvalidEnums())
318          return null;
319        else
320          throw new FHIRException("Unknown RemittanceOutcome code '"+codeString+"'");
321        }
322        public String toCode() {
323          switch (this) {
324            case QUEUED: return "queued";
325            case COMPLETE: return "complete";
326            case ERROR: return "error";
327            case PARTIAL: return "partial";
328            default: return "?";
329          }
330        }
331        public String getSystem() {
332          switch (this) {
333            case QUEUED: return "http://hl7.org/fhir/remittance-outcome";
334            case COMPLETE: return "http://hl7.org/fhir/remittance-outcome";
335            case ERROR: return "http://hl7.org/fhir/remittance-outcome";
336            case PARTIAL: return "http://hl7.org/fhir/remittance-outcome";
337            default: return "?";
338          }
339        }
340        public String getDefinition() {
341          switch (this) {
342            case QUEUED: return "The Claim/Pre-authorization/Pre-determination has been received but processing has not begun.";
343            case COMPLETE: return "The processing has completed without errors";
344            case ERROR: return "One or more errors have been detected in the Claim";
345            case PARTIAL: return "No errors have been detected in the Claim and some of the adjudication has been performed.";
346            default: return "?";
347          }
348        }
349        public String getDisplay() {
350          switch (this) {
351            case QUEUED: return "Queued";
352            case COMPLETE: return "Processing Complete";
353            case ERROR: return "Error";
354            case PARTIAL: return "Partial Processing";
355            default: return "?";
356          }
357        }
358    }
359
360  public static class RemittanceOutcomeEnumFactory implements EnumFactory<RemittanceOutcome> {
361    public RemittanceOutcome fromCode(String codeString) throws IllegalArgumentException {
362      if (codeString == null || "".equals(codeString))
363            if (codeString == null || "".equals(codeString))
364                return null;
365        if ("queued".equals(codeString))
366          return RemittanceOutcome.QUEUED;
367        if ("complete".equals(codeString))
368          return RemittanceOutcome.COMPLETE;
369        if ("error".equals(codeString))
370          return RemittanceOutcome.ERROR;
371        if ("partial".equals(codeString))
372          return RemittanceOutcome.PARTIAL;
373        throw new IllegalArgumentException("Unknown RemittanceOutcome code '"+codeString+"'");
374        }
375        public Enumeration<RemittanceOutcome> fromType(Base code) throws FHIRException {
376          if (code == null)
377            return null;
378          if (code.isEmpty())
379            return new Enumeration<RemittanceOutcome>(this);
380          String codeString = ((PrimitiveType) code).asStringValue();
381          if (codeString == null || "".equals(codeString))
382            return null;
383        if ("queued".equals(codeString))
384          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.QUEUED);
385        if ("complete".equals(codeString))
386          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.COMPLETE);
387        if ("error".equals(codeString))
388          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.ERROR);
389        if ("partial".equals(codeString))
390          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.PARTIAL);
391        throw new FHIRException("Unknown RemittanceOutcome code '"+codeString+"'");
392        }
393    public String toCode(RemittanceOutcome code) {
394      if (code == RemittanceOutcome.QUEUED)
395        return "queued";
396      if (code == RemittanceOutcome.COMPLETE)
397        return "complete";
398      if (code == RemittanceOutcome.ERROR)
399        return "error";
400      if (code == RemittanceOutcome.PARTIAL)
401        return "partial";
402      return "?";
403      }
404    public String toSystem(RemittanceOutcome code) {
405      return code.getSystem();
406      }
407    }
408
409    @Block()
410    public static class RelatedClaimComponent extends BackboneElement implements IBaseBackboneElement {
411        /**
412         * Reference to a related claim.
413         */
414        @Child(name = "claim", type = {Claim.class}, order=1, min=0, max=1, modifier=false, summary=false)
415        @Description(shortDefinition="Reference to the related claim", formalDefinition="Reference to a related claim." )
416        protected Reference claim;
417
418        /**
419         * The actual object that is the target of the reference (Reference to a related claim.)
420         */
421        protected Claim claimTarget;
422
423        /**
424         * A code to convey how the claims are related.
425         */
426        @Child(name = "relationship", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
427        @Description(shortDefinition="How the reference claim is related", formalDefinition="A code to convey how the claims are related." )
428        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-claim-relationship")
429        protected CodeableConcept relationship;
430
431        /**
432         * An alternate organizational reference to the case or file to which this particular claim pertains.
433         */
434        @Child(name = "reference", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=false)
435        @Description(shortDefinition="File or case reference", formalDefinition="An alternate organizational reference to the case or file to which this particular claim pertains." )
436        protected Identifier reference;
437
438        private static final long serialVersionUID = -379338905L;
439
440    /**
441     * Constructor
442     */
443      public RelatedClaimComponent() {
444        super();
445      }
446
447        /**
448         * @return {@link #claim} (Reference to a related claim.)
449         */
450        public Reference getClaim() { 
451          if (this.claim == null)
452            if (Configuration.errorOnAutoCreate())
453              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
454            else if (Configuration.doAutoCreate())
455              this.claim = new Reference(); // cc
456          return this.claim;
457        }
458
459        public boolean hasClaim() { 
460          return this.claim != null && !this.claim.isEmpty();
461        }
462
463        /**
464         * @param value {@link #claim} (Reference to a related claim.)
465         */
466        public RelatedClaimComponent setClaim(Reference value) { 
467          this.claim = value;
468          return this;
469        }
470
471        /**
472         * @return {@link #claim} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Reference to a related claim.)
473         */
474        public Claim getClaimTarget() { 
475          if (this.claimTarget == null)
476            if (Configuration.errorOnAutoCreate())
477              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
478            else if (Configuration.doAutoCreate())
479              this.claimTarget = new Claim(); // aa
480          return this.claimTarget;
481        }
482
483        /**
484         * @param value {@link #claim} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Reference to a related claim.)
485         */
486        public RelatedClaimComponent setClaimTarget(Claim value) { 
487          this.claimTarget = value;
488          return this;
489        }
490
491        /**
492         * @return {@link #relationship} (A code to convey how the claims are related.)
493         */
494        public CodeableConcept getRelationship() { 
495          if (this.relationship == null)
496            if (Configuration.errorOnAutoCreate())
497              throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
498            else if (Configuration.doAutoCreate())
499              this.relationship = new CodeableConcept(); // cc
500          return this.relationship;
501        }
502
503        public boolean hasRelationship() { 
504          return this.relationship != null && !this.relationship.isEmpty();
505        }
506
507        /**
508         * @param value {@link #relationship} (A code to convey how the claims are related.)
509         */
510        public RelatedClaimComponent setRelationship(CodeableConcept value) { 
511          this.relationship = value;
512          return this;
513        }
514
515        /**
516         * @return {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
517         */
518        public Identifier getReference() { 
519          if (this.reference == null)
520            if (Configuration.errorOnAutoCreate())
521              throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
522            else if (Configuration.doAutoCreate())
523              this.reference = new Identifier(); // cc
524          return this.reference;
525        }
526
527        public boolean hasReference() { 
528          return this.reference != null && !this.reference.isEmpty();
529        }
530
531        /**
532         * @param value {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
533         */
534        public RelatedClaimComponent setReference(Identifier value) { 
535          this.reference = value;
536          return this;
537        }
538
539        protected void listChildren(List<Property> children) {
540          super.listChildren(children);
541          children.add(new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim));
542          children.add(new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship));
543          children.add(new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1, reference));
544        }
545
546        @Override
547        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
548          switch (_hash) {
549          case 94742588: /*claim*/  return new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim);
550          case -261851592: /*relationship*/  return new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship);
551          case -925155509: /*reference*/  return new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1, reference);
552          default: return super.getNamedProperty(_hash, _name, _checkValid);
553          }
554
555        }
556
557      @Override
558      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
559        switch (hash) {
560        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
561        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
562        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Identifier
563        default: return super.getProperty(hash, name, checkValid);
564        }
565
566      }
567
568      @Override
569      public Base setProperty(int hash, String name, Base value) throws FHIRException {
570        switch (hash) {
571        case 94742588: // claim
572          this.claim = castToReference(value); // Reference
573          return value;
574        case -261851592: // relationship
575          this.relationship = castToCodeableConcept(value); // CodeableConcept
576          return value;
577        case -925155509: // reference
578          this.reference = castToIdentifier(value); // Identifier
579          return value;
580        default: return super.setProperty(hash, name, value);
581        }
582
583      }
584
585      @Override
586      public Base setProperty(String name, Base value) throws FHIRException {
587        if (name.equals("claim")) {
588          this.claim = castToReference(value); // Reference
589        } else if (name.equals("relationship")) {
590          this.relationship = castToCodeableConcept(value); // CodeableConcept
591        } else if (name.equals("reference")) {
592          this.reference = castToIdentifier(value); // Identifier
593        } else
594          return super.setProperty(name, value);
595        return value;
596      }
597
598      @Override
599      public Base makeProperty(int hash, String name) throws FHIRException {
600        switch (hash) {
601        case 94742588:  return getClaim(); 
602        case -261851592:  return getRelationship(); 
603        case -925155509:  return getReference(); 
604        default: return super.makeProperty(hash, name);
605        }
606
607      }
608
609      @Override
610      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
611        switch (hash) {
612        case 94742588: /*claim*/ return new String[] {"Reference"};
613        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
614        case -925155509: /*reference*/ return new String[] {"Identifier"};
615        default: return super.getTypesForProperty(hash, name);
616        }
617
618      }
619
620      @Override
621      public Base addChild(String name) throws FHIRException {
622        if (name.equals("claim")) {
623          this.claim = new Reference();
624          return this.claim;
625        }
626        else if (name.equals("relationship")) {
627          this.relationship = new CodeableConcept();
628          return this.relationship;
629        }
630        else if (name.equals("reference")) {
631          this.reference = new Identifier();
632          return this.reference;
633        }
634        else
635          return super.addChild(name);
636      }
637
638      public RelatedClaimComponent copy() {
639        RelatedClaimComponent dst = new RelatedClaimComponent();
640        copyValues(dst);
641        dst.claim = claim == null ? null : claim.copy();
642        dst.relationship = relationship == null ? null : relationship.copy();
643        dst.reference = reference == null ? null : reference.copy();
644        return dst;
645      }
646
647      @Override
648      public boolean equalsDeep(Base other_) {
649        if (!super.equalsDeep(other_))
650          return false;
651        if (!(other_ instanceof RelatedClaimComponent))
652          return false;
653        RelatedClaimComponent o = (RelatedClaimComponent) other_;
654        return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true) && compareDeep(reference, o.reference, true)
655          ;
656      }
657
658      @Override
659      public boolean equalsShallow(Base other_) {
660        if (!super.equalsShallow(other_))
661          return false;
662        if (!(other_ instanceof RelatedClaimComponent))
663          return false;
664        RelatedClaimComponent o = (RelatedClaimComponent) other_;
665        return true;
666      }
667
668      public boolean isEmpty() {
669        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference
670          );
671      }
672
673  public String fhirType() {
674    return "ExplanationOfBenefit.related";
675
676  }
677
678  }
679
680    @Block()
681    public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
682        /**
683         * Type of Party to be reimbursed: Subscriber, provider, other.
684         */
685        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
686        @Description(shortDefinition="Category of recipient", formalDefinition="Type of Party to be reimbursed: Subscriber, provider, other." )
687        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payeetype")
688        protected CodeableConcept type;
689
690        /**
691         * Reference to the individual or organization to whom any payment will be made.
692         */
693        @Child(name = "party", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, RelatedPerson.class}, order=2, min=0, max=1, modifier=false, summary=false)
694        @Description(shortDefinition="Recipient reference", formalDefinition="Reference to the individual or organization to whom any payment will be made." )
695        protected Reference party;
696
697        /**
698         * The actual object that is the target of the reference (Reference to the individual or organization to whom any payment will be made.)
699         */
700        protected Resource partyTarget;
701
702        private static final long serialVersionUID = 1609484699L;
703
704    /**
705     * Constructor
706     */
707      public PayeeComponent() {
708        super();
709      }
710
711        /**
712         * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
713         */
714        public CodeableConcept getType() { 
715          if (this.type == null)
716            if (Configuration.errorOnAutoCreate())
717              throw new Error("Attempt to auto-create PayeeComponent.type");
718            else if (Configuration.doAutoCreate())
719              this.type = new CodeableConcept(); // cc
720          return this.type;
721        }
722
723        public boolean hasType() { 
724          return this.type != null && !this.type.isEmpty();
725        }
726
727        /**
728         * @param value {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
729         */
730        public PayeeComponent setType(CodeableConcept value) { 
731          this.type = value;
732          return this;
733        }
734
735        /**
736         * @return {@link #party} (Reference to the individual or organization to whom any payment will be made.)
737         */
738        public Reference getParty() { 
739          if (this.party == null)
740            if (Configuration.errorOnAutoCreate())
741              throw new Error("Attempt to auto-create PayeeComponent.party");
742            else if (Configuration.doAutoCreate())
743              this.party = new Reference(); // cc
744          return this.party;
745        }
746
747        public boolean hasParty() { 
748          return this.party != null && !this.party.isEmpty();
749        }
750
751        /**
752         * @param value {@link #party} (Reference to the individual or organization to whom any payment will be made.)
753         */
754        public PayeeComponent setParty(Reference value) { 
755          this.party = value;
756          return this;
757        }
758
759        /**
760         * @return {@link #party} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Reference to the individual or organization to whom any payment will be made.)
761         */
762        public Resource getPartyTarget() { 
763          return this.partyTarget;
764        }
765
766        /**
767         * @param value {@link #party} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Reference to the individual or organization to whom any payment will be made.)
768         */
769        public PayeeComponent setPartyTarget(Resource value) { 
770          this.partyTarget = value;
771          return this;
772        }
773
774        protected void listChildren(List<Property> children) {
775          super.listChildren(children);
776          children.add(new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type));
777          children.add(new Property("party", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)", "Reference to the individual or organization to whom any payment will be made.", 0, 1, party));
778        }
779
780        @Override
781        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
782          switch (_hash) {
783          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type);
784          case 106437350: /*party*/  return new Property("party", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)", "Reference to the individual or organization to whom any payment will be made.", 0, 1, party);
785          default: return super.getNamedProperty(_hash, _name, _checkValid);
786          }
787
788        }
789
790      @Override
791      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
792        switch (hash) {
793        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
794        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
795        default: return super.getProperty(hash, name, checkValid);
796        }
797
798      }
799
800      @Override
801      public Base setProperty(int hash, String name, Base value) throws FHIRException {
802        switch (hash) {
803        case 3575610: // type
804          this.type = castToCodeableConcept(value); // CodeableConcept
805          return value;
806        case 106437350: // party
807          this.party = castToReference(value); // Reference
808          return value;
809        default: return super.setProperty(hash, name, value);
810        }
811
812      }
813
814      @Override
815      public Base setProperty(String name, Base value) throws FHIRException {
816        if (name.equals("type")) {
817          this.type = castToCodeableConcept(value); // CodeableConcept
818        } else if (name.equals("party")) {
819          this.party = castToReference(value); // Reference
820        } else
821          return super.setProperty(name, value);
822        return value;
823      }
824
825      @Override
826      public Base makeProperty(int hash, String name) throws FHIRException {
827        switch (hash) {
828        case 3575610:  return getType(); 
829        case 106437350:  return getParty(); 
830        default: return super.makeProperty(hash, name);
831        }
832
833      }
834
835      @Override
836      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
837        switch (hash) {
838        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
839        case 106437350: /*party*/ return new String[] {"Reference"};
840        default: return super.getTypesForProperty(hash, name);
841        }
842
843      }
844
845      @Override
846      public Base addChild(String name) throws FHIRException {
847        if (name.equals("type")) {
848          this.type = new CodeableConcept();
849          return this.type;
850        }
851        else if (name.equals("party")) {
852          this.party = new Reference();
853          return this.party;
854        }
855        else
856          return super.addChild(name);
857      }
858
859      public PayeeComponent copy() {
860        PayeeComponent dst = new PayeeComponent();
861        copyValues(dst);
862        dst.type = type == null ? null : type.copy();
863        dst.party = party == null ? null : party.copy();
864        return dst;
865      }
866
867      @Override
868      public boolean equalsDeep(Base other_) {
869        if (!super.equalsDeep(other_))
870          return false;
871        if (!(other_ instanceof PayeeComponent))
872          return false;
873        PayeeComponent o = (PayeeComponent) other_;
874        return compareDeep(type, o.type, true) && compareDeep(party, o.party, true);
875      }
876
877      @Override
878      public boolean equalsShallow(Base other_) {
879        if (!super.equalsShallow(other_))
880          return false;
881        if (!(other_ instanceof PayeeComponent))
882          return false;
883        PayeeComponent o = (PayeeComponent) other_;
884        return true;
885      }
886
887      public boolean isEmpty() {
888        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party);
889      }
890
891  public String fhirType() {
892    return "ExplanationOfBenefit.payee";
893
894  }
895
896  }
897
898    @Block()
899    public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
900        /**
901         * A number to uniquely identify care team entries.
902         */
903        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
904        @Description(shortDefinition="Order of care team", formalDefinition="A number to uniquely identify care team entries." )
905        protected PositiveIntType sequence;
906
907        /**
908         * Member of the team who provided the product or service.
909         */
910        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=2, min=1, max=1, modifier=false, summary=false)
911        @Description(shortDefinition="Practitioner or organization", formalDefinition="Member of the team who provided the product or service." )
912        protected Reference provider;
913
914        /**
915         * The actual object that is the target of the reference (Member of the team who provided the product or service.)
916         */
917        protected Resource providerTarget;
918
919        /**
920         * The party who is billing and/or responsible for the claimed products or services.
921         */
922        @Child(name = "responsible", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
923        @Description(shortDefinition="Indicator of the lead practitioner", formalDefinition="The party who is billing and/or responsible for the claimed products or services." )
924        protected BooleanType responsible;
925
926        /**
927         * The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.
928         */
929        @Child(name = "role", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
930        @Description(shortDefinition="Function within the team", formalDefinition="The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team." )
931        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-careteamrole")
932        protected CodeableConcept role;
933
934        /**
935         * The qualification of the practitioner which is applicable for this service.
936         */
937        @Child(name = "qualification", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
938        @Description(shortDefinition="Practitioner credential or specialization", formalDefinition="The qualification of the practitioner which is applicable for this service." )
939        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provider-qualification")
940        protected CodeableConcept qualification;
941
942        private static final long serialVersionUID = 1758966968L;
943
944    /**
945     * Constructor
946     */
947      public CareTeamComponent() {
948        super();
949      }
950
951    /**
952     * Constructor
953     */
954      public CareTeamComponent(PositiveIntType sequence, Reference provider) {
955        super();
956        this.sequence = sequence;
957        this.provider = provider;
958      }
959
960        /**
961         * @return {@link #sequence} (A number to uniquely identify care team entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
962         */
963        public PositiveIntType getSequenceElement() { 
964          if (this.sequence == null)
965            if (Configuration.errorOnAutoCreate())
966              throw new Error("Attempt to auto-create CareTeamComponent.sequence");
967            else if (Configuration.doAutoCreate())
968              this.sequence = new PositiveIntType(); // bb
969          return this.sequence;
970        }
971
972        public boolean hasSequenceElement() { 
973          return this.sequence != null && !this.sequence.isEmpty();
974        }
975
976        public boolean hasSequence() { 
977          return this.sequence != null && !this.sequence.isEmpty();
978        }
979
980        /**
981         * @param value {@link #sequence} (A number to uniquely identify care team entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
982         */
983        public CareTeamComponent setSequenceElement(PositiveIntType value) { 
984          this.sequence = value;
985          return this;
986        }
987
988        /**
989         * @return A number to uniquely identify care team entries.
990         */
991        public int getSequence() { 
992          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
993        }
994
995        /**
996         * @param value A number to uniquely identify care team entries.
997         */
998        public CareTeamComponent setSequence(int value) { 
999            if (this.sequence == null)
1000              this.sequence = new PositiveIntType();
1001            this.sequence.setValue(value);
1002          return this;
1003        }
1004
1005        /**
1006         * @return {@link #provider} (Member of the team who provided the product or service.)
1007         */
1008        public Reference getProvider() { 
1009          if (this.provider == null)
1010            if (Configuration.errorOnAutoCreate())
1011              throw new Error("Attempt to auto-create CareTeamComponent.provider");
1012            else if (Configuration.doAutoCreate())
1013              this.provider = new Reference(); // cc
1014          return this.provider;
1015        }
1016
1017        public boolean hasProvider() { 
1018          return this.provider != null && !this.provider.isEmpty();
1019        }
1020
1021        /**
1022         * @param value {@link #provider} (Member of the team who provided the product or service.)
1023         */
1024        public CareTeamComponent setProvider(Reference value) { 
1025          this.provider = value;
1026          return this;
1027        }
1028
1029        /**
1030         * @return {@link #provider} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Member of the team who provided the product or service.)
1031         */
1032        public Resource getProviderTarget() { 
1033          return this.providerTarget;
1034        }
1035
1036        /**
1037         * @param value {@link #provider} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Member of the team who provided the product or service.)
1038         */
1039        public CareTeamComponent setProviderTarget(Resource value) { 
1040          this.providerTarget = value;
1041          return this;
1042        }
1043
1044        /**
1045         * @return {@link #responsible} (The party who is billing and/or responsible for the claimed products or services.). This is the underlying object with id, value and extensions. The accessor "getResponsible" gives direct access to the value
1046         */
1047        public BooleanType getResponsibleElement() { 
1048          if (this.responsible == null)
1049            if (Configuration.errorOnAutoCreate())
1050              throw new Error("Attempt to auto-create CareTeamComponent.responsible");
1051            else if (Configuration.doAutoCreate())
1052              this.responsible = new BooleanType(); // bb
1053          return this.responsible;
1054        }
1055
1056        public boolean hasResponsibleElement() { 
1057          return this.responsible != null && !this.responsible.isEmpty();
1058        }
1059
1060        public boolean hasResponsible() { 
1061          return this.responsible != null && !this.responsible.isEmpty();
1062        }
1063
1064        /**
1065         * @param value {@link #responsible} (The party who is billing and/or responsible for the claimed products or services.). This is the underlying object with id, value and extensions. The accessor "getResponsible" gives direct access to the value
1066         */
1067        public CareTeamComponent setResponsibleElement(BooleanType value) { 
1068          this.responsible = value;
1069          return this;
1070        }
1071
1072        /**
1073         * @return The party who is billing and/or responsible for the claimed products or services.
1074         */
1075        public boolean getResponsible() { 
1076          return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
1077        }
1078
1079        /**
1080         * @param value The party who is billing and/or responsible for the claimed products or services.
1081         */
1082        public CareTeamComponent setResponsible(boolean value) { 
1083            if (this.responsible == null)
1084              this.responsible = new BooleanType();
1085            this.responsible.setValue(value);
1086          return this;
1087        }
1088
1089        /**
1090         * @return {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.)
1091         */
1092        public CodeableConcept getRole() { 
1093          if (this.role == null)
1094            if (Configuration.errorOnAutoCreate())
1095              throw new Error("Attempt to auto-create CareTeamComponent.role");
1096            else if (Configuration.doAutoCreate())
1097              this.role = new CodeableConcept(); // cc
1098          return this.role;
1099        }
1100
1101        public boolean hasRole() { 
1102          return this.role != null && !this.role.isEmpty();
1103        }
1104
1105        /**
1106         * @param value {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.)
1107         */
1108        public CareTeamComponent setRole(CodeableConcept value) { 
1109          this.role = value;
1110          return this;
1111        }
1112
1113        /**
1114         * @return {@link #qualification} (The qualification of the practitioner which is applicable for this service.)
1115         */
1116        public CodeableConcept getQualification() { 
1117          if (this.qualification == null)
1118            if (Configuration.errorOnAutoCreate())
1119              throw new Error("Attempt to auto-create CareTeamComponent.qualification");
1120            else if (Configuration.doAutoCreate())
1121              this.qualification = new CodeableConcept(); // cc
1122          return this.qualification;
1123        }
1124
1125        public boolean hasQualification() { 
1126          return this.qualification != null && !this.qualification.isEmpty();
1127        }
1128
1129        /**
1130         * @param value {@link #qualification} (The qualification of the practitioner which is applicable for this service.)
1131         */
1132        public CareTeamComponent setQualification(CodeableConcept value) { 
1133          this.qualification = value;
1134          return this;
1135        }
1136
1137        protected void listChildren(List<Property> children) {
1138          super.listChildren(children);
1139          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence));
1140          children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "Member of the team who provided the product or service.", 0, 1, provider));
1141          children.add(new Property("responsible", "boolean", "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible));
1142          children.add(new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1, role));
1143          children.add(new Property("qualification", "CodeableConcept", "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification));
1144        }
1145
1146        @Override
1147        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1148          switch (_hash) {
1149          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence);
1150          case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "Member of the team who provided the product or service.", 0, 1, provider);
1151          case 1847674614: /*responsible*/  return new Property("responsible", "boolean", "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible);
1152          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1, role);
1153          case -631333393: /*qualification*/  return new Property("qualification", "CodeableConcept", "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification);
1154          default: return super.getNamedProperty(_hash, _name, _checkValid);
1155          }
1156
1157        }
1158
1159      @Override
1160      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1161        switch (hash) {
1162        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1163        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
1164        case 1847674614: /*responsible*/ return this.responsible == null ? new Base[0] : new Base[] {this.responsible}; // BooleanType
1165        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
1166        case -631333393: /*qualification*/ return this.qualification == null ? new Base[0] : new Base[] {this.qualification}; // CodeableConcept
1167        default: return super.getProperty(hash, name, checkValid);
1168        }
1169
1170      }
1171
1172      @Override
1173      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1174        switch (hash) {
1175        case 1349547969: // sequence
1176          this.sequence = castToPositiveInt(value); // PositiveIntType
1177          return value;
1178        case -987494927: // provider
1179          this.provider = castToReference(value); // Reference
1180          return value;
1181        case 1847674614: // responsible
1182          this.responsible = castToBoolean(value); // BooleanType
1183          return value;
1184        case 3506294: // role
1185          this.role = castToCodeableConcept(value); // CodeableConcept
1186          return value;
1187        case -631333393: // qualification
1188          this.qualification = castToCodeableConcept(value); // CodeableConcept
1189          return value;
1190        default: return super.setProperty(hash, name, value);
1191        }
1192
1193      }
1194
1195      @Override
1196      public Base setProperty(String name, Base value) throws FHIRException {
1197        if (name.equals("sequence")) {
1198          this.sequence = castToPositiveInt(value); // PositiveIntType
1199        } else if (name.equals("provider")) {
1200          this.provider = castToReference(value); // Reference
1201        } else if (name.equals("responsible")) {
1202          this.responsible = castToBoolean(value); // BooleanType
1203        } else if (name.equals("role")) {
1204          this.role = castToCodeableConcept(value); // CodeableConcept
1205        } else if (name.equals("qualification")) {
1206          this.qualification = castToCodeableConcept(value); // CodeableConcept
1207        } else
1208          return super.setProperty(name, value);
1209        return value;
1210      }
1211
1212      @Override
1213      public Base makeProperty(int hash, String name) throws FHIRException {
1214        switch (hash) {
1215        case 1349547969:  return getSequenceElement();
1216        case -987494927:  return getProvider(); 
1217        case 1847674614:  return getResponsibleElement();
1218        case 3506294:  return getRole(); 
1219        case -631333393:  return getQualification(); 
1220        default: return super.makeProperty(hash, name);
1221        }
1222
1223      }
1224
1225      @Override
1226      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1227        switch (hash) {
1228        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1229        case -987494927: /*provider*/ return new String[] {"Reference"};
1230        case 1847674614: /*responsible*/ return new String[] {"boolean"};
1231        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
1232        case -631333393: /*qualification*/ return new String[] {"CodeableConcept"};
1233        default: return super.getTypesForProperty(hash, name);
1234        }
1235
1236      }
1237
1238      @Override
1239      public Base addChild(String name) throws FHIRException {
1240        if (name.equals("sequence")) {
1241          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1242        }
1243        else if (name.equals("provider")) {
1244          this.provider = new Reference();
1245          return this.provider;
1246        }
1247        else if (name.equals("responsible")) {
1248          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.responsible");
1249        }
1250        else if (name.equals("role")) {
1251          this.role = new CodeableConcept();
1252          return this.role;
1253        }
1254        else if (name.equals("qualification")) {
1255          this.qualification = new CodeableConcept();
1256          return this.qualification;
1257        }
1258        else
1259          return super.addChild(name);
1260      }
1261
1262      public CareTeamComponent copy() {
1263        CareTeamComponent dst = new CareTeamComponent();
1264        copyValues(dst);
1265        dst.sequence = sequence == null ? null : sequence.copy();
1266        dst.provider = provider == null ? null : provider.copy();
1267        dst.responsible = responsible == null ? null : responsible.copy();
1268        dst.role = role == null ? null : role.copy();
1269        dst.qualification = qualification == null ? null : qualification.copy();
1270        return dst;
1271      }
1272
1273      @Override
1274      public boolean equalsDeep(Base other_) {
1275        if (!super.equalsDeep(other_))
1276          return false;
1277        if (!(other_ instanceof CareTeamComponent))
1278          return false;
1279        CareTeamComponent o = (CareTeamComponent) other_;
1280        return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true) && compareDeep(responsible, o.responsible, true)
1281           && compareDeep(role, o.role, true) && compareDeep(qualification, o.qualification, true);
1282      }
1283
1284      @Override
1285      public boolean equalsShallow(Base other_) {
1286        if (!super.equalsShallow(other_))
1287          return false;
1288        if (!(other_ instanceof CareTeamComponent))
1289          return false;
1290        CareTeamComponent o = (CareTeamComponent) other_;
1291        return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true)
1292          ;
1293      }
1294
1295      public boolean isEmpty() {
1296        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible
1297          , role, qualification);
1298      }
1299
1300  public String fhirType() {
1301    return "ExplanationOfBenefit.careTeam";
1302
1303  }
1304
1305  }
1306
1307    @Block()
1308    public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
1309        /**
1310         * A number to uniquely identify supporting information entries.
1311         */
1312        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1313        @Description(shortDefinition="Information instance identifier", formalDefinition="A number to uniquely identify supporting information entries." )
1314        protected PositiveIntType sequence;
1315
1316        /**
1317         * The general class of the information supplied: information; exception; accident, employment; onset, etc.
1318         */
1319        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
1320        @Description(shortDefinition="Classification of the supplied information", formalDefinition="The general class of the information supplied: information; exception; accident, employment; onset, etc." )
1321        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-informationcategory")
1322        protected CodeableConcept category;
1323
1324        /**
1325         * System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.
1326         */
1327        @Child(name = "code", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1328        @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." )
1329        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-exception")
1330        protected CodeableConcept code;
1331
1332        /**
1333         * The date when or period to which this information refers.
1334         */
1335        @Child(name = "timing", type = {DateType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
1336        @Description(shortDefinition="When it occurred", formalDefinition="The date when or period to which this information refers." )
1337        protected Type timing;
1338
1339        /**
1340         * Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.
1341         */
1342        @Child(name = "value", type = {BooleanType.class, StringType.class, Quantity.class, Attachment.class, Reference.class}, order=5, min=0, max=1, modifier=false, summary=false)
1343        @Description(shortDefinition="Data to be provided", formalDefinition="Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data." )
1344        protected Type value;
1345
1346        /**
1347         * Provides the reason in the situation where a reason code is required in addition to the content.
1348         */
1349        @Child(name = "reason", type = {Coding.class}, order=6, min=0, max=1, modifier=false, summary=false)
1350        @Description(shortDefinition="Explanation for the information", formalDefinition="Provides the reason in the situation where a reason code is required in addition to the content." )
1351        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/missing-tooth-reason")
1352        protected Coding reason;
1353
1354        private static final long serialVersionUID = -410136661L;
1355
1356    /**
1357     * Constructor
1358     */
1359      public SupportingInformationComponent() {
1360        super();
1361      }
1362
1363    /**
1364     * Constructor
1365     */
1366      public SupportingInformationComponent(PositiveIntType sequence, CodeableConcept category) {
1367        super();
1368        this.sequence = sequence;
1369        this.category = category;
1370      }
1371
1372        /**
1373         * @return {@link #sequence} (A number to uniquely identify supporting information entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1374         */
1375        public PositiveIntType getSequenceElement() { 
1376          if (this.sequence == null)
1377            if (Configuration.errorOnAutoCreate())
1378              throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
1379            else if (Configuration.doAutoCreate())
1380              this.sequence = new PositiveIntType(); // bb
1381          return this.sequence;
1382        }
1383
1384        public boolean hasSequenceElement() { 
1385          return this.sequence != null && !this.sequence.isEmpty();
1386        }
1387
1388        public boolean hasSequence() { 
1389          return this.sequence != null && !this.sequence.isEmpty();
1390        }
1391
1392        /**
1393         * @param value {@link #sequence} (A number to uniquely identify supporting information entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1394         */
1395        public SupportingInformationComponent setSequenceElement(PositiveIntType value) { 
1396          this.sequence = value;
1397          return this;
1398        }
1399
1400        /**
1401         * @return A number to uniquely identify supporting information entries.
1402         */
1403        public int getSequence() { 
1404          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1405        }
1406
1407        /**
1408         * @param value A number to uniquely identify supporting information entries.
1409         */
1410        public SupportingInformationComponent setSequence(int value) { 
1411            if (this.sequence == null)
1412              this.sequence = new PositiveIntType();
1413            this.sequence.setValue(value);
1414          return this;
1415        }
1416
1417        /**
1418         * @return {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1419         */
1420        public CodeableConcept getCategory() { 
1421          if (this.category == null)
1422            if (Configuration.errorOnAutoCreate())
1423              throw new Error("Attempt to auto-create SupportingInformationComponent.category");
1424            else if (Configuration.doAutoCreate())
1425              this.category = new CodeableConcept(); // cc
1426          return this.category;
1427        }
1428
1429        public boolean hasCategory() { 
1430          return this.category != null && !this.category.isEmpty();
1431        }
1432
1433        /**
1434         * @param value {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1435         */
1436        public SupportingInformationComponent setCategory(CodeableConcept value) { 
1437          this.category = value;
1438          return this;
1439        }
1440
1441        /**
1442         * @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.)
1443         */
1444        public CodeableConcept getCode() { 
1445          if (this.code == null)
1446            if (Configuration.errorOnAutoCreate())
1447              throw new Error("Attempt to auto-create SupportingInformationComponent.code");
1448            else if (Configuration.doAutoCreate())
1449              this.code = new CodeableConcept(); // cc
1450          return this.code;
1451        }
1452
1453        public boolean hasCode() { 
1454          return this.code != null && !this.code.isEmpty();
1455        }
1456
1457        /**
1458         * @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.)
1459         */
1460        public SupportingInformationComponent setCode(CodeableConcept value) { 
1461          this.code = value;
1462          return this;
1463        }
1464
1465        /**
1466         * @return {@link #timing} (The date when or period to which this information refers.)
1467         */
1468        public Type getTiming() { 
1469          return this.timing;
1470        }
1471
1472        /**
1473         * @return {@link #timing} (The date when or period to which this information refers.)
1474         */
1475        public DateType getTimingDateType() throws FHIRException { 
1476          if (this.timing == null)
1477            this.timing = new DateType();
1478          if (!(this.timing instanceof DateType))
1479            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.timing.getClass().getName()+" was encountered");
1480          return (DateType) this.timing;
1481        }
1482
1483        public boolean hasTimingDateType() { 
1484          return this != null && this.timing instanceof DateType;
1485        }
1486
1487        /**
1488         * @return {@link #timing} (The date when or period to which this information refers.)
1489         */
1490        public Period getTimingPeriod() throws FHIRException { 
1491          if (this.timing == null)
1492            this.timing = new Period();
1493          if (!(this.timing instanceof Period))
1494            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
1495          return (Period) this.timing;
1496        }
1497
1498        public boolean hasTimingPeriod() { 
1499          return this != null && this.timing instanceof Period;
1500        }
1501
1502        public boolean hasTiming() { 
1503          return this.timing != null && !this.timing.isEmpty();
1504        }
1505
1506        /**
1507         * @param value {@link #timing} (The date when or period to which this information refers.)
1508         */
1509        public SupportingInformationComponent setTiming(Type value) { 
1510          if (value != null && !(value instanceof DateType || value instanceof Period))
1511            throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.timing[x]: "+value.fhirType());
1512          this.timing = value;
1513          return this;
1514        }
1515
1516        /**
1517         * @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.)
1518         */
1519        public Type getValue() { 
1520          return this.value;
1521        }
1522
1523        /**
1524         * @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.)
1525         */
1526        public BooleanType getValueBooleanType() throws FHIRException { 
1527          if (this.value == null)
1528            this.value = new BooleanType();
1529          if (!(this.value instanceof BooleanType))
1530            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
1531          return (BooleanType) this.value;
1532        }
1533
1534        public boolean hasValueBooleanType() { 
1535          return this != null && this.value instanceof BooleanType;
1536        }
1537
1538        /**
1539         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
1540         */
1541        public StringType getValueStringType() throws FHIRException { 
1542          if (this.value == null)
1543            this.value = new StringType();
1544          if (!(this.value instanceof StringType))
1545            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
1546          return (StringType) this.value;
1547        }
1548
1549        public boolean hasValueStringType() { 
1550          return this != null && this.value instanceof StringType;
1551        }
1552
1553        /**
1554         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
1555         */
1556        public Quantity getValueQuantity() throws FHIRException { 
1557          if (this.value == null)
1558            this.value = new Quantity();
1559          if (!(this.value instanceof Quantity))
1560            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
1561          return (Quantity) this.value;
1562        }
1563
1564        public boolean hasValueQuantity() { 
1565          return this != null && this.value instanceof Quantity;
1566        }
1567
1568        /**
1569         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
1570         */
1571        public Attachment getValueAttachment() throws FHIRException { 
1572          if (this.value == null)
1573            this.value = new Attachment();
1574          if (!(this.value instanceof Attachment))
1575            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
1576          return (Attachment) this.value;
1577        }
1578
1579        public boolean hasValueAttachment() { 
1580          return this != null && this.value instanceof Attachment;
1581        }
1582
1583        /**
1584         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
1585         */
1586        public Reference getValueReference() throws FHIRException { 
1587          if (this.value == null)
1588            this.value = new Reference();
1589          if (!(this.value instanceof Reference))
1590            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
1591          return (Reference) this.value;
1592        }
1593
1594        public boolean hasValueReference() { 
1595          return this != null && this.value instanceof Reference;
1596        }
1597
1598        public boolean hasValue() { 
1599          return this.value != null && !this.value.isEmpty();
1600        }
1601
1602        /**
1603         * @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.)
1604         */
1605        public SupportingInformationComponent setValue(Type value) { 
1606          if (value != null && !(value instanceof BooleanType || value instanceof StringType || value instanceof Quantity || value instanceof Attachment || value instanceof Reference))
1607            throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.value[x]: "+value.fhirType());
1608          this.value = value;
1609          return this;
1610        }
1611
1612        /**
1613         * @return {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1614         */
1615        public Coding getReason() { 
1616          if (this.reason == null)
1617            if (Configuration.errorOnAutoCreate())
1618              throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1619            else if (Configuration.doAutoCreate())
1620              this.reason = new Coding(); // cc
1621          return this.reason;
1622        }
1623
1624        public boolean hasReason() { 
1625          return this.reason != null && !this.reason.isEmpty();
1626        }
1627
1628        /**
1629         * @param value {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1630         */
1631        public SupportingInformationComponent setReason(Coding value) { 
1632          this.reason = value;
1633          return this;
1634        }
1635
1636        protected void listChildren(List<Property> children) {
1637          super.listChildren(children);
1638          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence));
1639          children.add(new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category));
1640          children.add(new Property("code", "CodeableConcept", "System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.", 0, 1, code));
1641          children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing));
1642          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));
1643          children.add(new Property("reason", "Coding", "Provides the reason in the situation where a reason code is required in addition to the content.", 0, 1, reason));
1644        }
1645
1646        @Override
1647        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1648          switch (_hash) {
1649          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence);
1650          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category);
1651          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.", 0, 1, code);
1652          case 164632566: /*timing[x]*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1653          case -873664438: /*timing*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1654          case 807935768: /*timingDate*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1655          case -615615829: /*timingPeriod*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1656          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);
1657          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);
1658          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);
1659          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);
1660          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);
1661          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);
1662          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);
1663          case -934964668: /*reason*/  return new Property("reason", "Coding", "Provides the reason in the situation where a reason code is required in addition to the content.", 0, 1, reason);
1664          default: return super.getNamedProperty(_hash, _name, _checkValid);
1665          }
1666
1667        }
1668
1669      @Override
1670      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1671        switch (hash) {
1672        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1673        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1674        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1675        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Type
1676        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
1677        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
1678        default: return super.getProperty(hash, name, checkValid);
1679        }
1680
1681      }
1682
1683      @Override
1684      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1685        switch (hash) {
1686        case 1349547969: // sequence
1687          this.sequence = castToPositiveInt(value); // PositiveIntType
1688          return value;
1689        case 50511102: // category
1690          this.category = castToCodeableConcept(value); // CodeableConcept
1691          return value;
1692        case 3059181: // code
1693          this.code = castToCodeableConcept(value); // CodeableConcept
1694          return value;
1695        case -873664438: // timing
1696          this.timing = castToType(value); // Type
1697          return value;
1698        case 111972721: // value
1699          this.value = castToType(value); // Type
1700          return value;
1701        case -934964668: // reason
1702          this.reason = castToCoding(value); // Coding
1703          return value;
1704        default: return super.setProperty(hash, name, value);
1705        }
1706
1707      }
1708
1709      @Override
1710      public Base setProperty(String name, Base value) throws FHIRException {
1711        if (name.equals("sequence")) {
1712          this.sequence = castToPositiveInt(value); // PositiveIntType
1713        } else if (name.equals("category")) {
1714          this.category = castToCodeableConcept(value); // CodeableConcept
1715        } else if (name.equals("code")) {
1716          this.code = castToCodeableConcept(value); // CodeableConcept
1717        } else if (name.equals("timing[x]")) {
1718          this.timing = castToType(value); // Type
1719        } else if (name.equals("value[x]")) {
1720          this.value = castToType(value); // Type
1721        } else if (name.equals("reason")) {
1722          this.reason = castToCoding(value); // Coding
1723        } else
1724          return super.setProperty(name, value);
1725        return value;
1726      }
1727
1728      @Override
1729      public Base makeProperty(int hash, String name) throws FHIRException {
1730        switch (hash) {
1731        case 1349547969:  return getSequenceElement();
1732        case 50511102:  return getCategory(); 
1733        case 3059181:  return getCode(); 
1734        case 164632566:  return getTiming(); 
1735        case -873664438:  return getTiming(); 
1736        case -1410166417:  return getValue(); 
1737        case 111972721:  return getValue(); 
1738        case -934964668:  return getReason(); 
1739        default: return super.makeProperty(hash, name);
1740        }
1741
1742      }
1743
1744      @Override
1745      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1746        switch (hash) {
1747        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1748        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1749        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1750        case -873664438: /*timing*/ return new String[] {"date", "Period"};
1751        case 111972721: /*value*/ return new String[] {"boolean", "string", "Quantity", "Attachment", "Reference"};
1752        case -934964668: /*reason*/ return new String[] {"Coding"};
1753        default: return super.getTypesForProperty(hash, name);
1754        }
1755
1756      }
1757
1758      @Override
1759      public Base addChild(String name) throws FHIRException {
1760        if (name.equals("sequence")) {
1761          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1762        }
1763        else if (name.equals("category")) {
1764          this.category = new CodeableConcept();
1765          return this.category;
1766        }
1767        else if (name.equals("code")) {
1768          this.code = new CodeableConcept();
1769          return this.code;
1770        }
1771        else if (name.equals("timingDate")) {
1772          this.timing = new DateType();
1773          return this.timing;
1774        }
1775        else if (name.equals("timingPeriod")) {
1776          this.timing = new Period();
1777          return this.timing;
1778        }
1779        else if (name.equals("valueBoolean")) {
1780          this.value = new BooleanType();
1781          return this.value;
1782        }
1783        else if (name.equals("valueString")) {
1784          this.value = new StringType();
1785          return this.value;
1786        }
1787        else if (name.equals("valueQuantity")) {
1788          this.value = new Quantity();
1789          return this.value;
1790        }
1791        else if (name.equals("valueAttachment")) {
1792          this.value = new Attachment();
1793          return this.value;
1794        }
1795        else if (name.equals("valueReference")) {
1796          this.value = new Reference();
1797          return this.value;
1798        }
1799        else if (name.equals("reason")) {
1800          this.reason = new Coding();
1801          return this.reason;
1802        }
1803        else
1804          return super.addChild(name);
1805      }
1806
1807      public SupportingInformationComponent copy() {
1808        SupportingInformationComponent dst = new SupportingInformationComponent();
1809        copyValues(dst);
1810        dst.sequence = sequence == null ? null : sequence.copy();
1811        dst.category = category == null ? null : category.copy();
1812        dst.code = code == null ? null : code.copy();
1813        dst.timing = timing == null ? null : timing.copy();
1814        dst.value = value == null ? null : value.copy();
1815        dst.reason = reason == null ? null : reason.copy();
1816        return dst;
1817      }
1818
1819      @Override
1820      public boolean equalsDeep(Base other_) {
1821        if (!super.equalsDeep(other_))
1822          return false;
1823        if (!(other_ instanceof SupportingInformationComponent))
1824          return false;
1825        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1826        return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true) && compareDeep(code, o.code, true)
1827           && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true) && compareDeep(reason, o.reason, true)
1828          ;
1829      }
1830
1831      @Override
1832      public boolean equalsShallow(Base other_) {
1833        if (!super.equalsShallow(other_))
1834          return false;
1835        if (!(other_ instanceof SupportingInformationComponent))
1836          return false;
1837        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1838        return compareValues(sequence, o.sequence, true);
1839      }
1840
1841      public boolean isEmpty() {
1842        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code
1843          , timing, value, reason);
1844      }
1845
1846  public String fhirType() {
1847    return "ExplanationOfBenefit.supportingInfo";
1848
1849  }
1850
1851  }
1852
1853    @Block()
1854    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
1855        /**
1856         * A number to uniquely identify diagnosis entries.
1857         */
1858        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1859        @Description(shortDefinition="Diagnosis instance identifier", formalDefinition="A number to uniquely identify diagnosis entries." )
1860        protected PositiveIntType sequence;
1861
1862        /**
1863         * The nature of illness or problem in a coded form or as a reference to an external defined Condition.
1864         */
1865        @Child(name = "diagnosis", type = {CodeableConcept.class, Condition.class}, order=2, min=1, max=1, modifier=false, summary=false)
1866        @Description(shortDefinition="Nature of illness or problem", formalDefinition="The nature of illness or problem in a coded form or as a reference to an external defined Condition." )
1867        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10")
1868        protected Type diagnosis;
1869
1870        /**
1871         * When the condition was observed or the relative ranking.
1872         */
1873        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1874        @Description(shortDefinition="Timing or nature of the diagnosis", formalDefinition="When the condition was observed or the relative ranking." )
1875        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosistype")
1876        protected List<CodeableConcept> type;
1877
1878        /**
1879         * Indication of whether the diagnosis was present on admission to a facility.
1880         */
1881        @Child(name = "onAdmission", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1882        @Description(shortDefinition="Present on admission", formalDefinition="Indication of whether the diagnosis was present on admission to a facility." )
1883        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosis-on-admission")
1884        protected CodeableConcept onAdmission;
1885
1886        /**
1887         * A package billing code or bundle code used to group products and services to a particular health condition (such as heart attack) which is based on a predetermined grouping code system.
1888         */
1889        @Child(name = "packageCode", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1890        @Description(shortDefinition="Package billing code", formalDefinition="A package billing code or bundle code used to group products and services to a particular health condition (such as heart attack) which is based on a predetermined grouping code system." )
1891        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
1892        protected CodeableConcept packageCode;
1893
1894        private static final long serialVersionUID = 2120593974L;
1895
1896    /**
1897     * Constructor
1898     */
1899      public DiagnosisComponent() {
1900        super();
1901      }
1902
1903    /**
1904     * Constructor
1905     */
1906      public DiagnosisComponent(PositiveIntType sequence, Type diagnosis) {
1907        super();
1908        this.sequence = sequence;
1909        this.diagnosis = diagnosis;
1910      }
1911
1912        /**
1913         * @return {@link #sequence} (A number to uniquely identify diagnosis entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1914         */
1915        public PositiveIntType getSequenceElement() { 
1916          if (this.sequence == null)
1917            if (Configuration.errorOnAutoCreate())
1918              throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
1919            else if (Configuration.doAutoCreate())
1920              this.sequence = new PositiveIntType(); // bb
1921          return this.sequence;
1922        }
1923
1924        public boolean hasSequenceElement() { 
1925          return this.sequence != null && !this.sequence.isEmpty();
1926        }
1927
1928        public boolean hasSequence() { 
1929          return this.sequence != null && !this.sequence.isEmpty();
1930        }
1931
1932        /**
1933         * @param value {@link #sequence} (A number to uniquely identify diagnosis entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1934         */
1935        public DiagnosisComponent setSequenceElement(PositiveIntType value) { 
1936          this.sequence = value;
1937          return this;
1938        }
1939
1940        /**
1941         * @return A number to uniquely identify diagnosis entries.
1942         */
1943        public int getSequence() { 
1944          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1945        }
1946
1947        /**
1948         * @param value A number to uniquely identify diagnosis entries.
1949         */
1950        public DiagnosisComponent setSequence(int value) { 
1951            if (this.sequence == null)
1952              this.sequence = new PositiveIntType();
1953            this.sequence.setValue(value);
1954          return this;
1955        }
1956
1957        /**
1958         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1959         */
1960        public Type getDiagnosis() { 
1961          return this.diagnosis;
1962        }
1963
1964        /**
1965         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1966         */
1967        public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException { 
1968          if (this.diagnosis == null)
1969            this.diagnosis = new CodeableConcept();
1970          if (!(this.diagnosis instanceof CodeableConcept))
1971            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1972          return (CodeableConcept) this.diagnosis;
1973        }
1974
1975        public boolean hasDiagnosisCodeableConcept() { 
1976          return this != null && this.diagnosis instanceof CodeableConcept;
1977        }
1978
1979        /**
1980         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1981         */
1982        public Reference getDiagnosisReference() throws FHIRException { 
1983          if (this.diagnosis == null)
1984            this.diagnosis = new Reference();
1985          if (!(this.diagnosis instanceof Reference))
1986            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1987          return (Reference) this.diagnosis;
1988        }
1989
1990        public boolean hasDiagnosisReference() { 
1991          return this != null && this.diagnosis instanceof Reference;
1992        }
1993
1994        public boolean hasDiagnosis() { 
1995          return this.diagnosis != null && !this.diagnosis.isEmpty();
1996        }
1997
1998        /**
1999         * @param value {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
2000         */
2001        public DiagnosisComponent setDiagnosis(Type value) { 
2002          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2003            throw new Error("Not the right type for ExplanationOfBenefit.diagnosis.diagnosis[x]: "+value.fhirType());
2004          this.diagnosis = value;
2005          return this;
2006        }
2007
2008        /**
2009         * @return {@link #type} (When the condition was observed or the relative ranking.)
2010         */
2011        public List<CodeableConcept> getType() { 
2012          if (this.type == null)
2013            this.type = new ArrayList<CodeableConcept>();
2014          return this.type;
2015        }
2016
2017        /**
2018         * @return Returns a reference to <code>this</code> for easy method chaining
2019         */
2020        public DiagnosisComponent setType(List<CodeableConcept> theType) { 
2021          this.type = theType;
2022          return this;
2023        }
2024
2025        public boolean hasType() { 
2026          if (this.type == null)
2027            return false;
2028          for (CodeableConcept item : this.type)
2029            if (!item.isEmpty())
2030              return true;
2031          return false;
2032        }
2033
2034        public CodeableConcept addType() { //3
2035          CodeableConcept t = new CodeableConcept();
2036          if (this.type == null)
2037            this.type = new ArrayList<CodeableConcept>();
2038          this.type.add(t);
2039          return t;
2040        }
2041
2042        public DiagnosisComponent addType(CodeableConcept t) { //3
2043          if (t == null)
2044            return this;
2045          if (this.type == null)
2046            this.type = new ArrayList<CodeableConcept>();
2047          this.type.add(t);
2048          return this;
2049        }
2050
2051        /**
2052         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
2053         */
2054        public CodeableConcept getTypeFirstRep() { 
2055          if (getType().isEmpty()) {
2056            addType();
2057          }
2058          return getType().get(0);
2059        }
2060
2061        /**
2062         * @return {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
2063         */
2064        public CodeableConcept getOnAdmission() { 
2065          if (this.onAdmission == null)
2066            if (Configuration.errorOnAutoCreate())
2067              throw new Error("Attempt to auto-create DiagnosisComponent.onAdmission");
2068            else if (Configuration.doAutoCreate())
2069              this.onAdmission = new CodeableConcept(); // cc
2070          return this.onAdmission;
2071        }
2072
2073        public boolean hasOnAdmission() { 
2074          return this.onAdmission != null && !this.onAdmission.isEmpty();
2075        }
2076
2077        /**
2078         * @param value {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
2079         */
2080        public DiagnosisComponent setOnAdmission(CodeableConcept value) { 
2081          this.onAdmission = value;
2082          return this;
2083        }
2084
2085        /**
2086         * @return {@link #packageCode} (A package billing code or bundle code used to group products and services to a particular health condition (such as heart attack) which is based on a predetermined grouping code system.)
2087         */
2088        public CodeableConcept getPackageCode() { 
2089          if (this.packageCode == null)
2090            if (Configuration.errorOnAutoCreate())
2091              throw new Error("Attempt to auto-create DiagnosisComponent.packageCode");
2092            else if (Configuration.doAutoCreate())
2093              this.packageCode = new CodeableConcept(); // cc
2094          return this.packageCode;
2095        }
2096
2097        public boolean hasPackageCode() { 
2098          return this.packageCode != null && !this.packageCode.isEmpty();
2099        }
2100
2101        /**
2102         * @param value {@link #packageCode} (A package billing code or bundle code used to group products and services to a particular health condition (such as heart attack) which is based on a predetermined grouping code system.)
2103         */
2104        public DiagnosisComponent setPackageCode(CodeableConcept value) { 
2105          this.packageCode = value;
2106          return this;
2107        }
2108
2109        protected void listChildren(List<Property> children) {
2110          super.listChildren(children);
2111          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence));
2112          children.add(new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis));
2113          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
2114          children.add(new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission));
2115          children.add(new Property("packageCode", "CodeableConcept", "A package billing code or bundle code used to group products and services to a particular health condition (such as heart attack) which is based on a predetermined grouping code system.", 0, 1, packageCode));
2116        }
2117
2118        @Override
2119        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2120          switch (_hash) {
2121          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence);
2122          case -1487009809: /*diagnosis[x]*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis);
2123          case 1196993265: /*diagnosis*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis);
2124          case 277781616: /*diagnosisCodeableConcept*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis);
2125          case 2050454362: /*diagnosisReference*/  return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)", "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1, diagnosis);
2126          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2127          case -3386134: /*onAdmission*/  return new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission);
2128          case 908444499: /*packageCode*/  return new Property("packageCode", "CodeableConcept", "A package billing code or bundle code used to group products and services to a particular health condition (such as heart attack) which is based on a predetermined grouping code system.", 0, 1, packageCode);
2129          default: return super.getNamedProperty(_hash, _name, _checkValid);
2130          }
2131
2132        }
2133
2134      @Override
2135      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2136        switch (hash) {
2137        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2138        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // Type
2139        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2140        case -3386134: /*onAdmission*/ return this.onAdmission == null ? new Base[0] : new Base[] {this.onAdmission}; // CodeableConcept
2141        case 908444499: /*packageCode*/ return this.packageCode == null ? new Base[0] : new Base[] {this.packageCode}; // CodeableConcept
2142        default: return super.getProperty(hash, name, checkValid);
2143        }
2144
2145      }
2146
2147      @Override
2148      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2149        switch (hash) {
2150        case 1349547969: // sequence
2151          this.sequence = castToPositiveInt(value); // PositiveIntType
2152          return value;
2153        case 1196993265: // diagnosis
2154          this.diagnosis = castToType(value); // Type
2155          return value;
2156        case 3575610: // type
2157          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
2158          return value;
2159        case -3386134: // onAdmission
2160          this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2161          return value;
2162        case 908444499: // packageCode
2163          this.packageCode = castToCodeableConcept(value); // CodeableConcept
2164          return value;
2165        default: return super.setProperty(hash, name, value);
2166        }
2167
2168      }
2169
2170      @Override
2171      public Base setProperty(String name, Base value) throws FHIRException {
2172        if (name.equals("sequence")) {
2173          this.sequence = castToPositiveInt(value); // PositiveIntType
2174        } else if (name.equals("diagnosis[x]")) {
2175          this.diagnosis = castToType(value); // Type
2176        } else if (name.equals("type")) {
2177          this.getType().add(castToCodeableConcept(value));
2178        } else if (name.equals("onAdmission")) {
2179          this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2180        } else if (name.equals("packageCode")) {
2181          this.packageCode = castToCodeableConcept(value); // CodeableConcept
2182        } else
2183          return super.setProperty(name, value);
2184        return value;
2185      }
2186
2187      @Override
2188      public Base makeProperty(int hash, String name) throws FHIRException {
2189        switch (hash) {
2190        case 1349547969:  return getSequenceElement();
2191        case -1487009809:  return getDiagnosis(); 
2192        case 1196993265:  return getDiagnosis(); 
2193        case 3575610:  return addType(); 
2194        case -3386134:  return getOnAdmission(); 
2195        case 908444499:  return getPackageCode(); 
2196        default: return super.makeProperty(hash, name);
2197        }
2198
2199      }
2200
2201      @Override
2202      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2203        switch (hash) {
2204        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2205        case 1196993265: /*diagnosis*/ return new String[] {"CodeableConcept", "Reference"};
2206        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2207        case -3386134: /*onAdmission*/ return new String[] {"CodeableConcept"};
2208        case 908444499: /*packageCode*/ return new String[] {"CodeableConcept"};
2209        default: return super.getTypesForProperty(hash, name);
2210        }
2211
2212      }
2213
2214      @Override
2215      public Base addChild(String name) throws FHIRException {
2216        if (name.equals("sequence")) {
2217          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
2218        }
2219        else if (name.equals("diagnosisCodeableConcept")) {
2220          this.diagnosis = new CodeableConcept();
2221          return this.diagnosis;
2222        }
2223        else if (name.equals("diagnosisReference")) {
2224          this.diagnosis = new Reference();
2225          return this.diagnosis;
2226        }
2227        else if (name.equals("type")) {
2228          return addType();
2229        }
2230        else if (name.equals("onAdmission")) {
2231          this.onAdmission = new CodeableConcept();
2232          return this.onAdmission;
2233        }
2234        else if (name.equals("packageCode")) {
2235          this.packageCode = new CodeableConcept();
2236          return this.packageCode;
2237        }
2238        else
2239          return super.addChild(name);
2240      }
2241
2242      public DiagnosisComponent copy() {
2243        DiagnosisComponent dst = new DiagnosisComponent();
2244        copyValues(dst);
2245        dst.sequence = sequence == null ? null : sequence.copy();
2246        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
2247        if (type != null) {
2248          dst.type = new ArrayList<CodeableConcept>();
2249          for (CodeableConcept i : type)
2250            dst.type.add(i.copy());
2251        };
2252        dst.onAdmission = onAdmission == null ? null : onAdmission.copy();
2253        dst.packageCode = packageCode == null ? null : packageCode.copy();
2254        return dst;
2255      }
2256
2257      @Override
2258      public boolean equalsDeep(Base other_) {
2259        if (!super.equalsDeep(other_))
2260          return false;
2261        if (!(other_ instanceof DiagnosisComponent))
2262          return false;
2263        DiagnosisComponent o = (DiagnosisComponent) other_;
2264        return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(type, o.type, true)
2265           && compareDeep(onAdmission, o.onAdmission, true) && compareDeep(packageCode, o.packageCode, true)
2266          ;
2267      }
2268
2269      @Override
2270      public boolean equalsShallow(Base other_) {
2271        if (!super.equalsShallow(other_))
2272          return false;
2273        if (!(other_ instanceof DiagnosisComponent))
2274          return false;
2275        DiagnosisComponent o = (DiagnosisComponent) other_;
2276        return compareValues(sequence, o.sequence, true);
2277      }
2278
2279      public boolean isEmpty() {
2280        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type
2281          , onAdmission, packageCode);
2282      }
2283
2284  public String fhirType() {
2285    return "ExplanationOfBenefit.diagnosis";
2286
2287  }
2288
2289  }
2290
2291    @Block()
2292    public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
2293        /**
2294         * A number to uniquely identify procedure entries.
2295         */
2296        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2297        @Description(shortDefinition="Procedure instance identifier", formalDefinition="A number to uniquely identify procedure entries." )
2298        protected PositiveIntType sequence;
2299
2300        /**
2301         * When the condition was observed or the relative ranking.
2302         */
2303        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2304        @Description(shortDefinition="Category of Procedure", formalDefinition="When the condition was observed or the relative ranking." )
2305        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-procedure-type")
2306        protected List<CodeableConcept> type;
2307
2308        /**
2309         * Date and optionally time the procedure was performed.
2310         */
2311        @Child(name = "date", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2312        @Description(shortDefinition="When the procedure was performed", formalDefinition="Date and optionally time the procedure was performed." )
2313        protected DateTimeType date;
2314
2315        /**
2316         * The code or reference to a Procedure resource which identifies the clinical intervention performed.
2317         */
2318        @Child(name = "procedure", type = {CodeableConcept.class, Procedure.class}, order=4, min=1, max=1, modifier=false, summary=false)
2319        @Description(shortDefinition="Specific clinical procedure", formalDefinition="The code or reference to a Procedure resource which identifies the clinical intervention performed." )
2320        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10-procedures")
2321        protected Type procedure;
2322
2323        /**
2324         * Unique Device Identifiers associated with this line item.
2325         */
2326        @Child(name = "udi", type = {Device.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2327        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
2328        protected List<Reference> udi;
2329        /**
2330         * The actual objects that are the target of the reference (Unique Device Identifiers associated with this line item.)
2331         */
2332        protected List<Device> udiTarget;
2333
2334
2335        private static final long serialVersionUID = 935341852L;
2336
2337    /**
2338     * Constructor
2339     */
2340      public ProcedureComponent() {
2341        super();
2342      }
2343
2344    /**
2345     * Constructor
2346     */
2347      public ProcedureComponent(PositiveIntType sequence, Type procedure) {
2348        super();
2349        this.sequence = sequence;
2350        this.procedure = procedure;
2351      }
2352
2353        /**
2354         * @return {@link #sequence} (A number to uniquely identify procedure entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
2355         */
2356        public PositiveIntType getSequenceElement() { 
2357          if (this.sequence == null)
2358            if (Configuration.errorOnAutoCreate())
2359              throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2360            else if (Configuration.doAutoCreate())
2361              this.sequence = new PositiveIntType(); // bb
2362          return this.sequence;
2363        }
2364
2365        public boolean hasSequenceElement() { 
2366          return this.sequence != null && !this.sequence.isEmpty();
2367        }
2368
2369        public boolean hasSequence() { 
2370          return this.sequence != null && !this.sequence.isEmpty();
2371        }
2372
2373        /**
2374         * @param value {@link #sequence} (A number to uniquely identify procedure entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
2375         */
2376        public ProcedureComponent setSequenceElement(PositiveIntType value) { 
2377          this.sequence = value;
2378          return this;
2379        }
2380
2381        /**
2382         * @return A number to uniquely identify procedure entries.
2383         */
2384        public int getSequence() { 
2385          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2386        }
2387
2388        /**
2389         * @param value A number to uniquely identify procedure entries.
2390         */
2391        public ProcedureComponent setSequence(int value) { 
2392            if (this.sequence == null)
2393              this.sequence = new PositiveIntType();
2394            this.sequence.setValue(value);
2395          return this;
2396        }
2397
2398        /**
2399         * @return {@link #type} (When the condition was observed or the relative ranking.)
2400         */
2401        public List<CodeableConcept> getType() { 
2402          if (this.type == null)
2403            this.type = new ArrayList<CodeableConcept>();
2404          return this.type;
2405        }
2406
2407        /**
2408         * @return Returns a reference to <code>this</code> for easy method chaining
2409         */
2410        public ProcedureComponent setType(List<CodeableConcept> theType) { 
2411          this.type = theType;
2412          return this;
2413        }
2414
2415        public boolean hasType() { 
2416          if (this.type == null)
2417            return false;
2418          for (CodeableConcept item : this.type)
2419            if (!item.isEmpty())
2420              return true;
2421          return false;
2422        }
2423
2424        public CodeableConcept addType() { //3
2425          CodeableConcept t = new CodeableConcept();
2426          if (this.type == null)
2427            this.type = new ArrayList<CodeableConcept>();
2428          this.type.add(t);
2429          return t;
2430        }
2431
2432        public ProcedureComponent addType(CodeableConcept t) { //3
2433          if (t == null)
2434            return this;
2435          if (this.type == null)
2436            this.type = new ArrayList<CodeableConcept>();
2437          this.type.add(t);
2438          return this;
2439        }
2440
2441        /**
2442         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
2443         */
2444        public CodeableConcept getTypeFirstRep() { 
2445          if (getType().isEmpty()) {
2446            addType();
2447          }
2448          return getType().get(0);
2449        }
2450
2451        /**
2452         * @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
2453         */
2454        public DateTimeType getDateElement() { 
2455          if (this.date == null)
2456            if (Configuration.errorOnAutoCreate())
2457              throw new Error("Attempt to auto-create ProcedureComponent.date");
2458            else if (Configuration.doAutoCreate())
2459              this.date = new DateTimeType(); // bb
2460          return this.date;
2461        }
2462
2463        public boolean hasDateElement() { 
2464          return this.date != null && !this.date.isEmpty();
2465        }
2466
2467        public boolean hasDate() { 
2468          return this.date != null && !this.date.isEmpty();
2469        }
2470
2471        /**
2472         * @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
2473         */
2474        public ProcedureComponent setDateElement(DateTimeType value) { 
2475          this.date = value;
2476          return this;
2477        }
2478
2479        /**
2480         * @return Date and optionally time the procedure was performed.
2481         */
2482        public Date getDate() { 
2483          return this.date == null ? null : this.date.getValue();
2484        }
2485
2486        /**
2487         * @param value Date and optionally time the procedure was performed.
2488         */
2489        public ProcedureComponent setDate(Date value) { 
2490          if (value == null)
2491            this.date = null;
2492          else {
2493            if (this.date == null)
2494              this.date = new DateTimeType();
2495            this.date.setValue(value);
2496          }
2497          return this;
2498        }
2499
2500        /**
2501         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2502         */
2503        public Type getProcedure() { 
2504          return this.procedure;
2505        }
2506
2507        /**
2508         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2509         */
2510        public CodeableConcept getProcedureCodeableConcept() throws FHIRException { 
2511          if (this.procedure == null)
2512            this.procedure = new CodeableConcept();
2513          if (!(this.procedure instanceof CodeableConcept))
2514            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.procedure.getClass().getName()+" was encountered");
2515          return (CodeableConcept) this.procedure;
2516        }
2517
2518        public boolean hasProcedureCodeableConcept() { 
2519          return this != null && this.procedure instanceof CodeableConcept;
2520        }
2521
2522        /**
2523         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2524         */
2525        public Reference getProcedureReference() throws FHIRException { 
2526          if (this.procedure == null)
2527            this.procedure = new Reference();
2528          if (!(this.procedure instanceof Reference))
2529            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.procedure.getClass().getName()+" was encountered");
2530          return (Reference) this.procedure;
2531        }
2532
2533        public boolean hasProcedureReference() { 
2534          return this != null && this.procedure instanceof Reference;
2535        }
2536
2537        public boolean hasProcedure() { 
2538          return this.procedure != null && !this.procedure.isEmpty();
2539        }
2540
2541        /**
2542         * @param value {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2543         */
2544        public ProcedureComponent setProcedure(Type value) { 
2545          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2546            throw new Error("Not the right type for ExplanationOfBenefit.procedure.procedure[x]: "+value.fhirType());
2547          this.procedure = value;
2548          return this;
2549        }
2550
2551        /**
2552         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
2553         */
2554        public List<Reference> getUdi() { 
2555          if (this.udi == null)
2556            this.udi = new ArrayList<Reference>();
2557          return this.udi;
2558        }
2559
2560        /**
2561         * @return Returns a reference to <code>this</code> for easy method chaining
2562         */
2563        public ProcedureComponent setUdi(List<Reference> theUdi) { 
2564          this.udi = theUdi;
2565          return this;
2566        }
2567
2568        public boolean hasUdi() { 
2569          if (this.udi == null)
2570            return false;
2571          for (Reference item : this.udi)
2572            if (!item.isEmpty())
2573              return true;
2574          return false;
2575        }
2576
2577        public Reference addUdi() { //3
2578          Reference t = new Reference();
2579          if (this.udi == null)
2580            this.udi = new ArrayList<Reference>();
2581          this.udi.add(t);
2582          return t;
2583        }
2584
2585        public ProcedureComponent addUdi(Reference t) { //3
2586          if (t == null)
2587            return this;
2588          if (this.udi == null)
2589            this.udi = new ArrayList<Reference>();
2590          this.udi.add(t);
2591          return this;
2592        }
2593
2594        /**
2595         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
2596         */
2597        public Reference getUdiFirstRep() { 
2598          if (getUdi().isEmpty()) {
2599            addUdi();
2600          }
2601          return getUdi().get(0);
2602        }
2603
2604        /**
2605         * @deprecated Use Reference#setResource(IBaseResource) instead
2606         */
2607        @Deprecated
2608        public List<Device> getUdiTarget() { 
2609          if (this.udiTarget == null)
2610            this.udiTarget = new ArrayList<Device>();
2611          return this.udiTarget;
2612        }
2613
2614        /**
2615         * @deprecated Use Reference#setResource(IBaseResource) instead
2616         */
2617        @Deprecated
2618        public Device addUdiTarget() { 
2619          Device r = new Device();
2620          if (this.udiTarget == null)
2621            this.udiTarget = new ArrayList<Device>();
2622          this.udiTarget.add(r);
2623          return r;
2624        }
2625
2626        protected void listChildren(List<Property> children) {
2627          super.listChildren(children);
2628          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence));
2629          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
2630          children.add(new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date));
2631          children.add(new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure));
2632          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
2633        }
2634
2635        @Override
2636        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2637          switch (_hash) {
2638          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence);
2639          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2640          case 3076014: /*date*/  return new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date);
2641          case 1640074445: /*procedure[x]*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure);
2642          case -1095204141: /*procedure*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure);
2643          case -1284783026: /*procedureCodeableConcept*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure);
2644          case 881809848: /*procedureReference*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure);
2645          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
2646          default: return super.getNamedProperty(_hash, _name, _checkValid);
2647          }
2648
2649        }
2650
2651      @Override
2652      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2653        switch (hash) {
2654        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2655        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2656        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2657        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // Type
2658        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
2659        default: return super.getProperty(hash, name, checkValid);
2660        }
2661
2662      }
2663
2664      @Override
2665      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2666        switch (hash) {
2667        case 1349547969: // sequence
2668          this.sequence = castToPositiveInt(value); // PositiveIntType
2669          return value;
2670        case 3575610: // type
2671          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
2672          return value;
2673        case 3076014: // date
2674          this.date = castToDateTime(value); // DateTimeType
2675          return value;
2676        case -1095204141: // procedure
2677          this.procedure = castToType(value); // Type
2678          return value;
2679        case 115642: // udi
2680          this.getUdi().add(castToReference(value)); // Reference
2681          return value;
2682        default: return super.setProperty(hash, name, value);
2683        }
2684
2685      }
2686
2687      @Override
2688      public Base setProperty(String name, Base value) throws FHIRException {
2689        if (name.equals("sequence")) {
2690          this.sequence = castToPositiveInt(value); // PositiveIntType
2691        } else if (name.equals("type")) {
2692          this.getType().add(castToCodeableConcept(value));
2693        } else if (name.equals("date")) {
2694          this.date = castToDateTime(value); // DateTimeType
2695        } else if (name.equals("procedure[x]")) {
2696          this.procedure = castToType(value); // Type
2697        } else if (name.equals("udi")) {
2698          this.getUdi().add(castToReference(value));
2699        } else
2700          return super.setProperty(name, value);
2701        return value;
2702      }
2703
2704      @Override
2705      public Base makeProperty(int hash, String name) throws FHIRException {
2706        switch (hash) {
2707        case 1349547969:  return getSequenceElement();
2708        case 3575610:  return addType(); 
2709        case 3076014:  return getDateElement();
2710        case 1640074445:  return getProcedure(); 
2711        case -1095204141:  return getProcedure(); 
2712        case 115642:  return addUdi(); 
2713        default: return super.makeProperty(hash, name);
2714        }
2715
2716      }
2717
2718      @Override
2719      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2720        switch (hash) {
2721        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2722        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2723        case 3076014: /*date*/ return new String[] {"dateTime"};
2724        case -1095204141: /*procedure*/ return new String[] {"CodeableConcept", "Reference"};
2725        case 115642: /*udi*/ return new String[] {"Reference"};
2726        default: return super.getTypesForProperty(hash, name);
2727        }
2728
2729      }
2730
2731      @Override
2732      public Base addChild(String name) throws FHIRException {
2733        if (name.equals("sequence")) {
2734          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
2735        }
2736        else if (name.equals("type")) {
2737          return addType();
2738        }
2739        else if (name.equals("date")) {
2740          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
2741        }
2742        else if (name.equals("procedureCodeableConcept")) {
2743          this.procedure = new CodeableConcept();
2744          return this.procedure;
2745        }
2746        else if (name.equals("procedureReference")) {
2747          this.procedure = new Reference();
2748          return this.procedure;
2749        }
2750        else if (name.equals("udi")) {
2751          return addUdi();
2752        }
2753        else
2754          return super.addChild(name);
2755      }
2756
2757      public ProcedureComponent copy() {
2758        ProcedureComponent dst = new ProcedureComponent();
2759        copyValues(dst);
2760        dst.sequence = sequence == null ? null : sequence.copy();
2761        if (type != null) {
2762          dst.type = new ArrayList<CodeableConcept>();
2763          for (CodeableConcept i : type)
2764            dst.type.add(i.copy());
2765        };
2766        dst.date = date == null ? null : date.copy();
2767        dst.procedure = procedure == null ? null : procedure.copy();
2768        if (udi != null) {
2769          dst.udi = new ArrayList<Reference>();
2770          for (Reference i : udi)
2771            dst.udi.add(i.copy());
2772        };
2773        return dst;
2774      }
2775
2776      @Override
2777      public boolean equalsDeep(Base other_) {
2778        if (!super.equalsDeep(other_))
2779          return false;
2780        if (!(other_ instanceof ProcedureComponent))
2781          return false;
2782        ProcedureComponent o = (ProcedureComponent) other_;
2783        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(date, o.date, true)
2784           && compareDeep(procedure, o.procedure, true) && compareDeep(udi, o.udi, true);
2785      }
2786
2787      @Override
2788      public boolean equalsShallow(Base other_) {
2789        if (!super.equalsShallow(other_))
2790          return false;
2791        if (!(other_ instanceof ProcedureComponent))
2792          return false;
2793        ProcedureComponent o = (ProcedureComponent) other_;
2794        return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
2795      }
2796
2797      public boolean isEmpty() {
2798        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, date, procedure
2799          , udi);
2800      }
2801
2802  public String fhirType() {
2803    return "ExplanationOfBenefit.procedure";
2804
2805  }
2806
2807  }
2808
2809    @Block()
2810    public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
2811        /**
2812         * A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2813         */
2814        @Child(name = "focal", type = {BooleanType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2815        @Description(shortDefinition="Coverage to be used for adjudication", formalDefinition="A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true." )
2816        protected BooleanType focal;
2817
2818        /**
2819         * Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.
2820         */
2821        @Child(name = "coverage", type = {Coverage.class}, order=2, min=1, max=1, modifier=false, summary=true)
2822        @Description(shortDefinition="Insurance information", formalDefinition="Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system." )
2823        protected Reference coverage;
2824
2825        /**
2826         * The actual object that is the target of the reference (Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.)
2827         */
2828        protected Coverage coverageTarget;
2829
2830        /**
2831         * Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.
2832         */
2833        @Child(name = "preAuthRef", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2834        @Description(shortDefinition="Prior authorization reference number", formalDefinition="Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization." )
2835        protected List<StringType> preAuthRef;
2836
2837        private static final long serialVersionUID = -606383626L;
2838
2839    /**
2840     * Constructor
2841     */
2842      public InsuranceComponent() {
2843        super();
2844      }
2845
2846    /**
2847     * Constructor
2848     */
2849      public InsuranceComponent(BooleanType focal, Reference coverage) {
2850        super();
2851        this.focal = focal;
2852        this.coverage = coverage;
2853      }
2854
2855        /**
2856         * @return {@link #focal} (A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.). This is the underlying object with id, value and extensions. The accessor "getFocal" gives direct access to the value
2857         */
2858        public BooleanType getFocalElement() { 
2859          if (this.focal == null)
2860            if (Configuration.errorOnAutoCreate())
2861              throw new Error("Attempt to auto-create InsuranceComponent.focal");
2862            else if (Configuration.doAutoCreate())
2863              this.focal = new BooleanType(); // bb
2864          return this.focal;
2865        }
2866
2867        public boolean hasFocalElement() { 
2868          return this.focal != null && !this.focal.isEmpty();
2869        }
2870
2871        public boolean hasFocal() { 
2872          return this.focal != null && !this.focal.isEmpty();
2873        }
2874
2875        /**
2876         * @param value {@link #focal} (A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.). This is the underlying object with id, value and extensions. The accessor "getFocal" gives direct access to the value
2877         */
2878        public InsuranceComponent setFocalElement(BooleanType value) { 
2879          this.focal = value;
2880          return this;
2881        }
2882
2883        /**
2884         * @return A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2885         */
2886        public boolean getFocal() { 
2887          return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
2888        }
2889
2890        /**
2891         * @param value A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2892         */
2893        public InsuranceComponent setFocal(boolean value) { 
2894            if (this.focal == null)
2895              this.focal = new BooleanType();
2896            this.focal.setValue(value);
2897          return this;
2898        }
2899
2900        /**
2901         * @return {@link #coverage} (Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.)
2902         */
2903        public Reference getCoverage() { 
2904          if (this.coverage == null)
2905            if (Configuration.errorOnAutoCreate())
2906              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2907            else if (Configuration.doAutoCreate())
2908              this.coverage = new Reference(); // cc
2909          return this.coverage;
2910        }
2911
2912        public boolean hasCoverage() { 
2913          return this.coverage != null && !this.coverage.isEmpty();
2914        }
2915
2916        /**
2917         * @param value {@link #coverage} (Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.)
2918         */
2919        public InsuranceComponent setCoverage(Reference value) { 
2920          this.coverage = value;
2921          return this;
2922        }
2923
2924        /**
2925         * @return {@link #coverage} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.)
2926         */
2927        public Coverage getCoverageTarget() { 
2928          if (this.coverageTarget == null)
2929            if (Configuration.errorOnAutoCreate())
2930              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2931            else if (Configuration.doAutoCreate())
2932              this.coverageTarget = new Coverage(); // aa
2933          return this.coverageTarget;
2934        }
2935
2936        /**
2937         * @param value {@link #coverage} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.)
2938         */
2939        public InsuranceComponent setCoverageTarget(Coverage value) { 
2940          this.coverageTarget = value;
2941          return this;
2942        }
2943
2944        /**
2945         * @return {@link #preAuthRef} (Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.)
2946         */
2947        public List<StringType> getPreAuthRef() { 
2948          if (this.preAuthRef == null)
2949            this.preAuthRef = new ArrayList<StringType>();
2950          return this.preAuthRef;
2951        }
2952
2953        /**
2954         * @return Returns a reference to <code>this</code> for easy method chaining
2955         */
2956        public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) { 
2957          this.preAuthRef = thePreAuthRef;
2958          return this;
2959        }
2960
2961        public boolean hasPreAuthRef() { 
2962          if (this.preAuthRef == null)
2963            return false;
2964          for (StringType item : this.preAuthRef)
2965            if (!item.isEmpty())
2966              return true;
2967          return false;
2968        }
2969
2970        /**
2971         * @return {@link #preAuthRef} (Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.)
2972         */
2973        public StringType addPreAuthRefElement() {//2 
2974          StringType t = new StringType();
2975          if (this.preAuthRef == null)
2976            this.preAuthRef = new ArrayList<StringType>();
2977          this.preAuthRef.add(t);
2978          return t;
2979        }
2980
2981        /**
2982         * @param value {@link #preAuthRef} (Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.)
2983         */
2984        public InsuranceComponent addPreAuthRef(String value) { //1
2985          StringType t = new StringType();
2986          t.setValue(value);
2987          if (this.preAuthRef == null)
2988            this.preAuthRef = new ArrayList<StringType>();
2989          this.preAuthRef.add(t);
2990          return this;
2991        }
2992
2993        /**
2994         * @param value {@link #preAuthRef} (Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.)
2995         */
2996        public boolean hasPreAuthRef(String value) { 
2997          if (this.preAuthRef == null)
2998            return false;
2999          for (StringType v : this.preAuthRef)
3000            if (v.getValue().equals(value)) // string
3001              return true;
3002          return false;
3003        }
3004
3005        protected void listChildren(List<Property> children) {
3006          super.listChildren(children);
3007          children.add(new Property("focal", "boolean", "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.", 0, 1, focal));
3008          children.add(new Property("coverage", "Reference(Coverage)", "Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.", 0, 1, coverage));
3009          children.add(new Property("preAuthRef", "string", "Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.", 0, java.lang.Integer.MAX_VALUE, preAuthRef));
3010        }
3011
3012        @Override
3013        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3014          switch (_hash) {
3015          case 97604197: /*focal*/  return new Property("focal", "boolean", "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.", 0, 1, focal);
3016          case -351767064: /*coverage*/  return new Property("coverage", "Reference(Coverage)", "Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.", 0, 1, coverage);
3017          case 522246568: /*preAuthRef*/  return new Property("preAuthRef", "string", "Reference numbers previously provided by the insurer to the provider to be quoted on subsequent claims containing services or products related to the prior authorization.", 0, java.lang.Integer.MAX_VALUE, preAuthRef);
3018          default: return super.getNamedProperty(_hash, _name, _checkValid);
3019          }
3020
3021        }
3022
3023      @Override
3024      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3025        switch (hash) {
3026        case 97604197: /*focal*/ return this.focal == null ? new Base[0] : new Base[] {this.focal}; // BooleanType
3027        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
3028        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
3029        default: return super.getProperty(hash, name, checkValid);
3030        }
3031
3032      }
3033
3034      @Override
3035      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3036        switch (hash) {
3037        case 97604197: // focal
3038          this.focal = castToBoolean(value); // BooleanType
3039          return value;
3040        case -351767064: // coverage
3041          this.coverage = castToReference(value); // Reference
3042          return value;
3043        case 522246568: // preAuthRef
3044          this.getPreAuthRef().add(castToString(value)); // StringType
3045          return value;
3046        default: return super.setProperty(hash, name, value);
3047        }
3048
3049      }
3050
3051      @Override
3052      public Base setProperty(String name, Base value) throws FHIRException {
3053        if (name.equals("focal")) {
3054          this.focal = castToBoolean(value); // BooleanType
3055        } else if (name.equals("coverage")) {
3056          this.coverage = castToReference(value); // Reference
3057        } else if (name.equals("preAuthRef")) {
3058          this.getPreAuthRef().add(castToString(value));
3059        } else
3060          return super.setProperty(name, value);
3061        return value;
3062      }
3063
3064      @Override
3065      public Base makeProperty(int hash, String name) throws FHIRException {
3066        switch (hash) {
3067        case 97604197:  return getFocalElement();
3068        case -351767064:  return getCoverage(); 
3069        case 522246568:  return addPreAuthRefElement();
3070        default: return super.makeProperty(hash, name);
3071        }
3072
3073      }
3074
3075      @Override
3076      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3077        switch (hash) {
3078        case 97604197: /*focal*/ return new String[] {"boolean"};
3079        case -351767064: /*coverage*/ return new String[] {"Reference"};
3080        case 522246568: /*preAuthRef*/ return new String[] {"string"};
3081        default: return super.getTypesForProperty(hash, name);
3082        }
3083
3084      }
3085
3086      @Override
3087      public Base addChild(String name) throws FHIRException {
3088        if (name.equals("focal")) {
3089          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.focal");
3090        }
3091        else if (name.equals("coverage")) {
3092          this.coverage = new Reference();
3093          return this.coverage;
3094        }
3095        else if (name.equals("preAuthRef")) {
3096          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
3097        }
3098        else
3099          return super.addChild(name);
3100      }
3101
3102      public InsuranceComponent copy() {
3103        InsuranceComponent dst = new InsuranceComponent();
3104        copyValues(dst);
3105        dst.focal = focal == null ? null : focal.copy();
3106        dst.coverage = coverage == null ? null : coverage.copy();
3107        if (preAuthRef != null) {
3108          dst.preAuthRef = new ArrayList<StringType>();
3109          for (StringType i : preAuthRef)
3110            dst.preAuthRef.add(i.copy());
3111        };
3112        return dst;
3113      }
3114
3115      @Override
3116      public boolean equalsDeep(Base other_) {
3117        if (!super.equalsDeep(other_))
3118          return false;
3119        if (!(other_ instanceof InsuranceComponent))
3120          return false;
3121        InsuranceComponent o = (InsuranceComponent) other_;
3122        return compareDeep(focal, o.focal, true) && compareDeep(coverage, o.coverage, true) && compareDeep(preAuthRef, o.preAuthRef, true)
3123          ;
3124      }
3125
3126      @Override
3127      public boolean equalsShallow(Base other_) {
3128        if (!super.equalsShallow(other_))
3129          return false;
3130        if (!(other_ instanceof InsuranceComponent))
3131          return false;
3132        InsuranceComponent o = (InsuranceComponent) other_;
3133        return compareValues(focal, o.focal, true) && compareValues(preAuthRef, o.preAuthRef, true);
3134      }
3135
3136      public boolean isEmpty() {
3137        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(focal, coverage, preAuthRef
3138          );
3139      }
3140
3141  public String fhirType() {
3142    return "ExplanationOfBenefit.insurance";
3143
3144  }
3145
3146  }
3147
3148    @Block()
3149    public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
3150        /**
3151         * Date of an accident event  related to the products and services contained in the claim.
3152         */
3153        @Child(name = "date", type = {DateType.class}, order=1, min=0, max=1, modifier=false, summary=false)
3154        @Description(shortDefinition="When the incident occurred", formalDefinition="Date of an accident event  related to the products and services contained in the claim." )
3155        protected DateType date;
3156
3157        /**
3158         * The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.
3159         */
3160        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
3161        @Description(shortDefinition="The nature of the accident", formalDefinition="The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers." )
3162        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActIncidentCode")
3163        protected CodeableConcept type;
3164
3165        /**
3166         * The physical location of the accident event.
3167         */
3168        @Child(name = "location", type = {Address.class, Location.class}, order=3, min=0, max=1, modifier=false, summary=false)
3169        @Description(shortDefinition="Where the event occurred", formalDefinition="The physical location of the accident event." )
3170        protected Type location;
3171
3172        private static final long serialVersionUID = 622904984L;
3173
3174    /**
3175     * Constructor
3176     */
3177      public AccidentComponent() {
3178        super();
3179      }
3180
3181        /**
3182         * @return {@link #date} (Date of an accident event  related to the products and services contained in the claim.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
3183         */
3184        public DateType getDateElement() { 
3185          if (this.date == null)
3186            if (Configuration.errorOnAutoCreate())
3187              throw new Error("Attempt to auto-create AccidentComponent.date");
3188            else if (Configuration.doAutoCreate())
3189              this.date = new DateType(); // bb
3190          return this.date;
3191        }
3192
3193        public boolean hasDateElement() { 
3194          return this.date != null && !this.date.isEmpty();
3195        }
3196
3197        public boolean hasDate() { 
3198          return this.date != null && !this.date.isEmpty();
3199        }
3200
3201        /**
3202         * @param value {@link #date} (Date of an accident event  related to the products and services contained in the claim.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
3203         */
3204        public AccidentComponent setDateElement(DateType value) { 
3205          this.date = value;
3206          return this;
3207        }
3208
3209        /**
3210         * @return Date of an accident event  related to the products and services contained in the claim.
3211         */
3212        public Date getDate() { 
3213          return this.date == null ? null : this.date.getValue();
3214        }
3215
3216        /**
3217         * @param value Date of an accident event  related to the products and services contained in the claim.
3218         */
3219        public AccidentComponent setDate(Date value) { 
3220          if (value == null)
3221            this.date = null;
3222          else {
3223            if (this.date == null)
3224              this.date = new DateType();
3225            this.date.setValue(value);
3226          }
3227          return this;
3228        }
3229
3230        /**
3231         * @return {@link #type} (The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.)
3232         */
3233        public CodeableConcept getType() { 
3234          if (this.type == null)
3235            if (Configuration.errorOnAutoCreate())
3236              throw new Error("Attempt to auto-create AccidentComponent.type");
3237            else if (Configuration.doAutoCreate())
3238              this.type = new CodeableConcept(); // cc
3239          return this.type;
3240        }
3241
3242        public boolean hasType() { 
3243          return this.type != null && !this.type.isEmpty();
3244        }
3245
3246        /**
3247         * @param value {@link #type} (The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.)
3248         */
3249        public AccidentComponent setType(CodeableConcept value) { 
3250          this.type = value;
3251          return this;
3252        }
3253
3254        /**
3255         * @return {@link #location} (The physical location of the accident event.)
3256         */
3257        public Type getLocation() { 
3258          return this.location;
3259        }
3260
3261        /**
3262         * @return {@link #location} (The physical location of the accident event.)
3263         */
3264        public Address getLocationAddress() throws FHIRException { 
3265          if (this.location == null)
3266            this.location = new Address();
3267          if (!(this.location instanceof Address))
3268            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
3269          return (Address) this.location;
3270        }
3271
3272        public boolean hasLocationAddress() { 
3273          return this != null && this.location instanceof Address;
3274        }
3275
3276        /**
3277         * @return {@link #location} (The physical location of the accident event.)
3278         */
3279        public Reference getLocationReference() throws FHIRException { 
3280          if (this.location == null)
3281            this.location = new Reference();
3282          if (!(this.location instanceof Reference))
3283            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
3284          return (Reference) this.location;
3285        }
3286
3287        public boolean hasLocationReference() { 
3288          return this != null && this.location instanceof Reference;
3289        }
3290
3291        public boolean hasLocation() { 
3292          return this.location != null && !this.location.isEmpty();
3293        }
3294
3295        /**
3296         * @param value {@link #location} (The physical location of the accident event.)
3297         */
3298        public AccidentComponent setLocation(Type value) { 
3299          if (value != null && !(value instanceof Address || value instanceof Reference))
3300            throw new Error("Not the right type for ExplanationOfBenefit.accident.location[x]: "+value.fhirType());
3301          this.location = value;
3302          return this;
3303        }
3304
3305        protected void listChildren(List<Property> children) {
3306          super.listChildren(children);
3307          children.add(new Property("date", "date", "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date));
3308          children.add(new Property("type", "CodeableConcept", "The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.", 0, 1, type));
3309          children.add(new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location));
3310        }
3311
3312        @Override
3313        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3314          switch (_hash) {
3315          case 3076014: /*date*/  return new Property("date", "date", "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date);
3316          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.", 0, 1, type);
3317          case 552316075: /*location[x]*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3318          case 1901043637: /*location*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3319          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3320          case 755866390: /*locationReference*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3321          default: return super.getNamedProperty(_hash, _name, _checkValid);
3322          }
3323
3324        }
3325
3326      @Override
3327      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3328        switch (hash) {
3329        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
3330        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3331        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
3332        default: return super.getProperty(hash, name, checkValid);
3333        }
3334
3335      }
3336
3337      @Override
3338      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3339        switch (hash) {
3340        case 3076014: // date
3341          this.date = castToDate(value); // DateType
3342          return value;
3343        case 3575610: // type
3344          this.type = castToCodeableConcept(value); // CodeableConcept
3345          return value;
3346        case 1901043637: // location
3347          this.location = castToType(value); // Type
3348          return value;
3349        default: return super.setProperty(hash, name, value);
3350        }
3351
3352      }
3353
3354      @Override
3355      public Base setProperty(String name, Base value) throws FHIRException {
3356        if (name.equals("date")) {
3357          this.date = castToDate(value); // DateType
3358        } else if (name.equals("type")) {
3359          this.type = castToCodeableConcept(value); // CodeableConcept
3360        } else if (name.equals("location[x]")) {
3361          this.location = castToType(value); // Type
3362        } else
3363          return super.setProperty(name, value);
3364        return value;
3365      }
3366
3367      @Override
3368      public Base makeProperty(int hash, String name) throws FHIRException {
3369        switch (hash) {
3370        case 3076014:  return getDateElement();
3371        case 3575610:  return getType(); 
3372        case 552316075:  return getLocation(); 
3373        case 1901043637:  return getLocation(); 
3374        default: return super.makeProperty(hash, name);
3375        }
3376
3377      }
3378
3379      @Override
3380      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3381        switch (hash) {
3382        case 3076014: /*date*/ return new String[] {"date"};
3383        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3384        case 1901043637: /*location*/ return new String[] {"Address", "Reference"};
3385        default: return super.getTypesForProperty(hash, name);
3386        }
3387
3388      }
3389
3390      @Override
3391      public Base addChild(String name) throws FHIRException {
3392        if (name.equals("date")) {
3393          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
3394        }
3395        else if (name.equals("type")) {
3396          this.type = new CodeableConcept();
3397          return this.type;
3398        }
3399        else if (name.equals("locationAddress")) {
3400          this.location = new Address();
3401          return this.location;
3402        }
3403        else if (name.equals("locationReference")) {
3404          this.location = new Reference();
3405          return this.location;
3406        }
3407        else
3408          return super.addChild(name);
3409      }
3410
3411      public AccidentComponent copy() {
3412        AccidentComponent dst = new AccidentComponent();
3413        copyValues(dst);
3414        dst.date = date == null ? null : date.copy();
3415        dst.type = type == null ? null : type.copy();
3416        dst.location = location == null ? null : location.copy();
3417        return dst;
3418      }
3419
3420      @Override
3421      public boolean equalsDeep(Base other_) {
3422        if (!super.equalsDeep(other_))
3423          return false;
3424        if (!(other_ instanceof AccidentComponent))
3425          return false;
3426        AccidentComponent o = (AccidentComponent) other_;
3427        return compareDeep(date, o.date, true) && compareDeep(type, o.type, true) && compareDeep(location, o.location, true)
3428          ;
3429      }
3430
3431      @Override
3432      public boolean equalsShallow(Base other_) {
3433        if (!super.equalsShallow(other_))
3434          return false;
3435        if (!(other_ instanceof AccidentComponent))
3436          return false;
3437        AccidentComponent o = (AccidentComponent) other_;
3438        return compareValues(date, o.date, true);
3439      }
3440
3441      public boolean isEmpty() {
3442        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
3443      }
3444
3445  public String fhirType() {
3446    return "ExplanationOfBenefit.accident";
3447
3448  }
3449
3450  }
3451
3452    @Block()
3453    public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
3454        /**
3455         * A number to uniquely identify item entries.
3456         */
3457        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
3458        @Description(shortDefinition="Item instance identifier", formalDefinition="A number to uniquely identify item entries." )
3459        protected PositiveIntType sequence;
3460
3461        /**
3462         * Care team members related to this service or product.
3463         */
3464        @Child(name = "careTeamSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3465        @Description(shortDefinition="Applicable care team members", formalDefinition="Care team members related to this service or product." )
3466        protected List<PositiveIntType> careTeamSequence;
3467
3468        /**
3469         * Diagnoses applicable for this service or product.
3470         */
3471        @Child(name = "diagnosisSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3472        @Description(shortDefinition="Applicable diagnoses", formalDefinition="Diagnoses applicable for this service or product." )
3473        protected List<PositiveIntType> diagnosisSequence;
3474
3475        /**
3476         * Procedures applicable for this service or product.
3477         */
3478        @Child(name = "procedureSequence", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3479        @Description(shortDefinition="Applicable procedures", formalDefinition="Procedures applicable for this service or product." )
3480        protected List<PositiveIntType> procedureSequence;
3481
3482        /**
3483         * Exceptions, special conditions and supporting information applicable for this service or product.
3484         */
3485        @Child(name = "informationSequence", type = {PositiveIntType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3486        @Description(shortDefinition="Applicable exception and supporting information", formalDefinition="Exceptions, special conditions and supporting information applicable for this service or product." )
3487        protected List<PositiveIntType> informationSequence;
3488
3489        /**
3490         * The type of revenue or cost center providing the product and/or service.
3491         */
3492        @Child(name = "revenue", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
3493        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
3494        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
3495        protected CodeableConcept revenue;
3496
3497        /**
3498         * Code to identify the general type of benefits under which products and services are provided.
3499         */
3500        @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
3501        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
3502        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
3503        protected CodeableConcept category;
3504
3505        /**
3506         * When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.
3507         */
3508        @Child(name = "productOrService", type = {CodeableConcept.class}, order=8, min=1, max=1, modifier=false, summary=false)
3509        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item." )
3510        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
3511        protected CodeableConcept productOrService;
3512
3513        /**
3514         * Item typification or modifiers codes to convey additional context for the product or service.
3515         */
3516        @Child(name = "modifier", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3517        @Description(shortDefinition="Product or service billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
3518        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
3519        protected List<CodeableConcept> modifier;
3520
3521        /**
3522         * Identifies the program under which this may be recovered.
3523         */
3524        @Child(name = "programCode", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3525        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
3526        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
3527        protected List<CodeableConcept> programCode;
3528
3529        /**
3530         * The date or dates when the service or product was supplied, performed or completed.
3531         */
3532        @Child(name = "serviced", type = {DateType.class, Period.class}, order=11, min=0, max=1, modifier=false, summary=false)
3533        @Description(shortDefinition="Date or dates of service or product delivery", formalDefinition="The date or dates when the service or product was supplied, performed or completed." )
3534        protected Type serviced;
3535
3536        /**
3537         * Where the product or service was provided.
3538         */
3539        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
3540        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
3541        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
3542        protected Type location;
3543
3544        /**
3545         * The number of repetitions of a service or product.
3546         */
3547        @Child(name = "quantity", type = {Quantity.class}, order=13, min=0, max=1, modifier=false, summary=false)
3548        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
3549        protected Quantity quantity;
3550
3551        /**
3552         * If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.
3553         */
3554        @Child(name = "unitPrice", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
3555        @Description(shortDefinition="Fee, charge or cost per item", formalDefinition="If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group." )
3556        protected Money unitPrice;
3557
3558        /**
3559         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3560         */
3561        @Child(name = "factor", type = {DecimalType.class}, order=15, min=0, max=1, modifier=false, summary=false)
3562        @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." )
3563        protected DecimalType factor;
3564
3565        /**
3566         * The quantity times the unit price for an additional service or product or charge.
3567         */
3568        @Child(name = "net", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=false)
3569        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
3570        protected Money net;
3571
3572        /**
3573         * Unique Device Identifiers associated with this line item.
3574         */
3575        @Child(name = "udi", type = {Device.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3576        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
3577        protected List<Reference> udi;
3578        /**
3579         * The actual objects that are the target of the reference (Unique Device Identifiers associated with this line item.)
3580         */
3581        protected List<Device> udiTarget;
3582
3583
3584        /**
3585         * Physical service site on the patient (limb, tooth, etc.).
3586         */
3587        @Child(name = "bodySite", type = {CodeableConcept.class}, order=18, min=0, max=1, modifier=false, summary=false)
3588        @Description(shortDefinition="Anatomical location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
3589        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
3590        protected CodeableConcept bodySite;
3591
3592        /**
3593         * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
3594         */
3595        @Child(name = "subSite", type = {CodeableConcept.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3596        @Description(shortDefinition="Anatomical sub-location", formalDefinition="A region or surface of the bodySite, e.g. limb region or tooth surface(s)." )
3597        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
3598        protected List<CodeableConcept> subSite;
3599
3600        /**
3601         * A billed item may include goods or services provided in multiple encounters.
3602         */
3603        @Child(name = "encounter", type = {Encounter.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3604        @Description(shortDefinition="Encounters related to this billed item", formalDefinition="A billed item may include goods or services provided in multiple encounters." )
3605        protected List<Reference> encounter;
3606        /**
3607         * The actual objects that are the target of the reference (A billed item may include goods or services provided in multiple encounters.)
3608         */
3609        protected List<Encounter> encounterTarget;
3610
3611
3612        /**
3613         * The numbers associated with notes below which apply to the adjudication of this item.
3614         */
3615        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3616        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
3617        protected List<PositiveIntType> noteNumber;
3618
3619        /**
3620         * If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item.
3621         */
3622        @Child(name = "adjudication", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3623        @Description(shortDefinition="Adjudication details", formalDefinition="If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item." )
3624        protected List<AdjudicationComponent> adjudication;
3625
3626        /**
3627         * Second-tier of goods and services.
3628         */
3629        @Child(name = "detail", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3630        @Description(shortDefinition="Additional items", formalDefinition="Second-tier of goods and services." )
3631        protected List<DetailComponent> detail;
3632
3633        private static final long serialVersionUID = 67419471L;
3634
3635    /**
3636     * Constructor
3637     */
3638      public ItemComponent() {
3639        super();
3640      }
3641
3642    /**
3643     * Constructor
3644     */
3645      public ItemComponent(PositiveIntType sequence, CodeableConcept productOrService) {
3646        super();
3647        this.sequence = sequence;
3648        this.productOrService = productOrService;
3649      }
3650
3651        /**
3652         * @return {@link #sequence} (A number to uniquely identify item entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
3653         */
3654        public PositiveIntType getSequenceElement() { 
3655          if (this.sequence == null)
3656            if (Configuration.errorOnAutoCreate())
3657              throw new Error("Attempt to auto-create ItemComponent.sequence");
3658            else if (Configuration.doAutoCreate())
3659              this.sequence = new PositiveIntType(); // bb
3660          return this.sequence;
3661        }
3662
3663        public boolean hasSequenceElement() { 
3664          return this.sequence != null && !this.sequence.isEmpty();
3665        }
3666
3667        public boolean hasSequence() { 
3668          return this.sequence != null && !this.sequence.isEmpty();
3669        }
3670
3671        /**
3672         * @param value {@link #sequence} (A number to uniquely identify item entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
3673         */
3674        public ItemComponent setSequenceElement(PositiveIntType value) { 
3675          this.sequence = value;
3676          return this;
3677        }
3678
3679        /**
3680         * @return A number to uniquely identify item entries.
3681         */
3682        public int getSequence() { 
3683          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3684        }
3685
3686        /**
3687         * @param value A number to uniquely identify item entries.
3688         */
3689        public ItemComponent setSequence(int value) { 
3690            if (this.sequence == null)
3691              this.sequence = new PositiveIntType();
3692            this.sequence.setValue(value);
3693          return this;
3694        }
3695
3696        /**
3697         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3698         */
3699        public List<PositiveIntType> getCareTeamSequence() { 
3700          if (this.careTeamSequence == null)
3701            this.careTeamSequence = new ArrayList<PositiveIntType>();
3702          return this.careTeamSequence;
3703        }
3704
3705        /**
3706         * @return Returns a reference to <code>this</code> for easy method chaining
3707         */
3708        public ItemComponent setCareTeamSequence(List<PositiveIntType> theCareTeamSequence) { 
3709          this.careTeamSequence = theCareTeamSequence;
3710          return this;
3711        }
3712
3713        public boolean hasCareTeamSequence() { 
3714          if (this.careTeamSequence == null)
3715            return false;
3716          for (PositiveIntType item : this.careTeamSequence)
3717            if (!item.isEmpty())
3718              return true;
3719          return false;
3720        }
3721
3722        /**
3723         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3724         */
3725        public PositiveIntType addCareTeamSequenceElement() {//2 
3726          PositiveIntType t = new PositiveIntType();
3727          if (this.careTeamSequence == null)
3728            this.careTeamSequence = new ArrayList<PositiveIntType>();
3729          this.careTeamSequence.add(t);
3730          return t;
3731        }
3732
3733        /**
3734         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3735         */
3736        public ItemComponent addCareTeamSequence(int value) { //1
3737          PositiveIntType t = new PositiveIntType();
3738          t.setValue(value);
3739          if (this.careTeamSequence == null)
3740            this.careTeamSequence = new ArrayList<PositiveIntType>();
3741          this.careTeamSequence.add(t);
3742          return this;
3743        }
3744
3745        /**
3746         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3747         */
3748        public boolean hasCareTeamSequence(int value) { 
3749          if (this.careTeamSequence == null)
3750            return false;
3751          for (PositiveIntType v : this.careTeamSequence)
3752            if (v.getValue().equals(value)) // positiveInt
3753              return true;
3754          return false;
3755        }
3756
3757        /**
3758         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3759         */
3760        public List<PositiveIntType> getDiagnosisSequence() { 
3761          if (this.diagnosisSequence == null)
3762            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3763          return this.diagnosisSequence;
3764        }
3765
3766        /**
3767         * @return Returns a reference to <code>this</code> for easy method chaining
3768         */
3769        public ItemComponent setDiagnosisSequence(List<PositiveIntType> theDiagnosisSequence) { 
3770          this.diagnosisSequence = theDiagnosisSequence;
3771          return this;
3772        }
3773
3774        public boolean hasDiagnosisSequence() { 
3775          if (this.diagnosisSequence == null)
3776            return false;
3777          for (PositiveIntType item : this.diagnosisSequence)
3778            if (!item.isEmpty())
3779              return true;
3780          return false;
3781        }
3782
3783        /**
3784         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3785         */
3786        public PositiveIntType addDiagnosisSequenceElement() {//2 
3787          PositiveIntType t = new PositiveIntType();
3788          if (this.diagnosisSequence == null)
3789            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3790          this.diagnosisSequence.add(t);
3791          return t;
3792        }
3793
3794        /**
3795         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3796         */
3797        public ItemComponent addDiagnosisSequence(int value) { //1
3798          PositiveIntType t = new PositiveIntType();
3799          t.setValue(value);
3800          if (this.diagnosisSequence == null)
3801            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3802          this.diagnosisSequence.add(t);
3803          return this;
3804        }
3805
3806        /**
3807         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3808         */
3809        public boolean hasDiagnosisSequence(int value) { 
3810          if (this.diagnosisSequence == null)
3811            return false;
3812          for (PositiveIntType v : this.diagnosisSequence)
3813            if (v.getValue().equals(value)) // positiveInt
3814              return true;
3815          return false;
3816        }
3817
3818        /**
3819         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3820         */
3821        public List<PositiveIntType> getProcedureSequence() { 
3822          if (this.procedureSequence == null)
3823            this.procedureSequence = new ArrayList<PositiveIntType>();
3824          return this.procedureSequence;
3825        }
3826
3827        /**
3828         * @return Returns a reference to <code>this</code> for easy method chaining
3829         */
3830        public ItemComponent setProcedureSequence(List<PositiveIntType> theProcedureSequence) { 
3831          this.procedureSequence = theProcedureSequence;
3832          return this;
3833        }
3834
3835        public boolean hasProcedureSequence() { 
3836          if (this.procedureSequence == null)
3837            return false;
3838          for (PositiveIntType item : this.procedureSequence)
3839            if (!item.isEmpty())
3840              return true;
3841          return false;
3842        }
3843
3844        /**
3845         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3846         */
3847        public PositiveIntType addProcedureSequenceElement() {//2 
3848          PositiveIntType t = new PositiveIntType();
3849          if (this.procedureSequence == null)
3850            this.procedureSequence = new ArrayList<PositiveIntType>();
3851          this.procedureSequence.add(t);
3852          return t;
3853        }
3854
3855        /**
3856         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3857         */
3858        public ItemComponent addProcedureSequence(int value) { //1
3859          PositiveIntType t = new PositiveIntType();
3860          t.setValue(value);
3861          if (this.procedureSequence == null)
3862            this.procedureSequence = new ArrayList<PositiveIntType>();
3863          this.procedureSequence.add(t);
3864          return this;
3865        }
3866
3867        /**
3868         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3869         */
3870        public boolean hasProcedureSequence(int value) { 
3871          if (this.procedureSequence == null)
3872            return false;
3873          for (PositiveIntType v : this.procedureSequence)
3874            if (v.getValue().equals(value)) // positiveInt
3875              return true;
3876          return false;
3877        }
3878
3879        /**
3880         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3881         */
3882        public List<PositiveIntType> getInformationSequence() { 
3883          if (this.informationSequence == null)
3884            this.informationSequence = new ArrayList<PositiveIntType>();
3885          return this.informationSequence;
3886        }
3887
3888        /**
3889         * @return Returns a reference to <code>this</code> for easy method chaining
3890         */
3891        public ItemComponent setInformationSequence(List<PositiveIntType> theInformationSequence) { 
3892          this.informationSequence = theInformationSequence;
3893          return this;
3894        }
3895
3896        public boolean hasInformationSequence() { 
3897          if (this.informationSequence == null)
3898            return false;
3899          for (PositiveIntType item : this.informationSequence)
3900            if (!item.isEmpty())
3901              return true;
3902          return false;
3903        }
3904
3905        /**
3906         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3907         */
3908        public PositiveIntType addInformationSequenceElement() {//2 
3909          PositiveIntType t = new PositiveIntType();
3910          if (this.informationSequence == null)
3911            this.informationSequence = new ArrayList<PositiveIntType>();
3912          this.informationSequence.add(t);
3913          return t;
3914        }
3915
3916        /**
3917         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3918         */
3919        public ItemComponent addInformationSequence(int value) { //1
3920          PositiveIntType t = new PositiveIntType();
3921          t.setValue(value);
3922          if (this.informationSequence == null)
3923            this.informationSequence = new ArrayList<PositiveIntType>();
3924          this.informationSequence.add(t);
3925          return this;
3926        }
3927
3928        /**
3929         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3930         */
3931        public boolean hasInformationSequence(int value) { 
3932          if (this.informationSequence == null)
3933            return false;
3934          for (PositiveIntType v : this.informationSequence)
3935            if (v.getValue().equals(value)) // positiveInt
3936              return true;
3937          return false;
3938        }
3939
3940        /**
3941         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3942         */
3943        public CodeableConcept getRevenue() { 
3944          if (this.revenue == null)
3945            if (Configuration.errorOnAutoCreate())
3946              throw new Error("Attempt to auto-create ItemComponent.revenue");
3947            else if (Configuration.doAutoCreate())
3948              this.revenue = new CodeableConcept(); // cc
3949          return this.revenue;
3950        }
3951
3952        public boolean hasRevenue() { 
3953          return this.revenue != null && !this.revenue.isEmpty();
3954        }
3955
3956        /**
3957         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3958         */
3959        public ItemComponent setRevenue(CodeableConcept value) { 
3960          this.revenue = value;
3961          return this;
3962        }
3963
3964        /**
3965         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
3966         */
3967        public CodeableConcept getCategory() { 
3968          if (this.category == null)
3969            if (Configuration.errorOnAutoCreate())
3970              throw new Error("Attempt to auto-create ItemComponent.category");
3971            else if (Configuration.doAutoCreate())
3972              this.category = new CodeableConcept(); // cc
3973          return this.category;
3974        }
3975
3976        public boolean hasCategory() { 
3977          return this.category != null && !this.category.isEmpty();
3978        }
3979
3980        /**
3981         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
3982         */
3983        public ItemComponent setCategory(CodeableConcept value) { 
3984          this.category = value;
3985          return this;
3986        }
3987
3988        /**
3989         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
3990         */
3991        public CodeableConcept getProductOrService() { 
3992          if (this.productOrService == null)
3993            if (Configuration.errorOnAutoCreate())
3994              throw new Error("Attempt to auto-create ItemComponent.productOrService");
3995            else if (Configuration.doAutoCreate())
3996              this.productOrService = new CodeableConcept(); // cc
3997          return this.productOrService;
3998        }
3999
4000        public boolean hasProductOrService() { 
4001          return this.productOrService != null && !this.productOrService.isEmpty();
4002        }
4003
4004        /**
4005         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
4006         */
4007        public ItemComponent setProductOrService(CodeableConcept value) { 
4008          this.productOrService = value;
4009          return this;
4010        }
4011
4012        /**
4013         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
4014         */
4015        public List<CodeableConcept> getModifier() { 
4016          if (this.modifier == null)
4017            this.modifier = new ArrayList<CodeableConcept>();
4018          return this.modifier;
4019        }
4020
4021        /**
4022         * @return Returns a reference to <code>this</code> for easy method chaining
4023         */
4024        public ItemComponent setModifier(List<CodeableConcept> theModifier) { 
4025          this.modifier = theModifier;
4026          return this;
4027        }
4028
4029        public boolean hasModifier() { 
4030          if (this.modifier == null)
4031            return false;
4032          for (CodeableConcept item : this.modifier)
4033            if (!item.isEmpty())
4034              return true;
4035          return false;
4036        }
4037
4038        public CodeableConcept addModifier() { //3
4039          CodeableConcept t = new CodeableConcept();
4040          if (this.modifier == null)
4041            this.modifier = new ArrayList<CodeableConcept>();
4042          this.modifier.add(t);
4043          return t;
4044        }
4045
4046        public ItemComponent addModifier(CodeableConcept t) { //3
4047          if (t == null)
4048            return this;
4049          if (this.modifier == null)
4050            this.modifier = new ArrayList<CodeableConcept>();
4051          this.modifier.add(t);
4052          return this;
4053        }
4054
4055        /**
4056         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
4057         */
4058        public CodeableConcept getModifierFirstRep() { 
4059          if (getModifier().isEmpty()) {
4060            addModifier();
4061          }
4062          return getModifier().get(0);
4063        }
4064
4065        /**
4066         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
4067         */
4068        public List<CodeableConcept> getProgramCode() { 
4069          if (this.programCode == null)
4070            this.programCode = new ArrayList<CodeableConcept>();
4071          return this.programCode;
4072        }
4073
4074        /**
4075         * @return Returns a reference to <code>this</code> for easy method chaining
4076         */
4077        public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
4078          this.programCode = theProgramCode;
4079          return this;
4080        }
4081
4082        public boolean hasProgramCode() { 
4083          if (this.programCode == null)
4084            return false;
4085          for (CodeableConcept item : this.programCode)
4086            if (!item.isEmpty())
4087              return true;
4088          return false;
4089        }
4090
4091        public CodeableConcept addProgramCode() { //3
4092          CodeableConcept t = new CodeableConcept();
4093          if (this.programCode == null)
4094            this.programCode = new ArrayList<CodeableConcept>();
4095          this.programCode.add(t);
4096          return t;
4097        }
4098
4099        public ItemComponent addProgramCode(CodeableConcept t) { //3
4100          if (t == null)
4101            return this;
4102          if (this.programCode == null)
4103            this.programCode = new ArrayList<CodeableConcept>();
4104          this.programCode.add(t);
4105          return this;
4106        }
4107
4108        /**
4109         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
4110         */
4111        public CodeableConcept getProgramCodeFirstRep() { 
4112          if (getProgramCode().isEmpty()) {
4113            addProgramCode();
4114          }
4115          return getProgramCode().get(0);
4116        }
4117
4118        /**
4119         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4120         */
4121        public Type getServiced() { 
4122          return this.serviced;
4123        }
4124
4125        /**
4126         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4127         */
4128        public DateType getServicedDateType() throws FHIRException { 
4129          if (this.serviced == null)
4130            this.serviced = new DateType();
4131          if (!(this.serviced instanceof DateType))
4132            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
4133          return (DateType) this.serviced;
4134        }
4135
4136        public boolean hasServicedDateType() { 
4137          return this != null && this.serviced instanceof DateType;
4138        }
4139
4140        /**
4141         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4142         */
4143        public Period getServicedPeriod() throws FHIRException { 
4144          if (this.serviced == null)
4145            this.serviced = new Period();
4146          if (!(this.serviced instanceof Period))
4147            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
4148          return (Period) this.serviced;
4149        }
4150
4151        public boolean hasServicedPeriod() { 
4152          return this != null && this.serviced instanceof Period;
4153        }
4154
4155        public boolean hasServiced() { 
4156          return this.serviced != null && !this.serviced.isEmpty();
4157        }
4158
4159        /**
4160         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4161         */
4162        public ItemComponent setServiced(Type value) { 
4163          if (value != null && !(value instanceof DateType || value instanceof Period))
4164            throw new Error("Not the right type for ExplanationOfBenefit.item.serviced[x]: "+value.fhirType());
4165          this.serviced = value;
4166          return this;
4167        }
4168
4169        /**
4170         * @return {@link #location} (Where the product or service was provided.)
4171         */
4172        public Type getLocation() { 
4173          return this.location;
4174        }
4175
4176        /**
4177         * @return {@link #location} (Where the product or service was provided.)
4178         */
4179        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
4180          if (this.location == null)
4181            this.location = new CodeableConcept();
4182          if (!(this.location instanceof CodeableConcept))
4183            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
4184          return (CodeableConcept) this.location;
4185        }
4186
4187        public boolean hasLocationCodeableConcept() { 
4188          return this != null && this.location instanceof CodeableConcept;
4189        }
4190
4191        /**
4192         * @return {@link #location} (Where the product or service was provided.)
4193         */
4194        public Address getLocationAddress() throws FHIRException { 
4195          if (this.location == null)
4196            this.location = new Address();
4197          if (!(this.location instanceof Address))
4198            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
4199          return (Address) this.location;
4200        }
4201
4202        public boolean hasLocationAddress() { 
4203          return this != null && this.location instanceof Address;
4204        }
4205
4206        /**
4207         * @return {@link #location} (Where the product or service was provided.)
4208         */
4209        public Reference getLocationReference() throws FHIRException { 
4210          if (this.location == null)
4211            this.location = new Reference();
4212          if (!(this.location instanceof Reference))
4213            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
4214          return (Reference) this.location;
4215        }
4216
4217        public boolean hasLocationReference() { 
4218          return this != null && this.location instanceof Reference;
4219        }
4220
4221        public boolean hasLocation() { 
4222          return this.location != null && !this.location.isEmpty();
4223        }
4224
4225        /**
4226         * @param value {@link #location} (Where the product or service was provided.)
4227         */
4228        public ItemComponent setLocation(Type value) { 
4229          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
4230            throw new Error("Not the right type for ExplanationOfBenefit.item.location[x]: "+value.fhirType());
4231          this.location = value;
4232          return this;
4233        }
4234
4235        /**
4236         * @return {@link #quantity} (The number of repetitions of a service or product.)
4237         */
4238        public Quantity getQuantity() { 
4239          if (this.quantity == null)
4240            if (Configuration.errorOnAutoCreate())
4241              throw new Error("Attempt to auto-create ItemComponent.quantity");
4242            else if (Configuration.doAutoCreate())
4243              this.quantity = new Quantity(); // cc
4244          return this.quantity;
4245        }
4246
4247        public boolean hasQuantity() { 
4248          return this.quantity != null && !this.quantity.isEmpty();
4249        }
4250
4251        /**
4252         * @param value {@link #quantity} (The number of repetitions of a service or product.)
4253         */
4254        public ItemComponent setQuantity(Quantity value) { 
4255          this.quantity = value;
4256          return this;
4257        }
4258
4259        /**
4260         * @return {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
4261         */
4262        public Money getUnitPrice() { 
4263          if (this.unitPrice == null)
4264            if (Configuration.errorOnAutoCreate())
4265              throw new Error("Attempt to auto-create ItemComponent.unitPrice");
4266            else if (Configuration.doAutoCreate())
4267              this.unitPrice = new Money(); // cc
4268          return this.unitPrice;
4269        }
4270
4271        public boolean hasUnitPrice() { 
4272          return this.unitPrice != null && !this.unitPrice.isEmpty();
4273        }
4274
4275        /**
4276         * @param value {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
4277         */
4278        public ItemComponent setUnitPrice(Money value) { 
4279          this.unitPrice = value;
4280          return this;
4281        }
4282
4283        /**
4284         * @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
4285         */
4286        public DecimalType getFactorElement() { 
4287          if (this.factor == null)
4288            if (Configuration.errorOnAutoCreate())
4289              throw new Error("Attempt to auto-create ItemComponent.factor");
4290            else if (Configuration.doAutoCreate())
4291              this.factor = new DecimalType(); // bb
4292          return this.factor;
4293        }
4294
4295        public boolean hasFactorElement() { 
4296          return this.factor != null && !this.factor.isEmpty();
4297        }
4298
4299        public boolean hasFactor() { 
4300          return this.factor != null && !this.factor.isEmpty();
4301        }
4302
4303        /**
4304         * @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
4305         */
4306        public ItemComponent setFactorElement(DecimalType value) { 
4307          this.factor = value;
4308          return this;
4309        }
4310
4311        /**
4312         * @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.
4313         */
4314        public BigDecimal getFactor() { 
4315          return this.factor == null ? null : this.factor.getValue();
4316        }
4317
4318        /**
4319         * @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.
4320         */
4321        public ItemComponent setFactor(BigDecimal value) { 
4322          if (value == null)
4323            this.factor = null;
4324          else {
4325            if (this.factor == null)
4326              this.factor = new DecimalType();
4327            this.factor.setValue(value);
4328          }
4329          return this;
4330        }
4331
4332        /**
4333         * @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.
4334         */
4335        public ItemComponent setFactor(long value) { 
4336              this.factor = new DecimalType();
4337            this.factor.setValue(value);
4338          return this;
4339        }
4340
4341        /**
4342         * @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.
4343         */
4344        public ItemComponent setFactor(double value) { 
4345              this.factor = new DecimalType();
4346            this.factor.setValue(value);
4347          return this;
4348        }
4349
4350        /**
4351         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4352         */
4353        public Money getNet() { 
4354          if (this.net == null)
4355            if (Configuration.errorOnAutoCreate())
4356              throw new Error("Attempt to auto-create ItemComponent.net");
4357            else if (Configuration.doAutoCreate())
4358              this.net = new Money(); // cc
4359          return this.net;
4360        }
4361
4362        public boolean hasNet() { 
4363          return this.net != null && !this.net.isEmpty();
4364        }
4365
4366        /**
4367         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4368         */
4369        public ItemComponent setNet(Money value) { 
4370          this.net = value;
4371          return this;
4372        }
4373
4374        /**
4375         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
4376         */
4377        public List<Reference> getUdi() { 
4378          if (this.udi == null)
4379            this.udi = new ArrayList<Reference>();
4380          return this.udi;
4381        }
4382
4383        /**
4384         * @return Returns a reference to <code>this</code> for easy method chaining
4385         */
4386        public ItemComponent setUdi(List<Reference> theUdi) { 
4387          this.udi = theUdi;
4388          return this;
4389        }
4390
4391        public boolean hasUdi() { 
4392          if (this.udi == null)
4393            return false;
4394          for (Reference item : this.udi)
4395            if (!item.isEmpty())
4396              return true;
4397          return false;
4398        }
4399
4400        public Reference addUdi() { //3
4401          Reference t = new Reference();
4402          if (this.udi == null)
4403            this.udi = new ArrayList<Reference>();
4404          this.udi.add(t);
4405          return t;
4406        }
4407
4408        public ItemComponent addUdi(Reference t) { //3
4409          if (t == null)
4410            return this;
4411          if (this.udi == null)
4412            this.udi = new ArrayList<Reference>();
4413          this.udi.add(t);
4414          return this;
4415        }
4416
4417        /**
4418         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
4419         */
4420        public Reference getUdiFirstRep() { 
4421          if (getUdi().isEmpty()) {
4422            addUdi();
4423          }
4424          return getUdi().get(0);
4425        }
4426
4427        /**
4428         * @deprecated Use Reference#setResource(IBaseResource) instead
4429         */
4430        @Deprecated
4431        public List<Device> getUdiTarget() { 
4432          if (this.udiTarget == null)
4433            this.udiTarget = new ArrayList<Device>();
4434          return this.udiTarget;
4435        }
4436
4437        /**
4438         * @deprecated Use Reference#setResource(IBaseResource) instead
4439         */
4440        @Deprecated
4441        public Device addUdiTarget() { 
4442          Device r = new Device();
4443          if (this.udiTarget == null)
4444            this.udiTarget = new ArrayList<Device>();
4445          this.udiTarget.add(r);
4446          return r;
4447        }
4448
4449        /**
4450         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4451         */
4452        public CodeableConcept getBodySite() { 
4453          if (this.bodySite == null)
4454            if (Configuration.errorOnAutoCreate())
4455              throw new Error("Attempt to auto-create ItemComponent.bodySite");
4456            else if (Configuration.doAutoCreate())
4457              this.bodySite = new CodeableConcept(); // cc
4458          return this.bodySite;
4459        }
4460
4461        public boolean hasBodySite() { 
4462          return this.bodySite != null && !this.bodySite.isEmpty();
4463        }
4464
4465        /**
4466         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4467         */
4468        public ItemComponent setBodySite(CodeableConcept value) { 
4469          this.bodySite = value;
4470          return this;
4471        }
4472
4473        /**
4474         * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb region or tooth surface(s).)
4475         */
4476        public List<CodeableConcept> getSubSite() { 
4477          if (this.subSite == null)
4478            this.subSite = new ArrayList<CodeableConcept>();
4479          return this.subSite;
4480        }
4481
4482        /**
4483         * @return Returns a reference to <code>this</code> for easy method chaining
4484         */
4485        public ItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
4486          this.subSite = theSubSite;
4487          return this;
4488        }
4489
4490        public boolean hasSubSite() { 
4491          if (this.subSite == null)
4492            return false;
4493          for (CodeableConcept item : this.subSite)
4494            if (!item.isEmpty())
4495              return true;
4496          return false;
4497        }
4498
4499        public CodeableConcept addSubSite() { //3
4500          CodeableConcept t = new CodeableConcept();
4501          if (this.subSite == null)
4502            this.subSite = new ArrayList<CodeableConcept>();
4503          this.subSite.add(t);
4504          return t;
4505        }
4506
4507        public ItemComponent addSubSite(CodeableConcept t) { //3
4508          if (t == null)
4509            return this;
4510          if (this.subSite == null)
4511            this.subSite = new ArrayList<CodeableConcept>();
4512          this.subSite.add(t);
4513          return this;
4514        }
4515
4516        /**
4517         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist
4518         */
4519        public CodeableConcept getSubSiteFirstRep() { 
4520          if (getSubSite().isEmpty()) {
4521            addSubSite();
4522          }
4523          return getSubSite().get(0);
4524        }
4525
4526        /**
4527         * @return {@link #encounter} (A billed item may include goods or services provided in multiple encounters.)
4528         */
4529        public List<Reference> getEncounter() { 
4530          if (this.encounter == null)
4531            this.encounter = new ArrayList<Reference>();
4532          return this.encounter;
4533        }
4534
4535        /**
4536         * @return Returns a reference to <code>this</code> for easy method chaining
4537         */
4538        public ItemComponent setEncounter(List<Reference> theEncounter) { 
4539          this.encounter = theEncounter;
4540          return this;
4541        }
4542
4543        public boolean hasEncounter() { 
4544          if (this.encounter == null)
4545            return false;
4546          for (Reference item : this.encounter)
4547            if (!item.isEmpty())
4548              return true;
4549          return false;
4550        }
4551
4552        public Reference addEncounter() { //3
4553          Reference t = new Reference();
4554          if (this.encounter == null)
4555            this.encounter = new ArrayList<Reference>();
4556          this.encounter.add(t);
4557          return t;
4558        }
4559
4560        public ItemComponent addEncounter(Reference t) { //3
4561          if (t == null)
4562            return this;
4563          if (this.encounter == null)
4564            this.encounter = new ArrayList<Reference>();
4565          this.encounter.add(t);
4566          return this;
4567        }
4568
4569        /**
4570         * @return The first repetition of repeating field {@link #encounter}, creating it if it does not already exist
4571         */
4572        public Reference getEncounterFirstRep() { 
4573          if (getEncounter().isEmpty()) {
4574            addEncounter();
4575          }
4576          return getEncounter().get(0);
4577        }
4578
4579        /**
4580         * @deprecated Use Reference#setResource(IBaseResource) instead
4581         */
4582        @Deprecated
4583        public List<Encounter> getEncounterTarget() { 
4584          if (this.encounterTarget == null)
4585            this.encounterTarget = new ArrayList<Encounter>();
4586          return this.encounterTarget;
4587        }
4588
4589        /**
4590         * @deprecated Use Reference#setResource(IBaseResource) instead
4591         */
4592        @Deprecated
4593        public Encounter addEncounterTarget() { 
4594          Encounter r = new Encounter();
4595          if (this.encounterTarget == null)
4596            this.encounterTarget = new ArrayList<Encounter>();
4597          this.encounterTarget.add(r);
4598          return r;
4599        }
4600
4601        /**
4602         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4603         */
4604        public List<PositiveIntType> getNoteNumber() { 
4605          if (this.noteNumber == null)
4606            this.noteNumber = new ArrayList<PositiveIntType>();
4607          return this.noteNumber;
4608        }
4609
4610        /**
4611         * @return Returns a reference to <code>this</code> for easy method chaining
4612         */
4613        public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
4614          this.noteNumber = theNoteNumber;
4615          return this;
4616        }
4617
4618        public boolean hasNoteNumber() { 
4619          if (this.noteNumber == null)
4620            return false;
4621          for (PositiveIntType item : this.noteNumber)
4622            if (!item.isEmpty())
4623              return true;
4624          return false;
4625        }
4626
4627        /**
4628         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4629         */
4630        public PositiveIntType addNoteNumberElement() {//2 
4631          PositiveIntType t = new PositiveIntType();
4632          if (this.noteNumber == null)
4633            this.noteNumber = new ArrayList<PositiveIntType>();
4634          this.noteNumber.add(t);
4635          return t;
4636        }
4637
4638        /**
4639         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4640         */
4641        public ItemComponent addNoteNumber(int value) { //1
4642          PositiveIntType t = new PositiveIntType();
4643          t.setValue(value);
4644          if (this.noteNumber == null)
4645            this.noteNumber = new ArrayList<PositiveIntType>();
4646          this.noteNumber.add(t);
4647          return this;
4648        }
4649
4650        /**
4651         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4652         */
4653        public boolean hasNoteNumber(int value) { 
4654          if (this.noteNumber == null)
4655            return false;
4656          for (PositiveIntType v : this.noteNumber)
4657            if (v.getValue().equals(value)) // positiveInt
4658              return true;
4659          return false;
4660        }
4661
4662        /**
4663         * @return {@link #adjudication} (If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item.)
4664         */
4665        public List<AdjudicationComponent> getAdjudication() { 
4666          if (this.adjudication == null)
4667            this.adjudication = new ArrayList<AdjudicationComponent>();
4668          return this.adjudication;
4669        }
4670
4671        /**
4672         * @return Returns a reference to <code>this</code> for easy method chaining
4673         */
4674        public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
4675          this.adjudication = theAdjudication;
4676          return this;
4677        }
4678
4679        public boolean hasAdjudication() { 
4680          if (this.adjudication == null)
4681            return false;
4682          for (AdjudicationComponent item : this.adjudication)
4683            if (!item.isEmpty())
4684              return true;
4685          return false;
4686        }
4687
4688        public AdjudicationComponent addAdjudication() { //3
4689          AdjudicationComponent t = new AdjudicationComponent();
4690          if (this.adjudication == null)
4691            this.adjudication = new ArrayList<AdjudicationComponent>();
4692          this.adjudication.add(t);
4693          return t;
4694        }
4695
4696        public ItemComponent addAdjudication(AdjudicationComponent t) { //3
4697          if (t == null)
4698            return this;
4699          if (this.adjudication == null)
4700            this.adjudication = new ArrayList<AdjudicationComponent>();
4701          this.adjudication.add(t);
4702          return this;
4703        }
4704
4705        /**
4706         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
4707         */
4708        public AdjudicationComponent getAdjudicationFirstRep() { 
4709          if (getAdjudication().isEmpty()) {
4710            addAdjudication();
4711          }
4712          return getAdjudication().get(0);
4713        }
4714
4715        /**
4716         * @return {@link #detail} (Second-tier of goods and services.)
4717         */
4718        public List<DetailComponent> getDetail() { 
4719          if (this.detail == null)
4720            this.detail = new ArrayList<DetailComponent>();
4721          return this.detail;
4722        }
4723
4724        /**
4725         * @return Returns a reference to <code>this</code> for easy method chaining
4726         */
4727        public ItemComponent setDetail(List<DetailComponent> theDetail) { 
4728          this.detail = theDetail;
4729          return this;
4730        }
4731
4732        public boolean hasDetail() { 
4733          if (this.detail == null)
4734            return false;
4735          for (DetailComponent item : this.detail)
4736            if (!item.isEmpty())
4737              return true;
4738          return false;
4739        }
4740
4741        public DetailComponent addDetail() { //3
4742          DetailComponent t = new DetailComponent();
4743          if (this.detail == null)
4744            this.detail = new ArrayList<DetailComponent>();
4745          this.detail.add(t);
4746          return t;
4747        }
4748
4749        public ItemComponent addDetail(DetailComponent t) { //3
4750          if (t == null)
4751            return this;
4752          if (this.detail == null)
4753            this.detail = new ArrayList<DetailComponent>();
4754          this.detail.add(t);
4755          return this;
4756        }
4757
4758        /**
4759         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
4760         */
4761        public DetailComponent getDetailFirstRep() { 
4762          if (getDetail().isEmpty()) {
4763            addDetail();
4764          }
4765          return getDetail().get(0);
4766        }
4767
4768        protected void listChildren(List<Property> children) {
4769          super.listChildren(children);
4770          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence));
4771          children.add(new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence));
4772          children.add(new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence));
4773          children.add(new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence));
4774          children.add(new Property("informationSequence", "positiveInt", "Exceptions, special conditions and supporting information applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, informationSequence));
4775          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
4776          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
4777          children.add(new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService));
4778          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier));
4779          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
4780          children.add(new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced));
4781          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location));
4782          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
4783          children.add(new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice));
4784          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));
4785          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
4786          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
4787          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
4788          children.add(new Property("subSite", "CodeableConcept", "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite));
4789          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));
4790          children.add(new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
4791          children.add(new Property("adjudication", "", "If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, adjudication));
4792          children.add(new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
4793        }
4794
4795        @Override
4796        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4797          switch (_hash) {
4798          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence);
4799          case 1070083823: /*careTeamSequence*/  return new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence);
4800          case -909769262: /*diagnosisSequence*/  return new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence);
4801          case -808920140: /*procedureSequence*/  return new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence);
4802          case -702585587: /*informationSequence*/  return new Property("informationSequence", "positiveInt", "Exceptions, special conditions and supporting information applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, informationSequence);
4803          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
4804          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category);
4805          case 1957227299: /*productOrService*/  return new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService);
4806          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier);
4807          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
4808          case -1927922223: /*serviced[x]*/  return new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
4809          case 1379209295: /*serviced*/  return new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
4810          case 363246749: /*servicedDate*/  return new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
4811          case 1534966512: /*servicedPeriod*/  return new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
4812          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4813          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4814          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4815          case -1280020865: /*locationAddress*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4816          case 755866390: /*locationReference*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4817          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
4818          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice);
4819          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);
4820          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
4821          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
4822          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
4823          case -1868566105: /*subSite*/  return new Property("subSite", "CodeableConcept", "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite);
4824          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);
4825          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
4826          case -231349275: /*adjudication*/  return new Property("adjudication", "", "If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, adjudication);
4827          case -1335224239: /*detail*/  return new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail);
4828          default: return super.getNamedProperty(_hash, _name, _checkValid);
4829          }
4830
4831        }
4832
4833      @Override
4834      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4835        switch (hash) {
4836        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
4837        case 1070083823: /*careTeamSequence*/ return this.careTeamSequence == null ? new Base[0] : this.careTeamSequence.toArray(new Base[this.careTeamSequence.size()]); // PositiveIntType
4838        case -909769262: /*diagnosisSequence*/ return this.diagnosisSequence == null ? new Base[0] : this.diagnosisSequence.toArray(new Base[this.diagnosisSequence.size()]); // PositiveIntType
4839        case -808920140: /*procedureSequence*/ return this.procedureSequence == null ? new Base[0] : this.procedureSequence.toArray(new Base[this.procedureSequence.size()]); // PositiveIntType
4840        case -702585587: /*informationSequence*/ return this.informationSequence == null ? new Base[0] : this.informationSequence.toArray(new Base[this.informationSequence.size()]); // PositiveIntType
4841        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
4842        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4843        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
4844        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
4845        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
4846        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
4847        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
4848        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
4849        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
4850        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
4851        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
4852        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
4853        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
4854        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
4855        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
4856        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
4857        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
4858        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
4859        default: return super.getProperty(hash, name, checkValid);
4860        }
4861
4862      }
4863
4864      @Override
4865      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4866        switch (hash) {
4867        case 1349547969: // sequence
4868          this.sequence = castToPositiveInt(value); // PositiveIntType
4869          return value;
4870        case 1070083823: // careTeamSequence
4871          this.getCareTeamSequence().add(castToPositiveInt(value)); // PositiveIntType
4872          return value;
4873        case -909769262: // diagnosisSequence
4874          this.getDiagnosisSequence().add(castToPositiveInt(value)); // PositiveIntType
4875          return value;
4876        case -808920140: // procedureSequence
4877          this.getProcedureSequence().add(castToPositiveInt(value)); // PositiveIntType
4878          return value;
4879        case -702585587: // informationSequence
4880          this.getInformationSequence().add(castToPositiveInt(value)); // PositiveIntType
4881          return value;
4882        case 1099842588: // revenue
4883          this.revenue = castToCodeableConcept(value); // CodeableConcept
4884          return value;
4885        case 50511102: // category
4886          this.category = castToCodeableConcept(value); // CodeableConcept
4887          return value;
4888        case 1957227299: // productOrService
4889          this.productOrService = castToCodeableConcept(value); // CodeableConcept
4890          return value;
4891        case -615513385: // modifier
4892          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
4893          return value;
4894        case 1010065041: // programCode
4895          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
4896          return value;
4897        case 1379209295: // serviced
4898          this.serviced = castToType(value); // Type
4899          return value;
4900        case 1901043637: // location
4901          this.location = castToType(value); // Type
4902          return value;
4903        case -1285004149: // quantity
4904          this.quantity = castToQuantity(value); // Quantity
4905          return value;
4906        case -486196699: // unitPrice
4907          this.unitPrice = castToMoney(value); // Money
4908          return value;
4909        case -1282148017: // factor
4910          this.factor = castToDecimal(value); // DecimalType
4911          return value;
4912        case 108957: // net
4913          this.net = castToMoney(value); // Money
4914          return value;
4915        case 115642: // udi
4916          this.getUdi().add(castToReference(value)); // Reference
4917          return value;
4918        case 1702620169: // bodySite
4919          this.bodySite = castToCodeableConcept(value); // CodeableConcept
4920          return value;
4921        case -1868566105: // subSite
4922          this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
4923          return value;
4924        case 1524132147: // encounter
4925          this.getEncounter().add(castToReference(value)); // Reference
4926          return value;
4927        case -1110033957: // noteNumber
4928          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
4929          return value;
4930        case -231349275: // adjudication
4931          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
4932          return value;
4933        case -1335224239: // detail
4934          this.getDetail().add((DetailComponent) value); // DetailComponent
4935          return value;
4936        default: return super.setProperty(hash, name, value);
4937        }
4938
4939      }
4940
4941      @Override
4942      public Base setProperty(String name, Base value) throws FHIRException {
4943        if (name.equals("sequence")) {
4944          this.sequence = castToPositiveInt(value); // PositiveIntType
4945        } else if (name.equals("careTeamSequence")) {
4946          this.getCareTeamSequence().add(castToPositiveInt(value));
4947        } else if (name.equals("diagnosisSequence")) {
4948          this.getDiagnosisSequence().add(castToPositiveInt(value));
4949        } else if (name.equals("procedureSequence")) {
4950          this.getProcedureSequence().add(castToPositiveInt(value));
4951        } else if (name.equals("informationSequence")) {
4952          this.getInformationSequence().add(castToPositiveInt(value));
4953        } else if (name.equals("revenue")) {
4954          this.revenue = castToCodeableConcept(value); // CodeableConcept
4955        } else if (name.equals("category")) {
4956          this.category = castToCodeableConcept(value); // CodeableConcept
4957        } else if (name.equals("productOrService")) {
4958          this.productOrService = castToCodeableConcept(value); // CodeableConcept
4959        } else if (name.equals("modifier")) {
4960          this.getModifier().add(castToCodeableConcept(value));
4961        } else if (name.equals("programCode")) {
4962          this.getProgramCode().add(castToCodeableConcept(value));
4963        } else if (name.equals("serviced[x]")) {
4964          this.serviced = castToType(value); // Type
4965        } else if (name.equals("location[x]")) {
4966          this.location = castToType(value); // Type
4967        } else if (name.equals("quantity")) {
4968          this.quantity = castToQuantity(value); // Quantity
4969        } else if (name.equals("unitPrice")) {
4970          this.unitPrice = castToMoney(value); // Money
4971        } else if (name.equals("factor")) {
4972          this.factor = castToDecimal(value); // DecimalType
4973        } else if (name.equals("net")) {
4974          this.net = castToMoney(value); // Money
4975        } else if (name.equals("udi")) {
4976          this.getUdi().add(castToReference(value));
4977        } else if (name.equals("bodySite")) {
4978          this.bodySite = castToCodeableConcept(value); // CodeableConcept
4979        } else if (name.equals("subSite")) {
4980          this.getSubSite().add(castToCodeableConcept(value));
4981        } else if (name.equals("encounter")) {
4982          this.getEncounter().add(castToReference(value));
4983        } else if (name.equals("noteNumber")) {
4984          this.getNoteNumber().add(castToPositiveInt(value));
4985        } else if (name.equals("adjudication")) {
4986          this.getAdjudication().add((AdjudicationComponent) value);
4987        } else if (name.equals("detail")) {
4988          this.getDetail().add((DetailComponent) value);
4989        } else
4990          return super.setProperty(name, value);
4991        return value;
4992      }
4993
4994      @Override
4995      public Base makeProperty(int hash, String name) throws FHIRException {
4996        switch (hash) {
4997        case 1349547969:  return getSequenceElement();
4998        case 1070083823:  return addCareTeamSequenceElement();
4999        case -909769262:  return addDiagnosisSequenceElement();
5000        case -808920140:  return addProcedureSequenceElement();
5001        case -702585587:  return addInformationSequenceElement();
5002        case 1099842588:  return getRevenue(); 
5003        case 50511102:  return getCategory(); 
5004        case 1957227299:  return getProductOrService(); 
5005        case -615513385:  return addModifier(); 
5006        case 1010065041:  return addProgramCode(); 
5007        case -1927922223:  return getServiced(); 
5008        case 1379209295:  return getServiced(); 
5009        case 552316075:  return getLocation(); 
5010        case 1901043637:  return getLocation(); 
5011        case -1285004149:  return getQuantity(); 
5012        case -486196699:  return getUnitPrice(); 
5013        case -1282148017:  return getFactorElement();
5014        case 108957:  return getNet(); 
5015        case 115642:  return addUdi(); 
5016        case 1702620169:  return getBodySite(); 
5017        case -1868566105:  return addSubSite(); 
5018        case 1524132147:  return addEncounter(); 
5019        case -1110033957:  return addNoteNumberElement();
5020        case -231349275:  return addAdjudication(); 
5021        case -1335224239:  return addDetail(); 
5022        default: return super.makeProperty(hash, name);
5023        }
5024
5025      }
5026
5027      @Override
5028      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5029        switch (hash) {
5030        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
5031        case 1070083823: /*careTeamSequence*/ return new String[] {"positiveInt"};
5032        case -909769262: /*diagnosisSequence*/ return new String[] {"positiveInt"};
5033        case -808920140: /*procedureSequence*/ return new String[] {"positiveInt"};
5034        case -702585587: /*informationSequence*/ return new String[] {"positiveInt"};
5035        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
5036        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5037        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
5038        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
5039        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
5040        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
5041        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
5042        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
5043        case -486196699: /*unitPrice*/ return new String[] {"Money"};
5044        case -1282148017: /*factor*/ return new String[] {"decimal"};
5045        case 108957: /*net*/ return new String[] {"Money"};
5046        case 115642: /*udi*/ return new String[] {"Reference"};
5047        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
5048        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
5049        case 1524132147: /*encounter*/ return new String[] {"Reference"};
5050        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
5051        case -231349275: /*adjudication*/ return new String[] {};
5052        case -1335224239: /*detail*/ return new String[] {};
5053        default: return super.getTypesForProperty(hash, name);
5054        }
5055
5056      }
5057
5058      @Override
5059      public Base addChild(String name) throws FHIRException {
5060        if (name.equals("sequence")) {
5061          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
5062        }
5063        else if (name.equals("careTeamSequence")) {
5064          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.careTeamSequence");
5065        }
5066        else if (name.equals("diagnosisSequence")) {
5067          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.diagnosisSequence");
5068        }
5069        else if (name.equals("procedureSequence")) {
5070          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedureSequence");
5071        }
5072        else if (name.equals("informationSequence")) {
5073          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.informationSequence");
5074        }
5075        else if (name.equals("revenue")) {
5076          this.revenue = new CodeableConcept();
5077          return this.revenue;
5078        }
5079        else if (name.equals("category")) {
5080          this.category = new CodeableConcept();
5081          return this.category;
5082        }
5083        else if (name.equals("productOrService")) {
5084          this.productOrService = new CodeableConcept();
5085          return this.productOrService;
5086        }
5087        else if (name.equals("modifier")) {
5088          return addModifier();
5089        }
5090        else if (name.equals("programCode")) {
5091          return addProgramCode();
5092        }
5093        else if (name.equals("servicedDate")) {
5094          this.serviced = new DateType();
5095          return this.serviced;
5096        }
5097        else if (name.equals("servicedPeriod")) {
5098          this.serviced = new Period();
5099          return this.serviced;
5100        }
5101        else if (name.equals("locationCodeableConcept")) {
5102          this.location = new CodeableConcept();
5103          return this.location;
5104        }
5105        else if (name.equals("locationAddress")) {
5106          this.location = new Address();
5107          return this.location;
5108        }
5109        else if (name.equals("locationReference")) {
5110          this.location = new Reference();
5111          return this.location;
5112        }
5113        else if (name.equals("quantity")) {
5114          this.quantity = new Quantity();
5115          return this.quantity;
5116        }
5117        else if (name.equals("unitPrice")) {
5118          this.unitPrice = new Money();
5119          return this.unitPrice;
5120        }
5121        else if (name.equals("factor")) {
5122          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
5123        }
5124        else if (name.equals("net")) {
5125          this.net = new Money();
5126          return this.net;
5127        }
5128        else if (name.equals("udi")) {
5129          return addUdi();
5130        }
5131        else if (name.equals("bodySite")) {
5132          this.bodySite = new CodeableConcept();
5133          return this.bodySite;
5134        }
5135        else if (name.equals("subSite")) {
5136          return addSubSite();
5137        }
5138        else if (name.equals("encounter")) {
5139          return addEncounter();
5140        }
5141        else if (name.equals("noteNumber")) {
5142          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
5143        }
5144        else if (name.equals("adjudication")) {
5145          return addAdjudication();
5146        }
5147        else if (name.equals("detail")) {
5148          return addDetail();
5149        }
5150        else
5151          return super.addChild(name);
5152      }
5153
5154      public ItemComponent copy() {
5155        ItemComponent dst = new ItemComponent();
5156        copyValues(dst);
5157        dst.sequence = sequence == null ? null : sequence.copy();
5158        if (careTeamSequence != null) {
5159          dst.careTeamSequence = new ArrayList<PositiveIntType>();
5160          for (PositiveIntType i : careTeamSequence)
5161            dst.careTeamSequence.add(i.copy());
5162        };
5163        if (diagnosisSequence != null) {
5164          dst.diagnosisSequence = new ArrayList<PositiveIntType>();
5165          for (PositiveIntType i : diagnosisSequence)
5166            dst.diagnosisSequence.add(i.copy());
5167        };
5168        if (procedureSequence != null) {
5169          dst.procedureSequence = new ArrayList<PositiveIntType>();
5170          for (PositiveIntType i : procedureSequence)
5171            dst.procedureSequence.add(i.copy());
5172        };
5173        if (informationSequence != null) {
5174          dst.informationSequence = new ArrayList<PositiveIntType>();
5175          for (PositiveIntType i : informationSequence)
5176            dst.informationSequence.add(i.copy());
5177        };
5178        dst.revenue = revenue == null ? null : revenue.copy();
5179        dst.category = category == null ? null : category.copy();
5180        dst.productOrService = productOrService == null ? null : productOrService.copy();
5181        if (modifier != null) {
5182          dst.modifier = new ArrayList<CodeableConcept>();
5183          for (CodeableConcept i : modifier)
5184            dst.modifier.add(i.copy());
5185        };
5186        if (programCode != null) {
5187          dst.programCode = new ArrayList<CodeableConcept>();
5188          for (CodeableConcept i : programCode)
5189            dst.programCode.add(i.copy());
5190        };
5191        dst.serviced = serviced == null ? null : serviced.copy();
5192        dst.location = location == null ? null : location.copy();
5193        dst.quantity = quantity == null ? null : quantity.copy();
5194        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
5195        dst.factor = factor == null ? null : factor.copy();
5196        dst.net = net == null ? null : net.copy();
5197        if (udi != null) {
5198          dst.udi = new ArrayList<Reference>();
5199          for (Reference i : udi)
5200            dst.udi.add(i.copy());
5201        };
5202        dst.bodySite = bodySite == null ? null : bodySite.copy();
5203        if (subSite != null) {
5204          dst.subSite = new ArrayList<CodeableConcept>();
5205          for (CodeableConcept i : subSite)
5206            dst.subSite.add(i.copy());
5207        };
5208        if (encounter != null) {
5209          dst.encounter = new ArrayList<Reference>();
5210          for (Reference i : encounter)
5211            dst.encounter.add(i.copy());
5212        };
5213        if (noteNumber != null) {
5214          dst.noteNumber = new ArrayList<PositiveIntType>();
5215          for (PositiveIntType i : noteNumber)
5216            dst.noteNumber.add(i.copy());
5217        };
5218        if (adjudication != null) {
5219          dst.adjudication = new ArrayList<AdjudicationComponent>();
5220          for (AdjudicationComponent i : adjudication)
5221            dst.adjudication.add(i.copy());
5222        };
5223        if (detail != null) {
5224          dst.detail = new ArrayList<DetailComponent>();
5225          for (DetailComponent i : detail)
5226            dst.detail.add(i.copy());
5227        };
5228        return dst;
5229      }
5230
5231      @Override
5232      public boolean equalsDeep(Base other_) {
5233        if (!super.equalsDeep(other_))
5234          return false;
5235        if (!(other_ instanceof ItemComponent))
5236          return false;
5237        ItemComponent o = (ItemComponent) other_;
5238        return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamSequence, o.careTeamSequence, true)
5239           && compareDeep(diagnosisSequence, o.diagnosisSequence, true) && compareDeep(procedureSequence, o.procedureSequence, true)
5240           && compareDeep(informationSequence, o.informationSequence, true) && compareDeep(revenue, o.revenue, true)
5241           && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
5242           && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true)
5243           && compareDeep(location, o.location, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
5244           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
5245           && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true) && compareDeep(encounter, o.encounter, true)
5246           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
5247           && compareDeep(detail, o.detail, true);
5248      }
5249
5250      @Override
5251      public boolean equalsShallow(Base other_) {
5252        if (!super.equalsShallow(other_))
5253          return false;
5254        if (!(other_ instanceof ItemComponent))
5255          return false;
5256        ItemComponent o = (ItemComponent) other_;
5257        return compareValues(sequence, o.sequence, true) && compareValues(careTeamSequence, o.careTeamSequence, true)
5258           && compareValues(diagnosisSequence, o.diagnosisSequence, true) && compareValues(procedureSequence, o.procedureSequence, true)
5259           && compareValues(informationSequence, o.informationSequence, true) && compareValues(factor, o.factor, true)
5260           && compareValues(noteNumber, o.noteNumber, true);
5261      }
5262
5263      public boolean isEmpty() {
5264        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamSequence
5265          , diagnosisSequence, procedureSequence, informationSequence, revenue, category, productOrService
5266          , modifier, programCode, serviced, location, quantity, unitPrice, factor, net
5267          , udi, bodySite, subSite, encounter, noteNumber, adjudication, detail);
5268      }
5269
5270  public String fhirType() {
5271    return "ExplanationOfBenefit.item";
5272
5273  }
5274
5275  }
5276
5277    @Block()
5278    public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
5279        /**
5280         * A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in-aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.
5281         */
5282        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
5283        @Description(shortDefinition="Type of adjudication information", formalDefinition="A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in-aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item." )
5284        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
5285        protected CodeableConcept category;
5286
5287        /**
5288         * A code supporting the understanding of the adjudication result and explaining variance from expected amount.
5289         */
5290        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5291        @Description(shortDefinition="Explanation of adjudication outcome", formalDefinition="A code supporting the understanding of the adjudication result and explaining variance from expected amount." )
5292        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-reason")
5293        protected CodeableConcept reason;
5294
5295        /**
5296         * Monetary amount associated with the category.
5297         */
5298        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
5299        @Description(shortDefinition="Monetary amount", formalDefinition="Monetary amount associated with the category." )
5300        protected Money amount;
5301
5302        /**
5303         * A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5304         */
5305        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
5306        @Description(shortDefinition="Non-monitary value", formalDefinition="A non-monetary value associated with the category. Mutually exclusive to the amount element above." )
5307        protected DecimalType value;
5308
5309        private static final long serialVersionUID = 1559898786L;
5310
5311    /**
5312     * Constructor
5313     */
5314      public AdjudicationComponent() {
5315        super();
5316      }
5317
5318    /**
5319     * Constructor
5320     */
5321      public AdjudicationComponent(CodeableConcept category) {
5322        super();
5323        this.category = category;
5324      }
5325
5326        /**
5327         * @return {@link #category} (A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in-aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.)
5328         */
5329        public CodeableConcept getCategory() { 
5330          if (this.category == null)
5331            if (Configuration.errorOnAutoCreate())
5332              throw new Error("Attempt to auto-create AdjudicationComponent.category");
5333            else if (Configuration.doAutoCreate())
5334              this.category = new CodeableConcept(); // cc
5335          return this.category;
5336        }
5337
5338        public boolean hasCategory() { 
5339          return this.category != null && !this.category.isEmpty();
5340        }
5341
5342        /**
5343         * @param value {@link #category} (A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in-aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.)
5344         */
5345        public AdjudicationComponent setCategory(CodeableConcept value) { 
5346          this.category = value;
5347          return this;
5348        }
5349
5350        /**
5351         * @return {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
5352         */
5353        public CodeableConcept getReason() { 
5354          if (this.reason == null)
5355            if (Configuration.errorOnAutoCreate())
5356              throw new Error("Attempt to auto-create AdjudicationComponent.reason");
5357            else if (Configuration.doAutoCreate())
5358              this.reason = new CodeableConcept(); // cc
5359          return this.reason;
5360        }
5361
5362        public boolean hasReason() { 
5363          return this.reason != null && !this.reason.isEmpty();
5364        }
5365
5366        /**
5367         * @param value {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
5368         */
5369        public AdjudicationComponent setReason(CodeableConcept value) { 
5370          this.reason = value;
5371          return this;
5372        }
5373
5374        /**
5375         * @return {@link #amount} (Monetary amount associated with the category.)
5376         */
5377        public Money getAmount() { 
5378          if (this.amount == null)
5379            if (Configuration.errorOnAutoCreate())
5380              throw new Error("Attempt to auto-create AdjudicationComponent.amount");
5381            else if (Configuration.doAutoCreate())
5382              this.amount = new Money(); // cc
5383          return this.amount;
5384        }
5385
5386        public boolean hasAmount() { 
5387          return this.amount != null && !this.amount.isEmpty();
5388        }
5389
5390        /**
5391         * @param value {@link #amount} (Monetary amount associated with the category.)
5392         */
5393        public AdjudicationComponent setAmount(Money value) { 
5394          this.amount = value;
5395          return this;
5396        }
5397
5398        /**
5399         * @return {@link #value} (A non-monetary value associated with the category. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
5400         */
5401        public DecimalType getValueElement() { 
5402          if (this.value == null)
5403            if (Configuration.errorOnAutoCreate())
5404              throw new Error("Attempt to auto-create AdjudicationComponent.value");
5405            else if (Configuration.doAutoCreate())
5406              this.value = new DecimalType(); // bb
5407          return this.value;
5408        }
5409
5410        public boolean hasValueElement() { 
5411          return this.value != null && !this.value.isEmpty();
5412        }
5413
5414        public boolean hasValue() { 
5415          return this.value != null && !this.value.isEmpty();
5416        }
5417
5418        /**
5419         * @param value {@link #value} (A non-monetary value associated with the category. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
5420         */
5421        public AdjudicationComponent setValueElement(DecimalType value) { 
5422          this.value = value;
5423          return this;
5424        }
5425
5426        /**
5427         * @return A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5428         */
5429        public BigDecimal getValue() { 
5430          return this.value == null ? null : this.value.getValue();
5431        }
5432
5433        /**
5434         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5435         */
5436        public AdjudicationComponent setValue(BigDecimal value) { 
5437          if (value == null)
5438            this.value = null;
5439          else {
5440            if (this.value == null)
5441              this.value = new DecimalType();
5442            this.value.setValue(value);
5443          }
5444          return this;
5445        }
5446
5447        /**
5448         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5449         */
5450        public AdjudicationComponent setValue(long value) { 
5451              this.value = new DecimalType();
5452            this.value.setValue(value);
5453          return this;
5454        }
5455
5456        /**
5457         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5458         */
5459        public AdjudicationComponent setValue(double value) { 
5460              this.value = new DecimalType();
5461            this.value.setValue(value);
5462          return this;
5463        }
5464
5465        protected void listChildren(List<Property> children) {
5466          super.listChildren(children);
5467          children.add(new Property("category", "CodeableConcept", "A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in-aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.", 0, 1, category));
5468          children.add(new Property("reason", "CodeableConcept", "A code supporting the understanding of the adjudication result and explaining variance from expected amount.", 0, 1, reason));
5469          children.add(new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount));
5470          children.add(new Property("value", "decimal", "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1, value));
5471        }
5472
5473        @Override
5474        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5475          switch (_hash) {
5476          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in-aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.", 0, 1, category);
5477          case -934964668: /*reason*/  return new Property("reason", "CodeableConcept", "A code supporting the understanding of the adjudication result and explaining variance from expected amount.", 0, 1, reason);
5478          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount);
5479          case 111972721: /*value*/  return new Property("value", "decimal", "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1, value);
5480          default: return super.getNamedProperty(_hash, _name, _checkValid);
5481          }
5482
5483        }
5484
5485      @Override
5486      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5487        switch (hash) {
5488        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
5489        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
5490        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
5491        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
5492        default: return super.getProperty(hash, name, checkValid);
5493        }
5494
5495      }
5496
5497      @Override
5498      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5499        switch (hash) {
5500        case 50511102: // category
5501          this.category = castToCodeableConcept(value); // CodeableConcept
5502          return value;
5503        case -934964668: // reason
5504          this.reason = castToCodeableConcept(value); // CodeableConcept
5505          return value;
5506        case -1413853096: // amount
5507          this.amount = castToMoney(value); // Money
5508          return value;
5509        case 111972721: // value
5510          this.value = castToDecimal(value); // DecimalType
5511          return value;
5512        default: return super.setProperty(hash, name, value);
5513        }
5514
5515      }
5516
5517      @Override
5518      public Base setProperty(String name, Base value) throws FHIRException {
5519        if (name.equals("category")) {
5520          this.category = castToCodeableConcept(value); // CodeableConcept
5521        } else if (name.equals("reason")) {
5522          this.reason = castToCodeableConcept(value); // CodeableConcept
5523        } else if (name.equals("amount")) {
5524          this.amount = castToMoney(value); // Money
5525        } else if (name.equals("value")) {
5526          this.value = castToDecimal(value); // DecimalType
5527        } else
5528          return super.setProperty(name, value);
5529        return value;
5530      }
5531
5532      @Override
5533      public Base makeProperty(int hash, String name) throws FHIRException {
5534        switch (hash) {
5535        case 50511102:  return getCategory(); 
5536        case -934964668:  return getReason(); 
5537        case -1413853096:  return getAmount(); 
5538        case 111972721:  return getValueElement();
5539        default: return super.makeProperty(hash, name);
5540        }
5541
5542      }
5543
5544      @Override
5545      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5546        switch (hash) {
5547        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5548        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
5549        case -1413853096: /*amount*/ return new String[] {"Money"};
5550        case 111972721: /*value*/ return new String[] {"decimal"};
5551        default: return super.getTypesForProperty(hash, name);
5552        }
5553
5554      }
5555
5556      @Override
5557      public Base addChild(String name) throws FHIRException {
5558        if (name.equals("category")) {
5559          this.category = new CodeableConcept();
5560          return this.category;
5561        }
5562        else if (name.equals("reason")) {
5563          this.reason = new CodeableConcept();
5564          return this.reason;
5565        }
5566        else if (name.equals("amount")) {
5567          this.amount = new Money();
5568          return this.amount;
5569        }
5570        else if (name.equals("value")) {
5571          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
5572        }
5573        else
5574          return super.addChild(name);
5575      }
5576
5577      public AdjudicationComponent copy() {
5578        AdjudicationComponent dst = new AdjudicationComponent();
5579        copyValues(dst);
5580        dst.category = category == null ? null : category.copy();
5581        dst.reason = reason == null ? null : reason.copy();
5582        dst.amount = amount == null ? null : amount.copy();
5583        dst.value = value == null ? null : value.copy();
5584        return dst;
5585      }
5586
5587      @Override
5588      public boolean equalsDeep(Base other_) {
5589        if (!super.equalsDeep(other_))
5590          return false;
5591        if (!(other_ instanceof AdjudicationComponent))
5592          return false;
5593        AdjudicationComponent o = (AdjudicationComponent) other_;
5594        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
5595           && compareDeep(value, o.value, true);
5596      }
5597
5598      @Override
5599      public boolean equalsShallow(Base other_) {
5600        if (!super.equalsShallow(other_))
5601          return false;
5602        if (!(other_ instanceof AdjudicationComponent))
5603          return false;
5604        AdjudicationComponent o = (AdjudicationComponent) other_;
5605        return compareValues(value, o.value, true);
5606      }
5607
5608      public boolean isEmpty() {
5609        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount
5610          , value);
5611      }
5612
5613  public String fhirType() {
5614    return "ExplanationOfBenefit.item.adjudication";
5615
5616  }
5617
5618  }
5619
5620    @Block()
5621    public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
5622        /**
5623         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5624         */
5625        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
5626        @Description(shortDefinition="Product or service provided", formalDefinition="A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items." )
5627        protected PositiveIntType sequence;
5628
5629        /**
5630         * The type of revenue or cost center providing the product and/or service.
5631         */
5632        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5633        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
5634        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
5635        protected CodeableConcept revenue;
5636
5637        /**
5638         * Code to identify the general type of benefits under which products and services are provided.
5639         */
5640        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
5641        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
5642        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
5643        protected CodeableConcept category;
5644
5645        /**
5646         * When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.
5647         */
5648        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
5649        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item." )
5650        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
5651        protected CodeableConcept productOrService;
5652
5653        /**
5654         * Item typification or modifiers codes to convey additional context for the product or service.
5655         */
5656        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5657        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
5658        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
5659        protected List<CodeableConcept> modifier;
5660
5661        /**
5662         * Identifies the program under which this may be recovered.
5663         */
5664        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5665        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
5666        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
5667        protected List<CodeableConcept> programCode;
5668
5669        /**
5670         * The number of repetitions of a service or product.
5671         */
5672        @Child(name = "quantity", type = {Quantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
5673        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
5674        protected Quantity quantity;
5675
5676        /**
5677         * If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.
5678         */
5679        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
5680        @Description(shortDefinition="Fee, charge or cost per item", formalDefinition="If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group." )
5681        protected Money unitPrice;
5682
5683        /**
5684         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
5685         */
5686        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
5687        @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." )
5688        protected DecimalType factor;
5689
5690        /**
5691         * The quantity times the unit price for an additional service or product or charge.
5692         */
5693        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
5694        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
5695        protected Money net;
5696
5697        /**
5698         * Unique Device Identifiers associated with this line item.
5699         */
5700        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5701        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
5702        protected List<Reference> udi;
5703        /**
5704         * The actual objects that are the target of the reference (Unique Device Identifiers associated with this line item.)
5705         */
5706        protected List<Device> udiTarget;
5707
5708
5709        /**
5710         * The numbers associated with notes below which apply to the adjudication of this item.
5711         */
5712        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5713        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
5714        protected List<PositiveIntType> noteNumber;
5715
5716        /**
5717         * The adjudication results.
5718         */
5719        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5720        @Description(shortDefinition="Detail level adjudication details", formalDefinition="The adjudication results." )
5721        protected List<AdjudicationComponent> adjudication;
5722
5723        /**
5724         * Third-tier of goods and services.
5725         */
5726        @Child(name = "subDetail", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5727        @Description(shortDefinition="Additional items", formalDefinition="Third-tier of goods and services." )
5728        protected List<SubDetailComponent> subDetail;
5729
5730        private static final long serialVersionUID = 225639798L;
5731
5732    /**
5733     * Constructor
5734     */
5735      public DetailComponent() {
5736        super();
5737      }
5738
5739    /**
5740     * Constructor
5741     */
5742      public DetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
5743        super();
5744        this.sequence = sequence;
5745        this.productOrService = productOrService;
5746      }
5747
5748        /**
5749         * @return {@link #sequence} (A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
5750         */
5751        public PositiveIntType getSequenceElement() { 
5752          if (this.sequence == null)
5753            if (Configuration.errorOnAutoCreate())
5754              throw new Error("Attempt to auto-create DetailComponent.sequence");
5755            else if (Configuration.doAutoCreate())
5756              this.sequence = new PositiveIntType(); // bb
5757          return this.sequence;
5758        }
5759
5760        public boolean hasSequenceElement() { 
5761          return this.sequence != null && !this.sequence.isEmpty();
5762        }
5763
5764        public boolean hasSequence() { 
5765          return this.sequence != null && !this.sequence.isEmpty();
5766        }
5767
5768        /**
5769         * @param value {@link #sequence} (A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
5770         */
5771        public DetailComponent setSequenceElement(PositiveIntType value) { 
5772          this.sequence = value;
5773          return this;
5774        }
5775
5776        /**
5777         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5778         */
5779        public int getSequence() { 
5780          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
5781        }
5782
5783        /**
5784         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5785         */
5786        public DetailComponent setSequence(int value) { 
5787            if (this.sequence == null)
5788              this.sequence = new PositiveIntType();
5789            this.sequence.setValue(value);
5790          return this;
5791        }
5792
5793        /**
5794         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5795         */
5796        public CodeableConcept getRevenue() { 
5797          if (this.revenue == null)
5798            if (Configuration.errorOnAutoCreate())
5799              throw new Error("Attempt to auto-create DetailComponent.revenue");
5800            else if (Configuration.doAutoCreate())
5801              this.revenue = new CodeableConcept(); // cc
5802          return this.revenue;
5803        }
5804
5805        public boolean hasRevenue() { 
5806          return this.revenue != null && !this.revenue.isEmpty();
5807        }
5808
5809        /**
5810         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5811         */
5812        public DetailComponent setRevenue(CodeableConcept value) { 
5813          this.revenue = value;
5814          return this;
5815        }
5816
5817        /**
5818         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5819         */
5820        public CodeableConcept getCategory() { 
5821          if (this.category == null)
5822            if (Configuration.errorOnAutoCreate())
5823              throw new Error("Attempt to auto-create DetailComponent.category");
5824            else if (Configuration.doAutoCreate())
5825              this.category = new CodeableConcept(); // cc
5826          return this.category;
5827        }
5828
5829        public boolean hasCategory() { 
5830          return this.category != null && !this.category.isEmpty();
5831        }
5832
5833        /**
5834         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5835         */
5836        public DetailComponent setCategory(CodeableConcept value) { 
5837          this.category = value;
5838          return this;
5839        }
5840
5841        /**
5842         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
5843         */
5844        public CodeableConcept getProductOrService() { 
5845          if (this.productOrService == null)
5846            if (Configuration.errorOnAutoCreate())
5847              throw new Error("Attempt to auto-create DetailComponent.productOrService");
5848            else if (Configuration.doAutoCreate())
5849              this.productOrService = new CodeableConcept(); // cc
5850          return this.productOrService;
5851        }
5852
5853        public boolean hasProductOrService() { 
5854          return this.productOrService != null && !this.productOrService.isEmpty();
5855        }
5856
5857        /**
5858         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
5859         */
5860        public DetailComponent setProductOrService(CodeableConcept value) { 
5861          this.productOrService = value;
5862          return this;
5863        }
5864
5865        /**
5866         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
5867         */
5868        public List<CodeableConcept> getModifier() { 
5869          if (this.modifier == null)
5870            this.modifier = new ArrayList<CodeableConcept>();
5871          return this.modifier;
5872        }
5873
5874        /**
5875         * @return Returns a reference to <code>this</code> for easy method chaining
5876         */
5877        public DetailComponent setModifier(List<CodeableConcept> theModifier) { 
5878          this.modifier = theModifier;
5879          return this;
5880        }
5881
5882        public boolean hasModifier() { 
5883          if (this.modifier == null)
5884            return false;
5885          for (CodeableConcept item : this.modifier)
5886            if (!item.isEmpty())
5887              return true;
5888          return false;
5889        }
5890
5891        public CodeableConcept addModifier() { //3
5892          CodeableConcept t = new CodeableConcept();
5893          if (this.modifier == null)
5894            this.modifier = new ArrayList<CodeableConcept>();
5895          this.modifier.add(t);
5896          return t;
5897        }
5898
5899        public DetailComponent addModifier(CodeableConcept t) { //3
5900          if (t == null)
5901            return this;
5902          if (this.modifier == null)
5903            this.modifier = new ArrayList<CodeableConcept>();
5904          this.modifier.add(t);
5905          return this;
5906        }
5907
5908        /**
5909         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
5910         */
5911        public CodeableConcept getModifierFirstRep() { 
5912          if (getModifier().isEmpty()) {
5913            addModifier();
5914          }
5915          return getModifier().get(0);
5916        }
5917
5918        /**
5919         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
5920         */
5921        public List<CodeableConcept> getProgramCode() { 
5922          if (this.programCode == null)
5923            this.programCode = new ArrayList<CodeableConcept>();
5924          return this.programCode;
5925        }
5926
5927        /**
5928         * @return Returns a reference to <code>this</code> for easy method chaining
5929         */
5930        public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
5931          this.programCode = theProgramCode;
5932          return this;
5933        }
5934
5935        public boolean hasProgramCode() { 
5936          if (this.programCode == null)
5937            return false;
5938          for (CodeableConcept item : this.programCode)
5939            if (!item.isEmpty())
5940              return true;
5941          return false;
5942        }
5943
5944        public CodeableConcept addProgramCode() { //3
5945          CodeableConcept t = new CodeableConcept();
5946          if (this.programCode == null)
5947            this.programCode = new ArrayList<CodeableConcept>();
5948          this.programCode.add(t);
5949          return t;
5950        }
5951
5952        public DetailComponent addProgramCode(CodeableConcept t) { //3
5953          if (t == null)
5954            return this;
5955          if (this.programCode == null)
5956            this.programCode = new ArrayList<CodeableConcept>();
5957          this.programCode.add(t);
5958          return this;
5959        }
5960
5961        /**
5962         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
5963         */
5964        public CodeableConcept getProgramCodeFirstRep() { 
5965          if (getProgramCode().isEmpty()) {
5966            addProgramCode();
5967          }
5968          return getProgramCode().get(0);
5969        }
5970
5971        /**
5972         * @return {@link #quantity} (The number of repetitions of a service or product.)
5973         */
5974        public Quantity getQuantity() { 
5975          if (this.quantity == null)
5976            if (Configuration.errorOnAutoCreate())
5977              throw new Error("Attempt to auto-create DetailComponent.quantity");
5978            else if (Configuration.doAutoCreate())
5979              this.quantity = new Quantity(); // cc
5980          return this.quantity;
5981        }
5982
5983        public boolean hasQuantity() { 
5984          return this.quantity != null && !this.quantity.isEmpty();
5985        }
5986
5987        /**
5988         * @param value {@link #quantity} (The number of repetitions of a service or product.)
5989         */
5990        public DetailComponent setQuantity(Quantity value) { 
5991          this.quantity = value;
5992          return this;
5993        }
5994
5995        /**
5996         * @return {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
5997         */
5998        public Money getUnitPrice() { 
5999          if (this.unitPrice == null)
6000            if (Configuration.errorOnAutoCreate())
6001              throw new Error("Attempt to auto-create DetailComponent.unitPrice");
6002            else if (Configuration.doAutoCreate())
6003              this.unitPrice = new Money(); // cc
6004          return this.unitPrice;
6005        }
6006
6007        public boolean hasUnitPrice() { 
6008          return this.unitPrice != null && !this.unitPrice.isEmpty();
6009        }
6010
6011        /**
6012         * @param value {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
6013         */
6014        public DetailComponent setUnitPrice(Money value) { 
6015          this.unitPrice = value;
6016          return this;
6017        }
6018
6019        /**
6020         * @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
6021         */
6022        public DecimalType getFactorElement() { 
6023          if (this.factor == null)
6024            if (Configuration.errorOnAutoCreate())
6025              throw new Error("Attempt to auto-create DetailComponent.factor");
6026            else if (Configuration.doAutoCreate())
6027              this.factor = new DecimalType(); // bb
6028          return this.factor;
6029        }
6030
6031        public boolean hasFactorElement() { 
6032          return this.factor != null && !this.factor.isEmpty();
6033        }
6034
6035        public boolean hasFactor() { 
6036          return this.factor != null && !this.factor.isEmpty();
6037        }
6038
6039        /**
6040         * @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
6041         */
6042        public DetailComponent setFactorElement(DecimalType value) { 
6043          this.factor = value;
6044          return this;
6045        }
6046
6047        /**
6048         * @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.
6049         */
6050        public BigDecimal getFactor() { 
6051          return this.factor == null ? null : this.factor.getValue();
6052        }
6053
6054        /**
6055         * @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.
6056         */
6057        public DetailComponent setFactor(BigDecimal value) { 
6058          if (value == null)
6059            this.factor = null;
6060          else {
6061            if (this.factor == null)
6062              this.factor = new DecimalType();
6063            this.factor.setValue(value);
6064          }
6065          return this;
6066        }
6067
6068        /**
6069         * @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.
6070         */
6071        public DetailComponent setFactor(long value) { 
6072              this.factor = new DecimalType();
6073            this.factor.setValue(value);
6074          return this;
6075        }
6076
6077        /**
6078         * @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.
6079         */
6080        public DetailComponent setFactor(double value) { 
6081              this.factor = new DecimalType();
6082            this.factor.setValue(value);
6083          return this;
6084        }
6085
6086        /**
6087         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
6088         */
6089        public Money getNet() { 
6090          if (this.net == null)
6091            if (Configuration.errorOnAutoCreate())
6092              throw new Error("Attempt to auto-create DetailComponent.net");
6093            else if (Configuration.doAutoCreate())
6094              this.net = new Money(); // cc
6095          return this.net;
6096        }
6097
6098        public boolean hasNet() { 
6099          return this.net != null && !this.net.isEmpty();
6100        }
6101
6102        /**
6103         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
6104         */
6105        public DetailComponent setNet(Money value) { 
6106          this.net = value;
6107          return this;
6108        }
6109
6110        /**
6111         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
6112         */
6113        public List<Reference> getUdi() { 
6114          if (this.udi == null)
6115            this.udi = new ArrayList<Reference>();
6116          return this.udi;
6117        }
6118
6119        /**
6120         * @return Returns a reference to <code>this</code> for easy method chaining
6121         */
6122        public DetailComponent setUdi(List<Reference> theUdi) { 
6123          this.udi = theUdi;
6124          return this;
6125        }
6126
6127        public boolean hasUdi() { 
6128          if (this.udi == null)
6129            return false;
6130          for (Reference item : this.udi)
6131            if (!item.isEmpty())
6132              return true;
6133          return false;
6134        }
6135
6136        public Reference addUdi() { //3
6137          Reference t = new Reference();
6138          if (this.udi == null)
6139            this.udi = new ArrayList<Reference>();
6140          this.udi.add(t);
6141          return t;
6142        }
6143
6144        public DetailComponent addUdi(Reference t) { //3
6145          if (t == null)
6146            return this;
6147          if (this.udi == null)
6148            this.udi = new ArrayList<Reference>();
6149          this.udi.add(t);
6150          return this;
6151        }
6152
6153        /**
6154         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
6155         */
6156        public Reference getUdiFirstRep() { 
6157          if (getUdi().isEmpty()) {
6158            addUdi();
6159          }
6160          return getUdi().get(0);
6161        }
6162
6163        /**
6164         * @deprecated Use Reference#setResource(IBaseResource) instead
6165         */
6166        @Deprecated
6167        public List<Device> getUdiTarget() { 
6168          if (this.udiTarget == null)
6169            this.udiTarget = new ArrayList<Device>();
6170          return this.udiTarget;
6171        }
6172
6173        /**
6174         * @deprecated Use Reference#setResource(IBaseResource) instead
6175         */
6176        @Deprecated
6177        public Device addUdiTarget() { 
6178          Device r = new Device();
6179          if (this.udiTarget == null)
6180            this.udiTarget = new ArrayList<Device>();
6181          this.udiTarget.add(r);
6182          return r;
6183        }
6184
6185        /**
6186         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6187         */
6188        public List<PositiveIntType> getNoteNumber() { 
6189          if (this.noteNumber == null)
6190            this.noteNumber = new ArrayList<PositiveIntType>();
6191          return this.noteNumber;
6192        }
6193
6194        /**
6195         * @return Returns a reference to <code>this</code> for easy method chaining
6196         */
6197        public DetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
6198          this.noteNumber = theNoteNumber;
6199          return this;
6200        }
6201
6202        public boolean hasNoteNumber() { 
6203          if (this.noteNumber == null)
6204            return false;
6205          for (PositiveIntType item : this.noteNumber)
6206            if (!item.isEmpty())
6207              return true;
6208          return false;
6209        }
6210
6211        /**
6212         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6213         */
6214        public PositiveIntType addNoteNumberElement() {//2 
6215          PositiveIntType t = new PositiveIntType();
6216          if (this.noteNumber == null)
6217            this.noteNumber = new ArrayList<PositiveIntType>();
6218          this.noteNumber.add(t);
6219          return t;
6220        }
6221
6222        /**
6223         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6224         */
6225        public DetailComponent addNoteNumber(int value) { //1
6226          PositiveIntType t = new PositiveIntType();
6227          t.setValue(value);
6228          if (this.noteNumber == null)
6229            this.noteNumber = new ArrayList<PositiveIntType>();
6230          this.noteNumber.add(t);
6231          return this;
6232        }
6233
6234        /**
6235         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6236         */
6237        public boolean hasNoteNumber(int value) { 
6238          if (this.noteNumber == null)
6239            return false;
6240          for (PositiveIntType v : this.noteNumber)
6241            if (v.getValue().equals(value)) // positiveInt
6242              return true;
6243          return false;
6244        }
6245
6246        /**
6247         * @return {@link #adjudication} (The adjudication results.)
6248         */
6249        public List<AdjudicationComponent> getAdjudication() { 
6250          if (this.adjudication == null)
6251            this.adjudication = new ArrayList<AdjudicationComponent>();
6252          return this.adjudication;
6253        }
6254
6255        /**
6256         * @return Returns a reference to <code>this</code> for easy method chaining
6257         */
6258        public DetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
6259          this.adjudication = theAdjudication;
6260          return this;
6261        }
6262
6263        public boolean hasAdjudication() { 
6264          if (this.adjudication == null)
6265            return false;
6266          for (AdjudicationComponent item : this.adjudication)
6267            if (!item.isEmpty())
6268              return true;
6269          return false;
6270        }
6271
6272        public AdjudicationComponent addAdjudication() { //3
6273          AdjudicationComponent t = new AdjudicationComponent();
6274          if (this.adjudication == null)
6275            this.adjudication = new ArrayList<AdjudicationComponent>();
6276          this.adjudication.add(t);
6277          return t;
6278        }
6279
6280        public DetailComponent addAdjudication(AdjudicationComponent t) { //3
6281          if (t == null)
6282            return this;
6283          if (this.adjudication == null)
6284            this.adjudication = new ArrayList<AdjudicationComponent>();
6285          this.adjudication.add(t);
6286          return this;
6287        }
6288
6289        /**
6290         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
6291         */
6292        public AdjudicationComponent getAdjudicationFirstRep() { 
6293          if (getAdjudication().isEmpty()) {
6294            addAdjudication();
6295          }
6296          return getAdjudication().get(0);
6297        }
6298
6299        /**
6300         * @return {@link #subDetail} (Third-tier of goods and services.)
6301         */
6302        public List<SubDetailComponent> getSubDetail() { 
6303          if (this.subDetail == null)
6304            this.subDetail = new ArrayList<SubDetailComponent>();
6305          return this.subDetail;
6306        }
6307
6308        /**
6309         * @return Returns a reference to <code>this</code> for easy method chaining
6310         */
6311        public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) { 
6312          this.subDetail = theSubDetail;
6313          return this;
6314        }
6315
6316        public boolean hasSubDetail() { 
6317          if (this.subDetail == null)
6318            return false;
6319          for (SubDetailComponent item : this.subDetail)
6320            if (!item.isEmpty())
6321              return true;
6322          return false;
6323        }
6324
6325        public SubDetailComponent addSubDetail() { //3
6326          SubDetailComponent t = new SubDetailComponent();
6327          if (this.subDetail == null)
6328            this.subDetail = new ArrayList<SubDetailComponent>();
6329          this.subDetail.add(t);
6330          return t;
6331        }
6332
6333        public DetailComponent addSubDetail(SubDetailComponent t) { //3
6334          if (t == null)
6335            return this;
6336          if (this.subDetail == null)
6337            this.subDetail = new ArrayList<SubDetailComponent>();
6338          this.subDetail.add(t);
6339          return this;
6340        }
6341
6342        /**
6343         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist
6344         */
6345        public SubDetailComponent getSubDetailFirstRep() { 
6346          if (getSubDetail().isEmpty()) {
6347            addSubDetail();
6348          }
6349          return getSubDetail().get(0);
6350        }
6351
6352        protected void listChildren(List<Property> children) {
6353          super.listChildren(children);
6354          children.add(new Property("sequence", "positiveInt", "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.", 0, 1, sequence));
6355          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
6356          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
6357          children.add(new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService));
6358          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier));
6359          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
6360          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
6361          children.add(new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice));
6362          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));
6363          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
6364          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
6365          children.add(new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
6366          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6367          children.add(new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
6368        }
6369
6370        @Override
6371        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6372          switch (_hash) {
6373          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.", 0, 1, sequence);
6374          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
6375          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category);
6376          case 1957227299: /*productOrService*/  return new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService);
6377          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier);
6378          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
6379          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
6380          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice);
6381          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);
6382          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
6383          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
6384          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
6385          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
6386          case -828829007: /*subDetail*/  return new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
6387          default: return super.getNamedProperty(_hash, _name, _checkValid);
6388          }
6389
6390        }
6391
6392      @Override
6393      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6394        switch (hash) {
6395        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
6396        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
6397        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
6398        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
6399        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
6400        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
6401        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
6402        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6403        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6404        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6405        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
6406        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
6407        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
6408        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
6409        default: return super.getProperty(hash, name, checkValid);
6410        }
6411
6412      }
6413
6414      @Override
6415      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6416        switch (hash) {
6417        case 1349547969: // sequence
6418          this.sequence = castToPositiveInt(value); // PositiveIntType
6419          return value;
6420        case 1099842588: // revenue
6421          this.revenue = castToCodeableConcept(value); // CodeableConcept
6422          return value;
6423        case 50511102: // category
6424          this.category = castToCodeableConcept(value); // CodeableConcept
6425          return value;
6426        case 1957227299: // productOrService
6427          this.productOrService = castToCodeableConcept(value); // CodeableConcept
6428          return value;
6429        case -615513385: // modifier
6430          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
6431          return value;
6432        case 1010065041: // programCode
6433          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
6434          return value;
6435        case -1285004149: // quantity
6436          this.quantity = castToQuantity(value); // Quantity
6437          return value;
6438        case -486196699: // unitPrice
6439          this.unitPrice = castToMoney(value); // Money
6440          return value;
6441        case -1282148017: // factor
6442          this.factor = castToDecimal(value); // DecimalType
6443          return value;
6444        case 108957: // net
6445          this.net = castToMoney(value); // Money
6446          return value;
6447        case 115642: // udi
6448          this.getUdi().add(castToReference(value)); // Reference
6449          return value;
6450        case -1110033957: // noteNumber
6451          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
6452          return value;
6453        case -231349275: // adjudication
6454          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
6455          return value;
6456        case -828829007: // subDetail
6457          this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
6458          return value;
6459        default: return super.setProperty(hash, name, value);
6460        }
6461
6462      }
6463
6464      @Override
6465      public Base setProperty(String name, Base value) throws FHIRException {
6466        if (name.equals("sequence")) {
6467          this.sequence = castToPositiveInt(value); // PositiveIntType
6468        } else if (name.equals("revenue")) {
6469          this.revenue = castToCodeableConcept(value); // CodeableConcept
6470        } else if (name.equals("category")) {
6471          this.category = castToCodeableConcept(value); // CodeableConcept
6472        } else if (name.equals("productOrService")) {
6473          this.productOrService = castToCodeableConcept(value); // CodeableConcept
6474        } else if (name.equals("modifier")) {
6475          this.getModifier().add(castToCodeableConcept(value));
6476        } else if (name.equals("programCode")) {
6477          this.getProgramCode().add(castToCodeableConcept(value));
6478        } else if (name.equals("quantity")) {
6479          this.quantity = castToQuantity(value); // Quantity
6480        } else if (name.equals("unitPrice")) {
6481          this.unitPrice = castToMoney(value); // Money
6482        } else if (name.equals("factor")) {
6483          this.factor = castToDecimal(value); // DecimalType
6484        } else if (name.equals("net")) {
6485          this.net = castToMoney(value); // Money
6486        } else if (name.equals("udi")) {
6487          this.getUdi().add(castToReference(value));
6488        } else if (name.equals("noteNumber")) {
6489          this.getNoteNumber().add(castToPositiveInt(value));
6490        } else if (name.equals("adjudication")) {
6491          this.getAdjudication().add((AdjudicationComponent) value);
6492        } else if (name.equals("subDetail")) {
6493          this.getSubDetail().add((SubDetailComponent) value);
6494        } else
6495          return super.setProperty(name, value);
6496        return value;
6497      }
6498
6499      @Override
6500      public Base makeProperty(int hash, String name) throws FHIRException {
6501        switch (hash) {
6502        case 1349547969:  return getSequenceElement();
6503        case 1099842588:  return getRevenue(); 
6504        case 50511102:  return getCategory(); 
6505        case 1957227299:  return getProductOrService(); 
6506        case -615513385:  return addModifier(); 
6507        case 1010065041:  return addProgramCode(); 
6508        case -1285004149:  return getQuantity(); 
6509        case -486196699:  return getUnitPrice(); 
6510        case -1282148017:  return getFactorElement();
6511        case 108957:  return getNet(); 
6512        case 115642:  return addUdi(); 
6513        case -1110033957:  return addNoteNumberElement();
6514        case -231349275:  return addAdjudication(); 
6515        case -828829007:  return addSubDetail(); 
6516        default: return super.makeProperty(hash, name);
6517        }
6518
6519      }
6520
6521      @Override
6522      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6523        switch (hash) {
6524        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
6525        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
6526        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
6527        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
6528        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
6529        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
6530        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
6531        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6532        case -1282148017: /*factor*/ return new String[] {"decimal"};
6533        case 108957: /*net*/ return new String[] {"Money"};
6534        case 115642: /*udi*/ return new String[] {"Reference"};
6535        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
6536        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
6537        case -828829007: /*subDetail*/ return new String[] {};
6538        default: return super.getTypesForProperty(hash, name);
6539        }
6540
6541      }
6542
6543      @Override
6544      public Base addChild(String name) throws FHIRException {
6545        if (name.equals("sequence")) {
6546          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
6547        }
6548        else if (name.equals("revenue")) {
6549          this.revenue = new CodeableConcept();
6550          return this.revenue;
6551        }
6552        else if (name.equals("category")) {
6553          this.category = new CodeableConcept();
6554          return this.category;
6555        }
6556        else if (name.equals("productOrService")) {
6557          this.productOrService = new CodeableConcept();
6558          return this.productOrService;
6559        }
6560        else if (name.equals("modifier")) {
6561          return addModifier();
6562        }
6563        else if (name.equals("programCode")) {
6564          return addProgramCode();
6565        }
6566        else if (name.equals("quantity")) {
6567          this.quantity = new Quantity();
6568          return this.quantity;
6569        }
6570        else if (name.equals("unitPrice")) {
6571          this.unitPrice = new Money();
6572          return this.unitPrice;
6573        }
6574        else if (name.equals("factor")) {
6575          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
6576        }
6577        else if (name.equals("net")) {
6578          this.net = new Money();
6579          return this.net;
6580        }
6581        else if (name.equals("udi")) {
6582          return addUdi();
6583        }
6584        else if (name.equals("noteNumber")) {
6585          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
6586        }
6587        else if (name.equals("adjudication")) {
6588          return addAdjudication();
6589        }
6590        else if (name.equals("subDetail")) {
6591          return addSubDetail();
6592        }
6593        else
6594          return super.addChild(name);
6595      }
6596
6597      public DetailComponent copy() {
6598        DetailComponent dst = new DetailComponent();
6599        copyValues(dst);
6600        dst.sequence = sequence == null ? null : sequence.copy();
6601        dst.revenue = revenue == null ? null : revenue.copy();
6602        dst.category = category == null ? null : category.copy();
6603        dst.productOrService = productOrService == null ? null : productOrService.copy();
6604        if (modifier != null) {
6605          dst.modifier = new ArrayList<CodeableConcept>();
6606          for (CodeableConcept i : modifier)
6607            dst.modifier.add(i.copy());
6608        };
6609        if (programCode != null) {
6610          dst.programCode = new ArrayList<CodeableConcept>();
6611          for (CodeableConcept i : programCode)
6612            dst.programCode.add(i.copy());
6613        };
6614        dst.quantity = quantity == null ? null : quantity.copy();
6615        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6616        dst.factor = factor == null ? null : factor.copy();
6617        dst.net = net == null ? null : net.copy();
6618        if (udi != null) {
6619          dst.udi = new ArrayList<Reference>();
6620          for (Reference i : udi)
6621            dst.udi.add(i.copy());
6622        };
6623        if (noteNumber != null) {
6624          dst.noteNumber = new ArrayList<PositiveIntType>();
6625          for (PositiveIntType i : noteNumber)
6626            dst.noteNumber.add(i.copy());
6627        };
6628        if (adjudication != null) {
6629          dst.adjudication = new ArrayList<AdjudicationComponent>();
6630          for (AdjudicationComponent i : adjudication)
6631            dst.adjudication.add(i.copy());
6632        };
6633        if (subDetail != null) {
6634          dst.subDetail = new ArrayList<SubDetailComponent>();
6635          for (SubDetailComponent i : subDetail)
6636            dst.subDetail.add(i.copy());
6637        };
6638        return dst;
6639      }
6640
6641      @Override
6642      public boolean equalsDeep(Base other_) {
6643        if (!super.equalsDeep(other_))
6644          return false;
6645        if (!(other_ instanceof DetailComponent))
6646          return false;
6647        DetailComponent o = (DetailComponent) other_;
6648        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
6649           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
6650           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
6651           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
6652           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
6653           && compareDeep(subDetail, o.subDetail, true);
6654      }
6655
6656      @Override
6657      public boolean equalsShallow(Base other_) {
6658        if (!super.equalsShallow(other_))
6659          return false;
6660        if (!(other_ instanceof DetailComponent))
6661          return false;
6662        DetailComponent o = (DetailComponent) other_;
6663        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
6664          ;
6665      }
6666
6667      public boolean isEmpty() {
6668        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
6669          , productOrService, modifier, programCode, quantity, unitPrice, factor, net, udi
6670          , noteNumber, adjudication, subDetail);
6671      }
6672
6673  public String fhirType() {
6674    return "ExplanationOfBenefit.item.detail";
6675
6676  }
6677
6678  }
6679
6680    @Block()
6681    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
6682        /**
6683         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6684         */
6685        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
6686        @Description(shortDefinition="Product or service provided", formalDefinition="A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items." )
6687        protected PositiveIntType sequence;
6688
6689        /**
6690         * The type of revenue or cost center providing the product and/or service.
6691         */
6692        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
6693        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
6694        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
6695        protected CodeableConcept revenue;
6696
6697        /**
6698         * Code to identify the general type of benefits under which products and services are provided.
6699         */
6700        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
6701        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
6702        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
6703        protected CodeableConcept category;
6704
6705        /**
6706         * When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.
6707         */
6708        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
6709        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item." )
6710        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
6711        protected CodeableConcept productOrService;
6712
6713        /**
6714         * Item typification or modifiers codes to convey additional context for the product or service.
6715         */
6716        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6717        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
6718        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
6719        protected List<CodeableConcept> modifier;
6720
6721        /**
6722         * Identifies the program under which this may be recovered.
6723         */
6724        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6725        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
6726        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
6727        protected List<CodeableConcept> programCode;
6728
6729        /**
6730         * The number of repetitions of a service or product.
6731         */
6732        @Child(name = "quantity", type = {Quantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
6733        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
6734        protected Quantity quantity;
6735
6736        /**
6737         * If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.
6738         */
6739        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
6740        @Description(shortDefinition="Fee, charge or cost per item", formalDefinition="If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group." )
6741        protected Money unitPrice;
6742
6743        /**
6744         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
6745         */
6746        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
6747        @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." )
6748        protected DecimalType factor;
6749
6750        /**
6751         * The quantity times the unit price for an additional service or product or charge.
6752         */
6753        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
6754        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
6755        protected Money net;
6756
6757        /**
6758         * Unique Device Identifiers associated with this line item.
6759         */
6760        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6761        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
6762        protected List<Reference> udi;
6763        /**
6764         * The actual objects that are the target of the reference (Unique Device Identifiers associated with this line item.)
6765         */
6766        protected List<Device> udiTarget;
6767
6768
6769        /**
6770         * The numbers associated with notes below which apply to the adjudication of this item.
6771         */
6772        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6773        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
6774        protected List<PositiveIntType> noteNumber;
6775
6776        /**
6777         * The adjudication results.
6778         */
6779        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6780        @Description(shortDefinition="Subdetail level adjudication details", formalDefinition="The adjudication results." )
6781        protected List<AdjudicationComponent> adjudication;
6782
6783        private static final long serialVersionUID = -996156853L;
6784
6785    /**
6786     * Constructor
6787     */
6788      public SubDetailComponent() {
6789        super();
6790      }
6791
6792    /**
6793     * Constructor
6794     */
6795      public SubDetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
6796        super();
6797        this.sequence = sequence;
6798        this.productOrService = productOrService;
6799      }
6800
6801        /**
6802         * @return {@link #sequence} (A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
6803         */
6804        public PositiveIntType getSequenceElement() { 
6805          if (this.sequence == null)
6806            if (Configuration.errorOnAutoCreate())
6807              throw new Error("Attempt to auto-create SubDetailComponent.sequence");
6808            else if (Configuration.doAutoCreate())
6809              this.sequence = new PositiveIntType(); // bb
6810          return this.sequence;
6811        }
6812
6813        public boolean hasSequenceElement() { 
6814          return this.sequence != null && !this.sequence.isEmpty();
6815        }
6816
6817        public boolean hasSequence() { 
6818          return this.sequence != null && !this.sequence.isEmpty();
6819        }
6820
6821        /**
6822         * @param value {@link #sequence} (A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
6823         */
6824        public SubDetailComponent setSequenceElement(PositiveIntType value) { 
6825          this.sequence = value;
6826          return this;
6827        }
6828
6829        /**
6830         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6831         */
6832        public int getSequence() { 
6833          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
6834        }
6835
6836        /**
6837         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6838         */
6839        public SubDetailComponent setSequence(int value) { 
6840            if (this.sequence == null)
6841              this.sequence = new PositiveIntType();
6842            this.sequence.setValue(value);
6843          return this;
6844        }
6845
6846        /**
6847         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
6848         */
6849        public CodeableConcept getRevenue() { 
6850          if (this.revenue == null)
6851            if (Configuration.errorOnAutoCreate())
6852              throw new Error("Attempt to auto-create SubDetailComponent.revenue");
6853            else if (Configuration.doAutoCreate())
6854              this.revenue = new CodeableConcept(); // cc
6855          return this.revenue;
6856        }
6857
6858        public boolean hasRevenue() { 
6859          return this.revenue != null && !this.revenue.isEmpty();
6860        }
6861
6862        /**
6863         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
6864         */
6865        public SubDetailComponent setRevenue(CodeableConcept value) { 
6866          this.revenue = value;
6867          return this;
6868        }
6869
6870        /**
6871         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
6872         */
6873        public CodeableConcept getCategory() { 
6874          if (this.category == null)
6875            if (Configuration.errorOnAutoCreate())
6876              throw new Error("Attempt to auto-create SubDetailComponent.category");
6877            else if (Configuration.doAutoCreate())
6878              this.category = new CodeableConcept(); // cc
6879          return this.category;
6880        }
6881
6882        public boolean hasCategory() { 
6883          return this.category != null && !this.category.isEmpty();
6884        }
6885
6886        /**
6887         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
6888         */
6889        public SubDetailComponent setCategory(CodeableConcept value) { 
6890          this.category = value;
6891          return this;
6892        }
6893
6894        /**
6895         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
6896         */
6897        public CodeableConcept getProductOrService() { 
6898          if (this.productOrService == null)
6899            if (Configuration.errorOnAutoCreate())
6900              throw new Error("Attempt to auto-create SubDetailComponent.productOrService");
6901            else if (Configuration.doAutoCreate())
6902              this.productOrService = new CodeableConcept(); // cc
6903          return this.productOrService;
6904        }
6905
6906        public boolean hasProductOrService() { 
6907          return this.productOrService != null && !this.productOrService.isEmpty();
6908        }
6909
6910        /**
6911         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
6912         */
6913        public SubDetailComponent setProductOrService(CodeableConcept value) { 
6914          this.productOrService = value;
6915          return this;
6916        }
6917
6918        /**
6919         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
6920         */
6921        public List<CodeableConcept> getModifier() { 
6922          if (this.modifier == null)
6923            this.modifier = new ArrayList<CodeableConcept>();
6924          return this.modifier;
6925        }
6926
6927        /**
6928         * @return Returns a reference to <code>this</code> for easy method chaining
6929         */
6930        public SubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
6931          this.modifier = theModifier;
6932          return this;
6933        }
6934
6935        public boolean hasModifier() { 
6936          if (this.modifier == null)
6937            return false;
6938          for (CodeableConcept item : this.modifier)
6939            if (!item.isEmpty())
6940              return true;
6941          return false;
6942        }
6943
6944        public CodeableConcept addModifier() { //3
6945          CodeableConcept t = new CodeableConcept();
6946          if (this.modifier == null)
6947            this.modifier = new ArrayList<CodeableConcept>();
6948          this.modifier.add(t);
6949          return t;
6950        }
6951
6952        public SubDetailComponent addModifier(CodeableConcept t) { //3
6953          if (t == null)
6954            return this;
6955          if (this.modifier == null)
6956            this.modifier = new ArrayList<CodeableConcept>();
6957          this.modifier.add(t);
6958          return this;
6959        }
6960
6961        /**
6962         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
6963         */
6964        public CodeableConcept getModifierFirstRep() { 
6965          if (getModifier().isEmpty()) {
6966            addModifier();
6967          }
6968          return getModifier().get(0);
6969        }
6970
6971        /**
6972         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
6973         */
6974        public List<CodeableConcept> getProgramCode() { 
6975          if (this.programCode == null)
6976            this.programCode = new ArrayList<CodeableConcept>();
6977          return this.programCode;
6978        }
6979
6980        /**
6981         * @return Returns a reference to <code>this</code> for easy method chaining
6982         */
6983        public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
6984          this.programCode = theProgramCode;
6985          return this;
6986        }
6987
6988        public boolean hasProgramCode() { 
6989          if (this.programCode == null)
6990            return false;
6991          for (CodeableConcept item : this.programCode)
6992            if (!item.isEmpty())
6993              return true;
6994          return false;
6995        }
6996
6997        public CodeableConcept addProgramCode() { //3
6998          CodeableConcept t = new CodeableConcept();
6999          if (this.programCode == null)
7000            this.programCode = new ArrayList<CodeableConcept>();
7001          this.programCode.add(t);
7002          return t;
7003        }
7004
7005        public SubDetailComponent addProgramCode(CodeableConcept t) { //3
7006          if (t == null)
7007            return this;
7008          if (this.programCode == null)
7009            this.programCode = new ArrayList<CodeableConcept>();
7010          this.programCode.add(t);
7011          return this;
7012        }
7013
7014        /**
7015         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
7016         */
7017        public CodeableConcept getProgramCodeFirstRep() { 
7018          if (getProgramCode().isEmpty()) {
7019            addProgramCode();
7020          }
7021          return getProgramCode().get(0);
7022        }
7023
7024        /**
7025         * @return {@link #quantity} (The number of repetitions of a service or product.)
7026         */
7027        public Quantity getQuantity() { 
7028          if (this.quantity == null)
7029            if (Configuration.errorOnAutoCreate())
7030              throw new Error("Attempt to auto-create SubDetailComponent.quantity");
7031            else if (Configuration.doAutoCreate())
7032              this.quantity = new Quantity(); // cc
7033          return this.quantity;
7034        }
7035
7036        public boolean hasQuantity() { 
7037          return this.quantity != null && !this.quantity.isEmpty();
7038        }
7039
7040        /**
7041         * @param value {@link #quantity} (The number of repetitions of a service or product.)
7042         */
7043        public SubDetailComponent setQuantity(Quantity value) { 
7044          this.quantity = value;
7045          return this;
7046        }
7047
7048        /**
7049         * @return {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
7050         */
7051        public Money getUnitPrice() { 
7052          if (this.unitPrice == null)
7053            if (Configuration.errorOnAutoCreate())
7054              throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
7055            else if (Configuration.doAutoCreate())
7056              this.unitPrice = new Money(); // cc
7057          return this.unitPrice;
7058        }
7059
7060        public boolean hasUnitPrice() { 
7061          return this.unitPrice != null && !this.unitPrice.isEmpty();
7062        }
7063
7064        /**
7065         * @param value {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
7066         */
7067        public SubDetailComponent setUnitPrice(Money value) { 
7068          this.unitPrice = value;
7069          return this;
7070        }
7071
7072        /**
7073         * @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
7074         */
7075        public DecimalType getFactorElement() { 
7076          if (this.factor == null)
7077            if (Configuration.errorOnAutoCreate())
7078              throw new Error("Attempt to auto-create SubDetailComponent.factor");
7079            else if (Configuration.doAutoCreate())
7080              this.factor = new DecimalType(); // bb
7081          return this.factor;
7082        }
7083
7084        public boolean hasFactorElement() { 
7085          return this.factor != null && !this.factor.isEmpty();
7086        }
7087
7088        public boolean hasFactor() { 
7089          return this.factor != null && !this.factor.isEmpty();
7090        }
7091
7092        /**
7093         * @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
7094         */
7095        public SubDetailComponent setFactorElement(DecimalType value) { 
7096          this.factor = value;
7097          return this;
7098        }
7099
7100        /**
7101         * @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.
7102         */
7103        public BigDecimal getFactor() { 
7104          return this.factor == null ? null : this.factor.getValue();
7105        }
7106
7107        /**
7108         * @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.
7109         */
7110        public SubDetailComponent setFactor(BigDecimal value) { 
7111          if (value == null)
7112            this.factor = null;
7113          else {
7114            if (this.factor == null)
7115              this.factor = new DecimalType();
7116            this.factor.setValue(value);
7117          }
7118          return this;
7119        }
7120
7121        /**
7122         * @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.
7123         */
7124        public SubDetailComponent setFactor(long value) { 
7125              this.factor = new DecimalType();
7126            this.factor.setValue(value);
7127          return this;
7128        }
7129
7130        /**
7131         * @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.
7132         */
7133        public SubDetailComponent setFactor(double value) { 
7134              this.factor = new DecimalType();
7135            this.factor.setValue(value);
7136          return this;
7137        }
7138
7139        /**
7140         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
7141         */
7142        public Money getNet() { 
7143          if (this.net == null)
7144            if (Configuration.errorOnAutoCreate())
7145              throw new Error("Attempt to auto-create SubDetailComponent.net");
7146            else if (Configuration.doAutoCreate())
7147              this.net = new Money(); // cc
7148          return this.net;
7149        }
7150
7151        public boolean hasNet() { 
7152          return this.net != null && !this.net.isEmpty();
7153        }
7154
7155        /**
7156         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
7157         */
7158        public SubDetailComponent setNet(Money value) { 
7159          this.net = value;
7160          return this;
7161        }
7162
7163        /**
7164         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
7165         */
7166        public List<Reference> getUdi() { 
7167          if (this.udi == null)
7168            this.udi = new ArrayList<Reference>();
7169          return this.udi;
7170        }
7171
7172        /**
7173         * @return Returns a reference to <code>this</code> for easy method chaining
7174         */
7175        public SubDetailComponent setUdi(List<Reference> theUdi) { 
7176          this.udi = theUdi;
7177          return this;
7178        }
7179
7180        public boolean hasUdi() { 
7181          if (this.udi == null)
7182            return false;
7183          for (Reference item : this.udi)
7184            if (!item.isEmpty())
7185              return true;
7186          return false;
7187        }
7188
7189        public Reference addUdi() { //3
7190          Reference t = new Reference();
7191          if (this.udi == null)
7192            this.udi = new ArrayList<Reference>();
7193          this.udi.add(t);
7194          return t;
7195        }
7196
7197        public SubDetailComponent addUdi(Reference t) { //3
7198          if (t == null)
7199            return this;
7200          if (this.udi == null)
7201            this.udi = new ArrayList<Reference>();
7202          this.udi.add(t);
7203          return this;
7204        }
7205
7206        /**
7207         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
7208         */
7209        public Reference getUdiFirstRep() { 
7210          if (getUdi().isEmpty()) {
7211            addUdi();
7212          }
7213          return getUdi().get(0);
7214        }
7215
7216        /**
7217         * @deprecated Use Reference#setResource(IBaseResource) instead
7218         */
7219        @Deprecated
7220        public List<Device> getUdiTarget() { 
7221          if (this.udiTarget == null)
7222            this.udiTarget = new ArrayList<Device>();
7223          return this.udiTarget;
7224        }
7225
7226        /**
7227         * @deprecated Use Reference#setResource(IBaseResource) instead
7228         */
7229        @Deprecated
7230        public Device addUdiTarget() { 
7231          Device r = new Device();
7232          if (this.udiTarget == null)
7233            this.udiTarget = new ArrayList<Device>();
7234          this.udiTarget.add(r);
7235          return r;
7236        }
7237
7238        /**
7239         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7240         */
7241        public List<PositiveIntType> getNoteNumber() { 
7242          if (this.noteNumber == null)
7243            this.noteNumber = new ArrayList<PositiveIntType>();
7244          return this.noteNumber;
7245        }
7246
7247        /**
7248         * @return Returns a reference to <code>this</code> for easy method chaining
7249         */
7250        public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
7251          this.noteNumber = theNoteNumber;
7252          return this;
7253        }
7254
7255        public boolean hasNoteNumber() { 
7256          if (this.noteNumber == null)
7257            return false;
7258          for (PositiveIntType item : this.noteNumber)
7259            if (!item.isEmpty())
7260              return true;
7261          return false;
7262        }
7263
7264        /**
7265         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7266         */
7267        public PositiveIntType addNoteNumberElement() {//2 
7268          PositiveIntType t = new PositiveIntType();
7269          if (this.noteNumber == null)
7270            this.noteNumber = new ArrayList<PositiveIntType>();
7271          this.noteNumber.add(t);
7272          return t;
7273        }
7274
7275        /**
7276         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7277         */
7278        public SubDetailComponent addNoteNumber(int value) { //1
7279          PositiveIntType t = new PositiveIntType();
7280          t.setValue(value);
7281          if (this.noteNumber == null)
7282            this.noteNumber = new ArrayList<PositiveIntType>();
7283          this.noteNumber.add(t);
7284          return this;
7285        }
7286
7287        /**
7288         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7289         */
7290        public boolean hasNoteNumber(int value) { 
7291          if (this.noteNumber == null)
7292            return false;
7293          for (PositiveIntType v : this.noteNumber)
7294            if (v.getValue().equals(value)) // positiveInt
7295              return true;
7296          return false;
7297        }
7298
7299        /**
7300         * @return {@link #adjudication} (The adjudication results.)
7301         */
7302        public List<AdjudicationComponent> getAdjudication() { 
7303          if (this.adjudication == null)
7304            this.adjudication = new ArrayList<AdjudicationComponent>();
7305          return this.adjudication;
7306        }
7307
7308        /**
7309         * @return Returns a reference to <code>this</code> for easy method chaining
7310         */
7311        public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
7312          this.adjudication = theAdjudication;
7313          return this;
7314        }
7315
7316        public boolean hasAdjudication() { 
7317          if (this.adjudication == null)
7318            return false;
7319          for (AdjudicationComponent item : this.adjudication)
7320            if (!item.isEmpty())
7321              return true;
7322          return false;
7323        }
7324
7325        public AdjudicationComponent addAdjudication() { //3
7326          AdjudicationComponent t = new AdjudicationComponent();
7327          if (this.adjudication == null)
7328            this.adjudication = new ArrayList<AdjudicationComponent>();
7329          this.adjudication.add(t);
7330          return t;
7331        }
7332
7333        public SubDetailComponent addAdjudication(AdjudicationComponent t) { //3
7334          if (t == null)
7335            return this;
7336          if (this.adjudication == null)
7337            this.adjudication = new ArrayList<AdjudicationComponent>();
7338          this.adjudication.add(t);
7339          return this;
7340        }
7341
7342        /**
7343         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
7344         */
7345        public AdjudicationComponent getAdjudicationFirstRep() { 
7346          if (getAdjudication().isEmpty()) {
7347            addAdjudication();
7348          }
7349          return getAdjudication().get(0);
7350        }
7351
7352        protected void listChildren(List<Property> children) {
7353          super.listChildren(children);
7354          children.add(new Property("sequence", "positiveInt", "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.", 0, 1, sequence));
7355          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
7356          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
7357          children.add(new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService));
7358          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier));
7359          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
7360          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
7361          children.add(new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice));
7362          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));
7363          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
7364          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
7365          children.add(new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
7366          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
7367        }
7368
7369        @Override
7370        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7371          switch (_hash) {
7372          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.", 0, 1, sequence);
7373          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
7374          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category);
7375          case 1957227299: /*productOrService*/  return new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService);
7376          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier);
7377          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
7378          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
7379          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice);
7380          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);
7381          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
7382          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
7383          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
7384          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
7385          default: return super.getNamedProperty(_hash, _name, _checkValid);
7386          }
7387
7388        }
7389
7390      @Override
7391      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7392        switch (hash) {
7393        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
7394        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
7395        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
7396        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
7397        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7398        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
7399        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
7400        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
7401        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
7402        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
7403        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
7404        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
7405        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
7406        default: return super.getProperty(hash, name, checkValid);
7407        }
7408
7409      }
7410
7411      @Override
7412      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7413        switch (hash) {
7414        case 1349547969: // sequence
7415          this.sequence = castToPositiveInt(value); // PositiveIntType
7416          return value;
7417        case 1099842588: // revenue
7418          this.revenue = castToCodeableConcept(value); // CodeableConcept
7419          return value;
7420        case 50511102: // category
7421          this.category = castToCodeableConcept(value); // CodeableConcept
7422          return value;
7423        case 1957227299: // productOrService
7424          this.productOrService = castToCodeableConcept(value); // CodeableConcept
7425          return value;
7426        case -615513385: // modifier
7427          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
7428          return value;
7429        case 1010065041: // programCode
7430          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
7431          return value;
7432        case -1285004149: // quantity
7433          this.quantity = castToQuantity(value); // Quantity
7434          return value;
7435        case -486196699: // unitPrice
7436          this.unitPrice = castToMoney(value); // Money
7437          return value;
7438        case -1282148017: // factor
7439          this.factor = castToDecimal(value); // DecimalType
7440          return value;
7441        case 108957: // net
7442          this.net = castToMoney(value); // Money
7443          return value;
7444        case 115642: // udi
7445          this.getUdi().add(castToReference(value)); // Reference
7446          return value;
7447        case -1110033957: // noteNumber
7448          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
7449          return value;
7450        case -231349275: // adjudication
7451          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7452          return value;
7453        default: return super.setProperty(hash, name, value);
7454        }
7455
7456      }
7457
7458      @Override
7459      public Base setProperty(String name, Base value) throws FHIRException {
7460        if (name.equals("sequence")) {
7461          this.sequence = castToPositiveInt(value); // PositiveIntType
7462        } else if (name.equals("revenue")) {
7463          this.revenue = castToCodeableConcept(value); // CodeableConcept
7464        } else if (name.equals("category")) {
7465          this.category = castToCodeableConcept(value); // CodeableConcept
7466        } else if (name.equals("productOrService")) {
7467          this.productOrService = castToCodeableConcept(value); // CodeableConcept
7468        } else if (name.equals("modifier")) {
7469          this.getModifier().add(castToCodeableConcept(value));
7470        } else if (name.equals("programCode")) {
7471          this.getProgramCode().add(castToCodeableConcept(value));
7472        } else if (name.equals("quantity")) {
7473          this.quantity = castToQuantity(value); // Quantity
7474        } else if (name.equals("unitPrice")) {
7475          this.unitPrice = castToMoney(value); // Money
7476        } else if (name.equals("factor")) {
7477          this.factor = castToDecimal(value); // DecimalType
7478        } else if (name.equals("net")) {
7479          this.net = castToMoney(value); // Money
7480        } else if (name.equals("udi")) {
7481          this.getUdi().add(castToReference(value));
7482        } else if (name.equals("noteNumber")) {
7483          this.getNoteNumber().add(castToPositiveInt(value));
7484        } else if (name.equals("adjudication")) {
7485          this.getAdjudication().add((AdjudicationComponent) value);
7486        } else
7487          return super.setProperty(name, value);
7488        return value;
7489      }
7490
7491      @Override
7492      public Base makeProperty(int hash, String name) throws FHIRException {
7493        switch (hash) {
7494        case 1349547969:  return getSequenceElement();
7495        case 1099842588:  return getRevenue(); 
7496        case 50511102:  return getCategory(); 
7497        case 1957227299:  return getProductOrService(); 
7498        case -615513385:  return addModifier(); 
7499        case 1010065041:  return addProgramCode(); 
7500        case -1285004149:  return getQuantity(); 
7501        case -486196699:  return getUnitPrice(); 
7502        case -1282148017:  return getFactorElement();
7503        case 108957:  return getNet(); 
7504        case 115642:  return addUdi(); 
7505        case -1110033957:  return addNoteNumberElement();
7506        case -231349275:  return addAdjudication(); 
7507        default: return super.makeProperty(hash, name);
7508        }
7509
7510      }
7511
7512      @Override
7513      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7514        switch (hash) {
7515        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
7516        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
7517        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
7518        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
7519        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
7520        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
7521        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
7522        case -486196699: /*unitPrice*/ return new String[] {"Money"};
7523        case -1282148017: /*factor*/ return new String[] {"decimal"};
7524        case 108957: /*net*/ return new String[] {"Money"};
7525        case 115642: /*udi*/ return new String[] {"Reference"};
7526        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
7527        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
7528        default: return super.getTypesForProperty(hash, name);
7529        }
7530
7531      }
7532
7533      @Override
7534      public Base addChild(String name) throws FHIRException {
7535        if (name.equals("sequence")) {
7536          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
7537        }
7538        else if (name.equals("revenue")) {
7539          this.revenue = new CodeableConcept();
7540          return this.revenue;
7541        }
7542        else if (name.equals("category")) {
7543          this.category = new CodeableConcept();
7544          return this.category;
7545        }
7546        else if (name.equals("productOrService")) {
7547          this.productOrService = new CodeableConcept();
7548          return this.productOrService;
7549        }
7550        else if (name.equals("modifier")) {
7551          return addModifier();
7552        }
7553        else if (name.equals("programCode")) {
7554          return addProgramCode();
7555        }
7556        else if (name.equals("quantity")) {
7557          this.quantity = new Quantity();
7558          return this.quantity;
7559        }
7560        else if (name.equals("unitPrice")) {
7561          this.unitPrice = new Money();
7562          return this.unitPrice;
7563        }
7564        else if (name.equals("factor")) {
7565          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
7566        }
7567        else if (name.equals("net")) {
7568          this.net = new Money();
7569          return this.net;
7570        }
7571        else if (name.equals("udi")) {
7572          return addUdi();
7573        }
7574        else if (name.equals("noteNumber")) {
7575          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
7576        }
7577        else if (name.equals("adjudication")) {
7578          return addAdjudication();
7579        }
7580        else
7581          return super.addChild(name);
7582      }
7583
7584      public SubDetailComponent copy() {
7585        SubDetailComponent dst = new SubDetailComponent();
7586        copyValues(dst);
7587        dst.sequence = sequence == null ? null : sequence.copy();
7588        dst.revenue = revenue == null ? null : revenue.copy();
7589        dst.category = category == null ? null : category.copy();
7590        dst.productOrService = productOrService == null ? null : productOrService.copy();
7591        if (modifier != null) {
7592          dst.modifier = new ArrayList<CodeableConcept>();
7593          for (CodeableConcept i : modifier)
7594            dst.modifier.add(i.copy());
7595        };
7596        if (programCode != null) {
7597          dst.programCode = new ArrayList<CodeableConcept>();
7598          for (CodeableConcept i : programCode)
7599            dst.programCode.add(i.copy());
7600        };
7601        dst.quantity = quantity == null ? null : quantity.copy();
7602        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7603        dst.factor = factor == null ? null : factor.copy();
7604        dst.net = net == null ? null : net.copy();
7605        if (udi != null) {
7606          dst.udi = new ArrayList<Reference>();
7607          for (Reference i : udi)
7608            dst.udi.add(i.copy());
7609        };
7610        if (noteNumber != null) {
7611          dst.noteNumber = new ArrayList<PositiveIntType>();
7612          for (PositiveIntType i : noteNumber)
7613            dst.noteNumber.add(i.copy());
7614        };
7615        if (adjudication != null) {
7616          dst.adjudication = new ArrayList<AdjudicationComponent>();
7617          for (AdjudicationComponent i : adjudication)
7618            dst.adjudication.add(i.copy());
7619        };
7620        return dst;
7621      }
7622
7623      @Override
7624      public boolean equalsDeep(Base other_) {
7625        if (!super.equalsDeep(other_))
7626          return false;
7627        if (!(other_ instanceof SubDetailComponent))
7628          return false;
7629        SubDetailComponent o = (SubDetailComponent) other_;
7630        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
7631           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
7632           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
7633           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
7634           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
7635          ;
7636      }
7637
7638      @Override
7639      public boolean equalsShallow(Base other_) {
7640        if (!super.equalsShallow(other_))
7641          return false;
7642        if (!(other_ instanceof SubDetailComponent))
7643          return false;
7644        SubDetailComponent o = (SubDetailComponent) other_;
7645        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
7646          ;
7647      }
7648
7649      public boolean isEmpty() {
7650        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
7651          , productOrService, modifier, programCode, quantity, unitPrice, factor, net, udi
7652          , noteNumber, adjudication);
7653      }
7654
7655  public String fhirType() {
7656    return "ExplanationOfBenefit.item.detail.subDetail";
7657
7658  }
7659
7660  }
7661
7662    @Block()
7663    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
7664        /**
7665         * Claim items which this service line is intended to replace.
7666         */
7667        @Child(name = "itemSequence", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7668        @Description(shortDefinition="Item sequence number", formalDefinition="Claim items which this service line is intended to replace." )
7669        protected List<PositiveIntType> itemSequence;
7670
7671        /**
7672         * The sequence number of the details within the claim item which this line is intended to replace.
7673         */
7674        @Child(name = "detailSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7675        @Description(shortDefinition="Detail sequence number", formalDefinition="The sequence number of the details within the claim item which this line is intended to replace." )
7676        protected List<PositiveIntType> detailSequence;
7677
7678        /**
7679         * The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.
7680         */
7681        @Child(name = "subDetailSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7682        @Description(shortDefinition="Subdetail sequence number", formalDefinition="The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace." )
7683        protected List<PositiveIntType> subDetailSequence;
7684
7685        /**
7686         * The providers who are authorized for the services rendered to the patient.
7687         */
7688        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7689        @Description(shortDefinition="Authorized providers", formalDefinition="The providers who are authorized for the services rendered to the patient." )
7690        protected List<Reference> provider;
7691        /**
7692         * The actual objects that are the target of the reference (The providers who are authorized for the services rendered to the patient.)
7693         */
7694        protected List<Resource> providerTarget;
7695
7696
7697        /**
7698         * When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.
7699         */
7700        @Child(name = "productOrService", type = {CodeableConcept.class}, order=5, min=1, max=1, modifier=false, summary=false)
7701        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item." )
7702        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
7703        protected CodeableConcept productOrService;
7704
7705        /**
7706         * Item typification or modifiers codes to convey additional context for the product or service.
7707         */
7708        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7709        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
7710        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
7711        protected List<CodeableConcept> modifier;
7712
7713        /**
7714         * Identifies the program under which this may be recovered.
7715         */
7716        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7717        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
7718        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
7719        protected List<CodeableConcept> programCode;
7720
7721        /**
7722         * The date or dates when the service or product was supplied, performed or completed.
7723         */
7724        @Child(name = "serviced", type = {DateType.class, Period.class}, order=8, min=0, max=1, modifier=false, summary=false)
7725        @Description(shortDefinition="Date or dates of service or product delivery", formalDefinition="The date or dates when the service or product was supplied, performed or completed." )
7726        protected Type serviced;
7727
7728        /**
7729         * Where the product or service was provided.
7730         */
7731        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=9, min=0, max=1, modifier=false, summary=false)
7732        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
7733        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
7734        protected Type location;
7735
7736        /**
7737         * The number of repetitions of a service or product.
7738         */
7739        @Child(name = "quantity", type = {Quantity.class}, order=10, min=0, max=1, modifier=false, summary=false)
7740        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
7741        protected Quantity quantity;
7742
7743        /**
7744         * If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.
7745         */
7746        @Child(name = "unitPrice", type = {Money.class}, order=11, min=0, max=1, modifier=false, summary=false)
7747        @Description(shortDefinition="Fee, charge or cost per item", formalDefinition="If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group." )
7748        protected Money unitPrice;
7749
7750        /**
7751         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
7752         */
7753        @Child(name = "factor", type = {DecimalType.class}, order=12, min=0, max=1, modifier=false, summary=false)
7754        @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." )
7755        protected DecimalType factor;
7756
7757        /**
7758         * The quantity times the unit price for an additional service or product or charge.
7759         */
7760        @Child(name = "net", type = {Money.class}, order=13, min=0, max=1, modifier=false, summary=false)
7761        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
7762        protected Money net;
7763
7764        /**
7765         * Physical service site on the patient (limb, tooth, etc.).
7766         */
7767        @Child(name = "bodySite", type = {CodeableConcept.class}, order=14, min=0, max=1, modifier=false, summary=false)
7768        @Description(shortDefinition="Anatomical location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
7769        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
7770        protected CodeableConcept bodySite;
7771
7772        /**
7773         * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
7774         */
7775        @Child(name = "subSite", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7776        @Description(shortDefinition="Anatomical sub-location", formalDefinition="A region or surface of the bodySite, e.g. limb region or tooth surface(s)." )
7777        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
7778        protected List<CodeableConcept> subSite;
7779
7780        /**
7781         * The numbers associated with notes below which apply to the adjudication of this item.
7782         */
7783        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7784        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
7785        protected List<PositiveIntType> noteNumber;
7786
7787        /**
7788         * The adjudication results.
7789         */
7790        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7791        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
7792        protected List<AdjudicationComponent> adjudication;
7793
7794        /**
7795         * The second-tier service adjudications for payor added services.
7796         */
7797        @Child(name = "detail", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7798        @Description(shortDefinition="Insurer added line items", formalDefinition="The second-tier service adjudications for payor added services." )
7799        protected List<AddedItemDetailComponent> detail;
7800
7801        private static final long serialVersionUID = -206524210L;
7802
7803    /**
7804     * Constructor
7805     */
7806      public AddedItemComponent() {
7807        super();
7808      }
7809
7810    /**
7811     * Constructor
7812     */
7813      public AddedItemComponent(CodeableConcept productOrService) {
7814        super();
7815        this.productOrService = productOrService;
7816      }
7817
7818        /**
7819         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
7820         */
7821        public List<PositiveIntType> getItemSequence() { 
7822          if (this.itemSequence == null)
7823            this.itemSequence = new ArrayList<PositiveIntType>();
7824          return this.itemSequence;
7825        }
7826
7827        /**
7828         * @return Returns a reference to <code>this</code> for easy method chaining
7829         */
7830        public AddedItemComponent setItemSequence(List<PositiveIntType> theItemSequence) { 
7831          this.itemSequence = theItemSequence;
7832          return this;
7833        }
7834
7835        public boolean hasItemSequence() { 
7836          if (this.itemSequence == null)
7837            return false;
7838          for (PositiveIntType item : this.itemSequence)
7839            if (!item.isEmpty())
7840              return true;
7841          return false;
7842        }
7843
7844        /**
7845         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
7846         */
7847        public PositiveIntType addItemSequenceElement() {//2 
7848          PositiveIntType t = new PositiveIntType();
7849          if (this.itemSequence == null)
7850            this.itemSequence = new ArrayList<PositiveIntType>();
7851          this.itemSequence.add(t);
7852          return t;
7853        }
7854
7855        /**
7856         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
7857         */
7858        public AddedItemComponent addItemSequence(int value) { //1
7859          PositiveIntType t = new PositiveIntType();
7860          t.setValue(value);
7861          if (this.itemSequence == null)
7862            this.itemSequence = new ArrayList<PositiveIntType>();
7863          this.itemSequence.add(t);
7864          return this;
7865        }
7866
7867        /**
7868         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
7869         */
7870        public boolean hasItemSequence(int value) { 
7871          if (this.itemSequence == null)
7872            return false;
7873          for (PositiveIntType v : this.itemSequence)
7874            if (v.getValue().equals(value)) // positiveInt
7875              return true;
7876          return false;
7877        }
7878
7879        /**
7880         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7881         */
7882        public List<PositiveIntType> getDetailSequence() { 
7883          if (this.detailSequence == null)
7884            this.detailSequence = new ArrayList<PositiveIntType>();
7885          return this.detailSequence;
7886        }
7887
7888        /**
7889         * @return Returns a reference to <code>this</code> for easy method chaining
7890         */
7891        public AddedItemComponent setDetailSequence(List<PositiveIntType> theDetailSequence) { 
7892          this.detailSequence = theDetailSequence;
7893          return this;
7894        }
7895
7896        public boolean hasDetailSequence() { 
7897          if (this.detailSequence == null)
7898            return false;
7899          for (PositiveIntType item : this.detailSequence)
7900            if (!item.isEmpty())
7901              return true;
7902          return false;
7903        }
7904
7905        /**
7906         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7907         */
7908        public PositiveIntType addDetailSequenceElement() {//2 
7909          PositiveIntType t = new PositiveIntType();
7910          if (this.detailSequence == null)
7911            this.detailSequence = new ArrayList<PositiveIntType>();
7912          this.detailSequence.add(t);
7913          return t;
7914        }
7915
7916        /**
7917         * @param value {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7918         */
7919        public AddedItemComponent addDetailSequence(int value) { //1
7920          PositiveIntType t = new PositiveIntType();
7921          t.setValue(value);
7922          if (this.detailSequence == null)
7923            this.detailSequence = new ArrayList<PositiveIntType>();
7924          this.detailSequence.add(t);
7925          return this;
7926        }
7927
7928        /**
7929         * @param value {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7930         */
7931        public boolean hasDetailSequence(int value) { 
7932          if (this.detailSequence == null)
7933            return false;
7934          for (PositiveIntType v : this.detailSequence)
7935            if (v.getValue().equals(value)) // positiveInt
7936              return true;
7937          return false;
7938        }
7939
7940        /**
7941         * @return {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
7942         */
7943        public List<PositiveIntType> getSubDetailSequence() { 
7944          if (this.subDetailSequence == null)
7945            this.subDetailSequence = new ArrayList<PositiveIntType>();
7946          return this.subDetailSequence;
7947        }
7948
7949        /**
7950         * @return Returns a reference to <code>this</code> for easy method chaining
7951         */
7952        public AddedItemComponent setSubDetailSequence(List<PositiveIntType> theSubDetailSequence) { 
7953          this.subDetailSequence = theSubDetailSequence;
7954          return this;
7955        }
7956
7957        public boolean hasSubDetailSequence() { 
7958          if (this.subDetailSequence == null)
7959            return false;
7960          for (PositiveIntType item : this.subDetailSequence)
7961            if (!item.isEmpty())
7962              return true;
7963          return false;
7964        }
7965
7966        /**
7967         * @return {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
7968         */
7969        public PositiveIntType addSubDetailSequenceElement() {//2 
7970          PositiveIntType t = new PositiveIntType();
7971          if (this.subDetailSequence == null)
7972            this.subDetailSequence = new ArrayList<PositiveIntType>();
7973          this.subDetailSequence.add(t);
7974          return t;
7975        }
7976
7977        /**
7978         * @param value {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
7979         */
7980        public AddedItemComponent addSubDetailSequence(int value) { //1
7981          PositiveIntType t = new PositiveIntType();
7982          t.setValue(value);
7983          if (this.subDetailSequence == null)
7984            this.subDetailSequence = new ArrayList<PositiveIntType>();
7985          this.subDetailSequence.add(t);
7986          return this;
7987        }
7988
7989        /**
7990         * @param value {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
7991         */
7992        public boolean hasSubDetailSequence(int value) { 
7993          if (this.subDetailSequence == null)
7994            return false;
7995          for (PositiveIntType v : this.subDetailSequence)
7996            if (v.getValue().equals(value)) // positiveInt
7997              return true;
7998          return false;
7999        }
8000
8001        /**
8002         * @return {@link #provider} (The providers who are authorized for the services rendered to the patient.)
8003         */
8004        public List<Reference> getProvider() { 
8005          if (this.provider == null)
8006            this.provider = new ArrayList<Reference>();
8007          return this.provider;
8008        }
8009
8010        /**
8011         * @return Returns a reference to <code>this</code> for easy method chaining
8012         */
8013        public AddedItemComponent setProvider(List<Reference> theProvider) { 
8014          this.provider = theProvider;
8015          return this;
8016        }
8017
8018        public boolean hasProvider() { 
8019          if (this.provider == null)
8020            return false;
8021          for (Reference item : this.provider)
8022            if (!item.isEmpty())
8023              return true;
8024          return false;
8025        }
8026
8027        public Reference addProvider() { //3
8028          Reference t = new Reference();
8029          if (this.provider == null)
8030            this.provider = new ArrayList<Reference>();
8031          this.provider.add(t);
8032          return t;
8033        }
8034
8035        public AddedItemComponent addProvider(Reference t) { //3
8036          if (t == null)
8037            return this;
8038          if (this.provider == null)
8039            this.provider = new ArrayList<Reference>();
8040          this.provider.add(t);
8041          return this;
8042        }
8043
8044        /**
8045         * @return The first repetition of repeating field {@link #provider}, creating it if it does not already exist
8046         */
8047        public Reference getProviderFirstRep() { 
8048          if (getProvider().isEmpty()) {
8049            addProvider();
8050          }
8051          return getProvider().get(0);
8052        }
8053
8054        /**
8055         * @deprecated Use Reference#setResource(IBaseResource) instead
8056         */
8057        @Deprecated
8058        public List<Resource> getProviderTarget() { 
8059          if (this.providerTarget == null)
8060            this.providerTarget = new ArrayList<Resource>();
8061          return this.providerTarget;
8062        }
8063
8064        /**
8065         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
8066         */
8067        public CodeableConcept getProductOrService() { 
8068          if (this.productOrService == null)
8069            if (Configuration.errorOnAutoCreate())
8070              throw new Error("Attempt to auto-create AddedItemComponent.productOrService");
8071            else if (Configuration.doAutoCreate())
8072              this.productOrService = new CodeableConcept(); // cc
8073          return this.productOrService;
8074        }
8075
8076        public boolean hasProductOrService() { 
8077          return this.productOrService != null && !this.productOrService.isEmpty();
8078        }
8079
8080        /**
8081         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
8082         */
8083        public AddedItemComponent setProductOrService(CodeableConcept value) { 
8084          this.productOrService = value;
8085          return this;
8086        }
8087
8088        /**
8089         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
8090         */
8091        public List<CodeableConcept> getModifier() { 
8092          if (this.modifier == null)
8093            this.modifier = new ArrayList<CodeableConcept>();
8094          return this.modifier;
8095        }
8096
8097        /**
8098         * @return Returns a reference to <code>this</code> for easy method chaining
8099         */
8100        public AddedItemComponent setModifier(List<CodeableConcept> theModifier) { 
8101          this.modifier = theModifier;
8102          return this;
8103        }
8104
8105        public boolean hasModifier() { 
8106          if (this.modifier == null)
8107            return false;
8108          for (CodeableConcept item : this.modifier)
8109            if (!item.isEmpty())
8110              return true;
8111          return false;
8112        }
8113
8114        public CodeableConcept addModifier() { //3
8115          CodeableConcept t = new CodeableConcept();
8116          if (this.modifier == null)
8117            this.modifier = new ArrayList<CodeableConcept>();
8118          this.modifier.add(t);
8119          return t;
8120        }
8121
8122        public AddedItemComponent addModifier(CodeableConcept t) { //3
8123          if (t == null)
8124            return this;
8125          if (this.modifier == null)
8126            this.modifier = new ArrayList<CodeableConcept>();
8127          this.modifier.add(t);
8128          return this;
8129        }
8130
8131        /**
8132         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
8133         */
8134        public CodeableConcept getModifierFirstRep() { 
8135          if (getModifier().isEmpty()) {
8136            addModifier();
8137          }
8138          return getModifier().get(0);
8139        }
8140
8141        /**
8142         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
8143         */
8144        public List<CodeableConcept> getProgramCode() { 
8145          if (this.programCode == null)
8146            this.programCode = new ArrayList<CodeableConcept>();
8147          return this.programCode;
8148        }
8149
8150        /**
8151         * @return Returns a reference to <code>this</code> for easy method chaining
8152         */
8153        public AddedItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
8154          this.programCode = theProgramCode;
8155          return this;
8156        }
8157
8158        public boolean hasProgramCode() { 
8159          if (this.programCode == null)
8160            return false;
8161          for (CodeableConcept item : this.programCode)
8162            if (!item.isEmpty())
8163              return true;
8164          return false;
8165        }
8166
8167        public CodeableConcept addProgramCode() { //3
8168          CodeableConcept t = new CodeableConcept();
8169          if (this.programCode == null)
8170            this.programCode = new ArrayList<CodeableConcept>();
8171          this.programCode.add(t);
8172          return t;
8173        }
8174
8175        public AddedItemComponent addProgramCode(CodeableConcept t) { //3
8176          if (t == null)
8177            return this;
8178          if (this.programCode == null)
8179            this.programCode = new ArrayList<CodeableConcept>();
8180          this.programCode.add(t);
8181          return this;
8182        }
8183
8184        /**
8185         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
8186         */
8187        public CodeableConcept getProgramCodeFirstRep() { 
8188          if (getProgramCode().isEmpty()) {
8189            addProgramCode();
8190          }
8191          return getProgramCode().get(0);
8192        }
8193
8194        /**
8195         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8196         */
8197        public Type getServiced() { 
8198          return this.serviced;
8199        }
8200
8201        /**
8202         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8203         */
8204        public DateType getServicedDateType() throws FHIRException { 
8205          if (this.serviced == null)
8206            this.serviced = new DateType();
8207          if (!(this.serviced instanceof DateType))
8208            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
8209          return (DateType) this.serviced;
8210        }
8211
8212        public boolean hasServicedDateType() { 
8213          return this != null && this.serviced instanceof DateType;
8214        }
8215
8216        /**
8217         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8218         */
8219        public Period getServicedPeriod() throws FHIRException { 
8220          if (this.serviced == null)
8221            this.serviced = new Period();
8222          if (!(this.serviced instanceof Period))
8223            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
8224          return (Period) this.serviced;
8225        }
8226
8227        public boolean hasServicedPeriod() { 
8228          return this != null && this.serviced instanceof Period;
8229        }
8230
8231        public boolean hasServiced() { 
8232          return this.serviced != null && !this.serviced.isEmpty();
8233        }
8234
8235        /**
8236         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8237         */
8238        public AddedItemComponent setServiced(Type value) { 
8239          if (value != null && !(value instanceof DateType || value instanceof Period))
8240            throw new Error("Not the right type for ExplanationOfBenefit.addItem.serviced[x]: "+value.fhirType());
8241          this.serviced = value;
8242          return this;
8243        }
8244
8245        /**
8246         * @return {@link #location} (Where the product or service was provided.)
8247         */
8248        public Type getLocation() { 
8249          return this.location;
8250        }
8251
8252        /**
8253         * @return {@link #location} (Where the product or service was provided.)
8254         */
8255        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
8256          if (this.location == null)
8257            this.location = new CodeableConcept();
8258          if (!(this.location instanceof CodeableConcept))
8259            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
8260          return (CodeableConcept) this.location;
8261        }
8262
8263        public boolean hasLocationCodeableConcept() { 
8264          return this != null && this.location instanceof CodeableConcept;
8265        }
8266
8267        /**
8268         * @return {@link #location} (Where the product or service was provided.)
8269         */
8270        public Address getLocationAddress() throws FHIRException { 
8271          if (this.location == null)
8272            this.location = new Address();
8273          if (!(this.location instanceof Address))
8274            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
8275          return (Address) this.location;
8276        }
8277
8278        public boolean hasLocationAddress() { 
8279          return this != null && this.location instanceof Address;
8280        }
8281
8282        /**
8283         * @return {@link #location} (Where the product or service was provided.)
8284         */
8285        public Reference getLocationReference() throws FHIRException { 
8286          if (this.location == null)
8287            this.location = new Reference();
8288          if (!(this.location instanceof Reference))
8289            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
8290          return (Reference) this.location;
8291        }
8292
8293        public boolean hasLocationReference() { 
8294          return this != null && this.location instanceof Reference;
8295        }
8296
8297        public boolean hasLocation() { 
8298          return this.location != null && !this.location.isEmpty();
8299        }
8300
8301        /**
8302         * @param value {@link #location} (Where the product or service was provided.)
8303         */
8304        public AddedItemComponent setLocation(Type value) { 
8305          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
8306            throw new Error("Not the right type for ExplanationOfBenefit.addItem.location[x]: "+value.fhirType());
8307          this.location = value;
8308          return this;
8309        }
8310
8311        /**
8312         * @return {@link #quantity} (The number of repetitions of a service or product.)
8313         */
8314        public Quantity getQuantity() { 
8315          if (this.quantity == null)
8316            if (Configuration.errorOnAutoCreate())
8317              throw new Error("Attempt to auto-create AddedItemComponent.quantity");
8318            else if (Configuration.doAutoCreate())
8319              this.quantity = new Quantity(); // cc
8320          return this.quantity;
8321        }
8322
8323        public boolean hasQuantity() { 
8324          return this.quantity != null && !this.quantity.isEmpty();
8325        }
8326
8327        /**
8328         * @param value {@link #quantity} (The number of repetitions of a service or product.)
8329         */
8330        public AddedItemComponent setQuantity(Quantity value) { 
8331          this.quantity = value;
8332          return this;
8333        }
8334
8335        /**
8336         * @return {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
8337         */
8338        public Money getUnitPrice() { 
8339          if (this.unitPrice == null)
8340            if (Configuration.errorOnAutoCreate())
8341              throw new Error("Attempt to auto-create AddedItemComponent.unitPrice");
8342            else if (Configuration.doAutoCreate())
8343              this.unitPrice = new Money(); // cc
8344          return this.unitPrice;
8345        }
8346
8347        public boolean hasUnitPrice() { 
8348          return this.unitPrice != null && !this.unitPrice.isEmpty();
8349        }
8350
8351        /**
8352         * @param value {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
8353         */
8354        public AddedItemComponent setUnitPrice(Money value) { 
8355          this.unitPrice = value;
8356          return this;
8357        }
8358
8359        /**
8360         * @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
8361         */
8362        public DecimalType getFactorElement() { 
8363          if (this.factor == null)
8364            if (Configuration.errorOnAutoCreate())
8365              throw new Error("Attempt to auto-create AddedItemComponent.factor");
8366            else if (Configuration.doAutoCreate())
8367              this.factor = new DecimalType(); // bb
8368          return this.factor;
8369        }
8370
8371        public boolean hasFactorElement() { 
8372          return this.factor != null && !this.factor.isEmpty();
8373        }
8374
8375        public boolean hasFactor() { 
8376          return this.factor != null && !this.factor.isEmpty();
8377        }
8378
8379        /**
8380         * @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
8381         */
8382        public AddedItemComponent setFactorElement(DecimalType value) { 
8383          this.factor = value;
8384          return this;
8385        }
8386
8387        /**
8388         * @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.
8389         */
8390        public BigDecimal getFactor() { 
8391          return this.factor == null ? null : this.factor.getValue();
8392        }
8393
8394        /**
8395         * @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.
8396         */
8397        public AddedItemComponent setFactor(BigDecimal value) { 
8398          if (value == null)
8399            this.factor = null;
8400          else {
8401            if (this.factor == null)
8402              this.factor = new DecimalType();
8403            this.factor.setValue(value);
8404          }
8405          return this;
8406        }
8407
8408        /**
8409         * @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.
8410         */
8411        public AddedItemComponent setFactor(long value) { 
8412              this.factor = new DecimalType();
8413            this.factor.setValue(value);
8414          return this;
8415        }
8416
8417        /**
8418         * @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.
8419         */
8420        public AddedItemComponent setFactor(double value) { 
8421              this.factor = new DecimalType();
8422            this.factor.setValue(value);
8423          return this;
8424        }
8425
8426        /**
8427         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8428         */
8429        public Money getNet() { 
8430          if (this.net == null)
8431            if (Configuration.errorOnAutoCreate())
8432              throw new Error("Attempt to auto-create AddedItemComponent.net");
8433            else if (Configuration.doAutoCreate())
8434              this.net = new Money(); // cc
8435          return this.net;
8436        }
8437
8438        public boolean hasNet() { 
8439          return this.net != null && !this.net.isEmpty();
8440        }
8441
8442        /**
8443         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8444         */
8445        public AddedItemComponent setNet(Money value) { 
8446          this.net = value;
8447          return this;
8448        }
8449
8450        /**
8451         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
8452         */
8453        public CodeableConcept getBodySite() { 
8454          if (this.bodySite == null)
8455            if (Configuration.errorOnAutoCreate())
8456              throw new Error("Attempt to auto-create AddedItemComponent.bodySite");
8457            else if (Configuration.doAutoCreate())
8458              this.bodySite = new CodeableConcept(); // cc
8459          return this.bodySite;
8460        }
8461
8462        public boolean hasBodySite() { 
8463          return this.bodySite != null && !this.bodySite.isEmpty();
8464        }
8465
8466        /**
8467         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
8468         */
8469        public AddedItemComponent setBodySite(CodeableConcept value) { 
8470          this.bodySite = value;
8471          return this;
8472        }
8473
8474        /**
8475         * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb region or tooth surface(s).)
8476         */
8477        public List<CodeableConcept> getSubSite() { 
8478          if (this.subSite == null)
8479            this.subSite = new ArrayList<CodeableConcept>();
8480          return this.subSite;
8481        }
8482
8483        /**
8484         * @return Returns a reference to <code>this</code> for easy method chaining
8485         */
8486        public AddedItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
8487          this.subSite = theSubSite;
8488          return this;
8489        }
8490
8491        public boolean hasSubSite() { 
8492          if (this.subSite == null)
8493            return false;
8494          for (CodeableConcept item : this.subSite)
8495            if (!item.isEmpty())
8496              return true;
8497          return false;
8498        }
8499
8500        public CodeableConcept addSubSite() { //3
8501          CodeableConcept t = new CodeableConcept();
8502          if (this.subSite == null)
8503            this.subSite = new ArrayList<CodeableConcept>();
8504          this.subSite.add(t);
8505          return t;
8506        }
8507
8508        public AddedItemComponent addSubSite(CodeableConcept t) { //3
8509          if (t == null)
8510            return this;
8511          if (this.subSite == null)
8512            this.subSite = new ArrayList<CodeableConcept>();
8513          this.subSite.add(t);
8514          return this;
8515        }
8516
8517        /**
8518         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist
8519         */
8520        public CodeableConcept getSubSiteFirstRep() { 
8521          if (getSubSite().isEmpty()) {
8522            addSubSite();
8523          }
8524          return getSubSite().get(0);
8525        }
8526
8527        /**
8528         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8529         */
8530        public List<PositiveIntType> getNoteNumber() { 
8531          if (this.noteNumber == null)
8532            this.noteNumber = new ArrayList<PositiveIntType>();
8533          return this.noteNumber;
8534        }
8535
8536        /**
8537         * @return Returns a reference to <code>this</code> for easy method chaining
8538         */
8539        public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
8540          this.noteNumber = theNoteNumber;
8541          return this;
8542        }
8543
8544        public boolean hasNoteNumber() { 
8545          if (this.noteNumber == null)
8546            return false;
8547          for (PositiveIntType item : this.noteNumber)
8548            if (!item.isEmpty())
8549              return true;
8550          return false;
8551        }
8552
8553        /**
8554         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8555         */
8556        public PositiveIntType addNoteNumberElement() {//2 
8557          PositiveIntType t = new PositiveIntType();
8558          if (this.noteNumber == null)
8559            this.noteNumber = new ArrayList<PositiveIntType>();
8560          this.noteNumber.add(t);
8561          return t;
8562        }
8563
8564        /**
8565         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8566         */
8567        public AddedItemComponent addNoteNumber(int value) { //1
8568          PositiveIntType t = new PositiveIntType();
8569          t.setValue(value);
8570          if (this.noteNumber == null)
8571            this.noteNumber = new ArrayList<PositiveIntType>();
8572          this.noteNumber.add(t);
8573          return this;
8574        }
8575
8576        /**
8577         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8578         */
8579        public boolean hasNoteNumber(int value) { 
8580          if (this.noteNumber == null)
8581            return false;
8582          for (PositiveIntType v : this.noteNumber)
8583            if (v.getValue().equals(value)) // positiveInt
8584              return true;
8585          return false;
8586        }
8587
8588        /**
8589         * @return {@link #adjudication} (The adjudication results.)
8590         */
8591        public List<AdjudicationComponent> getAdjudication() { 
8592          if (this.adjudication == null)
8593            this.adjudication = new ArrayList<AdjudicationComponent>();
8594          return this.adjudication;
8595        }
8596
8597        /**
8598         * @return Returns a reference to <code>this</code> for easy method chaining
8599         */
8600        public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
8601          this.adjudication = theAdjudication;
8602          return this;
8603        }
8604
8605        public boolean hasAdjudication() { 
8606          if (this.adjudication == null)
8607            return false;
8608          for (AdjudicationComponent item : this.adjudication)
8609            if (!item.isEmpty())
8610              return true;
8611          return false;
8612        }
8613
8614        public AdjudicationComponent addAdjudication() { //3
8615          AdjudicationComponent t = new AdjudicationComponent();
8616          if (this.adjudication == null)
8617            this.adjudication = new ArrayList<AdjudicationComponent>();
8618          this.adjudication.add(t);
8619          return t;
8620        }
8621
8622        public AddedItemComponent addAdjudication(AdjudicationComponent t) { //3
8623          if (t == null)
8624            return this;
8625          if (this.adjudication == null)
8626            this.adjudication = new ArrayList<AdjudicationComponent>();
8627          this.adjudication.add(t);
8628          return this;
8629        }
8630
8631        /**
8632         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
8633         */
8634        public AdjudicationComponent getAdjudicationFirstRep() { 
8635          if (getAdjudication().isEmpty()) {
8636            addAdjudication();
8637          }
8638          return getAdjudication().get(0);
8639        }
8640
8641        /**
8642         * @return {@link #detail} (The second-tier service adjudications for payor added services.)
8643         */
8644        public List<AddedItemDetailComponent> getDetail() { 
8645          if (this.detail == null)
8646            this.detail = new ArrayList<AddedItemDetailComponent>();
8647          return this.detail;
8648        }
8649
8650        /**
8651         * @return Returns a reference to <code>this</code> for easy method chaining
8652         */
8653        public AddedItemComponent setDetail(List<AddedItemDetailComponent> theDetail) { 
8654          this.detail = theDetail;
8655          return this;
8656        }
8657
8658        public boolean hasDetail() { 
8659          if (this.detail == null)
8660            return false;
8661          for (AddedItemDetailComponent item : this.detail)
8662            if (!item.isEmpty())
8663              return true;
8664          return false;
8665        }
8666
8667        public AddedItemDetailComponent addDetail() { //3
8668          AddedItemDetailComponent t = new AddedItemDetailComponent();
8669          if (this.detail == null)
8670            this.detail = new ArrayList<AddedItemDetailComponent>();
8671          this.detail.add(t);
8672          return t;
8673        }
8674
8675        public AddedItemComponent addDetail(AddedItemDetailComponent t) { //3
8676          if (t == null)
8677            return this;
8678          if (this.detail == null)
8679            this.detail = new ArrayList<AddedItemDetailComponent>();
8680          this.detail.add(t);
8681          return this;
8682        }
8683
8684        /**
8685         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
8686         */
8687        public AddedItemDetailComponent getDetailFirstRep() { 
8688          if (getDetail().isEmpty()) {
8689            addDetail();
8690          }
8691          return getDetail().get(0);
8692        }
8693
8694        protected void listChildren(List<Property> children) {
8695          super.listChildren(children);
8696          children.add(new Property("itemSequence", "positiveInt", "Claim items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, itemSequence));
8697          children.add(new Property("detailSequence", "positiveInt", "The sequence number of the details within the claim item which this line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, detailSequence));
8698          children.add(new Property("subDetailSequence", "positiveInt", "The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, subDetailSequence));
8699          children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The providers who are authorized for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, provider));
8700          children.add(new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService));
8701          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier));
8702          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
8703          children.add(new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced));
8704          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location));
8705          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
8706          children.add(new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice));
8707          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));
8708          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
8709          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
8710          children.add(new Property("subSite", "CodeableConcept", "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite));
8711          children.add(new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
8712          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
8713          children.add(new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail));
8714        }
8715
8716        @Override
8717        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8718          switch (_hash) {
8719          case 1977979892: /*itemSequence*/  return new Property("itemSequence", "positiveInt", "Claim items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, itemSequence);
8720          case 1321472818: /*detailSequence*/  return new Property("detailSequence", "positiveInt", "The sequence number of the details within the claim item which this line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, detailSequence);
8721          case -855462510: /*subDetailSequence*/  return new Property("subDetailSequence", "positiveInt", "The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, subDetailSequence);
8722          case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The providers who are authorized for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, provider);
8723          case 1957227299: /*productOrService*/  return new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService);
8724          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier);
8725          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
8726          case -1927922223: /*serviced[x]*/  return new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
8727          case 1379209295: /*serviced*/  return new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
8728          case 363246749: /*servicedDate*/  return new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
8729          case 1534966512: /*servicedPeriod*/  return new Property("serviced[x]", "date|Period", "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
8730          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8731          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8732          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8733          case -1280020865: /*locationAddress*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8734          case 755866390: /*locationReference*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8735          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
8736          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice);
8737          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);
8738          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
8739          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
8740          case -1868566105: /*subSite*/  return new Property("subSite", "CodeableConcept", "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE, subSite);
8741          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
8742          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
8743          case -1335224239: /*detail*/  return new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail);
8744          default: return super.getNamedProperty(_hash, _name, _checkValid);
8745          }
8746
8747        }
8748
8749      @Override
8750      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8751        switch (hash) {
8752        case 1977979892: /*itemSequence*/ return this.itemSequence == null ? new Base[0] : this.itemSequence.toArray(new Base[this.itemSequence.size()]); // PositiveIntType
8753        case 1321472818: /*detailSequence*/ return this.detailSequence == null ? new Base[0] : this.detailSequence.toArray(new Base[this.detailSequence.size()]); // PositiveIntType
8754        case -855462510: /*subDetailSequence*/ return this.subDetailSequence == null ? new Base[0] : this.subDetailSequence.toArray(new Base[this.subDetailSequence.size()]); // PositiveIntType
8755        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : this.provider.toArray(new Base[this.provider.size()]); // Reference
8756        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
8757        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
8758        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
8759        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
8760        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
8761        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
8762        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
8763        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
8764        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
8765        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
8766        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
8767        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
8768        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
8769        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemDetailComponent
8770        default: return super.getProperty(hash, name, checkValid);
8771        }
8772
8773      }
8774
8775      @Override
8776      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8777        switch (hash) {
8778        case 1977979892: // itemSequence
8779          this.getItemSequence().add(castToPositiveInt(value)); // PositiveIntType
8780          return value;
8781        case 1321472818: // detailSequence
8782          this.getDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
8783          return value;
8784        case -855462510: // subDetailSequence
8785          this.getSubDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
8786          return value;
8787        case -987494927: // provider
8788          this.getProvider().add(castToReference(value)); // Reference
8789          return value;
8790        case 1957227299: // productOrService
8791          this.productOrService = castToCodeableConcept(value); // CodeableConcept
8792          return value;
8793        case -615513385: // modifier
8794          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
8795          return value;
8796        case 1010065041: // programCode
8797          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
8798          return value;
8799        case 1379209295: // serviced
8800          this.serviced = castToType(value); // Type
8801          return value;
8802        case 1901043637: // location
8803          this.location = castToType(value); // Type
8804          return value;
8805        case -1285004149: // quantity
8806          this.quantity = castToQuantity(value); // Quantity
8807          return value;
8808        case -486196699: // unitPrice
8809          this.unitPrice = castToMoney(value); // Money
8810          return value;
8811        case -1282148017: // factor
8812          this.factor = castToDecimal(value); // DecimalType
8813          return value;
8814        case 108957: // net
8815          this.net = castToMoney(value); // Money
8816          return value;
8817        case 1702620169: // bodySite
8818          this.bodySite = castToCodeableConcept(value); // CodeableConcept
8819          return value;
8820        case -1868566105: // subSite
8821          this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
8822          return value;
8823        case -1110033957: // noteNumber
8824          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
8825          return value;
8826        case -231349275: // adjudication
8827          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
8828          return value;
8829        case -1335224239: // detail
8830          this.getDetail().add((AddedItemDetailComponent) value); // AddedItemDetailComponent
8831          return value;
8832        default: return super.setProperty(hash, name, value);
8833        }
8834
8835      }
8836
8837      @Override
8838      public Base setProperty(String name, Base value) throws FHIRException {
8839        if (name.equals("itemSequence")) {
8840          this.getItemSequence().add(castToPositiveInt(value));
8841        } else if (name.equals("detailSequence")) {
8842          this.getDetailSequence().add(castToPositiveInt(value));
8843        } else if (name.equals("subDetailSequence")) {
8844          this.getSubDetailSequence().add(castToPositiveInt(value));
8845        } else if (name.equals("provider")) {
8846          this.getProvider().add(castToReference(value));
8847        } else if (name.equals("productOrService")) {
8848          this.productOrService = castToCodeableConcept(value); // CodeableConcept
8849        } else if (name.equals("modifier")) {
8850          this.getModifier().add(castToCodeableConcept(value));
8851        } else if (name.equals("programCode")) {
8852          this.getProgramCode().add(castToCodeableConcept(value));
8853        } else if (name.equals("serviced[x]")) {
8854          this.serviced = castToType(value); // Type
8855        } else if (name.equals("location[x]")) {
8856          this.location = castToType(value); // Type
8857        } else if (name.equals("quantity")) {
8858          this.quantity = castToQuantity(value); // Quantity
8859        } else if (name.equals("unitPrice")) {
8860          this.unitPrice = castToMoney(value); // Money
8861        } else if (name.equals("factor")) {
8862          this.factor = castToDecimal(value); // DecimalType
8863        } else if (name.equals("net")) {
8864          this.net = castToMoney(value); // Money
8865        } else if (name.equals("bodySite")) {
8866          this.bodySite = castToCodeableConcept(value); // CodeableConcept
8867        } else if (name.equals("subSite")) {
8868          this.getSubSite().add(castToCodeableConcept(value));
8869        } else if (name.equals("noteNumber")) {
8870          this.getNoteNumber().add(castToPositiveInt(value));
8871        } else if (name.equals("adjudication")) {
8872          this.getAdjudication().add((AdjudicationComponent) value);
8873        } else if (name.equals("detail")) {
8874          this.getDetail().add((AddedItemDetailComponent) value);
8875        } else
8876          return super.setProperty(name, value);
8877        return value;
8878      }
8879
8880      @Override
8881      public Base makeProperty(int hash, String name) throws FHIRException {
8882        switch (hash) {
8883        case 1977979892:  return addItemSequenceElement();
8884        case 1321472818:  return addDetailSequenceElement();
8885        case -855462510:  return addSubDetailSequenceElement();
8886        case -987494927:  return addProvider(); 
8887        case 1957227299:  return getProductOrService(); 
8888        case -615513385:  return addModifier(); 
8889        case 1010065041:  return addProgramCode(); 
8890        case -1927922223:  return getServiced(); 
8891        case 1379209295:  return getServiced(); 
8892        case 552316075:  return getLocation(); 
8893        case 1901043637:  return getLocation(); 
8894        case -1285004149:  return getQuantity(); 
8895        case -486196699:  return getUnitPrice(); 
8896        case -1282148017:  return getFactorElement();
8897        case 108957:  return getNet(); 
8898        case 1702620169:  return getBodySite(); 
8899        case -1868566105:  return addSubSite(); 
8900        case -1110033957:  return addNoteNumberElement();
8901        case -231349275:  return addAdjudication(); 
8902        case -1335224239:  return addDetail(); 
8903        default: return super.makeProperty(hash, name);
8904        }
8905
8906      }
8907
8908      @Override
8909      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8910        switch (hash) {
8911        case 1977979892: /*itemSequence*/ return new String[] {"positiveInt"};
8912        case 1321472818: /*detailSequence*/ return new String[] {"positiveInt"};
8913        case -855462510: /*subDetailSequence*/ return new String[] {"positiveInt"};
8914        case -987494927: /*provider*/ return new String[] {"Reference"};
8915        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
8916        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
8917        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
8918        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
8919        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
8920        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
8921        case -486196699: /*unitPrice*/ return new String[] {"Money"};
8922        case -1282148017: /*factor*/ return new String[] {"decimal"};
8923        case 108957: /*net*/ return new String[] {"Money"};
8924        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
8925        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
8926        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
8927        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
8928        case -1335224239: /*detail*/ return new String[] {};
8929        default: return super.getTypesForProperty(hash, name);
8930        }
8931
8932      }
8933
8934      @Override
8935      public Base addChild(String name) throws FHIRException {
8936        if (name.equals("itemSequence")) {
8937          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.itemSequence");
8938        }
8939        else if (name.equals("detailSequence")) {
8940          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.detailSequence");
8941        }
8942        else if (name.equals("subDetailSequence")) {
8943          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.subDetailSequence");
8944        }
8945        else if (name.equals("provider")) {
8946          return addProvider();
8947        }
8948        else if (name.equals("productOrService")) {
8949          this.productOrService = new CodeableConcept();
8950          return this.productOrService;
8951        }
8952        else if (name.equals("modifier")) {
8953          return addModifier();
8954        }
8955        else if (name.equals("programCode")) {
8956          return addProgramCode();
8957        }
8958        else if (name.equals("servicedDate")) {
8959          this.serviced = new DateType();
8960          return this.serviced;
8961        }
8962        else if (name.equals("servicedPeriod")) {
8963          this.serviced = new Period();
8964          return this.serviced;
8965        }
8966        else if (name.equals("locationCodeableConcept")) {
8967          this.location = new CodeableConcept();
8968          return this.location;
8969        }
8970        else if (name.equals("locationAddress")) {
8971          this.location = new Address();
8972          return this.location;
8973        }
8974        else if (name.equals("locationReference")) {
8975          this.location = new Reference();
8976          return this.location;
8977        }
8978        else if (name.equals("quantity")) {
8979          this.quantity = new Quantity();
8980          return this.quantity;
8981        }
8982        else if (name.equals("unitPrice")) {
8983          this.unitPrice = new Money();
8984          return this.unitPrice;
8985        }
8986        else if (name.equals("factor")) {
8987          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
8988        }
8989        else if (name.equals("net")) {
8990          this.net = new Money();
8991          return this.net;
8992        }
8993        else if (name.equals("bodySite")) {
8994          this.bodySite = new CodeableConcept();
8995          return this.bodySite;
8996        }
8997        else if (name.equals("subSite")) {
8998          return addSubSite();
8999        }
9000        else if (name.equals("noteNumber")) {
9001          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
9002        }
9003        else if (name.equals("adjudication")) {
9004          return addAdjudication();
9005        }
9006        else if (name.equals("detail")) {
9007          return addDetail();
9008        }
9009        else
9010          return super.addChild(name);
9011      }
9012
9013      public AddedItemComponent copy() {
9014        AddedItemComponent dst = new AddedItemComponent();
9015        copyValues(dst);
9016        if (itemSequence != null) {
9017          dst.itemSequence = new ArrayList<PositiveIntType>();
9018          for (PositiveIntType i : itemSequence)
9019            dst.itemSequence.add(i.copy());
9020        };
9021        if (detailSequence != null) {
9022          dst.detailSequence = new ArrayList<PositiveIntType>();
9023          for (PositiveIntType i : detailSequence)
9024            dst.detailSequence.add(i.copy());
9025        };
9026        if (subDetailSequence != null) {
9027          dst.subDetailSequence = new ArrayList<PositiveIntType>();
9028          for (PositiveIntType i : subDetailSequence)
9029            dst.subDetailSequence.add(i.copy());
9030        };
9031        if (provider != null) {
9032          dst.provider = new ArrayList<Reference>();
9033          for (Reference i : provider)
9034            dst.provider.add(i.copy());
9035        };
9036        dst.productOrService = productOrService == null ? null : productOrService.copy();
9037        if (modifier != null) {
9038          dst.modifier = new ArrayList<CodeableConcept>();
9039          for (CodeableConcept i : modifier)
9040            dst.modifier.add(i.copy());
9041        };
9042        if (programCode != null) {
9043          dst.programCode = new ArrayList<CodeableConcept>();
9044          for (CodeableConcept i : programCode)
9045            dst.programCode.add(i.copy());
9046        };
9047        dst.serviced = serviced == null ? null : serviced.copy();
9048        dst.location = location == null ? null : location.copy();
9049        dst.quantity = quantity == null ? null : quantity.copy();
9050        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
9051        dst.factor = factor == null ? null : factor.copy();
9052        dst.net = net == null ? null : net.copy();
9053        dst.bodySite = bodySite == null ? null : bodySite.copy();
9054        if (subSite != null) {
9055          dst.subSite = new ArrayList<CodeableConcept>();
9056          for (CodeableConcept i : subSite)
9057            dst.subSite.add(i.copy());
9058        };
9059        if (noteNumber != null) {
9060          dst.noteNumber = new ArrayList<PositiveIntType>();
9061          for (PositiveIntType i : noteNumber)
9062            dst.noteNumber.add(i.copy());
9063        };
9064        if (adjudication != null) {
9065          dst.adjudication = new ArrayList<AdjudicationComponent>();
9066          for (AdjudicationComponent i : adjudication)
9067            dst.adjudication.add(i.copy());
9068        };
9069        if (detail != null) {
9070          dst.detail = new ArrayList<AddedItemDetailComponent>();
9071          for (AddedItemDetailComponent i : detail)
9072            dst.detail.add(i.copy());
9073        };
9074        return dst;
9075      }
9076
9077      @Override
9078      public boolean equalsDeep(Base other_) {
9079        if (!super.equalsDeep(other_))
9080          return false;
9081        if (!(other_ instanceof AddedItemComponent))
9082          return false;
9083        AddedItemComponent o = (AddedItemComponent) other_;
9084        return compareDeep(itemSequence, o.itemSequence, true) && compareDeep(detailSequence, o.detailSequence, true)
9085           && compareDeep(subDetailSequence, o.subDetailSequence, true) && compareDeep(provider, o.provider, true)
9086           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
9087           && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
9088           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
9089           && compareDeep(net, o.net, true) && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true)
9090           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
9091           && compareDeep(detail, o.detail, true);
9092      }
9093
9094      @Override
9095      public boolean equalsShallow(Base other_) {
9096        if (!super.equalsShallow(other_))
9097          return false;
9098        if (!(other_ instanceof AddedItemComponent))
9099          return false;
9100        AddedItemComponent o = (AddedItemComponent) other_;
9101        return compareValues(itemSequence, o.itemSequence, true) && compareValues(detailSequence, o.detailSequence, true)
9102           && compareValues(subDetailSequence, o.subDetailSequence, true) && compareValues(factor, o.factor, true)
9103           && compareValues(noteNumber, o.noteNumber, true);
9104      }
9105
9106      public boolean isEmpty() {
9107        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(itemSequence, detailSequence
9108          , subDetailSequence, provider, productOrService, modifier, programCode, serviced
9109          , location, quantity, unitPrice, factor, net, bodySite, subSite, noteNumber
9110          , adjudication, detail);
9111      }
9112
9113  public String fhirType() {
9114    return "ExplanationOfBenefit.addItem";
9115
9116  }
9117
9118  }
9119
9120    @Block()
9121    public static class AddedItemDetailComponent extends BackboneElement implements IBaseBackboneElement {
9122        /**
9123         * When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.
9124         */
9125        @Child(name = "productOrService", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9126        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item." )
9127        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
9128        protected CodeableConcept productOrService;
9129
9130        /**
9131         * Item typification or modifiers codes to convey additional context for the product or service.
9132         */
9133        @Child(name = "modifier", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9134        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
9135        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
9136        protected List<CodeableConcept> modifier;
9137
9138        /**
9139         * The number of repetitions of a service or product.
9140         */
9141        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
9142        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
9143        protected Quantity quantity;
9144
9145        /**
9146         * If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.
9147         */
9148        @Child(name = "unitPrice", type = {Money.class}, order=4, min=0, max=1, modifier=false, summary=false)
9149        @Description(shortDefinition="Fee, charge or cost per item", formalDefinition="If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group." )
9150        protected Money unitPrice;
9151
9152        /**
9153         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
9154         */
9155        @Child(name = "factor", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=false)
9156        @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." )
9157        protected DecimalType factor;
9158
9159        /**
9160         * The quantity times the unit price for an additional service or product or charge.
9161         */
9162        @Child(name = "net", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
9163        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
9164        protected Money net;
9165
9166        /**
9167         * The numbers associated with notes below which apply to the adjudication of this item.
9168         */
9169        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9170        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
9171        protected List<PositiveIntType> noteNumber;
9172
9173        /**
9174         * The adjudication results.
9175         */
9176        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9177        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
9178        protected List<AdjudicationComponent> adjudication;
9179
9180        /**
9181         * The third-tier service adjudications for payor added services.
9182         */
9183        @Child(name = "subDetail", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9184        @Description(shortDefinition="Insurer added line items", formalDefinition="The third-tier service adjudications for payor added services." )
9185        protected List<AddedItemDetailSubDetailComponent> subDetail;
9186
9187        private static final long serialVersionUID = 295910869L;
9188
9189    /**
9190     * Constructor
9191     */
9192      public AddedItemDetailComponent() {
9193        super();
9194      }
9195
9196    /**
9197     * Constructor
9198     */
9199      public AddedItemDetailComponent(CodeableConcept productOrService) {
9200        super();
9201        this.productOrService = productOrService;
9202      }
9203
9204        /**
9205         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
9206         */
9207        public CodeableConcept getProductOrService() { 
9208          if (this.productOrService == null)
9209            if (Configuration.errorOnAutoCreate())
9210              throw new Error("Attempt to auto-create AddedItemDetailComponent.productOrService");
9211            else if (Configuration.doAutoCreate())
9212              this.productOrService = new CodeableConcept(); // cc
9213          return this.productOrService;
9214        }
9215
9216        public boolean hasProductOrService() { 
9217          return this.productOrService != null && !this.productOrService.isEmpty();
9218        }
9219
9220        /**
9221         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
9222         */
9223        public AddedItemDetailComponent setProductOrService(CodeableConcept value) { 
9224          this.productOrService = value;
9225          return this;
9226        }
9227
9228        /**
9229         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
9230         */
9231        public List<CodeableConcept> getModifier() { 
9232          if (this.modifier == null)
9233            this.modifier = new ArrayList<CodeableConcept>();
9234          return this.modifier;
9235        }
9236
9237        /**
9238         * @return Returns a reference to <code>this</code> for easy method chaining
9239         */
9240        public AddedItemDetailComponent setModifier(List<CodeableConcept> theModifier) { 
9241          this.modifier = theModifier;
9242          return this;
9243        }
9244
9245        public boolean hasModifier() { 
9246          if (this.modifier == null)
9247            return false;
9248          for (CodeableConcept item : this.modifier)
9249            if (!item.isEmpty())
9250              return true;
9251          return false;
9252        }
9253
9254        public CodeableConcept addModifier() { //3
9255          CodeableConcept t = new CodeableConcept();
9256          if (this.modifier == null)
9257            this.modifier = new ArrayList<CodeableConcept>();
9258          this.modifier.add(t);
9259          return t;
9260        }
9261
9262        public AddedItemDetailComponent addModifier(CodeableConcept t) { //3
9263          if (t == null)
9264            return this;
9265          if (this.modifier == null)
9266            this.modifier = new ArrayList<CodeableConcept>();
9267          this.modifier.add(t);
9268          return this;
9269        }
9270
9271        /**
9272         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
9273         */
9274        public CodeableConcept getModifierFirstRep() { 
9275          if (getModifier().isEmpty()) {
9276            addModifier();
9277          }
9278          return getModifier().get(0);
9279        }
9280
9281        /**
9282         * @return {@link #quantity} (The number of repetitions of a service or product.)
9283         */
9284        public Quantity getQuantity() { 
9285          if (this.quantity == null)
9286            if (Configuration.errorOnAutoCreate())
9287              throw new Error("Attempt to auto-create AddedItemDetailComponent.quantity");
9288            else if (Configuration.doAutoCreate())
9289              this.quantity = new Quantity(); // cc
9290          return this.quantity;
9291        }
9292
9293        public boolean hasQuantity() { 
9294          return this.quantity != null && !this.quantity.isEmpty();
9295        }
9296
9297        /**
9298         * @param value {@link #quantity} (The number of repetitions of a service or product.)
9299         */
9300        public AddedItemDetailComponent setQuantity(Quantity value) { 
9301          this.quantity = value;
9302          return this;
9303        }
9304
9305        /**
9306         * @return {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
9307         */
9308        public Money getUnitPrice() { 
9309          if (this.unitPrice == null)
9310            if (Configuration.errorOnAutoCreate())
9311              throw new Error("Attempt to auto-create AddedItemDetailComponent.unitPrice");
9312            else if (Configuration.doAutoCreate())
9313              this.unitPrice = new Money(); // cc
9314          return this.unitPrice;
9315        }
9316
9317        public boolean hasUnitPrice() { 
9318          return this.unitPrice != null && !this.unitPrice.isEmpty();
9319        }
9320
9321        /**
9322         * @param value {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
9323         */
9324        public AddedItemDetailComponent setUnitPrice(Money value) { 
9325          this.unitPrice = value;
9326          return this;
9327        }
9328
9329        /**
9330         * @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
9331         */
9332        public DecimalType getFactorElement() { 
9333          if (this.factor == null)
9334            if (Configuration.errorOnAutoCreate())
9335              throw new Error("Attempt to auto-create AddedItemDetailComponent.factor");
9336            else if (Configuration.doAutoCreate())
9337              this.factor = new DecimalType(); // bb
9338          return this.factor;
9339        }
9340
9341        public boolean hasFactorElement() { 
9342          return this.factor != null && !this.factor.isEmpty();
9343        }
9344
9345        public boolean hasFactor() { 
9346          return this.factor != null && !this.factor.isEmpty();
9347        }
9348
9349        /**
9350         * @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
9351         */
9352        public AddedItemDetailComponent setFactorElement(DecimalType value) { 
9353          this.factor = value;
9354          return this;
9355        }
9356
9357        /**
9358         * @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.
9359         */
9360        public BigDecimal getFactor() { 
9361          return this.factor == null ? null : this.factor.getValue();
9362        }
9363
9364        /**
9365         * @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.
9366         */
9367        public AddedItemDetailComponent setFactor(BigDecimal value) { 
9368          if (value == null)
9369            this.factor = null;
9370          else {
9371            if (this.factor == null)
9372              this.factor = new DecimalType();
9373            this.factor.setValue(value);
9374          }
9375          return this;
9376        }
9377
9378        /**
9379         * @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.
9380         */
9381        public AddedItemDetailComponent setFactor(long value) { 
9382              this.factor = new DecimalType();
9383            this.factor.setValue(value);
9384          return this;
9385        }
9386
9387        /**
9388         * @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.
9389         */
9390        public AddedItemDetailComponent setFactor(double value) { 
9391              this.factor = new DecimalType();
9392            this.factor.setValue(value);
9393          return this;
9394        }
9395
9396        /**
9397         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9398         */
9399        public Money getNet() { 
9400          if (this.net == null)
9401            if (Configuration.errorOnAutoCreate())
9402              throw new Error("Attempt to auto-create AddedItemDetailComponent.net");
9403            else if (Configuration.doAutoCreate())
9404              this.net = new Money(); // cc
9405          return this.net;
9406        }
9407
9408        public boolean hasNet() { 
9409          return this.net != null && !this.net.isEmpty();
9410        }
9411
9412        /**
9413         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9414         */
9415        public AddedItemDetailComponent setNet(Money value) { 
9416          this.net = value;
9417          return this;
9418        }
9419
9420        /**
9421         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9422         */
9423        public List<PositiveIntType> getNoteNumber() { 
9424          if (this.noteNumber == null)
9425            this.noteNumber = new ArrayList<PositiveIntType>();
9426          return this.noteNumber;
9427        }
9428
9429        /**
9430         * @return Returns a reference to <code>this</code> for easy method chaining
9431         */
9432        public AddedItemDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
9433          this.noteNumber = theNoteNumber;
9434          return this;
9435        }
9436
9437        public boolean hasNoteNumber() { 
9438          if (this.noteNumber == null)
9439            return false;
9440          for (PositiveIntType item : this.noteNumber)
9441            if (!item.isEmpty())
9442              return true;
9443          return false;
9444        }
9445
9446        /**
9447         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9448         */
9449        public PositiveIntType addNoteNumberElement() {//2 
9450          PositiveIntType t = new PositiveIntType();
9451          if (this.noteNumber == null)
9452            this.noteNumber = new ArrayList<PositiveIntType>();
9453          this.noteNumber.add(t);
9454          return t;
9455        }
9456
9457        /**
9458         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9459         */
9460        public AddedItemDetailComponent addNoteNumber(int value) { //1
9461          PositiveIntType t = new PositiveIntType();
9462          t.setValue(value);
9463          if (this.noteNumber == null)
9464            this.noteNumber = new ArrayList<PositiveIntType>();
9465          this.noteNumber.add(t);
9466          return this;
9467        }
9468
9469        /**
9470         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9471         */
9472        public boolean hasNoteNumber(int value) { 
9473          if (this.noteNumber == null)
9474            return false;
9475          for (PositiveIntType v : this.noteNumber)
9476            if (v.getValue().equals(value)) // positiveInt
9477              return true;
9478          return false;
9479        }
9480
9481        /**
9482         * @return {@link #adjudication} (The adjudication results.)
9483         */
9484        public List<AdjudicationComponent> getAdjudication() { 
9485          if (this.adjudication == null)
9486            this.adjudication = new ArrayList<AdjudicationComponent>();
9487          return this.adjudication;
9488        }
9489
9490        /**
9491         * @return Returns a reference to <code>this</code> for easy method chaining
9492         */
9493        public AddedItemDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
9494          this.adjudication = theAdjudication;
9495          return this;
9496        }
9497
9498        public boolean hasAdjudication() { 
9499          if (this.adjudication == null)
9500            return false;
9501          for (AdjudicationComponent item : this.adjudication)
9502            if (!item.isEmpty())
9503              return true;
9504          return false;
9505        }
9506
9507        public AdjudicationComponent addAdjudication() { //3
9508          AdjudicationComponent t = new AdjudicationComponent();
9509          if (this.adjudication == null)
9510            this.adjudication = new ArrayList<AdjudicationComponent>();
9511          this.adjudication.add(t);
9512          return t;
9513        }
9514
9515        public AddedItemDetailComponent addAdjudication(AdjudicationComponent t) { //3
9516          if (t == null)
9517            return this;
9518          if (this.adjudication == null)
9519            this.adjudication = new ArrayList<AdjudicationComponent>();
9520          this.adjudication.add(t);
9521          return this;
9522        }
9523
9524        /**
9525         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
9526         */
9527        public AdjudicationComponent getAdjudicationFirstRep() { 
9528          if (getAdjudication().isEmpty()) {
9529            addAdjudication();
9530          }
9531          return getAdjudication().get(0);
9532        }
9533
9534        /**
9535         * @return {@link #subDetail} (The third-tier service adjudications for payor added services.)
9536         */
9537        public List<AddedItemDetailSubDetailComponent> getSubDetail() { 
9538          if (this.subDetail == null)
9539            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9540          return this.subDetail;
9541        }
9542
9543        /**
9544         * @return Returns a reference to <code>this</code> for easy method chaining
9545         */
9546        public AddedItemDetailComponent setSubDetail(List<AddedItemDetailSubDetailComponent> theSubDetail) { 
9547          this.subDetail = theSubDetail;
9548          return this;
9549        }
9550
9551        public boolean hasSubDetail() { 
9552          if (this.subDetail == null)
9553            return false;
9554          for (AddedItemDetailSubDetailComponent item : this.subDetail)
9555            if (!item.isEmpty())
9556              return true;
9557          return false;
9558        }
9559
9560        public AddedItemDetailSubDetailComponent addSubDetail() { //3
9561          AddedItemDetailSubDetailComponent t = new AddedItemDetailSubDetailComponent();
9562          if (this.subDetail == null)
9563            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9564          this.subDetail.add(t);
9565          return t;
9566        }
9567
9568        public AddedItemDetailComponent addSubDetail(AddedItemDetailSubDetailComponent t) { //3
9569          if (t == null)
9570            return this;
9571          if (this.subDetail == null)
9572            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9573          this.subDetail.add(t);
9574          return this;
9575        }
9576
9577        /**
9578         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist
9579         */
9580        public AddedItemDetailSubDetailComponent getSubDetailFirstRep() { 
9581          if (getSubDetail().isEmpty()) {
9582            addSubDetail();
9583          }
9584          return getSubDetail().get(0);
9585        }
9586
9587        protected void listChildren(List<Property> children) {
9588          super.listChildren(children);
9589          children.add(new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService));
9590          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier));
9591          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
9592          children.add(new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice));
9593          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));
9594          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
9595          children.add(new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
9596          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
9597          children.add(new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
9598        }
9599
9600        @Override
9601        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9602          switch (_hash) {
9603          case 1957227299: /*productOrService*/  return new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService);
9604          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier);
9605          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
9606          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice);
9607          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);
9608          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
9609          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
9610          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
9611          case -828829007: /*subDetail*/  return new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
9612          default: return super.getNamedProperty(_hash, _name, _checkValid);
9613          }
9614
9615        }
9616
9617      @Override
9618      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9619        switch (hash) {
9620        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
9621        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
9622        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
9623        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
9624        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
9625        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
9626        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
9627        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
9628        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // AddedItemDetailSubDetailComponent
9629        default: return super.getProperty(hash, name, checkValid);
9630        }
9631
9632      }
9633
9634      @Override
9635      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9636        switch (hash) {
9637        case 1957227299: // productOrService
9638          this.productOrService = castToCodeableConcept(value); // CodeableConcept
9639          return value;
9640        case -615513385: // modifier
9641          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
9642          return value;
9643        case -1285004149: // quantity
9644          this.quantity = castToQuantity(value); // Quantity
9645          return value;
9646        case -486196699: // unitPrice
9647          this.unitPrice = castToMoney(value); // Money
9648          return value;
9649        case -1282148017: // factor
9650          this.factor = castToDecimal(value); // DecimalType
9651          return value;
9652        case 108957: // net
9653          this.net = castToMoney(value); // Money
9654          return value;
9655        case -1110033957: // noteNumber
9656          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
9657          return value;
9658        case -231349275: // adjudication
9659          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
9660          return value;
9661        case -828829007: // subDetail
9662          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value); // AddedItemDetailSubDetailComponent
9663          return value;
9664        default: return super.setProperty(hash, name, value);
9665        }
9666
9667      }
9668
9669      @Override
9670      public Base setProperty(String name, Base value) throws FHIRException {
9671        if (name.equals("productOrService")) {
9672          this.productOrService = castToCodeableConcept(value); // CodeableConcept
9673        } else if (name.equals("modifier")) {
9674          this.getModifier().add(castToCodeableConcept(value));
9675        } else if (name.equals("quantity")) {
9676          this.quantity = castToQuantity(value); // Quantity
9677        } else if (name.equals("unitPrice")) {
9678          this.unitPrice = castToMoney(value); // Money
9679        } else if (name.equals("factor")) {
9680          this.factor = castToDecimal(value); // DecimalType
9681        } else if (name.equals("net")) {
9682          this.net = castToMoney(value); // Money
9683        } else if (name.equals("noteNumber")) {
9684          this.getNoteNumber().add(castToPositiveInt(value));
9685        } else if (name.equals("adjudication")) {
9686          this.getAdjudication().add((AdjudicationComponent) value);
9687        } else if (name.equals("subDetail")) {
9688          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value);
9689        } else
9690          return super.setProperty(name, value);
9691        return value;
9692      }
9693
9694      @Override
9695      public Base makeProperty(int hash, String name) throws FHIRException {
9696        switch (hash) {
9697        case 1957227299:  return getProductOrService(); 
9698        case -615513385:  return addModifier(); 
9699        case -1285004149:  return getQuantity(); 
9700        case -486196699:  return getUnitPrice(); 
9701        case -1282148017:  return getFactorElement();
9702        case 108957:  return getNet(); 
9703        case -1110033957:  return addNoteNumberElement();
9704        case -231349275:  return addAdjudication(); 
9705        case -828829007:  return addSubDetail(); 
9706        default: return super.makeProperty(hash, name);
9707        }
9708
9709      }
9710
9711      @Override
9712      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9713        switch (hash) {
9714        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
9715        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
9716        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
9717        case -486196699: /*unitPrice*/ return new String[] {"Money"};
9718        case -1282148017: /*factor*/ return new String[] {"decimal"};
9719        case 108957: /*net*/ return new String[] {"Money"};
9720        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
9721        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
9722        case -828829007: /*subDetail*/ return new String[] {};
9723        default: return super.getTypesForProperty(hash, name);
9724        }
9725
9726      }
9727
9728      @Override
9729      public Base addChild(String name) throws FHIRException {
9730        if (name.equals("productOrService")) {
9731          this.productOrService = new CodeableConcept();
9732          return this.productOrService;
9733        }
9734        else if (name.equals("modifier")) {
9735          return addModifier();
9736        }
9737        else if (name.equals("quantity")) {
9738          this.quantity = new Quantity();
9739          return this.quantity;
9740        }
9741        else if (name.equals("unitPrice")) {
9742          this.unitPrice = new Money();
9743          return this.unitPrice;
9744        }
9745        else if (name.equals("factor")) {
9746          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
9747        }
9748        else if (name.equals("net")) {
9749          this.net = new Money();
9750          return this.net;
9751        }
9752        else if (name.equals("noteNumber")) {
9753          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
9754        }
9755        else if (name.equals("adjudication")) {
9756          return addAdjudication();
9757        }
9758        else if (name.equals("subDetail")) {
9759          return addSubDetail();
9760        }
9761        else
9762          return super.addChild(name);
9763      }
9764
9765      public AddedItemDetailComponent copy() {
9766        AddedItemDetailComponent dst = new AddedItemDetailComponent();
9767        copyValues(dst);
9768        dst.productOrService = productOrService == null ? null : productOrService.copy();
9769        if (modifier != null) {
9770          dst.modifier = new ArrayList<CodeableConcept>();
9771          for (CodeableConcept i : modifier)
9772            dst.modifier.add(i.copy());
9773        };
9774        dst.quantity = quantity == null ? null : quantity.copy();
9775        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
9776        dst.factor = factor == null ? null : factor.copy();
9777        dst.net = net == null ? null : net.copy();
9778        if (noteNumber != null) {
9779          dst.noteNumber = new ArrayList<PositiveIntType>();
9780          for (PositiveIntType i : noteNumber)
9781            dst.noteNumber.add(i.copy());
9782        };
9783        if (adjudication != null) {
9784          dst.adjudication = new ArrayList<AdjudicationComponent>();
9785          for (AdjudicationComponent i : adjudication)
9786            dst.adjudication.add(i.copy());
9787        };
9788        if (subDetail != null) {
9789          dst.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9790          for (AddedItemDetailSubDetailComponent i : subDetail)
9791            dst.subDetail.add(i.copy());
9792        };
9793        return dst;
9794      }
9795
9796      @Override
9797      public boolean equalsDeep(Base other_) {
9798        if (!super.equalsDeep(other_))
9799          return false;
9800        if (!(other_ instanceof AddedItemDetailComponent))
9801          return false;
9802        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
9803        return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
9804           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
9805           && compareDeep(net, o.net, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
9806           && compareDeep(subDetail, o.subDetail, true);
9807      }
9808
9809      @Override
9810      public boolean equalsShallow(Base other_) {
9811        if (!super.equalsShallow(other_))
9812          return false;
9813        if (!(other_ instanceof AddedItemDetailComponent))
9814          return false;
9815        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
9816        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
9817      }
9818
9819      public boolean isEmpty() {
9820        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier
9821          , quantity, unitPrice, factor, net, noteNumber, adjudication, subDetail);
9822      }
9823
9824  public String fhirType() {
9825    return "ExplanationOfBenefit.addItem.detail";
9826
9827  }
9828
9829  }
9830
9831    @Block()
9832    public static class AddedItemDetailSubDetailComponent extends BackboneElement implements IBaseBackboneElement {
9833        /**
9834         * When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.
9835         */
9836        @Child(name = "productOrService", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9837        @Description(shortDefinition="Billing, service, product, or drug code", formalDefinition="When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item." )
9838        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
9839        protected CodeableConcept productOrService;
9840
9841        /**
9842         * Item typification or modifiers codes to convey additional context for the product or service.
9843         */
9844        @Child(name = "modifier", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9845        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
9846        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
9847        protected List<CodeableConcept> modifier;
9848
9849        /**
9850         * The number of repetitions of a service or product.
9851         */
9852        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
9853        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
9854        protected Quantity quantity;
9855
9856        /**
9857         * If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.
9858         */
9859        @Child(name = "unitPrice", type = {Money.class}, order=4, min=0, max=1, modifier=false, summary=false)
9860        @Description(shortDefinition="Fee, charge or cost per item", formalDefinition="If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group." )
9861        protected Money unitPrice;
9862
9863        /**
9864         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
9865         */
9866        @Child(name = "factor", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=false)
9867        @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." )
9868        protected DecimalType factor;
9869
9870        /**
9871         * The quantity times the unit price for an additional service or product or charge.
9872         */
9873        @Child(name = "net", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
9874        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
9875        protected Money net;
9876
9877        /**
9878         * The numbers associated with notes below which apply to the adjudication of this item.
9879         */
9880        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9881        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
9882        protected List<PositiveIntType> noteNumber;
9883
9884        /**
9885         * The adjudication results.
9886         */
9887        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9888        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
9889        protected List<AdjudicationComponent> adjudication;
9890
9891        private static final long serialVersionUID = 1301363592L;
9892
9893    /**
9894     * Constructor
9895     */
9896      public AddedItemDetailSubDetailComponent() {
9897        super();
9898      }
9899
9900    /**
9901     * Constructor
9902     */
9903      public AddedItemDetailSubDetailComponent(CodeableConcept productOrService) {
9904        super();
9905        this.productOrService = productOrService;
9906      }
9907
9908        /**
9909         * @return {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
9910         */
9911        public CodeableConcept getProductOrService() { 
9912          if (this.productOrService == null)
9913            if (Configuration.errorOnAutoCreate())
9914              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.productOrService");
9915            else if (Configuration.doAutoCreate())
9916              this.productOrService = new CodeableConcept(); // cc
9917          return this.productOrService;
9918        }
9919
9920        public boolean hasProductOrService() { 
9921          return this.productOrService != null && !this.productOrService.isEmpty();
9922        }
9923
9924        /**
9925         * @param value {@link #productOrService} (When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.)
9926         */
9927        public AddedItemDetailSubDetailComponent setProductOrService(CodeableConcept value) { 
9928          this.productOrService = value;
9929          return this;
9930        }
9931
9932        /**
9933         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
9934         */
9935        public List<CodeableConcept> getModifier() { 
9936          if (this.modifier == null)
9937            this.modifier = new ArrayList<CodeableConcept>();
9938          return this.modifier;
9939        }
9940
9941        /**
9942         * @return Returns a reference to <code>this</code> for easy method chaining
9943         */
9944        public AddedItemDetailSubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
9945          this.modifier = theModifier;
9946          return this;
9947        }
9948
9949        public boolean hasModifier() { 
9950          if (this.modifier == null)
9951            return false;
9952          for (CodeableConcept item : this.modifier)
9953            if (!item.isEmpty())
9954              return true;
9955          return false;
9956        }
9957
9958        public CodeableConcept addModifier() { //3
9959          CodeableConcept t = new CodeableConcept();
9960          if (this.modifier == null)
9961            this.modifier = new ArrayList<CodeableConcept>();
9962          this.modifier.add(t);
9963          return t;
9964        }
9965
9966        public AddedItemDetailSubDetailComponent addModifier(CodeableConcept t) { //3
9967          if (t == null)
9968            return this;
9969          if (this.modifier == null)
9970            this.modifier = new ArrayList<CodeableConcept>();
9971          this.modifier.add(t);
9972          return this;
9973        }
9974
9975        /**
9976         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
9977         */
9978        public CodeableConcept getModifierFirstRep() { 
9979          if (getModifier().isEmpty()) {
9980            addModifier();
9981          }
9982          return getModifier().get(0);
9983        }
9984
9985        /**
9986         * @return {@link #quantity} (The number of repetitions of a service or product.)
9987         */
9988        public Quantity getQuantity() { 
9989          if (this.quantity == null)
9990            if (Configuration.errorOnAutoCreate())
9991              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.quantity");
9992            else if (Configuration.doAutoCreate())
9993              this.quantity = new Quantity(); // cc
9994          return this.quantity;
9995        }
9996
9997        public boolean hasQuantity() { 
9998          return this.quantity != null && !this.quantity.isEmpty();
9999        }
10000
10001        /**
10002         * @param value {@link #quantity} (The number of repetitions of a service or product.)
10003         */
10004        public AddedItemDetailSubDetailComponent setQuantity(Quantity value) { 
10005          this.quantity = value;
10006          return this;
10007        }
10008
10009        /**
10010         * @return {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
10011         */
10012        public Money getUnitPrice() { 
10013          if (this.unitPrice == null)
10014            if (Configuration.errorOnAutoCreate())
10015              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.unitPrice");
10016            else if (Configuration.doAutoCreate())
10017              this.unitPrice = new Money(); // cc
10018          return this.unitPrice;
10019        }
10020
10021        public boolean hasUnitPrice() { 
10022          return this.unitPrice != null && !this.unitPrice.isEmpty();
10023        }
10024
10025        /**
10026         * @param value {@link #unitPrice} (If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.)
10027         */
10028        public AddedItemDetailSubDetailComponent setUnitPrice(Money value) { 
10029          this.unitPrice = value;
10030          return this;
10031        }
10032
10033        /**
10034         * @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
10035         */
10036        public DecimalType getFactorElement() { 
10037          if (this.factor == null)
10038            if (Configuration.errorOnAutoCreate())
10039              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.factor");
10040            else if (Configuration.doAutoCreate())
10041              this.factor = new DecimalType(); // bb
10042          return this.factor;
10043        }
10044
10045        public boolean hasFactorElement() { 
10046          return this.factor != null && !this.factor.isEmpty();
10047        }
10048
10049        public boolean hasFactor() { 
10050          return this.factor != null && !this.factor.isEmpty();
10051        }
10052
10053        /**
10054         * @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
10055         */
10056        public AddedItemDetailSubDetailComponent setFactorElement(DecimalType value) { 
10057          this.factor = value;
10058          return this;
10059        }
10060
10061        /**
10062         * @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.
10063         */
10064        public BigDecimal getFactor() { 
10065          return this.factor == null ? null : this.factor.getValue();
10066        }
10067
10068        /**
10069         * @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.
10070         */
10071        public AddedItemDetailSubDetailComponent setFactor(BigDecimal value) { 
10072          if (value == null)
10073            this.factor = null;
10074          else {
10075            if (this.factor == null)
10076              this.factor = new DecimalType();
10077            this.factor.setValue(value);
10078          }
10079          return this;
10080        }
10081
10082        /**
10083         * @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.
10084         */
10085        public AddedItemDetailSubDetailComponent setFactor(long value) { 
10086              this.factor = new DecimalType();
10087            this.factor.setValue(value);
10088          return this;
10089        }
10090
10091        /**
10092         * @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.
10093         */
10094        public AddedItemDetailSubDetailComponent setFactor(double value) { 
10095              this.factor = new DecimalType();
10096            this.factor.setValue(value);
10097          return this;
10098        }
10099
10100        /**
10101         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
10102         */
10103        public Money getNet() { 
10104          if (this.net == null)
10105            if (Configuration.errorOnAutoCreate())
10106              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.net");
10107            else if (Configuration.doAutoCreate())
10108              this.net = new Money(); // cc
10109          return this.net;
10110        }
10111
10112        public boolean hasNet() { 
10113          return this.net != null && !this.net.isEmpty();
10114        }
10115
10116        /**
10117         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
10118         */
10119        public AddedItemDetailSubDetailComponent setNet(Money value) { 
10120          this.net = value;
10121          return this;
10122        }
10123
10124        /**
10125         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10126         */
10127        public List<PositiveIntType> getNoteNumber() { 
10128          if (this.noteNumber == null)
10129            this.noteNumber = new ArrayList<PositiveIntType>();
10130          return this.noteNumber;
10131        }
10132
10133        /**
10134         * @return Returns a reference to <code>this</code> for easy method chaining
10135         */
10136        public AddedItemDetailSubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
10137          this.noteNumber = theNoteNumber;
10138          return this;
10139        }
10140
10141        public boolean hasNoteNumber() { 
10142          if (this.noteNumber == null)
10143            return false;
10144          for (PositiveIntType item : this.noteNumber)
10145            if (!item.isEmpty())
10146              return true;
10147          return false;
10148        }
10149
10150        /**
10151         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10152         */
10153        public PositiveIntType addNoteNumberElement() {//2 
10154          PositiveIntType t = new PositiveIntType();
10155          if (this.noteNumber == null)
10156            this.noteNumber = new ArrayList<PositiveIntType>();
10157          this.noteNumber.add(t);
10158          return t;
10159        }
10160
10161        /**
10162         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10163         */
10164        public AddedItemDetailSubDetailComponent addNoteNumber(int value) { //1
10165          PositiveIntType t = new PositiveIntType();
10166          t.setValue(value);
10167          if (this.noteNumber == null)
10168            this.noteNumber = new ArrayList<PositiveIntType>();
10169          this.noteNumber.add(t);
10170          return this;
10171        }
10172
10173        /**
10174         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10175         */
10176        public boolean hasNoteNumber(int value) { 
10177          if (this.noteNumber == null)
10178            return false;
10179          for (PositiveIntType v : this.noteNumber)
10180            if (v.getValue().equals(value)) // positiveInt
10181              return true;
10182          return false;
10183        }
10184
10185        /**
10186         * @return {@link #adjudication} (The adjudication results.)
10187         */
10188        public List<AdjudicationComponent> getAdjudication() { 
10189          if (this.adjudication == null)
10190            this.adjudication = new ArrayList<AdjudicationComponent>();
10191          return this.adjudication;
10192        }
10193
10194        /**
10195         * @return Returns a reference to <code>this</code> for easy method chaining
10196         */
10197        public AddedItemDetailSubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
10198          this.adjudication = theAdjudication;
10199          return this;
10200        }
10201
10202        public boolean hasAdjudication() { 
10203          if (this.adjudication == null)
10204            return false;
10205          for (AdjudicationComponent item : this.adjudication)
10206            if (!item.isEmpty())
10207              return true;
10208          return false;
10209        }
10210
10211        public AdjudicationComponent addAdjudication() { //3
10212          AdjudicationComponent t = new AdjudicationComponent();
10213          if (this.adjudication == null)
10214            this.adjudication = new ArrayList<AdjudicationComponent>();
10215          this.adjudication.add(t);
10216          return t;
10217        }
10218
10219        public AddedItemDetailSubDetailComponent addAdjudication(AdjudicationComponent t) { //3
10220          if (t == null)
10221            return this;
10222          if (this.adjudication == null)
10223            this.adjudication = new ArrayList<AdjudicationComponent>();
10224          this.adjudication.add(t);
10225          return this;
10226        }
10227
10228        /**
10229         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
10230         */
10231        public AdjudicationComponent getAdjudicationFirstRep() { 
10232          if (getAdjudication().isEmpty()) {
10233            addAdjudication();
10234          }
10235          return getAdjudication().get(0);
10236        }
10237
10238        protected void listChildren(List<Property> children) {
10239          super.listChildren(children);
10240          children.add(new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService));
10241          children.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier));
10242          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
10243          children.add(new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice));
10244          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));
10245          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
10246          children.add(new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
10247          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
10248        }
10249
10250        @Override
10251        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10252          switch (_hash) {
10253          case 1957227299: /*productOrService*/  return new Property("productOrService", "CodeableConcept", "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.", 0, 1, productOrService);
10254          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Item typification or modifiers codes to convey additional context for the product or service.", 0, java.lang.Integer.MAX_VALUE, modifier);
10255          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
10256          case -486196699: /*unitPrice*/  return new Property("unitPrice", "Money", "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.", 0, 1, unitPrice);
10257          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);
10258          case 108957: /*net*/  return new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
10259          case -1110033957: /*noteNumber*/  return new Property("noteNumber", "positiveInt", "The numbers associated with notes below which apply to the adjudication of this item.", 0, java.lang.Integer.MAX_VALUE, noteNumber);
10260          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
10261          default: return super.getNamedProperty(_hash, _name, _checkValid);
10262          }
10263
10264        }
10265
10266      @Override
10267      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10268        switch (hash) {
10269        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
10270        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
10271        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
10272        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
10273        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
10274        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
10275        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
10276        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
10277        default: return super.getProperty(hash, name, checkValid);
10278        }
10279
10280      }
10281
10282      @Override
10283      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10284        switch (hash) {
10285        case 1957227299: // productOrService
10286          this.productOrService = castToCodeableConcept(value); // CodeableConcept
10287          return value;
10288        case -615513385: // modifier
10289          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
10290          return value;
10291        case -1285004149: // quantity
10292          this.quantity = castToQuantity(value); // Quantity
10293          return value;
10294        case -486196699: // unitPrice
10295          this.unitPrice = castToMoney(value); // Money
10296          return value;
10297        case -1282148017: // factor
10298          this.factor = castToDecimal(value); // DecimalType
10299          return value;
10300        case 108957: // net
10301          this.net = castToMoney(value); // Money
10302          return value;
10303        case -1110033957: // noteNumber
10304          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
10305          return value;
10306        case -231349275: // adjudication
10307          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
10308          return value;
10309        default: return super.setProperty(hash, name, value);
10310        }
10311
10312      }
10313
10314      @Override
10315      public Base setProperty(String name, Base value) throws FHIRException {
10316        if (name.equals("productOrService")) {
10317          this.productOrService = castToCodeableConcept(value); // CodeableConcept
10318        } else if (name.equals("modifier")) {
10319          this.getModifier().add(castToCodeableConcept(value));
10320        } else if (name.equals("quantity")) {
10321          this.quantity = castToQuantity(value); // Quantity
10322        } else if (name.equals("unitPrice")) {
10323          this.unitPrice = castToMoney(value); // Money
10324        } else if (name.equals("factor")) {
10325          this.factor = castToDecimal(value); // DecimalType
10326        } else if (name.equals("net")) {
10327          this.net = castToMoney(value); // Money
10328        } else if (name.equals("noteNumber")) {
10329          this.getNoteNumber().add(castToPositiveInt(value));
10330        } else if (name.equals("adjudication")) {
10331          this.getAdjudication().add((AdjudicationComponent) value);
10332        } else
10333          return super.setProperty(name, value);
10334        return value;
10335      }
10336
10337      @Override
10338      public Base makeProperty(int hash, String name) throws FHIRException {
10339        switch (hash) {
10340        case 1957227299:  return getProductOrService(); 
10341        case -615513385:  return addModifier(); 
10342        case -1285004149:  return getQuantity(); 
10343        case -486196699:  return getUnitPrice(); 
10344        case -1282148017:  return getFactorElement();
10345        case 108957:  return getNet(); 
10346        case -1110033957:  return addNoteNumberElement();
10347        case -231349275:  return addAdjudication(); 
10348        default: return super.makeProperty(hash, name);
10349        }
10350
10351      }
10352
10353      @Override
10354      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10355        switch (hash) {
10356        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
10357        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
10358        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
10359        case -486196699: /*unitPrice*/ return new String[] {"Money"};
10360        case -1282148017: /*factor*/ return new String[] {"decimal"};
10361        case 108957: /*net*/ return new String[] {"Money"};
10362        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
10363        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
10364        default: return super.getTypesForProperty(hash, name);
10365        }
10366
10367      }
10368
10369      @Override
10370      public Base addChild(String name) throws FHIRException {
10371        if (name.equals("productOrService")) {
10372          this.productOrService = new CodeableConcept();
10373          return this.productOrService;
10374        }
10375        else if (name.equals("modifier")) {
10376          return addModifier();
10377        }
10378        else if (name.equals("quantity")) {
10379          this.quantity = new Quantity();
10380          return this.quantity;
10381        }
10382        else if (name.equals("unitPrice")) {
10383          this.unitPrice = new Money();
10384          return this.unitPrice;
10385        }
10386        else if (name.equals("factor")) {
10387          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
10388        }
10389        else if (name.equals("net")) {
10390          this.net = new Money();
10391          return this.net;
10392        }
10393        else if (name.equals("noteNumber")) {
10394          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
10395        }
10396        else if (name.equals("adjudication")) {
10397          return addAdjudication();
10398        }
10399        else
10400          return super.addChild(name);
10401      }
10402
10403      public AddedItemDetailSubDetailComponent copy() {
10404        AddedItemDetailSubDetailComponent dst = new AddedItemDetailSubDetailComponent();
10405        copyValues(dst);
10406        dst.productOrService = productOrService == null ? null : productOrService.copy();
10407        if (modifier != null) {
10408          dst.modifier = new ArrayList<CodeableConcept>();
10409          for (CodeableConcept i : modifier)
10410            dst.modifier.add(i.copy());
10411        };
10412        dst.quantity = quantity == null ? null : quantity.copy();
10413        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
10414        dst.factor = factor == null ? null : factor.copy();
10415        dst.net = net == null ? null : net.copy();
10416        if (noteNumber != null) {
10417          dst.noteNumber = new ArrayList<PositiveIntType>();
10418          for (PositiveIntType i : noteNumber)
10419            dst.noteNumber.add(i.copy());
10420        };
10421        if (adjudication != null) {
10422          dst.adjudication = new ArrayList<AdjudicationComponent>();
10423          for (AdjudicationComponent i : adjudication)
10424            dst.adjudication.add(i.copy());
10425        };
10426        return dst;
10427      }
10428
10429      @Override
10430      public boolean equalsDeep(Base other_) {
10431        if (!super.equalsDeep(other_))
10432          return false;
10433        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
10434          return false;
10435        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
10436        return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
10437           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
10438           && compareDeep(net, o.net, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
10439          ;
10440      }
10441
10442      @Override
10443      public boolean equalsShallow(Base other_) {
10444        if (!super.equalsShallow(other_))
10445          return false;
10446        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
10447          return false;
10448        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
10449        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
10450      }
10451
10452      public boolean isEmpty() {
10453        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier
10454          , quantity, unitPrice, factor, net, noteNumber, adjudication);
10455      }
10456
10457  public String fhirType() {
10458    return "ExplanationOfBenefit.addItem.detail.subDetail";
10459
10460  }
10461
10462  }
10463
10464    @Block()
10465    public static class TotalComponent extends BackboneElement implements IBaseBackboneElement {
10466        /**
10467         * A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.
10468         */
10469        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
10470        @Description(shortDefinition="Type of adjudication information", formalDefinition="A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item." )
10471        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
10472        protected CodeableConcept category;
10473
10474        /**
10475         * Monetary total amount associated with the category.
10476         */
10477        @Child(name = "amount", type = {Money.class}, order=2, min=1, max=1, modifier=false, summary=true)
10478        @Description(shortDefinition="Financial total for the category", formalDefinition="Monetary total amount associated with the category." )
10479        protected Money amount;
10480
10481        private static final long serialVersionUID = 2012310309L;
10482
10483    /**
10484     * Constructor
10485     */
10486      public TotalComponent() {
10487        super();
10488      }
10489
10490    /**
10491     * Constructor
10492     */
10493      public TotalComponent(CodeableConcept category, Money amount) {
10494        super();
10495        this.category = category;
10496        this.amount = amount;
10497      }
10498
10499        /**
10500         * @return {@link #category} (A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.)
10501         */
10502        public CodeableConcept getCategory() { 
10503          if (this.category == null)
10504            if (Configuration.errorOnAutoCreate())
10505              throw new Error("Attempt to auto-create TotalComponent.category");
10506            else if (Configuration.doAutoCreate())
10507              this.category = new CodeableConcept(); // cc
10508          return this.category;
10509        }
10510
10511        public boolean hasCategory() { 
10512          return this.category != null && !this.category.isEmpty();
10513        }
10514
10515        /**
10516         * @param value {@link #category} (A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.)
10517         */
10518        public TotalComponent setCategory(CodeableConcept value) { 
10519          this.category = value;
10520          return this;
10521        }
10522
10523        /**
10524         * @return {@link #amount} (Monetary total amount associated with the category.)
10525         */
10526        public Money getAmount() { 
10527          if (this.amount == null)
10528            if (Configuration.errorOnAutoCreate())
10529              throw new Error("Attempt to auto-create TotalComponent.amount");
10530            else if (Configuration.doAutoCreate())
10531              this.amount = new Money(); // cc
10532          return this.amount;
10533        }
10534
10535        public boolean hasAmount() { 
10536          return this.amount != null && !this.amount.isEmpty();
10537        }
10538
10539        /**
10540         * @param value {@link #amount} (Monetary total amount associated with the category.)
10541         */
10542        public TotalComponent setAmount(Money value) { 
10543          this.amount = value;
10544          return this;
10545        }
10546
10547        protected void listChildren(List<Property> children) {
10548          super.listChildren(children);
10549          children.add(new Property("category", "CodeableConcept", "A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.", 0, 1, category));
10550          children.add(new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount));
10551        }
10552
10553        @Override
10554        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10555          switch (_hash) {
10556          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.", 0, 1, category);
10557          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount);
10558          default: return super.getNamedProperty(_hash, _name, _checkValid);
10559          }
10560
10561        }
10562
10563      @Override
10564      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10565        switch (hash) {
10566        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
10567        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
10568        default: return super.getProperty(hash, name, checkValid);
10569        }
10570
10571      }
10572
10573      @Override
10574      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10575        switch (hash) {
10576        case 50511102: // category
10577          this.category = castToCodeableConcept(value); // CodeableConcept
10578          return value;
10579        case -1413853096: // amount
10580          this.amount = castToMoney(value); // Money
10581          return value;
10582        default: return super.setProperty(hash, name, value);
10583        }
10584
10585      }
10586
10587      @Override
10588      public Base setProperty(String name, Base value) throws FHIRException {
10589        if (name.equals("category")) {
10590          this.category = castToCodeableConcept(value); // CodeableConcept
10591        } else if (name.equals("amount")) {
10592          this.amount = castToMoney(value); // Money
10593        } else
10594          return super.setProperty(name, value);
10595        return value;
10596      }
10597
10598      @Override
10599      public Base makeProperty(int hash, String name) throws FHIRException {
10600        switch (hash) {
10601        case 50511102:  return getCategory(); 
10602        case -1413853096:  return getAmount(); 
10603        default: return super.makeProperty(hash, name);
10604        }
10605
10606      }
10607
10608      @Override
10609      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10610        switch (hash) {
10611        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
10612        case -1413853096: /*amount*/ return new String[] {"Money"};
10613        default: return super.getTypesForProperty(hash, name);
10614        }
10615
10616      }
10617
10618      @Override
10619      public Base addChild(String name) throws FHIRException {
10620        if (name.equals("category")) {
10621          this.category = new CodeableConcept();
10622          return this.category;
10623        }
10624        else if (name.equals("amount")) {
10625          this.amount = new Money();
10626          return this.amount;
10627        }
10628        else
10629          return super.addChild(name);
10630      }
10631
10632      public TotalComponent copy() {
10633        TotalComponent dst = new TotalComponent();
10634        copyValues(dst);
10635        dst.category = category == null ? null : category.copy();
10636        dst.amount = amount == null ? null : amount.copy();
10637        return dst;
10638      }
10639
10640      @Override
10641      public boolean equalsDeep(Base other_) {
10642        if (!super.equalsDeep(other_))
10643          return false;
10644        if (!(other_ instanceof TotalComponent))
10645          return false;
10646        TotalComponent o = (TotalComponent) other_;
10647        return compareDeep(category, o.category, true) && compareDeep(amount, o.amount, true);
10648      }
10649
10650      @Override
10651      public boolean equalsShallow(Base other_) {
10652        if (!super.equalsShallow(other_))
10653          return false;
10654        if (!(other_ instanceof TotalComponent))
10655          return false;
10656        TotalComponent o = (TotalComponent) other_;
10657        return true;
10658      }
10659
10660      public boolean isEmpty() {
10661        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, amount);
10662      }
10663
10664  public String fhirType() {
10665    return "ExplanationOfBenefit.total";
10666
10667  }
10668
10669  }
10670
10671    @Block()
10672    public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
10673        /**
10674         * Whether this represents partial or complete payment of the benefits payable.
10675         */
10676        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
10677        @Description(shortDefinition="Partial or complete payment", formalDefinition="Whether this represents partial or complete payment of the benefits payable." )
10678        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-paymenttype")
10679        protected CodeableConcept type;
10680
10681        /**
10682         * Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.
10683         */
10684        @Child(name = "adjustment", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
10685        @Description(shortDefinition="Payment adjustment for non-claim issues", formalDefinition="Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication." )
10686        protected Money adjustment;
10687
10688        /**
10689         * Reason for the payment adjustment.
10690         */
10691        @Child(name = "adjustmentReason", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
10692        @Description(shortDefinition="Explanation for the variance", formalDefinition="Reason for the payment adjustment." )
10693        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
10694        protected CodeableConcept adjustmentReason;
10695
10696        /**
10697         * Estimated date the payment will be issued or the actual issue date of payment.
10698         */
10699        @Child(name = "date", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=false)
10700        @Description(shortDefinition="Expected date of payment", formalDefinition="Estimated date the payment will be issued or the actual issue date of payment." )
10701        protected DateType date;
10702
10703        /**
10704         * Benefits payable less any payment adjustment.
10705         */
10706        @Child(name = "amount", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
10707        @Description(shortDefinition="Payable amount after adjustment", formalDefinition="Benefits payable less any payment adjustment." )
10708        protected Money amount;
10709
10710        /**
10711         * Issuer's unique identifier for the payment instrument.
10712         */
10713        @Child(name = "identifier", type = {Identifier.class}, order=6, min=0, max=1, modifier=false, summary=false)
10714        @Description(shortDefinition="Business identifier for the payment", formalDefinition="Issuer's unique identifier for the payment instrument." )
10715        protected Identifier identifier;
10716
10717        private static final long serialVersionUID = 1539906026L;
10718
10719    /**
10720     * Constructor
10721     */
10722      public PaymentComponent() {
10723        super();
10724      }
10725
10726        /**
10727         * @return {@link #type} (Whether this represents partial or complete payment of the benefits payable.)
10728         */
10729        public CodeableConcept getType() { 
10730          if (this.type == null)
10731            if (Configuration.errorOnAutoCreate())
10732              throw new Error("Attempt to auto-create PaymentComponent.type");
10733            else if (Configuration.doAutoCreate())
10734              this.type = new CodeableConcept(); // cc
10735          return this.type;
10736        }
10737
10738        public boolean hasType() { 
10739          return this.type != null && !this.type.isEmpty();
10740        }
10741
10742        /**
10743         * @param value {@link #type} (Whether this represents partial or complete payment of the benefits payable.)
10744         */
10745        public PaymentComponent setType(CodeableConcept value) { 
10746          this.type = value;
10747          return this;
10748        }
10749
10750        /**
10751         * @return {@link #adjustment} (Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.)
10752         */
10753        public Money getAdjustment() { 
10754          if (this.adjustment == null)
10755            if (Configuration.errorOnAutoCreate())
10756              throw new Error("Attempt to auto-create PaymentComponent.adjustment");
10757            else if (Configuration.doAutoCreate())
10758              this.adjustment = new Money(); // cc
10759          return this.adjustment;
10760        }
10761
10762        public boolean hasAdjustment() { 
10763          return this.adjustment != null && !this.adjustment.isEmpty();
10764        }
10765
10766        /**
10767         * @param value {@link #adjustment} (Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.)
10768         */
10769        public PaymentComponent setAdjustment(Money value) { 
10770          this.adjustment = value;
10771          return this;
10772        }
10773
10774        /**
10775         * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
10776         */
10777        public CodeableConcept getAdjustmentReason() { 
10778          if (this.adjustmentReason == null)
10779            if (Configuration.errorOnAutoCreate())
10780              throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
10781            else if (Configuration.doAutoCreate())
10782              this.adjustmentReason = new CodeableConcept(); // cc
10783          return this.adjustmentReason;
10784        }
10785
10786        public boolean hasAdjustmentReason() { 
10787          return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
10788        }
10789
10790        /**
10791         * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
10792         */
10793        public PaymentComponent setAdjustmentReason(CodeableConcept value) { 
10794          this.adjustmentReason = value;
10795          return this;
10796        }
10797
10798        /**
10799         * @return {@link #date} (Estimated date the payment will be issued or the actual issue date of payment.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
10800         */
10801        public DateType getDateElement() { 
10802          if (this.date == null)
10803            if (Configuration.errorOnAutoCreate())
10804              throw new Error("Attempt to auto-create PaymentComponent.date");
10805            else if (Configuration.doAutoCreate())
10806              this.date = new DateType(); // bb
10807          return this.date;
10808        }
10809
10810        public boolean hasDateElement() { 
10811          return this.date != null && !this.date.isEmpty();
10812        }
10813
10814        public boolean hasDate() { 
10815          return this.date != null && !this.date.isEmpty();
10816        }
10817
10818        /**
10819         * @param value {@link #date} (Estimated date the payment will be issued or the actual issue date of payment.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
10820         */
10821        public PaymentComponent setDateElement(DateType value) { 
10822          this.date = value;
10823          return this;
10824        }
10825
10826        /**
10827         * @return Estimated date the payment will be issued or the actual issue date of payment.
10828         */
10829        public Date getDate() { 
10830          return this.date == null ? null : this.date.getValue();
10831        }
10832
10833        /**
10834         * @param value Estimated date the payment will be issued or the actual issue date of payment.
10835         */
10836        public PaymentComponent setDate(Date value) { 
10837          if (value == null)
10838            this.date = null;
10839          else {
10840            if (this.date == null)
10841              this.date = new DateType();
10842            this.date.setValue(value);
10843          }
10844          return this;
10845        }
10846
10847        /**
10848         * @return {@link #amount} (Benefits payable less any payment adjustment.)
10849         */
10850        public Money getAmount() { 
10851          if (this.amount == null)
10852            if (Configuration.errorOnAutoCreate())
10853              throw new Error("Attempt to auto-create PaymentComponent.amount");
10854            else if (Configuration.doAutoCreate())
10855              this.amount = new Money(); // cc
10856          return this.amount;
10857        }
10858
10859        public boolean hasAmount() { 
10860          return this.amount != null && !this.amount.isEmpty();
10861        }
10862
10863        /**
10864         * @param value {@link #amount} (Benefits payable less any payment adjustment.)
10865         */
10866        public PaymentComponent setAmount(Money value) { 
10867          this.amount = value;
10868          return this;
10869        }
10870
10871        /**
10872         * @return {@link #identifier} (Issuer's unique identifier for the payment instrument.)
10873         */
10874        public Identifier getIdentifier() { 
10875          if (this.identifier == null)
10876            if (Configuration.errorOnAutoCreate())
10877              throw new Error("Attempt to auto-create PaymentComponent.identifier");
10878            else if (Configuration.doAutoCreate())
10879              this.identifier = new Identifier(); // cc
10880          return this.identifier;
10881        }
10882
10883        public boolean hasIdentifier() { 
10884          return this.identifier != null && !this.identifier.isEmpty();
10885        }
10886
10887        /**
10888         * @param value {@link #identifier} (Issuer's unique identifier for the payment instrument.)
10889         */
10890        public PaymentComponent setIdentifier(Identifier value) { 
10891          this.identifier = value;
10892          return this;
10893        }
10894
10895        protected void listChildren(List<Property> children) {
10896          super.listChildren(children);
10897          children.add(new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type));
10898          children.add(new Property("adjustment", "Money", "Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.", 0, 1, adjustment));
10899          children.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason));
10900          children.add(new Property("date", "date", "Estimated date the payment will be issued or the actual issue date of payment.", 0, 1, date));
10901          children.add(new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount));
10902          children.add(new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0, 1, identifier));
10903        }
10904
10905        @Override
10906        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10907          switch (_hash) {
10908          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type);
10909          case 1977085293: /*adjustment*/  return new Property("adjustment", "Money", "Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.", 0, 1, adjustment);
10910          case -1255938543: /*adjustmentReason*/  return new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason);
10911          case 3076014: /*date*/  return new Property("date", "date", "Estimated date the payment will be issued or the actual issue date of payment.", 0, 1, date);
10912          case -1413853096: /*amount*/  return new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount);
10913          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0, 1, identifier);
10914          default: return super.getNamedProperty(_hash, _name, _checkValid);
10915          }
10916
10917        }
10918
10919      @Override
10920      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10921        switch (hash) {
10922        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
10923        case 1977085293: /*adjustment*/ return this.adjustment == null ? new Base[0] : new Base[] {this.adjustment}; // Money
10924        case -1255938543: /*adjustmentReason*/ return this.adjustmentReason == null ? new Base[0] : new Base[] {this.adjustmentReason}; // CodeableConcept
10925        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
10926        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
10927        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
10928        default: return super.getProperty(hash, name, checkValid);
10929        }
10930
10931      }
10932
10933      @Override
10934      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10935        switch (hash) {
10936        case 3575610: // type
10937          this.type = castToCodeableConcept(value); // CodeableConcept
10938          return value;
10939        case 1977085293: // adjustment
10940          this.adjustment = castToMoney(value); // Money
10941          return value;
10942        case -1255938543: // adjustmentReason
10943          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
10944          return value;
10945        case 3076014: // date
10946          this.date = castToDate(value); // DateType
10947          return value;
10948        case -1413853096: // amount
10949          this.amount = castToMoney(value); // Money
10950          return value;
10951        case -1618432855: // identifier
10952          this.identifier = castToIdentifier(value); // Identifier
10953          return value;
10954        default: return super.setProperty(hash, name, value);
10955        }
10956
10957      }
10958
10959      @Override
10960      public Base setProperty(String name, Base value) throws FHIRException {
10961        if (name.equals("type")) {
10962          this.type = castToCodeableConcept(value); // CodeableConcept
10963        } else if (name.equals("adjustment")) {
10964          this.adjustment = castToMoney(value); // Money
10965        } else if (name.equals("adjustmentReason")) {
10966          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
10967        } else if (name.equals("date")) {
10968          this.date = castToDate(value); // DateType
10969        } else if (name.equals("amount")) {
10970          this.amount = castToMoney(value); // Money
10971        } else if (name.equals("identifier")) {
10972          this.identifier = castToIdentifier(value); // Identifier
10973        } else
10974          return super.setProperty(name, value);
10975        return value;
10976      }
10977
10978      @Override
10979      public Base makeProperty(int hash, String name) throws FHIRException {
10980        switch (hash) {
10981        case 3575610:  return getType(); 
10982        case 1977085293:  return getAdjustment(); 
10983        case -1255938543:  return getAdjustmentReason(); 
10984        case 3076014:  return getDateElement();
10985        case -1413853096:  return getAmount(); 
10986        case -1618432855:  return getIdentifier(); 
10987        default: return super.makeProperty(hash, name);
10988        }
10989
10990      }
10991
10992      @Override
10993      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10994        switch (hash) {
10995        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
10996        case 1977085293: /*adjustment*/ return new String[] {"Money"};
10997        case -1255938543: /*adjustmentReason*/ return new String[] {"CodeableConcept"};
10998        case 3076014: /*date*/ return new String[] {"date"};
10999        case -1413853096: /*amount*/ return new String[] {"Money"};
11000        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
11001        default: return super.getTypesForProperty(hash, name);
11002        }
11003
11004      }
11005
11006      @Override
11007      public Base addChild(String name) throws FHIRException {
11008        if (name.equals("type")) {
11009          this.type = new CodeableConcept();
11010          return this.type;
11011        }
11012        else if (name.equals("adjustment")) {
11013          this.adjustment = new Money();
11014          return this.adjustment;
11015        }
11016        else if (name.equals("adjustmentReason")) {
11017          this.adjustmentReason = new CodeableConcept();
11018          return this.adjustmentReason;
11019        }
11020        else if (name.equals("date")) {
11021          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
11022        }
11023        else if (name.equals("amount")) {
11024          this.amount = new Money();
11025          return this.amount;
11026        }
11027        else if (name.equals("identifier")) {
11028          this.identifier = new Identifier();
11029          return this.identifier;
11030        }
11031        else
11032          return super.addChild(name);
11033      }
11034
11035      public PaymentComponent copy() {
11036        PaymentComponent dst = new PaymentComponent();
11037        copyValues(dst);
11038        dst.type = type == null ? null : type.copy();
11039        dst.adjustment = adjustment == null ? null : adjustment.copy();
11040        dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
11041        dst.date = date == null ? null : date.copy();
11042        dst.amount = amount == null ? null : amount.copy();
11043        dst.identifier = identifier == null ? null : identifier.copy();
11044        return dst;
11045      }
11046
11047      @Override
11048      public boolean equalsDeep(Base other_) {
11049        if (!super.equalsDeep(other_))
11050          return false;
11051        if (!(other_ instanceof PaymentComponent))
11052          return false;
11053        PaymentComponent o = (PaymentComponent) other_;
11054        return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true) && compareDeep(adjustmentReason, o.adjustmentReason, true)
11055           && compareDeep(date, o.date, true) && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true)
11056          ;
11057      }
11058
11059      @Override
11060      public boolean equalsShallow(Base other_) {
11061        if (!super.equalsShallow(other_))
11062          return false;
11063        if (!(other_ instanceof PaymentComponent))
11064          return false;
11065        PaymentComponent o = (PaymentComponent) other_;
11066        return compareValues(date, o.date, true);
11067      }
11068
11069      public boolean isEmpty() {
11070        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason
11071          , date, amount, identifier);
11072      }
11073
11074  public String fhirType() {
11075    return "ExplanationOfBenefit.payment";
11076
11077  }
11078
11079  }
11080
11081    @Block()
11082    public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
11083        /**
11084         * A number to uniquely identify a note entry.
11085         */
11086        @Child(name = "number", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
11087        @Description(shortDefinition="Note instance identifier", formalDefinition="A number to uniquely identify a note entry." )
11088        protected PositiveIntType number;
11089
11090        /**
11091         * The business purpose of the note text.
11092         */
11093        @Child(name = "type", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
11094        @Description(shortDefinition="display | print | printoper", formalDefinition="The business purpose of the note text." )
11095        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/note-type")
11096        protected Enumeration<NoteType> type;
11097
11098        /**
11099         * The explanation or description associated with the processing.
11100         */
11101        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
11102        @Description(shortDefinition="Note explanatory text", formalDefinition="The explanation or description associated with the processing." )
11103        protected StringType text;
11104
11105        /**
11106         * A code to define the language used in the text of the note.
11107         */
11108        @Child(name = "language", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
11109        @Description(shortDefinition="Language of the text", formalDefinition="A code to define the language used in the text of the note." )
11110        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
11111        protected CodeableConcept language;
11112
11113        private static final long serialVersionUID = -385184277L;
11114
11115    /**
11116     * Constructor
11117     */
11118      public NoteComponent() {
11119        super();
11120      }
11121
11122        /**
11123         * @return {@link #number} (A number to uniquely identify a note entry.). This is the underlying object with id, value and extensions. The accessor "getNumber" gives direct access to the value
11124         */
11125        public PositiveIntType getNumberElement() { 
11126          if (this.number == null)
11127            if (Configuration.errorOnAutoCreate())
11128              throw new Error("Attempt to auto-create NoteComponent.number");
11129            else if (Configuration.doAutoCreate())
11130              this.number = new PositiveIntType(); // bb
11131          return this.number;
11132        }
11133
11134        public boolean hasNumberElement() { 
11135          return this.number != null && !this.number.isEmpty();
11136        }
11137
11138        public boolean hasNumber() { 
11139          return this.number != null && !this.number.isEmpty();
11140        }
11141
11142        /**
11143         * @param value {@link #number} (A number to uniquely identify a note entry.). This is the underlying object with id, value and extensions. The accessor "getNumber" gives direct access to the value
11144         */
11145        public NoteComponent setNumberElement(PositiveIntType value) { 
11146          this.number = value;
11147          return this;
11148        }
11149
11150        /**
11151         * @return A number to uniquely identify a note entry.
11152         */
11153        public int getNumber() { 
11154          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
11155        }
11156
11157        /**
11158         * @param value A number to uniquely identify a note entry.
11159         */
11160        public NoteComponent setNumber(int value) { 
11161            if (this.number == null)
11162              this.number = new PositiveIntType();
11163            this.number.setValue(value);
11164          return this;
11165        }
11166
11167        /**
11168         * @return {@link #type} (The business purpose of the note text.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
11169         */
11170        public Enumeration<NoteType> getTypeElement() { 
11171          if (this.type == null)
11172            if (Configuration.errorOnAutoCreate())
11173              throw new Error("Attempt to auto-create NoteComponent.type");
11174            else if (Configuration.doAutoCreate())
11175              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory()); // bb
11176          return this.type;
11177        }
11178
11179        public boolean hasTypeElement() { 
11180          return this.type != null && !this.type.isEmpty();
11181        }
11182
11183        public boolean hasType() { 
11184          return this.type != null && !this.type.isEmpty();
11185        }
11186
11187        /**
11188         * @param value {@link #type} (The business purpose of the note text.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
11189         */
11190        public NoteComponent setTypeElement(Enumeration<NoteType> value) { 
11191          this.type = value;
11192          return this;
11193        }
11194
11195        /**
11196         * @return The business purpose of the note text.
11197         */
11198        public NoteType getType() { 
11199          return this.type == null ? null : this.type.getValue();
11200        }
11201
11202        /**
11203         * @param value The business purpose of the note text.
11204         */
11205        public NoteComponent setType(NoteType value) { 
11206          if (value == null)
11207            this.type = null;
11208          else {
11209            if (this.type == null)
11210              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory());
11211            this.type.setValue(value);
11212          }
11213          return this;
11214        }
11215
11216        /**
11217         * @return {@link #text} (The explanation or description associated with the processing.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
11218         */
11219        public StringType getTextElement() { 
11220          if (this.text == null)
11221            if (Configuration.errorOnAutoCreate())
11222              throw new Error("Attempt to auto-create NoteComponent.text");
11223            else if (Configuration.doAutoCreate())
11224              this.text = new StringType(); // bb
11225          return this.text;
11226        }
11227
11228        public boolean hasTextElement() { 
11229          return this.text != null && !this.text.isEmpty();
11230        }
11231
11232        public boolean hasText() { 
11233          return this.text != null && !this.text.isEmpty();
11234        }
11235
11236        /**
11237         * @param value {@link #text} (The explanation or description associated with the processing.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
11238         */
11239        public NoteComponent setTextElement(StringType value) { 
11240          this.text = value;
11241          return this;
11242        }
11243
11244        /**
11245         * @return The explanation or description associated with the processing.
11246         */
11247        public String getText() { 
11248          return this.text == null ? null : this.text.getValue();
11249        }
11250
11251        /**
11252         * @param value The explanation or description associated with the processing.
11253         */
11254        public NoteComponent setText(String value) { 
11255          if (Utilities.noString(value))
11256            this.text = null;
11257          else {
11258            if (this.text == null)
11259              this.text = new StringType();
11260            this.text.setValue(value);
11261          }
11262          return this;
11263        }
11264
11265        /**
11266         * @return {@link #language} (A code to define the language used in the text of the note.)
11267         */
11268        public CodeableConcept getLanguage() { 
11269          if (this.language == null)
11270            if (Configuration.errorOnAutoCreate())
11271              throw new Error("Attempt to auto-create NoteComponent.language");
11272            else if (Configuration.doAutoCreate())
11273              this.language = new CodeableConcept(); // cc
11274          return this.language;
11275        }
11276
11277        public boolean hasLanguage() { 
11278          return this.language != null && !this.language.isEmpty();
11279        }
11280
11281        /**
11282         * @param value {@link #language} (A code to define the language used in the text of the note.)
11283         */
11284        public NoteComponent setLanguage(CodeableConcept value) { 
11285          this.language = value;
11286          return this;
11287        }
11288
11289        protected void listChildren(List<Property> children) {
11290          super.listChildren(children);
11291          children.add(new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number));
11292          children.add(new Property("type", "code", "The business purpose of the note text.", 0, 1, type));
11293          children.add(new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text));
11294          children.add(new Property("language", "CodeableConcept", "A code to define the language used in the text of the note.", 0, 1, language));
11295        }
11296
11297        @Override
11298        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11299          switch (_hash) {
11300          case -1034364087: /*number*/  return new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number);
11301          case 3575610: /*type*/  return new Property("type", "code", "The business purpose of the note text.", 0, 1, type);
11302          case 3556653: /*text*/  return new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text);
11303          case -1613589672: /*language*/  return new Property("language", "CodeableConcept", "A code to define the language used in the text of the note.", 0, 1, language);
11304          default: return super.getNamedProperty(_hash, _name, _checkValid);
11305          }
11306
11307        }
11308
11309      @Override
11310      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11311        switch (hash) {
11312        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // PositiveIntType
11313        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<NoteType>
11314        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
11315        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeableConcept
11316        default: return super.getProperty(hash, name, checkValid);
11317        }
11318
11319      }
11320
11321      @Override
11322      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11323        switch (hash) {
11324        case -1034364087: // number
11325          this.number = castToPositiveInt(value); // PositiveIntType
11326          return value;
11327        case 3575610: // type
11328          value = new NoteTypeEnumFactory().fromType(castToCode(value));
11329          this.type = (Enumeration) value; // Enumeration<NoteType>
11330          return value;
11331        case 3556653: // text
11332          this.text = castToString(value); // StringType
11333          return value;
11334        case -1613589672: // language
11335          this.language = castToCodeableConcept(value); // CodeableConcept
11336          return value;
11337        default: return super.setProperty(hash, name, value);
11338        }
11339
11340      }
11341
11342      @Override
11343      public Base setProperty(String name, Base value) throws FHIRException {
11344        if (name.equals("number")) {
11345          this.number = castToPositiveInt(value); // PositiveIntType
11346        } else if (name.equals("type")) {
11347          value = new NoteTypeEnumFactory().fromType(castToCode(value));
11348          this.type = (Enumeration) value; // Enumeration<NoteType>
11349        } else if (name.equals("text")) {
11350          this.text = castToString(value); // StringType
11351        } else if (name.equals("language")) {
11352          this.language = castToCodeableConcept(value); // CodeableConcept
11353        } else
11354          return super.setProperty(name, value);
11355        return value;
11356      }
11357
11358      @Override
11359      public Base makeProperty(int hash, String name) throws FHIRException {
11360        switch (hash) {
11361        case -1034364087:  return getNumberElement();
11362        case 3575610:  return getTypeElement();
11363        case 3556653:  return getTextElement();
11364        case -1613589672:  return getLanguage(); 
11365        default: return super.makeProperty(hash, name);
11366        }
11367
11368      }
11369
11370      @Override
11371      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11372        switch (hash) {
11373        case -1034364087: /*number*/ return new String[] {"positiveInt"};
11374        case 3575610: /*type*/ return new String[] {"code"};
11375        case 3556653: /*text*/ return new String[] {"string"};
11376        case -1613589672: /*language*/ return new String[] {"CodeableConcept"};
11377        default: return super.getTypesForProperty(hash, name);
11378        }
11379
11380      }
11381
11382      @Override
11383      public Base addChild(String name) throws FHIRException {
11384        if (name.equals("number")) {
11385          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.number");
11386        }
11387        else if (name.equals("type")) {
11388          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.type");
11389        }
11390        else if (name.equals("text")) {
11391          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.text");
11392        }
11393        else if (name.equals("language")) {
11394          this.language = new CodeableConcept();
11395          return this.language;
11396        }
11397        else
11398          return super.addChild(name);
11399      }
11400
11401      public NoteComponent copy() {
11402        NoteComponent dst = new NoteComponent();
11403        copyValues(dst);
11404        dst.number = number == null ? null : number.copy();
11405        dst.type = type == null ? null : type.copy();
11406        dst.text = text == null ? null : text.copy();
11407        dst.language = language == null ? null : language.copy();
11408        return dst;
11409      }
11410
11411      @Override
11412      public boolean equalsDeep(Base other_) {
11413        if (!super.equalsDeep(other_))
11414          return false;
11415        if (!(other_ instanceof NoteComponent))
11416          return false;
11417        NoteComponent o = (NoteComponent) other_;
11418        return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
11419           && compareDeep(language, o.language, true);
11420      }
11421
11422      @Override
11423      public boolean equalsShallow(Base other_) {
11424        if (!super.equalsShallow(other_))
11425          return false;
11426        if (!(other_ instanceof NoteComponent))
11427          return false;
11428        NoteComponent o = (NoteComponent) other_;
11429        return compareValues(number, o.number, true) && compareValues(type, o.type, true) && compareValues(text, o.text, true)
11430          ;
11431      }
11432
11433      public boolean isEmpty() {
11434        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language
11435          );
11436      }
11437
11438  public String fhirType() {
11439    return "ExplanationOfBenefit.processNote";
11440
11441  }
11442
11443  }
11444
11445    @Block()
11446    public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
11447        /**
11448         * Code to identify the general type of benefits under which products and services are provided.
11449         */
11450        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
11451        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
11452        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
11453        protected CodeableConcept category;
11454
11455        /**
11456         * True if the indicated class of service is excluded from the plan, missing or False indicates the product or service is included in the coverage.
11457         */
11458        @Child(name = "excluded", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
11459        @Description(shortDefinition="Excluded from the plan", formalDefinition="True if the indicated class of service is excluded from the plan, missing or False indicates the product or service is included in the coverage." )
11460        protected BooleanType excluded;
11461
11462        /**
11463         * A short name or tag for the benefit.
11464         */
11465        @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
11466        @Description(shortDefinition="Short name for the benefit", formalDefinition="A short name or tag for the benefit." )
11467        protected StringType name;
11468
11469        /**
11470         * A richer description of the benefit or services covered.
11471         */
11472        @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
11473        @Description(shortDefinition="Description of the benefit or services covered", formalDefinition="A richer description of the benefit or services covered." )
11474        protected StringType description;
11475
11476        /**
11477         * Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.
11478         */
11479        @Child(name = "network", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
11480        @Description(shortDefinition="In or out of network", formalDefinition="Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers." )
11481        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-network")
11482        protected CodeableConcept network;
11483
11484        /**
11485         * Indicates if the benefits apply to an individual or to the family.
11486         */
11487        @Child(name = "unit", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
11488        @Description(shortDefinition="Individual or family", formalDefinition="Indicates if the benefits apply to an individual or to the family." )
11489        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-unit")
11490        protected CodeableConcept unit;
11491
11492        /**
11493         * The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.
11494         */
11495        @Child(name = "term", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
11496        @Description(shortDefinition="Annual or lifetime", formalDefinition="The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'." )
11497        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-term")
11498        protected CodeableConcept term;
11499
11500        /**
11501         * Benefits Used to date.
11502         */
11503        @Child(name = "financial", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
11504        @Description(shortDefinition="Benefit Summary", formalDefinition="Benefits Used to date." )
11505        protected List<BenefitComponent> financial;
11506
11507        private static final long serialVersionUID = -1889655824L;
11508
11509    /**
11510     * Constructor
11511     */
11512      public BenefitBalanceComponent() {
11513        super();
11514      }
11515
11516    /**
11517     * Constructor
11518     */
11519      public BenefitBalanceComponent(CodeableConcept category) {
11520        super();
11521        this.category = category;
11522      }
11523
11524        /**
11525         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
11526         */
11527        public CodeableConcept getCategory() { 
11528          if (this.category == null)
11529            if (Configuration.errorOnAutoCreate())
11530              throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
11531            else if (Configuration.doAutoCreate())
11532              this.category = new CodeableConcept(); // cc
11533          return this.category;
11534        }
11535
11536        public boolean hasCategory() { 
11537          return this.category != null && !this.category.isEmpty();
11538        }
11539
11540        /**
11541         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
11542         */
11543        public BenefitBalanceComponent setCategory(CodeableConcept value) { 
11544          this.category = value;
11545          return this;
11546        }
11547
11548        /**
11549         * @return {@link #excluded} (True if the indicated class of service is excluded from the plan, missing or False indicates the product or service is included in the coverage.). This is the underlying object with id, value and extensions. The accessor "getExcluded" gives direct access to the value
11550         */
11551        public BooleanType getExcludedElement() { 
11552          if (this.excluded == null)
11553            if (Configuration.errorOnAutoCreate())
11554              throw new Error("Attempt to auto-create BenefitBalanceComponent.excluded");
11555            else if (Configuration.doAutoCreate())
11556              this.excluded = new BooleanType(); // bb
11557          return this.excluded;
11558        }
11559
11560        public boolean hasExcludedElement() { 
11561          return this.excluded != null && !this.excluded.isEmpty();
11562        }
11563
11564        public boolean hasExcluded() { 
11565          return this.excluded != null && !this.excluded.isEmpty();
11566        }
11567
11568        /**
11569         * @param value {@link #excluded} (True if the indicated class of service is excluded from the plan, missing or False indicates the product or service is included in the coverage.). This is the underlying object with id, value and extensions. The accessor "getExcluded" gives direct access to the value
11570         */
11571        public BenefitBalanceComponent setExcludedElement(BooleanType value) { 
11572          this.excluded = value;
11573          return this;
11574        }
11575
11576        /**
11577         * @return True if the indicated class of service is excluded from the plan, missing or False indicates the product or service is included in the coverage.
11578         */
11579        public boolean getExcluded() { 
11580          return this.excluded == null || this.excluded.isEmpty() ? false : this.excluded.getValue();
11581        }
11582
11583        /**
11584         * @param value True if the indicated class of service is excluded from the plan, missing or False indicates the product or service is included in the coverage.
11585         */
11586        public BenefitBalanceComponent setExcluded(boolean value) { 
11587            if (this.excluded == null)
11588              this.excluded = new BooleanType();
11589            this.excluded.setValue(value);
11590          return this;
11591        }
11592
11593        /**
11594         * @return {@link #name} (A short name or tag for the benefit.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
11595         */
11596        public StringType getNameElement() { 
11597          if (this.name == null)
11598            if (Configuration.errorOnAutoCreate())
11599              throw new Error("Attempt to auto-create BenefitBalanceComponent.name");
11600            else if (Configuration.doAutoCreate())
11601              this.name = new StringType(); // bb
11602          return this.name;
11603        }
11604
11605        public boolean hasNameElement() { 
11606          return this.name != null && !this.name.isEmpty();
11607        }
11608
11609        public boolean hasName() { 
11610          return this.name != null && !this.name.isEmpty();
11611        }
11612
11613        /**
11614         * @param value {@link #name} (A short name or tag for the benefit.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
11615         */
11616        public BenefitBalanceComponent setNameElement(StringType value) { 
11617          this.name = value;
11618          return this;
11619        }
11620
11621        /**
11622         * @return A short name or tag for the benefit.
11623         */
11624        public String getName() { 
11625          return this.name == null ? null : this.name.getValue();
11626        }
11627
11628        /**
11629         * @param value A short name or tag for the benefit.
11630         */
11631        public BenefitBalanceComponent setName(String value) { 
11632          if (Utilities.noString(value))
11633            this.name = null;
11634          else {
11635            if (this.name == null)
11636              this.name = new StringType();
11637            this.name.setValue(value);
11638          }
11639          return this;
11640        }
11641
11642        /**
11643         * @return {@link #description} (A richer description of the benefit or services covered.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
11644         */
11645        public StringType getDescriptionElement() { 
11646          if (this.description == null)
11647            if (Configuration.errorOnAutoCreate())
11648              throw new Error("Attempt to auto-create BenefitBalanceComponent.description");
11649            else if (Configuration.doAutoCreate())
11650              this.description = new StringType(); // bb
11651          return this.description;
11652        }
11653
11654        public boolean hasDescriptionElement() { 
11655          return this.description != null && !this.description.isEmpty();
11656        }
11657
11658        public boolean hasDescription() { 
11659          return this.description != null && !this.description.isEmpty();
11660        }
11661
11662        /**
11663         * @param value {@link #description} (A richer description of the benefit or services covered.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
11664         */
11665        public BenefitBalanceComponent setDescriptionElement(StringType value) { 
11666          this.description = value;
11667          return this;
11668        }
11669
11670        /**
11671         * @return A richer description of the benefit or services covered.
11672         */
11673        public String getDescription() { 
11674          return this.description == null ? null : this.description.getValue();
11675        }
11676
11677        /**
11678         * @param value A richer description of the benefit or services covered.
11679         */
11680        public BenefitBalanceComponent setDescription(String value) { 
11681          if (Utilities.noString(value))
11682            this.description = null;
11683          else {
11684            if (this.description == null)
11685              this.description = new StringType();
11686            this.description.setValue(value);
11687          }
11688          return this;
11689        }
11690
11691        /**
11692         * @return {@link #network} (Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.)
11693         */
11694        public CodeableConcept getNetwork() { 
11695          if (this.network == null)
11696            if (Configuration.errorOnAutoCreate())
11697              throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
11698            else if (Configuration.doAutoCreate())
11699              this.network = new CodeableConcept(); // cc
11700          return this.network;
11701        }
11702
11703        public boolean hasNetwork() { 
11704          return this.network != null && !this.network.isEmpty();
11705        }
11706
11707        /**
11708         * @param value {@link #network} (Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.)
11709         */
11710        public BenefitBalanceComponent setNetwork(CodeableConcept value) { 
11711          this.network = value;
11712          return this;
11713        }
11714
11715        /**
11716         * @return {@link #unit} (Indicates if the benefits apply to an individual or to the family.)
11717         */
11718        public CodeableConcept getUnit() { 
11719          if (this.unit == null)
11720            if (Configuration.errorOnAutoCreate())
11721              throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
11722            else if (Configuration.doAutoCreate())
11723              this.unit = new CodeableConcept(); // cc
11724          return this.unit;
11725        }
11726
11727        public boolean hasUnit() { 
11728          return this.unit != null && !this.unit.isEmpty();
11729        }
11730
11731        /**
11732         * @param value {@link #unit} (Indicates if the benefits apply to an individual or to the family.)
11733         */
11734        public BenefitBalanceComponent setUnit(CodeableConcept value) { 
11735          this.unit = value;
11736          return this;
11737        }
11738
11739        /**
11740         * @return {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.)
11741         */
11742        public CodeableConcept getTerm() { 
11743          if (this.term == null)
11744            if (Configuration.errorOnAutoCreate())
11745              throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
11746            else if (Configuration.doAutoCreate())
11747              this.term = new CodeableConcept(); // cc
11748          return this.term;
11749        }
11750
11751        public boolean hasTerm() { 
11752          return this.term != null && !this.term.isEmpty();
11753        }
11754
11755        /**
11756         * @param value {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.)
11757         */
11758        public BenefitBalanceComponent setTerm(CodeableConcept value) { 
11759          this.term = value;
11760          return this;
11761        }
11762
11763        /**
11764         * @return {@link #financial} (Benefits Used to date.)
11765         */
11766        public List<BenefitComponent> getFinancial() { 
11767          if (this.financial == null)
11768            this.financial = new ArrayList<BenefitComponent>();
11769          return this.financial;
11770        }
11771
11772        /**
11773         * @return Returns a reference to <code>this</code> for easy method chaining
11774         */
11775        public BenefitBalanceComponent setFinancial(List<BenefitComponent> theFinancial) { 
11776          this.financial = theFinancial;
11777          return this;
11778        }
11779
11780        public boolean hasFinancial() { 
11781          if (this.financial == null)
11782            return false;
11783          for (BenefitComponent item : this.financial)
11784            if (!item.isEmpty())
11785              return true;
11786          return false;
11787        }
11788
11789        public BenefitComponent addFinancial() { //3
11790          BenefitComponent t = new BenefitComponent();
11791          if (this.financial == null)
11792            this.financial = new ArrayList<BenefitComponent>();
11793          this.financial.add(t);
11794          return t;
11795        }
11796
11797        public BenefitBalanceComponent addFinancial(BenefitComponent t) { //3
11798          if (t == null)
11799            return this;
11800          if (this.financial == null)
11801            this.financial = new ArrayList<BenefitComponent>();
11802          this.financial.add(t);
11803          return this;
11804        }
11805
11806        /**
11807         * @return The first repetition of repeating field {@link #financial}, creating it if it does not already exist
11808         */
11809        public BenefitComponent getFinancialFirstRep() { 
11810          if (getFinancial().isEmpty()) {
11811            addFinancial();
11812          }
11813          return getFinancial().get(0);
11814        }
11815
11816        protected void listChildren(List<Property> children) {
11817          super.listChildren(children);
11818          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
11819          children.add(new Property("excluded", "boolean", "True if the indicated class of service is excluded from the plan, missing or False indicates the product or service is included in the coverage.", 0, 1, excluded));
11820          children.add(new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name));
11821          children.add(new Property("description", "string", "A richer description of the benefit or services covered.", 0, 1, description));
11822          children.add(new Property("network", "CodeableConcept", "Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.", 0, 1, network));
11823          children.add(new Property("unit", "CodeableConcept", "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit));
11824          children.add(new Property("term", "CodeableConcept", "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.", 0, 1, term));
11825          children.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
11826        }
11827
11828        @Override
11829        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11830          switch (_hash) {
11831          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category);
11832          case 1994055114: /*excluded*/  return new Property("excluded", "boolean", "True if the indicated class of service is excluded from the plan, missing or False indicates the product or service is included in the coverage.", 0, 1, excluded);
11833          case 3373707: /*name*/  return new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name);
11834          case -1724546052: /*description*/  return new Property("description", "string", "A richer description of the benefit or services covered.", 0, 1, description);
11835          case 1843485230: /*network*/  return new Property("network", "CodeableConcept", "Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.", 0, 1, network);
11836          case 3594628: /*unit*/  return new Property("unit", "CodeableConcept", "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit);
11837          case 3556460: /*term*/  return new Property("term", "CodeableConcept", "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.", 0, 1, term);
11838          case 357555337: /*financial*/  return new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial);
11839          default: return super.getNamedProperty(_hash, _name, _checkValid);
11840          }
11841
11842        }
11843
11844      @Override
11845      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11846        switch (hash) {
11847        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
11848        case 1994055114: /*excluded*/ return this.excluded == null ? new Base[0] : new Base[] {this.excluded}; // BooleanType
11849        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
11850        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
11851        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // CodeableConcept
11852        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // CodeableConcept
11853        case 3556460: /*term*/ return this.term == null ? new Base[0] : new Base[] {this.term}; // CodeableConcept
11854        case 357555337: /*financial*/ return this.financial == null ? new Base[0] : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
11855        default: return super.getProperty(hash, name, checkValid);
11856        }
11857
11858      }
11859
11860      @Override
11861      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11862        switch (hash) {
11863        case 50511102: // category
11864          this.category = castToCodeableConcept(value); // CodeableConcept
11865          return value;
11866        case 1994055114: // excluded
11867          this.excluded = castToBoolean(value); // BooleanType
11868          return value;
11869        case 3373707: // name
11870          this.name = castToString(value); // StringType
11871          return value;
11872        case -1724546052: // description
11873          this.description = castToString(value); // StringType
11874          return value;
11875        case 1843485230: // network
11876          this.network = castToCodeableConcept(value); // CodeableConcept
11877          return value;
11878        case 3594628: // unit
11879          this.unit = castToCodeableConcept(value); // CodeableConcept
11880          return value;
11881        case 3556460: // term
11882          this.term = castToCodeableConcept(value); // CodeableConcept
11883          return value;
11884        case 357555337: // financial
11885          this.getFinancial().add((BenefitComponent) value); // BenefitComponent
11886          return value;
11887        default: return super.setProperty(hash, name, value);
11888        }
11889
11890      }
11891
11892      @Override
11893      public Base setProperty(String name, Base value) throws FHIRException {
11894        if (name.equals("category")) {
11895          this.category = castToCodeableConcept(value); // CodeableConcept
11896        } else if (name.equals("excluded")) {
11897          this.excluded = castToBoolean(value); // BooleanType
11898        } else if (name.equals("name")) {
11899          this.name = castToString(value); // StringType
11900        } else if (name.equals("description")) {
11901          this.description = castToString(value); // StringType
11902        } else if (name.equals("network")) {
11903          this.network = castToCodeableConcept(value); // CodeableConcept
11904        } else if (name.equals("unit")) {
11905          this.unit = castToCodeableConcept(value); // CodeableConcept
11906        } else if (name.equals("term")) {
11907          this.term = castToCodeableConcept(value); // CodeableConcept
11908        } else if (name.equals("financial")) {
11909          this.getFinancial().add((BenefitComponent) value);
11910        } else
11911          return super.setProperty(name, value);
11912        return value;
11913      }
11914
11915      @Override
11916      public Base makeProperty(int hash, String name) throws FHIRException {
11917        switch (hash) {
11918        case 50511102:  return getCategory(); 
11919        case 1994055114:  return getExcludedElement();
11920        case 3373707:  return getNameElement();
11921        case -1724546052:  return getDescriptionElement();
11922        case 1843485230:  return getNetwork(); 
11923        case 3594628:  return getUnit(); 
11924        case 3556460:  return getTerm(); 
11925        case 357555337:  return addFinancial(); 
11926        default: return super.makeProperty(hash, name);
11927        }
11928
11929      }
11930
11931      @Override
11932      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11933        switch (hash) {
11934        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
11935        case 1994055114: /*excluded*/ return new String[] {"boolean"};
11936        case 3373707: /*name*/ return new String[] {"string"};
11937        case -1724546052: /*description*/ return new String[] {"string"};
11938        case 1843485230: /*network*/ return new String[] {"CodeableConcept"};
11939        case 3594628: /*unit*/ return new String[] {"CodeableConcept"};
11940        case 3556460: /*term*/ return new String[] {"CodeableConcept"};
11941        case 357555337: /*financial*/ return new String[] {};
11942        default: return super.getTypesForProperty(hash, name);
11943        }
11944
11945      }
11946
11947      @Override
11948      public Base addChild(String name) throws FHIRException {
11949        if (name.equals("category")) {
11950          this.category = new CodeableConcept();
11951          return this.category;
11952        }
11953        else if (name.equals("excluded")) {
11954          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.excluded");
11955        }
11956        else if (name.equals("name")) {
11957          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.name");
11958        }
11959        else if (name.equals("description")) {
11960          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.description");
11961        }
11962        else if (name.equals("network")) {
11963          this.network = new CodeableConcept();
11964          return this.network;
11965        }
11966        else if (name.equals("unit")) {
11967          this.unit = new CodeableConcept();
11968          return this.unit;
11969        }
11970        else if (name.equals("term")) {
11971          this.term = new CodeableConcept();
11972          return this.term;
11973        }
11974        else if (name.equals("financial")) {
11975          return addFinancial();
11976        }
11977        else
11978          return super.addChild(name);
11979      }
11980
11981      public BenefitBalanceComponent copy() {
11982        BenefitBalanceComponent dst = new BenefitBalanceComponent();
11983        copyValues(dst);
11984        dst.category = category == null ? null : category.copy();
11985        dst.excluded = excluded == null ? null : excluded.copy();
11986        dst.name = name == null ? null : name.copy();
11987        dst.description = description == null ? null : description.copy();
11988        dst.network = network == null ? null : network.copy();
11989        dst.unit = unit == null ? null : unit.copy();
11990        dst.term = term == null ? null : term.copy();
11991        if (financial != null) {
11992          dst.financial = new ArrayList<BenefitComponent>();
11993          for (BenefitComponent i : financial)
11994            dst.financial.add(i.copy());
11995        };
11996        return dst;
11997      }
11998
11999      @Override
12000      public boolean equalsDeep(Base other_) {
12001        if (!super.equalsDeep(other_))
12002          return false;
12003        if (!(other_ instanceof BenefitBalanceComponent))
12004          return false;
12005        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
12006        return compareDeep(category, o.category, true) && compareDeep(excluded, o.excluded, true) && compareDeep(name, o.name, true)
12007           && compareDeep(description, o.description, true) && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true)
12008           && compareDeep(term, o.term, true) && compareDeep(financial, o.financial, true);
12009      }
12010
12011      @Override
12012      public boolean equalsShallow(Base other_) {
12013        if (!super.equalsShallow(other_))
12014          return false;
12015        if (!(other_ instanceof BenefitBalanceComponent))
12016          return false;
12017        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
12018        return compareValues(excluded, o.excluded, true) && compareValues(name, o.name, true) && compareValues(description, o.description, true)
12019          ;
12020      }
12021
12022      public boolean isEmpty() {
12023        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, excluded, name
12024          , description, network, unit, term, financial);
12025      }
12026
12027  public String fhirType() {
12028    return "ExplanationOfBenefit.benefitBalance";
12029
12030  }
12031
12032  }
12033
12034    @Block()
12035    public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
12036        /**
12037         * Classification of benefit being provided.
12038         */
12039        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
12040        @Description(shortDefinition="Benefit classification", formalDefinition="Classification of benefit being provided." )
12041        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-type")
12042        protected CodeableConcept type;
12043
12044        /**
12045         * The quantity of the benefit which is permitted under the coverage.
12046         */
12047        @Child(name = "allowed", type = {UnsignedIntType.class, StringType.class, Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
12048        @Description(shortDefinition="Benefits allowed", formalDefinition="The quantity of the benefit which is permitted under the coverage." )
12049        protected Type allowed;
12050
12051        /**
12052         * The quantity of the benefit which have been consumed to date.
12053         */
12054        @Child(name = "used", type = {UnsignedIntType.class, Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
12055        @Description(shortDefinition="Benefits used", formalDefinition="The quantity of the benefit which have been consumed to date." )
12056        protected Type used;
12057
12058        private static final long serialVersionUID = -1506285314L;
12059
12060    /**
12061     * Constructor
12062     */
12063      public BenefitComponent() {
12064        super();
12065      }
12066
12067    /**
12068     * Constructor
12069     */
12070      public BenefitComponent(CodeableConcept type) {
12071        super();
12072        this.type = type;
12073      }
12074
12075        /**
12076         * @return {@link #type} (Classification of benefit being provided.)
12077         */
12078        public CodeableConcept getType() { 
12079          if (this.type == null)
12080            if (Configuration.errorOnAutoCreate())
12081              throw new Error("Attempt to auto-create BenefitComponent.type");
12082            else if (Configuration.doAutoCreate())
12083              this.type = new CodeableConcept(); // cc
12084          return this.type;
12085        }
12086
12087        public boolean hasType() { 
12088          return this.type != null && !this.type.isEmpty();
12089        }
12090
12091        /**
12092         * @param value {@link #type} (Classification of benefit being provided.)
12093         */
12094        public BenefitComponent setType(CodeableConcept value) { 
12095          this.type = value;
12096          return this;
12097        }
12098
12099        /**
12100         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12101         */
12102        public Type getAllowed() { 
12103          return this.allowed;
12104        }
12105
12106        /**
12107         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12108         */
12109        public UnsignedIntType getAllowedUnsignedIntType() throws FHIRException { 
12110          if (this.allowed == null)
12111            this.allowed = new UnsignedIntType();
12112          if (!(this.allowed instanceof UnsignedIntType))
12113            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.allowed.getClass().getName()+" was encountered");
12114          return (UnsignedIntType) this.allowed;
12115        }
12116
12117        public boolean hasAllowedUnsignedIntType() { 
12118          return this != null && this.allowed instanceof UnsignedIntType;
12119        }
12120
12121        /**
12122         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12123         */
12124        public StringType getAllowedStringType() throws FHIRException { 
12125          if (this.allowed == null)
12126            this.allowed = new StringType();
12127          if (!(this.allowed instanceof StringType))
12128            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.allowed.getClass().getName()+" was encountered");
12129          return (StringType) this.allowed;
12130        }
12131
12132        public boolean hasAllowedStringType() { 
12133          return this != null && this.allowed instanceof StringType;
12134        }
12135
12136        /**
12137         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12138         */
12139        public Money getAllowedMoney() throws FHIRException { 
12140          if (this.allowed == null)
12141            this.allowed = new Money();
12142          if (!(this.allowed instanceof Money))
12143            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.allowed.getClass().getName()+" was encountered");
12144          return (Money) this.allowed;
12145        }
12146
12147        public boolean hasAllowedMoney() { 
12148          return this != null && this.allowed instanceof Money;
12149        }
12150
12151        public boolean hasAllowed() { 
12152          return this.allowed != null && !this.allowed.isEmpty();
12153        }
12154
12155        /**
12156         * @param value {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12157         */
12158        public BenefitComponent setAllowed(Type value) { 
12159          if (value != null && !(value instanceof UnsignedIntType || value instanceof StringType || value instanceof Money))
12160            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.allowed[x]: "+value.fhirType());
12161          this.allowed = value;
12162          return this;
12163        }
12164
12165        /**
12166         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
12167         */
12168        public Type getUsed() { 
12169          return this.used;
12170        }
12171
12172        /**
12173         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
12174         */
12175        public UnsignedIntType getUsedUnsignedIntType() throws FHIRException { 
12176          if (this.used == null)
12177            this.used = new UnsignedIntType();
12178          if (!(this.used instanceof UnsignedIntType))
12179            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.used.getClass().getName()+" was encountered");
12180          return (UnsignedIntType) this.used;
12181        }
12182
12183        public boolean hasUsedUnsignedIntType() { 
12184          return this != null && this.used instanceof UnsignedIntType;
12185        }
12186
12187        /**
12188         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
12189         */
12190        public Money getUsedMoney() throws FHIRException { 
12191          if (this.used == null)
12192            this.used = new Money();
12193          if (!(this.used instanceof Money))
12194            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.used.getClass().getName()+" was encountered");
12195          return (Money) this.used;
12196        }
12197
12198        public boolean hasUsedMoney() { 
12199          return this != null && this.used instanceof Money;
12200        }
12201
12202        public boolean hasUsed() { 
12203          return this.used != null && !this.used.isEmpty();
12204        }
12205
12206        /**
12207         * @param value {@link #used} (The quantity of the benefit which have been consumed to date.)
12208         */
12209        public BenefitComponent setUsed(Type value) { 
12210          if (value != null && !(value instanceof UnsignedIntType || value instanceof Money))
12211            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.used[x]: "+value.fhirType());
12212          this.used = value;
12213          return this;
12214        }
12215
12216        protected void listChildren(List<Property> children) {
12217          super.listChildren(children);
12218          children.add(new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type));
12219          children.add(new Property("allowed[x]", "unsignedInt|string|Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed));
12220          children.add(new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used));
12221        }
12222
12223        @Override
12224        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
12225          switch (_hash) {
12226          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type);
12227          case -1336663592: /*allowed[x]*/  return new Property("allowed[x]", "unsignedInt|string|Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
12228          case -911343192: /*allowed*/  return new Property("allowed[x]", "unsignedInt|string|Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
12229          case 1668802034: /*allowedUnsignedInt*/  return new Property("allowed[x]", "unsignedInt|string|Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
12230          case -2135265319: /*allowedString*/  return new Property("allowed[x]", "unsignedInt|string|Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
12231          case -351668232: /*allowedMoney*/  return new Property("allowed[x]", "unsignedInt|string|Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
12232          case -147553373: /*used[x]*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
12233          case 3599293: /*used*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
12234          case 1252740285: /*usedUnsignedInt*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
12235          case -78048509: /*usedMoney*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
12236          default: return super.getNamedProperty(_hash, _name, _checkValid);
12237          }
12238
12239        }
12240
12241      @Override
12242      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
12243        switch (hash) {
12244        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
12245        case -911343192: /*allowed*/ return this.allowed == null ? new Base[0] : new Base[] {this.allowed}; // Type
12246        case 3599293: /*used*/ return this.used == null ? new Base[0] : new Base[] {this.used}; // Type
12247        default: return super.getProperty(hash, name, checkValid);
12248        }
12249
12250      }
12251
12252      @Override
12253      public Base setProperty(int hash, String name, Base value) throws FHIRException {
12254        switch (hash) {
12255        case 3575610: // type
12256          this.type = castToCodeableConcept(value); // CodeableConcept
12257          return value;
12258        case -911343192: // allowed
12259          this.allowed = castToType(value); // Type
12260          return value;
12261        case 3599293: // used
12262          this.used = castToType(value); // Type
12263          return value;
12264        default: return super.setProperty(hash, name, value);
12265        }
12266
12267      }
12268
12269      @Override
12270      public Base setProperty(String name, Base value) throws FHIRException {
12271        if (name.equals("type")) {
12272          this.type = castToCodeableConcept(value); // CodeableConcept
12273        } else if (name.equals("allowed[x]")) {
12274          this.allowed = castToType(value); // Type
12275        } else if (name.equals("used[x]")) {
12276          this.used = castToType(value); // Type
12277        } else
12278          return super.setProperty(name, value);
12279        return value;
12280      }
12281
12282      @Override
12283      public Base makeProperty(int hash, String name) throws FHIRException {
12284        switch (hash) {
12285        case 3575610:  return getType(); 
12286        case -1336663592:  return getAllowed(); 
12287        case -911343192:  return getAllowed(); 
12288        case -147553373:  return getUsed(); 
12289        case 3599293:  return getUsed(); 
12290        default: return super.makeProperty(hash, name);
12291        }
12292
12293      }
12294
12295      @Override
12296      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12297        switch (hash) {
12298        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
12299        case -911343192: /*allowed*/ return new String[] {"unsignedInt", "string", "Money"};
12300        case 3599293: /*used*/ return new String[] {"unsignedInt", "Money"};
12301        default: return super.getTypesForProperty(hash, name);
12302        }
12303
12304      }
12305
12306      @Override
12307      public Base addChild(String name) throws FHIRException {
12308        if (name.equals("type")) {
12309          this.type = new CodeableConcept();
12310          return this.type;
12311        }
12312        else if (name.equals("allowedUnsignedInt")) {
12313          this.allowed = new UnsignedIntType();
12314          return this.allowed;
12315        }
12316        else if (name.equals("allowedString")) {
12317          this.allowed = new StringType();
12318          return this.allowed;
12319        }
12320        else if (name.equals("allowedMoney")) {
12321          this.allowed = new Money();
12322          return this.allowed;
12323        }
12324        else if (name.equals("usedUnsignedInt")) {
12325          this.used = new UnsignedIntType();
12326          return this.used;
12327        }
12328        else if (name.equals("usedMoney")) {
12329          this.used = new Money();
12330          return this.used;
12331        }
12332        else
12333          return super.addChild(name);
12334      }
12335
12336      public BenefitComponent copy() {
12337        BenefitComponent dst = new BenefitComponent();
12338        copyValues(dst);
12339        dst.type = type == null ? null : type.copy();
12340        dst.allowed = allowed == null ? null : allowed.copy();
12341        dst.used = used == null ? null : used.copy();
12342        return dst;
12343      }
12344
12345      @Override
12346      public boolean equalsDeep(Base other_) {
12347        if (!super.equalsDeep(other_))
12348          return false;
12349        if (!(other_ instanceof BenefitComponent))
12350          return false;
12351        BenefitComponent o = (BenefitComponent) other_;
12352        return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true) && compareDeep(used, o.used, true)
12353          ;
12354      }
12355
12356      @Override
12357      public boolean equalsShallow(Base other_) {
12358        if (!super.equalsShallow(other_))
12359          return false;
12360        if (!(other_ instanceof BenefitComponent))
12361          return false;
12362        BenefitComponent o = (BenefitComponent) other_;
12363        return true;
12364      }
12365
12366      public boolean isEmpty() {
12367        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed, used);
12368      }
12369
12370  public String fhirType() {
12371    return "ExplanationOfBenefit.benefitBalance.financial";
12372
12373  }
12374
12375  }
12376
12377    /**
12378     * A unique identifier assigned to this explanation of benefit.
12379     */
12380    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12381    @Description(shortDefinition="Business Identifier for the resource", formalDefinition="A unique identifier assigned to this explanation of benefit." )
12382    protected List<Identifier> identifier;
12383
12384    /**
12385     * The status of the resource instance.
12386     */
12387    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
12388    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
12389    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/explanationofbenefit-status")
12390    protected Enumeration<ExplanationOfBenefitStatus> status;
12391
12392    /**
12393     * The category of claim, e.g. oral, pharmacy, vision, institutional, professional.
12394     */
12395    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
12396    @Description(shortDefinition="Category or discipline", formalDefinition="The category of claim, e.g. oral, pharmacy, vision, institutional, professional." )
12397    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-type")
12398    protected CodeableConcept type;
12399
12400    /**
12401     * A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.
12402     */
12403    @Child(name = "subType", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
12404    @Description(shortDefinition="More granular claim type", formalDefinition="A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service." )
12405    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-subtype")
12406    protected CodeableConcept subType;
12407
12408    /**
12409     * A code to indicate whether the nature of the request is: to request adjudication of products and services previously rendered; or requesting authorization and adjudication for provision in the future; or requesting the non-binding adjudication of the listed products and services which could be provided in the future.
12410     */
12411    @Child(name = "use", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
12412    @Description(shortDefinition="claim | preauthorization | predetermination", formalDefinition="A code to indicate whether the nature of the request is: to request adjudication of products and services previously rendered; or requesting authorization and adjudication for provision in the future; or requesting the non-binding adjudication of the listed products and services which could be provided in the future." )
12413    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-use")
12414    protected Enumeration<Use> use;
12415
12416    /**
12417     * The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for forecast reimbursement is sought.
12418     */
12419    @Child(name = "patient", type = {Patient.class}, order=5, min=1, max=1, modifier=false, summary=true)
12420    @Description(shortDefinition="The recipient of the products and services", formalDefinition="The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for forecast reimbursement is sought." )
12421    protected Reference patient;
12422
12423    /**
12424     * The actual object that is the target of the reference (The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for forecast reimbursement is sought.)
12425     */
12426    protected Patient patientTarget;
12427
12428    /**
12429     * The period for which charges are being submitted.
12430     */
12431    @Child(name = "billablePeriod", type = {Period.class}, order=6, min=0, max=1, modifier=false, summary=true)
12432    @Description(shortDefinition="Relevant time frame for the claim", formalDefinition="The period for which charges are being submitted." )
12433    protected Period billablePeriod;
12434
12435    /**
12436     * The date this resource was created.
12437     */
12438    @Child(name = "created", type = {DateTimeType.class}, order=7, min=1, max=1, modifier=false, summary=true)
12439    @Description(shortDefinition="Response creation date", formalDefinition="The date this resource was created." )
12440    protected DateTimeType created;
12441
12442    /**
12443     * Individual who created the claim, predetermination or preauthorization.
12444     */
12445    @Child(name = "enterer", type = {Practitioner.class, PractitionerRole.class}, order=8, min=0, max=1, modifier=false, summary=false)
12446    @Description(shortDefinition="Author of the claim", formalDefinition="Individual who created the claim, predetermination or preauthorization." )
12447    protected Reference enterer;
12448
12449    /**
12450     * The actual object that is the target of the reference (Individual who created the claim, predetermination or preauthorization.)
12451     */
12452    protected Resource entererTarget;
12453
12454    /**
12455     * The party responsible for authorization, adjudication and reimbursement.
12456     */
12457    @Child(name = "insurer", type = {Organization.class}, order=9, min=1, max=1, modifier=false, summary=true)
12458    @Description(shortDefinition="Party responsible for reimbursement", formalDefinition="The party responsible for authorization, adjudication and reimbursement." )
12459    protected Reference insurer;
12460
12461    /**
12462     * The actual object that is the target of the reference (The party responsible for authorization, adjudication and reimbursement.)
12463     */
12464    protected Organization insurerTarget;
12465
12466    /**
12467     * The provider which is responsible for the claim, predetermination or preauthorization.
12468     */
12469    @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=10, min=1, max=1, modifier=false, summary=true)
12470    @Description(shortDefinition="Party responsible for the claim", formalDefinition="The provider which is responsible for the claim, predetermination or preauthorization." )
12471    protected Reference provider;
12472
12473    /**
12474     * The actual object that is the target of the reference (The provider which is responsible for the claim, predetermination or preauthorization.)
12475     */
12476    protected Resource providerTarget;
12477
12478    /**
12479     * The provider-required urgency of processing the request. Typical values include: stat, routine deferred.
12480     */
12481    @Child(name = "priority", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=false)
12482    @Description(shortDefinition="Desired processing urgency", formalDefinition="The provider-required urgency of processing the request. Typical values include: stat, routine deferred." )
12483    protected CodeableConcept priority;
12484
12485    /**
12486     * A code to indicate whether and for whom funds are to be reserved for future claims.
12487     */
12488    @Child(name = "fundsReserveRequested", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
12489    @Description(shortDefinition="For whom to reserve funds", formalDefinition="A code to indicate whether and for whom funds are to be reserved for future claims." )
12490    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fundsreserve")
12491    protected CodeableConcept fundsReserveRequested;
12492
12493    /**
12494     * A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.
12495     */
12496    @Child(name = "fundsReserve", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
12497    @Description(shortDefinition="Funds reserved status", formalDefinition="A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom." )
12498    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fundsreserve")
12499    protected CodeableConcept fundsReserve;
12500
12501    /**
12502     * Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.
12503     */
12504    @Child(name = "related", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12505    @Description(shortDefinition="Prior or corollary claims", formalDefinition="Other claims which are related to this claim such as prior submissions or claims for related services or for the same event." )
12506    protected List<RelatedClaimComponent> related;
12507
12508    /**
12509     * Prescription to support the dispensing of pharmacy, device or vision products.
12510     */
12511    @Child(name = "prescription", type = {MedicationRequest.class, VisionPrescription.class}, order=15, min=0, max=1, modifier=false, summary=false)
12512    @Description(shortDefinition="Prescription authorizing services or products", formalDefinition="Prescription to support the dispensing of pharmacy, device or vision products." )
12513    protected Reference prescription;
12514
12515    /**
12516     * The actual object that is the target of the reference (Prescription to support the dispensing of pharmacy, device or vision products.)
12517     */
12518    protected Resource prescriptionTarget;
12519
12520    /**
12521     * Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.
12522     */
12523    @Child(name = "originalPrescription", type = {MedicationRequest.class}, order=16, min=0, max=1, modifier=false, summary=false)
12524    @Description(shortDefinition="Original prescription if superceded by fulfiller", formalDefinition="Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products." )
12525    protected Reference originalPrescription;
12526
12527    /**
12528     * The actual object that is the target of the reference (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
12529     */
12530    protected MedicationRequest originalPrescriptionTarget;
12531
12532    /**
12533     * The party to be reimbursed for cost of the products and services according to the terms of the policy.
12534     */
12535    @Child(name = "payee", type = {}, order=17, min=0, max=1, modifier=false, summary=false)
12536    @Description(shortDefinition="Recipient of benefits payable", formalDefinition="The party to be reimbursed for cost of the products and services according to the terms of the policy." )
12537    protected PayeeComponent payee;
12538
12539    /**
12540     * A reference to a referral resource.
12541     */
12542    @Child(name = "referral", type = {ServiceRequest.class}, order=18, min=0, max=1, modifier=false, summary=false)
12543    @Description(shortDefinition="Treatment Referral", formalDefinition="A reference to a referral resource." )
12544    protected Reference referral;
12545
12546    /**
12547     * The actual object that is the target of the reference (A reference to a referral resource.)
12548     */
12549    protected ServiceRequest referralTarget;
12550
12551    /**
12552     * Facility where the services were provided.
12553     */
12554    @Child(name = "facility", type = {Location.class}, order=19, min=0, max=1, modifier=false, summary=false)
12555    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
12556    protected Reference facility;
12557
12558    /**
12559     * The actual object that is the target of the reference (Facility where the services were provided.)
12560     */
12561    protected Location facilityTarget;
12562
12563    /**
12564     * The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.
12565     */
12566    @Child(name = "claim", type = {Claim.class}, order=20, min=0, max=1, modifier=false, summary=false)
12567    @Description(shortDefinition="Claim reference", formalDefinition="The business identifier for the instance of the adjudication request: claim predetermination or preauthorization." )
12568    protected Reference claim;
12569
12570    /**
12571     * The actual object that is the target of the reference (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
12572     */
12573    protected Claim claimTarget;
12574
12575    /**
12576     * The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.
12577     */
12578    @Child(name = "claimResponse", type = {ClaimResponse.class}, order=21, min=0, max=1, modifier=false, summary=false)
12579    @Description(shortDefinition="Claim response reference", formalDefinition="The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response." )
12580    protected Reference claimResponse;
12581
12582    /**
12583     * The actual object that is the target of the reference (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
12584     */
12585    protected ClaimResponse claimResponseTarget;
12586
12587    /**
12588     * The outcome of the claim, predetermination, or preauthorization processing.
12589     */
12590    @Child(name = "outcome", type = {CodeType.class}, order=22, min=1, max=1, modifier=false, summary=true)
12591    @Description(shortDefinition="queued | complete | error | partial", formalDefinition="The outcome of the claim, predetermination, or preauthorization processing." )
12592    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/remittance-outcome")
12593    protected Enumeration<RemittanceOutcome> outcome;
12594
12595    /**
12596     * A human readable description of the status of the adjudication.
12597     */
12598    @Child(name = "disposition", type = {StringType.class}, order=23, min=0, max=1, modifier=false, summary=false)
12599    @Description(shortDefinition="Disposition Message", formalDefinition="A human readable description of the status of the adjudication." )
12600    protected StringType disposition;
12601
12602    /**
12603     * Reference from the Insurer which is used in later communications which refers to this adjudication.
12604     */
12605    @Child(name = "preAuthRef", type = {StringType.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12606    @Description(shortDefinition="Preauthorization reference", formalDefinition="Reference from the Insurer which is used in later communications which refers to this adjudication." )
12607    protected List<StringType> preAuthRef;
12608
12609    /**
12610     * The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.
12611     */
12612    @Child(name = "preAuthRefPeriod", type = {Period.class}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12613    @Description(shortDefinition="Preauthorization in-effect period", formalDefinition="The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided." )
12614    protected List<Period> preAuthRefPeriod;
12615
12616    /**
12617     * The members of the team who provided the products and services.
12618     */
12619    @Child(name = "careTeam", type = {}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12620    @Description(shortDefinition="Care Team members", formalDefinition="The members of the team who provided the products and services." )
12621    protected List<CareTeamComponent> careTeam;
12622
12623    /**
12624     * Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.
12625     */
12626    @Child(name = "supportingInfo", type = {}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12627    @Description(shortDefinition="Supporting information", formalDefinition="Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues." )
12628    protected List<SupportingInformationComponent> supportingInfo;
12629
12630    /**
12631     * Information about diagnoses relevant to the claim items.
12632     */
12633    @Child(name = "diagnosis", type = {}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12634    @Description(shortDefinition="Pertinent diagnosis information", formalDefinition="Information about diagnoses relevant to the claim items." )
12635    protected List<DiagnosisComponent> diagnosis;
12636
12637    /**
12638     * Procedures performed on the patient relevant to the billing items with the claim.
12639     */
12640    @Child(name = "procedure", type = {}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12641    @Description(shortDefinition="Clinical procedures performed", formalDefinition="Procedures performed on the patient relevant to the billing items with the claim." )
12642    protected List<ProcedureComponent> procedure;
12643
12644    /**
12645     * This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
12646     */
12647    @Child(name = "precedence", type = {PositiveIntType.class}, order=30, min=0, max=1, modifier=false, summary=false)
12648    @Description(shortDefinition="Precedence (primary, secondary, etc.)", formalDefinition="This indicates the relative order of a series of EOBs related to different coverages for the same suite of services." )
12649    protected PositiveIntType precedence;
12650
12651    /**
12652     * Financial instruments for reimbursement for the health care products and services specified on the claim.
12653     */
12654    @Child(name = "insurance", type = {}, order=31, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
12655    @Description(shortDefinition="Patient insurance information", formalDefinition="Financial instruments for reimbursement for the health care products and services specified on the claim." )
12656    protected List<InsuranceComponent> insurance;
12657
12658    /**
12659     * Details of a accident which resulted in injuries which required the products and services listed in the claim.
12660     */
12661    @Child(name = "accident", type = {}, order=32, min=0, max=1, modifier=false, summary=false)
12662    @Description(shortDefinition="Details of the event", formalDefinition="Details of a accident which resulted in injuries which required the products and services listed in the claim." )
12663    protected AccidentComponent accident;
12664
12665    /**
12666     * A claim line. Either a simple (a product or service) or a 'group' of details which can also be a simple items or groups of sub-details.
12667     */
12668    @Child(name = "item", type = {}, order=33, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12669    @Description(shortDefinition="Product or service provided", formalDefinition="A claim line. Either a simple (a product or service) or a 'group' of details which can also be a simple items or groups of sub-details." )
12670    protected List<ItemComponent> item;
12671
12672    /**
12673     * The first-tier service adjudications for payor added product or service lines.
12674     */
12675    @Child(name = "addItem", type = {}, order=34, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12676    @Description(shortDefinition="Insurer added line items", formalDefinition="The first-tier service adjudications for payor added product or service lines." )
12677    protected List<AddedItemComponent> addItem;
12678
12679    /**
12680     * The adjudication results which are presented at the header level rather than at the line-item or add-item levels.
12681     */
12682    @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=35, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12683    @Description(shortDefinition="Header-level adjudication", formalDefinition="The adjudication results which are presented at the header level rather than at the line-item or add-item levels." )
12684    protected List<AdjudicationComponent> adjudication;
12685
12686    /**
12687     * Categorized monetary totals for the adjudication.
12688     */
12689    @Child(name = "total", type = {}, order=36, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
12690    @Description(shortDefinition="Adjudication totals", formalDefinition="Categorized monetary totals for the adjudication." )
12691    protected List<TotalComponent> total;
12692
12693    /**
12694     * Payment details for the adjudication of the claim.
12695     */
12696    @Child(name = "payment", type = {}, order=37, min=0, max=1, modifier=false, summary=false)
12697    @Description(shortDefinition="Payment Details", formalDefinition="Payment details for the adjudication of the claim." )
12698    protected PaymentComponent payment;
12699
12700    /**
12701     * A code for the form to be used for printing the content.
12702     */
12703    @Child(name = "formCode", type = {CodeableConcept.class}, order=38, min=0, max=1, modifier=false, summary=false)
12704    @Description(shortDefinition="Printed form identifier", formalDefinition="A code for the form to be used for printing the content." )
12705    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/forms")
12706    protected CodeableConcept formCode;
12707
12708    /**
12709     * The actual form, by reference or inclusion, for printing the content or an EOB.
12710     */
12711    @Child(name = "form", type = {Attachment.class}, order=39, min=0, max=1, modifier=false, summary=false)
12712    @Description(shortDefinition="Printed reference or actual form", formalDefinition="The actual form, by reference or inclusion, for printing the content or an EOB." )
12713    protected Attachment form;
12714
12715    /**
12716     * A note that describes or explains adjudication results in a human readable form.
12717     */
12718    @Child(name = "processNote", type = {}, order=40, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12719    @Description(shortDefinition="Note concerning adjudication", formalDefinition="A note that describes or explains adjudication results in a human readable form." )
12720    protected List<NoteComponent> processNote;
12721
12722    /**
12723     * The term of the benefits documented in this response.
12724     */
12725    @Child(name = "benefitPeriod", type = {Period.class}, order=41, min=0, max=1, modifier=false, summary=false)
12726    @Description(shortDefinition="When the benefits are applicable", formalDefinition="The term of the benefits documented in this response." )
12727    protected Period benefitPeriod;
12728
12729    /**
12730     * Balance by Benefit Category.
12731     */
12732    @Child(name = "benefitBalance", type = {}, order=42, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12733    @Description(shortDefinition="Balance by Benefit Category", formalDefinition="Balance by Benefit Category." )
12734    protected List<BenefitBalanceComponent> benefitBalance;
12735
12736    private static final long serialVersionUID = -1515422099L;
12737
12738  /**
12739   * Constructor
12740   */
12741    public ExplanationOfBenefit() {
12742      super();
12743    }
12744
12745  /**
12746   * Constructor
12747   */
12748    public ExplanationOfBenefit(Enumeration<ExplanationOfBenefitStatus> status, CodeableConcept type, Enumeration<Use> use, Reference patient, DateTimeType created, Reference insurer, Reference provider, Enumeration<RemittanceOutcome> outcome) {
12749      super();
12750      this.status = status;
12751      this.type = type;
12752      this.use = use;
12753      this.patient = patient;
12754      this.created = created;
12755      this.insurer = insurer;
12756      this.provider = provider;
12757      this.outcome = outcome;
12758    }
12759
12760    /**
12761     * @return {@link #identifier} (A unique identifier assigned to this explanation of benefit.)
12762     */
12763    public List<Identifier> getIdentifier() { 
12764      if (this.identifier == null)
12765        this.identifier = new ArrayList<Identifier>();
12766      return this.identifier;
12767    }
12768
12769    /**
12770     * @return Returns a reference to <code>this</code> for easy method chaining
12771     */
12772    public ExplanationOfBenefit setIdentifier(List<Identifier> theIdentifier) { 
12773      this.identifier = theIdentifier;
12774      return this;
12775    }
12776
12777    public boolean hasIdentifier() { 
12778      if (this.identifier == null)
12779        return false;
12780      for (Identifier item : this.identifier)
12781        if (!item.isEmpty())
12782          return true;
12783      return false;
12784    }
12785
12786    public Identifier addIdentifier() { //3
12787      Identifier t = new Identifier();
12788      if (this.identifier == null)
12789        this.identifier = new ArrayList<Identifier>();
12790      this.identifier.add(t);
12791      return t;
12792    }
12793
12794    public ExplanationOfBenefit addIdentifier(Identifier t) { //3
12795      if (t == null)
12796        return this;
12797      if (this.identifier == null)
12798        this.identifier = new ArrayList<Identifier>();
12799      this.identifier.add(t);
12800      return this;
12801    }
12802
12803    /**
12804     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
12805     */
12806    public Identifier getIdentifierFirstRep() { 
12807      if (getIdentifier().isEmpty()) {
12808        addIdentifier();
12809      }
12810      return getIdentifier().get(0);
12811    }
12812
12813    /**
12814     * @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
12815     */
12816    public Enumeration<ExplanationOfBenefitStatus> getStatusElement() { 
12817      if (this.status == null)
12818        if (Configuration.errorOnAutoCreate())
12819          throw new Error("Attempt to auto-create ExplanationOfBenefit.status");
12820        else if (Configuration.doAutoCreate())
12821          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory()); // bb
12822      return this.status;
12823    }
12824
12825    public boolean hasStatusElement() { 
12826      return this.status != null && !this.status.isEmpty();
12827    }
12828
12829    public boolean hasStatus() { 
12830      return this.status != null && !this.status.isEmpty();
12831    }
12832
12833    /**
12834     * @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
12835     */
12836    public ExplanationOfBenefit setStatusElement(Enumeration<ExplanationOfBenefitStatus> value) { 
12837      this.status = value;
12838      return this;
12839    }
12840
12841    /**
12842     * @return The status of the resource instance.
12843     */
12844    public ExplanationOfBenefitStatus getStatus() { 
12845      return this.status == null ? null : this.status.getValue();
12846    }
12847
12848    /**
12849     * @param value The status of the resource instance.
12850     */
12851    public ExplanationOfBenefit setStatus(ExplanationOfBenefitStatus value) { 
12852        if (this.status == null)
12853          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory());
12854        this.status.setValue(value);
12855      return this;
12856    }
12857
12858    /**
12859     * @return {@link #type} (The category of claim, e.g. oral, pharmacy, vision, institutional, professional.)
12860     */
12861    public CodeableConcept getType() { 
12862      if (this.type == null)
12863        if (Configuration.errorOnAutoCreate())
12864          throw new Error("Attempt to auto-create ExplanationOfBenefit.type");
12865        else if (Configuration.doAutoCreate())
12866          this.type = new CodeableConcept(); // cc
12867      return this.type;
12868    }
12869
12870    public boolean hasType() { 
12871      return this.type != null && !this.type.isEmpty();
12872    }
12873
12874    /**
12875     * @param value {@link #type} (The category of claim, e.g. oral, pharmacy, vision, institutional, professional.)
12876     */
12877    public ExplanationOfBenefit setType(CodeableConcept value) { 
12878      this.type = value;
12879      return this;
12880    }
12881
12882    /**
12883     * @return {@link #subType} (A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.)
12884     */
12885    public CodeableConcept getSubType() { 
12886      if (this.subType == null)
12887        if (Configuration.errorOnAutoCreate())
12888          throw new Error("Attempt to auto-create ExplanationOfBenefit.subType");
12889        else if (Configuration.doAutoCreate())
12890          this.subType = new CodeableConcept(); // cc
12891      return this.subType;
12892    }
12893
12894    public boolean hasSubType() { 
12895      return this.subType != null && !this.subType.isEmpty();
12896    }
12897
12898    /**
12899     * @param value {@link #subType} (A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.)
12900     */
12901    public ExplanationOfBenefit setSubType(CodeableConcept value) { 
12902      this.subType = value;
12903      return this;
12904    }
12905
12906    /**
12907     * @return {@link #use} (A code to indicate whether the nature of the request is: to request adjudication of products and services previously rendered; or requesting authorization and adjudication for provision in the future; or requesting the non-binding adjudication of the listed products and services which could be provided in the future.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
12908     */
12909    public Enumeration<Use> getUseElement() { 
12910      if (this.use == null)
12911        if (Configuration.errorOnAutoCreate())
12912          throw new Error("Attempt to auto-create ExplanationOfBenefit.use");
12913        else if (Configuration.doAutoCreate())
12914          this.use = new Enumeration<Use>(new UseEnumFactory()); // bb
12915      return this.use;
12916    }
12917
12918    public boolean hasUseElement() { 
12919      return this.use != null && !this.use.isEmpty();
12920    }
12921
12922    public boolean hasUse() { 
12923      return this.use != null && !this.use.isEmpty();
12924    }
12925
12926    /**
12927     * @param value {@link #use} (A code to indicate whether the nature of the request is: to request adjudication of products and services previously rendered; or requesting authorization and adjudication for provision in the future; or requesting the non-binding adjudication of the listed products and services which could be provided in the future.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
12928     */
12929    public ExplanationOfBenefit setUseElement(Enumeration<Use> value) { 
12930      this.use = value;
12931      return this;
12932    }
12933
12934    /**
12935     * @return A code to indicate whether the nature of the request is: to request adjudication of products and services previously rendered; or requesting authorization and adjudication for provision in the future; or requesting the non-binding adjudication of the listed products and services which could be provided in the future.
12936     */
12937    public Use getUse() { 
12938      return this.use == null ? null : this.use.getValue();
12939    }
12940
12941    /**
12942     * @param value A code to indicate whether the nature of the request is: to request adjudication of products and services previously rendered; or requesting authorization and adjudication for provision in the future; or requesting the non-binding adjudication of the listed products and services which could be provided in the future.
12943     */
12944    public ExplanationOfBenefit setUse(Use value) { 
12945        if (this.use == null)
12946          this.use = new Enumeration<Use>(new UseEnumFactory());
12947        this.use.setValue(value);
12948      return this;
12949    }
12950
12951    /**
12952     * @return {@link #patient} (The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for forecast reimbursement is sought.)
12953     */
12954    public Reference getPatient() { 
12955      if (this.patient == null)
12956        if (Configuration.errorOnAutoCreate())
12957          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
12958        else if (Configuration.doAutoCreate())
12959          this.patient = new Reference(); // cc
12960      return this.patient;
12961    }
12962
12963    public boolean hasPatient() { 
12964      return this.patient != null && !this.patient.isEmpty();
12965    }
12966
12967    /**
12968     * @param value {@link #patient} (The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for forecast reimbursement is sought.)
12969     */
12970    public ExplanationOfBenefit setPatient(Reference value) { 
12971      this.patient = value;
12972      return this;
12973    }
12974
12975    /**
12976     * @return {@link #patient} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for forecast reimbursement is sought.)
12977     */
12978    public Patient getPatientTarget() { 
12979      if (this.patientTarget == null)
12980        if (Configuration.errorOnAutoCreate())
12981          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
12982        else if (Configuration.doAutoCreate())
12983          this.patientTarget = new Patient(); // aa
12984      return this.patientTarget;
12985    }
12986
12987    /**
12988     * @param value {@link #patient} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for forecast reimbursement is sought.)
12989     */
12990    public ExplanationOfBenefit setPatientTarget(Patient value) { 
12991      this.patientTarget = value;
12992      return this;
12993    }
12994
12995    /**
12996     * @return {@link #billablePeriod} (The period for which charges are being submitted.)
12997     */
12998    public Period getBillablePeriod() { 
12999      if (this.billablePeriod == null)
13000        if (Configuration.errorOnAutoCreate())
13001          throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
13002        else if (Configuration.doAutoCreate())
13003          this.billablePeriod = new Period(); // cc
13004      return this.billablePeriod;
13005    }
13006
13007    public boolean hasBillablePeriod() { 
13008      return this.billablePeriod != null && !this.billablePeriod.isEmpty();
13009    }
13010
13011    /**
13012     * @param value {@link #billablePeriod} (The period for which charges are being submitted.)
13013     */
13014    public ExplanationOfBenefit setBillablePeriod(Period value) { 
13015      this.billablePeriod = value;
13016      return this;
13017    }
13018
13019    /**
13020     * @return {@link #created} (The date this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
13021     */
13022    public DateTimeType getCreatedElement() { 
13023      if (this.created == null)
13024        if (Configuration.errorOnAutoCreate())
13025          throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
13026        else if (Configuration.doAutoCreate())
13027          this.created = new DateTimeType(); // bb
13028      return this.created;
13029    }
13030
13031    public boolean hasCreatedElement() { 
13032      return this.created != null && !this.created.isEmpty();
13033    }
13034
13035    public boolean hasCreated() { 
13036      return this.created != null && !this.created.isEmpty();
13037    }
13038
13039    /**
13040     * @param value {@link #created} (The date this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
13041     */
13042    public ExplanationOfBenefit setCreatedElement(DateTimeType value) { 
13043      this.created = value;
13044      return this;
13045    }
13046
13047    /**
13048     * @return The date this resource was created.
13049     */
13050    public Date getCreated() { 
13051      return this.created == null ? null : this.created.getValue();
13052    }
13053
13054    /**
13055     * @param value The date this resource was created.
13056     */
13057    public ExplanationOfBenefit setCreated(Date value) { 
13058        if (this.created == null)
13059          this.created = new DateTimeType();
13060        this.created.setValue(value);
13061      return this;
13062    }
13063
13064    /**
13065     * @return {@link #enterer} (Individual who created the claim, predetermination or preauthorization.)
13066     */
13067    public Reference getEnterer() { 
13068      if (this.enterer == null)
13069        if (Configuration.errorOnAutoCreate())
13070          throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
13071        else if (Configuration.doAutoCreate())
13072          this.enterer = new Reference(); // cc
13073      return this.enterer;
13074    }
13075
13076    public boolean hasEnterer() { 
13077      return this.enterer != null && !this.enterer.isEmpty();
13078    }
13079
13080    /**
13081     * @param value {@link #enterer} (Individual who created the claim, predetermination or preauthorization.)
13082     */
13083    public ExplanationOfBenefit setEnterer(Reference value) { 
13084      this.enterer = value;
13085      return this;
13086    }
13087
13088    /**
13089     * @return {@link #enterer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Individual who created the claim, predetermination or preauthorization.)
13090     */
13091    public Resource getEntererTarget() { 
13092      return this.entererTarget;
13093    }
13094
13095    /**
13096     * @param value {@link #enterer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Individual who created the claim, predetermination or preauthorization.)
13097     */
13098    public ExplanationOfBenefit setEntererTarget(Resource value) { 
13099      this.entererTarget = value;
13100      return this;
13101    }
13102
13103    /**
13104     * @return {@link #insurer} (The party responsible for authorization, adjudication and reimbursement.)
13105     */
13106    public Reference getInsurer() { 
13107      if (this.insurer == null)
13108        if (Configuration.errorOnAutoCreate())
13109          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
13110        else if (Configuration.doAutoCreate())
13111          this.insurer = new Reference(); // cc
13112      return this.insurer;
13113    }
13114
13115    public boolean hasInsurer() { 
13116      return this.insurer != null && !this.insurer.isEmpty();
13117    }
13118
13119    /**
13120     * @param value {@link #insurer} (The party responsible for authorization, adjudication and reimbursement.)
13121     */
13122    public ExplanationOfBenefit setInsurer(Reference value) { 
13123      this.insurer = value;
13124      return this;
13125    }
13126
13127    /**
13128     * @return {@link #insurer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The party responsible for authorization, adjudication and reimbursement.)
13129     */
13130    public Organization getInsurerTarget() { 
13131      if (this.insurerTarget == null)
13132        if (Configuration.errorOnAutoCreate())
13133          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
13134        else if (Configuration.doAutoCreate())
13135          this.insurerTarget = new Organization(); // aa
13136      return this.insurerTarget;
13137    }
13138
13139    /**
13140     * @param value {@link #insurer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The party responsible for authorization, adjudication and reimbursement.)
13141     */
13142    public ExplanationOfBenefit setInsurerTarget(Organization value) { 
13143      this.insurerTarget = value;
13144      return this;
13145    }
13146
13147    /**
13148     * @return {@link #provider} (The provider which is responsible for the claim, predetermination or preauthorization.)
13149     */
13150    public Reference getProvider() { 
13151      if (this.provider == null)
13152        if (Configuration.errorOnAutoCreate())
13153          throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
13154        else if (Configuration.doAutoCreate())
13155          this.provider = new Reference(); // cc
13156      return this.provider;
13157    }
13158
13159    public boolean hasProvider() { 
13160      return this.provider != null && !this.provider.isEmpty();
13161    }
13162
13163    /**
13164     * @param value {@link #provider} (The provider which is responsible for the claim, predetermination or preauthorization.)
13165     */
13166    public ExplanationOfBenefit setProvider(Reference value) { 
13167      this.provider = value;
13168      return this;
13169    }
13170
13171    /**
13172     * @return {@link #provider} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The provider which is responsible for the claim, predetermination or preauthorization.)
13173     */
13174    public Resource getProviderTarget() { 
13175      return this.providerTarget;
13176    }
13177
13178    /**
13179     * @param value {@link #provider} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The provider which is responsible for the claim, predetermination or preauthorization.)
13180     */
13181    public ExplanationOfBenefit setProviderTarget(Resource value) { 
13182      this.providerTarget = value;
13183      return this;
13184    }
13185
13186    /**
13187     * @return {@link #priority} (The provider-required urgency of processing the request. Typical values include: stat, routine deferred.)
13188     */
13189    public CodeableConcept getPriority() { 
13190      if (this.priority == null)
13191        if (Configuration.errorOnAutoCreate())
13192          throw new Error("Attempt to auto-create ExplanationOfBenefit.priority");
13193        else if (Configuration.doAutoCreate())
13194          this.priority = new CodeableConcept(); // cc
13195      return this.priority;
13196    }
13197
13198    public boolean hasPriority() { 
13199      return this.priority != null && !this.priority.isEmpty();
13200    }
13201
13202    /**
13203     * @param value {@link #priority} (The provider-required urgency of processing the request. Typical values include: stat, routine deferred.)
13204     */
13205    public ExplanationOfBenefit setPriority(CodeableConcept value) { 
13206      this.priority = value;
13207      return this;
13208    }
13209
13210    /**
13211     * @return {@link #fundsReserveRequested} (A code to indicate whether and for whom funds are to be reserved for future claims.)
13212     */
13213    public CodeableConcept getFundsReserveRequested() { 
13214      if (this.fundsReserveRequested == null)
13215        if (Configuration.errorOnAutoCreate())
13216          throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserveRequested");
13217        else if (Configuration.doAutoCreate())
13218          this.fundsReserveRequested = new CodeableConcept(); // cc
13219      return this.fundsReserveRequested;
13220    }
13221
13222    public boolean hasFundsReserveRequested() { 
13223      return this.fundsReserveRequested != null && !this.fundsReserveRequested.isEmpty();
13224    }
13225
13226    /**
13227     * @param value {@link #fundsReserveRequested} (A code to indicate whether and for whom funds are to be reserved for future claims.)
13228     */
13229    public ExplanationOfBenefit setFundsReserveRequested(CodeableConcept value) { 
13230      this.fundsReserveRequested = value;
13231      return this;
13232    }
13233
13234    /**
13235     * @return {@link #fundsReserve} (A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.)
13236     */
13237    public CodeableConcept getFundsReserve() { 
13238      if (this.fundsReserve == null)
13239        if (Configuration.errorOnAutoCreate())
13240          throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserve");
13241        else if (Configuration.doAutoCreate())
13242          this.fundsReserve = new CodeableConcept(); // cc
13243      return this.fundsReserve;
13244    }
13245
13246    public boolean hasFundsReserve() { 
13247      return this.fundsReserve != null && !this.fundsReserve.isEmpty();
13248    }
13249
13250    /**
13251     * @param value {@link #fundsReserve} (A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.)
13252     */
13253    public ExplanationOfBenefit setFundsReserve(CodeableConcept value) { 
13254      this.fundsReserve = value;
13255      return this;
13256    }
13257
13258    /**
13259     * @return {@link #related} (Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.)
13260     */
13261    public List<RelatedClaimComponent> getRelated() { 
13262      if (this.related == null)
13263        this.related = new ArrayList<RelatedClaimComponent>();
13264      return this.related;
13265    }
13266
13267    /**
13268     * @return Returns a reference to <code>this</code> for easy method chaining
13269     */
13270    public ExplanationOfBenefit setRelated(List<RelatedClaimComponent> theRelated) { 
13271      this.related = theRelated;
13272      return this;
13273    }
13274
13275    public boolean hasRelated() { 
13276      if (this.related == null)
13277        return false;
13278      for (RelatedClaimComponent item : this.related)
13279        if (!item.isEmpty())
13280          return true;
13281      return false;
13282    }
13283
13284    public RelatedClaimComponent addRelated() { //3
13285      RelatedClaimComponent t = new RelatedClaimComponent();
13286      if (this.related == null)
13287        this.related = new ArrayList<RelatedClaimComponent>();
13288      this.related.add(t);
13289      return t;
13290    }
13291
13292    public ExplanationOfBenefit addRelated(RelatedClaimComponent t) { //3
13293      if (t == null)
13294        return this;
13295      if (this.related == null)
13296        this.related = new ArrayList<RelatedClaimComponent>();
13297      this.related.add(t);
13298      return this;
13299    }
13300
13301    /**
13302     * @return The first repetition of repeating field {@link #related}, creating it if it does not already exist
13303     */
13304    public RelatedClaimComponent getRelatedFirstRep() { 
13305      if (getRelated().isEmpty()) {
13306        addRelated();
13307      }
13308      return getRelated().get(0);
13309    }
13310
13311    /**
13312     * @return {@link #prescription} (Prescription to support the dispensing of pharmacy, device or vision products.)
13313     */
13314    public Reference getPrescription() { 
13315      if (this.prescription == null)
13316        if (Configuration.errorOnAutoCreate())
13317          throw new Error("Attempt to auto-create ExplanationOfBenefit.prescription");
13318        else if (Configuration.doAutoCreate())
13319          this.prescription = new Reference(); // cc
13320      return this.prescription;
13321    }
13322
13323    public boolean hasPrescription() { 
13324      return this.prescription != null && !this.prescription.isEmpty();
13325    }
13326
13327    /**
13328     * @param value {@link #prescription} (Prescription to support the dispensing of pharmacy, device or vision products.)
13329     */
13330    public ExplanationOfBenefit setPrescription(Reference value) { 
13331      this.prescription = value;
13332      return this;
13333    }
13334
13335    /**
13336     * @return {@link #prescription} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Prescription to support the dispensing of pharmacy, device or vision products.)
13337     */
13338    public Resource getPrescriptionTarget() { 
13339      return this.prescriptionTarget;
13340    }
13341
13342    /**
13343     * @param value {@link #prescription} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Prescription to support the dispensing of pharmacy, device or vision products.)
13344     */
13345    public ExplanationOfBenefit setPrescriptionTarget(Resource value) { 
13346      this.prescriptionTarget = value;
13347      return this;
13348    }
13349
13350    /**
13351     * @return {@link #originalPrescription} (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
13352     */
13353    public Reference getOriginalPrescription() { 
13354      if (this.originalPrescription == null)
13355        if (Configuration.errorOnAutoCreate())
13356          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
13357        else if (Configuration.doAutoCreate())
13358          this.originalPrescription = new Reference(); // cc
13359      return this.originalPrescription;
13360    }
13361
13362    public boolean hasOriginalPrescription() { 
13363      return this.originalPrescription != null && !this.originalPrescription.isEmpty();
13364    }
13365
13366    /**
13367     * @param value {@link #originalPrescription} (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
13368     */
13369    public ExplanationOfBenefit setOriginalPrescription(Reference value) { 
13370      this.originalPrescription = value;
13371      return this;
13372    }
13373
13374    /**
13375     * @return {@link #originalPrescription} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
13376     */
13377    public MedicationRequest getOriginalPrescriptionTarget() { 
13378      if (this.originalPrescriptionTarget == null)
13379        if (Configuration.errorOnAutoCreate())
13380          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
13381        else if (Configuration.doAutoCreate())
13382          this.originalPrescriptionTarget = new MedicationRequest(); // aa
13383      return this.originalPrescriptionTarget;
13384    }
13385
13386    /**
13387     * @param value {@link #originalPrescription} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
13388     */
13389    public ExplanationOfBenefit setOriginalPrescriptionTarget(MedicationRequest value) { 
13390      this.originalPrescriptionTarget = value;
13391      return this;
13392    }
13393
13394    /**
13395     * @return {@link #payee} (The party to be reimbursed for cost of the products and services according to the terms of the policy.)
13396     */
13397    public PayeeComponent getPayee() { 
13398      if (this.payee == null)
13399        if (Configuration.errorOnAutoCreate())
13400          throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
13401        else if (Configuration.doAutoCreate())
13402          this.payee = new PayeeComponent(); // cc
13403      return this.payee;
13404    }
13405
13406    public boolean hasPayee() { 
13407      return this.payee != null && !this.payee.isEmpty();
13408    }
13409
13410    /**
13411     * @param value {@link #payee} (The party to be reimbursed for cost of the products and services according to the terms of the policy.)
13412     */
13413    public ExplanationOfBenefit setPayee(PayeeComponent value) { 
13414      this.payee = value;
13415      return this;
13416    }
13417
13418    /**
13419     * @return {@link #referral} (A reference to a referral resource.)
13420     */
13421    public Reference getReferral() { 
13422      if (this.referral == null)
13423        if (Configuration.errorOnAutoCreate())
13424          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
13425        else if (Configuration.doAutoCreate())
13426          this.referral = new Reference(); // cc
13427      return this.referral;
13428    }
13429
13430    public boolean hasReferral() { 
13431      return this.referral != null && !this.referral.isEmpty();
13432    }
13433
13434    /**
13435     * @param value {@link #referral} (A reference to a referral resource.)
13436     */
13437    public ExplanationOfBenefit setReferral(Reference value) { 
13438      this.referral = value;
13439      return this;
13440    }
13441
13442    /**
13443     * @return {@link #referral} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A reference to a referral resource.)
13444     */
13445    public ServiceRequest getReferralTarget() { 
13446      if (this.referralTarget == null)
13447        if (Configuration.errorOnAutoCreate())
13448          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
13449        else if (Configuration.doAutoCreate())
13450          this.referralTarget = new ServiceRequest(); // aa
13451      return this.referralTarget;
13452    }
13453
13454    /**
13455     * @param value {@link #referral} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A reference to a referral resource.)
13456     */
13457    public ExplanationOfBenefit setReferralTarget(ServiceRequest value) { 
13458      this.referralTarget = value;
13459      return this;
13460    }
13461
13462    /**
13463     * @return {@link #facility} (Facility where the services were provided.)
13464     */
13465    public Reference getFacility() { 
13466      if (this.facility == null)
13467        if (Configuration.errorOnAutoCreate())
13468          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
13469        else if (Configuration.doAutoCreate())
13470          this.facility = new Reference(); // cc
13471      return this.facility;
13472    }
13473
13474    public boolean hasFacility() { 
13475      return this.facility != null && !this.facility.isEmpty();
13476    }
13477
13478    /**
13479     * @param value {@link #facility} (Facility where the services were provided.)
13480     */
13481    public ExplanationOfBenefit setFacility(Reference value) { 
13482      this.facility = value;
13483      return this;
13484    }
13485
13486    /**
13487     * @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.)
13488     */
13489    public Location getFacilityTarget() { 
13490      if (this.facilityTarget == null)
13491        if (Configuration.errorOnAutoCreate())
13492          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
13493        else if (Configuration.doAutoCreate())
13494          this.facilityTarget = new Location(); // aa
13495      return this.facilityTarget;
13496    }
13497
13498    /**
13499     * @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.)
13500     */
13501    public ExplanationOfBenefit setFacilityTarget(Location value) { 
13502      this.facilityTarget = value;
13503      return this;
13504    }
13505
13506    /**
13507     * @return {@link #claim} (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
13508     */
13509    public Reference getClaim() { 
13510      if (this.claim == null)
13511        if (Configuration.errorOnAutoCreate())
13512          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
13513        else if (Configuration.doAutoCreate())
13514          this.claim = new Reference(); // cc
13515      return this.claim;
13516    }
13517
13518    public boolean hasClaim() { 
13519      return this.claim != null && !this.claim.isEmpty();
13520    }
13521
13522    /**
13523     * @param value {@link #claim} (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
13524     */
13525    public ExplanationOfBenefit setClaim(Reference value) { 
13526      this.claim = value;
13527      return this;
13528    }
13529
13530    /**
13531     * @return {@link #claim} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
13532     */
13533    public Claim getClaimTarget() { 
13534      if (this.claimTarget == null)
13535        if (Configuration.errorOnAutoCreate())
13536          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
13537        else if (Configuration.doAutoCreate())
13538          this.claimTarget = new Claim(); // aa
13539      return this.claimTarget;
13540    }
13541
13542    /**
13543     * @param value {@link #claim} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
13544     */
13545    public ExplanationOfBenefit setClaimTarget(Claim value) { 
13546      this.claimTarget = value;
13547      return this;
13548    }
13549
13550    /**
13551     * @return {@link #claimResponse} (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
13552     */
13553    public Reference getClaimResponse() { 
13554      if (this.claimResponse == null)
13555        if (Configuration.errorOnAutoCreate())
13556          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
13557        else if (Configuration.doAutoCreate())
13558          this.claimResponse = new Reference(); // cc
13559      return this.claimResponse;
13560    }
13561
13562    public boolean hasClaimResponse() { 
13563      return this.claimResponse != null && !this.claimResponse.isEmpty();
13564    }
13565
13566    /**
13567     * @param value {@link #claimResponse} (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
13568     */
13569    public ExplanationOfBenefit setClaimResponse(Reference value) { 
13570      this.claimResponse = value;
13571      return this;
13572    }
13573
13574    /**
13575     * @return {@link #claimResponse} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
13576     */
13577    public ClaimResponse getClaimResponseTarget() { 
13578      if (this.claimResponseTarget == null)
13579        if (Configuration.errorOnAutoCreate())
13580          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
13581        else if (Configuration.doAutoCreate())
13582          this.claimResponseTarget = new ClaimResponse(); // aa
13583      return this.claimResponseTarget;
13584    }
13585
13586    /**
13587     * @param value {@link #claimResponse} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
13588     */
13589    public ExplanationOfBenefit setClaimResponseTarget(ClaimResponse value) { 
13590      this.claimResponseTarget = value;
13591      return this;
13592    }
13593
13594    /**
13595     * @return {@link #outcome} (The outcome of the claim, predetermination, or preauthorization processing.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
13596     */
13597    public Enumeration<RemittanceOutcome> getOutcomeElement() { 
13598      if (this.outcome == null)
13599        if (Configuration.errorOnAutoCreate())
13600          throw new Error("Attempt to auto-create ExplanationOfBenefit.outcome");
13601        else if (Configuration.doAutoCreate())
13602          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory()); // bb
13603      return this.outcome;
13604    }
13605
13606    public boolean hasOutcomeElement() { 
13607      return this.outcome != null && !this.outcome.isEmpty();
13608    }
13609
13610    public boolean hasOutcome() { 
13611      return this.outcome != null && !this.outcome.isEmpty();
13612    }
13613
13614    /**
13615     * @param value {@link #outcome} (The outcome of the claim, predetermination, or preauthorization processing.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
13616     */
13617    public ExplanationOfBenefit setOutcomeElement(Enumeration<RemittanceOutcome> value) { 
13618      this.outcome = value;
13619      return this;
13620    }
13621
13622    /**
13623     * @return The outcome of the claim, predetermination, or preauthorization processing.
13624     */
13625    public RemittanceOutcome getOutcome() { 
13626      return this.outcome == null ? null : this.outcome.getValue();
13627    }
13628
13629    /**
13630     * @param value The outcome of the claim, predetermination, or preauthorization processing.
13631     */
13632    public ExplanationOfBenefit setOutcome(RemittanceOutcome value) { 
13633        if (this.outcome == null)
13634          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory());
13635        this.outcome.setValue(value);
13636      return this;
13637    }
13638
13639    /**
13640     * @return {@link #disposition} (A human readable description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
13641     */
13642    public StringType getDispositionElement() { 
13643      if (this.disposition == null)
13644        if (Configuration.errorOnAutoCreate())
13645          throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
13646        else if (Configuration.doAutoCreate())
13647          this.disposition = new StringType(); // bb
13648      return this.disposition;
13649    }
13650
13651    public boolean hasDispositionElement() { 
13652      return this.disposition != null && !this.disposition.isEmpty();
13653    }
13654
13655    public boolean hasDisposition() { 
13656      return this.disposition != null && !this.disposition.isEmpty();
13657    }
13658
13659    /**
13660     * @param value {@link #disposition} (A human readable description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
13661     */
13662    public ExplanationOfBenefit setDispositionElement(StringType value) { 
13663      this.disposition = value;
13664      return this;
13665    }
13666
13667    /**
13668     * @return A human readable description of the status of the adjudication.
13669     */
13670    public String getDisposition() { 
13671      return this.disposition == null ? null : this.disposition.getValue();
13672    }
13673
13674    /**
13675     * @param value A human readable description of the status of the adjudication.
13676     */
13677    public ExplanationOfBenefit setDisposition(String value) { 
13678      if (Utilities.noString(value))
13679        this.disposition = null;
13680      else {
13681        if (this.disposition == null)
13682          this.disposition = new StringType();
13683        this.disposition.setValue(value);
13684      }
13685      return this;
13686    }
13687
13688    /**
13689     * @return {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13690     */
13691    public List<StringType> getPreAuthRef() { 
13692      if (this.preAuthRef == null)
13693        this.preAuthRef = new ArrayList<StringType>();
13694      return this.preAuthRef;
13695    }
13696
13697    /**
13698     * @return Returns a reference to <code>this</code> for easy method chaining
13699     */
13700    public ExplanationOfBenefit setPreAuthRef(List<StringType> thePreAuthRef) { 
13701      this.preAuthRef = thePreAuthRef;
13702      return this;
13703    }
13704
13705    public boolean hasPreAuthRef() { 
13706      if (this.preAuthRef == null)
13707        return false;
13708      for (StringType item : this.preAuthRef)
13709        if (!item.isEmpty())
13710          return true;
13711      return false;
13712    }
13713
13714    /**
13715     * @return {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13716     */
13717    public StringType addPreAuthRefElement() {//2 
13718      StringType t = new StringType();
13719      if (this.preAuthRef == null)
13720        this.preAuthRef = new ArrayList<StringType>();
13721      this.preAuthRef.add(t);
13722      return t;
13723    }
13724
13725    /**
13726     * @param value {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13727     */
13728    public ExplanationOfBenefit addPreAuthRef(String value) { //1
13729      StringType t = new StringType();
13730      t.setValue(value);
13731      if (this.preAuthRef == null)
13732        this.preAuthRef = new ArrayList<StringType>();
13733      this.preAuthRef.add(t);
13734      return this;
13735    }
13736
13737    /**
13738     * @param value {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13739     */
13740    public boolean hasPreAuthRef(String value) { 
13741      if (this.preAuthRef == null)
13742        return false;
13743      for (StringType v : this.preAuthRef)
13744        if (v.getValue().equals(value)) // string
13745          return true;
13746      return false;
13747    }
13748
13749    /**
13750     * @return {@link #preAuthRefPeriod} (The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.)
13751     */
13752    public List<Period> getPreAuthRefPeriod() { 
13753      if (this.preAuthRefPeriod == null)
13754        this.preAuthRefPeriod = new ArrayList<Period>();
13755      return this.preAuthRefPeriod;
13756    }
13757
13758    /**
13759     * @return Returns a reference to <code>this</code> for easy method chaining
13760     */
13761    public ExplanationOfBenefit setPreAuthRefPeriod(List<Period> thePreAuthRefPeriod) { 
13762      this.preAuthRefPeriod = thePreAuthRefPeriod;
13763      return this;
13764    }
13765
13766    public boolean hasPreAuthRefPeriod() { 
13767      if (this.preAuthRefPeriod == null)
13768        return false;
13769      for (Period item : this.preAuthRefPeriod)
13770        if (!item.isEmpty())
13771          return true;
13772      return false;
13773    }
13774
13775    public Period addPreAuthRefPeriod() { //3
13776      Period t = new Period();
13777      if (this.preAuthRefPeriod == null)
13778        this.preAuthRefPeriod = new ArrayList<Period>();
13779      this.preAuthRefPeriod.add(t);
13780      return t;
13781    }
13782
13783    public ExplanationOfBenefit addPreAuthRefPeriod(Period t) { //3
13784      if (t == null)
13785        return this;
13786      if (this.preAuthRefPeriod == null)
13787        this.preAuthRefPeriod = new ArrayList<Period>();
13788      this.preAuthRefPeriod.add(t);
13789      return this;
13790    }
13791
13792    /**
13793     * @return The first repetition of repeating field {@link #preAuthRefPeriod}, creating it if it does not already exist
13794     */
13795    public Period getPreAuthRefPeriodFirstRep() { 
13796      if (getPreAuthRefPeriod().isEmpty()) {
13797        addPreAuthRefPeriod();
13798      }
13799      return getPreAuthRefPeriod().get(0);
13800    }
13801
13802    /**
13803     * @return {@link #careTeam} (The members of the team who provided the products and services.)
13804     */
13805    public List<CareTeamComponent> getCareTeam() { 
13806      if (this.careTeam == null)
13807        this.careTeam = new ArrayList<CareTeamComponent>();
13808      return this.careTeam;
13809    }
13810
13811    /**
13812     * @return Returns a reference to <code>this</code> for easy method chaining
13813     */
13814    public ExplanationOfBenefit setCareTeam(List<CareTeamComponent> theCareTeam) { 
13815      this.careTeam = theCareTeam;
13816      return this;
13817    }
13818
13819    public boolean hasCareTeam() { 
13820      if (this.careTeam == null)
13821        return false;
13822      for (CareTeamComponent item : this.careTeam)
13823        if (!item.isEmpty())
13824          return true;
13825      return false;
13826    }
13827
13828    public CareTeamComponent addCareTeam() { //3
13829      CareTeamComponent t = new CareTeamComponent();
13830      if (this.careTeam == null)
13831        this.careTeam = new ArrayList<CareTeamComponent>();
13832      this.careTeam.add(t);
13833      return t;
13834    }
13835
13836    public ExplanationOfBenefit addCareTeam(CareTeamComponent t) { //3
13837      if (t == null)
13838        return this;
13839      if (this.careTeam == null)
13840        this.careTeam = new ArrayList<CareTeamComponent>();
13841      this.careTeam.add(t);
13842      return this;
13843    }
13844
13845    /**
13846     * @return The first repetition of repeating field {@link #careTeam}, creating it if it does not already exist
13847     */
13848    public CareTeamComponent getCareTeamFirstRep() { 
13849      if (getCareTeam().isEmpty()) {
13850        addCareTeam();
13851      }
13852      return getCareTeam().get(0);
13853    }
13854
13855    /**
13856     * @return {@link #supportingInfo} (Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.)
13857     */
13858    public List<SupportingInformationComponent> getSupportingInfo() { 
13859      if (this.supportingInfo == null)
13860        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13861      return this.supportingInfo;
13862    }
13863
13864    /**
13865     * @return Returns a reference to <code>this</code> for easy method chaining
13866     */
13867    public ExplanationOfBenefit setSupportingInfo(List<SupportingInformationComponent> theSupportingInfo) { 
13868      this.supportingInfo = theSupportingInfo;
13869      return this;
13870    }
13871
13872    public boolean hasSupportingInfo() { 
13873      if (this.supportingInfo == null)
13874        return false;
13875      for (SupportingInformationComponent item : this.supportingInfo)
13876        if (!item.isEmpty())
13877          return true;
13878      return false;
13879    }
13880
13881    public SupportingInformationComponent addSupportingInfo() { //3
13882      SupportingInformationComponent t = new SupportingInformationComponent();
13883      if (this.supportingInfo == null)
13884        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13885      this.supportingInfo.add(t);
13886      return t;
13887    }
13888
13889    public ExplanationOfBenefit addSupportingInfo(SupportingInformationComponent t) { //3
13890      if (t == null)
13891        return this;
13892      if (this.supportingInfo == null)
13893        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13894      this.supportingInfo.add(t);
13895      return this;
13896    }
13897
13898    /**
13899     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist
13900     */
13901    public SupportingInformationComponent getSupportingInfoFirstRep() { 
13902      if (getSupportingInfo().isEmpty()) {
13903        addSupportingInfo();
13904      }
13905      return getSupportingInfo().get(0);
13906    }
13907
13908    /**
13909     * @return {@link #diagnosis} (Information about diagnoses relevant to the claim items.)
13910     */
13911    public List<DiagnosisComponent> getDiagnosis() { 
13912      if (this.diagnosis == null)
13913        this.diagnosis = new ArrayList<DiagnosisComponent>();
13914      return this.diagnosis;
13915    }
13916
13917    /**
13918     * @return Returns a reference to <code>this</code> for easy method chaining
13919     */
13920    public ExplanationOfBenefit setDiagnosis(List<DiagnosisComponent> theDiagnosis) { 
13921      this.diagnosis = theDiagnosis;
13922      return this;
13923    }
13924
13925    public boolean hasDiagnosis() { 
13926      if (this.diagnosis == null)
13927        return false;
13928      for (DiagnosisComponent item : this.diagnosis)
13929        if (!item.isEmpty())
13930          return true;
13931      return false;
13932    }
13933
13934    public DiagnosisComponent addDiagnosis() { //3
13935      DiagnosisComponent t = new DiagnosisComponent();
13936      if (this.diagnosis == null)
13937        this.diagnosis = new ArrayList<DiagnosisComponent>();
13938      this.diagnosis.add(t);
13939      return t;
13940    }
13941
13942    public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { //3
13943      if (t == null)
13944        return this;
13945      if (this.diagnosis == null)
13946        this.diagnosis = new ArrayList<DiagnosisComponent>();
13947      this.diagnosis.add(t);
13948      return this;
13949    }
13950
13951    /**
13952     * @return The first repetition of repeating field {@link #diagnosis}, creating it if it does not already exist
13953     */
13954    public DiagnosisComponent getDiagnosisFirstRep() { 
13955      if (getDiagnosis().isEmpty()) {
13956        addDiagnosis();
13957      }
13958      return getDiagnosis().get(0);
13959    }
13960
13961    /**
13962     * @return {@link #procedure} (Procedures performed on the patient relevant to the billing items with the claim.)
13963     */
13964    public List<ProcedureComponent> getProcedure() { 
13965      if (this.procedure == null)
13966        this.procedure = new ArrayList<ProcedureComponent>();
13967      return this.procedure;
13968    }
13969
13970    /**
13971     * @return Returns a reference to <code>this</code> for easy method chaining
13972     */
13973    public ExplanationOfBenefit setProcedure(List<ProcedureComponent> theProcedure) { 
13974      this.procedure = theProcedure;
13975      return this;
13976    }
13977
13978    public boolean hasProcedure() { 
13979      if (this.procedure == null)
13980        return false;
13981      for (ProcedureComponent item : this.procedure)
13982        if (!item.isEmpty())
13983          return true;
13984      return false;
13985    }
13986
13987    public ProcedureComponent addProcedure() { //3
13988      ProcedureComponent t = new ProcedureComponent();
13989      if (this.procedure == null)
13990        this.procedure = new ArrayList<ProcedureComponent>();
13991      this.procedure.add(t);
13992      return t;
13993    }
13994
13995    public ExplanationOfBenefit addProcedure(ProcedureComponent t) { //3
13996      if (t == null)
13997        return this;
13998      if (this.procedure == null)
13999        this.procedure = new ArrayList<ProcedureComponent>();
14000      this.procedure.add(t);
14001      return this;
14002    }
14003
14004    /**
14005     * @return The first repetition of repeating field {@link #procedure}, creating it if it does not already exist
14006     */
14007    public ProcedureComponent getProcedureFirstRep() { 
14008      if (getProcedure().isEmpty()) {
14009        addProcedure();
14010      }
14011      return getProcedure().get(0);
14012    }
14013
14014    /**
14015     * @return {@link #precedence} (This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.). This is the underlying object with id, value and extensions. The accessor "getPrecedence" gives direct access to the value
14016     */
14017    public PositiveIntType getPrecedenceElement() { 
14018      if (this.precedence == null)
14019        if (Configuration.errorOnAutoCreate())
14020          throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
14021        else if (Configuration.doAutoCreate())
14022          this.precedence = new PositiveIntType(); // bb
14023      return this.precedence;
14024    }
14025
14026    public boolean hasPrecedenceElement() { 
14027      return this.precedence != null && !this.precedence.isEmpty();
14028    }
14029
14030    public boolean hasPrecedence() { 
14031      return this.precedence != null && !this.precedence.isEmpty();
14032    }
14033
14034    /**
14035     * @param value {@link #precedence} (This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.). This is the underlying object with id, value and extensions. The accessor "getPrecedence" gives direct access to the value
14036     */
14037    public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) { 
14038      this.precedence = value;
14039      return this;
14040    }
14041
14042    /**
14043     * @return This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
14044     */
14045    public int getPrecedence() { 
14046      return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
14047    }
14048
14049    /**
14050     * @param value This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
14051     */
14052    public ExplanationOfBenefit setPrecedence(int value) { 
14053        if (this.precedence == null)
14054          this.precedence = new PositiveIntType();
14055        this.precedence.setValue(value);
14056      return this;
14057    }
14058
14059    /**
14060     * @return {@link #insurance} (Financial instruments for reimbursement for the health care products and services specified on the claim.)
14061     */
14062    public List<InsuranceComponent> getInsurance() { 
14063      if (this.insurance == null)
14064        this.insurance = new ArrayList<InsuranceComponent>();
14065      return this.insurance;
14066    }
14067
14068    /**
14069     * @return Returns a reference to <code>this</code> for easy method chaining
14070     */
14071    public ExplanationOfBenefit setInsurance(List<InsuranceComponent> theInsurance) { 
14072      this.insurance = theInsurance;
14073      return this;
14074    }
14075
14076    public boolean hasInsurance() { 
14077      if (this.insurance == null)
14078        return false;
14079      for (InsuranceComponent item : this.insurance)
14080        if (!item.isEmpty())
14081          return true;
14082      return false;
14083    }
14084
14085    public InsuranceComponent addInsurance() { //3
14086      InsuranceComponent t = new InsuranceComponent();
14087      if (this.insurance == null)
14088        this.insurance = new ArrayList<InsuranceComponent>();
14089      this.insurance.add(t);
14090      return t;
14091    }
14092
14093    public ExplanationOfBenefit addInsurance(InsuranceComponent t) { //3
14094      if (t == null)
14095        return this;
14096      if (this.insurance == null)
14097        this.insurance = new ArrayList<InsuranceComponent>();
14098      this.insurance.add(t);
14099      return this;
14100    }
14101
14102    /**
14103     * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist
14104     */
14105    public InsuranceComponent getInsuranceFirstRep() { 
14106      if (getInsurance().isEmpty()) {
14107        addInsurance();
14108      }
14109      return getInsurance().get(0);
14110    }
14111
14112    /**
14113     * @return {@link #accident} (Details of a accident which resulted in injuries which required the products and services listed in the claim.)
14114     */
14115    public AccidentComponent getAccident() { 
14116      if (this.accident == null)
14117        if (Configuration.errorOnAutoCreate())
14118          throw new Error("Attempt to auto-create ExplanationOfBenefit.accident");
14119        else if (Configuration.doAutoCreate())
14120          this.accident = new AccidentComponent(); // cc
14121      return this.accident;
14122    }
14123
14124    public boolean hasAccident() { 
14125      return this.accident != null && !this.accident.isEmpty();
14126    }
14127
14128    /**
14129     * @param value {@link #accident} (Details of a accident which resulted in injuries which required the products and services listed in the claim.)
14130     */
14131    public ExplanationOfBenefit setAccident(AccidentComponent value) { 
14132      this.accident = value;
14133      return this;
14134    }
14135
14136    /**
14137     * @return {@link #item} (A claim line. Either a simple (a product or service) or a 'group' of details which can also be a simple items or groups of sub-details.)
14138     */
14139    public List<ItemComponent> getItem() { 
14140      if (this.item == null)
14141        this.item = new ArrayList<ItemComponent>();
14142      return this.item;
14143    }
14144
14145    /**
14146     * @return Returns a reference to <code>this</code> for easy method chaining
14147     */
14148    public ExplanationOfBenefit setItem(List<ItemComponent> theItem) { 
14149      this.item = theItem;
14150      return this;
14151    }
14152
14153    public boolean hasItem() { 
14154      if (this.item == null)
14155        return false;
14156      for (ItemComponent item : this.item)
14157        if (!item.isEmpty())
14158          return true;
14159      return false;
14160    }
14161
14162    public ItemComponent addItem() { //3
14163      ItemComponent t = new ItemComponent();
14164      if (this.item == null)
14165        this.item = new ArrayList<ItemComponent>();
14166      this.item.add(t);
14167      return t;
14168    }
14169
14170    public ExplanationOfBenefit addItem(ItemComponent t) { //3
14171      if (t == null)
14172        return this;
14173      if (this.item == null)
14174        this.item = new ArrayList<ItemComponent>();
14175      this.item.add(t);
14176      return this;
14177    }
14178
14179    /**
14180     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
14181     */
14182    public ItemComponent getItemFirstRep() { 
14183      if (getItem().isEmpty()) {
14184        addItem();
14185      }
14186      return getItem().get(0);
14187    }
14188
14189    /**
14190     * @return {@link #addItem} (The first-tier service adjudications for payor added product or service lines.)
14191     */
14192    public List<AddedItemComponent> getAddItem() { 
14193      if (this.addItem == null)
14194        this.addItem = new ArrayList<AddedItemComponent>();
14195      return this.addItem;
14196    }
14197
14198    /**
14199     * @return Returns a reference to <code>this</code> for easy method chaining
14200     */
14201    public ExplanationOfBenefit setAddItem(List<AddedItemComponent> theAddItem) { 
14202      this.addItem = theAddItem;
14203      return this;
14204    }
14205
14206    public boolean hasAddItem() { 
14207      if (this.addItem == null)
14208        return false;
14209      for (AddedItemComponent item : this.addItem)
14210        if (!item.isEmpty())
14211          return true;
14212      return false;
14213    }
14214
14215    public AddedItemComponent addAddItem() { //3
14216      AddedItemComponent t = new AddedItemComponent();
14217      if (this.addItem == null)
14218        this.addItem = new ArrayList<AddedItemComponent>();
14219      this.addItem.add(t);
14220      return t;
14221    }
14222
14223    public ExplanationOfBenefit addAddItem(AddedItemComponent t) { //3
14224      if (t == null)
14225        return this;
14226      if (this.addItem == null)
14227        this.addItem = new ArrayList<AddedItemComponent>();
14228      this.addItem.add(t);
14229      return this;
14230    }
14231
14232    /**
14233     * @return The first repetition of repeating field {@link #addItem}, creating it if it does not already exist
14234     */
14235    public AddedItemComponent getAddItemFirstRep() { 
14236      if (getAddItem().isEmpty()) {
14237        addAddItem();
14238      }
14239      return getAddItem().get(0);
14240    }
14241
14242    /**
14243     * @return {@link #adjudication} (The adjudication results which are presented at the header level rather than at the line-item or add-item levels.)
14244     */
14245    public List<AdjudicationComponent> getAdjudication() { 
14246      if (this.adjudication == null)
14247        this.adjudication = new ArrayList<AdjudicationComponent>();
14248      return this.adjudication;
14249    }
14250
14251    /**
14252     * @return Returns a reference to <code>this</code> for easy method chaining
14253     */
14254    public ExplanationOfBenefit setAdjudication(List<AdjudicationComponent> theAdjudication) { 
14255      this.adjudication = theAdjudication;
14256      return this;
14257    }
14258
14259    public boolean hasAdjudication() { 
14260      if (this.adjudication == null)
14261        return false;
14262      for (AdjudicationComponent item : this.adjudication)
14263        if (!item.isEmpty())
14264          return true;
14265      return false;
14266    }
14267
14268    public AdjudicationComponent addAdjudication() { //3
14269      AdjudicationComponent t = new AdjudicationComponent();
14270      if (this.adjudication == null)
14271        this.adjudication = new ArrayList<AdjudicationComponent>();
14272      this.adjudication.add(t);
14273      return t;
14274    }
14275
14276    public ExplanationOfBenefit addAdjudication(AdjudicationComponent t) { //3
14277      if (t == null)
14278        return this;
14279      if (this.adjudication == null)
14280        this.adjudication = new ArrayList<AdjudicationComponent>();
14281      this.adjudication.add(t);
14282      return this;
14283    }
14284
14285    /**
14286     * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
14287     */
14288    public AdjudicationComponent getAdjudicationFirstRep() { 
14289      if (getAdjudication().isEmpty()) {
14290        addAdjudication();
14291      }
14292      return getAdjudication().get(0);
14293    }
14294
14295    /**
14296     * @return {@link #total} (Categorized monetary totals for the adjudication.)
14297     */
14298    public List<TotalComponent> getTotal() { 
14299      if (this.total == null)
14300        this.total = new ArrayList<TotalComponent>();
14301      return this.total;
14302    }
14303
14304    /**
14305     * @return Returns a reference to <code>this</code> for easy method chaining
14306     */
14307    public ExplanationOfBenefit setTotal(List<TotalComponent> theTotal) { 
14308      this.total = theTotal;
14309      return this;
14310    }
14311
14312    public boolean hasTotal() { 
14313      if (this.total == null)
14314        return false;
14315      for (TotalComponent item : this.total)
14316        if (!item.isEmpty())
14317          return true;
14318      return false;
14319    }
14320
14321    public TotalComponent addTotal() { //3
14322      TotalComponent t = new TotalComponent();
14323      if (this.total == null)
14324        this.total = new ArrayList<TotalComponent>();
14325      this.total.add(t);
14326      return t;
14327    }
14328
14329    public ExplanationOfBenefit addTotal(TotalComponent t) { //3
14330      if (t == null)
14331        return this;
14332      if (this.total == null)
14333        this.total = new ArrayList<TotalComponent>();
14334      this.total.add(t);
14335      return this;
14336    }
14337
14338    /**
14339     * @return The first repetition of repeating field {@link #total}, creating it if it does not already exist
14340     */
14341    public TotalComponent getTotalFirstRep() { 
14342      if (getTotal().isEmpty()) {
14343        addTotal();
14344      }
14345      return getTotal().get(0);
14346    }
14347
14348    /**
14349     * @return {@link #payment} (Payment details for the adjudication of the claim.)
14350     */
14351    public PaymentComponent getPayment() { 
14352      if (this.payment == null)
14353        if (Configuration.errorOnAutoCreate())
14354          throw new Error("Attempt to auto-create ExplanationOfBenefit.payment");
14355        else if (Configuration.doAutoCreate())
14356          this.payment = new PaymentComponent(); // cc
14357      return this.payment;
14358    }
14359
14360    public boolean hasPayment() { 
14361      return this.payment != null && !this.payment.isEmpty();
14362    }
14363
14364    /**
14365     * @param value {@link #payment} (Payment details for the adjudication of the claim.)
14366     */
14367    public ExplanationOfBenefit setPayment(PaymentComponent value) { 
14368      this.payment = value;
14369      return this;
14370    }
14371
14372    /**
14373     * @return {@link #formCode} (A code for the form to be used for printing the content.)
14374     */
14375    public CodeableConcept getFormCode() { 
14376      if (this.formCode == null)
14377        if (Configuration.errorOnAutoCreate())
14378          throw new Error("Attempt to auto-create ExplanationOfBenefit.formCode");
14379        else if (Configuration.doAutoCreate())
14380          this.formCode = new CodeableConcept(); // cc
14381      return this.formCode;
14382    }
14383
14384    public boolean hasFormCode() { 
14385      return this.formCode != null && !this.formCode.isEmpty();
14386    }
14387
14388    /**
14389     * @param value {@link #formCode} (A code for the form to be used for printing the content.)
14390     */
14391    public ExplanationOfBenefit setFormCode(CodeableConcept value) { 
14392      this.formCode = value;
14393      return this;
14394    }
14395
14396    /**
14397     * @return {@link #form} (The actual form, by reference or inclusion, for printing the content or an EOB.)
14398     */
14399    public Attachment getForm() { 
14400      if (this.form == null)
14401        if (Configuration.errorOnAutoCreate())
14402          throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
14403        else if (Configuration.doAutoCreate())
14404          this.form = new Attachment(); // cc
14405      return this.form;
14406    }
14407
14408    public boolean hasForm() { 
14409      return this.form != null && !this.form.isEmpty();
14410    }
14411
14412    /**
14413     * @param value {@link #form} (The actual form, by reference or inclusion, for printing the content or an EOB.)
14414     */
14415    public ExplanationOfBenefit setForm(Attachment value) { 
14416      this.form = value;
14417      return this;
14418    }
14419
14420    /**
14421     * @return {@link #processNote} (A note that describes or explains adjudication results in a human readable form.)
14422     */
14423    public List<NoteComponent> getProcessNote() { 
14424      if (this.processNote == null)
14425        this.processNote = new ArrayList<NoteComponent>();
14426      return this.processNote;
14427    }
14428
14429    /**
14430     * @return Returns a reference to <code>this</code> for easy method chaining
14431     */
14432    public ExplanationOfBenefit setProcessNote(List<NoteComponent> theProcessNote) { 
14433      this.processNote = theProcessNote;
14434      return this;
14435    }
14436
14437    public boolean hasProcessNote() { 
14438      if (this.processNote == null)
14439        return false;
14440      for (NoteComponent item : this.processNote)
14441        if (!item.isEmpty())
14442          return true;
14443      return false;
14444    }
14445
14446    public NoteComponent addProcessNote() { //3
14447      NoteComponent t = new NoteComponent();
14448      if (this.processNote == null)
14449        this.processNote = new ArrayList<NoteComponent>();
14450      this.processNote.add(t);
14451      return t;
14452    }
14453
14454    public ExplanationOfBenefit addProcessNote(NoteComponent t) { //3
14455      if (t == null)
14456        return this;
14457      if (this.processNote == null)
14458        this.processNote = new ArrayList<NoteComponent>();
14459      this.processNote.add(t);
14460      return this;
14461    }
14462
14463    /**
14464     * @return The first repetition of repeating field {@link #processNote}, creating it if it does not already exist
14465     */
14466    public NoteComponent getProcessNoteFirstRep() { 
14467      if (getProcessNote().isEmpty()) {
14468        addProcessNote();
14469      }
14470      return getProcessNote().get(0);
14471    }
14472
14473    /**
14474     * @return {@link #benefitPeriod} (The term of the benefits documented in this response.)
14475     */
14476    public Period getBenefitPeriod() { 
14477      if (this.benefitPeriod == null)
14478        if (Configuration.errorOnAutoCreate())
14479          throw new Error("Attempt to auto-create ExplanationOfBenefit.benefitPeriod");
14480        else if (Configuration.doAutoCreate())
14481          this.benefitPeriod = new Period(); // cc
14482      return this.benefitPeriod;
14483    }
14484
14485    public boolean hasBenefitPeriod() { 
14486      return this.benefitPeriod != null && !this.benefitPeriod.isEmpty();
14487    }
14488
14489    /**
14490     * @param value {@link #benefitPeriod} (The term of the benefits documented in this response.)
14491     */
14492    public ExplanationOfBenefit setBenefitPeriod(Period value) { 
14493      this.benefitPeriod = value;
14494      return this;
14495    }
14496
14497    /**
14498     * @return {@link #benefitBalance} (Balance by Benefit Category.)
14499     */
14500    public List<BenefitBalanceComponent> getBenefitBalance() { 
14501      if (this.benefitBalance == null)
14502        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14503      return this.benefitBalance;
14504    }
14505
14506    /**
14507     * @return Returns a reference to <code>this</code> for easy method chaining
14508     */
14509    public ExplanationOfBenefit setBenefitBalance(List<BenefitBalanceComponent> theBenefitBalance) { 
14510      this.benefitBalance = theBenefitBalance;
14511      return this;
14512    }
14513
14514    public boolean hasBenefitBalance() { 
14515      if (this.benefitBalance == null)
14516        return false;
14517      for (BenefitBalanceComponent item : this.benefitBalance)
14518        if (!item.isEmpty())
14519          return true;
14520      return false;
14521    }
14522
14523    public BenefitBalanceComponent addBenefitBalance() { //3
14524      BenefitBalanceComponent t = new BenefitBalanceComponent();
14525      if (this.benefitBalance == null)
14526        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14527      this.benefitBalance.add(t);
14528      return t;
14529    }
14530
14531    public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { //3
14532      if (t == null)
14533        return this;
14534      if (this.benefitBalance == null)
14535        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14536      this.benefitBalance.add(t);
14537      return this;
14538    }
14539
14540    /**
14541     * @return The first repetition of repeating field {@link #benefitBalance}, creating it if it does not already exist
14542     */
14543    public BenefitBalanceComponent getBenefitBalanceFirstRep() { 
14544      if (getBenefitBalance().isEmpty()) {
14545        addBenefitBalance();
14546      }
14547      return getBenefitBalance().get(0);
14548    }
14549
14550      protected void listChildren(List<Property> children) {
14551        super.listChildren(children);
14552        children.add(new Property("identifier", "Identifier", "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier));
14553        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
14554        children.add(new Property("type", "CodeableConcept", "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type));
14555        children.add(new Property("subType", "CodeableConcept", "A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.", 0, 1, subType));
14556        children.add(new Property("use", "code", "A code to indicate whether the nature of the request is: to request adjudication of products and services previously rendered; or requesting authorization and adjudication for provision in the future; or requesting the non-binding adjudication of the listed products and services which could be provided in the future.", 0, 1, use));
14557        children.add(new Property("patient", "Reference(Patient)", "The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for forecast reimbursement is sought.", 0, 1, patient));
14558        children.add(new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1, billablePeriod));
14559        children.add(new Property("created", "dateTime", "The date this resource was created.", 0, 1, created));
14560        children.add(new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer));
14561        children.add(new Property("insurer", "Reference(Organization)", "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer));
14562        children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider));
14563        children.add(new Property("priority", "CodeableConcept", "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.", 0, 1, priority));
14564        children.add(new Property("fundsReserveRequested", "CodeableConcept", "A code to indicate whether and for whom funds are to be reserved for future claims.", 0, 1, fundsReserveRequested));
14565        children.add(new Property("fundsReserve", "CodeableConcept", "A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.", 0, 1, fundsReserve));
14566        children.add(new Property("related", "", "Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.", 0, java.lang.Integer.MAX_VALUE, related));
14567        children.add(new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription));
14568        children.add(new Property("originalPrescription", "Reference(MedicationRequest)", "Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.", 0, 1, originalPrescription));
14569        children.add(new Property("payee", "", "The party to be reimbursed for cost of the products and services according to the terms of the policy.", 0, 1, payee));
14570        children.add(new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral));
14571        children.add(new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility));
14572        children.add(new Property("claim", "Reference(Claim)", "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.", 0, 1, claim));
14573        children.add(new Property("claimResponse", "Reference(ClaimResponse)", "The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.", 0, 1, claimResponse));
14574        children.add(new Property("outcome", "code", "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome));
14575        children.add(new Property("disposition", "string", "A human readable description of the status of the adjudication.", 0, 1, disposition));
14576        children.add(new Property("preAuthRef", "string", "Reference from the Insurer which is used in later communications which refers to this adjudication.", 0, java.lang.Integer.MAX_VALUE, preAuthRef));
14577        children.add(new Property("preAuthRefPeriod", "Period", "The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.", 0, java.lang.Integer.MAX_VALUE, preAuthRefPeriod));
14578        children.add(new Property("careTeam", "", "The members of the team who provided the products and services.", 0, java.lang.Integer.MAX_VALUE, careTeam));
14579        children.add(new Property("supportingInfo", "", "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.", 0, java.lang.Integer.MAX_VALUE, supportingInfo));
14580        children.add(new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
14581        children.add(new Property("procedure", "", "Procedures performed on the patient relevant to the billing items with the claim.", 0, java.lang.Integer.MAX_VALUE, procedure));
14582        children.add(new Property("precedence", "positiveInt", "This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.", 0, 1, precedence));
14583        children.add(new Property("insurance", "", "Financial instruments for reimbursement for the health care products and services specified on the claim.", 0, java.lang.Integer.MAX_VALUE, insurance));
14584        children.add(new Property("accident", "", "Details of a accident which resulted in injuries which required the products and services listed in the claim.", 0, 1, accident));
14585        children.add(new Property("item", "", "A claim line. Either a simple (a product or service) or a 'group' of details which can also be a simple items or groups of sub-details.", 0, java.lang.Integer.MAX_VALUE, item));
14586        children.add(new Property("addItem", "", "The first-tier service adjudications for payor added product or service lines.", 0, java.lang.Integer.MAX_VALUE, addItem));
14587        children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results which are presented at the header level rather than at the line-item or add-item levels.", 0, java.lang.Integer.MAX_VALUE, adjudication));
14588        children.add(new Property("total", "", "Categorized monetary totals for the adjudication.", 0, java.lang.Integer.MAX_VALUE, total));
14589        children.add(new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment));
14590        children.add(new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.", 0, 1, formCode));
14591        children.add(new Property("form", "Attachment", "The actual form, by reference or inclusion, for printing the content or an EOB.", 0, 1, form));
14592        children.add(new Property("processNote", "", "A note that describes or explains adjudication results in a human readable form.", 0, java.lang.Integer.MAX_VALUE, processNote));
14593        children.add(new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1, benefitPeriod));
14594        children.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance));
14595      }
14596
14597      @Override
14598      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
14599        switch (_hash) {
14600        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier);
14601        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
14602        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type);
14603        case -1868521062: /*subType*/  return new Property("subType", "CodeableConcept", "A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.", 0, 1, subType);
14604        case 116103: /*use*/  return new Property("use", "code", "A code to indicate whether the nature of the request is: to request adjudication of products and services previously rendered; or requesting authorization and adjudication for provision in the future; or requesting the non-binding adjudication of the listed products and services which could be provided in the future.", 0, 1, use);
14605        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for forecast reimbursement is sought.", 0, 1, patient);
14606        case -332066046: /*billablePeriod*/  return new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1, billablePeriod);
14607        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date this resource was created.", 0, 1, created);
14608        case -1591951995: /*enterer*/  return new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer);
14609        case 1957615864: /*insurer*/  return new Property("insurer", "Reference(Organization)", "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer);
14610        case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider);
14611        case -1165461084: /*priority*/  return new Property("priority", "CodeableConcept", "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.", 0, 1, priority);
14612        case -1688904576: /*fundsReserveRequested*/  return new Property("fundsReserveRequested", "CodeableConcept", "A code to indicate whether and for whom funds are to be reserved for future claims.", 0, 1, fundsReserveRequested);
14613        case 1314609806: /*fundsReserve*/  return new Property("fundsReserve", "CodeableConcept", "A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.", 0, 1, fundsReserve);
14614        case 1090493483: /*related*/  return new Property("related", "", "Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.", 0, java.lang.Integer.MAX_VALUE, related);
14615        case 460301338: /*prescription*/  return new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription);
14616        case -1814015861: /*originalPrescription*/  return new Property("originalPrescription", "Reference(MedicationRequest)", "Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.", 0, 1, originalPrescription);
14617        case 106443592: /*payee*/  return new Property("payee", "", "The party to be reimbursed for cost of the products and services according to the terms of the policy.", 0, 1, payee);
14618        case -722568291: /*referral*/  return new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral);
14619        case 501116579: /*facility*/  return new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility);
14620        case 94742588: /*claim*/  return new Property("claim", "Reference(Claim)", "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.", 0, 1, claim);
14621        case 689513629: /*claimResponse*/  return new Property("claimResponse", "Reference(ClaimResponse)", "The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.", 0, 1, claimResponse);
14622        case -1106507950: /*outcome*/  return new Property("outcome", "code", "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome);
14623        case 583380919: /*disposition*/  return new Property("disposition", "string", "A human readable description of the status of the adjudication.", 0, 1, disposition);
14624        case 522246568: /*preAuthRef*/  return new Property("preAuthRef", "string", "Reference from the Insurer which is used in later communications which refers to this adjudication.", 0, java.lang.Integer.MAX_VALUE, preAuthRef);
14625        case -1262920311: /*preAuthRefPeriod*/  return new Property("preAuthRefPeriod", "Period", "The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.", 0, java.lang.Integer.MAX_VALUE, preAuthRefPeriod);
14626        case -7323378: /*careTeam*/  return new Property("careTeam", "", "The members of the team who provided the products and services.", 0, java.lang.Integer.MAX_VALUE, careTeam);
14627        case 1922406657: /*supportingInfo*/  return new Property("supportingInfo", "", "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.", 0, java.lang.Integer.MAX_VALUE, supportingInfo);
14628        case 1196993265: /*diagnosis*/  return new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0, java.lang.Integer.MAX_VALUE, diagnosis);
14629        case -1095204141: /*procedure*/  return new Property("procedure", "", "Procedures performed on the patient relevant to the billing items with the claim.", 0, java.lang.Integer.MAX_VALUE, procedure);
14630        case 159695370: /*precedence*/  return new Property("precedence", "positiveInt", "This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.", 0, 1, precedence);
14631        case 73049818: /*insurance*/  return new Property("insurance", "", "Financial instruments for reimbursement for the health care products and services specified on the claim.", 0, java.lang.Integer.MAX_VALUE, insurance);
14632        case -2143202801: /*accident*/  return new Property("accident", "", "Details of a accident which resulted in injuries which required the products and services listed in the claim.", 0, 1, accident);
14633        case 3242771: /*item*/  return new Property("item", "", "A claim line. Either a simple (a product or service) or a 'group' of details which can also be a simple items or groups of sub-details.", 0, java.lang.Integer.MAX_VALUE, item);
14634        case -1148899500: /*addItem*/  return new Property("addItem", "", "The first-tier service adjudications for payor added product or service lines.", 0, java.lang.Integer.MAX_VALUE, addItem);
14635        case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results which are presented at the header level rather than at the line-item or add-item levels.", 0, java.lang.Integer.MAX_VALUE, adjudication);
14636        case 110549828: /*total*/  return new Property("total", "", "Categorized monetary totals for the adjudication.", 0, java.lang.Integer.MAX_VALUE, total);
14637        case -786681338: /*payment*/  return new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment);
14638        case 473181393: /*formCode*/  return new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.", 0, 1, formCode);
14639        case 3148996: /*form*/  return new Property("form", "Attachment", "The actual form, by reference or inclusion, for printing the content or an EOB.", 0, 1, form);
14640        case 202339073: /*processNote*/  return new Property("processNote", "", "A note that describes or explains adjudication results in a human readable form.", 0, java.lang.Integer.MAX_VALUE, processNote);
14641        case -407369416: /*benefitPeriod*/  return new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1, benefitPeriod);
14642        case 596003397: /*benefitBalance*/  return new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance);
14643        default: return super.getNamedProperty(_hash, _name, _checkValid);
14644        }
14645
14646      }
14647
14648      @Override
14649      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
14650        switch (hash) {
14651        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
14652        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ExplanationOfBenefitStatus>
14653        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
14654        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
14655        case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<Use>
14656        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
14657        case -332066046: /*billablePeriod*/ return this.billablePeriod == null ? new Base[0] : new Base[] {this.billablePeriod}; // Period
14658        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
14659        case -1591951995: /*enterer*/ return this.enterer == null ? new Base[0] : new Base[] {this.enterer}; // Reference
14660        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
14661        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
14662        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
14663        case -1688904576: /*fundsReserveRequested*/ return this.fundsReserveRequested == null ? new Base[0] : new Base[] {this.fundsReserveRequested}; // CodeableConcept
14664        case 1314609806: /*fundsReserve*/ return this.fundsReserve == null ? new Base[0] : new Base[] {this.fundsReserve}; // CodeableConcept
14665        case 1090493483: /*related*/ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimComponent
14666        case 460301338: /*prescription*/ return this.prescription == null ? new Base[0] : new Base[] {this.prescription}; // Reference
14667        case -1814015861: /*originalPrescription*/ return this.originalPrescription == null ? new Base[0] : new Base[] {this.originalPrescription}; // Reference
14668        case 106443592: /*payee*/ return this.payee == null ? new Base[0] : new Base[] {this.payee}; // PayeeComponent
14669        case -722568291: /*referral*/ return this.referral == null ? new Base[0] : new Base[] {this.referral}; // Reference
14670        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Reference
14671        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
14672        case 689513629: /*claimResponse*/ return this.claimResponse == null ? new Base[0] : new Base[] {this.claimResponse}; // Reference
14673        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // Enumeration<RemittanceOutcome>
14674        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
14675        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
14676        case -1262920311: /*preAuthRefPeriod*/ return this.preAuthRefPeriod == null ? new Base[0] : this.preAuthRefPeriod.toArray(new Base[this.preAuthRefPeriod.size()]); // Period
14677        case -7323378: /*careTeam*/ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // CareTeamComponent
14678        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // SupportingInformationComponent
14679        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
14680        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
14681        case 159695370: /*precedence*/ return this.precedence == null ? new Base[0] : new Base[] {this.precedence}; // PositiveIntType
14682        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // InsuranceComponent
14683        case -2143202801: /*accident*/ return this.accident == null ? new Base[0] : new Base[] {this.accident}; // AccidentComponent
14684        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
14685        case -1148899500: /*addItem*/ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
14686        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
14687        case 110549828: /*total*/ return this.total == null ? new Base[0] : this.total.toArray(new Base[this.total.size()]); // TotalComponent
14688        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // PaymentComponent
14689        case 473181393: /*formCode*/ return this.formCode == null ? new Base[0] : new Base[] {this.formCode}; // CodeableConcept
14690        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // Attachment
14691        case 202339073: /*processNote*/ return this.processNote == null ? new Base[0] : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
14692        case -407369416: /*benefitPeriod*/ return this.benefitPeriod == null ? new Base[0] : new Base[] {this.benefitPeriod}; // Period
14693        case 596003397: /*benefitBalance*/ return this.benefitBalance == null ? new Base[0] : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
14694        default: return super.getProperty(hash, name, checkValid);
14695        }
14696
14697      }
14698
14699      @Override
14700      public Base setProperty(int hash, String name, Base value) throws FHIRException {
14701        switch (hash) {
14702        case -1618432855: // identifier
14703          this.getIdentifier().add(castToIdentifier(value)); // Identifier
14704          return value;
14705        case -892481550: // status
14706          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
14707          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
14708          return value;
14709        case 3575610: // type
14710          this.type = castToCodeableConcept(value); // CodeableConcept
14711          return value;
14712        case -1868521062: // subType
14713          this.subType = castToCodeableConcept(value); // CodeableConcept
14714          return value;
14715        case 116103: // use
14716          value = new UseEnumFactory().fromType(castToCode(value));
14717          this.use = (Enumeration) value; // Enumeration<Use>
14718          return value;
14719        case -791418107: // patient
14720          this.patient = castToReference(value); // Reference
14721          return value;
14722        case -332066046: // billablePeriod
14723          this.billablePeriod = castToPeriod(value); // Period
14724          return value;
14725        case 1028554472: // created
14726          this.created = castToDateTime(value); // DateTimeType
14727          return value;
14728        case -1591951995: // enterer
14729          this.enterer = castToReference(value); // Reference
14730          return value;
14731        case 1957615864: // insurer
14732          this.insurer = castToReference(value); // Reference
14733          return value;
14734        case -987494927: // provider
14735          this.provider = castToReference(value); // Reference
14736          return value;
14737        case -1165461084: // priority
14738          this.priority = castToCodeableConcept(value); // CodeableConcept
14739          return value;
14740        case -1688904576: // fundsReserveRequested
14741          this.fundsReserveRequested = castToCodeableConcept(value); // CodeableConcept
14742          return value;
14743        case 1314609806: // fundsReserve
14744          this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
14745          return value;
14746        case 1090493483: // related
14747          this.getRelated().add((RelatedClaimComponent) value); // RelatedClaimComponent
14748          return value;
14749        case 460301338: // prescription
14750          this.prescription = castToReference(value); // Reference
14751          return value;
14752        case -1814015861: // originalPrescription
14753          this.originalPrescription = castToReference(value); // Reference
14754          return value;
14755        case 106443592: // payee
14756          this.payee = (PayeeComponent) value; // PayeeComponent
14757          return value;
14758        case -722568291: // referral
14759          this.referral = castToReference(value); // Reference
14760          return value;
14761        case 501116579: // facility
14762          this.facility = castToReference(value); // Reference
14763          return value;
14764        case 94742588: // claim
14765          this.claim = castToReference(value); // Reference
14766          return value;
14767        case 689513629: // claimResponse
14768          this.claimResponse = castToReference(value); // Reference
14769          return value;
14770        case -1106507950: // outcome
14771          value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
14772          this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
14773          return value;
14774        case 583380919: // disposition
14775          this.disposition = castToString(value); // StringType
14776          return value;
14777        case 522246568: // preAuthRef
14778          this.getPreAuthRef().add(castToString(value)); // StringType
14779          return value;
14780        case -1262920311: // preAuthRefPeriod
14781          this.getPreAuthRefPeriod().add(castToPeriod(value)); // Period
14782          return value;
14783        case -7323378: // careTeam
14784          this.getCareTeam().add((CareTeamComponent) value); // CareTeamComponent
14785          return value;
14786        case 1922406657: // supportingInfo
14787          this.getSupportingInfo().add((SupportingInformationComponent) value); // SupportingInformationComponent
14788          return value;
14789        case 1196993265: // diagnosis
14790          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
14791          return value;
14792        case -1095204141: // procedure
14793          this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
14794          return value;
14795        case 159695370: // precedence
14796          this.precedence = castToPositiveInt(value); // PositiveIntType
14797          return value;
14798        case 73049818: // insurance
14799          this.getInsurance().add((InsuranceComponent) value); // InsuranceComponent
14800          return value;
14801        case -2143202801: // accident
14802          this.accident = (AccidentComponent) value; // AccidentComponent
14803          return value;
14804        case 3242771: // item
14805          this.getItem().add((ItemComponent) value); // ItemComponent
14806          return value;
14807        case -1148899500: // addItem
14808          this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
14809          return value;
14810        case -231349275: // adjudication
14811          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
14812          return value;
14813        case 110549828: // total
14814          this.getTotal().add((TotalComponent) value); // TotalComponent
14815          return value;
14816        case -786681338: // payment
14817          this.payment = (PaymentComponent) value; // PaymentComponent
14818          return value;
14819        case 473181393: // formCode
14820          this.formCode = castToCodeableConcept(value); // CodeableConcept
14821          return value;
14822        case 3148996: // form
14823          this.form = castToAttachment(value); // Attachment
14824          return value;
14825        case 202339073: // processNote
14826          this.getProcessNote().add((NoteComponent) value); // NoteComponent
14827          return value;
14828        case -407369416: // benefitPeriod
14829          this.benefitPeriod = castToPeriod(value); // Period
14830          return value;
14831        case 596003397: // benefitBalance
14832          this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
14833          return value;
14834        default: return super.setProperty(hash, name, value);
14835        }
14836
14837      }
14838
14839      @Override
14840      public Base setProperty(String name, Base value) throws FHIRException {
14841        if (name.equals("identifier")) {
14842          this.getIdentifier().add(castToIdentifier(value));
14843        } else if (name.equals("status")) {
14844          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
14845          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
14846        } else if (name.equals("type")) {
14847          this.type = castToCodeableConcept(value); // CodeableConcept
14848        } else if (name.equals("subType")) {
14849          this.subType = castToCodeableConcept(value); // CodeableConcept
14850        } else if (name.equals("use")) {
14851          value = new UseEnumFactory().fromType(castToCode(value));
14852          this.use = (Enumeration) value; // Enumeration<Use>
14853        } else if (name.equals("patient")) {
14854          this.patient = castToReference(value); // Reference
14855        } else if (name.equals("billablePeriod")) {
14856          this.billablePeriod = castToPeriod(value); // Period
14857        } else if (name.equals("created")) {
14858          this.created = castToDateTime(value); // DateTimeType
14859        } else if (name.equals("enterer")) {
14860          this.enterer = castToReference(value); // Reference
14861        } else if (name.equals("insurer")) {
14862          this.insurer = castToReference(value); // Reference
14863        } else if (name.equals("provider")) {
14864          this.provider = castToReference(value); // Reference
14865        } else if (name.equals("priority")) {
14866          this.priority = castToCodeableConcept(value); // CodeableConcept
14867        } else if (name.equals("fundsReserveRequested")) {
14868          this.fundsReserveRequested = castToCodeableConcept(value); // CodeableConcept
14869        } else if (name.equals("fundsReserve")) {
14870          this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
14871        } else if (name.equals("related")) {
14872          this.getRelated().add((RelatedClaimComponent) value);
14873        } else if (name.equals("prescription")) {
14874          this.prescription = castToReference(value); // Reference
14875        } else if (name.equals("originalPrescription")) {
14876          this.originalPrescription = castToReference(value); // Reference
14877        } else if (name.equals("payee")) {
14878          this.payee = (PayeeComponent) value; // PayeeComponent
14879        } else if (name.equals("referral")) {
14880          this.referral = castToReference(value); // Reference
14881        } else if (name.equals("facility")) {
14882          this.facility = castToReference(value); // Reference
14883        } else if (name.equals("claim")) {
14884          this.claim = castToReference(value); // Reference
14885        } else if (name.equals("claimResponse")) {
14886          this.claimResponse = castToReference(value); // Reference
14887        } else if (name.equals("outcome")) {
14888          value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
14889          this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
14890        } else if (name.equals("disposition")) {
14891          this.disposition = castToString(value); // StringType
14892        } else if (name.equals("preAuthRef")) {
14893          this.getPreAuthRef().add(castToString(value));
14894        } else if (name.equals("preAuthRefPeriod")) {
14895          this.getPreAuthRefPeriod().add(castToPeriod(value));
14896        } else if (name.equals("careTeam")) {
14897          this.getCareTeam().add((CareTeamComponent) value);
14898        } else if (name.equals("supportingInfo")) {
14899          this.getSupportingInfo().add((SupportingInformationComponent) value);
14900        } else if (name.equals("diagnosis")) {
14901          this.getDiagnosis().add((DiagnosisComponent) value);
14902        } else if (name.equals("procedure")) {
14903          this.getProcedure().add((ProcedureComponent) value);
14904        } else if (name.equals("precedence")) {
14905          this.precedence = castToPositiveInt(value); // PositiveIntType
14906        } else if (name.equals("insurance")) {
14907          this.getInsurance().add((InsuranceComponent) value);
14908        } else if (name.equals("accident")) {
14909          this.accident = (AccidentComponent) value; // AccidentComponent
14910        } else if (name.equals("item")) {
14911          this.getItem().add((ItemComponent) value);
14912        } else if (name.equals("addItem")) {
14913          this.getAddItem().add((AddedItemComponent) value);
14914        } else if (name.equals("adjudication")) {
14915          this.getAdjudication().add((AdjudicationComponent) value);
14916        } else if (name.equals("total")) {
14917          this.getTotal().add((TotalComponent) value);
14918        } else if (name.equals("payment")) {
14919          this.payment = (PaymentComponent) value; // PaymentComponent
14920        } else if (name.equals("formCode")) {
14921          this.formCode = castToCodeableConcept(value); // CodeableConcept
14922        } else if (name.equals("form")) {
14923          this.form = castToAttachment(value); // Attachment
14924        } else if (name.equals("processNote")) {
14925          this.getProcessNote().add((NoteComponent) value);
14926        } else if (name.equals("benefitPeriod")) {
14927          this.benefitPeriod = castToPeriod(value); // Period
14928        } else if (name.equals("benefitBalance")) {
14929          this.getBenefitBalance().add((BenefitBalanceComponent) value);
14930        } else
14931          return super.setProperty(name, value);
14932        return value;
14933      }
14934
14935      @Override
14936      public Base makeProperty(int hash, String name) throws FHIRException {
14937        switch (hash) {
14938        case -1618432855:  return addIdentifier(); 
14939        case -892481550:  return getStatusElement();
14940        case 3575610:  return getType(); 
14941        case -1868521062:  return getSubType(); 
14942        case 116103:  return getUseElement();
14943        case -791418107:  return getPatient(); 
14944        case -332066046:  return getBillablePeriod(); 
14945        case 1028554472:  return getCreatedElement();
14946        case -1591951995:  return getEnterer(); 
14947        case 1957615864:  return getInsurer(); 
14948        case -987494927:  return getProvider(); 
14949        case -1165461084:  return getPriority(); 
14950        case -1688904576:  return getFundsReserveRequested(); 
14951        case 1314609806:  return getFundsReserve(); 
14952        case 1090493483:  return addRelated(); 
14953        case 460301338:  return getPrescription(); 
14954        case -1814015861:  return getOriginalPrescription(); 
14955        case 106443592:  return getPayee(); 
14956        case -722568291:  return getReferral(); 
14957        case 501116579:  return getFacility(); 
14958        case 94742588:  return getClaim(); 
14959        case 689513629:  return getClaimResponse(); 
14960        case -1106507950:  return getOutcomeElement();
14961        case 583380919:  return getDispositionElement();
14962        case 522246568:  return addPreAuthRefElement();
14963        case -1262920311:  return addPreAuthRefPeriod(); 
14964        case -7323378:  return addCareTeam(); 
14965        case 1922406657:  return addSupportingInfo(); 
14966        case 1196993265:  return addDiagnosis(); 
14967        case -1095204141:  return addProcedure(); 
14968        case 159695370:  return getPrecedenceElement();
14969        case 73049818:  return addInsurance(); 
14970        case -2143202801:  return getAccident(); 
14971        case 3242771:  return addItem(); 
14972        case -1148899500:  return addAddItem(); 
14973        case -231349275:  return addAdjudication(); 
14974        case 110549828:  return addTotal(); 
14975        case -786681338:  return getPayment(); 
14976        case 473181393:  return getFormCode(); 
14977        case 3148996:  return getForm(); 
14978        case 202339073:  return addProcessNote(); 
14979        case -407369416:  return getBenefitPeriod(); 
14980        case 596003397:  return addBenefitBalance(); 
14981        default: return super.makeProperty(hash, name);
14982        }
14983
14984      }
14985
14986      @Override
14987      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
14988        switch (hash) {
14989        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
14990        case -892481550: /*status*/ return new String[] {"code"};
14991        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
14992        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
14993        case 116103: /*use*/ return new String[] {"code"};
14994        case -791418107: /*patient*/ return new String[] {"Reference"};
14995        case -332066046: /*billablePeriod*/ return new String[] {"Period"};
14996        case 1028554472: /*created*/ return new String[] {"dateTime"};
14997        case -1591951995: /*enterer*/ return new String[] {"Reference"};
14998        case 1957615864: /*insurer*/ return new String[] {"Reference"};
14999        case -987494927: /*provider*/ return new String[] {"Reference"};
15000        case -1165461084: /*priority*/ return new String[] {"CodeableConcept"};
15001        case -1688904576: /*fundsReserveRequested*/ return new String[] {"CodeableConcept"};
15002        case 1314609806: /*fundsReserve*/ return new String[] {"CodeableConcept"};
15003        case 1090493483: /*related*/ return new String[] {};
15004        case 460301338: /*prescription*/ return new String[] {"Reference"};
15005        case -1814015861: /*originalPrescription*/ return new String[] {"Reference"};
15006        case 106443592: /*payee*/ return new String[] {};
15007        case -722568291: /*referral*/ return new String[] {"Reference"};
15008        case 501116579: /*facility*/ return new String[] {"Reference"};
15009        case 94742588: /*claim*/ return new String[] {"Reference"};
15010        case 689513629: /*claimResponse*/ return new String[] {"Reference"};
15011        case -1106507950: /*outcome*/ return new String[] {"code"};
15012        case 583380919: /*disposition*/ return new String[] {"string"};
15013        case 522246568: /*preAuthRef*/ return new String[] {"string"};
15014        case -1262920311: /*preAuthRefPeriod*/ return new String[] {"Period"};
15015        case -7323378: /*careTeam*/ return new String[] {};
15016        case 1922406657: /*supportingInfo*/ return new String[] {};
15017        case 1196993265: /*diagnosis*/ return new String[] {};
15018        case -1095204141: /*procedure*/ return new String[] {};
15019        case 159695370: /*precedence*/ return new String[] {"positiveInt"};
15020        case 73049818: /*insurance*/ return new String[] {};
15021        case -2143202801: /*accident*/ return new String[] {};
15022        case 3242771: /*item*/ return new String[] {};
15023        case -1148899500: /*addItem*/ return new String[] {};
15024        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
15025        case 110549828: /*total*/ return new String[] {};
15026        case -786681338: /*payment*/ return new String[] {};
15027        case 473181393: /*formCode*/ return new String[] {"CodeableConcept"};
15028        case 3148996: /*form*/ return new String[] {"Attachment"};
15029        case 202339073: /*processNote*/ return new String[] {};
15030        case -407369416: /*benefitPeriod*/ return new String[] {"Period"};
15031        case 596003397: /*benefitBalance*/ return new String[] {};
15032        default: return super.getTypesForProperty(hash, name);
15033        }
15034
15035      }
15036
15037      @Override
15038      public Base addChild(String name) throws FHIRException {
15039        if (name.equals("identifier")) {
15040          return addIdentifier();
15041        }
15042        else if (name.equals("status")) {
15043          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.status");
15044        }
15045        else if (name.equals("type")) {
15046          this.type = new CodeableConcept();
15047          return this.type;
15048        }
15049        else if (name.equals("subType")) {
15050          this.subType = new CodeableConcept();
15051          return this.subType;
15052        }
15053        else if (name.equals("use")) {
15054          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.use");
15055        }
15056        else if (name.equals("patient")) {
15057          this.patient = new Reference();
15058          return this.patient;
15059        }
15060        else if (name.equals("billablePeriod")) {
15061          this.billablePeriod = new Period();
15062          return this.billablePeriod;
15063        }
15064        else if (name.equals("created")) {
15065          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.created");
15066        }
15067        else if (name.equals("enterer")) {
15068          this.enterer = new Reference();
15069          return this.enterer;
15070        }
15071        else if (name.equals("insurer")) {
15072          this.insurer = new Reference();
15073          return this.insurer;
15074        }
15075        else if (name.equals("provider")) {
15076          this.provider = new Reference();
15077          return this.provider;
15078        }
15079        else if (name.equals("priority")) {
15080          this.priority = new CodeableConcept();
15081          return this.priority;
15082        }
15083        else if (name.equals("fundsReserveRequested")) {
15084          this.fundsReserveRequested = new CodeableConcept();
15085          return this.fundsReserveRequested;
15086        }
15087        else if (name.equals("fundsReserve")) {
15088          this.fundsReserve = new CodeableConcept();
15089          return this.fundsReserve;
15090        }
15091        else if (name.equals("related")) {
15092          return addRelated();
15093        }
15094        else if (name.equals("prescription")) {
15095          this.prescription = new Reference();
15096          return this.prescription;
15097        }
15098        else if (name.equals("originalPrescription")) {
15099          this.originalPrescription = new Reference();
15100          return this.originalPrescription;
15101        }
15102        else if (name.equals("payee")) {
15103          this.payee = new PayeeComponent();
15104          return this.payee;
15105        }
15106        else if (name.equals("referral")) {
15107          this.referral = new Reference();
15108          return this.referral;
15109        }
15110        else if (name.equals("facility")) {
15111          this.facility = new Reference();
15112          return this.facility;
15113        }
15114        else if (name.equals("claim")) {
15115          this.claim = new Reference();
15116          return this.claim;
15117        }
15118        else if (name.equals("claimResponse")) {
15119          this.claimResponse = new Reference();
15120          return this.claimResponse;
15121        }
15122        else if (name.equals("outcome")) {
15123          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.outcome");
15124        }
15125        else if (name.equals("disposition")) {
15126          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.disposition");
15127        }
15128        else if (name.equals("preAuthRef")) {
15129          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
15130        }
15131        else if (name.equals("preAuthRefPeriod")) {
15132          return addPreAuthRefPeriod();
15133        }
15134        else if (name.equals("careTeam")) {
15135          return addCareTeam();
15136        }
15137        else if (name.equals("supportingInfo")) {
15138          return addSupportingInfo();
15139        }
15140        else if (name.equals("diagnosis")) {
15141          return addDiagnosis();
15142        }
15143        else if (name.equals("procedure")) {
15144          return addProcedure();
15145        }
15146        else if (name.equals("precedence")) {
15147          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.precedence");
15148        }
15149        else if (name.equals("insurance")) {
15150          return addInsurance();
15151        }
15152        else if (name.equals("accident")) {
15153          this.accident = new AccidentComponent();
15154          return this.accident;
15155        }
15156        else if (name.equals("item")) {
15157          return addItem();
15158        }
15159        else if (name.equals("addItem")) {
15160          return addAddItem();
15161        }
15162        else if (name.equals("adjudication")) {
15163          return addAdjudication();
15164        }
15165        else if (name.equals("total")) {
15166          return addTotal();
15167        }
15168        else if (name.equals("payment")) {
15169          this.payment = new PaymentComponent();
15170          return this.payment;
15171        }
15172        else if (name.equals("formCode")) {
15173          this.formCode = new CodeableConcept();
15174          return this.formCode;
15175        }
15176        else if (name.equals("form")) {
15177          this.form = new Attachment();
15178          return this.form;
15179        }
15180        else if (name.equals("processNote")) {
15181          return addProcessNote();
15182        }
15183        else if (name.equals("benefitPeriod")) {
15184          this.benefitPeriod = new Period();
15185          return this.benefitPeriod;
15186        }
15187        else if (name.equals("benefitBalance")) {
15188          return addBenefitBalance();
15189        }
15190        else
15191          return super.addChild(name);
15192      }
15193
15194  public String fhirType() {
15195    return "ExplanationOfBenefit";
15196
15197  }
15198
15199      public ExplanationOfBenefit copy() {
15200        ExplanationOfBenefit dst = new ExplanationOfBenefit();
15201        copyValues(dst);
15202        if (identifier != null) {
15203          dst.identifier = new ArrayList<Identifier>();
15204          for (Identifier i : identifier)
15205            dst.identifier.add(i.copy());
15206        };
15207        dst.status = status == null ? null : status.copy();
15208        dst.type = type == null ? null : type.copy();
15209        dst.subType = subType == null ? null : subType.copy();
15210        dst.use = use == null ? null : use.copy();
15211        dst.patient = patient == null ? null : patient.copy();
15212        dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
15213        dst.created = created == null ? null : created.copy();
15214        dst.enterer = enterer == null ? null : enterer.copy();
15215        dst.insurer = insurer == null ? null : insurer.copy();
15216        dst.provider = provider == null ? null : provider.copy();
15217        dst.priority = priority == null ? null : priority.copy();
15218        dst.fundsReserveRequested = fundsReserveRequested == null ? null : fundsReserveRequested.copy();
15219        dst.fundsReserve = fundsReserve == null ? null : fundsReserve.copy();
15220        if (related != null) {
15221          dst.related = new ArrayList<RelatedClaimComponent>();
15222          for (RelatedClaimComponent i : related)
15223            dst.related.add(i.copy());
15224        };
15225        dst.prescription = prescription == null ? null : prescription.copy();
15226        dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
15227        dst.payee = payee == null ? null : payee.copy();
15228        dst.referral = referral == null ? null : referral.copy();
15229        dst.facility = facility == null ? null : facility.copy();
15230        dst.claim = claim == null ? null : claim.copy();
15231        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
15232        dst.outcome = outcome == null ? null : outcome.copy();
15233        dst.disposition = disposition == null ? null : disposition.copy();
15234        if (preAuthRef != null) {
15235          dst.preAuthRef = new ArrayList<StringType>();
15236          for (StringType i : preAuthRef)
15237            dst.preAuthRef.add(i.copy());
15238        };
15239        if (preAuthRefPeriod != null) {
15240          dst.preAuthRefPeriod = new ArrayList<Period>();
15241          for (Period i : preAuthRefPeriod)
15242            dst.preAuthRefPeriod.add(i.copy());
15243        };
15244        if (careTeam != null) {
15245          dst.careTeam = new ArrayList<CareTeamComponent>();
15246          for (CareTeamComponent i : careTeam)
15247            dst.careTeam.add(i.copy());
15248        };
15249        if (supportingInfo != null) {
15250          dst.supportingInfo = new ArrayList<SupportingInformationComponent>();
15251          for (SupportingInformationComponent i : supportingInfo)
15252            dst.supportingInfo.add(i.copy());
15253        };
15254        if (diagnosis != null) {
15255          dst.diagnosis = new ArrayList<DiagnosisComponent>();
15256          for (DiagnosisComponent i : diagnosis)
15257            dst.diagnosis.add(i.copy());
15258        };
15259        if (procedure != null) {
15260          dst.procedure = new ArrayList<ProcedureComponent>();
15261          for (ProcedureComponent i : procedure)
15262            dst.procedure.add(i.copy());
15263        };
15264        dst.precedence = precedence == null ? null : precedence.copy();
15265        if (insurance != null) {
15266          dst.insurance = new ArrayList<InsuranceComponent>();
15267          for (InsuranceComponent i : insurance)
15268            dst.insurance.add(i.copy());
15269        };
15270        dst.accident = accident == null ? null : accident.copy();
15271        if (item != null) {
15272          dst.item = new ArrayList<ItemComponent>();
15273          for (ItemComponent i : item)
15274            dst.item.add(i.copy());
15275        };
15276        if (addItem != null) {
15277          dst.addItem = new ArrayList<AddedItemComponent>();
15278          for (AddedItemComponent i : addItem)
15279            dst.addItem.add(i.copy());
15280        };
15281        if (adjudication != null) {
15282          dst.adjudication = new ArrayList<AdjudicationComponent>();
15283          for (AdjudicationComponent i : adjudication)
15284            dst.adjudication.add(i.copy());
15285        };
15286        if (total != null) {
15287          dst.total = new ArrayList<TotalComponent>();
15288          for (TotalComponent i : total)
15289            dst.total.add(i.copy());
15290        };
15291        dst.payment = payment == null ? null : payment.copy();
15292        dst.formCode = formCode == null ? null : formCode.copy();
15293        dst.form = form == null ? null : form.copy();
15294        if (processNote != null) {
15295          dst.processNote = new ArrayList<NoteComponent>();
15296          for (NoteComponent i : processNote)
15297            dst.processNote.add(i.copy());
15298        };
15299        dst.benefitPeriod = benefitPeriod == null ? null : benefitPeriod.copy();
15300        if (benefitBalance != null) {
15301          dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
15302          for (BenefitBalanceComponent i : benefitBalance)
15303            dst.benefitBalance.add(i.copy());
15304        };
15305        return dst;
15306      }
15307
15308      protected ExplanationOfBenefit typedCopy() {
15309        return copy();
15310      }
15311
15312      @Override
15313      public boolean equalsDeep(Base other_) {
15314        if (!super.equalsDeep(other_))
15315          return false;
15316        if (!(other_ instanceof ExplanationOfBenefit))
15317          return false;
15318        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
15319        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
15320           && compareDeep(subType, o.subType, true) && compareDeep(use, o.use, true) && compareDeep(patient, o.patient, true)
15321           && compareDeep(billablePeriod, o.billablePeriod, true) && compareDeep(created, o.created, true)
15322           && compareDeep(enterer, o.enterer, true) && compareDeep(insurer, o.insurer, true) && compareDeep(provider, o.provider, true)
15323           && compareDeep(priority, o.priority, true) && compareDeep(fundsReserveRequested, o.fundsReserveRequested, true)
15324           && compareDeep(fundsReserve, o.fundsReserve, true) && compareDeep(related, o.related, true) && compareDeep(prescription, o.prescription, true)
15325           && compareDeep(originalPrescription, o.originalPrescription, true) && compareDeep(payee, o.payee, true)
15326           && compareDeep(referral, o.referral, true) && compareDeep(facility, o.facility, true) && compareDeep(claim, o.claim, true)
15327           && compareDeep(claimResponse, o.claimResponse, true) && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true)
15328           && compareDeep(preAuthRef, o.preAuthRef, true) && compareDeep(preAuthRefPeriod, o.preAuthRefPeriod, true)
15329           && compareDeep(careTeam, o.careTeam, true) && compareDeep(supportingInfo, o.supportingInfo, true)
15330           && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true) && compareDeep(precedence, o.precedence, true)
15331           && compareDeep(insurance, o.insurance, true) && compareDeep(accident, o.accident, true) && compareDeep(item, o.item, true)
15332           && compareDeep(addItem, o.addItem, true) && compareDeep(adjudication, o.adjudication, true) && compareDeep(total, o.total, true)
15333           && compareDeep(payment, o.payment, true) && compareDeep(formCode, o.formCode, true) && compareDeep(form, o.form, true)
15334           && compareDeep(processNote, o.processNote, true) && compareDeep(benefitPeriod, o.benefitPeriod, true)
15335           && compareDeep(benefitBalance, o.benefitBalance, true);
15336      }
15337
15338      @Override
15339      public boolean equalsShallow(Base other_) {
15340        if (!super.equalsShallow(other_))
15341          return false;
15342        if (!(other_ instanceof ExplanationOfBenefit))
15343          return false;
15344        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
15345        return compareValues(status, o.status, true) && compareValues(use, o.use, true) && compareValues(created, o.created, true)
15346           && compareValues(outcome, o.outcome, true) && compareValues(disposition, o.disposition, true) && compareValues(preAuthRef, o.preAuthRef, true)
15347           && compareValues(precedence, o.precedence, true);
15348      }
15349
15350      public boolean isEmpty() {
15351        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
15352          , subType, use, patient, billablePeriod, created, enterer, insurer, provider
15353          , priority, fundsReserveRequested, fundsReserve, related, prescription, originalPrescription
15354          , payee, referral, facility, claim, claimResponse, outcome, disposition, preAuthRef
15355          , preAuthRefPeriod, careTeam, supportingInfo, diagnosis, procedure, precedence, insurance
15356          , accident, item, addItem, adjudication, total, payment, formCode, form, processNote
15357          , benefitPeriod, benefitBalance);
15358      }
15359
15360  @Override
15361  public ResourceType getResourceType() {
15362    return ResourceType.ExplanationOfBenefit;
15363   }
15364
15365 /**
15366   * Search parameter: <b>coverage</b>
15367   * <p>
15368   * Description: <b>The plan under which the claim was adjudicated</b><br>
15369   * Type: <b>reference</b><br>
15370   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
15371   * </p>
15372   */
15373  @SearchParamDefinition(name="coverage", path="ExplanationOfBenefit.insurance.coverage", description="The plan under which the claim was adjudicated", type="reference", target={Coverage.class } )
15374  public static final String SP_COVERAGE = "coverage";
15375 /**
15376   * <b>Fluent Client</b> search parameter constant for <b>coverage</b>
15377   * <p>
15378   * Description: <b>The plan under which the claim was adjudicated</b><br>
15379   * Type: <b>reference</b><br>
15380   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
15381   * </p>
15382   */
15383  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COVERAGE);
15384
15385/**
15386   * Constant for fluent queries to be used to add include statements. Specifies
15387   * the path value of "<b>ExplanationOfBenefit:coverage</b>".
15388   */
15389  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:coverage").toLocked();
15390
15391 /**
15392   * Search parameter: <b>care-team</b>
15393   * <p>
15394   * Description: <b>Member of the CareTeam</b><br>
15395   * Type: <b>reference</b><br>
15396   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
15397   * </p>
15398   */
15399  @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 } )
15400  public static final String SP_CARE_TEAM = "care-team";
15401 /**
15402   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
15403   * <p>
15404   * Description: <b>Member of the CareTeam</b><br>
15405   * Type: <b>reference</b><br>
15406   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
15407   * </p>
15408   */
15409  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CARE_TEAM);
15410
15411/**
15412   * Constant for fluent queries to be used to add include statements. Specifies
15413   * the path value of "<b>ExplanationOfBenefit:care-team</b>".
15414   */
15415  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:care-team").toLocked();
15416
15417 /**
15418   * Search parameter: <b>identifier</b>
15419   * <p>
15420   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
15421   * Type: <b>token</b><br>
15422   * Path: <b>ExplanationOfBenefit.identifier</b><br>
15423   * </p>
15424   */
15425  @SearchParamDefinition(name="identifier", path="ExplanationOfBenefit.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
15426  public static final String SP_IDENTIFIER = "identifier";
15427 /**
15428   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
15429   * <p>
15430   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
15431   * Type: <b>token</b><br>
15432   * Path: <b>ExplanationOfBenefit.identifier</b><br>
15433   * </p>
15434   */
15435  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
15436
15437 /**
15438   * Search parameter: <b>created</b>
15439   * <p>
15440   * Description: <b>The creation date for the EOB</b><br>
15441   * Type: <b>date</b><br>
15442   * Path: <b>ExplanationOfBenefit.created</b><br>
15443   * </p>
15444   */
15445  @SearchParamDefinition(name="created", path="ExplanationOfBenefit.created", description="The creation date for the EOB", type="date" )
15446  public static final String SP_CREATED = "created";
15447 /**
15448   * <b>Fluent Client</b> search parameter constant for <b>created</b>
15449   * <p>
15450   * Description: <b>The creation date for the EOB</b><br>
15451   * Type: <b>date</b><br>
15452   * Path: <b>ExplanationOfBenefit.created</b><br>
15453   * </p>
15454   */
15455  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
15456
15457 /**
15458   * Search parameter: <b>encounter</b>
15459   * <p>
15460   * Description: <b>Encounters associated with a billed line item</b><br>
15461   * Type: <b>reference</b><br>
15462   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
15463   * </p>
15464   */
15465  @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 } )
15466  public static final String SP_ENCOUNTER = "encounter";
15467 /**
15468   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
15469   * <p>
15470   * Description: <b>Encounters associated with a billed line item</b><br>
15471   * Type: <b>reference</b><br>
15472   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
15473   * </p>
15474   */
15475  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
15476
15477/**
15478   * Constant for fluent queries to be used to add include statements. Specifies
15479   * the path value of "<b>ExplanationOfBenefit:encounter</b>".
15480   */
15481  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:encounter").toLocked();
15482
15483 /**
15484   * Search parameter: <b>payee</b>
15485   * <p>
15486   * Description: <b>The party receiving any payment for the Claim</b><br>
15487   * Type: <b>reference</b><br>
15488   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
15489   * </p>
15490   */
15491  @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 } )
15492  public static final String SP_PAYEE = "payee";
15493 /**
15494   * <b>Fluent Client</b> search parameter constant for <b>payee</b>
15495   * <p>
15496   * Description: <b>The party receiving any payment for the Claim</b><br>
15497   * Type: <b>reference</b><br>
15498   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
15499   * </p>
15500   */
15501  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PAYEE);
15502
15503/**
15504   * Constant for fluent queries to be used to add include statements. Specifies
15505   * the path value of "<b>ExplanationOfBenefit:payee</b>".
15506   */
15507  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYEE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:payee").toLocked();
15508
15509 /**
15510   * Search parameter: <b>disposition</b>
15511   * <p>
15512   * Description: <b>The contents of the disposition message</b><br>
15513   * Type: <b>string</b><br>
15514   * Path: <b>ExplanationOfBenefit.disposition</b><br>
15515   * </p>
15516   */
15517  @SearchParamDefinition(name="disposition", path="ExplanationOfBenefit.disposition", description="The contents of the disposition message", type="string" )
15518  public static final String SP_DISPOSITION = "disposition";
15519 /**
15520   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
15521   * <p>
15522   * Description: <b>The contents of the disposition message</b><br>
15523   * Type: <b>string</b><br>
15524   * Path: <b>ExplanationOfBenefit.disposition</b><br>
15525   * </p>
15526   */
15527  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
15528
15529 /**
15530   * Search parameter: <b>provider</b>
15531   * <p>
15532   * Description: <b>The reference to the provider</b><br>
15533   * Type: <b>reference</b><br>
15534   * Path: <b>ExplanationOfBenefit.provider</b><br>
15535   * </p>
15536   */
15537  @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 } )
15538  public static final String SP_PROVIDER = "provider";
15539 /**
15540   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
15541   * <p>
15542   * Description: <b>The reference to the provider</b><br>
15543   * Type: <b>reference</b><br>
15544   * Path: <b>ExplanationOfBenefit.provider</b><br>
15545   * </p>
15546   */
15547  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
15548
15549/**
15550   * Constant for fluent queries to be used to add include statements. Specifies
15551   * the path value of "<b>ExplanationOfBenefit:provider</b>".
15552   */
15553  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:provider").toLocked();
15554
15555 /**
15556   * Search parameter: <b>patient</b>
15557   * <p>
15558   * Description: <b>The reference to the patient</b><br>
15559   * Type: <b>reference</b><br>
15560   * Path: <b>ExplanationOfBenefit.patient</b><br>
15561   * </p>
15562   */
15563  @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 } )
15564  public static final String SP_PATIENT = "patient";
15565 /**
15566   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
15567   * <p>
15568   * Description: <b>The reference to the patient</b><br>
15569   * Type: <b>reference</b><br>
15570   * Path: <b>ExplanationOfBenefit.patient</b><br>
15571   * </p>
15572   */
15573  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
15574
15575/**
15576   * Constant for fluent queries to be used to add include statements. Specifies
15577   * the path value of "<b>ExplanationOfBenefit:patient</b>".
15578   */
15579  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:patient").toLocked();
15580
15581 /**
15582   * Search parameter: <b>detail-udi</b>
15583   * <p>
15584   * Description: <b>UDI associated with a line item detail product or service</b><br>
15585   * Type: <b>reference</b><br>
15586   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
15587   * </p>
15588   */
15589  @SearchParamDefinition(name="detail-udi", path="ExplanationOfBenefit.item.detail.udi", description="UDI associated with a line item detail product or service", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device") }, target={Device.class } )
15590  public static final String SP_DETAIL_UDI = "detail-udi";
15591 /**
15592   * <b>Fluent Client</b> search parameter constant for <b>detail-udi</b>
15593   * <p>
15594   * Description: <b>UDI associated with a line item detail product or service</b><br>
15595   * Type: <b>reference</b><br>
15596   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
15597   * </p>
15598   */
15599  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DETAIL_UDI);
15600
15601/**
15602   * Constant for fluent queries to be used to add include statements. Specifies
15603   * the path value of "<b>ExplanationOfBenefit:detail-udi</b>".
15604   */
15605  public static final ca.uhn.fhir.model.api.Include INCLUDE_DETAIL_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:detail-udi").toLocked();
15606
15607 /**
15608   * Search parameter: <b>claim</b>
15609   * <p>
15610   * Description: <b>The reference to the claim</b><br>
15611   * Type: <b>reference</b><br>
15612   * Path: <b>ExplanationOfBenefit.claim</b><br>
15613   * </p>
15614   */
15615  @SearchParamDefinition(name="claim", path="ExplanationOfBenefit.claim", description="The reference to the claim", type="reference", target={Claim.class } )
15616  public static final String SP_CLAIM = "claim";
15617 /**
15618   * <b>Fluent Client</b> search parameter constant for <b>claim</b>
15619   * <p>
15620   * Description: <b>The reference to the claim</b><br>
15621   * Type: <b>reference</b><br>
15622   * Path: <b>ExplanationOfBenefit.claim</b><br>
15623   * </p>
15624   */
15625  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CLAIM);
15626
15627/**
15628   * Constant for fluent queries to be used to add include statements. Specifies
15629   * the path value of "<b>ExplanationOfBenefit:claim</b>".
15630   */
15631  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:claim").toLocked();
15632
15633 /**
15634   * Search parameter: <b>enterer</b>
15635   * <p>
15636   * Description: <b>The party responsible for the entry of the Claim</b><br>
15637   * Type: <b>reference</b><br>
15638   * Path: <b>ExplanationOfBenefit.enterer</b><br>
15639   * </p>
15640   */
15641  @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 } )
15642  public static final String SP_ENTERER = "enterer";
15643 /**
15644   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
15645   * <p>
15646   * Description: <b>The party responsible for the entry of the Claim</b><br>
15647   * Type: <b>reference</b><br>
15648   * Path: <b>ExplanationOfBenefit.enterer</b><br>
15649   * </p>
15650   */
15651  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTERER);
15652
15653/**
15654   * Constant for fluent queries to be used to add include statements. Specifies
15655   * the path value of "<b>ExplanationOfBenefit:enterer</b>".
15656   */
15657  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:enterer").toLocked();
15658
15659 /**
15660   * Search parameter: <b>procedure-udi</b>
15661   * <p>
15662   * Description: <b>UDI associated with a procedure</b><br>
15663   * Type: <b>reference</b><br>
15664   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
15665   * </p>
15666   */
15667  @SearchParamDefinition(name="procedure-udi", path="ExplanationOfBenefit.procedure.udi", description="UDI associated with a procedure", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device") }, target={Device.class } )
15668  public static final String SP_PROCEDURE_UDI = "procedure-udi";
15669 /**
15670   * <b>Fluent Client</b> search parameter constant for <b>procedure-udi</b>
15671   * <p>
15672   * Description: <b>UDI associated with a procedure</b><br>
15673   * Type: <b>reference</b><br>
15674   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
15675   * </p>
15676   */
15677  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROCEDURE_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROCEDURE_UDI);
15678
15679/**
15680   * Constant for fluent queries to be used to add include statements. Specifies
15681   * the path value of "<b>ExplanationOfBenefit:procedure-udi</b>".
15682   */
15683  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROCEDURE_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:procedure-udi").toLocked();
15684
15685 /**
15686   * Search parameter: <b>subdetail-udi</b>
15687   * <p>
15688   * Description: <b>UDI associated with a line item detail subdetail product or service</b><br>
15689   * Type: <b>reference</b><br>
15690   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
15691   * </p>
15692   */
15693  @SearchParamDefinition(name="subdetail-udi", path="ExplanationOfBenefit.item.detail.subDetail.udi", description="UDI associated with a line item detail subdetail product or service", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device") }, target={Device.class } )
15694  public static final String SP_SUBDETAIL_UDI = "subdetail-udi";
15695 /**
15696   * <b>Fluent Client</b> search parameter constant for <b>subdetail-udi</b>
15697   * <p>
15698   * Description: <b>UDI associated with a line item detail subdetail product or service</b><br>
15699   * Type: <b>reference</b><br>
15700   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
15701   * </p>
15702   */
15703  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBDETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBDETAIL_UDI);
15704
15705/**
15706   * Constant for fluent queries to be used to add include statements. Specifies
15707   * the path value of "<b>ExplanationOfBenefit:subdetail-udi</b>".
15708   */
15709  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBDETAIL_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:subdetail-udi").toLocked();
15710
15711 /**
15712   * Search parameter: <b>facility</b>
15713   * <p>
15714   * Description: <b>Facility responsible for the goods and services</b><br>
15715   * Type: <b>reference</b><br>
15716   * Path: <b>ExplanationOfBenefit.facility</b><br>
15717   * </p>
15718   */
15719  @SearchParamDefinition(name="facility", path="ExplanationOfBenefit.facility", description="Facility responsible for the goods and services", type="reference", target={Location.class } )
15720  public static final String SP_FACILITY = "facility";
15721 /**
15722   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
15723   * <p>
15724   * Description: <b>Facility responsible for the goods and services</b><br>
15725   * Type: <b>reference</b><br>
15726   * Path: <b>ExplanationOfBenefit.facility</b><br>
15727   * </p>
15728   */
15729  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITY);
15730
15731/**
15732   * Constant for fluent queries to be used to add include statements. Specifies
15733   * the path value of "<b>ExplanationOfBenefit:facility</b>".
15734   */
15735  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:facility").toLocked();
15736
15737 /**
15738   * Search parameter: <b>item-udi</b>
15739   * <p>
15740   * Description: <b>UDI associated with a line item product or service</b><br>
15741   * Type: <b>reference</b><br>
15742   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
15743   * </p>
15744   */
15745  @SearchParamDefinition(name="item-udi", path="ExplanationOfBenefit.item.udi", description="UDI associated with a line item product or service", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device") }, target={Device.class } )
15746  public static final String SP_ITEM_UDI = "item-udi";
15747 /**
15748   * <b>Fluent Client</b> search parameter constant for <b>item-udi</b>
15749   * <p>
15750   * Description: <b>UDI associated with a line item product or service</b><br>
15751   * Type: <b>reference</b><br>
15752   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
15753   * </p>
15754   */
15755  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ITEM_UDI);
15756
15757/**
15758   * Constant for fluent queries to be used to add include statements. Specifies
15759   * the path value of "<b>ExplanationOfBenefit:item-udi</b>".
15760   */
15761  public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:item-udi").toLocked();
15762
15763 /**
15764   * Search parameter: <b>status</b>
15765   * <p>
15766   * Description: <b>Status of the instance</b><br>
15767   * Type: <b>token</b><br>
15768   * Path: <b>ExplanationOfBenefit.status</b><br>
15769   * </p>
15770   */
15771  @SearchParamDefinition(name="status", path="ExplanationOfBenefit.status", description="Status of the instance", type="token" )
15772  public static final String SP_STATUS = "status";
15773 /**
15774   * <b>Fluent Client</b> search parameter constant for <b>status</b>
15775   * <p>
15776   * Description: <b>Status of the instance</b><br>
15777   * Type: <b>token</b><br>
15778   * Path: <b>ExplanationOfBenefit.status</b><br>
15779   * </p>
15780   */
15781  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
15782
15783
15784}
15785