001package org.hl7.fhir.r4.model;
002
003import java.math.BigDecimal;
004
005/*-
006 * #%L
007 * org.hl7.fhir.r4
008 * %%
009 * Copyright (C) 2014 - 2019 Health Level 7
010 * %%
011 * Licensed under the Apache License, Version 2.0 (the "License");
012 * you may not use this file except in compliance with the License.
013 * You may obtain a copy of the License at
014 * 
015 *      http://www.apache.org/licenses/LICENSE-2.0
016 * 
017 * Unless required by applicable law or agreed to in writing, software
018 * distributed under the License is distributed on an "AS IS" BASIS,
019 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
020 * See the License for the specific language governing permissions and
021 * limitations under the License.
022 * #L%
023 */
024
025/*
026  Copyright (c) 2011+, HL7, Inc.
027  All rights reserved.
028  
029  Redistribution and use in source and binary forms, with or without modification, 
030  are permitted provided that the following conditions are met:
031  
032   * Redistributions of source code must retain the above copyright notice, this 
033     list of conditions and the following disclaimer.
034   * Redistributions in binary form must reproduce the above copyright notice, 
035     this list of conditions and the following disclaimer in the documentation 
036     and/or other materials provided with the distribution.
037   * Neither the name of HL7 nor the names of its contributors may be used to 
038     endorse or promote products derived from this software without specific 
039     prior written permission.
040  
041  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
042  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
043  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
044  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
045  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
046  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
047  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
048  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
049  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
050  POSSIBILITY OF SUCH DAMAGE.
051  
052*/
053
054// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
055import java.util.ArrayList;
056import java.util.Date;
057import java.util.List;
058
059import org.hl7.fhir.exceptions.FHIRException;
060import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
061import org.hl7.fhir.r4.model.Enumerations.NoteType;
062import org.hl7.fhir.r4.model.Enumerations.NoteTypeEnumFactory;
063import org.hl7.fhir.utilities.Utilities;
064
065import ca.uhn.fhir.model.api.annotation.Block;
066import ca.uhn.fhir.model.api.annotation.Child;
067import ca.uhn.fhir.model.api.annotation.Description;
068import ca.uhn.fhir.model.api.annotation.ResourceDef;
069import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
070/**
071 * 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.
072 */
073@ResourceDef(name="ExplanationOfBenefit", profile="http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit")
074public class ExplanationOfBenefit extends DomainResource {
075
076    public enum ExplanationOfBenefitStatus {
077        /**
078         * The resource instance is currently in-force.
079         */
080        ACTIVE, 
081        /**
082         * The resource instance is withdrawn, rescinded or reversed.
083         */
084        CANCELLED, 
085        /**
086         * A new resource instance the contents of which is not complete.
087         */
088        DRAFT, 
089        /**
090         * The resource instance was entered in error.
091         */
092        ENTEREDINERROR, 
093        /**
094         * added to help the parsers with the generic types
095         */
096        NULL;
097        public static ExplanationOfBenefitStatus fromCode(String codeString) throws FHIRException {
098            if (codeString == null || "".equals(codeString))
099                return null;
100        if ("active".equals(codeString))
101          return ACTIVE;
102        if ("cancelled".equals(codeString))
103          return CANCELLED;
104        if ("draft".equals(codeString))
105          return DRAFT;
106        if ("entered-in-error".equals(codeString))
107          return ENTEREDINERROR;
108        if (Configuration.isAcceptInvalidEnums())
109          return null;
110        else
111          throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
112        }
113        public String toCode() {
114          switch (this) {
115            case ACTIVE: return "active";
116            case CANCELLED: return "cancelled";
117            case DRAFT: return "draft";
118            case ENTEREDINERROR: return "entered-in-error";
119            default: return "?";
120          }
121        }
122        public String getSystem() {
123          switch (this) {
124            case ACTIVE: return "http://hl7.org/fhir/explanationofbenefit-status";
125            case CANCELLED: return "http://hl7.org/fhir/explanationofbenefit-status";
126            case DRAFT: return "http://hl7.org/fhir/explanationofbenefit-status";
127            case ENTEREDINERROR: return "http://hl7.org/fhir/explanationofbenefit-status";
128            default: return "?";
129          }
130        }
131        public String getDefinition() {
132          switch (this) {
133            case ACTIVE: return "The resource instance is currently in-force.";
134            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
135            case DRAFT: return "A new resource instance the contents of which is not complete.";
136            case ENTEREDINERROR: return "The resource instance was entered in error.";
137            default: return "?";
138          }
139        }
140        public String getDisplay() {
141          switch (this) {
142            case ACTIVE: return "Active";
143            case CANCELLED: return "Cancelled";
144            case DRAFT: return "Draft";
145            case ENTEREDINERROR: return "Entered In Error";
146            default: return "?";
147          }
148        }
149    }
150
151  public static class ExplanationOfBenefitStatusEnumFactory implements EnumFactory<ExplanationOfBenefitStatus> {
152    public ExplanationOfBenefitStatus fromCode(String codeString) throws IllegalArgumentException {
153      if (codeString == null || "".equals(codeString))
154            if (codeString == null || "".equals(codeString))
155                return null;
156        if ("active".equals(codeString))
157          return ExplanationOfBenefitStatus.ACTIVE;
158        if ("cancelled".equals(codeString))
159          return ExplanationOfBenefitStatus.CANCELLED;
160        if ("draft".equals(codeString))
161          return ExplanationOfBenefitStatus.DRAFT;
162        if ("entered-in-error".equals(codeString))
163          return ExplanationOfBenefitStatus.ENTEREDINERROR;
164        throw new IllegalArgumentException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
165        }
166        public Enumeration<ExplanationOfBenefitStatus> fromType(Base code) throws FHIRException {
167          if (code == null)
168            return null;
169          if (code.isEmpty())
170            return new Enumeration<ExplanationOfBenefitStatus>(this);
171          String codeString = ((PrimitiveType) code).asStringValue();
172          if (codeString == null || "".equals(codeString))
173            return null;
174        if ("active".equals(codeString))
175          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ACTIVE);
176        if ("cancelled".equals(codeString))
177          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.CANCELLED);
178        if ("draft".equals(codeString))
179          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.DRAFT);
180        if ("entered-in-error".equals(codeString))
181          return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ENTEREDINERROR);
182        throw new FHIRException("Unknown ExplanationOfBenefitStatus code '"+codeString+"'");
183        }
184    public String toCode(ExplanationOfBenefitStatus code) {
185      if (code == ExplanationOfBenefitStatus.ACTIVE)
186        return "active";
187      if (code == ExplanationOfBenefitStatus.CANCELLED)
188        return "cancelled";
189      if (code == ExplanationOfBenefitStatus.DRAFT)
190        return "draft";
191      if (code == ExplanationOfBenefitStatus.ENTEREDINERROR)
192        return "entered-in-error";
193      return "?";
194      }
195    public String toSystem(ExplanationOfBenefitStatus code) {
196      return code.getSystem();
197      }
198    }
199
200    public enum Use {
201        /**
202         * The treatment is complete and this represents a Claim for the services.
203         */
204        CLAIM, 
205        /**
206         * The treatment is proposed and this represents a Pre-authorization for the services.
207         */
208        PREAUTHORIZATION, 
209        /**
210         * The treatment is proposed and this represents a Pre-determination for the services.
211         */
212        PREDETERMINATION, 
213        /**
214         * added to help the parsers with the generic types
215         */
216        NULL;
217        public static Use fromCode(String codeString) throws FHIRException {
218            if (codeString == null || "".equals(codeString))
219                return null;
220        if ("claim".equals(codeString))
221          return CLAIM;
222        if ("preauthorization".equals(codeString))
223          return PREAUTHORIZATION;
224        if ("predetermination".equals(codeString))
225          return PREDETERMINATION;
226        if (Configuration.isAcceptInvalidEnums())
227          return null;
228        else
229          throw new FHIRException("Unknown Use code '"+codeString+"'");
230        }
231        public String toCode() {
232          switch (this) {
233            case CLAIM: return "claim";
234            case PREAUTHORIZATION: return "preauthorization";
235            case PREDETERMINATION: return "predetermination";
236            default: return "?";
237          }
238        }
239        public String getSystem() {
240          switch (this) {
241            case CLAIM: return "http://hl7.org/fhir/claim-use";
242            case PREAUTHORIZATION: return "http://hl7.org/fhir/claim-use";
243            case PREDETERMINATION: return "http://hl7.org/fhir/claim-use";
244            default: return "?";
245          }
246        }
247        public String getDefinition() {
248          switch (this) {
249            case CLAIM: return "The treatment is complete and this represents a Claim for the services.";
250            case PREAUTHORIZATION: return "The treatment is proposed and this represents a Pre-authorization for the services.";
251            case PREDETERMINATION: return "The treatment is proposed and this represents a Pre-determination for the services.";
252            default: return "?";
253          }
254        }
255        public String getDisplay() {
256          switch (this) {
257            case CLAIM: return "Claim";
258            case PREAUTHORIZATION: return "Preauthorization";
259            case PREDETERMINATION: return "Predetermination";
260            default: return "?";
261          }
262        }
263    }
264
265  public static class UseEnumFactory implements EnumFactory<Use> {
266    public Use fromCode(String codeString) throws IllegalArgumentException {
267      if (codeString == null || "".equals(codeString))
268            if (codeString == null || "".equals(codeString))
269                return null;
270        if ("claim".equals(codeString))
271          return Use.CLAIM;
272        if ("preauthorization".equals(codeString))
273          return Use.PREAUTHORIZATION;
274        if ("predetermination".equals(codeString))
275          return Use.PREDETERMINATION;
276        throw new IllegalArgumentException("Unknown Use code '"+codeString+"'");
277        }
278        public Enumeration<Use> fromType(Base code) throws FHIRException {
279          if (code == null)
280            return null;
281          if (code.isEmpty())
282            return new Enumeration<Use>(this);
283          String codeString = ((PrimitiveType) code).asStringValue();
284          if (codeString == null || "".equals(codeString))
285            return null;
286        if ("claim".equals(codeString))
287          return new Enumeration<Use>(this, Use.CLAIM);
288        if ("preauthorization".equals(codeString))
289          return new Enumeration<Use>(this, Use.PREAUTHORIZATION);
290        if ("predetermination".equals(codeString))
291          return new Enumeration<Use>(this, Use.PREDETERMINATION);
292        throw new FHIRException("Unknown Use code '"+codeString+"'");
293        }
294    public String toCode(Use code) {
295      if (code == Use.CLAIM)
296        return "claim";
297      if (code == Use.PREAUTHORIZATION)
298        return "preauthorization";
299      if (code == Use.PREDETERMINATION)
300        return "predetermination";
301      return "?";
302      }
303    public String toSystem(Use code) {
304      return code.getSystem();
305      }
306    }
307
308    public enum RemittanceOutcome {
309        /**
310         * The Claim/Pre-authorization/Pre-determination has been received but processing has not begun.
311         */
312        QUEUED, 
313        /**
314         * The processing has completed without errors
315         */
316        COMPLETE, 
317        /**
318         * One or more errors have been detected in the Claim
319         */
320        ERROR, 
321        /**
322         * No errors have been detected in the Claim and some of the adjudication has been performed.
323         */
324        PARTIAL, 
325        /**
326         * added to help the parsers with the generic types
327         */
328        NULL;
329        public static RemittanceOutcome fromCode(String codeString) throws FHIRException {
330            if (codeString == null || "".equals(codeString))
331                return null;
332        if ("queued".equals(codeString))
333          return QUEUED;
334        if ("complete".equals(codeString))
335          return COMPLETE;
336        if ("error".equals(codeString))
337          return ERROR;
338        if ("partial".equals(codeString))
339          return PARTIAL;
340        if (Configuration.isAcceptInvalidEnums())
341          return null;
342        else
343          throw new FHIRException("Unknown RemittanceOutcome code '"+codeString+"'");
344        }
345        public String toCode() {
346          switch (this) {
347            case QUEUED: return "queued";
348            case COMPLETE: return "complete";
349            case ERROR: return "error";
350            case PARTIAL: return "partial";
351            default: return "?";
352          }
353        }
354        public String getSystem() {
355          switch (this) {
356            case QUEUED: return "http://hl7.org/fhir/remittance-outcome";
357            case COMPLETE: return "http://hl7.org/fhir/remittance-outcome";
358            case ERROR: return "http://hl7.org/fhir/remittance-outcome";
359            case PARTIAL: return "http://hl7.org/fhir/remittance-outcome";
360            default: return "?";
361          }
362        }
363        public String getDefinition() {
364          switch (this) {
365            case QUEUED: return "The Claim/Pre-authorization/Pre-determination has been received but processing has not begun.";
366            case COMPLETE: return "The processing has completed without errors";
367            case ERROR: return "One or more errors have been detected in the Claim";
368            case PARTIAL: return "No errors have been detected in the Claim and some of the adjudication has been performed.";
369            default: return "?";
370          }
371        }
372        public String getDisplay() {
373          switch (this) {
374            case QUEUED: return "Queued";
375            case COMPLETE: return "Processing Complete";
376            case ERROR: return "Error";
377            case PARTIAL: return "Partial Processing";
378            default: return "?";
379          }
380        }
381    }
382
383  public static class RemittanceOutcomeEnumFactory implements EnumFactory<RemittanceOutcome> {
384    public RemittanceOutcome fromCode(String codeString) throws IllegalArgumentException {
385      if (codeString == null || "".equals(codeString))
386            if (codeString == null || "".equals(codeString))
387                return null;
388        if ("queued".equals(codeString))
389          return RemittanceOutcome.QUEUED;
390        if ("complete".equals(codeString))
391          return RemittanceOutcome.COMPLETE;
392        if ("error".equals(codeString))
393          return RemittanceOutcome.ERROR;
394        if ("partial".equals(codeString))
395          return RemittanceOutcome.PARTIAL;
396        throw new IllegalArgumentException("Unknown RemittanceOutcome code '"+codeString+"'");
397        }
398        public Enumeration<RemittanceOutcome> fromType(Base code) throws FHIRException {
399          if (code == null)
400            return null;
401          if (code.isEmpty())
402            return new Enumeration<RemittanceOutcome>(this);
403          String codeString = ((PrimitiveType) code).asStringValue();
404          if (codeString == null || "".equals(codeString))
405            return null;
406        if ("queued".equals(codeString))
407          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.QUEUED);
408        if ("complete".equals(codeString))
409          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.COMPLETE);
410        if ("error".equals(codeString))
411          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.ERROR);
412        if ("partial".equals(codeString))
413          return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.PARTIAL);
414        throw new FHIRException("Unknown RemittanceOutcome code '"+codeString+"'");
415        }
416    public String toCode(RemittanceOutcome code) {
417      if (code == RemittanceOutcome.QUEUED)
418        return "queued";
419      if (code == RemittanceOutcome.COMPLETE)
420        return "complete";
421      if (code == RemittanceOutcome.ERROR)
422        return "error";
423      if (code == RemittanceOutcome.PARTIAL)
424        return "partial";
425      return "?";
426      }
427    public String toSystem(RemittanceOutcome code) {
428      return code.getSystem();
429      }
430    }
431
432    @Block()
433    public static class RelatedClaimComponent extends BackboneElement implements IBaseBackboneElement {
434        /**
435         * Reference to a related claim.
436         */
437        @Child(name = "claim", type = {Claim.class}, order=1, min=0, max=1, modifier=false, summary=false)
438        @Description(shortDefinition="Reference to the related claim", formalDefinition="Reference to a related claim." )
439        protected Reference claim;
440
441        /**
442         * The actual object that is the target of the reference (Reference to a related claim.)
443         */
444        protected Claim claimTarget;
445
446        /**
447         * A code to convey how the claims are related.
448         */
449        @Child(name = "relationship", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
450        @Description(shortDefinition="How the reference claim is related", formalDefinition="A code to convey how the claims are related." )
451        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-claim-relationship")
452        protected CodeableConcept relationship;
453
454        /**
455         * An alternate organizational reference to the case or file to which this particular claim pertains.
456         */
457        @Child(name = "reference", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=false)
458        @Description(shortDefinition="File or case reference", formalDefinition="An alternate organizational reference to the case or file to which this particular claim pertains." )
459        protected Identifier reference;
460
461        private static final long serialVersionUID = -379338905L;
462
463    /**
464     * Constructor
465     */
466      public RelatedClaimComponent() {
467        super();
468      }
469
470        /**
471         * @return {@link #claim} (Reference to a related claim.)
472         */
473        public Reference getClaim() { 
474          if (this.claim == null)
475            if (Configuration.errorOnAutoCreate())
476              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
477            else if (Configuration.doAutoCreate())
478              this.claim = new Reference(); // cc
479          return this.claim;
480        }
481
482        public boolean hasClaim() { 
483          return this.claim != null && !this.claim.isEmpty();
484        }
485
486        /**
487         * @param value {@link #claim} (Reference to a related claim.)
488         */
489        public RelatedClaimComponent setClaim(Reference value) { 
490          this.claim = value;
491          return this;
492        }
493
494        /**
495         * @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.)
496         */
497        public Claim getClaimTarget() { 
498          if (this.claimTarget == null)
499            if (Configuration.errorOnAutoCreate())
500              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
501            else if (Configuration.doAutoCreate())
502              this.claimTarget = new Claim(); // aa
503          return this.claimTarget;
504        }
505
506        /**
507         * @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.)
508         */
509        public RelatedClaimComponent setClaimTarget(Claim value) { 
510          this.claimTarget = value;
511          return this;
512        }
513
514        /**
515         * @return {@link #relationship} (A code to convey how the claims are related.)
516         */
517        public CodeableConcept getRelationship() { 
518          if (this.relationship == null)
519            if (Configuration.errorOnAutoCreate())
520              throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
521            else if (Configuration.doAutoCreate())
522              this.relationship = new CodeableConcept(); // cc
523          return this.relationship;
524        }
525
526        public boolean hasRelationship() { 
527          return this.relationship != null && !this.relationship.isEmpty();
528        }
529
530        /**
531         * @param value {@link #relationship} (A code to convey how the claims are related.)
532         */
533        public RelatedClaimComponent setRelationship(CodeableConcept value) { 
534          this.relationship = value;
535          return this;
536        }
537
538        /**
539         * @return {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
540         */
541        public Identifier getReference() { 
542          if (this.reference == null)
543            if (Configuration.errorOnAutoCreate())
544              throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
545            else if (Configuration.doAutoCreate())
546              this.reference = new Identifier(); // cc
547          return this.reference;
548        }
549
550        public boolean hasReference() { 
551          return this.reference != null && !this.reference.isEmpty();
552        }
553
554        /**
555         * @param value {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
556         */
557        public RelatedClaimComponent setReference(Identifier value) { 
558          this.reference = value;
559          return this;
560        }
561
562        protected void listChildren(List<Property> children) {
563          super.listChildren(children);
564          children.add(new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim));
565          children.add(new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship));
566          children.add(new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1, reference));
567        }
568
569        @Override
570        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
571          switch (_hash) {
572          case 94742588: /*claim*/  return new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim);
573          case -261851592: /*relationship*/  return new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship);
574          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);
575          default: return super.getNamedProperty(_hash, _name, _checkValid);
576          }
577
578        }
579
580      @Override
581      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
582        switch (hash) {
583        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
584        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
585        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Identifier
586        default: return super.getProperty(hash, name, checkValid);
587        }
588
589      }
590
591      @Override
592      public Base setProperty(int hash, String name, Base value) throws FHIRException {
593        switch (hash) {
594        case 94742588: // claim
595          this.claim = castToReference(value); // Reference
596          return value;
597        case -261851592: // relationship
598          this.relationship = castToCodeableConcept(value); // CodeableConcept
599          return value;
600        case -925155509: // reference
601          this.reference = castToIdentifier(value); // Identifier
602          return value;
603        default: return super.setProperty(hash, name, value);
604        }
605
606      }
607
608      @Override
609      public Base setProperty(String name, Base value) throws FHIRException {
610        if (name.equals("claim")) {
611          this.claim = castToReference(value); // Reference
612        } else if (name.equals("relationship")) {
613          this.relationship = castToCodeableConcept(value); // CodeableConcept
614        } else if (name.equals("reference")) {
615          this.reference = castToIdentifier(value); // Identifier
616        } else
617          return super.setProperty(name, value);
618        return value;
619      }
620
621      @Override
622      public Base makeProperty(int hash, String name) throws FHIRException {
623        switch (hash) {
624        case 94742588:  return getClaim(); 
625        case -261851592:  return getRelationship(); 
626        case -925155509:  return getReference(); 
627        default: return super.makeProperty(hash, name);
628        }
629
630      }
631
632      @Override
633      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
634        switch (hash) {
635        case 94742588: /*claim*/ return new String[] {"Reference"};
636        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
637        case -925155509: /*reference*/ return new String[] {"Identifier"};
638        default: return super.getTypesForProperty(hash, name);
639        }
640
641      }
642
643      @Override
644      public Base addChild(String name) throws FHIRException {
645        if (name.equals("claim")) {
646          this.claim = new Reference();
647          return this.claim;
648        }
649        else if (name.equals("relationship")) {
650          this.relationship = new CodeableConcept();
651          return this.relationship;
652        }
653        else if (name.equals("reference")) {
654          this.reference = new Identifier();
655          return this.reference;
656        }
657        else
658          return super.addChild(name);
659      }
660
661      public RelatedClaimComponent copy() {
662        RelatedClaimComponent dst = new RelatedClaimComponent();
663        copyValues(dst);
664        dst.claim = claim == null ? null : claim.copy();
665        dst.relationship = relationship == null ? null : relationship.copy();
666        dst.reference = reference == null ? null : reference.copy();
667        return dst;
668      }
669
670      @Override
671      public boolean equalsDeep(Base other_) {
672        if (!super.equalsDeep(other_))
673          return false;
674        if (!(other_ instanceof RelatedClaimComponent))
675          return false;
676        RelatedClaimComponent o = (RelatedClaimComponent) other_;
677        return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true) && compareDeep(reference, o.reference, true)
678          ;
679      }
680
681      @Override
682      public boolean equalsShallow(Base other_) {
683        if (!super.equalsShallow(other_))
684          return false;
685        if (!(other_ instanceof RelatedClaimComponent))
686          return false;
687        RelatedClaimComponent o = (RelatedClaimComponent) other_;
688        return true;
689      }
690
691      public boolean isEmpty() {
692        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference
693          );
694      }
695
696  public String fhirType() {
697    return "ExplanationOfBenefit.related";
698
699  }
700
701  }
702
703    @Block()
704    public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
705        /**
706         * Type of Party to be reimbursed: Subscriber, provider, other.
707         */
708        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
709        @Description(shortDefinition="Category of recipient", formalDefinition="Type of Party to be reimbursed: Subscriber, provider, other." )
710        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payeetype")
711        protected CodeableConcept type;
712
713        /**
714         * Reference to the individual or organization to whom any payment will be made.
715         */
716        @Child(name = "party", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, RelatedPerson.class}, order=2, min=0, max=1, modifier=false, summary=false)
717        @Description(shortDefinition="Recipient reference", formalDefinition="Reference to the individual or organization to whom any payment will be made." )
718        protected Reference party;
719
720        /**
721         * The actual object that is the target of the reference (Reference to the individual or organization to whom any payment will be made.)
722         */
723        protected Resource partyTarget;
724
725        private static final long serialVersionUID = 1609484699L;
726
727    /**
728     * Constructor
729     */
730      public PayeeComponent() {
731        super();
732      }
733
734        /**
735         * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
736         */
737        public CodeableConcept getType() { 
738          if (this.type == null)
739            if (Configuration.errorOnAutoCreate())
740              throw new Error("Attempt to auto-create PayeeComponent.type");
741            else if (Configuration.doAutoCreate())
742              this.type = new CodeableConcept(); // cc
743          return this.type;
744        }
745
746        public boolean hasType() { 
747          return this.type != null && !this.type.isEmpty();
748        }
749
750        /**
751         * @param value {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
752         */
753        public PayeeComponent setType(CodeableConcept value) { 
754          this.type = value;
755          return this;
756        }
757
758        /**
759         * @return {@link #party} (Reference to the individual or organization to whom any payment will be made.)
760         */
761        public Reference getParty() { 
762          if (this.party == null)
763            if (Configuration.errorOnAutoCreate())
764              throw new Error("Attempt to auto-create PayeeComponent.party");
765            else if (Configuration.doAutoCreate())
766              this.party = new Reference(); // cc
767          return this.party;
768        }
769
770        public boolean hasParty() { 
771          return this.party != null && !this.party.isEmpty();
772        }
773
774        /**
775         * @param value {@link #party} (Reference to the individual or organization to whom any payment will be made.)
776         */
777        public PayeeComponent setParty(Reference value) { 
778          this.party = value;
779          return this;
780        }
781
782        /**
783         * @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.)
784         */
785        public Resource getPartyTarget() { 
786          return this.partyTarget;
787        }
788
789        /**
790         * @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.)
791         */
792        public PayeeComponent setPartyTarget(Resource value) { 
793          this.partyTarget = value;
794          return this;
795        }
796
797        protected void listChildren(List<Property> children) {
798          super.listChildren(children);
799          children.add(new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type));
800          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));
801        }
802
803        @Override
804        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
805          switch (_hash) {
806          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type);
807          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);
808          default: return super.getNamedProperty(_hash, _name, _checkValid);
809          }
810
811        }
812
813      @Override
814      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
815        switch (hash) {
816        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
817        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
818        default: return super.getProperty(hash, name, checkValid);
819        }
820
821      }
822
823      @Override
824      public Base setProperty(int hash, String name, Base value) throws FHIRException {
825        switch (hash) {
826        case 3575610: // type
827          this.type = castToCodeableConcept(value); // CodeableConcept
828          return value;
829        case 106437350: // party
830          this.party = castToReference(value); // Reference
831          return value;
832        default: return super.setProperty(hash, name, value);
833        }
834
835      }
836
837      @Override
838      public Base setProperty(String name, Base value) throws FHIRException {
839        if (name.equals("type")) {
840          this.type = castToCodeableConcept(value); // CodeableConcept
841        } else if (name.equals("party")) {
842          this.party = castToReference(value); // Reference
843        } else
844          return super.setProperty(name, value);
845        return value;
846      }
847
848      @Override
849      public Base makeProperty(int hash, String name) throws FHIRException {
850        switch (hash) {
851        case 3575610:  return getType(); 
852        case 106437350:  return getParty(); 
853        default: return super.makeProperty(hash, name);
854        }
855
856      }
857
858      @Override
859      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
860        switch (hash) {
861        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
862        case 106437350: /*party*/ return new String[] {"Reference"};
863        default: return super.getTypesForProperty(hash, name);
864        }
865
866      }
867
868      @Override
869      public Base addChild(String name) throws FHIRException {
870        if (name.equals("type")) {
871          this.type = new CodeableConcept();
872          return this.type;
873        }
874        else if (name.equals("party")) {
875          this.party = new Reference();
876          return this.party;
877        }
878        else
879          return super.addChild(name);
880      }
881
882      public PayeeComponent copy() {
883        PayeeComponent dst = new PayeeComponent();
884        copyValues(dst);
885        dst.type = type == null ? null : type.copy();
886        dst.party = party == null ? null : party.copy();
887        return dst;
888      }
889
890      @Override
891      public boolean equalsDeep(Base other_) {
892        if (!super.equalsDeep(other_))
893          return false;
894        if (!(other_ instanceof PayeeComponent))
895          return false;
896        PayeeComponent o = (PayeeComponent) other_;
897        return compareDeep(type, o.type, true) && compareDeep(party, o.party, true);
898      }
899
900      @Override
901      public boolean equalsShallow(Base other_) {
902        if (!super.equalsShallow(other_))
903          return false;
904        if (!(other_ instanceof PayeeComponent))
905          return false;
906        PayeeComponent o = (PayeeComponent) other_;
907        return true;
908      }
909
910      public boolean isEmpty() {
911        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party);
912      }
913
914  public String fhirType() {
915    return "ExplanationOfBenefit.payee";
916
917  }
918
919  }
920
921    @Block()
922    public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
923        /**
924         * A number to uniquely identify care team entries.
925         */
926        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
927        @Description(shortDefinition="Order of care team", formalDefinition="A number to uniquely identify care team entries." )
928        protected PositiveIntType sequence;
929
930        /**
931         * Member of the team who provided the product or service.
932         */
933        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=2, min=1, max=1, modifier=false, summary=false)
934        @Description(shortDefinition="Practitioner or organization", formalDefinition="Member of the team who provided the product or service." )
935        protected Reference provider;
936
937        /**
938         * The actual object that is the target of the reference (Member of the team who provided the product or service.)
939         */
940        protected Resource providerTarget;
941
942        /**
943         * The party who is billing and/or responsible for the claimed products or services.
944         */
945        @Child(name = "responsible", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
946        @Description(shortDefinition="Indicator of the lead practitioner", formalDefinition="The party who is billing and/or responsible for the claimed products or services." )
947        protected BooleanType responsible;
948
949        /**
950         * The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.
951         */
952        @Child(name = "role", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
953        @Description(shortDefinition="Function within the team", formalDefinition="The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team." )
954        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-careteamrole")
955        protected CodeableConcept role;
956
957        /**
958         * The qualification of the practitioner which is applicable for this service.
959         */
960        @Child(name = "qualification", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
961        @Description(shortDefinition="Practitioner credential or specialization", formalDefinition="The qualification of the practitioner which is applicable for this service." )
962        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provider-qualification")
963        protected CodeableConcept qualification;
964
965        private static final long serialVersionUID = 1758966968L;
966
967    /**
968     * Constructor
969     */
970      public CareTeamComponent() {
971        super();
972      }
973
974    /**
975     * Constructor
976     */
977      public CareTeamComponent(PositiveIntType sequence, Reference provider) {
978        super();
979        this.sequence = sequence;
980        this.provider = provider;
981      }
982
983        /**
984         * @return {@link #sequence} (A number to uniquely identify care team entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
985         */
986        public PositiveIntType getSequenceElement() { 
987          if (this.sequence == null)
988            if (Configuration.errorOnAutoCreate())
989              throw new Error("Attempt to auto-create CareTeamComponent.sequence");
990            else if (Configuration.doAutoCreate())
991              this.sequence = new PositiveIntType(); // bb
992          return this.sequence;
993        }
994
995        public boolean hasSequenceElement() { 
996          return this.sequence != null && !this.sequence.isEmpty();
997        }
998
999        public boolean hasSequence() { 
1000          return this.sequence != null && !this.sequence.isEmpty();
1001        }
1002
1003        /**
1004         * @param value {@link #sequence} (A number to uniquely identify care team entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1005         */
1006        public CareTeamComponent setSequenceElement(PositiveIntType value) { 
1007          this.sequence = value;
1008          return this;
1009        }
1010
1011        /**
1012         * @return A number to uniquely identify care team entries.
1013         */
1014        public int getSequence() { 
1015          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1016        }
1017
1018        /**
1019         * @param value A number to uniquely identify care team entries.
1020         */
1021        public CareTeamComponent setSequence(int value) { 
1022            if (this.sequence == null)
1023              this.sequence = new PositiveIntType();
1024            this.sequence.setValue(value);
1025          return this;
1026        }
1027
1028        /**
1029         * @return {@link #provider} (Member of the team who provided the product or service.)
1030         */
1031        public Reference getProvider() { 
1032          if (this.provider == null)
1033            if (Configuration.errorOnAutoCreate())
1034              throw new Error("Attempt to auto-create CareTeamComponent.provider");
1035            else if (Configuration.doAutoCreate())
1036              this.provider = new Reference(); // cc
1037          return this.provider;
1038        }
1039
1040        public boolean hasProvider() { 
1041          return this.provider != null && !this.provider.isEmpty();
1042        }
1043
1044        /**
1045         * @param value {@link #provider} (Member of the team who provided the product or service.)
1046         */
1047        public CareTeamComponent setProvider(Reference value) { 
1048          this.provider = value;
1049          return this;
1050        }
1051
1052        /**
1053         * @return {@link #provider} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Member of the team who provided the product or service.)
1054         */
1055        public Resource getProviderTarget() { 
1056          return this.providerTarget;
1057        }
1058
1059        /**
1060         * @param value {@link #provider} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Member of the team who provided the product or service.)
1061         */
1062        public CareTeamComponent setProviderTarget(Resource value) { 
1063          this.providerTarget = value;
1064          return this;
1065        }
1066
1067        /**
1068         * @return {@link #responsible} (The party who is billing and/or responsible for the claimed products or services.). This is the underlying object with id, value and extensions. The accessor "getResponsible" gives direct access to the value
1069         */
1070        public BooleanType getResponsibleElement() { 
1071          if (this.responsible == null)
1072            if (Configuration.errorOnAutoCreate())
1073              throw new Error("Attempt to auto-create CareTeamComponent.responsible");
1074            else if (Configuration.doAutoCreate())
1075              this.responsible = new BooleanType(); // bb
1076          return this.responsible;
1077        }
1078
1079        public boolean hasResponsibleElement() { 
1080          return this.responsible != null && !this.responsible.isEmpty();
1081        }
1082
1083        public boolean hasResponsible() { 
1084          return this.responsible != null && !this.responsible.isEmpty();
1085        }
1086
1087        /**
1088         * @param value {@link #responsible} (The party who is billing and/or responsible for the claimed products or services.). This is the underlying object with id, value and extensions. The accessor "getResponsible" gives direct access to the value
1089         */
1090        public CareTeamComponent setResponsibleElement(BooleanType value) { 
1091          this.responsible = value;
1092          return this;
1093        }
1094
1095        /**
1096         * @return The party who is billing and/or responsible for the claimed products or services.
1097         */
1098        public boolean getResponsible() { 
1099          return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
1100        }
1101
1102        /**
1103         * @param value The party who is billing and/or responsible for the claimed products or services.
1104         */
1105        public CareTeamComponent setResponsible(boolean value) { 
1106            if (this.responsible == null)
1107              this.responsible = new BooleanType();
1108            this.responsible.setValue(value);
1109          return this;
1110        }
1111
1112        /**
1113         * @return {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.)
1114         */
1115        public CodeableConcept getRole() { 
1116          if (this.role == null)
1117            if (Configuration.errorOnAutoCreate())
1118              throw new Error("Attempt to auto-create CareTeamComponent.role");
1119            else if (Configuration.doAutoCreate())
1120              this.role = new CodeableConcept(); // cc
1121          return this.role;
1122        }
1123
1124        public boolean hasRole() { 
1125          return this.role != null && !this.role.isEmpty();
1126        }
1127
1128        /**
1129         * @param value {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.)
1130         */
1131        public CareTeamComponent setRole(CodeableConcept value) { 
1132          this.role = value;
1133          return this;
1134        }
1135
1136        /**
1137         * @return {@link #qualification} (The qualification of the practitioner which is applicable for this service.)
1138         */
1139        public CodeableConcept getQualification() { 
1140          if (this.qualification == null)
1141            if (Configuration.errorOnAutoCreate())
1142              throw new Error("Attempt to auto-create CareTeamComponent.qualification");
1143            else if (Configuration.doAutoCreate())
1144              this.qualification = new CodeableConcept(); // cc
1145          return this.qualification;
1146        }
1147
1148        public boolean hasQualification() { 
1149          return this.qualification != null && !this.qualification.isEmpty();
1150        }
1151
1152        /**
1153         * @param value {@link #qualification} (The qualification of the practitioner which is applicable for this service.)
1154         */
1155        public CareTeamComponent setQualification(CodeableConcept value) { 
1156          this.qualification = value;
1157          return this;
1158        }
1159
1160        protected void listChildren(List<Property> children) {
1161          super.listChildren(children);
1162          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence));
1163          children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "Member of the team who provided the product or service.", 0, 1, provider));
1164          children.add(new Property("responsible", "boolean", "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible));
1165          children.add(new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1, role));
1166          children.add(new Property("qualification", "CodeableConcept", "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification));
1167        }
1168
1169        @Override
1170        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1171          switch (_hash) {
1172          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence);
1173          case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "Member of the team who provided the product or service.", 0, 1, provider);
1174          case 1847674614: /*responsible*/  return new Property("responsible", "boolean", "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible);
1175          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1, role);
1176          case -631333393: /*qualification*/  return new Property("qualification", "CodeableConcept", "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification);
1177          default: return super.getNamedProperty(_hash, _name, _checkValid);
1178          }
1179
1180        }
1181
1182      @Override
1183      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1184        switch (hash) {
1185        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1186        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
1187        case 1847674614: /*responsible*/ return this.responsible == null ? new Base[0] : new Base[] {this.responsible}; // BooleanType
1188        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
1189        case -631333393: /*qualification*/ return this.qualification == null ? new Base[0] : new Base[] {this.qualification}; // CodeableConcept
1190        default: return super.getProperty(hash, name, checkValid);
1191        }
1192
1193      }
1194
1195      @Override
1196      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1197        switch (hash) {
1198        case 1349547969: // sequence
1199          this.sequence = castToPositiveInt(value); // PositiveIntType
1200          return value;
1201        case -987494927: // provider
1202          this.provider = castToReference(value); // Reference
1203          return value;
1204        case 1847674614: // responsible
1205          this.responsible = castToBoolean(value); // BooleanType
1206          return value;
1207        case 3506294: // role
1208          this.role = castToCodeableConcept(value); // CodeableConcept
1209          return value;
1210        case -631333393: // qualification
1211          this.qualification = castToCodeableConcept(value); // CodeableConcept
1212          return value;
1213        default: return super.setProperty(hash, name, value);
1214        }
1215
1216      }
1217
1218      @Override
1219      public Base setProperty(String name, Base value) throws FHIRException {
1220        if (name.equals("sequence")) {
1221          this.sequence = castToPositiveInt(value); // PositiveIntType
1222        } else if (name.equals("provider")) {
1223          this.provider = castToReference(value); // Reference
1224        } else if (name.equals("responsible")) {
1225          this.responsible = castToBoolean(value); // BooleanType
1226        } else if (name.equals("role")) {
1227          this.role = castToCodeableConcept(value); // CodeableConcept
1228        } else if (name.equals("qualification")) {
1229          this.qualification = castToCodeableConcept(value); // CodeableConcept
1230        } else
1231          return super.setProperty(name, value);
1232        return value;
1233      }
1234
1235      @Override
1236      public Base makeProperty(int hash, String name) throws FHIRException {
1237        switch (hash) {
1238        case 1349547969:  return getSequenceElement();
1239        case -987494927:  return getProvider(); 
1240        case 1847674614:  return getResponsibleElement();
1241        case 3506294:  return getRole(); 
1242        case -631333393:  return getQualification(); 
1243        default: return super.makeProperty(hash, name);
1244        }
1245
1246      }
1247
1248      @Override
1249      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1250        switch (hash) {
1251        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1252        case -987494927: /*provider*/ return new String[] {"Reference"};
1253        case 1847674614: /*responsible*/ return new String[] {"boolean"};
1254        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
1255        case -631333393: /*qualification*/ return new String[] {"CodeableConcept"};
1256        default: return super.getTypesForProperty(hash, name);
1257        }
1258
1259      }
1260
1261      @Override
1262      public Base addChild(String name) throws FHIRException {
1263        if (name.equals("sequence")) {
1264          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1265        }
1266        else if (name.equals("provider")) {
1267          this.provider = new Reference();
1268          return this.provider;
1269        }
1270        else if (name.equals("responsible")) {
1271          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.responsible");
1272        }
1273        else if (name.equals("role")) {
1274          this.role = new CodeableConcept();
1275          return this.role;
1276        }
1277        else if (name.equals("qualification")) {
1278          this.qualification = new CodeableConcept();
1279          return this.qualification;
1280        }
1281        else
1282          return super.addChild(name);
1283      }
1284
1285      public CareTeamComponent copy() {
1286        CareTeamComponent dst = new CareTeamComponent();
1287        copyValues(dst);
1288        dst.sequence = sequence == null ? null : sequence.copy();
1289        dst.provider = provider == null ? null : provider.copy();
1290        dst.responsible = responsible == null ? null : responsible.copy();
1291        dst.role = role == null ? null : role.copy();
1292        dst.qualification = qualification == null ? null : qualification.copy();
1293        return dst;
1294      }
1295
1296      @Override
1297      public boolean equalsDeep(Base other_) {
1298        if (!super.equalsDeep(other_))
1299          return false;
1300        if (!(other_ instanceof CareTeamComponent))
1301          return false;
1302        CareTeamComponent o = (CareTeamComponent) other_;
1303        return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true) && compareDeep(responsible, o.responsible, true)
1304           && compareDeep(role, o.role, true) && compareDeep(qualification, o.qualification, true);
1305      }
1306
1307      @Override
1308      public boolean equalsShallow(Base other_) {
1309        if (!super.equalsShallow(other_))
1310          return false;
1311        if (!(other_ instanceof CareTeamComponent))
1312          return false;
1313        CareTeamComponent o = (CareTeamComponent) other_;
1314        return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true)
1315          ;
1316      }
1317
1318      public boolean isEmpty() {
1319        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible
1320          , role, qualification);
1321      }
1322
1323  public String fhirType() {
1324    return "ExplanationOfBenefit.careTeam";
1325
1326  }
1327
1328  }
1329
1330    @Block()
1331    public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
1332        /**
1333         * A number to uniquely identify supporting information entries.
1334         */
1335        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1336        @Description(shortDefinition="Information instance identifier", formalDefinition="A number to uniquely identify supporting information entries." )
1337        protected PositiveIntType sequence;
1338
1339        /**
1340         * The general class of the information supplied: information; exception; accident, employment; onset, etc.
1341         */
1342        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
1343        @Description(shortDefinition="Classification of the supplied information", formalDefinition="The general class of the information supplied: information; exception; accident, employment; onset, etc." )
1344        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-informationcategory")
1345        protected CodeableConcept category;
1346
1347        /**
1348         * System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.
1349         */
1350        @Child(name = "code", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1351        @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." )
1352        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-exception")
1353        protected CodeableConcept code;
1354
1355        /**
1356         * The date when or period to which this information refers.
1357         */
1358        @Child(name = "timing", type = {DateType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
1359        @Description(shortDefinition="When it occurred", formalDefinition="The date when or period to which this information refers." )
1360        protected Type timing;
1361
1362        /**
1363         * Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.
1364         */
1365        @Child(name = "value", type = {BooleanType.class, StringType.class, Quantity.class, Attachment.class, Reference.class}, order=5, min=0, max=1, modifier=false, summary=false)
1366        @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." )
1367        protected Type value;
1368
1369        /**
1370         * Provides the reason in the situation where a reason code is required in addition to the content.
1371         */
1372        @Child(name = "reason", type = {Coding.class}, order=6, min=0, max=1, modifier=false, summary=false)
1373        @Description(shortDefinition="Explanation for the information", formalDefinition="Provides the reason in the situation where a reason code is required in addition to the content." )
1374        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/missing-tooth-reason")
1375        protected Coding reason;
1376
1377        private static final long serialVersionUID = -410136661L;
1378
1379    /**
1380     * Constructor
1381     */
1382      public SupportingInformationComponent() {
1383        super();
1384      }
1385
1386    /**
1387     * Constructor
1388     */
1389      public SupportingInformationComponent(PositiveIntType sequence, CodeableConcept category) {
1390        super();
1391        this.sequence = sequence;
1392        this.category = category;
1393      }
1394
1395        /**
1396         * @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
1397         */
1398        public PositiveIntType getSequenceElement() { 
1399          if (this.sequence == null)
1400            if (Configuration.errorOnAutoCreate())
1401              throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
1402            else if (Configuration.doAutoCreate())
1403              this.sequence = new PositiveIntType(); // bb
1404          return this.sequence;
1405        }
1406
1407        public boolean hasSequenceElement() { 
1408          return this.sequence != null && !this.sequence.isEmpty();
1409        }
1410
1411        public boolean hasSequence() { 
1412          return this.sequence != null && !this.sequence.isEmpty();
1413        }
1414
1415        /**
1416         * @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
1417         */
1418        public SupportingInformationComponent setSequenceElement(PositiveIntType value) { 
1419          this.sequence = value;
1420          return this;
1421        }
1422
1423        /**
1424         * @return A number to uniquely identify supporting information entries.
1425         */
1426        public int getSequence() { 
1427          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1428        }
1429
1430        /**
1431         * @param value A number to uniquely identify supporting information entries.
1432         */
1433        public SupportingInformationComponent setSequence(int value) { 
1434            if (this.sequence == null)
1435              this.sequence = new PositiveIntType();
1436            this.sequence.setValue(value);
1437          return this;
1438        }
1439
1440        /**
1441         * @return {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1442         */
1443        public CodeableConcept getCategory() { 
1444          if (this.category == null)
1445            if (Configuration.errorOnAutoCreate())
1446              throw new Error("Attempt to auto-create SupportingInformationComponent.category");
1447            else if (Configuration.doAutoCreate())
1448              this.category = new CodeableConcept(); // cc
1449          return this.category;
1450        }
1451
1452        public boolean hasCategory() { 
1453          return this.category != null && !this.category.isEmpty();
1454        }
1455
1456        /**
1457         * @param value {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1458         */
1459        public SupportingInformationComponent setCategory(CodeableConcept value) { 
1460          this.category = value;
1461          return this;
1462        }
1463
1464        /**
1465         * @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.)
1466         */
1467        public CodeableConcept getCode() { 
1468          if (this.code == null)
1469            if (Configuration.errorOnAutoCreate())
1470              throw new Error("Attempt to auto-create SupportingInformationComponent.code");
1471            else if (Configuration.doAutoCreate())
1472              this.code = new CodeableConcept(); // cc
1473          return this.code;
1474        }
1475
1476        public boolean hasCode() { 
1477          return this.code != null && !this.code.isEmpty();
1478        }
1479
1480        /**
1481         * @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.)
1482         */
1483        public SupportingInformationComponent setCode(CodeableConcept value) { 
1484          this.code = value;
1485          return this;
1486        }
1487
1488        /**
1489         * @return {@link #timing} (The date when or period to which this information refers.)
1490         */
1491        public Type getTiming() { 
1492          return this.timing;
1493        }
1494
1495        /**
1496         * @return {@link #timing} (The date when or period to which this information refers.)
1497         */
1498        public DateType getTimingDateType() throws FHIRException { 
1499          if (this.timing == null)
1500            this.timing = new DateType();
1501          if (!(this.timing instanceof DateType))
1502            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.timing.getClass().getName()+" was encountered");
1503          return (DateType) this.timing;
1504        }
1505
1506        public boolean hasTimingDateType() { 
1507          return this != null && this.timing instanceof DateType;
1508        }
1509
1510        /**
1511         * @return {@link #timing} (The date when or period to which this information refers.)
1512         */
1513        public Period getTimingPeriod() throws FHIRException { 
1514          if (this.timing == null)
1515            this.timing = new Period();
1516          if (!(this.timing instanceof Period))
1517            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
1518          return (Period) this.timing;
1519        }
1520
1521        public boolean hasTimingPeriod() { 
1522          return this != null && this.timing instanceof Period;
1523        }
1524
1525        public boolean hasTiming() { 
1526          return this.timing != null && !this.timing.isEmpty();
1527        }
1528
1529        /**
1530         * @param value {@link #timing} (The date when or period to which this information refers.)
1531         */
1532        public SupportingInformationComponent setTiming(Type value) { 
1533          if (value != null && !(value instanceof DateType || value instanceof Period))
1534            throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.timing[x]: "+value.fhirType());
1535          this.timing = value;
1536          return this;
1537        }
1538
1539        /**
1540         * @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.)
1541         */
1542        public Type getValue() { 
1543          return this.value;
1544        }
1545
1546        /**
1547         * @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.)
1548         */
1549        public BooleanType getValueBooleanType() throws FHIRException { 
1550          if (this.value == null)
1551            this.value = new BooleanType();
1552          if (!(this.value instanceof BooleanType))
1553            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
1554          return (BooleanType) this.value;
1555        }
1556
1557        public boolean hasValueBooleanType() { 
1558          return this != null && this.value instanceof BooleanType;
1559        }
1560
1561        /**
1562         * @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.)
1563         */
1564        public StringType getValueStringType() throws FHIRException { 
1565          if (this.value == null)
1566            this.value = new StringType();
1567          if (!(this.value instanceof StringType))
1568            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
1569          return (StringType) this.value;
1570        }
1571
1572        public boolean hasValueStringType() { 
1573          return this != null && this.value instanceof StringType;
1574        }
1575
1576        /**
1577         * @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.)
1578         */
1579        public Quantity getValueQuantity() throws FHIRException { 
1580          if (this.value == null)
1581            this.value = new Quantity();
1582          if (!(this.value instanceof Quantity))
1583            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
1584          return (Quantity) this.value;
1585        }
1586
1587        public boolean hasValueQuantity() { 
1588          return this != null && this.value instanceof Quantity;
1589        }
1590
1591        /**
1592         * @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.)
1593         */
1594        public Attachment getValueAttachment() throws FHIRException { 
1595          if (this.value == null)
1596            this.value = new Attachment();
1597          if (!(this.value instanceof Attachment))
1598            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
1599          return (Attachment) this.value;
1600        }
1601
1602        public boolean hasValueAttachment() { 
1603          return this != null && this.value instanceof Attachment;
1604        }
1605
1606        /**
1607         * @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.)
1608         */
1609        public Reference getValueReference() throws FHIRException { 
1610          if (this.value == null)
1611            this.value = new Reference();
1612          if (!(this.value instanceof Reference))
1613            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
1614          return (Reference) this.value;
1615        }
1616
1617        public boolean hasValueReference() { 
1618          return this != null && this.value instanceof Reference;
1619        }
1620
1621        public boolean hasValue() { 
1622          return this.value != null && !this.value.isEmpty();
1623        }
1624
1625        /**
1626         * @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.)
1627         */
1628        public SupportingInformationComponent setValue(Type value) { 
1629          if (value != null && !(value instanceof BooleanType || value instanceof StringType || value instanceof Quantity || value instanceof Attachment || value instanceof Reference))
1630            throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.value[x]: "+value.fhirType());
1631          this.value = value;
1632          return this;
1633        }
1634
1635        /**
1636         * @return {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1637         */
1638        public Coding getReason() { 
1639          if (this.reason == null)
1640            if (Configuration.errorOnAutoCreate())
1641              throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1642            else if (Configuration.doAutoCreate())
1643              this.reason = new Coding(); // cc
1644          return this.reason;
1645        }
1646
1647        public boolean hasReason() { 
1648          return this.reason != null && !this.reason.isEmpty();
1649        }
1650
1651        /**
1652         * @param value {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1653         */
1654        public SupportingInformationComponent setReason(Coding value) { 
1655          this.reason = value;
1656          return this;
1657        }
1658
1659        protected void listChildren(List<Property> children) {
1660          super.listChildren(children);
1661          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence));
1662          children.add(new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category));
1663          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));
1664          children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing));
1665          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));
1666          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));
1667        }
1668
1669        @Override
1670        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1671          switch (_hash) {
1672          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence);
1673          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category);
1674          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);
1675          case 164632566: /*timing[x]*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1676          case -873664438: /*timing*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1677          case 807935768: /*timingDate*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1678          case -615615829: /*timingPeriod*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1679          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);
1680          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);
1681          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);
1682          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);
1683          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);
1684          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);
1685          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);
1686          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);
1687          default: return super.getNamedProperty(_hash, _name, _checkValid);
1688          }
1689
1690        }
1691
1692      @Override
1693      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1694        switch (hash) {
1695        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1696        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1697        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1698        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Type
1699        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
1700        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
1701        default: return super.getProperty(hash, name, checkValid);
1702        }
1703
1704      }
1705
1706      @Override
1707      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1708        switch (hash) {
1709        case 1349547969: // sequence
1710          this.sequence = castToPositiveInt(value); // PositiveIntType
1711          return value;
1712        case 50511102: // category
1713          this.category = castToCodeableConcept(value); // CodeableConcept
1714          return value;
1715        case 3059181: // code
1716          this.code = castToCodeableConcept(value); // CodeableConcept
1717          return value;
1718        case -873664438: // timing
1719          this.timing = castToType(value); // Type
1720          return value;
1721        case 111972721: // value
1722          this.value = castToType(value); // Type
1723          return value;
1724        case -934964668: // reason
1725          this.reason = castToCoding(value); // Coding
1726          return value;
1727        default: return super.setProperty(hash, name, value);
1728        }
1729
1730      }
1731
1732      @Override
1733      public Base setProperty(String name, Base value) throws FHIRException {
1734        if (name.equals("sequence")) {
1735          this.sequence = castToPositiveInt(value); // PositiveIntType
1736        } else if (name.equals("category")) {
1737          this.category = castToCodeableConcept(value); // CodeableConcept
1738        } else if (name.equals("code")) {
1739          this.code = castToCodeableConcept(value); // CodeableConcept
1740        } else if (name.equals("timing[x]")) {
1741          this.timing = castToType(value); // Type
1742        } else if (name.equals("value[x]")) {
1743          this.value = castToType(value); // Type
1744        } else if (name.equals("reason")) {
1745          this.reason = castToCoding(value); // Coding
1746        } else
1747          return super.setProperty(name, value);
1748        return value;
1749      }
1750
1751      @Override
1752      public Base makeProperty(int hash, String name) throws FHIRException {
1753        switch (hash) {
1754        case 1349547969:  return getSequenceElement();
1755        case 50511102:  return getCategory(); 
1756        case 3059181:  return getCode(); 
1757        case 164632566:  return getTiming(); 
1758        case -873664438:  return getTiming(); 
1759        case -1410166417:  return getValue(); 
1760        case 111972721:  return getValue(); 
1761        case -934964668:  return getReason(); 
1762        default: return super.makeProperty(hash, name);
1763        }
1764
1765      }
1766
1767      @Override
1768      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1769        switch (hash) {
1770        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1771        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1772        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1773        case -873664438: /*timing*/ return new String[] {"date", "Period"};
1774        case 111972721: /*value*/ return new String[] {"boolean", "string", "Quantity", "Attachment", "Reference"};
1775        case -934964668: /*reason*/ return new String[] {"Coding"};
1776        default: return super.getTypesForProperty(hash, name);
1777        }
1778
1779      }
1780
1781      @Override
1782      public Base addChild(String name) throws FHIRException {
1783        if (name.equals("sequence")) {
1784          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1785        }
1786        else if (name.equals("category")) {
1787          this.category = new CodeableConcept();
1788          return this.category;
1789        }
1790        else if (name.equals("code")) {
1791          this.code = new CodeableConcept();
1792          return this.code;
1793        }
1794        else if (name.equals("timingDate")) {
1795          this.timing = new DateType();
1796          return this.timing;
1797        }
1798        else if (name.equals("timingPeriod")) {
1799          this.timing = new Period();
1800          return this.timing;
1801        }
1802        else if (name.equals("valueBoolean")) {
1803          this.value = new BooleanType();
1804          return this.value;
1805        }
1806        else if (name.equals("valueString")) {
1807          this.value = new StringType();
1808          return this.value;
1809        }
1810        else if (name.equals("valueQuantity")) {
1811          this.value = new Quantity();
1812          return this.value;
1813        }
1814        else if (name.equals("valueAttachment")) {
1815          this.value = new Attachment();
1816          return this.value;
1817        }
1818        else if (name.equals("valueReference")) {
1819          this.value = new Reference();
1820          return this.value;
1821        }
1822        else if (name.equals("reason")) {
1823          this.reason = new Coding();
1824          return this.reason;
1825        }
1826        else
1827          return super.addChild(name);
1828      }
1829
1830      public SupportingInformationComponent copy() {
1831        SupportingInformationComponent dst = new SupportingInformationComponent();
1832        copyValues(dst);
1833        dst.sequence = sequence == null ? null : sequence.copy();
1834        dst.category = category == null ? null : category.copy();
1835        dst.code = code == null ? null : code.copy();
1836        dst.timing = timing == null ? null : timing.copy();
1837        dst.value = value == null ? null : value.copy();
1838        dst.reason = reason == null ? null : reason.copy();
1839        return dst;
1840      }
1841
1842      @Override
1843      public boolean equalsDeep(Base other_) {
1844        if (!super.equalsDeep(other_))
1845          return false;
1846        if (!(other_ instanceof SupportingInformationComponent))
1847          return false;
1848        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1849        return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true) && compareDeep(code, o.code, true)
1850           && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true) && compareDeep(reason, o.reason, true)
1851          ;
1852      }
1853
1854      @Override
1855      public boolean equalsShallow(Base other_) {
1856        if (!super.equalsShallow(other_))
1857          return false;
1858        if (!(other_ instanceof SupportingInformationComponent))
1859          return false;
1860        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1861        return compareValues(sequence, o.sequence, true);
1862      }
1863
1864      public boolean isEmpty() {
1865        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code
1866          , timing, value, reason);
1867      }
1868
1869  public String fhirType() {
1870    return "ExplanationOfBenefit.supportingInfo";
1871
1872  }
1873
1874  }
1875
1876    @Block()
1877    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
1878        /**
1879         * A number to uniquely identify diagnosis entries.
1880         */
1881        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1882        @Description(shortDefinition="Diagnosis instance identifier", formalDefinition="A number to uniquely identify diagnosis entries." )
1883        protected PositiveIntType sequence;
1884
1885        /**
1886         * The nature of illness or problem in a coded form or as a reference to an external defined Condition.
1887         */
1888        @Child(name = "diagnosis", type = {CodeableConcept.class, Condition.class}, order=2, min=1, max=1, modifier=false, summary=false)
1889        @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." )
1890        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10")
1891        protected Type diagnosis;
1892
1893        /**
1894         * When the condition was observed or the relative ranking.
1895         */
1896        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1897        @Description(shortDefinition="Timing or nature of the diagnosis", formalDefinition="When the condition was observed or the relative ranking." )
1898        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosistype")
1899        protected List<CodeableConcept> type;
1900
1901        /**
1902         * Indication of whether the diagnosis was present on admission to a facility.
1903         */
1904        @Child(name = "onAdmission", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1905        @Description(shortDefinition="Present on admission", formalDefinition="Indication of whether the diagnosis was present on admission to a facility." )
1906        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosis-on-admission")
1907        protected CodeableConcept onAdmission;
1908
1909        /**
1910         * 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.
1911         */
1912        @Child(name = "packageCode", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1913        @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." )
1914        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
1915        protected CodeableConcept packageCode;
1916
1917        private static final long serialVersionUID = 2120593974L;
1918
1919    /**
1920     * Constructor
1921     */
1922      public DiagnosisComponent() {
1923        super();
1924      }
1925
1926    /**
1927     * Constructor
1928     */
1929      public DiagnosisComponent(PositiveIntType sequence, Type diagnosis) {
1930        super();
1931        this.sequence = sequence;
1932        this.diagnosis = diagnosis;
1933      }
1934
1935        /**
1936         * @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
1937         */
1938        public PositiveIntType getSequenceElement() { 
1939          if (this.sequence == null)
1940            if (Configuration.errorOnAutoCreate())
1941              throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
1942            else if (Configuration.doAutoCreate())
1943              this.sequence = new PositiveIntType(); // bb
1944          return this.sequence;
1945        }
1946
1947        public boolean hasSequenceElement() { 
1948          return this.sequence != null && !this.sequence.isEmpty();
1949        }
1950
1951        public boolean hasSequence() { 
1952          return this.sequence != null && !this.sequence.isEmpty();
1953        }
1954
1955        /**
1956         * @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
1957         */
1958        public DiagnosisComponent setSequenceElement(PositiveIntType value) { 
1959          this.sequence = value;
1960          return this;
1961        }
1962
1963        /**
1964         * @return A number to uniquely identify diagnosis entries.
1965         */
1966        public int getSequence() { 
1967          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1968        }
1969
1970        /**
1971         * @param value A number to uniquely identify diagnosis entries.
1972         */
1973        public DiagnosisComponent setSequence(int value) { 
1974            if (this.sequence == null)
1975              this.sequence = new PositiveIntType();
1976            this.sequence.setValue(value);
1977          return this;
1978        }
1979
1980        /**
1981         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1982         */
1983        public Type getDiagnosis() { 
1984          return this.diagnosis;
1985        }
1986
1987        /**
1988         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1989         */
1990        public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException { 
1991          if (this.diagnosis == null)
1992            this.diagnosis = new CodeableConcept();
1993          if (!(this.diagnosis instanceof CodeableConcept))
1994            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1995          return (CodeableConcept) this.diagnosis;
1996        }
1997
1998        public boolean hasDiagnosisCodeableConcept() { 
1999          return this != null && this.diagnosis instanceof CodeableConcept;
2000        }
2001
2002        /**
2003         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
2004         */
2005        public Reference getDiagnosisReference() throws FHIRException { 
2006          if (this.diagnosis == null)
2007            this.diagnosis = new Reference();
2008          if (!(this.diagnosis instanceof Reference))
2009            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
2010          return (Reference) this.diagnosis;
2011        }
2012
2013        public boolean hasDiagnosisReference() { 
2014          return this != null && this.diagnosis instanceof Reference;
2015        }
2016
2017        public boolean hasDiagnosis() { 
2018          return this.diagnosis != null && !this.diagnosis.isEmpty();
2019        }
2020
2021        /**
2022         * @param value {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
2023         */
2024        public DiagnosisComponent setDiagnosis(Type value) { 
2025          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2026            throw new Error("Not the right type for ExplanationOfBenefit.diagnosis.diagnosis[x]: "+value.fhirType());
2027          this.diagnosis = value;
2028          return this;
2029        }
2030
2031        /**
2032         * @return {@link #type} (When the condition was observed or the relative ranking.)
2033         */
2034        public List<CodeableConcept> getType() { 
2035          if (this.type == null)
2036            this.type = new ArrayList<CodeableConcept>();
2037          return this.type;
2038        }
2039
2040        /**
2041         * @return Returns a reference to <code>this</code> for easy method chaining
2042         */
2043        public DiagnosisComponent setType(List<CodeableConcept> theType) { 
2044          this.type = theType;
2045          return this;
2046        }
2047
2048        public boolean hasType() { 
2049          if (this.type == null)
2050            return false;
2051          for (CodeableConcept item : this.type)
2052            if (!item.isEmpty())
2053              return true;
2054          return false;
2055        }
2056
2057        public CodeableConcept addType() { //3
2058          CodeableConcept t = new CodeableConcept();
2059          if (this.type == null)
2060            this.type = new ArrayList<CodeableConcept>();
2061          this.type.add(t);
2062          return t;
2063        }
2064
2065        public DiagnosisComponent addType(CodeableConcept t) { //3
2066          if (t == null)
2067            return this;
2068          if (this.type == null)
2069            this.type = new ArrayList<CodeableConcept>();
2070          this.type.add(t);
2071          return this;
2072        }
2073
2074        /**
2075         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
2076         */
2077        public CodeableConcept getTypeFirstRep() { 
2078          if (getType().isEmpty()) {
2079            addType();
2080          }
2081          return getType().get(0);
2082        }
2083
2084        /**
2085         * @return {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
2086         */
2087        public CodeableConcept getOnAdmission() { 
2088          if (this.onAdmission == null)
2089            if (Configuration.errorOnAutoCreate())
2090              throw new Error("Attempt to auto-create DiagnosisComponent.onAdmission");
2091            else if (Configuration.doAutoCreate())
2092              this.onAdmission = new CodeableConcept(); // cc
2093          return this.onAdmission;
2094        }
2095
2096        public boolean hasOnAdmission() { 
2097          return this.onAdmission != null && !this.onAdmission.isEmpty();
2098        }
2099
2100        /**
2101         * @param value {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
2102         */
2103        public DiagnosisComponent setOnAdmission(CodeableConcept value) { 
2104          this.onAdmission = value;
2105          return this;
2106        }
2107
2108        /**
2109         * @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.)
2110         */
2111        public CodeableConcept getPackageCode() { 
2112          if (this.packageCode == null)
2113            if (Configuration.errorOnAutoCreate())
2114              throw new Error("Attempt to auto-create DiagnosisComponent.packageCode");
2115            else if (Configuration.doAutoCreate())
2116              this.packageCode = new CodeableConcept(); // cc
2117          return this.packageCode;
2118        }
2119
2120        public boolean hasPackageCode() { 
2121          return this.packageCode != null && !this.packageCode.isEmpty();
2122        }
2123
2124        /**
2125         * @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.)
2126         */
2127        public DiagnosisComponent setPackageCode(CodeableConcept value) { 
2128          this.packageCode = value;
2129          return this;
2130        }
2131
2132        protected void listChildren(List<Property> children) {
2133          super.listChildren(children);
2134          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence));
2135          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));
2136          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
2137          children.add(new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission));
2138          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));
2139        }
2140
2141        @Override
2142        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2143          switch (_hash) {
2144          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence);
2145          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);
2146          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);
2147          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);
2148          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);
2149          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2150          case -3386134: /*onAdmission*/  return new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission);
2151          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);
2152          default: return super.getNamedProperty(_hash, _name, _checkValid);
2153          }
2154
2155        }
2156
2157      @Override
2158      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2159        switch (hash) {
2160        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2161        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // Type
2162        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2163        case -3386134: /*onAdmission*/ return this.onAdmission == null ? new Base[0] : new Base[] {this.onAdmission}; // CodeableConcept
2164        case 908444499: /*packageCode*/ return this.packageCode == null ? new Base[0] : new Base[] {this.packageCode}; // CodeableConcept
2165        default: return super.getProperty(hash, name, checkValid);
2166        }
2167
2168      }
2169
2170      @Override
2171      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2172        switch (hash) {
2173        case 1349547969: // sequence
2174          this.sequence = castToPositiveInt(value); // PositiveIntType
2175          return value;
2176        case 1196993265: // diagnosis
2177          this.diagnosis = castToType(value); // Type
2178          return value;
2179        case 3575610: // type
2180          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
2181          return value;
2182        case -3386134: // onAdmission
2183          this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2184          return value;
2185        case 908444499: // packageCode
2186          this.packageCode = castToCodeableConcept(value); // CodeableConcept
2187          return value;
2188        default: return super.setProperty(hash, name, value);
2189        }
2190
2191      }
2192
2193      @Override
2194      public Base setProperty(String name, Base value) throws FHIRException {
2195        if (name.equals("sequence")) {
2196          this.sequence = castToPositiveInt(value); // PositiveIntType
2197        } else if (name.equals("diagnosis[x]")) {
2198          this.diagnosis = castToType(value); // Type
2199        } else if (name.equals("type")) {
2200          this.getType().add(castToCodeableConcept(value));
2201        } else if (name.equals("onAdmission")) {
2202          this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2203        } else if (name.equals("packageCode")) {
2204          this.packageCode = castToCodeableConcept(value); // CodeableConcept
2205        } else
2206          return super.setProperty(name, value);
2207        return value;
2208      }
2209
2210      @Override
2211      public Base makeProperty(int hash, String name) throws FHIRException {
2212        switch (hash) {
2213        case 1349547969:  return getSequenceElement();
2214        case -1487009809:  return getDiagnosis(); 
2215        case 1196993265:  return getDiagnosis(); 
2216        case 3575610:  return addType(); 
2217        case -3386134:  return getOnAdmission(); 
2218        case 908444499:  return getPackageCode(); 
2219        default: return super.makeProperty(hash, name);
2220        }
2221
2222      }
2223
2224      @Override
2225      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2226        switch (hash) {
2227        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2228        case 1196993265: /*diagnosis*/ return new String[] {"CodeableConcept", "Reference"};
2229        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2230        case -3386134: /*onAdmission*/ return new String[] {"CodeableConcept"};
2231        case 908444499: /*packageCode*/ return new String[] {"CodeableConcept"};
2232        default: return super.getTypesForProperty(hash, name);
2233        }
2234
2235      }
2236
2237      @Override
2238      public Base addChild(String name) throws FHIRException {
2239        if (name.equals("sequence")) {
2240          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
2241        }
2242        else if (name.equals("diagnosisCodeableConcept")) {
2243          this.diagnosis = new CodeableConcept();
2244          return this.diagnosis;
2245        }
2246        else if (name.equals("diagnosisReference")) {
2247          this.diagnosis = new Reference();
2248          return this.diagnosis;
2249        }
2250        else if (name.equals("type")) {
2251          return addType();
2252        }
2253        else if (name.equals("onAdmission")) {
2254          this.onAdmission = new CodeableConcept();
2255          return this.onAdmission;
2256        }
2257        else if (name.equals("packageCode")) {
2258          this.packageCode = new CodeableConcept();
2259          return this.packageCode;
2260        }
2261        else
2262          return super.addChild(name);
2263      }
2264
2265      public DiagnosisComponent copy() {
2266        DiagnosisComponent dst = new DiagnosisComponent();
2267        copyValues(dst);
2268        dst.sequence = sequence == null ? null : sequence.copy();
2269        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
2270        if (type != null) {
2271          dst.type = new ArrayList<CodeableConcept>();
2272          for (CodeableConcept i : type)
2273            dst.type.add(i.copy());
2274        };
2275        dst.onAdmission = onAdmission == null ? null : onAdmission.copy();
2276        dst.packageCode = packageCode == null ? null : packageCode.copy();
2277        return dst;
2278      }
2279
2280      @Override
2281      public boolean equalsDeep(Base other_) {
2282        if (!super.equalsDeep(other_))
2283          return false;
2284        if (!(other_ instanceof DiagnosisComponent))
2285          return false;
2286        DiagnosisComponent o = (DiagnosisComponent) other_;
2287        return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(type, o.type, true)
2288           && compareDeep(onAdmission, o.onAdmission, true) && compareDeep(packageCode, o.packageCode, true)
2289          ;
2290      }
2291
2292      @Override
2293      public boolean equalsShallow(Base other_) {
2294        if (!super.equalsShallow(other_))
2295          return false;
2296        if (!(other_ instanceof DiagnosisComponent))
2297          return false;
2298        DiagnosisComponent o = (DiagnosisComponent) other_;
2299        return compareValues(sequence, o.sequence, true);
2300      }
2301
2302      public boolean isEmpty() {
2303        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type
2304          , onAdmission, packageCode);
2305      }
2306
2307  public String fhirType() {
2308    return "ExplanationOfBenefit.diagnosis";
2309
2310  }
2311
2312  }
2313
2314    @Block()
2315    public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
2316        /**
2317         * A number to uniquely identify procedure entries.
2318         */
2319        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2320        @Description(shortDefinition="Procedure instance identifier", formalDefinition="A number to uniquely identify procedure entries." )
2321        protected PositiveIntType sequence;
2322
2323        /**
2324         * When the condition was observed or the relative ranking.
2325         */
2326        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2327        @Description(shortDefinition="Category of Procedure", formalDefinition="When the condition was observed or the relative ranking." )
2328        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-procedure-type")
2329        protected List<CodeableConcept> type;
2330
2331        /**
2332         * Date and optionally time the procedure was performed.
2333         */
2334        @Child(name = "date", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2335        @Description(shortDefinition="When the procedure was performed", formalDefinition="Date and optionally time the procedure was performed." )
2336        protected DateTimeType date;
2337
2338        /**
2339         * The code or reference to a Procedure resource which identifies the clinical intervention performed.
2340         */
2341        @Child(name = "procedure", type = {CodeableConcept.class, Procedure.class}, order=4, min=1, max=1, modifier=false, summary=false)
2342        @Description(shortDefinition="Specific clinical procedure", formalDefinition="The code or reference to a Procedure resource which identifies the clinical intervention performed." )
2343        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10-procedures")
2344        protected Type procedure;
2345
2346        /**
2347         * Unique Device Identifiers associated with this line item.
2348         */
2349        @Child(name = "udi", type = {Device.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2350        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
2351        protected List<Reference> udi;
2352        /**
2353         * The actual objects that are the target of the reference (Unique Device Identifiers associated with this line item.)
2354         */
2355        protected List<Device> udiTarget;
2356
2357
2358        private static final long serialVersionUID = 935341852L;
2359
2360    /**
2361     * Constructor
2362     */
2363      public ProcedureComponent() {
2364        super();
2365      }
2366
2367    /**
2368     * Constructor
2369     */
2370      public ProcedureComponent(PositiveIntType sequence, Type procedure) {
2371        super();
2372        this.sequence = sequence;
2373        this.procedure = procedure;
2374      }
2375
2376        /**
2377         * @return {@link #sequence} (A number to uniquely identify procedure entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
2378         */
2379        public PositiveIntType getSequenceElement() { 
2380          if (this.sequence == null)
2381            if (Configuration.errorOnAutoCreate())
2382              throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2383            else if (Configuration.doAutoCreate())
2384              this.sequence = new PositiveIntType(); // bb
2385          return this.sequence;
2386        }
2387
2388        public boolean hasSequenceElement() { 
2389          return this.sequence != null && !this.sequence.isEmpty();
2390        }
2391
2392        public boolean hasSequence() { 
2393          return this.sequence != null && !this.sequence.isEmpty();
2394        }
2395
2396        /**
2397         * @param value {@link #sequence} (A number to uniquely identify procedure entries.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
2398         */
2399        public ProcedureComponent setSequenceElement(PositiveIntType value) { 
2400          this.sequence = value;
2401          return this;
2402        }
2403
2404        /**
2405         * @return A number to uniquely identify procedure entries.
2406         */
2407        public int getSequence() { 
2408          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2409        }
2410
2411        /**
2412         * @param value A number to uniquely identify procedure entries.
2413         */
2414        public ProcedureComponent setSequence(int value) { 
2415            if (this.sequence == null)
2416              this.sequence = new PositiveIntType();
2417            this.sequence.setValue(value);
2418          return this;
2419        }
2420
2421        /**
2422         * @return {@link #type} (When the condition was observed or the relative ranking.)
2423         */
2424        public List<CodeableConcept> getType() { 
2425          if (this.type == null)
2426            this.type = new ArrayList<CodeableConcept>();
2427          return this.type;
2428        }
2429
2430        /**
2431         * @return Returns a reference to <code>this</code> for easy method chaining
2432         */
2433        public ProcedureComponent setType(List<CodeableConcept> theType) { 
2434          this.type = theType;
2435          return this;
2436        }
2437
2438        public boolean hasType() { 
2439          if (this.type == null)
2440            return false;
2441          for (CodeableConcept item : this.type)
2442            if (!item.isEmpty())
2443              return true;
2444          return false;
2445        }
2446
2447        public CodeableConcept addType() { //3
2448          CodeableConcept t = new CodeableConcept();
2449          if (this.type == null)
2450            this.type = new ArrayList<CodeableConcept>();
2451          this.type.add(t);
2452          return t;
2453        }
2454
2455        public ProcedureComponent addType(CodeableConcept t) { //3
2456          if (t == null)
2457            return this;
2458          if (this.type == null)
2459            this.type = new ArrayList<CodeableConcept>();
2460          this.type.add(t);
2461          return this;
2462        }
2463
2464        /**
2465         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
2466         */
2467        public CodeableConcept getTypeFirstRep() { 
2468          if (getType().isEmpty()) {
2469            addType();
2470          }
2471          return getType().get(0);
2472        }
2473
2474        /**
2475         * @return {@link #date} (Date and optionally time the procedure was performed.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2476         */
2477        public DateTimeType getDateElement() { 
2478          if (this.date == null)
2479            if (Configuration.errorOnAutoCreate())
2480              throw new Error("Attempt to auto-create ProcedureComponent.date");
2481            else if (Configuration.doAutoCreate())
2482              this.date = new DateTimeType(); // bb
2483          return this.date;
2484        }
2485
2486        public boolean hasDateElement() { 
2487          return this.date != null && !this.date.isEmpty();
2488        }
2489
2490        public boolean hasDate() { 
2491          return this.date != null && !this.date.isEmpty();
2492        }
2493
2494        /**
2495         * @param value {@link #date} (Date and optionally time the procedure was performed.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2496         */
2497        public ProcedureComponent setDateElement(DateTimeType value) { 
2498          this.date = value;
2499          return this;
2500        }
2501
2502        /**
2503         * @return Date and optionally time the procedure was performed.
2504         */
2505        public Date getDate() { 
2506          return this.date == null ? null : this.date.getValue();
2507        }
2508
2509        /**
2510         * @param value Date and optionally time the procedure was performed.
2511         */
2512        public ProcedureComponent setDate(Date value) { 
2513          if (value == null)
2514            this.date = null;
2515          else {
2516            if (this.date == null)
2517              this.date = new DateTimeType();
2518            this.date.setValue(value);
2519          }
2520          return this;
2521        }
2522
2523        /**
2524         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2525         */
2526        public Type getProcedure() { 
2527          return this.procedure;
2528        }
2529
2530        /**
2531         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2532         */
2533        public CodeableConcept getProcedureCodeableConcept() throws FHIRException { 
2534          if (this.procedure == null)
2535            this.procedure = new CodeableConcept();
2536          if (!(this.procedure instanceof CodeableConcept))
2537            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.procedure.getClass().getName()+" was encountered");
2538          return (CodeableConcept) this.procedure;
2539        }
2540
2541        public boolean hasProcedureCodeableConcept() { 
2542          return this != null && this.procedure instanceof CodeableConcept;
2543        }
2544
2545        /**
2546         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2547         */
2548        public Reference getProcedureReference() throws FHIRException { 
2549          if (this.procedure == null)
2550            this.procedure = new Reference();
2551          if (!(this.procedure instanceof Reference))
2552            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.procedure.getClass().getName()+" was encountered");
2553          return (Reference) this.procedure;
2554        }
2555
2556        public boolean hasProcedureReference() { 
2557          return this != null && this.procedure instanceof Reference;
2558        }
2559
2560        public boolean hasProcedure() { 
2561          return this.procedure != null && !this.procedure.isEmpty();
2562        }
2563
2564        /**
2565         * @param value {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2566         */
2567        public ProcedureComponent setProcedure(Type value) { 
2568          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2569            throw new Error("Not the right type for ExplanationOfBenefit.procedure.procedure[x]: "+value.fhirType());
2570          this.procedure = value;
2571          return this;
2572        }
2573
2574        /**
2575         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
2576         */
2577        public List<Reference> getUdi() { 
2578          if (this.udi == null)
2579            this.udi = new ArrayList<Reference>();
2580          return this.udi;
2581        }
2582
2583        /**
2584         * @return Returns a reference to <code>this</code> for easy method chaining
2585         */
2586        public ProcedureComponent setUdi(List<Reference> theUdi) { 
2587          this.udi = theUdi;
2588          return this;
2589        }
2590
2591        public boolean hasUdi() { 
2592          if (this.udi == null)
2593            return false;
2594          for (Reference item : this.udi)
2595            if (!item.isEmpty())
2596              return true;
2597          return false;
2598        }
2599
2600        public Reference addUdi() { //3
2601          Reference t = new Reference();
2602          if (this.udi == null)
2603            this.udi = new ArrayList<Reference>();
2604          this.udi.add(t);
2605          return t;
2606        }
2607
2608        public ProcedureComponent addUdi(Reference t) { //3
2609          if (t == null)
2610            return this;
2611          if (this.udi == null)
2612            this.udi = new ArrayList<Reference>();
2613          this.udi.add(t);
2614          return this;
2615        }
2616
2617        /**
2618         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
2619         */
2620        public Reference getUdiFirstRep() { 
2621          if (getUdi().isEmpty()) {
2622            addUdi();
2623          }
2624          return getUdi().get(0);
2625        }
2626
2627        /**
2628         * @deprecated Use Reference#setResource(IBaseResource) instead
2629         */
2630        @Deprecated
2631        public List<Device> getUdiTarget() { 
2632          if (this.udiTarget == null)
2633            this.udiTarget = new ArrayList<Device>();
2634          return this.udiTarget;
2635        }
2636
2637        /**
2638         * @deprecated Use Reference#setResource(IBaseResource) instead
2639         */
2640        @Deprecated
2641        public Device addUdiTarget() { 
2642          Device r = new Device();
2643          if (this.udiTarget == null)
2644            this.udiTarget = new ArrayList<Device>();
2645          this.udiTarget.add(r);
2646          return r;
2647        }
2648
2649        protected void listChildren(List<Property> children) {
2650          super.listChildren(children);
2651          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence));
2652          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
2653          children.add(new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date));
2654          children.add(new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure));
2655          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
2656        }
2657
2658        @Override
2659        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2660          switch (_hash) {
2661          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence);
2662          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2663          case 3076014: /*date*/  return new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date);
2664          case 1640074445: /*procedure[x]*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure);
2665          case -1095204141: /*procedure*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure);
2666          case -1284783026: /*procedureCodeableConcept*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure);
2667          case 881809848: /*procedureReference*/  return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)", "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1, procedure);
2668          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
2669          default: return super.getNamedProperty(_hash, _name, _checkValid);
2670          }
2671
2672        }
2673
2674      @Override
2675      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2676        switch (hash) {
2677        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2678        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2679        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2680        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // Type
2681        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
2682        default: return super.getProperty(hash, name, checkValid);
2683        }
2684
2685      }
2686
2687      @Override
2688      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2689        switch (hash) {
2690        case 1349547969: // sequence
2691          this.sequence = castToPositiveInt(value); // PositiveIntType
2692          return value;
2693        case 3575610: // type
2694          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
2695          return value;
2696        case 3076014: // date
2697          this.date = castToDateTime(value); // DateTimeType
2698          return value;
2699        case -1095204141: // procedure
2700          this.procedure = castToType(value); // Type
2701          return value;
2702        case 115642: // udi
2703          this.getUdi().add(castToReference(value)); // Reference
2704          return value;
2705        default: return super.setProperty(hash, name, value);
2706        }
2707
2708      }
2709
2710      @Override
2711      public Base setProperty(String name, Base value) throws FHIRException {
2712        if (name.equals("sequence")) {
2713          this.sequence = castToPositiveInt(value); // PositiveIntType
2714        } else if (name.equals("type")) {
2715          this.getType().add(castToCodeableConcept(value));
2716        } else if (name.equals("date")) {
2717          this.date = castToDateTime(value); // DateTimeType
2718        } else if (name.equals("procedure[x]")) {
2719          this.procedure = castToType(value); // Type
2720        } else if (name.equals("udi")) {
2721          this.getUdi().add(castToReference(value));
2722        } else
2723          return super.setProperty(name, value);
2724        return value;
2725      }
2726
2727      @Override
2728      public Base makeProperty(int hash, String name) throws FHIRException {
2729        switch (hash) {
2730        case 1349547969:  return getSequenceElement();
2731        case 3575610:  return addType(); 
2732        case 3076014:  return getDateElement();
2733        case 1640074445:  return getProcedure(); 
2734        case -1095204141:  return getProcedure(); 
2735        case 115642:  return addUdi(); 
2736        default: return super.makeProperty(hash, name);
2737        }
2738
2739      }
2740
2741      @Override
2742      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2743        switch (hash) {
2744        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2745        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2746        case 3076014: /*date*/ return new String[] {"dateTime"};
2747        case -1095204141: /*procedure*/ return new String[] {"CodeableConcept", "Reference"};
2748        case 115642: /*udi*/ return new String[] {"Reference"};
2749        default: return super.getTypesForProperty(hash, name);
2750        }
2751
2752      }
2753
2754      @Override
2755      public Base addChild(String name) throws FHIRException {
2756        if (name.equals("sequence")) {
2757          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
2758        }
2759        else if (name.equals("type")) {
2760          return addType();
2761        }
2762        else if (name.equals("date")) {
2763          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
2764        }
2765        else if (name.equals("procedureCodeableConcept")) {
2766          this.procedure = new CodeableConcept();
2767          return this.procedure;
2768        }
2769        else if (name.equals("procedureReference")) {
2770          this.procedure = new Reference();
2771          return this.procedure;
2772        }
2773        else if (name.equals("udi")) {
2774          return addUdi();
2775        }
2776        else
2777          return super.addChild(name);
2778      }
2779
2780      public ProcedureComponent copy() {
2781        ProcedureComponent dst = new ProcedureComponent();
2782        copyValues(dst);
2783        dst.sequence = sequence == null ? null : sequence.copy();
2784        if (type != null) {
2785          dst.type = new ArrayList<CodeableConcept>();
2786          for (CodeableConcept i : type)
2787            dst.type.add(i.copy());
2788        };
2789        dst.date = date == null ? null : date.copy();
2790        dst.procedure = procedure == null ? null : procedure.copy();
2791        if (udi != null) {
2792          dst.udi = new ArrayList<Reference>();
2793          for (Reference i : udi)
2794            dst.udi.add(i.copy());
2795        };
2796        return dst;
2797      }
2798
2799      @Override
2800      public boolean equalsDeep(Base other_) {
2801        if (!super.equalsDeep(other_))
2802          return false;
2803        if (!(other_ instanceof ProcedureComponent))
2804          return false;
2805        ProcedureComponent o = (ProcedureComponent) other_;
2806        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(date, o.date, true)
2807           && compareDeep(procedure, o.procedure, true) && compareDeep(udi, o.udi, true);
2808      }
2809
2810      @Override
2811      public boolean equalsShallow(Base other_) {
2812        if (!super.equalsShallow(other_))
2813          return false;
2814        if (!(other_ instanceof ProcedureComponent))
2815          return false;
2816        ProcedureComponent o = (ProcedureComponent) other_;
2817        return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
2818      }
2819
2820      public boolean isEmpty() {
2821        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, date, procedure
2822          , udi);
2823      }
2824
2825  public String fhirType() {
2826    return "ExplanationOfBenefit.procedure";
2827
2828  }
2829
2830  }
2831
2832    @Block()
2833    public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
2834        /**
2835         * A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2836         */
2837        @Child(name = "focal", type = {BooleanType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2838        @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." )
2839        protected BooleanType focal;
2840
2841        /**
2842         * 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.
2843         */
2844        @Child(name = "coverage", type = {Coverage.class}, order=2, min=1, max=1, modifier=false, summary=true)
2845        @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." )
2846        protected Reference coverage;
2847
2848        /**
2849         * 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.)
2850         */
2851        protected Coverage coverageTarget;
2852
2853        /**
2854         * 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.
2855         */
2856        @Child(name = "preAuthRef", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2857        @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." )
2858        protected List<StringType> preAuthRef;
2859
2860        private static final long serialVersionUID = -606383626L;
2861
2862    /**
2863     * Constructor
2864     */
2865      public InsuranceComponent() {
2866        super();
2867      }
2868
2869    /**
2870     * Constructor
2871     */
2872      public InsuranceComponent(BooleanType focal, Reference coverage) {
2873        super();
2874        this.focal = focal;
2875        this.coverage = coverage;
2876      }
2877
2878        /**
2879         * @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
2880         */
2881        public BooleanType getFocalElement() { 
2882          if (this.focal == null)
2883            if (Configuration.errorOnAutoCreate())
2884              throw new Error("Attempt to auto-create InsuranceComponent.focal");
2885            else if (Configuration.doAutoCreate())
2886              this.focal = new BooleanType(); // bb
2887          return this.focal;
2888        }
2889
2890        public boolean hasFocalElement() { 
2891          return this.focal != null && !this.focal.isEmpty();
2892        }
2893
2894        public boolean hasFocal() { 
2895          return this.focal != null && !this.focal.isEmpty();
2896        }
2897
2898        /**
2899         * @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
2900         */
2901        public InsuranceComponent setFocalElement(BooleanType value) { 
2902          this.focal = value;
2903          return this;
2904        }
2905
2906        /**
2907         * @return A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2908         */
2909        public boolean getFocal() { 
2910          return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
2911        }
2912
2913        /**
2914         * @param value A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2915         */
2916        public InsuranceComponent setFocal(boolean value) { 
2917            if (this.focal == null)
2918              this.focal = new BooleanType();
2919            this.focal.setValue(value);
2920          return this;
2921        }
2922
2923        /**
2924         * @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.)
2925         */
2926        public Reference getCoverage() { 
2927          if (this.coverage == null)
2928            if (Configuration.errorOnAutoCreate())
2929              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2930            else if (Configuration.doAutoCreate())
2931              this.coverage = new Reference(); // cc
2932          return this.coverage;
2933        }
2934
2935        public boolean hasCoverage() { 
2936          return this.coverage != null && !this.coverage.isEmpty();
2937        }
2938
2939        /**
2940         * @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.)
2941         */
2942        public InsuranceComponent setCoverage(Reference value) { 
2943          this.coverage = value;
2944          return this;
2945        }
2946
2947        /**
2948         * @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.)
2949         */
2950        public Coverage getCoverageTarget() { 
2951          if (this.coverageTarget == null)
2952            if (Configuration.errorOnAutoCreate())
2953              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2954            else if (Configuration.doAutoCreate())
2955              this.coverageTarget = new Coverage(); // aa
2956          return this.coverageTarget;
2957        }
2958
2959        /**
2960         * @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.)
2961         */
2962        public InsuranceComponent setCoverageTarget(Coverage value) { 
2963          this.coverageTarget = value;
2964          return this;
2965        }
2966
2967        /**
2968         * @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.)
2969         */
2970        public List<StringType> getPreAuthRef() { 
2971          if (this.preAuthRef == null)
2972            this.preAuthRef = new ArrayList<StringType>();
2973          return this.preAuthRef;
2974        }
2975
2976        /**
2977         * @return Returns a reference to <code>this</code> for easy method chaining
2978         */
2979        public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) { 
2980          this.preAuthRef = thePreAuthRef;
2981          return this;
2982        }
2983
2984        public boolean hasPreAuthRef() { 
2985          if (this.preAuthRef == null)
2986            return false;
2987          for (StringType item : this.preAuthRef)
2988            if (!item.isEmpty())
2989              return true;
2990          return false;
2991        }
2992
2993        /**
2994         * @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.)
2995         */
2996        public StringType addPreAuthRefElement() {//2 
2997          StringType t = new StringType();
2998          if (this.preAuthRef == null)
2999            this.preAuthRef = new ArrayList<StringType>();
3000          this.preAuthRef.add(t);
3001          return t;
3002        }
3003
3004        /**
3005         * @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.)
3006         */
3007        public InsuranceComponent addPreAuthRef(String value) { //1
3008          StringType t = new StringType();
3009          t.setValue(value);
3010          if (this.preAuthRef == null)
3011            this.preAuthRef = new ArrayList<StringType>();
3012          this.preAuthRef.add(t);
3013          return this;
3014        }
3015
3016        /**
3017         * @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.)
3018         */
3019        public boolean hasPreAuthRef(String value) { 
3020          if (this.preAuthRef == null)
3021            return false;
3022          for (StringType v : this.preAuthRef)
3023            if (v.getValue().equals(value)) // string
3024              return true;
3025          return false;
3026        }
3027
3028        protected void listChildren(List<Property> children) {
3029          super.listChildren(children);
3030          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));
3031          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));
3032          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));
3033        }
3034
3035        @Override
3036        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3037          switch (_hash) {
3038          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);
3039          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);
3040          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);
3041          default: return super.getNamedProperty(_hash, _name, _checkValid);
3042          }
3043
3044        }
3045
3046      @Override
3047      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3048        switch (hash) {
3049        case 97604197: /*focal*/ return this.focal == null ? new Base[0] : new Base[] {this.focal}; // BooleanType
3050        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
3051        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
3052        default: return super.getProperty(hash, name, checkValid);
3053        }
3054
3055      }
3056
3057      @Override
3058      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3059        switch (hash) {
3060        case 97604197: // focal
3061          this.focal = castToBoolean(value); // BooleanType
3062          return value;
3063        case -351767064: // coverage
3064          this.coverage = castToReference(value); // Reference
3065          return value;
3066        case 522246568: // preAuthRef
3067          this.getPreAuthRef().add(castToString(value)); // StringType
3068          return value;
3069        default: return super.setProperty(hash, name, value);
3070        }
3071
3072      }
3073
3074      @Override
3075      public Base setProperty(String name, Base value) throws FHIRException {
3076        if (name.equals("focal")) {
3077          this.focal = castToBoolean(value); // BooleanType
3078        } else if (name.equals("coverage")) {
3079          this.coverage = castToReference(value); // Reference
3080        } else if (name.equals("preAuthRef")) {
3081          this.getPreAuthRef().add(castToString(value));
3082        } else
3083          return super.setProperty(name, value);
3084        return value;
3085      }
3086
3087      @Override
3088      public Base makeProperty(int hash, String name) throws FHIRException {
3089        switch (hash) {
3090        case 97604197:  return getFocalElement();
3091        case -351767064:  return getCoverage(); 
3092        case 522246568:  return addPreAuthRefElement();
3093        default: return super.makeProperty(hash, name);
3094        }
3095
3096      }
3097
3098      @Override
3099      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3100        switch (hash) {
3101        case 97604197: /*focal*/ return new String[] {"boolean"};
3102        case -351767064: /*coverage*/ return new String[] {"Reference"};
3103        case 522246568: /*preAuthRef*/ return new String[] {"string"};
3104        default: return super.getTypesForProperty(hash, name);
3105        }
3106
3107      }
3108
3109      @Override
3110      public Base addChild(String name) throws FHIRException {
3111        if (name.equals("focal")) {
3112          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.focal");
3113        }
3114        else if (name.equals("coverage")) {
3115          this.coverage = new Reference();
3116          return this.coverage;
3117        }
3118        else if (name.equals("preAuthRef")) {
3119          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
3120        }
3121        else
3122          return super.addChild(name);
3123      }
3124
3125      public InsuranceComponent copy() {
3126        InsuranceComponent dst = new InsuranceComponent();
3127        copyValues(dst);
3128        dst.focal = focal == null ? null : focal.copy();
3129        dst.coverage = coverage == null ? null : coverage.copy();
3130        if (preAuthRef != null) {
3131          dst.preAuthRef = new ArrayList<StringType>();
3132          for (StringType i : preAuthRef)
3133            dst.preAuthRef.add(i.copy());
3134        };
3135        return dst;
3136      }
3137
3138      @Override
3139      public boolean equalsDeep(Base other_) {
3140        if (!super.equalsDeep(other_))
3141          return false;
3142        if (!(other_ instanceof InsuranceComponent))
3143          return false;
3144        InsuranceComponent o = (InsuranceComponent) other_;
3145        return compareDeep(focal, o.focal, true) && compareDeep(coverage, o.coverage, true) && compareDeep(preAuthRef, o.preAuthRef, true)
3146          ;
3147      }
3148
3149      @Override
3150      public boolean equalsShallow(Base other_) {
3151        if (!super.equalsShallow(other_))
3152          return false;
3153        if (!(other_ instanceof InsuranceComponent))
3154          return false;
3155        InsuranceComponent o = (InsuranceComponent) other_;
3156        return compareValues(focal, o.focal, true) && compareValues(preAuthRef, o.preAuthRef, true);
3157      }
3158
3159      public boolean isEmpty() {
3160        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(focal, coverage, preAuthRef
3161          );
3162      }
3163
3164  public String fhirType() {
3165    return "ExplanationOfBenefit.insurance";
3166
3167  }
3168
3169  }
3170
3171    @Block()
3172    public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
3173        /**
3174         * Date of an accident event  related to the products and services contained in the claim.
3175         */
3176        @Child(name = "date", type = {DateType.class}, order=1, min=0, max=1, modifier=false, summary=false)
3177        @Description(shortDefinition="When the incident occurred", formalDefinition="Date of an accident event  related to the products and services contained in the claim." )
3178        protected DateType date;
3179
3180        /**
3181         * The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.
3182         */
3183        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
3184        @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." )
3185        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActIncidentCode")
3186        protected CodeableConcept type;
3187
3188        /**
3189         * The physical location of the accident event.
3190         */
3191        @Child(name = "location", type = {Address.class, Location.class}, order=3, min=0, max=1, modifier=false, summary=false)
3192        @Description(shortDefinition="Where the event occurred", formalDefinition="The physical location of the accident event." )
3193        protected Type location;
3194
3195        private static final long serialVersionUID = 622904984L;
3196
3197    /**
3198     * Constructor
3199     */
3200      public AccidentComponent() {
3201        super();
3202      }
3203
3204        /**
3205         * @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
3206         */
3207        public DateType getDateElement() { 
3208          if (this.date == null)
3209            if (Configuration.errorOnAutoCreate())
3210              throw new Error("Attempt to auto-create AccidentComponent.date");
3211            else if (Configuration.doAutoCreate())
3212              this.date = new DateType(); // bb
3213          return this.date;
3214        }
3215
3216        public boolean hasDateElement() { 
3217          return this.date != null && !this.date.isEmpty();
3218        }
3219
3220        public boolean hasDate() { 
3221          return this.date != null && !this.date.isEmpty();
3222        }
3223
3224        /**
3225         * @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
3226         */
3227        public AccidentComponent setDateElement(DateType value) { 
3228          this.date = value;
3229          return this;
3230        }
3231
3232        /**
3233         * @return Date of an accident event  related to the products and services contained in the claim.
3234         */
3235        public Date getDate() { 
3236          return this.date == null ? null : this.date.getValue();
3237        }
3238
3239        /**
3240         * @param value Date of an accident event  related to the products and services contained in the claim.
3241         */
3242        public AccidentComponent setDate(Date value) { 
3243          if (value == null)
3244            this.date = null;
3245          else {
3246            if (this.date == null)
3247              this.date = new DateType();
3248            this.date.setValue(value);
3249          }
3250          return this;
3251        }
3252
3253        /**
3254         * @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.)
3255         */
3256        public CodeableConcept getType() { 
3257          if (this.type == null)
3258            if (Configuration.errorOnAutoCreate())
3259              throw new Error("Attempt to auto-create AccidentComponent.type");
3260            else if (Configuration.doAutoCreate())
3261              this.type = new CodeableConcept(); // cc
3262          return this.type;
3263        }
3264
3265        public boolean hasType() { 
3266          return this.type != null && !this.type.isEmpty();
3267        }
3268
3269        /**
3270         * @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.)
3271         */
3272        public AccidentComponent setType(CodeableConcept value) { 
3273          this.type = value;
3274          return this;
3275        }
3276
3277        /**
3278         * @return {@link #location} (The physical location of the accident event.)
3279         */
3280        public Type getLocation() { 
3281          return this.location;
3282        }
3283
3284        /**
3285         * @return {@link #location} (The physical location of the accident event.)
3286         */
3287        public Address getLocationAddress() throws FHIRException { 
3288          if (this.location == null)
3289            this.location = new Address();
3290          if (!(this.location instanceof Address))
3291            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
3292          return (Address) this.location;
3293        }
3294
3295        public boolean hasLocationAddress() { 
3296          return this != null && this.location instanceof Address;
3297        }
3298
3299        /**
3300         * @return {@link #location} (The physical location of the accident event.)
3301         */
3302        public Reference getLocationReference() throws FHIRException { 
3303          if (this.location == null)
3304            this.location = new Reference();
3305          if (!(this.location instanceof Reference))
3306            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
3307          return (Reference) this.location;
3308        }
3309
3310        public boolean hasLocationReference() { 
3311          return this != null && this.location instanceof Reference;
3312        }
3313
3314        public boolean hasLocation() { 
3315          return this.location != null && !this.location.isEmpty();
3316        }
3317
3318        /**
3319         * @param value {@link #location} (The physical location of the accident event.)
3320         */
3321        public AccidentComponent setLocation(Type value) { 
3322          if (value != null && !(value instanceof Address || value instanceof Reference))
3323            throw new Error("Not the right type for ExplanationOfBenefit.accident.location[x]: "+value.fhirType());
3324          this.location = value;
3325          return this;
3326        }
3327
3328        protected void listChildren(List<Property> children) {
3329          super.listChildren(children);
3330          children.add(new Property("date", "date", "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date));
3331          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));
3332          children.add(new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location));
3333        }
3334
3335        @Override
3336        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3337          switch (_hash) {
3338          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);
3339          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);
3340          case 552316075: /*location[x]*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3341          case 1901043637: /*location*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3342          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3343          case 755866390: /*locationReference*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3344          default: return super.getNamedProperty(_hash, _name, _checkValid);
3345          }
3346
3347        }
3348
3349      @Override
3350      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3351        switch (hash) {
3352        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
3353        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3354        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
3355        default: return super.getProperty(hash, name, checkValid);
3356        }
3357
3358      }
3359
3360      @Override
3361      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3362        switch (hash) {
3363        case 3076014: // date
3364          this.date = castToDate(value); // DateType
3365          return value;
3366        case 3575610: // type
3367          this.type = castToCodeableConcept(value); // CodeableConcept
3368          return value;
3369        case 1901043637: // location
3370          this.location = castToType(value); // Type
3371          return value;
3372        default: return super.setProperty(hash, name, value);
3373        }
3374
3375      }
3376
3377      @Override
3378      public Base setProperty(String name, Base value) throws FHIRException {
3379        if (name.equals("date")) {
3380          this.date = castToDate(value); // DateType
3381        } else if (name.equals("type")) {
3382          this.type = castToCodeableConcept(value); // CodeableConcept
3383        } else if (name.equals("location[x]")) {
3384          this.location = castToType(value); // Type
3385        } else
3386          return super.setProperty(name, value);
3387        return value;
3388      }
3389
3390      @Override
3391      public Base makeProperty(int hash, String name) throws FHIRException {
3392        switch (hash) {
3393        case 3076014:  return getDateElement();
3394        case 3575610:  return getType(); 
3395        case 552316075:  return getLocation(); 
3396        case 1901043637:  return getLocation(); 
3397        default: return super.makeProperty(hash, name);
3398        }
3399
3400      }
3401
3402      @Override
3403      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3404        switch (hash) {
3405        case 3076014: /*date*/ return new String[] {"date"};
3406        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3407        case 1901043637: /*location*/ return new String[] {"Address", "Reference"};
3408        default: return super.getTypesForProperty(hash, name);
3409        }
3410
3411      }
3412
3413      @Override
3414      public Base addChild(String name) throws FHIRException {
3415        if (name.equals("date")) {
3416          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
3417        }
3418        else if (name.equals("type")) {
3419          this.type = new CodeableConcept();
3420          return this.type;
3421        }
3422        else if (name.equals("locationAddress")) {
3423          this.location = new Address();
3424          return this.location;
3425        }
3426        else if (name.equals("locationReference")) {
3427          this.location = new Reference();
3428          return this.location;
3429        }
3430        else
3431          return super.addChild(name);
3432      }
3433
3434      public AccidentComponent copy() {
3435        AccidentComponent dst = new AccidentComponent();
3436        copyValues(dst);
3437        dst.date = date == null ? null : date.copy();
3438        dst.type = type == null ? null : type.copy();
3439        dst.location = location == null ? null : location.copy();
3440        return dst;
3441      }
3442
3443      @Override
3444      public boolean equalsDeep(Base other_) {
3445        if (!super.equalsDeep(other_))
3446          return false;
3447        if (!(other_ instanceof AccidentComponent))
3448          return false;
3449        AccidentComponent o = (AccidentComponent) other_;
3450        return compareDeep(date, o.date, true) && compareDeep(type, o.type, true) && compareDeep(location, o.location, true)
3451          ;
3452      }
3453
3454      @Override
3455      public boolean equalsShallow(Base other_) {
3456        if (!super.equalsShallow(other_))
3457          return false;
3458        if (!(other_ instanceof AccidentComponent))
3459          return false;
3460        AccidentComponent o = (AccidentComponent) other_;
3461        return compareValues(date, o.date, true);
3462      }
3463
3464      public boolean isEmpty() {
3465        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
3466      }
3467
3468  public String fhirType() {
3469    return "ExplanationOfBenefit.accident";
3470
3471  }
3472
3473  }
3474
3475    @Block()
3476    public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
3477        /**
3478         * A number to uniquely identify item entries.
3479         */
3480        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
3481        @Description(shortDefinition="Item instance identifier", formalDefinition="A number to uniquely identify item entries." )
3482        protected PositiveIntType sequence;
3483
3484        /**
3485         * Care team members related to this service or product.
3486         */
3487        @Child(name = "careTeamSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3488        @Description(shortDefinition="Applicable care team members", formalDefinition="Care team members related to this service or product." )
3489        protected List<PositiveIntType> careTeamSequence;
3490
3491        /**
3492         * Diagnoses applicable for this service or product.
3493         */
3494        @Child(name = "diagnosisSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3495        @Description(shortDefinition="Applicable diagnoses", formalDefinition="Diagnoses applicable for this service or product." )
3496        protected List<PositiveIntType> diagnosisSequence;
3497
3498        /**
3499         * Procedures applicable for this service or product.
3500         */
3501        @Child(name = "procedureSequence", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3502        @Description(shortDefinition="Applicable procedures", formalDefinition="Procedures applicable for this service or product." )
3503        protected List<PositiveIntType> procedureSequence;
3504
3505        /**
3506         * Exceptions, special conditions and supporting information applicable for this service or product.
3507         */
3508        @Child(name = "informationSequence", type = {PositiveIntType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3509        @Description(shortDefinition="Applicable exception and supporting information", formalDefinition="Exceptions, special conditions and supporting information applicable for this service or product." )
3510        protected List<PositiveIntType> informationSequence;
3511
3512        /**
3513         * The type of revenue or cost center providing the product and/or service.
3514         */
3515        @Child(name = "revenue", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
3516        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
3517        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
3518        protected CodeableConcept revenue;
3519
3520        /**
3521         * Code to identify the general type of benefits under which products and services are provided.
3522         */
3523        @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
3524        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
3525        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
3526        protected CodeableConcept category;
3527
3528        /**
3529         * 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.
3530         */
3531        @Child(name = "productOrService", type = {CodeableConcept.class}, order=8, min=1, max=1, modifier=false, summary=false)
3532        @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." )
3533        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
3534        protected CodeableConcept productOrService;
3535
3536        /**
3537         * Item typification or modifiers codes to convey additional context for the product or service.
3538         */
3539        @Child(name = "modifier", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3540        @Description(shortDefinition="Product or service billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
3541        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
3542        protected List<CodeableConcept> modifier;
3543
3544        /**
3545         * Identifies the program under which this may be recovered.
3546         */
3547        @Child(name = "programCode", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3548        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
3549        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
3550        protected List<CodeableConcept> programCode;
3551
3552        /**
3553         * The date or dates when the service or product was supplied, performed or completed.
3554         */
3555        @Child(name = "serviced", type = {DateType.class, Period.class}, order=11, min=0, max=1, modifier=false, summary=false)
3556        @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." )
3557        protected Type serviced;
3558
3559        /**
3560         * Where the product or service was provided.
3561         */
3562        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
3563        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
3564        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
3565        protected Type location;
3566
3567        /**
3568         * The number of repetitions of a service or product.
3569         */
3570        @Child(name = "quantity", type = {Quantity.class}, order=13, min=0, max=1, modifier=false, summary=false)
3571        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
3572        protected Quantity quantity;
3573
3574        /**
3575         * 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.
3576         */
3577        @Child(name = "unitPrice", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
3578        @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." )
3579        protected Money unitPrice;
3580
3581        /**
3582         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3583         */
3584        @Child(name = "factor", type = {DecimalType.class}, order=15, min=0, max=1, modifier=false, summary=false)
3585        @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." )
3586        protected DecimalType factor;
3587
3588        /**
3589         * The quantity times the unit price for an additional service or product or charge.
3590         */
3591        @Child(name = "net", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=false)
3592        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
3593        protected Money net;
3594
3595        /**
3596         * Unique Device Identifiers associated with this line item.
3597         */
3598        @Child(name = "udi", type = {Device.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3599        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
3600        protected List<Reference> udi;
3601        /**
3602         * The actual objects that are the target of the reference (Unique Device Identifiers associated with this line item.)
3603         */
3604        protected List<Device> udiTarget;
3605
3606
3607        /**
3608         * Physical service site on the patient (limb, tooth, etc.).
3609         */
3610        @Child(name = "bodySite", type = {CodeableConcept.class}, order=18, min=0, max=1, modifier=false, summary=false)
3611        @Description(shortDefinition="Anatomical location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
3612        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
3613        protected CodeableConcept bodySite;
3614
3615        /**
3616         * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
3617         */
3618        @Child(name = "subSite", type = {CodeableConcept.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3619        @Description(shortDefinition="Anatomical sub-location", formalDefinition="A region or surface of the bodySite, e.g. limb region or tooth surface(s)." )
3620        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
3621        protected List<CodeableConcept> subSite;
3622
3623        /**
3624         * A billed item may include goods or services provided in multiple encounters.
3625         */
3626        @Child(name = "encounter", type = {Encounter.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3627        @Description(shortDefinition="Encounters related to this billed item", formalDefinition="A billed item may include goods or services provided in multiple encounters." )
3628        protected List<Reference> encounter;
3629        /**
3630         * The actual objects that are the target of the reference (A billed item may include goods or services provided in multiple encounters.)
3631         */
3632        protected List<Encounter> encounterTarget;
3633
3634
3635        /**
3636         * The numbers associated with notes below which apply to the adjudication of this item.
3637         */
3638        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3639        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
3640        protected List<PositiveIntType> noteNumber;
3641
3642        /**
3643         * 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.
3644         */
3645        @Child(name = "adjudication", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3646        @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." )
3647        protected List<AdjudicationComponent> adjudication;
3648
3649        /**
3650         * Second-tier of goods and services.
3651         */
3652        @Child(name = "detail", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3653        @Description(shortDefinition="Additional items", formalDefinition="Second-tier of goods and services." )
3654        protected List<DetailComponent> detail;
3655
3656        private static final long serialVersionUID = 67419471L;
3657
3658    /**
3659     * Constructor
3660     */
3661      public ItemComponent() {
3662        super();
3663      }
3664
3665    /**
3666     * Constructor
3667     */
3668      public ItemComponent(PositiveIntType sequence, CodeableConcept productOrService) {
3669        super();
3670        this.sequence = sequence;
3671        this.productOrService = productOrService;
3672      }
3673
3674        /**
3675         * @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
3676         */
3677        public PositiveIntType getSequenceElement() { 
3678          if (this.sequence == null)
3679            if (Configuration.errorOnAutoCreate())
3680              throw new Error("Attempt to auto-create ItemComponent.sequence");
3681            else if (Configuration.doAutoCreate())
3682              this.sequence = new PositiveIntType(); // bb
3683          return this.sequence;
3684        }
3685
3686        public boolean hasSequenceElement() { 
3687          return this.sequence != null && !this.sequence.isEmpty();
3688        }
3689
3690        public boolean hasSequence() { 
3691          return this.sequence != null && !this.sequence.isEmpty();
3692        }
3693
3694        /**
3695         * @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
3696         */
3697        public ItemComponent setSequenceElement(PositiveIntType value) { 
3698          this.sequence = value;
3699          return this;
3700        }
3701
3702        /**
3703         * @return A number to uniquely identify item entries.
3704         */
3705        public int getSequence() { 
3706          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3707        }
3708
3709        /**
3710         * @param value A number to uniquely identify item entries.
3711         */
3712        public ItemComponent setSequence(int value) { 
3713            if (this.sequence == null)
3714              this.sequence = new PositiveIntType();
3715            this.sequence.setValue(value);
3716          return this;
3717        }
3718
3719        /**
3720         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3721         */
3722        public List<PositiveIntType> getCareTeamSequence() { 
3723          if (this.careTeamSequence == null)
3724            this.careTeamSequence = new ArrayList<PositiveIntType>();
3725          return this.careTeamSequence;
3726        }
3727
3728        /**
3729         * @return Returns a reference to <code>this</code> for easy method chaining
3730         */
3731        public ItemComponent setCareTeamSequence(List<PositiveIntType> theCareTeamSequence) { 
3732          this.careTeamSequence = theCareTeamSequence;
3733          return this;
3734        }
3735
3736        public boolean hasCareTeamSequence() { 
3737          if (this.careTeamSequence == null)
3738            return false;
3739          for (PositiveIntType item : this.careTeamSequence)
3740            if (!item.isEmpty())
3741              return true;
3742          return false;
3743        }
3744
3745        /**
3746         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3747         */
3748        public PositiveIntType addCareTeamSequenceElement() {//2 
3749          PositiveIntType t = new PositiveIntType();
3750          if (this.careTeamSequence == null)
3751            this.careTeamSequence = new ArrayList<PositiveIntType>();
3752          this.careTeamSequence.add(t);
3753          return t;
3754        }
3755
3756        /**
3757         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3758         */
3759        public ItemComponent addCareTeamSequence(int value) { //1
3760          PositiveIntType t = new PositiveIntType();
3761          t.setValue(value);
3762          if (this.careTeamSequence == null)
3763            this.careTeamSequence = new ArrayList<PositiveIntType>();
3764          this.careTeamSequence.add(t);
3765          return this;
3766        }
3767
3768        /**
3769         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3770         */
3771        public boolean hasCareTeamSequence(int value) { 
3772          if (this.careTeamSequence == null)
3773            return false;
3774          for (PositiveIntType v : this.careTeamSequence)
3775            if (v.getValue().equals(value)) // positiveInt
3776              return true;
3777          return false;
3778        }
3779
3780        /**
3781         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3782         */
3783        public List<PositiveIntType> getDiagnosisSequence() { 
3784          if (this.diagnosisSequence == null)
3785            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3786          return this.diagnosisSequence;
3787        }
3788
3789        /**
3790         * @return Returns a reference to <code>this</code> for easy method chaining
3791         */
3792        public ItemComponent setDiagnosisSequence(List<PositiveIntType> theDiagnosisSequence) { 
3793          this.diagnosisSequence = theDiagnosisSequence;
3794          return this;
3795        }
3796
3797        public boolean hasDiagnosisSequence() { 
3798          if (this.diagnosisSequence == null)
3799            return false;
3800          for (PositiveIntType item : this.diagnosisSequence)
3801            if (!item.isEmpty())
3802              return true;
3803          return false;
3804        }
3805
3806        /**
3807         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3808         */
3809        public PositiveIntType addDiagnosisSequenceElement() {//2 
3810          PositiveIntType t = new PositiveIntType();
3811          if (this.diagnosisSequence == null)
3812            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3813          this.diagnosisSequence.add(t);
3814          return t;
3815        }
3816
3817        /**
3818         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3819         */
3820        public ItemComponent addDiagnosisSequence(int value) { //1
3821          PositiveIntType t = new PositiveIntType();
3822          t.setValue(value);
3823          if (this.diagnosisSequence == null)
3824            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3825          this.diagnosisSequence.add(t);
3826          return this;
3827        }
3828
3829        /**
3830         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3831         */
3832        public boolean hasDiagnosisSequence(int value) { 
3833          if (this.diagnosisSequence == null)
3834            return false;
3835          for (PositiveIntType v : this.diagnosisSequence)
3836            if (v.getValue().equals(value)) // positiveInt
3837              return true;
3838          return false;
3839        }
3840
3841        /**
3842         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3843         */
3844        public List<PositiveIntType> getProcedureSequence() { 
3845          if (this.procedureSequence == null)
3846            this.procedureSequence = new ArrayList<PositiveIntType>();
3847          return this.procedureSequence;
3848        }
3849
3850        /**
3851         * @return Returns a reference to <code>this</code> for easy method chaining
3852         */
3853        public ItemComponent setProcedureSequence(List<PositiveIntType> theProcedureSequence) { 
3854          this.procedureSequence = theProcedureSequence;
3855          return this;
3856        }
3857
3858        public boolean hasProcedureSequence() { 
3859          if (this.procedureSequence == null)
3860            return false;
3861          for (PositiveIntType item : this.procedureSequence)
3862            if (!item.isEmpty())
3863              return true;
3864          return false;
3865        }
3866
3867        /**
3868         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3869         */
3870        public PositiveIntType addProcedureSequenceElement() {//2 
3871          PositiveIntType t = new PositiveIntType();
3872          if (this.procedureSequence == null)
3873            this.procedureSequence = new ArrayList<PositiveIntType>();
3874          this.procedureSequence.add(t);
3875          return t;
3876        }
3877
3878        /**
3879         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3880         */
3881        public ItemComponent addProcedureSequence(int value) { //1
3882          PositiveIntType t = new PositiveIntType();
3883          t.setValue(value);
3884          if (this.procedureSequence == null)
3885            this.procedureSequence = new ArrayList<PositiveIntType>();
3886          this.procedureSequence.add(t);
3887          return this;
3888        }
3889
3890        /**
3891         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3892         */
3893        public boolean hasProcedureSequence(int value) { 
3894          if (this.procedureSequence == null)
3895            return false;
3896          for (PositiveIntType v : this.procedureSequence)
3897            if (v.getValue().equals(value)) // positiveInt
3898              return true;
3899          return false;
3900        }
3901
3902        /**
3903         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3904         */
3905        public List<PositiveIntType> getInformationSequence() { 
3906          if (this.informationSequence == null)
3907            this.informationSequence = new ArrayList<PositiveIntType>();
3908          return this.informationSequence;
3909        }
3910
3911        /**
3912         * @return Returns a reference to <code>this</code> for easy method chaining
3913         */
3914        public ItemComponent setInformationSequence(List<PositiveIntType> theInformationSequence) { 
3915          this.informationSequence = theInformationSequence;
3916          return this;
3917        }
3918
3919        public boolean hasInformationSequence() { 
3920          if (this.informationSequence == null)
3921            return false;
3922          for (PositiveIntType item : this.informationSequence)
3923            if (!item.isEmpty())
3924              return true;
3925          return false;
3926        }
3927
3928        /**
3929         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3930         */
3931        public PositiveIntType addInformationSequenceElement() {//2 
3932          PositiveIntType t = new PositiveIntType();
3933          if (this.informationSequence == null)
3934            this.informationSequence = new ArrayList<PositiveIntType>();
3935          this.informationSequence.add(t);
3936          return t;
3937        }
3938
3939        /**
3940         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3941         */
3942        public ItemComponent addInformationSequence(int value) { //1
3943          PositiveIntType t = new PositiveIntType();
3944          t.setValue(value);
3945          if (this.informationSequence == null)
3946            this.informationSequence = new ArrayList<PositiveIntType>();
3947          this.informationSequence.add(t);
3948          return this;
3949        }
3950
3951        /**
3952         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3953         */
3954        public boolean hasInformationSequence(int value) { 
3955          if (this.informationSequence == null)
3956            return false;
3957          for (PositiveIntType v : this.informationSequence)
3958            if (v.getValue().equals(value)) // positiveInt
3959              return true;
3960          return false;
3961        }
3962
3963        /**
3964         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3965         */
3966        public CodeableConcept getRevenue() { 
3967          if (this.revenue == null)
3968            if (Configuration.errorOnAutoCreate())
3969              throw new Error("Attempt to auto-create ItemComponent.revenue");
3970            else if (Configuration.doAutoCreate())
3971              this.revenue = new CodeableConcept(); // cc
3972          return this.revenue;
3973        }
3974
3975        public boolean hasRevenue() { 
3976          return this.revenue != null && !this.revenue.isEmpty();
3977        }
3978
3979        /**
3980         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3981         */
3982        public ItemComponent setRevenue(CodeableConcept value) { 
3983          this.revenue = value;
3984          return this;
3985        }
3986
3987        /**
3988         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
3989         */
3990        public CodeableConcept getCategory() { 
3991          if (this.category == null)
3992            if (Configuration.errorOnAutoCreate())
3993              throw new Error("Attempt to auto-create ItemComponent.category");
3994            else if (Configuration.doAutoCreate())
3995              this.category = new CodeableConcept(); // cc
3996          return this.category;
3997        }
3998
3999        public boolean hasCategory() { 
4000          return this.category != null && !this.category.isEmpty();
4001        }
4002
4003        /**
4004         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
4005         */
4006        public ItemComponent setCategory(CodeableConcept value) { 
4007          this.category = value;
4008          return this;
4009        }
4010
4011        /**
4012         * @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.)
4013         */
4014        public CodeableConcept getProductOrService() { 
4015          if (this.productOrService == null)
4016            if (Configuration.errorOnAutoCreate())
4017              throw new Error("Attempt to auto-create ItemComponent.productOrService");
4018            else if (Configuration.doAutoCreate())
4019              this.productOrService = new CodeableConcept(); // cc
4020          return this.productOrService;
4021        }
4022
4023        public boolean hasProductOrService() { 
4024          return this.productOrService != null && !this.productOrService.isEmpty();
4025        }
4026
4027        /**
4028         * @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.)
4029         */
4030        public ItemComponent setProductOrService(CodeableConcept value) { 
4031          this.productOrService = value;
4032          return this;
4033        }
4034
4035        /**
4036         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
4037         */
4038        public List<CodeableConcept> getModifier() { 
4039          if (this.modifier == null)
4040            this.modifier = new ArrayList<CodeableConcept>();
4041          return this.modifier;
4042        }
4043
4044        /**
4045         * @return Returns a reference to <code>this</code> for easy method chaining
4046         */
4047        public ItemComponent setModifier(List<CodeableConcept> theModifier) { 
4048          this.modifier = theModifier;
4049          return this;
4050        }
4051
4052        public boolean hasModifier() { 
4053          if (this.modifier == null)
4054            return false;
4055          for (CodeableConcept item : this.modifier)
4056            if (!item.isEmpty())
4057              return true;
4058          return false;
4059        }
4060
4061        public CodeableConcept addModifier() { //3
4062          CodeableConcept t = new CodeableConcept();
4063          if (this.modifier == null)
4064            this.modifier = new ArrayList<CodeableConcept>();
4065          this.modifier.add(t);
4066          return t;
4067        }
4068
4069        public ItemComponent addModifier(CodeableConcept t) { //3
4070          if (t == null)
4071            return this;
4072          if (this.modifier == null)
4073            this.modifier = new ArrayList<CodeableConcept>();
4074          this.modifier.add(t);
4075          return this;
4076        }
4077
4078        /**
4079         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
4080         */
4081        public CodeableConcept getModifierFirstRep() { 
4082          if (getModifier().isEmpty()) {
4083            addModifier();
4084          }
4085          return getModifier().get(0);
4086        }
4087
4088        /**
4089         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
4090         */
4091        public List<CodeableConcept> getProgramCode() { 
4092          if (this.programCode == null)
4093            this.programCode = new ArrayList<CodeableConcept>();
4094          return this.programCode;
4095        }
4096
4097        /**
4098         * @return Returns a reference to <code>this</code> for easy method chaining
4099         */
4100        public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
4101          this.programCode = theProgramCode;
4102          return this;
4103        }
4104
4105        public boolean hasProgramCode() { 
4106          if (this.programCode == null)
4107            return false;
4108          for (CodeableConcept item : this.programCode)
4109            if (!item.isEmpty())
4110              return true;
4111          return false;
4112        }
4113
4114        public CodeableConcept addProgramCode() { //3
4115          CodeableConcept t = new CodeableConcept();
4116          if (this.programCode == null)
4117            this.programCode = new ArrayList<CodeableConcept>();
4118          this.programCode.add(t);
4119          return t;
4120        }
4121
4122        public ItemComponent addProgramCode(CodeableConcept t) { //3
4123          if (t == null)
4124            return this;
4125          if (this.programCode == null)
4126            this.programCode = new ArrayList<CodeableConcept>();
4127          this.programCode.add(t);
4128          return this;
4129        }
4130
4131        /**
4132         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
4133         */
4134        public CodeableConcept getProgramCodeFirstRep() { 
4135          if (getProgramCode().isEmpty()) {
4136            addProgramCode();
4137          }
4138          return getProgramCode().get(0);
4139        }
4140
4141        /**
4142         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4143         */
4144        public Type getServiced() { 
4145          return this.serviced;
4146        }
4147
4148        /**
4149         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4150         */
4151        public DateType getServicedDateType() throws FHIRException { 
4152          if (this.serviced == null)
4153            this.serviced = new DateType();
4154          if (!(this.serviced instanceof DateType))
4155            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
4156          return (DateType) this.serviced;
4157        }
4158
4159        public boolean hasServicedDateType() { 
4160          return this != null && this.serviced instanceof DateType;
4161        }
4162
4163        /**
4164         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4165         */
4166        public Period getServicedPeriod() throws FHIRException { 
4167          if (this.serviced == null)
4168            this.serviced = new Period();
4169          if (!(this.serviced instanceof Period))
4170            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
4171          return (Period) this.serviced;
4172        }
4173
4174        public boolean hasServicedPeriod() { 
4175          return this != null && this.serviced instanceof Period;
4176        }
4177
4178        public boolean hasServiced() { 
4179          return this.serviced != null && !this.serviced.isEmpty();
4180        }
4181
4182        /**
4183         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4184         */
4185        public ItemComponent setServiced(Type value) { 
4186          if (value != null && !(value instanceof DateType || value instanceof Period))
4187            throw new Error("Not the right type for ExplanationOfBenefit.item.serviced[x]: "+value.fhirType());
4188          this.serviced = value;
4189          return this;
4190        }
4191
4192        /**
4193         * @return {@link #location} (Where the product or service was provided.)
4194         */
4195        public Type getLocation() { 
4196          return this.location;
4197        }
4198
4199        /**
4200         * @return {@link #location} (Where the product or service was provided.)
4201         */
4202        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
4203          if (this.location == null)
4204            this.location = new CodeableConcept();
4205          if (!(this.location instanceof CodeableConcept))
4206            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
4207          return (CodeableConcept) this.location;
4208        }
4209
4210        public boolean hasLocationCodeableConcept() { 
4211          return this != null && this.location instanceof CodeableConcept;
4212        }
4213
4214        /**
4215         * @return {@link #location} (Where the product or service was provided.)
4216         */
4217        public Address getLocationAddress() throws FHIRException { 
4218          if (this.location == null)
4219            this.location = new Address();
4220          if (!(this.location instanceof Address))
4221            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
4222          return (Address) this.location;
4223        }
4224
4225        public boolean hasLocationAddress() { 
4226          return this != null && this.location instanceof Address;
4227        }
4228
4229        /**
4230         * @return {@link #location} (Where the product or service was provided.)
4231         */
4232        public Reference getLocationReference() throws FHIRException { 
4233          if (this.location == null)
4234            this.location = new Reference();
4235          if (!(this.location instanceof Reference))
4236            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
4237          return (Reference) this.location;
4238        }
4239
4240        public boolean hasLocationReference() { 
4241          return this != null && this.location instanceof Reference;
4242        }
4243
4244        public boolean hasLocation() { 
4245          return this.location != null && !this.location.isEmpty();
4246        }
4247
4248        /**
4249         * @param value {@link #location} (Where the product or service was provided.)
4250         */
4251        public ItemComponent setLocation(Type value) { 
4252          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
4253            throw new Error("Not the right type for ExplanationOfBenefit.item.location[x]: "+value.fhirType());
4254          this.location = value;
4255          return this;
4256        }
4257
4258        /**
4259         * @return {@link #quantity} (The number of repetitions of a service or product.)
4260         */
4261        public Quantity getQuantity() { 
4262          if (this.quantity == null)
4263            if (Configuration.errorOnAutoCreate())
4264              throw new Error("Attempt to auto-create ItemComponent.quantity");
4265            else if (Configuration.doAutoCreate())
4266              this.quantity = new Quantity(); // cc
4267          return this.quantity;
4268        }
4269
4270        public boolean hasQuantity() { 
4271          return this.quantity != null && !this.quantity.isEmpty();
4272        }
4273
4274        /**
4275         * @param value {@link #quantity} (The number of repetitions of a service or product.)
4276         */
4277        public ItemComponent setQuantity(Quantity value) { 
4278          this.quantity = value;
4279          return this;
4280        }
4281
4282        /**
4283         * @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.)
4284         */
4285        public Money getUnitPrice() { 
4286          if (this.unitPrice == null)
4287            if (Configuration.errorOnAutoCreate())
4288              throw new Error("Attempt to auto-create ItemComponent.unitPrice");
4289            else if (Configuration.doAutoCreate())
4290              this.unitPrice = new Money(); // cc
4291          return this.unitPrice;
4292        }
4293
4294        public boolean hasUnitPrice() { 
4295          return this.unitPrice != null && !this.unitPrice.isEmpty();
4296        }
4297
4298        /**
4299         * @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.)
4300         */
4301        public ItemComponent setUnitPrice(Money value) { 
4302          this.unitPrice = value;
4303          return this;
4304        }
4305
4306        /**
4307         * @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
4308         */
4309        public DecimalType getFactorElement() { 
4310          if (this.factor == null)
4311            if (Configuration.errorOnAutoCreate())
4312              throw new Error("Attempt to auto-create ItemComponent.factor");
4313            else if (Configuration.doAutoCreate())
4314              this.factor = new DecimalType(); // bb
4315          return this.factor;
4316        }
4317
4318        public boolean hasFactorElement() { 
4319          return this.factor != null && !this.factor.isEmpty();
4320        }
4321
4322        public boolean hasFactor() { 
4323          return this.factor != null && !this.factor.isEmpty();
4324        }
4325
4326        /**
4327         * @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
4328         */
4329        public ItemComponent setFactorElement(DecimalType value) { 
4330          this.factor = value;
4331          return this;
4332        }
4333
4334        /**
4335         * @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.
4336         */
4337        public BigDecimal getFactor() { 
4338          return this.factor == null ? null : this.factor.getValue();
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(BigDecimal value) { 
4345          if (value == null)
4346            this.factor = null;
4347          else {
4348            if (this.factor == null)
4349              this.factor = new DecimalType();
4350            this.factor.setValue(value);
4351          }
4352          return this;
4353        }
4354
4355        /**
4356         * @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.
4357         */
4358        public ItemComponent setFactor(long value) { 
4359              this.factor = new DecimalType();
4360            this.factor.setValue(value);
4361          return this;
4362        }
4363
4364        /**
4365         * @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.
4366         */
4367        public ItemComponent setFactor(double value) { 
4368              this.factor = new DecimalType();
4369            this.factor.setValue(value);
4370          return this;
4371        }
4372
4373        /**
4374         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4375         */
4376        public Money getNet() { 
4377          if (this.net == null)
4378            if (Configuration.errorOnAutoCreate())
4379              throw new Error("Attempt to auto-create ItemComponent.net");
4380            else if (Configuration.doAutoCreate())
4381              this.net = new Money(); // cc
4382          return this.net;
4383        }
4384
4385        public boolean hasNet() { 
4386          return this.net != null && !this.net.isEmpty();
4387        }
4388
4389        /**
4390         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4391         */
4392        public ItemComponent setNet(Money value) { 
4393          this.net = value;
4394          return this;
4395        }
4396
4397        /**
4398         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
4399         */
4400        public List<Reference> getUdi() { 
4401          if (this.udi == null)
4402            this.udi = new ArrayList<Reference>();
4403          return this.udi;
4404        }
4405
4406        /**
4407         * @return Returns a reference to <code>this</code> for easy method chaining
4408         */
4409        public ItemComponent setUdi(List<Reference> theUdi) { 
4410          this.udi = theUdi;
4411          return this;
4412        }
4413
4414        public boolean hasUdi() { 
4415          if (this.udi == null)
4416            return false;
4417          for (Reference item : this.udi)
4418            if (!item.isEmpty())
4419              return true;
4420          return false;
4421        }
4422
4423        public Reference addUdi() { //3
4424          Reference t = new Reference();
4425          if (this.udi == null)
4426            this.udi = new ArrayList<Reference>();
4427          this.udi.add(t);
4428          return t;
4429        }
4430
4431        public ItemComponent addUdi(Reference t) { //3
4432          if (t == null)
4433            return this;
4434          if (this.udi == null)
4435            this.udi = new ArrayList<Reference>();
4436          this.udi.add(t);
4437          return this;
4438        }
4439
4440        /**
4441         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
4442         */
4443        public Reference getUdiFirstRep() { 
4444          if (getUdi().isEmpty()) {
4445            addUdi();
4446          }
4447          return getUdi().get(0);
4448        }
4449
4450        /**
4451         * @deprecated Use Reference#setResource(IBaseResource) instead
4452         */
4453        @Deprecated
4454        public List<Device> getUdiTarget() { 
4455          if (this.udiTarget == null)
4456            this.udiTarget = new ArrayList<Device>();
4457          return this.udiTarget;
4458        }
4459
4460        /**
4461         * @deprecated Use Reference#setResource(IBaseResource) instead
4462         */
4463        @Deprecated
4464        public Device addUdiTarget() { 
4465          Device r = new Device();
4466          if (this.udiTarget == null)
4467            this.udiTarget = new ArrayList<Device>();
4468          this.udiTarget.add(r);
4469          return r;
4470        }
4471
4472        /**
4473         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4474         */
4475        public CodeableConcept getBodySite() { 
4476          if (this.bodySite == null)
4477            if (Configuration.errorOnAutoCreate())
4478              throw new Error("Attempt to auto-create ItemComponent.bodySite");
4479            else if (Configuration.doAutoCreate())
4480              this.bodySite = new CodeableConcept(); // cc
4481          return this.bodySite;
4482        }
4483
4484        public boolean hasBodySite() { 
4485          return this.bodySite != null && !this.bodySite.isEmpty();
4486        }
4487
4488        /**
4489         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4490         */
4491        public ItemComponent setBodySite(CodeableConcept value) { 
4492          this.bodySite = value;
4493          return this;
4494        }
4495
4496        /**
4497         * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb region or tooth surface(s).)
4498         */
4499        public List<CodeableConcept> getSubSite() { 
4500          if (this.subSite == null)
4501            this.subSite = new ArrayList<CodeableConcept>();
4502          return this.subSite;
4503        }
4504
4505        /**
4506         * @return Returns a reference to <code>this</code> for easy method chaining
4507         */
4508        public ItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
4509          this.subSite = theSubSite;
4510          return this;
4511        }
4512
4513        public boolean hasSubSite() { 
4514          if (this.subSite == null)
4515            return false;
4516          for (CodeableConcept item : this.subSite)
4517            if (!item.isEmpty())
4518              return true;
4519          return false;
4520        }
4521
4522        public CodeableConcept addSubSite() { //3
4523          CodeableConcept t = new CodeableConcept();
4524          if (this.subSite == null)
4525            this.subSite = new ArrayList<CodeableConcept>();
4526          this.subSite.add(t);
4527          return t;
4528        }
4529
4530        public ItemComponent addSubSite(CodeableConcept t) { //3
4531          if (t == null)
4532            return this;
4533          if (this.subSite == null)
4534            this.subSite = new ArrayList<CodeableConcept>();
4535          this.subSite.add(t);
4536          return this;
4537        }
4538
4539        /**
4540         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist
4541         */
4542        public CodeableConcept getSubSiteFirstRep() { 
4543          if (getSubSite().isEmpty()) {
4544            addSubSite();
4545          }
4546          return getSubSite().get(0);
4547        }
4548
4549        /**
4550         * @return {@link #encounter} (A billed item may include goods or services provided in multiple encounters.)
4551         */
4552        public List<Reference> getEncounter() { 
4553          if (this.encounter == null)
4554            this.encounter = new ArrayList<Reference>();
4555          return this.encounter;
4556        }
4557
4558        /**
4559         * @return Returns a reference to <code>this</code> for easy method chaining
4560         */
4561        public ItemComponent setEncounter(List<Reference> theEncounter) { 
4562          this.encounter = theEncounter;
4563          return this;
4564        }
4565
4566        public boolean hasEncounter() { 
4567          if (this.encounter == null)
4568            return false;
4569          for (Reference item : this.encounter)
4570            if (!item.isEmpty())
4571              return true;
4572          return false;
4573        }
4574
4575        public Reference addEncounter() { //3
4576          Reference t = new Reference();
4577          if (this.encounter == null)
4578            this.encounter = new ArrayList<Reference>();
4579          this.encounter.add(t);
4580          return t;
4581        }
4582
4583        public ItemComponent addEncounter(Reference t) { //3
4584          if (t == null)
4585            return this;
4586          if (this.encounter == null)
4587            this.encounter = new ArrayList<Reference>();
4588          this.encounter.add(t);
4589          return this;
4590        }
4591
4592        /**
4593         * @return The first repetition of repeating field {@link #encounter}, creating it if it does not already exist
4594         */
4595        public Reference getEncounterFirstRep() { 
4596          if (getEncounter().isEmpty()) {
4597            addEncounter();
4598          }
4599          return getEncounter().get(0);
4600        }
4601
4602        /**
4603         * @deprecated Use Reference#setResource(IBaseResource) instead
4604         */
4605        @Deprecated
4606        public List<Encounter> getEncounterTarget() { 
4607          if (this.encounterTarget == null)
4608            this.encounterTarget = new ArrayList<Encounter>();
4609          return this.encounterTarget;
4610        }
4611
4612        /**
4613         * @deprecated Use Reference#setResource(IBaseResource) instead
4614         */
4615        @Deprecated
4616        public Encounter addEncounterTarget() { 
4617          Encounter r = new Encounter();
4618          if (this.encounterTarget == null)
4619            this.encounterTarget = new ArrayList<Encounter>();
4620          this.encounterTarget.add(r);
4621          return r;
4622        }
4623
4624        /**
4625         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4626         */
4627        public List<PositiveIntType> getNoteNumber() { 
4628          if (this.noteNumber == null)
4629            this.noteNumber = new ArrayList<PositiveIntType>();
4630          return this.noteNumber;
4631        }
4632
4633        /**
4634         * @return Returns a reference to <code>this</code> for easy method chaining
4635         */
4636        public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
4637          this.noteNumber = theNoteNumber;
4638          return this;
4639        }
4640
4641        public boolean hasNoteNumber() { 
4642          if (this.noteNumber == null)
4643            return false;
4644          for (PositiveIntType item : this.noteNumber)
4645            if (!item.isEmpty())
4646              return true;
4647          return false;
4648        }
4649
4650        /**
4651         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4652         */
4653        public PositiveIntType addNoteNumberElement() {//2 
4654          PositiveIntType t = new PositiveIntType();
4655          if (this.noteNumber == null)
4656            this.noteNumber = new ArrayList<PositiveIntType>();
4657          this.noteNumber.add(t);
4658          return t;
4659        }
4660
4661        /**
4662         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4663         */
4664        public ItemComponent addNoteNumber(int value) { //1
4665          PositiveIntType t = new PositiveIntType();
4666          t.setValue(value);
4667          if (this.noteNumber == null)
4668            this.noteNumber = new ArrayList<PositiveIntType>();
4669          this.noteNumber.add(t);
4670          return this;
4671        }
4672
4673        /**
4674         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4675         */
4676        public boolean hasNoteNumber(int value) { 
4677          if (this.noteNumber == null)
4678            return false;
4679          for (PositiveIntType v : this.noteNumber)
4680            if (v.getValue().equals(value)) // positiveInt
4681              return true;
4682          return false;
4683        }
4684
4685        /**
4686         * @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.)
4687         */
4688        public List<AdjudicationComponent> getAdjudication() { 
4689          if (this.adjudication == null)
4690            this.adjudication = new ArrayList<AdjudicationComponent>();
4691          return this.adjudication;
4692        }
4693
4694        /**
4695         * @return Returns a reference to <code>this</code> for easy method chaining
4696         */
4697        public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
4698          this.adjudication = theAdjudication;
4699          return this;
4700        }
4701
4702        public boolean hasAdjudication() { 
4703          if (this.adjudication == null)
4704            return false;
4705          for (AdjudicationComponent item : this.adjudication)
4706            if (!item.isEmpty())
4707              return true;
4708          return false;
4709        }
4710
4711        public AdjudicationComponent addAdjudication() { //3
4712          AdjudicationComponent t = new AdjudicationComponent();
4713          if (this.adjudication == null)
4714            this.adjudication = new ArrayList<AdjudicationComponent>();
4715          this.adjudication.add(t);
4716          return t;
4717        }
4718
4719        public ItemComponent addAdjudication(AdjudicationComponent t) { //3
4720          if (t == null)
4721            return this;
4722          if (this.adjudication == null)
4723            this.adjudication = new ArrayList<AdjudicationComponent>();
4724          this.adjudication.add(t);
4725          return this;
4726        }
4727
4728        /**
4729         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
4730         */
4731        public AdjudicationComponent getAdjudicationFirstRep() { 
4732          if (getAdjudication().isEmpty()) {
4733            addAdjudication();
4734          }
4735          return getAdjudication().get(0);
4736        }
4737
4738        /**
4739         * @return {@link #detail} (Second-tier of goods and services.)
4740         */
4741        public List<DetailComponent> getDetail() { 
4742          if (this.detail == null)
4743            this.detail = new ArrayList<DetailComponent>();
4744          return this.detail;
4745        }
4746
4747        /**
4748         * @return Returns a reference to <code>this</code> for easy method chaining
4749         */
4750        public ItemComponent setDetail(List<DetailComponent> theDetail) { 
4751          this.detail = theDetail;
4752          return this;
4753        }
4754
4755        public boolean hasDetail() { 
4756          if (this.detail == null)
4757            return false;
4758          for (DetailComponent item : this.detail)
4759            if (!item.isEmpty())
4760              return true;
4761          return false;
4762        }
4763
4764        public DetailComponent addDetail() { //3
4765          DetailComponent t = new DetailComponent();
4766          if (this.detail == null)
4767            this.detail = new ArrayList<DetailComponent>();
4768          this.detail.add(t);
4769          return t;
4770        }
4771
4772        public ItemComponent addDetail(DetailComponent t) { //3
4773          if (t == null)
4774            return this;
4775          if (this.detail == null)
4776            this.detail = new ArrayList<DetailComponent>();
4777          this.detail.add(t);
4778          return this;
4779        }
4780
4781        /**
4782         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
4783         */
4784        public DetailComponent getDetailFirstRep() { 
4785          if (getDetail().isEmpty()) {
4786            addDetail();
4787          }
4788          return getDetail().get(0);
4789        }
4790
4791        protected void listChildren(List<Property> children) {
4792          super.listChildren(children);
4793          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence));
4794          children.add(new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence));
4795          children.add(new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence));
4796          children.add(new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence));
4797          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));
4798          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
4799          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
4800          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));
4801          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));
4802          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
4803          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));
4804          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location));
4805          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
4806          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));
4807          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));
4808          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
4809          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
4810          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
4811          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));
4812          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));
4813          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));
4814          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));
4815          children.add(new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
4816        }
4817
4818        @Override
4819        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4820          switch (_hash) {
4821          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence);
4822          case 1070083823: /*careTeamSequence*/  return new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence);
4823          case -909769262: /*diagnosisSequence*/  return new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence);
4824          case -808920140: /*procedureSequence*/  return new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence);
4825          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);
4826          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
4827          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);
4828          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);
4829          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);
4830          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
4831          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);
4832          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);
4833          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);
4834          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);
4835          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4836          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4837          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4838          case -1280020865: /*locationAddress*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4839          case 755866390: /*locationReference*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4840          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
4841          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);
4842          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);
4843          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);
4844          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
4845          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
4846          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);
4847          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);
4848          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);
4849          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);
4850          case -1335224239: /*detail*/  return new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail);
4851          default: return super.getNamedProperty(_hash, _name, _checkValid);
4852          }
4853
4854        }
4855
4856      @Override
4857      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4858        switch (hash) {
4859        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
4860        case 1070083823: /*careTeamSequence*/ return this.careTeamSequence == null ? new Base[0] : this.careTeamSequence.toArray(new Base[this.careTeamSequence.size()]); // PositiveIntType
4861        case -909769262: /*diagnosisSequence*/ return this.diagnosisSequence == null ? new Base[0] : this.diagnosisSequence.toArray(new Base[this.diagnosisSequence.size()]); // PositiveIntType
4862        case -808920140: /*procedureSequence*/ return this.procedureSequence == null ? new Base[0] : this.procedureSequence.toArray(new Base[this.procedureSequence.size()]); // PositiveIntType
4863        case -702585587: /*informationSequence*/ return this.informationSequence == null ? new Base[0] : this.informationSequence.toArray(new Base[this.informationSequence.size()]); // PositiveIntType
4864        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
4865        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4866        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
4867        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
4868        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
4869        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
4870        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
4871        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
4872        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
4873        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
4874        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
4875        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
4876        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
4877        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
4878        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
4879        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
4880        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
4881        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
4882        default: return super.getProperty(hash, name, checkValid);
4883        }
4884
4885      }
4886
4887      @Override
4888      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4889        switch (hash) {
4890        case 1349547969: // sequence
4891          this.sequence = castToPositiveInt(value); // PositiveIntType
4892          return value;
4893        case 1070083823: // careTeamSequence
4894          this.getCareTeamSequence().add(castToPositiveInt(value)); // PositiveIntType
4895          return value;
4896        case -909769262: // diagnosisSequence
4897          this.getDiagnosisSequence().add(castToPositiveInt(value)); // PositiveIntType
4898          return value;
4899        case -808920140: // procedureSequence
4900          this.getProcedureSequence().add(castToPositiveInt(value)); // PositiveIntType
4901          return value;
4902        case -702585587: // informationSequence
4903          this.getInformationSequence().add(castToPositiveInt(value)); // PositiveIntType
4904          return value;
4905        case 1099842588: // revenue
4906          this.revenue = castToCodeableConcept(value); // CodeableConcept
4907          return value;
4908        case 50511102: // category
4909          this.category = castToCodeableConcept(value); // CodeableConcept
4910          return value;
4911        case 1957227299: // productOrService
4912          this.productOrService = castToCodeableConcept(value); // CodeableConcept
4913          return value;
4914        case -615513385: // modifier
4915          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
4916          return value;
4917        case 1010065041: // programCode
4918          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
4919          return value;
4920        case 1379209295: // serviced
4921          this.serviced = castToType(value); // Type
4922          return value;
4923        case 1901043637: // location
4924          this.location = castToType(value); // Type
4925          return value;
4926        case -1285004149: // quantity
4927          this.quantity = castToQuantity(value); // Quantity
4928          return value;
4929        case -486196699: // unitPrice
4930          this.unitPrice = castToMoney(value); // Money
4931          return value;
4932        case -1282148017: // factor
4933          this.factor = castToDecimal(value); // DecimalType
4934          return value;
4935        case 108957: // net
4936          this.net = castToMoney(value); // Money
4937          return value;
4938        case 115642: // udi
4939          this.getUdi().add(castToReference(value)); // Reference
4940          return value;
4941        case 1702620169: // bodySite
4942          this.bodySite = castToCodeableConcept(value); // CodeableConcept
4943          return value;
4944        case -1868566105: // subSite
4945          this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
4946          return value;
4947        case 1524132147: // encounter
4948          this.getEncounter().add(castToReference(value)); // Reference
4949          return value;
4950        case -1110033957: // noteNumber
4951          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
4952          return value;
4953        case -231349275: // adjudication
4954          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
4955          return value;
4956        case -1335224239: // detail
4957          this.getDetail().add((DetailComponent) value); // DetailComponent
4958          return value;
4959        default: return super.setProperty(hash, name, value);
4960        }
4961
4962      }
4963
4964      @Override
4965      public Base setProperty(String name, Base value) throws FHIRException {
4966        if (name.equals("sequence")) {
4967          this.sequence = castToPositiveInt(value); // PositiveIntType
4968        } else if (name.equals("careTeamSequence")) {
4969          this.getCareTeamSequence().add(castToPositiveInt(value));
4970        } else if (name.equals("diagnosisSequence")) {
4971          this.getDiagnosisSequence().add(castToPositiveInt(value));
4972        } else if (name.equals("procedureSequence")) {
4973          this.getProcedureSequence().add(castToPositiveInt(value));
4974        } else if (name.equals("informationSequence")) {
4975          this.getInformationSequence().add(castToPositiveInt(value));
4976        } else if (name.equals("revenue")) {
4977          this.revenue = castToCodeableConcept(value); // CodeableConcept
4978        } else if (name.equals("category")) {
4979          this.category = castToCodeableConcept(value); // CodeableConcept
4980        } else if (name.equals("productOrService")) {
4981          this.productOrService = castToCodeableConcept(value); // CodeableConcept
4982        } else if (name.equals("modifier")) {
4983          this.getModifier().add(castToCodeableConcept(value));
4984        } else if (name.equals("programCode")) {
4985          this.getProgramCode().add(castToCodeableConcept(value));
4986        } else if (name.equals("serviced[x]")) {
4987          this.serviced = castToType(value); // Type
4988        } else if (name.equals("location[x]")) {
4989          this.location = castToType(value); // Type
4990        } else if (name.equals("quantity")) {
4991          this.quantity = castToQuantity(value); // Quantity
4992        } else if (name.equals("unitPrice")) {
4993          this.unitPrice = castToMoney(value); // Money
4994        } else if (name.equals("factor")) {
4995          this.factor = castToDecimal(value); // DecimalType
4996        } else if (name.equals("net")) {
4997          this.net = castToMoney(value); // Money
4998        } else if (name.equals("udi")) {
4999          this.getUdi().add(castToReference(value));
5000        } else if (name.equals("bodySite")) {
5001          this.bodySite = castToCodeableConcept(value); // CodeableConcept
5002        } else if (name.equals("subSite")) {
5003          this.getSubSite().add(castToCodeableConcept(value));
5004        } else if (name.equals("encounter")) {
5005          this.getEncounter().add(castToReference(value));
5006        } else if (name.equals("noteNumber")) {
5007          this.getNoteNumber().add(castToPositiveInt(value));
5008        } else if (name.equals("adjudication")) {
5009          this.getAdjudication().add((AdjudicationComponent) value);
5010        } else if (name.equals("detail")) {
5011          this.getDetail().add((DetailComponent) value);
5012        } else
5013          return super.setProperty(name, value);
5014        return value;
5015      }
5016
5017      @Override
5018      public Base makeProperty(int hash, String name) throws FHIRException {
5019        switch (hash) {
5020        case 1349547969:  return getSequenceElement();
5021        case 1070083823:  return addCareTeamSequenceElement();
5022        case -909769262:  return addDiagnosisSequenceElement();
5023        case -808920140:  return addProcedureSequenceElement();
5024        case -702585587:  return addInformationSequenceElement();
5025        case 1099842588:  return getRevenue(); 
5026        case 50511102:  return getCategory(); 
5027        case 1957227299:  return getProductOrService(); 
5028        case -615513385:  return addModifier(); 
5029        case 1010065041:  return addProgramCode(); 
5030        case -1927922223:  return getServiced(); 
5031        case 1379209295:  return getServiced(); 
5032        case 552316075:  return getLocation(); 
5033        case 1901043637:  return getLocation(); 
5034        case -1285004149:  return getQuantity(); 
5035        case -486196699:  return getUnitPrice(); 
5036        case -1282148017:  return getFactorElement();
5037        case 108957:  return getNet(); 
5038        case 115642:  return addUdi(); 
5039        case 1702620169:  return getBodySite(); 
5040        case -1868566105:  return addSubSite(); 
5041        case 1524132147:  return addEncounter(); 
5042        case -1110033957:  return addNoteNumberElement();
5043        case -231349275:  return addAdjudication(); 
5044        case -1335224239:  return addDetail(); 
5045        default: return super.makeProperty(hash, name);
5046        }
5047
5048      }
5049
5050      @Override
5051      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5052        switch (hash) {
5053        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
5054        case 1070083823: /*careTeamSequence*/ return new String[] {"positiveInt"};
5055        case -909769262: /*diagnosisSequence*/ return new String[] {"positiveInt"};
5056        case -808920140: /*procedureSequence*/ return new String[] {"positiveInt"};
5057        case -702585587: /*informationSequence*/ return new String[] {"positiveInt"};
5058        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
5059        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5060        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
5061        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
5062        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
5063        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
5064        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
5065        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
5066        case -486196699: /*unitPrice*/ return new String[] {"Money"};
5067        case -1282148017: /*factor*/ return new String[] {"decimal"};
5068        case 108957: /*net*/ return new String[] {"Money"};
5069        case 115642: /*udi*/ return new String[] {"Reference"};
5070        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
5071        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
5072        case 1524132147: /*encounter*/ return new String[] {"Reference"};
5073        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
5074        case -231349275: /*adjudication*/ return new String[] {};
5075        case -1335224239: /*detail*/ return new String[] {};
5076        default: return super.getTypesForProperty(hash, name);
5077        }
5078
5079      }
5080
5081      @Override
5082      public Base addChild(String name) throws FHIRException {
5083        if (name.equals("sequence")) {
5084          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
5085        }
5086        else if (name.equals("careTeamSequence")) {
5087          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.careTeamSequence");
5088        }
5089        else if (name.equals("diagnosisSequence")) {
5090          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.diagnosisSequence");
5091        }
5092        else if (name.equals("procedureSequence")) {
5093          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedureSequence");
5094        }
5095        else if (name.equals("informationSequence")) {
5096          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.informationSequence");
5097        }
5098        else if (name.equals("revenue")) {
5099          this.revenue = new CodeableConcept();
5100          return this.revenue;
5101        }
5102        else if (name.equals("category")) {
5103          this.category = new CodeableConcept();
5104          return this.category;
5105        }
5106        else if (name.equals("productOrService")) {
5107          this.productOrService = new CodeableConcept();
5108          return this.productOrService;
5109        }
5110        else if (name.equals("modifier")) {
5111          return addModifier();
5112        }
5113        else if (name.equals("programCode")) {
5114          return addProgramCode();
5115        }
5116        else if (name.equals("servicedDate")) {
5117          this.serviced = new DateType();
5118          return this.serviced;
5119        }
5120        else if (name.equals("servicedPeriod")) {
5121          this.serviced = new Period();
5122          return this.serviced;
5123        }
5124        else if (name.equals("locationCodeableConcept")) {
5125          this.location = new CodeableConcept();
5126          return this.location;
5127        }
5128        else if (name.equals("locationAddress")) {
5129          this.location = new Address();
5130          return this.location;
5131        }
5132        else if (name.equals("locationReference")) {
5133          this.location = new Reference();
5134          return this.location;
5135        }
5136        else if (name.equals("quantity")) {
5137          this.quantity = new Quantity();
5138          return this.quantity;
5139        }
5140        else if (name.equals("unitPrice")) {
5141          this.unitPrice = new Money();
5142          return this.unitPrice;
5143        }
5144        else if (name.equals("factor")) {
5145          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
5146        }
5147        else if (name.equals("net")) {
5148          this.net = new Money();
5149          return this.net;
5150        }
5151        else if (name.equals("udi")) {
5152          return addUdi();
5153        }
5154        else if (name.equals("bodySite")) {
5155          this.bodySite = new CodeableConcept();
5156          return this.bodySite;
5157        }
5158        else if (name.equals("subSite")) {
5159          return addSubSite();
5160        }
5161        else if (name.equals("encounter")) {
5162          return addEncounter();
5163        }
5164        else if (name.equals("noteNumber")) {
5165          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
5166        }
5167        else if (name.equals("adjudication")) {
5168          return addAdjudication();
5169        }
5170        else if (name.equals("detail")) {
5171          return addDetail();
5172        }
5173        else
5174          return super.addChild(name);
5175      }
5176
5177      public ItemComponent copy() {
5178        ItemComponent dst = new ItemComponent();
5179        copyValues(dst);
5180        dst.sequence = sequence == null ? null : sequence.copy();
5181        if (careTeamSequence != null) {
5182          dst.careTeamSequence = new ArrayList<PositiveIntType>();
5183          for (PositiveIntType i : careTeamSequence)
5184            dst.careTeamSequence.add(i.copy());
5185        };
5186        if (diagnosisSequence != null) {
5187          dst.diagnosisSequence = new ArrayList<PositiveIntType>();
5188          for (PositiveIntType i : diagnosisSequence)
5189            dst.diagnosisSequence.add(i.copy());
5190        };
5191        if (procedureSequence != null) {
5192          dst.procedureSequence = new ArrayList<PositiveIntType>();
5193          for (PositiveIntType i : procedureSequence)
5194            dst.procedureSequence.add(i.copy());
5195        };
5196        if (informationSequence != null) {
5197          dst.informationSequence = new ArrayList<PositiveIntType>();
5198          for (PositiveIntType i : informationSequence)
5199            dst.informationSequence.add(i.copy());
5200        };
5201        dst.revenue = revenue == null ? null : revenue.copy();
5202        dst.category = category == null ? null : category.copy();
5203        dst.productOrService = productOrService == null ? null : productOrService.copy();
5204        if (modifier != null) {
5205          dst.modifier = new ArrayList<CodeableConcept>();
5206          for (CodeableConcept i : modifier)
5207            dst.modifier.add(i.copy());
5208        };
5209        if (programCode != null) {
5210          dst.programCode = new ArrayList<CodeableConcept>();
5211          for (CodeableConcept i : programCode)
5212            dst.programCode.add(i.copy());
5213        };
5214        dst.serviced = serviced == null ? null : serviced.copy();
5215        dst.location = location == null ? null : location.copy();
5216        dst.quantity = quantity == null ? null : quantity.copy();
5217        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
5218        dst.factor = factor == null ? null : factor.copy();
5219        dst.net = net == null ? null : net.copy();
5220        if (udi != null) {
5221          dst.udi = new ArrayList<Reference>();
5222          for (Reference i : udi)
5223            dst.udi.add(i.copy());
5224        };
5225        dst.bodySite = bodySite == null ? null : bodySite.copy();
5226        if (subSite != null) {
5227          dst.subSite = new ArrayList<CodeableConcept>();
5228          for (CodeableConcept i : subSite)
5229            dst.subSite.add(i.copy());
5230        };
5231        if (encounter != null) {
5232          dst.encounter = new ArrayList<Reference>();
5233          for (Reference i : encounter)
5234            dst.encounter.add(i.copy());
5235        };
5236        if (noteNumber != null) {
5237          dst.noteNumber = new ArrayList<PositiveIntType>();
5238          for (PositiveIntType i : noteNumber)
5239            dst.noteNumber.add(i.copy());
5240        };
5241        if (adjudication != null) {
5242          dst.adjudication = new ArrayList<AdjudicationComponent>();
5243          for (AdjudicationComponent i : adjudication)
5244            dst.adjudication.add(i.copy());
5245        };
5246        if (detail != null) {
5247          dst.detail = new ArrayList<DetailComponent>();
5248          for (DetailComponent i : detail)
5249            dst.detail.add(i.copy());
5250        };
5251        return dst;
5252      }
5253
5254      @Override
5255      public boolean equalsDeep(Base other_) {
5256        if (!super.equalsDeep(other_))
5257          return false;
5258        if (!(other_ instanceof ItemComponent))
5259          return false;
5260        ItemComponent o = (ItemComponent) other_;
5261        return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamSequence, o.careTeamSequence, true)
5262           && compareDeep(diagnosisSequence, o.diagnosisSequence, true) && compareDeep(procedureSequence, o.procedureSequence, true)
5263           && compareDeep(informationSequence, o.informationSequence, true) && compareDeep(revenue, o.revenue, true)
5264           && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
5265           && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true)
5266           && compareDeep(location, o.location, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
5267           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
5268           && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true) && compareDeep(encounter, o.encounter, true)
5269           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
5270           && compareDeep(detail, o.detail, true);
5271      }
5272
5273      @Override
5274      public boolean equalsShallow(Base other_) {
5275        if (!super.equalsShallow(other_))
5276          return false;
5277        if (!(other_ instanceof ItemComponent))
5278          return false;
5279        ItemComponent o = (ItemComponent) other_;
5280        return compareValues(sequence, o.sequence, true) && compareValues(careTeamSequence, o.careTeamSequence, true)
5281           && compareValues(diagnosisSequence, o.diagnosisSequence, true) && compareValues(procedureSequence, o.procedureSequence, true)
5282           && compareValues(informationSequence, o.informationSequence, true) && compareValues(factor, o.factor, true)
5283           && compareValues(noteNumber, o.noteNumber, true);
5284      }
5285
5286      public boolean isEmpty() {
5287        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamSequence
5288          , diagnosisSequence, procedureSequence, informationSequence, revenue, category, productOrService
5289          , modifier, programCode, serviced, location, quantity, unitPrice, factor, net
5290          , udi, bodySite, subSite, encounter, noteNumber, adjudication, detail);
5291      }
5292
5293  public String fhirType() {
5294    return "ExplanationOfBenefit.item";
5295
5296  }
5297
5298  }
5299
5300    @Block()
5301    public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
5302        /**
5303         * 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.
5304         */
5305        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
5306        @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." )
5307        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
5308        protected CodeableConcept category;
5309
5310        /**
5311         * A code supporting the understanding of the adjudication result and explaining variance from expected amount.
5312         */
5313        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5314        @Description(shortDefinition="Explanation of adjudication outcome", formalDefinition="A code supporting the understanding of the adjudication result and explaining variance from expected amount." )
5315        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-reason")
5316        protected CodeableConcept reason;
5317
5318        /**
5319         * Monetary amount associated with the category.
5320         */
5321        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
5322        @Description(shortDefinition="Monetary amount", formalDefinition="Monetary amount associated with the category." )
5323        protected Money amount;
5324
5325        /**
5326         * A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5327         */
5328        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
5329        @Description(shortDefinition="Non-monitary value", formalDefinition="A non-monetary value associated with the category. Mutually exclusive to the amount element above." )
5330        protected DecimalType value;
5331
5332        private static final long serialVersionUID = 1559898786L;
5333
5334    /**
5335     * Constructor
5336     */
5337      public AdjudicationComponent() {
5338        super();
5339      }
5340
5341    /**
5342     * Constructor
5343     */
5344      public AdjudicationComponent(CodeableConcept category) {
5345        super();
5346        this.category = category;
5347      }
5348
5349        /**
5350         * @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.)
5351         */
5352        public CodeableConcept getCategory() { 
5353          if (this.category == null)
5354            if (Configuration.errorOnAutoCreate())
5355              throw new Error("Attempt to auto-create AdjudicationComponent.category");
5356            else if (Configuration.doAutoCreate())
5357              this.category = new CodeableConcept(); // cc
5358          return this.category;
5359        }
5360
5361        public boolean hasCategory() { 
5362          return this.category != null && !this.category.isEmpty();
5363        }
5364
5365        /**
5366         * @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.)
5367         */
5368        public AdjudicationComponent setCategory(CodeableConcept value) { 
5369          this.category = value;
5370          return this;
5371        }
5372
5373        /**
5374         * @return {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
5375         */
5376        public CodeableConcept getReason() { 
5377          if (this.reason == null)
5378            if (Configuration.errorOnAutoCreate())
5379              throw new Error("Attempt to auto-create AdjudicationComponent.reason");
5380            else if (Configuration.doAutoCreate())
5381              this.reason = new CodeableConcept(); // cc
5382          return this.reason;
5383        }
5384
5385        public boolean hasReason() { 
5386          return this.reason != null && !this.reason.isEmpty();
5387        }
5388
5389        /**
5390         * @param value {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
5391         */
5392        public AdjudicationComponent setReason(CodeableConcept value) { 
5393          this.reason = value;
5394          return this;
5395        }
5396
5397        /**
5398         * @return {@link #amount} (Monetary amount associated with the category.)
5399         */
5400        public Money getAmount() { 
5401          if (this.amount == null)
5402            if (Configuration.errorOnAutoCreate())
5403              throw new Error("Attempt to auto-create AdjudicationComponent.amount");
5404            else if (Configuration.doAutoCreate())
5405              this.amount = new Money(); // cc
5406          return this.amount;
5407        }
5408
5409        public boolean hasAmount() { 
5410          return this.amount != null && !this.amount.isEmpty();
5411        }
5412
5413        /**
5414         * @param value {@link #amount} (Monetary amount associated with the category.)
5415         */
5416        public AdjudicationComponent setAmount(Money value) { 
5417          this.amount = value;
5418          return this;
5419        }
5420
5421        /**
5422         * @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
5423         */
5424        public DecimalType getValueElement() { 
5425          if (this.value == null)
5426            if (Configuration.errorOnAutoCreate())
5427              throw new Error("Attempt to auto-create AdjudicationComponent.value");
5428            else if (Configuration.doAutoCreate())
5429              this.value = new DecimalType(); // bb
5430          return this.value;
5431        }
5432
5433        public boolean hasValueElement() { 
5434          return this.value != null && !this.value.isEmpty();
5435        }
5436
5437        public boolean hasValue() { 
5438          return this.value != null && !this.value.isEmpty();
5439        }
5440
5441        /**
5442         * @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
5443         */
5444        public AdjudicationComponent setValueElement(DecimalType value) { 
5445          this.value = value;
5446          return this;
5447        }
5448
5449        /**
5450         * @return A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5451         */
5452        public BigDecimal getValue() { 
5453          return this.value == null ? null : this.value.getValue();
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(BigDecimal value) { 
5460          if (value == null)
5461            this.value = null;
5462          else {
5463            if (this.value == null)
5464              this.value = new DecimalType();
5465            this.value.setValue(value);
5466          }
5467          return this;
5468        }
5469
5470        /**
5471         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5472         */
5473        public AdjudicationComponent setValue(long value) { 
5474              this.value = new DecimalType();
5475            this.value.setValue(value);
5476          return this;
5477        }
5478
5479        /**
5480         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5481         */
5482        public AdjudicationComponent setValue(double value) { 
5483              this.value = new DecimalType();
5484            this.value.setValue(value);
5485          return this;
5486        }
5487
5488        protected void listChildren(List<Property> children) {
5489          super.listChildren(children);
5490          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));
5491          children.add(new Property("reason", "CodeableConcept", "A code supporting the understanding of the adjudication result and explaining variance from expected amount.", 0, 1, reason));
5492          children.add(new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount));
5493          children.add(new Property("value", "decimal", "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1, value));
5494        }
5495
5496        @Override
5497        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5498          switch (_hash) {
5499          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);
5500          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);
5501          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount);
5502          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);
5503          default: return super.getNamedProperty(_hash, _name, _checkValid);
5504          }
5505
5506        }
5507
5508      @Override
5509      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5510        switch (hash) {
5511        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
5512        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
5513        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
5514        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
5515        default: return super.getProperty(hash, name, checkValid);
5516        }
5517
5518      }
5519
5520      @Override
5521      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5522        switch (hash) {
5523        case 50511102: // category
5524          this.category = castToCodeableConcept(value); // CodeableConcept
5525          return value;
5526        case -934964668: // reason
5527          this.reason = castToCodeableConcept(value); // CodeableConcept
5528          return value;
5529        case -1413853096: // amount
5530          this.amount = castToMoney(value); // Money
5531          return value;
5532        case 111972721: // value
5533          this.value = castToDecimal(value); // DecimalType
5534          return value;
5535        default: return super.setProperty(hash, name, value);
5536        }
5537
5538      }
5539
5540      @Override
5541      public Base setProperty(String name, Base value) throws FHIRException {
5542        if (name.equals("category")) {
5543          this.category = castToCodeableConcept(value); // CodeableConcept
5544        } else if (name.equals("reason")) {
5545          this.reason = castToCodeableConcept(value); // CodeableConcept
5546        } else if (name.equals("amount")) {
5547          this.amount = castToMoney(value); // Money
5548        } else if (name.equals("value")) {
5549          this.value = castToDecimal(value); // DecimalType
5550        } else
5551          return super.setProperty(name, value);
5552        return value;
5553      }
5554
5555      @Override
5556      public Base makeProperty(int hash, String name) throws FHIRException {
5557        switch (hash) {
5558        case 50511102:  return getCategory(); 
5559        case -934964668:  return getReason(); 
5560        case -1413853096:  return getAmount(); 
5561        case 111972721:  return getValueElement();
5562        default: return super.makeProperty(hash, name);
5563        }
5564
5565      }
5566
5567      @Override
5568      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5569        switch (hash) {
5570        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5571        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
5572        case -1413853096: /*amount*/ return new String[] {"Money"};
5573        case 111972721: /*value*/ return new String[] {"decimal"};
5574        default: return super.getTypesForProperty(hash, name);
5575        }
5576
5577      }
5578
5579      @Override
5580      public Base addChild(String name) throws FHIRException {
5581        if (name.equals("category")) {
5582          this.category = new CodeableConcept();
5583          return this.category;
5584        }
5585        else if (name.equals("reason")) {
5586          this.reason = new CodeableConcept();
5587          return this.reason;
5588        }
5589        else if (name.equals("amount")) {
5590          this.amount = new Money();
5591          return this.amount;
5592        }
5593        else if (name.equals("value")) {
5594          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
5595        }
5596        else
5597          return super.addChild(name);
5598      }
5599
5600      public AdjudicationComponent copy() {
5601        AdjudicationComponent dst = new AdjudicationComponent();
5602        copyValues(dst);
5603        dst.category = category == null ? null : category.copy();
5604        dst.reason = reason == null ? null : reason.copy();
5605        dst.amount = amount == null ? null : amount.copy();
5606        dst.value = value == null ? null : value.copy();
5607        return dst;
5608      }
5609
5610      @Override
5611      public boolean equalsDeep(Base other_) {
5612        if (!super.equalsDeep(other_))
5613          return false;
5614        if (!(other_ instanceof AdjudicationComponent))
5615          return false;
5616        AdjudicationComponent o = (AdjudicationComponent) other_;
5617        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
5618           && compareDeep(value, o.value, true);
5619      }
5620
5621      @Override
5622      public boolean equalsShallow(Base other_) {
5623        if (!super.equalsShallow(other_))
5624          return false;
5625        if (!(other_ instanceof AdjudicationComponent))
5626          return false;
5627        AdjudicationComponent o = (AdjudicationComponent) other_;
5628        return compareValues(value, o.value, true);
5629      }
5630
5631      public boolean isEmpty() {
5632        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount
5633          , value);
5634      }
5635
5636  public String fhirType() {
5637    return "ExplanationOfBenefit.item.adjudication";
5638
5639  }
5640
5641  }
5642
5643    @Block()
5644    public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
5645        /**
5646         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5647         */
5648        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
5649        @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." )
5650        protected PositiveIntType sequence;
5651
5652        /**
5653         * The type of revenue or cost center providing the product and/or service.
5654         */
5655        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5656        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
5657        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
5658        protected CodeableConcept revenue;
5659
5660        /**
5661         * Code to identify the general type of benefits under which products and services are provided.
5662         */
5663        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
5664        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
5665        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
5666        protected CodeableConcept category;
5667
5668        /**
5669         * 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.
5670         */
5671        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
5672        @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." )
5673        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
5674        protected CodeableConcept productOrService;
5675
5676        /**
5677         * Item typification or modifiers codes to convey additional context for the product or service.
5678         */
5679        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5680        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
5681        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
5682        protected List<CodeableConcept> modifier;
5683
5684        /**
5685         * Identifies the program under which this may be recovered.
5686         */
5687        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5688        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
5689        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
5690        protected List<CodeableConcept> programCode;
5691
5692        /**
5693         * The number of repetitions of a service or product.
5694         */
5695        @Child(name = "quantity", type = {Quantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
5696        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
5697        protected Quantity quantity;
5698
5699        /**
5700         * 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.
5701         */
5702        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
5703        @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." )
5704        protected Money unitPrice;
5705
5706        /**
5707         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
5708         */
5709        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
5710        @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." )
5711        protected DecimalType factor;
5712
5713        /**
5714         * The quantity times the unit price for an additional service or product or charge.
5715         */
5716        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
5717        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
5718        protected Money net;
5719
5720        /**
5721         * Unique Device Identifiers associated with this line item.
5722         */
5723        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5724        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
5725        protected List<Reference> udi;
5726        /**
5727         * The actual objects that are the target of the reference (Unique Device Identifiers associated with this line item.)
5728         */
5729        protected List<Device> udiTarget;
5730
5731
5732        /**
5733         * The numbers associated with notes below which apply to the adjudication of this item.
5734         */
5735        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5736        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
5737        protected List<PositiveIntType> noteNumber;
5738
5739        /**
5740         * The adjudication results.
5741         */
5742        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5743        @Description(shortDefinition="Detail level adjudication details", formalDefinition="The adjudication results." )
5744        protected List<AdjudicationComponent> adjudication;
5745
5746        /**
5747         * Third-tier of goods and services.
5748         */
5749        @Child(name = "subDetail", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5750        @Description(shortDefinition="Additional items", formalDefinition="Third-tier of goods and services." )
5751        protected List<SubDetailComponent> subDetail;
5752
5753        private static final long serialVersionUID = 225639798L;
5754
5755    /**
5756     * Constructor
5757     */
5758      public DetailComponent() {
5759        super();
5760      }
5761
5762    /**
5763     * Constructor
5764     */
5765      public DetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
5766        super();
5767        this.sequence = sequence;
5768        this.productOrService = productOrService;
5769      }
5770
5771        /**
5772         * @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
5773         */
5774        public PositiveIntType getSequenceElement() { 
5775          if (this.sequence == null)
5776            if (Configuration.errorOnAutoCreate())
5777              throw new Error("Attempt to auto-create DetailComponent.sequence");
5778            else if (Configuration.doAutoCreate())
5779              this.sequence = new PositiveIntType(); // bb
5780          return this.sequence;
5781        }
5782
5783        public boolean hasSequenceElement() { 
5784          return this.sequence != null && !this.sequence.isEmpty();
5785        }
5786
5787        public boolean hasSequence() { 
5788          return this.sequence != null && !this.sequence.isEmpty();
5789        }
5790
5791        /**
5792         * @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
5793         */
5794        public DetailComponent setSequenceElement(PositiveIntType value) { 
5795          this.sequence = value;
5796          return this;
5797        }
5798
5799        /**
5800         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5801         */
5802        public int getSequence() { 
5803          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
5804        }
5805
5806        /**
5807         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5808         */
5809        public DetailComponent setSequence(int value) { 
5810            if (this.sequence == null)
5811              this.sequence = new PositiveIntType();
5812            this.sequence.setValue(value);
5813          return this;
5814        }
5815
5816        /**
5817         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5818         */
5819        public CodeableConcept getRevenue() { 
5820          if (this.revenue == null)
5821            if (Configuration.errorOnAutoCreate())
5822              throw new Error("Attempt to auto-create DetailComponent.revenue");
5823            else if (Configuration.doAutoCreate())
5824              this.revenue = new CodeableConcept(); // cc
5825          return this.revenue;
5826        }
5827
5828        public boolean hasRevenue() { 
5829          return this.revenue != null && !this.revenue.isEmpty();
5830        }
5831
5832        /**
5833         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5834         */
5835        public DetailComponent setRevenue(CodeableConcept value) { 
5836          this.revenue = value;
5837          return this;
5838        }
5839
5840        /**
5841         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5842         */
5843        public CodeableConcept getCategory() { 
5844          if (this.category == null)
5845            if (Configuration.errorOnAutoCreate())
5846              throw new Error("Attempt to auto-create DetailComponent.category");
5847            else if (Configuration.doAutoCreate())
5848              this.category = new CodeableConcept(); // cc
5849          return this.category;
5850        }
5851
5852        public boolean hasCategory() { 
5853          return this.category != null && !this.category.isEmpty();
5854        }
5855
5856        /**
5857         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5858         */
5859        public DetailComponent setCategory(CodeableConcept value) { 
5860          this.category = value;
5861          return this;
5862        }
5863
5864        /**
5865         * @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.)
5866         */
5867        public CodeableConcept getProductOrService() { 
5868          if (this.productOrService == null)
5869            if (Configuration.errorOnAutoCreate())
5870              throw new Error("Attempt to auto-create DetailComponent.productOrService");
5871            else if (Configuration.doAutoCreate())
5872              this.productOrService = new CodeableConcept(); // cc
5873          return this.productOrService;
5874        }
5875
5876        public boolean hasProductOrService() { 
5877          return this.productOrService != null && !this.productOrService.isEmpty();
5878        }
5879
5880        /**
5881         * @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.)
5882         */
5883        public DetailComponent setProductOrService(CodeableConcept value) { 
5884          this.productOrService = value;
5885          return this;
5886        }
5887
5888        /**
5889         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
5890         */
5891        public List<CodeableConcept> getModifier() { 
5892          if (this.modifier == null)
5893            this.modifier = new ArrayList<CodeableConcept>();
5894          return this.modifier;
5895        }
5896
5897        /**
5898         * @return Returns a reference to <code>this</code> for easy method chaining
5899         */
5900        public DetailComponent setModifier(List<CodeableConcept> theModifier) { 
5901          this.modifier = theModifier;
5902          return this;
5903        }
5904
5905        public boolean hasModifier() { 
5906          if (this.modifier == null)
5907            return false;
5908          for (CodeableConcept item : this.modifier)
5909            if (!item.isEmpty())
5910              return true;
5911          return false;
5912        }
5913
5914        public CodeableConcept addModifier() { //3
5915          CodeableConcept t = new CodeableConcept();
5916          if (this.modifier == null)
5917            this.modifier = new ArrayList<CodeableConcept>();
5918          this.modifier.add(t);
5919          return t;
5920        }
5921
5922        public DetailComponent addModifier(CodeableConcept t) { //3
5923          if (t == null)
5924            return this;
5925          if (this.modifier == null)
5926            this.modifier = new ArrayList<CodeableConcept>();
5927          this.modifier.add(t);
5928          return this;
5929        }
5930
5931        /**
5932         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
5933         */
5934        public CodeableConcept getModifierFirstRep() { 
5935          if (getModifier().isEmpty()) {
5936            addModifier();
5937          }
5938          return getModifier().get(0);
5939        }
5940
5941        /**
5942         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
5943         */
5944        public List<CodeableConcept> getProgramCode() { 
5945          if (this.programCode == null)
5946            this.programCode = new ArrayList<CodeableConcept>();
5947          return this.programCode;
5948        }
5949
5950        /**
5951         * @return Returns a reference to <code>this</code> for easy method chaining
5952         */
5953        public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
5954          this.programCode = theProgramCode;
5955          return this;
5956        }
5957
5958        public boolean hasProgramCode() { 
5959          if (this.programCode == null)
5960            return false;
5961          for (CodeableConcept item : this.programCode)
5962            if (!item.isEmpty())
5963              return true;
5964          return false;
5965        }
5966
5967        public CodeableConcept addProgramCode() { //3
5968          CodeableConcept t = new CodeableConcept();
5969          if (this.programCode == null)
5970            this.programCode = new ArrayList<CodeableConcept>();
5971          this.programCode.add(t);
5972          return t;
5973        }
5974
5975        public DetailComponent addProgramCode(CodeableConcept t) { //3
5976          if (t == null)
5977            return this;
5978          if (this.programCode == null)
5979            this.programCode = new ArrayList<CodeableConcept>();
5980          this.programCode.add(t);
5981          return this;
5982        }
5983
5984        /**
5985         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
5986         */
5987        public CodeableConcept getProgramCodeFirstRep() { 
5988          if (getProgramCode().isEmpty()) {
5989            addProgramCode();
5990          }
5991          return getProgramCode().get(0);
5992        }
5993
5994        /**
5995         * @return {@link #quantity} (The number of repetitions of a service or product.)
5996         */
5997        public Quantity getQuantity() { 
5998          if (this.quantity == null)
5999            if (Configuration.errorOnAutoCreate())
6000              throw new Error("Attempt to auto-create DetailComponent.quantity");
6001            else if (Configuration.doAutoCreate())
6002              this.quantity = new Quantity(); // cc
6003          return this.quantity;
6004        }
6005
6006        public boolean hasQuantity() { 
6007          return this.quantity != null && !this.quantity.isEmpty();
6008        }
6009
6010        /**
6011         * @param value {@link #quantity} (The number of repetitions of a service or product.)
6012         */
6013        public DetailComponent setQuantity(Quantity value) { 
6014          this.quantity = value;
6015          return this;
6016        }
6017
6018        /**
6019         * @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.)
6020         */
6021        public Money getUnitPrice() { 
6022          if (this.unitPrice == null)
6023            if (Configuration.errorOnAutoCreate())
6024              throw new Error("Attempt to auto-create DetailComponent.unitPrice");
6025            else if (Configuration.doAutoCreate())
6026              this.unitPrice = new Money(); // cc
6027          return this.unitPrice;
6028        }
6029
6030        public boolean hasUnitPrice() { 
6031          return this.unitPrice != null && !this.unitPrice.isEmpty();
6032        }
6033
6034        /**
6035         * @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.)
6036         */
6037        public DetailComponent setUnitPrice(Money value) { 
6038          this.unitPrice = value;
6039          return this;
6040        }
6041
6042        /**
6043         * @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
6044         */
6045        public DecimalType getFactorElement() { 
6046          if (this.factor == null)
6047            if (Configuration.errorOnAutoCreate())
6048              throw new Error("Attempt to auto-create DetailComponent.factor");
6049            else if (Configuration.doAutoCreate())
6050              this.factor = new DecimalType(); // bb
6051          return this.factor;
6052        }
6053
6054        public boolean hasFactorElement() { 
6055          return this.factor != null && !this.factor.isEmpty();
6056        }
6057
6058        public boolean hasFactor() { 
6059          return this.factor != null && !this.factor.isEmpty();
6060        }
6061
6062        /**
6063         * @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
6064         */
6065        public DetailComponent setFactorElement(DecimalType value) { 
6066          this.factor = value;
6067          return this;
6068        }
6069
6070        /**
6071         * @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.
6072         */
6073        public BigDecimal getFactor() { 
6074          return this.factor == null ? null : this.factor.getValue();
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(BigDecimal value) { 
6081          if (value == null)
6082            this.factor = null;
6083          else {
6084            if (this.factor == null)
6085              this.factor = new DecimalType();
6086            this.factor.setValue(value);
6087          }
6088          return this;
6089        }
6090
6091        /**
6092         * @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.
6093         */
6094        public DetailComponent setFactor(long value) { 
6095              this.factor = new DecimalType();
6096            this.factor.setValue(value);
6097          return this;
6098        }
6099
6100        /**
6101         * @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.
6102         */
6103        public DetailComponent setFactor(double value) { 
6104              this.factor = new DecimalType();
6105            this.factor.setValue(value);
6106          return this;
6107        }
6108
6109        /**
6110         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
6111         */
6112        public Money getNet() { 
6113          if (this.net == null)
6114            if (Configuration.errorOnAutoCreate())
6115              throw new Error("Attempt to auto-create DetailComponent.net");
6116            else if (Configuration.doAutoCreate())
6117              this.net = new Money(); // cc
6118          return this.net;
6119        }
6120
6121        public boolean hasNet() { 
6122          return this.net != null && !this.net.isEmpty();
6123        }
6124
6125        /**
6126         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
6127         */
6128        public DetailComponent setNet(Money value) { 
6129          this.net = value;
6130          return this;
6131        }
6132
6133        /**
6134         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
6135         */
6136        public List<Reference> getUdi() { 
6137          if (this.udi == null)
6138            this.udi = new ArrayList<Reference>();
6139          return this.udi;
6140        }
6141
6142        /**
6143         * @return Returns a reference to <code>this</code> for easy method chaining
6144         */
6145        public DetailComponent setUdi(List<Reference> theUdi) { 
6146          this.udi = theUdi;
6147          return this;
6148        }
6149
6150        public boolean hasUdi() { 
6151          if (this.udi == null)
6152            return false;
6153          for (Reference item : this.udi)
6154            if (!item.isEmpty())
6155              return true;
6156          return false;
6157        }
6158
6159        public Reference addUdi() { //3
6160          Reference t = new Reference();
6161          if (this.udi == null)
6162            this.udi = new ArrayList<Reference>();
6163          this.udi.add(t);
6164          return t;
6165        }
6166
6167        public DetailComponent addUdi(Reference t) { //3
6168          if (t == null)
6169            return this;
6170          if (this.udi == null)
6171            this.udi = new ArrayList<Reference>();
6172          this.udi.add(t);
6173          return this;
6174        }
6175
6176        /**
6177         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
6178         */
6179        public Reference getUdiFirstRep() { 
6180          if (getUdi().isEmpty()) {
6181            addUdi();
6182          }
6183          return getUdi().get(0);
6184        }
6185
6186        /**
6187         * @deprecated Use Reference#setResource(IBaseResource) instead
6188         */
6189        @Deprecated
6190        public List<Device> getUdiTarget() { 
6191          if (this.udiTarget == null)
6192            this.udiTarget = new ArrayList<Device>();
6193          return this.udiTarget;
6194        }
6195
6196        /**
6197         * @deprecated Use Reference#setResource(IBaseResource) instead
6198         */
6199        @Deprecated
6200        public Device addUdiTarget() { 
6201          Device r = new Device();
6202          if (this.udiTarget == null)
6203            this.udiTarget = new ArrayList<Device>();
6204          this.udiTarget.add(r);
6205          return r;
6206        }
6207
6208        /**
6209         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6210         */
6211        public List<PositiveIntType> getNoteNumber() { 
6212          if (this.noteNumber == null)
6213            this.noteNumber = new ArrayList<PositiveIntType>();
6214          return this.noteNumber;
6215        }
6216
6217        /**
6218         * @return Returns a reference to <code>this</code> for easy method chaining
6219         */
6220        public DetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
6221          this.noteNumber = theNoteNumber;
6222          return this;
6223        }
6224
6225        public boolean hasNoteNumber() { 
6226          if (this.noteNumber == null)
6227            return false;
6228          for (PositiveIntType item : this.noteNumber)
6229            if (!item.isEmpty())
6230              return true;
6231          return false;
6232        }
6233
6234        /**
6235         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6236         */
6237        public PositiveIntType addNoteNumberElement() {//2 
6238          PositiveIntType t = new PositiveIntType();
6239          if (this.noteNumber == null)
6240            this.noteNumber = new ArrayList<PositiveIntType>();
6241          this.noteNumber.add(t);
6242          return t;
6243        }
6244
6245        /**
6246         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6247         */
6248        public DetailComponent addNoteNumber(int value) { //1
6249          PositiveIntType t = new PositiveIntType();
6250          t.setValue(value);
6251          if (this.noteNumber == null)
6252            this.noteNumber = new ArrayList<PositiveIntType>();
6253          this.noteNumber.add(t);
6254          return this;
6255        }
6256
6257        /**
6258         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6259         */
6260        public boolean hasNoteNumber(int value) { 
6261          if (this.noteNumber == null)
6262            return false;
6263          for (PositiveIntType v : this.noteNumber)
6264            if (v.getValue().equals(value)) // positiveInt
6265              return true;
6266          return false;
6267        }
6268
6269        /**
6270         * @return {@link #adjudication} (The adjudication results.)
6271         */
6272        public List<AdjudicationComponent> getAdjudication() { 
6273          if (this.adjudication == null)
6274            this.adjudication = new ArrayList<AdjudicationComponent>();
6275          return this.adjudication;
6276        }
6277
6278        /**
6279         * @return Returns a reference to <code>this</code> for easy method chaining
6280         */
6281        public DetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
6282          this.adjudication = theAdjudication;
6283          return this;
6284        }
6285
6286        public boolean hasAdjudication() { 
6287          if (this.adjudication == null)
6288            return false;
6289          for (AdjudicationComponent item : this.adjudication)
6290            if (!item.isEmpty())
6291              return true;
6292          return false;
6293        }
6294
6295        public AdjudicationComponent addAdjudication() { //3
6296          AdjudicationComponent t = new AdjudicationComponent();
6297          if (this.adjudication == null)
6298            this.adjudication = new ArrayList<AdjudicationComponent>();
6299          this.adjudication.add(t);
6300          return t;
6301        }
6302
6303        public DetailComponent addAdjudication(AdjudicationComponent t) { //3
6304          if (t == null)
6305            return this;
6306          if (this.adjudication == null)
6307            this.adjudication = new ArrayList<AdjudicationComponent>();
6308          this.adjudication.add(t);
6309          return this;
6310        }
6311
6312        /**
6313         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
6314         */
6315        public AdjudicationComponent getAdjudicationFirstRep() { 
6316          if (getAdjudication().isEmpty()) {
6317            addAdjudication();
6318          }
6319          return getAdjudication().get(0);
6320        }
6321
6322        /**
6323         * @return {@link #subDetail} (Third-tier of goods and services.)
6324         */
6325        public List<SubDetailComponent> getSubDetail() { 
6326          if (this.subDetail == null)
6327            this.subDetail = new ArrayList<SubDetailComponent>();
6328          return this.subDetail;
6329        }
6330
6331        /**
6332         * @return Returns a reference to <code>this</code> for easy method chaining
6333         */
6334        public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) { 
6335          this.subDetail = theSubDetail;
6336          return this;
6337        }
6338
6339        public boolean hasSubDetail() { 
6340          if (this.subDetail == null)
6341            return false;
6342          for (SubDetailComponent item : this.subDetail)
6343            if (!item.isEmpty())
6344              return true;
6345          return false;
6346        }
6347
6348        public SubDetailComponent addSubDetail() { //3
6349          SubDetailComponent t = new SubDetailComponent();
6350          if (this.subDetail == null)
6351            this.subDetail = new ArrayList<SubDetailComponent>();
6352          this.subDetail.add(t);
6353          return t;
6354        }
6355
6356        public DetailComponent addSubDetail(SubDetailComponent t) { //3
6357          if (t == null)
6358            return this;
6359          if (this.subDetail == null)
6360            this.subDetail = new ArrayList<SubDetailComponent>();
6361          this.subDetail.add(t);
6362          return this;
6363        }
6364
6365        /**
6366         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist
6367         */
6368        public SubDetailComponent getSubDetailFirstRep() { 
6369          if (getSubDetail().isEmpty()) {
6370            addSubDetail();
6371          }
6372          return getSubDetail().get(0);
6373        }
6374
6375        protected void listChildren(List<Property> children) {
6376          super.listChildren(children);
6377          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));
6378          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
6379          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
6380          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));
6381          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));
6382          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
6383          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
6384          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));
6385          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));
6386          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
6387          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
6388          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));
6389          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6390          children.add(new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
6391        }
6392
6393        @Override
6394        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6395          switch (_hash) {
6396          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);
6397          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
6398          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);
6399          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);
6400          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);
6401          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
6402          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
6403          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);
6404          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);
6405          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);
6406          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
6407          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);
6408          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
6409          case -828829007: /*subDetail*/  return new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
6410          default: return super.getNamedProperty(_hash, _name, _checkValid);
6411          }
6412
6413        }
6414
6415      @Override
6416      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6417        switch (hash) {
6418        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
6419        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
6420        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
6421        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
6422        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
6423        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
6424        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
6425        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6426        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6427        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6428        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
6429        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
6430        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
6431        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
6432        default: return super.getProperty(hash, name, checkValid);
6433        }
6434
6435      }
6436
6437      @Override
6438      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6439        switch (hash) {
6440        case 1349547969: // sequence
6441          this.sequence = castToPositiveInt(value); // PositiveIntType
6442          return value;
6443        case 1099842588: // revenue
6444          this.revenue = castToCodeableConcept(value); // CodeableConcept
6445          return value;
6446        case 50511102: // category
6447          this.category = castToCodeableConcept(value); // CodeableConcept
6448          return value;
6449        case 1957227299: // productOrService
6450          this.productOrService = castToCodeableConcept(value); // CodeableConcept
6451          return value;
6452        case -615513385: // modifier
6453          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
6454          return value;
6455        case 1010065041: // programCode
6456          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
6457          return value;
6458        case -1285004149: // quantity
6459          this.quantity = castToQuantity(value); // Quantity
6460          return value;
6461        case -486196699: // unitPrice
6462          this.unitPrice = castToMoney(value); // Money
6463          return value;
6464        case -1282148017: // factor
6465          this.factor = castToDecimal(value); // DecimalType
6466          return value;
6467        case 108957: // net
6468          this.net = castToMoney(value); // Money
6469          return value;
6470        case 115642: // udi
6471          this.getUdi().add(castToReference(value)); // Reference
6472          return value;
6473        case -1110033957: // noteNumber
6474          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
6475          return value;
6476        case -231349275: // adjudication
6477          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
6478          return value;
6479        case -828829007: // subDetail
6480          this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
6481          return value;
6482        default: return super.setProperty(hash, name, value);
6483        }
6484
6485      }
6486
6487      @Override
6488      public Base setProperty(String name, Base value) throws FHIRException {
6489        if (name.equals("sequence")) {
6490          this.sequence = castToPositiveInt(value); // PositiveIntType
6491        } else if (name.equals("revenue")) {
6492          this.revenue = castToCodeableConcept(value); // CodeableConcept
6493        } else if (name.equals("category")) {
6494          this.category = castToCodeableConcept(value); // CodeableConcept
6495        } else if (name.equals("productOrService")) {
6496          this.productOrService = castToCodeableConcept(value); // CodeableConcept
6497        } else if (name.equals("modifier")) {
6498          this.getModifier().add(castToCodeableConcept(value));
6499        } else if (name.equals("programCode")) {
6500          this.getProgramCode().add(castToCodeableConcept(value));
6501        } else if (name.equals("quantity")) {
6502          this.quantity = castToQuantity(value); // Quantity
6503        } else if (name.equals("unitPrice")) {
6504          this.unitPrice = castToMoney(value); // Money
6505        } else if (name.equals("factor")) {
6506          this.factor = castToDecimal(value); // DecimalType
6507        } else if (name.equals("net")) {
6508          this.net = castToMoney(value); // Money
6509        } else if (name.equals("udi")) {
6510          this.getUdi().add(castToReference(value));
6511        } else if (name.equals("noteNumber")) {
6512          this.getNoteNumber().add(castToPositiveInt(value));
6513        } else if (name.equals("adjudication")) {
6514          this.getAdjudication().add((AdjudicationComponent) value);
6515        } else if (name.equals("subDetail")) {
6516          this.getSubDetail().add((SubDetailComponent) value);
6517        } else
6518          return super.setProperty(name, value);
6519        return value;
6520      }
6521
6522      @Override
6523      public Base makeProperty(int hash, String name) throws FHIRException {
6524        switch (hash) {
6525        case 1349547969:  return getSequenceElement();
6526        case 1099842588:  return getRevenue(); 
6527        case 50511102:  return getCategory(); 
6528        case 1957227299:  return getProductOrService(); 
6529        case -615513385:  return addModifier(); 
6530        case 1010065041:  return addProgramCode(); 
6531        case -1285004149:  return getQuantity(); 
6532        case -486196699:  return getUnitPrice(); 
6533        case -1282148017:  return getFactorElement();
6534        case 108957:  return getNet(); 
6535        case 115642:  return addUdi(); 
6536        case -1110033957:  return addNoteNumberElement();
6537        case -231349275:  return addAdjudication(); 
6538        case -828829007:  return addSubDetail(); 
6539        default: return super.makeProperty(hash, name);
6540        }
6541
6542      }
6543
6544      @Override
6545      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6546        switch (hash) {
6547        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
6548        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
6549        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
6550        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
6551        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
6552        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
6553        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
6554        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6555        case -1282148017: /*factor*/ return new String[] {"decimal"};
6556        case 108957: /*net*/ return new String[] {"Money"};
6557        case 115642: /*udi*/ return new String[] {"Reference"};
6558        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
6559        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
6560        case -828829007: /*subDetail*/ return new String[] {};
6561        default: return super.getTypesForProperty(hash, name);
6562        }
6563
6564      }
6565
6566      @Override
6567      public Base addChild(String name) throws FHIRException {
6568        if (name.equals("sequence")) {
6569          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
6570        }
6571        else if (name.equals("revenue")) {
6572          this.revenue = new CodeableConcept();
6573          return this.revenue;
6574        }
6575        else if (name.equals("category")) {
6576          this.category = new CodeableConcept();
6577          return this.category;
6578        }
6579        else if (name.equals("productOrService")) {
6580          this.productOrService = new CodeableConcept();
6581          return this.productOrService;
6582        }
6583        else if (name.equals("modifier")) {
6584          return addModifier();
6585        }
6586        else if (name.equals("programCode")) {
6587          return addProgramCode();
6588        }
6589        else if (name.equals("quantity")) {
6590          this.quantity = new Quantity();
6591          return this.quantity;
6592        }
6593        else if (name.equals("unitPrice")) {
6594          this.unitPrice = new Money();
6595          return this.unitPrice;
6596        }
6597        else if (name.equals("factor")) {
6598          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
6599        }
6600        else if (name.equals("net")) {
6601          this.net = new Money();
6602          return this.net;
6603        }
6604        else if (name.equals("udi")) {
6605          return addUdi();
6606        }
6607        else if (name.equals("noteNumber")) {
6608          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
6609        }
6610        else if (name.equals("adjudication")) {
6611          return addAdjudication();
6612        }
6613        else if (name.equals("subDetail")) {
6614          return addSubDetail();
6615        }
6616        else
6617          return super.addChild(name);
6618      }
6619
6620      public DetailComponent copy() {
6621        DetailComponent dst = new DetailComponent();
6622        copyValues(dst);
6623        dst.sequence = sequence == null ? null : sequence.copy();
6624        dst.revenue = revenue == null ? null : revenue.copy();
6625        dst.category = category == null ? null : category.copy();
6626        dst.productOrService = productOrService == null ? null : productOrService.copy();
6627        if (modifier != null) {
6628          dst.modifier = new ArrayList<CodeableConcept>();
6629          for (CodeableConcept i : modifier)
6630            dst.modifier.add(i.copy());
6631        };
6632        if (programCode != null) {
6633          dst.programCode = new ArrayList<CodeableConcept>();
6634          for (CodeableConcept i : programCode)
6635            dst.programCode.add(i.copy());
6636        };
6637        dst.quantity = quantity == null ? null : quantity.copy();
6638        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6639        dst.factor = factor == null ? null : factor.copy();
6640        dst.net = net == null ? null : net.copy();
6641        if (udi != null) {
6642          dst.udi = new ArrayList<Reference>();
6643          for (Reference i : udi)
6644            dst.udi.add(i.copy());
6645        };
6646        if (noteNumber != null) {
6647          dst.noteNumber = new ArrayList<PositiveIntType>();
6648          for (PositiveIntType i : noteNumber)
6649            dst.noteNumber.add(i.copy());
6650        };
6651        if (adjudication != null) {
6652          dst.adjudication = new ArrayList<AdjudicationComponent>();
6653          for (AdjudicationComponent i : adjudication)
6654            dst.adjudication.add(i.copy());
6655        };
6656        if (subDetail != null) {
6657          dst.subDetail = new ArrayList<SubDetailComponent>();
6658          for (SubDetailComponent i : subDetail)
6659            dst.subDetail.add(i.copy());
6660        };
6661        return dst;
6662      }
6663
6664      @Override
6665      public boolean equalsDeep(Base other_) {
6666        if (!super.equalsDeep(other_))
6667          return false;
6668        if (!(other_ instanceof DetailComponent))
6669          return false;
6670        DetailComponent o = (DetailComponent) other_;
6671        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
6672           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
6673           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
6674           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
6675           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
6676           && compareDeep(subDetail, o.subDetail, true);
6677      }
6678
6679      @Override
6680      public boolean equalsShallow(Base other_) {
6681        if (!super.equalsShallow(other_))
6682          return false;
6683        if (!(other_ instanceof DetailComponent))
6684          return false;
6685        DetailComponent o = (DetailComponent) other_;
6686        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
6687          ;
6688      }
6689
6690      public boolean isEmpty() {
6691        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
6692          , productOrService, modifier, programCode, quantity, unitPrice, factor, net, udi
6693          , noteNumber, adjudication, subDetail);
6694      }
6695
6696  public String fhirType() {
6697    return "ExplanationOfBenefit.item.detail";
6698
6699  }
6700
6701  }
6702
6703    @Block()
6704    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
6705        /**
6706         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6707         */
6708        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
6709        @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." )
6710        protected PositiveIntType sequence;
6711
6712        /**
6713         * The type of revenue or cost center providing the product and/or service.
6714         */
6715        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
6716        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
6717        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
6718        protected CodeableConcept revenue;
6719
6720        /**
6721         * Code to identify the general type of benefits under which products and services are provided.
6722         */
6723        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
6724        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
6725        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
6726        protected CodeableConcept category;
6727
6728        /**
6729         * 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.
6730         */
6731        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
6732        @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." )
6733        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
6734        protected CodeableConcept productOrService;
6735
6736        /**
6737         * Item typification or modifiers codes to convey additional context for the product or service.
6738         */
6739        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6740        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
6741        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
6742        protected List<CodeableConcept> modifier;
6743
6744        /**
6745         * Identifies the program under which this may be recovered.
6746         */
6747        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6748        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
6749        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
6750        protected List<CodeableConcept> programCode;
6751
6752        /**
6753         * The number of repetitions of a service or product.
6754         */
6755        @Child(name = "quantity", type = {Quantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
6756        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
6757        protected Quantity quantity;
6758
6759        /**
6760         * 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.
6761         */
6762        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
6763        @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." )
6764        protected Money unitPrice;
6765
6766        /**
6767         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
6768         */
6769        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
6770        @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." )
6771        protected DecimalType factor;
6772
6773        /**
6774         * The quantity times the unit price for an additional service or product or charge.
6775         */
6776        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
6777        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
6778        protected Money net;
6779
6780        /**
6781         * Unique Device Identifiers associated with this line item.
6782         */
6783        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6784        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
6785        protected List<Reference> udi;
6786        /**
6787         * The actual objects that are the target of the reference (Unique Device Identifiers associated with this line item.)
6788         */
6789        protected List<Device> udiTarget;
6790
6791
6792        /**
6793         * The numbers associated with notes below which apply to the adjudication of this item.
6794         */
6795        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6796        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
6797        protected List<PositiveIntType> noteNumber;
6798
6799        /**
6800         * The adjudication results.
6801         */
6802        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6803        @Description(shortDefinition="Subdetail level adjudication details", formalDefinition="The adjudication results." )
6804        protected List<AdjudicationComponent> adjudication;
6805
6806        private static final long serialVersionUID = -996156853L;
6807
6808    /**
6809     * Constructor
6810     */
6811      public SubDetailComponent() {
6812        super();
6813      }
6814
6815    /**
6816     * Constructor
6817     */
6818      public SubDetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
6819        super();
6820        this.sequence = sequence;
6821        this.productOrService = productOrService;
6822      }
6823
6824        /**
6825         * @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
6826         */
6827        public PositiveIntType getSequenceElement() { 
6828          if (this.sequence == null)
6829            if (Configuration.errorOnAutoCreate())
6830              throw new Error("Attempt to auto-create SubDetailComponent.sequence");
6831            else if (Configuration.doAutoCreate())
6832              this.sequence = new PositiveIntType(); // bb
6833          return this.sequence;
6834        }
6835
6836        public boolean hasSequenceElement() { 
6837          return this.sequence != null && !this.sequence.isEmpty();
6838        }
6839
6840        public boolean hasSequence() { 
6841          return this.sequence != null && !this.sequence.isEmpty();
6842        }
6843
6844        /**
6845         * @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
6846         */
6847        public SubDetailComponent setSequenceElement(PositiveIntType value) { 
6848          this.sequence = value;
6849          return this;
6850        }
6851
6852        /**
6853         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6854         */
6855        public int getSequence() { 
6856          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
6857        }
6858
6859        /**
6860         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6861         */
6862        public SubDetailComponent setSequence(int value) { 
6863            if (this.sequence == null)
6864              this.sequence = new PositiveIntType();
6865            this.sequence.setValue(value);
6866          return this;
6867        }
6868
6869        /**
6870         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
6871         */
6872        public CodeableConcept getRevenue() { 
6873          if (this.revenue == null)
6874            if (Configuration.errorOnAutoCreate())
6875              throw new Error("Attempt to auto-create SubDetailComponent.revenue");
6876            else if (Configuration.doAutoCreate())
6877              this.revenue = new CodeableConcept(); // cc
6878          return this.revenue;
6879        }
6880
6881        public boolean hasRevenue() { 
6882          return this.revenue != null && !this.revenue.isEmpty();
6883        }
6884
6885        /**
6886         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
6887         */
6888        public SubDetailComponent setRevenue(CodeableConcept value) { 
6889          this.revenue = value;
6890          return this;
6891        }
6892
6893        /**
6894         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
6895         */
6896        public CodeableConcept getCategory() { 
6897          if (this.category == null)
6898            if (Configuration.errorOnAutoCreate())
6899              throw new Error("Attempt to auto-create SubDetailComponent.category");
6900            else if (Configuration.doAutoCreate())
6901              this.category = new CodeableConcept(); // cc
6902          return this.category;
6903        }
6904
6905        public boolean hasCategory() { 
6906          return this.category != null && !this.category.isEmpty();
6907        }
6908
6909        /**
6910         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
6911         */
6912        public SubDetailComponent setCategory(CodeableConcept value) { 
6913          this.category = value;
6914          return this;
6915        }
6916
6917        /**
6918         * @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.)
6919         */
6920        public CodeableConcept getProductOrService() { 
6921          if (this.productOrService == null)
6922            if (Configuration.errorOnAutoCreate())
6923              throw new Error("Attempt to auto-create SubDetailComponent.productOrService");
6924            else if (Configuration.doAutoCreate())
6925              this.productOrService = new CodeableConcept(); // cc
6926          return this.productOrService;
6927        }
6928
6929        public boolean hasProductOrService() { 
6930          return this.productOrService != null && !this.productOrService.isEmpty();
6931        }
6932
6933        /**
6934         * @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.)
6935         */
6936        public SubDetailComponent setProductOrService(CodeableConcept value) { 
6937          this.productOrService = value;
6938          return this;
6939        }
6940
6941        /**
6942         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
6943         */
6944        public List<CodeableConcept> getModifier() { 
6945          if (this.modifier == null)
6946            this.modifier = new ArrayList<CodeableConcept>();
6947          return this.modifier;
6948        }
6949
6950        /**
6951         * @return Returns a reference to <code>this</code> for easy method chaining
6952         */
6953        public SubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
6954          this.modifier = theModifier;
6955          return this;
6956        }
6957
6958        public boolean hasModifier() { 
6959          if (this.modifier == null)
6960            return false;
6961          for (CodeableConcept item : this.modifier)
6962            if (!item.isEmpty())
6963              return true;
6964          return false;
6965        }
6966
6967        public CodeableConcept addModifier() { //3
6968          CodeableConcept t = new CodeableConcept();
6969          if (this.modifier == null)
6970            this.modifier = new ArrayList<CodeableConcept>();
6971          this.modifier.add(t);
6972          return t;
6973        }
6974
6975        public SubDetailComponent addModifier(CodeableConcept t) { //3
6976          if (t == null)
6977            return this;
6978          if (this.modifier == null)
6979            this.modifier = new ArrayList<CodeableConcept>();
6980          this.modifier.add(t);
6981          return this;
6982        }
6983
6984        /**
6985         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
6986         */
6987        public CodeableConcept getModifierFirstRep() { 
6988          if (getModifier().isEmpty()) {
6989            addModifier();
6990          }
6991          return getModifier().get(0);
6992        }
6993
6994        /**
6995         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
6996         */
6997        public List<CodeableConcept> getProgramCode() { 
6998          if (this.programCode == null)
6999            this.programCode = new ArrayList<CodeableConcept>();
7000          return this.programCode;
7001        }
7002
7003        /**
7004         * @return Returns a reference to <code>this</code> for easy method chaining
7005         */
7006        public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
7007          this.programCode = theProgramCode;
7008          return this;
7009        }
7010
7011        public boolean hasProgramCode() { 
7012          if (this.programCode == null)
7013            return false;
7014          for (CodeableConcept item : this.programCode)
7015            if (!item.isEmpty())
7016              return true;
7017          return false;
7018        }
7019
7020        public CodeableConcept addProgramCode() { //3
7021          CodeableConcept t = new CodeableConcept();
7022          if (this.programCode == null)
7023            this.programCode = new ArrayList<CodeableConcept>();
7024          this.programCode.add(t);
7025          return t;
7026        }
7027
7028        public SubDetailComponent addProgramCode(CodeableConcept t) { //3
7029          if (t == null)
7030            return this;
7031          if (this.programCode == null)
7032            this.programCode = new ArrayList<CodeableConcept>();
7033          this.programCode.add(t);
7034          return this;
7035        }
7036
7037        /**
7038         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
7039         */
7040        public CodeableConcept getProgramCodeFirstRep() { 
7041          if (getProgramCode().isEmpty()) {
7042            addProgramCode();
7043          }
7044          return getProgramCode().get(0);
7045        }
7046
7047        /**
7048         * @return {@link #quantity} (The number of repetitions of a service or product.)
7049         */
7050        public Quantity getQuantity() { 
7051          if (this.quantity == null)
7052            if (Configuration.errorOnAutoCreate())
7053              throw new Error("Attempt to auto-create SubDetailComponent.quantity");
7054            else if (Configuration.doAutoCreate())
7055              this.quantity = new Quantity(); // cc
7056          return this.quantity;
7057        }
7058
7059        public boolean hasQuantity() { 
7060          return this.quantity != null && !this.quantity.isEmpty();
7061        }
7062
7063        /**
7064         * @param value {@link #quantity} (The number of repetitions of a service or product.)
7065         */
7066        public SubDetailComponent setQuantity(Quantity value) { 
7067          this.quantity = value;
7068          return this;
7069        }
7070
7071        /**
7072         * @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.)
7073         */
7074        public Money getUnitPrice() { 
7075          if (this.unitPrice == null)
7076            if (Configuration.errorOnAutoCreate())
7077              throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
7078            else if (Configuration.doAutoCreate())
7079              this.unitPrice = new Money(); // cc
7080          return this.unitPrice;
7081        }
7082
7083        public boolean hasUnitPrice() { 
7084          return this.unitPrice != null && !this.unitPrice.isEmpty();
7085        }
7086
7087        /**
7088         * @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.)
7089         */
7090        public SubDetailComponent setUnitPrice(Money value) { 
7091          this.unitPrice = value;
7092          return this;
7093        }
7094
7095        /**
7096         * @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
7097         */
7098        public DecimalType getFactorElement() { 
7099          if (this.factor == null)
7100            if (Configuration.errorOnAutoCreate())
7101              throw new Error("Attempt to auto-create SubDetailComponent.factor");
7102            else if (Configuration.doAutoCreate())
7103              this.factor = new DecimalType(); // bb
7104          return this.factor;
7105        }
7106
7107        public boolean hasFactorElement() { 
7108          return this.factor != null && !this.factor.isEmpty();
7109        }
7110
7111        public boolean hasFactor() { 
7112          return this.factor != null && !this.factor.isEmpty();
7113        }
7114
7115        /**
7116         * @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
7117         */
7118        public SubDetailComponent setFactorElement(DecimalType value) { 
7119          this.factor = value;
7120          return this;
7121        }
7122
7123        /**
7124         * @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.
7125         */
7126        public BigDecimal getFactor() { 
7127          return this.factor == null ? null : this.factor.getValue();
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(BigDecimal value) { 
7134          if (value == null)
7135            this.factor = null;
7136          else {
7137            if (this.factor == null)
7138              this.factor = new DecimalType();
7139            this.factor.setValue(value);
7140          }
7141          return this;
7142        }
7143
7144        /**
7145         * @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.
7146         */
7147        public SubDetailComponent setFactor(long value) { 
7148              this.factor = new DecimalType();
7149            this.factor.setValue(value);
7150          return this;
7151        }
7152
7153        /**
7154         * @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.
7155         */
7156        public SubDetailComponent setFactor(double value) { 
7157              this.factor = new DecimalType();
7158            this.factor.setValue(value);
7159          return this;
7160        }
7161
7162        /**
7163         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
7164         */
7165        public Money getNet() { 
7166          if (this.net == null)
7167            if (Configuration.errorOnAutoCreate())
7168              throw new Error("Attempt to auto-create SubDetailComponent.net");
7169            else if (Configuration.doAutoCreate())
7170              this.net = new Money(); // cc
7171          return this.net;
7172        }
7173
7174        public boolean hasNet() { 
7175          return this.net != null && !this.net.isEmpty();
7176        }
7177
7178        /**
7179         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
7180         */
7181        public SubDetailComponent setNet(Money value) { 
7182          this.net = value;
7183          return this;
7184        }
7185
7186        /**
7187         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
7188         */
7189        public List<Reference> getUdi() { 
7190          if (this.udi == null)
7191            this.udi = new ArrayList<Reference>();
7192          return this.udi;
7193        }
7194
7195        /**
7196         * @return Returns a reference to <code>this</code> for easy method chaining
7197         */
7198        public SubDetailComponent setUdi(List<Reference> theUdi) { 
7199          this.udi = theUdi;
7200          return this;
7201        }
7202
7203        public boolean hasUdi() { 
7204          if (this.udi == null)
7205            return false;
7206          for (Reference item : this.udi)
7207            if (!item.isEmpty())
7208              return true;
7209          return false;
7210        }
7211
7212        public Reference addUdi() { //3
7213          Reference t = new Reference();
7214          if (this.udi == null)
7215            this.udi = new ArrayList<Reference>();
7216          this.udi.add(t);
7217          return t;
7218        }
7219
7220        public SubDetailComponent addUdi(Reference t) { //3
7221          if (t == null)
7222            return this;
7223          if (this.udi == null)
7224            this.udi = new ArrayList<Reference>();
7225          this.udi.add(t);
7226          return this;
7227        }
7228
7229        /**
7230         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
7231         */
7232        public Reference getUdiFirstRep() { 
7233          if (getUdi().isEmpty()) {
7234            addUdi();
7235          }
7236          return getUdi().get(0);
7237        }
7238
7239        /**
7240         * @deprecated Use Reference#setResource(IBaseResource) instead
7241         */
7242        @Deprecated
7243        public List<Device> getUdiTarget() { 
7244          if (this.udiTarget == null)
7245            this.udiTarget = new ArrayList<Device>();
7246          return this.udiTarget;
7247        }
7248
7249        /**
7250         * @deprecated Use Reference#setResource(IBaseResource) instead
7251         */
7252        @Deprecated
7253        public Device addUdiTarget() { 
7254          Device r = new Device();
7255          if (this.udiTarget == null)
7256            this.udiTarget = new ArrayList<Device>();
7257          this.udiTarget.add(r);
7258          return r;
7259        }
7260
7261        /**
7262         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7263         */
7264        public List<PositiveIntType> getNoteNumber() { 
7265          if (this.noteNumber == null)
7266            this.noteNumber = new ArrayList<PositiveIntType>();
7267          return this.noteNumber;
7268        }
7269
7270        /**
7271         * @return Returns a reference to <code>this</code> for easy method chaining
7272         */
7273        public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
7274          this.noteNumber = theNoteNumber;
7275          return this;
7276        }
7277
7278        public boolean hasNoteNumber() { 
7279          if (this.noteNumber == null)
7280            return false;
7281          for (PositiveIntType item : this.noteNumber)
7282            if (!item.isEmpty())
7283              return true;
7284          return false;
7285        }
7286
7287        /**
7288         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7289         */
7290        public PositiveIntType addNoteNumberElement() {//2 
7291          PositiveIntType t = new PositiveIntType();
7292          if (this.noteNumber == null)
7293            this.noteNumber = new ArrayList<PositiveIntType>();
7294          this.noteNumber.add(t);
7295          return t;
7296        }
7297
7298        /**
7299         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7300         */
7301        public SubDetailComponent addNoteNumber(int value) { //1
7302          PositiveIntType t = new PositiveIntType();
7303          t.setValue(value);
7304          if (this.noteNumber == null)
7305            this.noteNumber = new ArrayList<PositiveIntType>();
7306          this.noteNumber.add(t);
7307          return this;
7308        }
7309
7310        /**
7311         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7312         */
7313        public boolean hasNoteNumber(int value) { 
7314          if (this.noteNumber == null)
7315            return false;
7316          for (PositiveIntType v : this.noteNumber)
7317            if (v.getValue().equals(value)) // positiveInt
7318              return true;
7319          return false;
7320        }
7321
7322        /**
7323         * @return {@link #adjudication} (The adjudication results.)
7324         */
7325        public List<AdjudicationComponent> getAdjudication() { 
7326          if (this.adjudication == null)
7327            this.adjudication = new ArrayList<AdjudicationComponent>();
7328          return this.adjudication;
7329        }
7330
7331        /**
7332         * @return Returns a reference to <code>this</code> for easy method chaining
7333         */
7334        public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
7335          this.adjudication = theAdjudication;
7336          return this;
7337        }
7338
7339        public boolean hasAdjudication() { 
7340          if (this.adjudication == null)
7341            return false;
7342          for (AdjudicationComponent item : this.adjudication)
7343            if (!item.isEmpty())
7344              return true;
7345          return false;
7346        }
7347
7348        public AdjudicationComponent addAdjudication() { //3
7349          AdjudicationComponent t = new AdjudicationComponent();
7350          if (this.adjudication == null)
7351            this.adjudication = new ArrayList<AdjudicationComponent>();
7352          this.adjudication.add(t);
7353          return t;
7354        }
7355
7356        public SubDetailComponent addAdjudication(AdjudicationComponent t) { //3
7357          if (t == null)
7358            return this;
7359          if (this.adjudication == null)
7360            this.adjudication = new ArrayList<AdjudicationComponent>();
7361          this.adjudication.add(t);
7362          return this;
7363        }
7364
7365        /**
7366         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
7367         */
7368        public AdjudicationComponent getAdjudicationFirstRep() { 
7369          if (getAdjudication().isEmpty()) {
7370            addAdjudication();
7371          }
7372          return getAdjudication().get(0);
7373        }
7374
7375        protected void listChildren(List<Property> children) {
7376          super.listChildren(children);
7377          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));
7378          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
7379          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
7380          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));
7381          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));
7382          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
7383          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
7384          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));
7385          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));
7386          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
7387          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
7388          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));
7389          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
7390        }
7391
7392        @Override
7393        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7394          switch (_hash) {
7395          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);
7396          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
7397          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);
7398          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);
7399          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);
7400          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
7401          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
7402          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);
7403          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);
7404          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);
7405          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
7406          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);
7407          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
7408          default: return super.getNamedProperty(_hash, _name, _checkValid);
7409          }
7410
7411        }
7412
7413      @Override
7414      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7415        switch (hash) {
7416        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
7417        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
7418        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
7419        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
7420        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7421        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
7422        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
7423        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
7424        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
7425        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
7426        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
7427        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
7428        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
7429        default: return super.getProperty(hash, name, checkValid);
7430        }
7431
7432      }
7433
7434      @Override
7435      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7436        switch (hash) {
7437        case 1349547969: // sequence
7438          this.sequence = castToPositiveInt(value); // PositiveIntType
7439          return value;
7440        case 1099842588: // revenue
7441          this.revenue = castToCodeableConcept(value); // CodeableConcept
7442          return value;
7443        case 50511102: // category
7444          this.category = castToCodeableConcept(value); // CodeableConcept
7445          return value;
7446        case 1957227299: // productOrService
7447          this.productOrService = castToCodeableConcept(value); // CodeableConcept
7448          return value;
7449        case -615513385: // modifier
7450          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
7451          return value;
7452        case 1010065041: // programCode
7453          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
7454          return value;
7455        case -1285004149: // quantity
7456          this.quantity = castToQuantity(value); // Quantity
7457          return value;
7458        case -486196699: // unitPrice
7459          this.unitPrice = castToMoney(value); // Money
7460          return value;
7461        case -1282148017: // factor
7462          this.factor = castToDecimal(value); // DecimalType
7463          return value;
7464        case 108957: // net
7465          this.net = castToMoney(value); // Money
7466          return value;
7467        case 115642: // udi
7468          this.getUdi().add(castToReference(value)); // Reference
7469          return value;
7470        case -1110033957: // noteNumber
7471          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
7472          return value;
7473        case -231349275: // adjudication
7474          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7475          return value;
7476        default: return super.setProperty(hash, name, value);
7477        }
7478
7479      }
7480
7481      @Override
7482      public Base setProperty(String name, Base value) throws FHIRException {
7483        if (name.equals("sequence")) {
7484          this.sequence = castToPositiveInt(value); // PositiveIntType
7485        } else if (name.equals("revenue")) {
7486          this.revenue = castToCodeableConcept(value); // CodeableConcept
7487        } else if (name.equals("category")) {
7488          this.category = castToCodeableConcept(value); // CodeableConcept
7489        } else if (name.equals("productOrService")) {
7490          this.productOrService = castToCodeableConcept(value); // CodeableConcept
7491        } else if (name.equals("modifier")) {
7492          this.getModifier().add(castToCodeableConcept(value));
7493        } else if (name.equals("programCode")) {
7494          this.getProgramCode().add(castToCodeableConcept(value));
7495        } else if (name.equals("quantity")) {
7496          this.quantity = castToQuantity(value); // Quantity
7497        } else if (name.equals("unitPrice")) {
7498          this.unitPrice = castToMoney(value); // Money
7499        } else if (name.equals("factor")) {
7500          this.factor = castToDecimal(value); // DecimalType
7501        } else if (name.equals("net")) {
7502          this.net = castToMoney(value); // Money
7503        } else if (name.equals("udi")) {
7504          this.getUdi().add(castToReference(value));
7505        } else if (name.equals("noteNumber")) {
7506          this.getNoteNumber().add(castToPositiveInt(value));
7507        } else if (name.equals("adjudication")) {
7508          this.getAdjudication().add((AdjudicationComponent) value);
7509        } else
7510          return super.setProperty(name, value);
7511        return value;
7512      }
7513
7514      @Override
7515      public Base makeProperty(int hash, String name) throws FHIRException {
7516        switch (hash) {
7517        case 1349547969:  return getSequenceElement();
7518        case 1099842588:  return getRevenue(); 
7519        case 50511102:  return getCategory(); 
7520        case 1957227299:  return getProductOrService(); 
7521        case -615513385:  return addModifier(); 
7522        case 1010065041:  return addProgramCode(); 
7523        case -1285004149:  return getQuantity(); 
7524        case -486196699:  return getUnitPrice(); 
7525        case -1282148017:  return getFactorElement();
7526        case 108957:  return getNet(); 
7527        case 115642:  return addUdi(); 
7528        case -1110033957:  return addNoteNumberElement();
7529        case -231349275:  return addAdjudication(); 
7530        default: return super.makeProperty(hash, name);
7531        }
7532
7533      }
7534
7535      @Override
7536      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7537        switch (hash) {
7538        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
7539        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
7540        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
7541        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
7542        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
7543        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
7544        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
7545        case -486196699: /*unitPrice*/ return new String[] {"Money"};
7546        case -1282148017: /*factor*/ return new String[] {"decimal"};
7547        case 108957: /*net*/ return new String[] {"Money"};
7548        case 115642: /*udi*/ return new String[] {"Reference"};
7549        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
7550        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
7551        default: return super.getTypesForProperty(hash, name);
7552        }
7553
7554      }
7555
7556      @Override
7557      public Base addChild(String name) throws FHIRException {
7558        if (name.equals("sequence")) {
7559          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
7560        }
7561        else if (name.equals("revenue")) {
7562          this.revenue = new CodeableConcept();
7563          return this.revenue;
7564        }
7565        else if (name.equals("category")) {
7566          this.category = new CodeableConcept();
7567          return this.category;
7568        }
7569        else if (name.equals("productOrService")) {
7570          this.productOrService = new CodeableConcept();
7571          return this.productOrService;
7572        }
7573        else if (name.equals("modifier")) {
7574          return addModifier();
7575        }
7576        else if (name.equals("programCode")) {
7577          return addProgramCode();
7578        }
7579        else if (name.equals("quantity")) {
7580          this.quantity = new Quantity();
7581          return this.quantity;
7582        }
7583        else if (name.equals("unitPrice")) {
7584          this.unitPrice = new Money();
7585          return this.unitPrice;
7586        }
7587        else if (name.equals("factor")) {
7588          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
7589        }
7590        else if (name.equals("net")) {
7591          this.net = new Money();
7592          return this.net;
7593        }
7594        else if (name.equals("udi")) {
7595          return addUdi();
7596        }
7597        else if (name.equals("noteNumber")) {
7598          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
7599        }
7600        else if (name.equals("adjudication")) {
7601          return addAdjudication();
7602        }
7603        else
7604          return super.addChild(name);
7605      }
7606
7607      public SubDetailComponent copy() {
7608        SubDetailComponent dst = new SubDetailComponent();
7609        copyValues(dst);
7610        dst.sequence = sequence == null ? null : sequence.copy();
7611        dst.revenue = revenue == null ? null : revenue.copy();
7612        dst.category = category == null ? null : category.copy();
7613        dst.productOrService = productOrService == null ? null : productOrService.copy();
7614        if (modifier != null) {
7615          dst.modifier = new ArrayList<CodeableConcept>();
7616          for (CodeableConcept i : modifier)
7617            dst.modifier.add(i.copy());
7618        };
7619        if (programCode != null) {
7620          dst.programCode = new ArrayList<CodeableConcept>();
7621          for (CodeableConcept i : programCode)
7622            dst.programCode.add(i.copy());
7623        };
7624        dst.quantity = quantity == null ? null : quantity.copy();
7625        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7626        dst.factor = factor == null ? null : factor.copy();
7627        dst.net = net == null ? null : net.copy();
7628        if (udi != null) {
7629          dst.udi = new ArrayList<Reference>();
7630          for (Reference i : udi)
7631            dst.udi.add(i.copy());
7632        };
7633        if (noteNumber != null) {
7634          dst.noteNumber = new ArrayList<PositiveIntType>();
7635          for (PositiveIntType i : noteNumber)
7636            dst.noteNumber.add(i.copy());
7637        };
7638        if (adjudication != null) {
7639          dst.adjudication = new ArrayList<AdjudicationComponent>();
7640          for (AdjudicationComponent i : adjudication)
7641            dst.adjudication.add(i.copy());
7642        };
7643        return dst;
7644      }
7645
7646      @Override
7647      public boolean equalsDeep(Base other_) {
7648        if (!super.equalsDeep(other_))
7649          return false;
7650        if (!(other_ instanceof SubDetailComponent))
7651          return false;
7652        SubDetailComponent o = (SubDetailComponent) other_;
7653        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
7654           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
7655           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
7656           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
7657           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
7658          ;
7659      }
7660
7661      @Override
7662      public boolean equalsShallow(Base other_) {
7663        if (!super.equalsShallow(other_))
7664          return false;
7665        if (!(other_ instanceof SubDetailComponent))
7666          return false;
7667        SubDetailComponent o = (SubDetailComponent) other_;
7668        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
7669          ;
7670      }
7671
7672      public boolean isEmpty() {
7673        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
7674          , productOrService, modifier, programCode, quantity, unitPrice, factor, net, udi
7675          , noteNumber, adjudication);
7676      }
7677
7678  public String fhirType() {
7679    return "ExplanationOfBenefit.item.detail.subDetail";
7680
7681  }
7682
7683  }
7684
7685    @Block()
7686    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
7687        /**
7688         * Claim items which this service line is intended to replace.
7689         */
7690        @Child(name = "itemSequence", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7691        @Description(shortDefinition="Item sequence number", formalDefinition="Claim items which this service line is intended to replace." )
7692        protected List<PositiveIntType> itemSequence;
7693
7694        /**
7695         * The sequence number of the details within the claim item which this line is intended to replace.
7696         */
7697        @Child(name = "detailSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7698        @Description(shortDefinition="Detail sequence number", formalDefinition="The sequence number of the details within the claim item which this line is intended to replace." )
7699        protected List<PositiveIntType> detailSequence;
7700
7701        /**
7702         * The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.
7703         */
7704        @Child(name = "subDetailSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7705        @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." )
7706        protected List<PositiveIntType> subDetailSequence;
7707
7708        /**
7709         * The providers who are authorized for the services rendered to the patient.
7710         */
7711        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7712        @Description(shortDefinition="Authorized providers", formalDefinition="The providers who are authorized for the services rendered to the patient." )
7713        protected List<Reference> provider;
7714        /**
7715         * The actual objects that are the target of the reference (The providers who are authorized for the services rendered to the patient.)
7716         */
7717        protected List<Resource> providerTarget;
7718
7719
7720        /**
7721         * 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.
7722         */
7723        @Child(name = "productOrService", type = {CodeableConcept.class}, order=5, min=1, max=1, modifier=false, summary=false)
7724        @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." )
7725        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
7726        protected CodeableConcept productOrService;
7727
7728        /**
7729         * Item typification or modifiers codes to convey additional context for the product or service.
7730         */
7731        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7732        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
7733        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
7734        protected List<CodeableConcept> modifier;
7735
7736        /**
7737         * Identifies the program under which this may be recovered.
7738         */
7739        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7740        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
7741        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
7742        protected List<CodeableConcept> programCode;
7743
7744        /**
7745         * The date or dates when the service or product was supplied, performed or completed.
7746         */
7747        @Child(name = "serviced", type = {DateType.class, Period.class}, order=8, min=0, max=1, modifier=false, summary=false)
7748        @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." )
7749        protected Type serviced;
7750
7751        /**
7752         * Where the product or service was provided.
7753         */
7754        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=9, min=0, max=1, modifier=false, summary=false)
7755        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
7756        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
7757        protected Type location;
7758
7759        /**
7760         * The number of repetitions of a service or product.
7761         */
7762        @Child(name = "quantity", type = {Quantity.class}, order=10, min=0, max=1, modifier=false, summary=false)
7763        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
7764        protected Quantity quantity;
7765
7766        /**
7767         * 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.
7768         */
7769        @Child(name = "unitPrice", type = {Money.class}, order=11, min=0, max=1, modifier=false, summary=false)
7770        @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." )
7771        protected Money unitPrice;
7772
7773        /**
7774         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
7775         */
7776        @Child(name = "factor", type = {DecimalType.class}, order=12, min=0, max=1, modifier=false, summary=false)
7777        @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." )
7778        protected DecimalType factor;
7779
7780        /**
7781         * The quantity times the unit price for an additional service or product or charge.
7782         */
7783        @Child(name = "net", type = {Money.class}, order=13, min=0, max=1, modifier=false, summary=false)
7784        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
7785        protected Money net;
7786
7787        /**
7788         * Physical service site on the patient (limb, tooth, etc.).
7789         */
7790        @Child(name = "bodySite", type = {CodeableConcept.class}, order=14, min=0, max=1, modifier=false, summary=false)
7791        @Description(shortDefinition="Anatomical location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
7792        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
7793        protected CodeableConcept bodySite;
7794
7795        /**
7796         * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
7797         */
7798        @Child(name = "subSite", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7799        @Description(shortDefinition="Anatomical sub-location", formalDefinition="A region or surface of the bodySite, e.g. limb region or tooth surface(s)." )
7800        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
7801        protected List<CodeableConcept> subSite;
7802
7803        /**
7804         * The numbers associated with notes below which apply to the adjudication of this item.
7805         */
7806        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7807        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
7808        protected List<PositiveIntType> noteNumber;
7809
7810        /**
7811         * The adjudication results.
7812         */
7813        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7814        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
7815        protected List<AdjudicationComponent> adjudication;
7816
7817        /**
7818         * The second-tier service adjudications for payor added services.
7819         */
7820        @Child(name = "detail", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7821        @Description(shortDefinition="Insurer added line items", formalDefinition="The second-tier service adjudications for payor added services." )
7822        protected List<AddedItemDetailComponent> detail;
7823
7824        private static final long serialVersionUID = -206524210L;
7825
7826    /**
7827     * Constructor
7828     */
7829      public AddedItemComponent() {
7830        super();
7831      }
7832
7833    /**
7834     * Constructor
7835     */
7836      public AddedItemComponent(CodeableConcept productOrService) {
7837        super();
7838        this.productOrService = productOrService;
7839      }
7840
7841        /**
7842         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
7843         */
7844        public List<PositiveIntType> getItemSequence() { 
7845          if (this.itemSequence == null)
7846            this.itemSequence = new ArrayList<PositiveIntType>();
7847          return this.itemSequence;
7848        }
7849
7850        /**
7851         * @return Returns a reference to <code>this</code> for easy method chaining
7852         */
7853        public AddedItemComponent setItemSequence(List<PositiveIntType> theItemSequence) { 
7854          this.itemSequence = theItemSequence;
7855          return this;
7856        }
7857
7858        public boolean hasItemSequence() { 
7859          if (this.itemSequence == null)
7860            return false;
7861          for (PositiveIntType item : this.itemSequence)
7862            if (!item.isEmpty())
7863              return true;
7864          return false;
7865        }
7866
7867        /**
7868         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
7869         */
7870        public PositiveIntType addItemSequenceElement() {//2 
7871          PositiveIntType t = new PositiveIntType();
7872          if (this.itemSequence == null)
7873            this.itemSequence = new ArrayList<PositiveIntType>();
7874          this.itemSequence.add(t);
7875          return t;
7876        }
7877
7878        /**
7879         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
7880         */
7881        public AddedItemComponent addItemSequence(int value) { //1
7882          PositiveIntType t = new PositiveIntType();
7883          t.setValue(value);
7884          if (this.itemSequence == null)
7885            this.itemSequence = new ArrayList<PositiveIntType>();
7886          this.itemSequence.add(t);
7887          return this;
7888        }
7889
7890        /**
7891         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
7892         */
7893        public boolean hasItemSequence(int value) { 
7894          if (this.itemSequence == null)
7895            return false;
7896          for (PositiveIntType v : this.itemSequence)
7897            if (v.getValue().equals(value)) // positiveInt
7898              return true;
7899          return false;
7900        }
7901
7902        /**
7903         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7904         */
7905        public List<PositiveIntType> getDetailSequence() { 
7906          if (this.detailSequence == null)
7907            this.detailSequence = new ArrayList<PositiveIntType>();
7908          return this.detailSequence;
7909        }
7910
7911        /**
7912         * @return Returns a reference to <code>this</code> for easy method chaining
7913         */
7914        public AddedItemComponent setDetailSequence(List<PositiveIntType> theDetailSequence) { 
7915          this.detailSequence = theDetailSequence;
7916          return this;
7917        }
7918
7919        public boolean hasDetailSequence() { 
7920          if (this.detailSequence == null)
7921            return false;
7922          for (PositiveIntType item : this.detailSequence)
7923            if (!item.isEmpty())
7924              return true;
7925          return false;
7926        }
7927
7928        /**
7929         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7930         */
7931        public PositiveIntType addDetailSequenceElement() {//2 
7932          PositiveIntType t = new PositiveIntType();
7933          if (this.detailSequence == null)
7934            this.detailSequence = new ArrayList<PositiveIntType>();
7935          this.detailSequence.add(t);
7936          return t;
7937        }
7938
7939        /**
7940         * @param value {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7941         */
7942        public AddedItemComponent addDetailSequence(int value) { //1
7943          PositiveIntType t = new PositiveIntType();
7944          t.setValue(value);
7945          if (this.detailSequence == null)
7946            this.detailSequence = new ArrayList<PositiveIntType>();
7947          this.detailSequence.add(t);
7948          return this;
7949        }
7950
7951        /**
7952         * @param value {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7953         */
7954        public boolean hasDetailSequence(int value) { 
7955          if (this.detailSequence == null)
7956            return false;
7957          for (PositiveIntType v : this.detailSequence)
7958            if (v.getValue().equals(value)) // positiveInt
7959              return true;
7960          return false;
7961        }
7962
7963        /**
7964         * @return {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
7965         */
7966        public List<PositiveIntType> getSubDetailSequence() { 
7967          if (this.subDetailSequence == null)
7968            this.subDetailSequence = new ArrayList<PositiveIntType>();
7969          return this.subDetailSequence;
7970        }
7971
7972        /**
7973         * @return Returns a reference to <code>this</code> for easy method chaining
7974         */
7975        public AddedItemComponent setSubDetailSequence(List<PositiveIntType> theSubDetailSequence) { 
7976          this.subDetailSequence = theSubDetailSequence;
7977          return this;
7978        }
7979
7980        public boolean hasSubDetailSequence() { 
7981          if (this.subDetailSequence == null)
7982            return false;
7983          for (PositiveIntType item : this.subDetailSequence)
7984            if (!item.isEmpty())
7985              return true;
7986          return false;
7987        }
7988
7989        /**
7990         * @return {@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 PositiveIntType addSubDetailSequenceElement() {//2 
7993          PositiveIntType t = new PositiveIntType();
7994          if (this.subDetailSequence == null)
7995            this.subDetailSequence = new ArrayList<PositiveIntType>();
7996          this.subDetailSequence.add(t);
7997          return t;
7998        }
7999
8000        /**
8001         * @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.)
8002         */
8003        public AddedItemComponent addSubDetailSequence(int value) { //1
8004          PositiveIntType t = new PositiveIntType();
8005          t.setValue(value);
8006          if (this.subDetailSequence == null)
8007            this.subDetailSequence = new ArrayList<PositiveIntType>();
8008          this.subDetailSequence.add(t);
8009          return this;
8010        }
8011
8012        /**
8013         * @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.)
8014         */
8015        public boolean hasSubDetailSequence(int value) { 
8016          if (this.subDetailSequence == null)
8017            return false;
8018          for (PositiveIntType v : this.subDetailSequence)
8019            if (v.getValue().equals(value)) // positiveInt
8020              return true;
8021          return false;
8022        }
8023
8024        /**
8025         * @return {@link #provider} (The providers who are authorized for the services rendered to the patient.)
8026         */
8027        public List<Reference> getProvider() { 
8028          if (this.provider == null)
8029            this.provider = new ArrayList<Reference>();
8030          return this.provider;
8031        }
8032
8033        /**
8034         * @return Returns a reference to <code>this</code> for easy method chaining
8035         */
8036        public AddedItemComponent setProvider(List<Reference> theProvider) { 
8037          this.provider = theProvider;
8038          return this;
8039        }
8040
8041        public boolean hasProvider() { 
8042          if (this.provider == null)
8043            return false;
8044          for (Reference item : this.provider)
8045            if (!item.isEmpty())
8046              return true;
8047          return false;
8048        }
8049
8050        public Reference addProvider() { //3
8051          Reference t = new Reference();
8052          if (this.provider == null)
8053            this.provider = new ArrayList<Reference>();
8054          this.provider.add(t);
8055          return t;
8056        }
8057
8058        public AddedItemComponent addProvider(Reference t) { //3
8059          if (t == null)
8060            return this;
8061          if (this.provider == null)
8062            this.provider = new ArrayList<Reference>();
8063          this.provider.add(t);
8064          return this;
8065        }
8066
8067        /**
8068         * @return The first repetition of repeating field {@link #provider}, creating it if it does not already exist
8069         */
8070        public Reference getProviderFirstRep() { 
8071          if (getProvider().isEmpty()) {
8072            addProvider();
8073          }
8074          return getProvider().get(0);
8075        }
8076
8077        /**
8078         * @deprecated Use Reference#setResource(IBaseResource) instead
8079         */
8080        @Deprecated
8081        public List<Resource> getProviderTarget() { 
8082          if (this.providerTarget == null)
8083            this.providerTarget = new ArrayList<Resource>();
8084          return this.providerTarget;
8085        }
8086
8087        /**
8088         * @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.)
8089         */
8090        public CodeableConcept getProductOrService() { 
8091          if (this.productOrService == null)
8092            if (Configuration.errorOnAutoCreate())
8093              throw new Error("Attempt to auto-create AddedItemComponent.productOrService");
8094            else if (Configuration.doAutoCreate())
8095              this.productOrService = new CodeableConcept(); // cc
8096          return this.productOrService;
8097        }
8098
8099        public boolean hasProductOrService() { 
8100          return this.productOrService != null && !this.productOrService.isEmpty();
8101        }
8102
8103        /**
8104         * @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.)
8105         */
8106        public AddedItemComponent setProductOrService(CodeableConcept value) { 
8107          this.productOrService = value;
8108          return this;
8109        }
8110
8111        /**
8112         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
8113         */
8114        public List<CodeableConcept> getModifier() { 
8115          if (this.modifier == null)
8116            this.modifier = new ArrayList<CodeableConcept>();
8117          return this.modifier;
8118        }
8119
8120        /**
8121         * @return Returns a reference to <code>this</code> for easy method chaining
8122         */
8123        public AddedItemComponent setModifier(List<CodeableConcept> theModifier) { 
8124          this.modifier = theModifier;
8125          return this;
8126        }
8127
8128        public boolean hasModifier() { 
8129          if (this.modifier == null)
8130            return false;
8131          for (CodeableConcept item : this.modifier)
8132            if (!item.isEmpty())
8133              return true;
8134          return false;
8135        }
8136
8137        public CodeableConcept addModifier() { //3
8138          CodeableConcept t = new CodeableConcept();
8139          if (this.modifier == null)
8140            this.modifier = new ArrayList<CodeableConcept>();
8141          this.modifier.add(t);
8142          return t;
8143        }
8144
8145        public AddedItemComponent addModifier(CodeableConcept t) { //3
8146          if (t == null)
8147            return this;
8148          if (this.modifier == null)
8149            this.modifier = new ArrayList<CodeableConcept>();
8150          this.modifier.add(t);
8151          return this;
8152        }
8153
8154        /**
8155         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
8156         */
8157        public CodeableConcept getModifierFirstRep() { 
8158          if (getModifier().isEmpty()) {
8159            addModifier();
8160          }
8161          return getModifier().get(0);
8162        }
8163
8164        /**
8165         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
8166         */
8167        public List<CodeableConcept> getProgramCode() { 
8168          if (this.programCode == null)
8169            this.programCode = new ArrayList<CodeableConcept>();
8170          return this.programCode;
8171        }
8172
8173        /**
8174         * @return Returns a reference to <code>this</code> for easy method chaining
8175         */
8176        public AddedItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
8177          this.programCode = theProgramCode;
8178          return this;
8179        }
8180
8181        public boolean hasProgramCode() { 
8182          if (this.programCode == null)
8183            return false;
8184          for (CodeableConcept item : this.programCode)
8185            if (!item.isEmpty())
8186              return true;
8187          return false;
8188        }
8189
8190        public CodeableConcept addProgramCode() { //3
8191          CodeableConcept t = new CodeableConcept();
8192          if (this.programCode == null)
8193            this.programCode = new ArrayList<CodeableConcept>();
8194          this.programCode.add(t);
8195          return t;
8196        }
8197
8198        public AddedItemComponent addProgramCode(CodeableConcept t) { //3
8199          if (t == null)
8200            return this;
8201          if (this.programCode == null)
8202            this.programCode = new ArrayList<CodeableConcept>();
8203          this.programCode.add(t);
8204          return this;
8205        }
8206
8207        /**
8208         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
8209         */
8210        public CodeableConcept getProgramCodeFirstRep() { 
8211          if (getProgramCode().isEmpty()) {
8212            addProgramCode();
8213          }
8214          return getProgramCode().get(0);
8215        }
8216
8217        /**
8218         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8219         */
8220        public Type getServiced() { 
8221          return this.serviced;
8222        }
8223
8224        /**
8225         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8226         */
8227        public DateType getServicedDateType() throws FHIRException { 
8228          if (this.serviced == null)
8229            this.serviced = new DateType();
8230          if (!(this.serviced instanceof DateType))
8231            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
8232          return (DateType) this.serviced;
8233        }
8234
8235        public boolean hasServicedDateType() { 
8236          return this != null && this.serviced instanceof DateType;
8237        }
8238
8239        /**
8240         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8241         */
8242        public Period getServicedPeriod() throws FHIRException { 
8243          if (this.serviced == null)
8244            this.serviced = new Period();
8245          if (!(this.serviced instanceof Period))
8246            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
8247          return (Period) this.serviced;
8248        }
8249
8250        public boolean hasServicedPeriod() { 
8251          return this != null && this.serviced instanceof Period;
8252        }
8253
8254        public boolean hasServiced() { 
8255          return this.serviced != null && !this.serviced.isEmpty();
8256        }
8257
8258        /**
8259         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8260         */
8261        public AddedItemComponent setServiced(Type value) { 
8262          if (value != null && !(value instanceof DateType || value instanceof Period))
8263            throw new Error("Not the right type for ExplanationOfBenefit.addItem.serviced[x]: "+value.fhirType());
8264          this.serviced = value;
8265          return this;
8266        }
8267
8268        /**
8269         * @return {@link #location} (Where the product or service was provided.)
8270         */
8271        public Type getLocation() { 
8272          return this.location;
8273        }
8274
8275        /**
8276         * @return {@link #location} (Where the product or service was provided.)
8277         */
8278        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
8279          if (this.location == null)
8280            this.location = new CodeableConcept();
8281          if (!(this.location instanceof CodeableConcept))
8282            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
8283          return (CodeableConcept) this.location;
8284        }
8285
8286        public boolean hasLocationCodeableConcept() { 
8287          return this != null && this.location instanceof CodeableConcept;
8288        }
8289
8290        /**
8291         * @return {@link #location} (Where the product or service was provided.)
8292         */
8293        public Address getLocationAddress() throws FHIRException { 
8294          if (this.location == null)
8295            this.location = new Address();
8296          if (!(this.location instanceof Address))
8297            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
8298          return (Address) this.location;
8299        }
8300
8301        public boolean hasLocationAddress() { 
8302          return this != null && this.location instanceof Address;
8303        }
8304
8305        /**
8306         * @return {@link #location} (Where the product or service was provided.)
8307         */
8308        public Reference getLocationReference() throws FHIRException { 
8309          if (this.location == null)
8310            this.location = new Reference();
8311          if (!(this.location instanceof Reference))
8312            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
8313          return (Reference) this.location;
8314        }
8315
8316        public boolean hasLocationReference() { 
8317          return this != null && this.location instanceof Reference;
8318        }
8319
8320        public boolean hasLocation() { 
8321          return this.location != null && !this.location.isEmpty();
8322        }
8323
8324        /**
8325         * @param value {@link #location} (Where the product or service was provided.)
8326         */
8327        public AddedItemComponent setLocation(Type value) { 
8328          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
8329            throw new Error("Not the right type for ExplanationOfBenefit.addItem.location[x]: "+value.fhirType());
8330          this.location = value;
8331          return this;
8332        }
8333
8334        /**
8335         * @return {@link #quantity} (The number of repetitions of a service or product.)
8336         */
8337        public Quantity getQuantity() { 
8338          if (this.quantity == null)
8339            if (Configuration.errorOnAutoCreate())
8340              throw new Error("Attempt to auto-create AddedItemComponent.quantity");
8341            else if (Configuration.doAutoCreate())
8342              this.quantity = new Quantity(); // cc
8343          return this.quantity;
8344        }
8345
8346        public boolean hasQuantity() { 
8347          return this.quantity != null && !this.quantity.isEmpty();
8348        }
8349
8350        /**
8351         * @param value {@link #quantity} (The number of repetitions of a service or product.)
8352         */
8353        public AddedItemComponent setQuantity(Quantity value) { 
8354          this.quantity = value;
8355          return this;
8356        }
8357
8358        /**
8359         * @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.)
8360         */
8361        public Money getUnitPrice() { 
8362          if (this.unitPrice == null)
8363            if (Configuration.errorOnAutoCreate())
8364              throw new Error("Attempt to auto-create AddedItemComponent.unitPrice");
8365            else if (Configuration.doAutoCreate())
8366              this.unitPrice = new Money(); // cc
8367          return this.unitPrice;
8368        }
8369
8370        public boolean hasUnitPrice() { 
8371          return this.unitPrice != null && !this.unitPrice.isEmpty();
8372        }
8373
8374        /**
8375         * @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.)
8376         */
8377        public AddedItemComponent setUnitPrice(Money value) { 
8378          this.unitPrice = value;
8379          return this;
8380        }
8381
8382        /**
8383         * @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
8384         */
8385        public DecimalType getFactorElement() { 
8386          if (this.factor == null)
8387            if (Configuration.errorOnAutoCreate())
8388              throw new Error("Attempt to auto-create AddedItemComponent.factor");
8389            else if (Configuration.doAutoCreate())
8390              this.factor = new DecimalType(); // bb
8391          return this.factor;
8392        }
8393
8394        public boolean hasFactorElement() { 
8395          return this.factor != null && !this.factor.isEmpty();
8396        }
8397
8398        public boolean hasFactor() { 
8399          return this.factor != null && !this.factor.isEmpty();
8400        }
8401
8402        /**
8403         * @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
8404         */
8405        public AddedItemComponent setFactorElement(DecimalType value) { 
8406          this.factor = value;
8407          return this;
8408        }
8409
8410        /**
8411         * @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.
8412         */
8413        public BigDecimal getFactor() { 
8414          return this.factor == null ? null : this.factor.getValue();
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(BigDecimal value) { 
8421          if (value == null)
8422            this.factor = null;
8423          else {
8424            if (this.factor == null)
8425              this.factor = new DecimalType();
8426            this.factor.setValue(value);
8427          }
8428          return this;
8429        }
8430
8431        /**
8432         * @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.
8433         */
8434        public AddedItemComponent setFactor(long value) { 
8435              this.factor = new DecimalType();
8436            this.factor.setValue(value);
8437          return this;
8438        }
8439
8440        /**
8441         * @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.
8442         */
8443        public AddedItemComponent setFactor(double value) { 
8444              this.factor = new DecimalType();
8445            this.factor.setValue(value);
8446          return this;
8447        }
8448
8449        /**
8450         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8451         */
8452        public Money getNet() { 
8453          if (this.net == null)
8454            if (Configuration.errorOnAutoCreate())
8455              throw new Error("Attempt to auto-create AddedItemComponent.net");
8456            else if (Configuration.doAutoCreate())
8457              this.net = new Money(); // cc
8458          return this.net;
8459        }
8460
8461        public boolean hasNet() { 
8462          return this.net != null && !this.net.isEmpty();
8463        }
8464
8465        /**
8466         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8467         */
8468        public AddedItemComponent setNet(Money value) { 
8469          this.net = value;
8470          return this;
8471        }
8472
8473        /**
8474         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
8475         */
8476        public CodeableConcept getBodySite() { 
8477          if (this.bodySite == null)
8478            if (Configuration.errorOnAutoCreate())
8479              throw new Error("Attempt to auto-create AddedItemComponent.bodySite");
8480            else if (Configuration.doAutoCreate())
8481              this.bodySite = new CodeableConcept(); // cc
8482          return this.bodySite;
8483        }
8484
8485        public boolean hasBodySite() { 
8486          return this.bodySite != null && !this.bodySite.isEmpty();
8487        }
8488
8489        /**
8490         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
8491         */
8492        public AddedItemComponent setBodySite(CodeableConcept value) { 
8493          this.bodySite = value;
8494          return this;
8495        }
8496
8497        /**
8498         * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb region or tooth surface(s).)
8499         */
8500        public List<CodeableConcept> getSubSite() { 
8501          if (this.subSite == null)
8502            this.subSite = new ArrayList<CodeableConcept>();
8503          return this.subSite;
8504        }
8505
8506        /**
8507         * @return Returns a reference to <code>this</code> for easy method chaining
8508         */
8509        public AddedItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
8510          this.subSite = theSubSite;
8511          return this;
8512        }
8513
8514        public boolean hasSubSite() { 
8515          if (this.subSite == null)
8516            return false;
8517          for (CodeableConcept item : this.subSite)
8518            if (!item.isEmpty())
8519              return true;
8520          return false;
8521        }
8522
8523        public CodeableConcept addSubSite() { //3
8524          CodeableConcept t = new CodeableConcept();
8525          if (this.subSite == null)
8526            this.subSite = new ArrayList<CodeableConcept>();
8527          this.subSite.add(t);
8528          return t;
8529        }
8530
8531        public AddedItemComponent addSubSite(CodeableConcept t) { //3
8532          if (t == null)
8533            return this;
8534          if (this.subSite == null)
8535            this.subSite = new ArrayList<CodeableConcept>();
8536          this.subSite.add(t);
8537          return this;
8538        }
8539
8540        /**
8541         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist
8542         */
8543        public CodeableConcept getSubSiteFirstRep() { 
8544          if (getSubSite().isEmpty()) {
8545            addSubSite();
8546          }
8547          return getSubSite().get(0);
8548        }
8549
8550        /**
8551         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8552         */
8553        public List<PositiveIntType> getNoteNumber() { 
8554          if (this.noteNumber == null)
8555            this.noteNumber = new ArrayList<PositiveIntType>();
8556          return this.noteNumber;
8557        }
8558
8559        /**
8560         * @return Returns a reference to <code>this</code> for easy method chaining
8561         */
8562        public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
8563          this.noteNumber = theNoteNumber;
8564          return this;
8565        }
8566
8567        public boolean hasNoteNumber() { 
8568          if (this.noteNumber == null)
8569            return false;
8570          for (PositiveIntType item : this.noteNumber)
8571            if (!item.isEmpty())
8572              return true;
8573          return false;
8574        }
8575
8576        /**
8577         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8578         */
8579        public PositiveIntType addNoteNumberElement() {//2 
8580          PositiveIntType t = new PositiveIntType();
8581          if (this.noteNumber == null)
8582            this.noteNumber = new ArrayList<PositiveIntType>();
8583          this.noteNumber.add(t);
8584          return t;
8585        }
8586
8587        /**
8588         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8589         */
8590        public AddedItemComponent addNoteNumber(int value) { //1
8591          PositiveIntType t = new PositiveIntType();
8592          t.setValue(value);
8593          if (this.noteNumber == null)
8594            this.noteNumber = new ArrayList<PositiveIntType>();
8595          this.noteNumber.add(t);
8596          return this;
8597        }
8598
8599        /**
8600         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8601         */
8602        public boolean hasNoteNumber(int value) { 
8603          if (this.noteNumber == null)
8604            return false;
8605          for (PositiveIntType v : this.noteNumber)
8606            if (v.getValue().equals(value)) // positiveInt
8607              return true;
8608          return false;
8609        }
8610
8611        /**
8612         * @return {@link #adjudication} (The adjudication results.)
8613         */
8614        public List<AdjudicationComponent> getAdjudication() { 
8615          if (this.adjudication == null)
8616            this.adjudication = new ArrayList<AdjudicationComponent>();
8617          return this.adjudication;
8618        }
8619
8620        /**
8621         * @return Returns a reference to <code>this</code> for easy method chaining
8622         */
8623        public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
8624          this.adjudication = theAdjudication;
8625          return this;
8626        }
8627
8628        public boolean hasAdjudication() { 
8629          if (this.adjudication == null)
8630            return false;
8631          for (AdjudicationComponent item : this.adjudication)
8632            if (!item.isEmpty())
8633              return true;
8634          return false;
8635        }
8636
8637        public AdjudicationComponent addAdjudication() { //3
8638          AdjudicationComponent t = new AdjudicationComponent();
8639          if (this.adjudication == null)
8640            this.adjudication = new ArrayList<AdjudicationComponent>();
8641          this.adjudication.add(t);
8642          return t;
8643        }
8644
8645        public AddedItemComponent addAdjudication(AdjudicationComponent t) { //3
8646          if (t == null)
8647            return this;
8648          if (this.adjudication == null)
8649            this.adjudication = new ArrayList<AdjudicationComponent>();
8650          this.adjudication.add(t);
8651          return this;
8652        }
8653
8654        /**
8655         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
8656         */
8657        public AdjudicationComponent getAdjudicationFirstRep() { 
8658          if (getAdjudication().isEmpty()) {
8659            addAdjudication();
8660          }
8661          return getAdjudication().get(0);
8662        }
8663
8664        /**
8665         * @return {@link #detail} (The second-tier service adjudications for payor added services.)
8666         */
8667        public List<AddedItemDetailComponent> getDetail() { 
8668          if (this.detail == null)
8669            this.detail = new ArrayList<AddedItemDetailComponent>();
8670          return this.detail;
8671        }
8672
8673        /**
8674         * @return Returns a reference to <code>this</code> for easy method chaining
8675         */
8676        public AddedItemComponent setDetail(List<AddedItemDetailComponent> theDetail) { 
8677          this.detail = theDetail;
8678          return this;
8679        }
8680
8681        public boolean hasDetail() { 
8682          if (this.detail == null)
8683            return false;
8684          for (AddedItemDetailComponent item : this.detail)
8685            if (!item.isEmpty())
8686              return true;
8687          return false;
8688        }
8689
8690        public AddedItemDetailComponent addDetail() { //3
8691          AddedItemDetailComponent t = new AddedItemDetailComponent();
8692          if (this.detail == null)
8693            this.detail = new ArrayList<AddedItemDetailComponent>();
8694          this.detail.add(t);
8695          return t;
8696        }
8697
8698        public AddedItemComponent addDetail(AddedItemDetailComponent t) { //3
8699          if (t == null)
8700            return this;
8701          if (this.detail == null)
8702            this.detail = new ArrayList<AddedItemDetailComponent>();
8703          this.detail.add(t);
8704          return this;
8705        }
8706
8707        /**
8708         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
8709         */
8710        public AddedItemDetailComponent getDetailFirstRep() { 
8711          if (getDetail().isEmpty()) {
8712            addDetail();
8713          }
8714          return getDetail().get(0);
8715        }
8716
8717        protected void listChildren(List<Property> children) {
8718          super.listChildren(children);
8719          children.add(new Property("itemSequence", "positiveInt", "Claim items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, itemSequence));
8720          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));
8721          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));
8722          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));
8723          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));
8724          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));
8725          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
8726          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));
8727          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location));
8728          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
8729          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));
8730          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));
8731          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
8732          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
8733          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));
8734          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));
8735          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
8736          children.add(new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail));
8737        }
8738
8739        @Override
8740        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8741          switch (_hash) {
8742          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);
8743          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);
8744          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);
8745          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);
8746          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);
8747          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);
8748          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
8749          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);
8750          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);
8751          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);
8752          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);
8753          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8754          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8755          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8756          case -1280020865: /*locationAddress*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8757          case 755866390: /*locationReference*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8758          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
8759          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);
8760          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);
8761          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);
8762          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
8763          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);
8764          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);
8765          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
8766          case -1335224239: /*detail*/  return new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail);
8767          default: return super.getNamedProperty(_hash, _name, _checkValid);
8768          }
8769
8770        }
8771
8772      @Override
8773      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8774        switch (hash) {
8775        case 1977979892: /*itemSequence*/ return this.itemSequence == null ? new Base[0] : this.itemSequence.toArray(new Base[this.itemSequence.size()]); // PositiveIntType
8776        case 1321472818: /*detailSequence*/ return this.detailSequence == null ? new Base[0] : this.detailSequence.toArray(new Base[this.detailSequence.size()]); // PositiveIntType
8777        case -855462510: /*subDetailSequence*/ return this.subDetailSequence == null ? new Base[0] : this.subDetailSequence.toArray(new Base[this.subDetailSequence.size()]); // PositiveIntType
8778        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : this.provider.toArray(new Base[this.provider.size()]); // Reference
8779        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
8780        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
8781        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
8782        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
8783        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
8784        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
8785        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
8786        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
8787        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
8788        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
8789        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
8790        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
8791        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
8792        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemDetailComponent
8793        default: return super.getProperty(hash, name, checkValid);
8794        }
8795
8796      }
8797
8798      @Override
8799      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8800        switch (hash) {
8801        case 1977979892: // itemSequence
8802          this.getItemSequence().add(castToPositiveInt(value)); // PositiveIntType
8803          return value;
8804        case 1321472818: // detailSequence
8805          this.getDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
8806          return value;
8807        case -855462510: // subDetailSequence
8808          this.getSubDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
8809          return value;
8810        case -987494927: // provider
8811          this.getProvider().add(castToReference(value)); // Reference
8812          return value;
8813        case 1957227299: // productOrService
8814          this.productOrService = castToCodeableConcept(value); // CodeableConcept
8815          return value;
8816        case -615513385: // modifier
8817          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
8818          return value;
8819        case 1010065041: // programCode
8820          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
8821          return value;
8822        case 1379209295: // serviced
8823          this.serviced = castToType(value); // Type
8824          return value;
8825        case 1901043637: // location
8826          this.location = castToType(value); // Type
8827          return value;
8828        case -1285004149: // quantity
8829          this.quantity = castToQuantity(value); // Quantity
8830          return value;
8831        case -486196699: // unitPrice
8832          this.unitPrice = castToMoney(value); // Money
8833          return value;
8834        case -1282148017: // factor
8835          this.factor = castToDecimal(value); // DecimalType
8836          return value;
8837        case 108957: // net
8838          this.net = castToMoney(value); // Money
8839          return value;
8840        case 1702620169: // bodySite
8841          this.bodySite = castToCodeableConcept(value); // CodeableConcept
8842          return value;
8843        case -1868566105: // subSite
8844          this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
8845          return value;
8846        case -1110033957: // noteNumber
8847          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
8848          return value;
8849        case -231349275: // adjudication
8850          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
8851          return value;
8852        case -1335224239: // detail
8853          this.getDetail().add((AddedItemDetailComponent) value); // AddedItemDetailComponent
8854          return value;
8855        default: return super.setProperty(hash, name, value);
8856        }
8857
8858      }
8859
8860      @Override
8861      public Base setProperty(String name, Base value) throws FHIRException {
8862        if (name.equals("itemSequence")) {
8863          this.getItemSequence().add(castToPositiveInt(value));
8864        } else if (name.equals("detailSequence")) {
8865          this.getDetailSequence().add(castToPositiveInt(value));
8866        } else if (name.equals("subDetailSequence")) {
8867          this.getSubDetailSequence().add(castToPositiveInt(value));
8868        } else if (name.equals("provider")) {
8869          this.getProvider().add(castToReference(value));
8870        } else if (name.equals("productOrService")) {
8871          this.productOrService = castToCodeableConcept(value); // CodeableConcept
8872        } else if (name.equals("modifier")) {
8873          this.getModifier().add(castToCodeableConcept(value));
8874        } else if (name.equals("programCode")) {
8875          this.getProgramCode().add(castToCodeableConcept(value));
8876        } else if (name.equals("serviced[x]")) {
8877          this.serviced = castToType(value); // Type
8878        } else if (name.equals("location[x]")) {
8879          this.location = castToType(value); // Type
8880        } else if (name.equals("quantity")) {
8881          this.quantity = castToQuantity(value); // Quantity
8882        } else if (name.equals("unitPrice")) {
8883          this.unitPrice = castToMoney(value); // Money
8884        } else if (name.equals("factor")) {
8885          this.factor = castToDecimal(value); // DecimalType
8886        } else if (name.equals("net")) {
8887          this.net = castToMoney(value); // Money
8888        } else if (name.equals("bodySite")) {
8889          this.bodySite = castToCodeableConcept(value); // CodeableConcept
8890        } else if (name.equals("subSite")) {
8891          this.getSubSite().add(castToCodeableConcept(value));
8892        } else if (name.equals("noteNumber")) {
8893          this.getNoteNumber().add(castToPositiveInt(value));
8894        } else if (name.equals("adjudication")) {
8895          this.getAdjudication().add((AdjudicationComponent) value);
8896        } else if (name.equals("detail")) {
8897          this.getDetail().add((AddedItemDetailComponent) value);
8898        } else
8899          return super.setProperty(name, value);
8900        return value;
8901      }
8902
8903      @Override
8904      public Base makeProperty(int hash, String name) throws FHIRException {
8905        switch (hash) {
8906        case 1977979892:  return addItemSequenceElement();
8907        case 1321472818:  return addDetailSequenceElement();
8908        case -855462510:  return addSubDetailSequenceElement();
8909        case -987494927:  return addProvider(); 
8910        case 1957227299:  return getProductOrService(); 
8911        case -615513385:  return addModifier(); 
8912        case 1010065041:  return addProgramCode(); 
8913        case -1927922223:  return getServiced(); 
8914        case 1379209295:  return getServiced(); 
8915        case 552316075:  return getLocation(); 
8916        case 1901043637:  return getLocation(); 
8917        case -1285004149:  return getQuantity(); 
8918        case -486196699:  return getUnitPrice(); 
8919        case -1282148017:  return getFactorElement();
8920        case 108957:  return getNet(); 
8921        case 1702620169:  return getBodySite(); 
8922        case -1868566105:  return addSubSite(); 
8923        case -1110033957:  return addNoteNumberElement();
8924        case -231349275:  return addAdjudication(); 
8925        case -1335224239:  return addDetail(); 
8926        default: return super.makeProperty(hash, name);
8927        }
8928
8929      }
8930
8931      @Override
8932      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8933        switch (hash) {
8934        case 1977979892: /*itemSequence*/ return new String[] {"positiveInt"};
8935        case 1321472818: /*detailSequence*/ return new String[] {"positiveInt"};
8936        case -855462510: /*subDetailSequence*/ return new String[] {"positiveInt"};
8937        case -987494927: /*provider*/ return new String[] {"Reference"};
8938        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
8939        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
8940        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
8941        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
8942        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
8943        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
8944        case -486196699: /*unitPrice*/ return new String[] {"Money"};
8945        case -1282148017: /*factor*/ return new String[] {"decimal"};
8946        case 108957: /*net*/ return new String[] {"Money"};
8947        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
8948        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
8949        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
8950        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
8951        case -1335224239: /*detail*/ return new String[] {};
8952        default: return super.getTypesForProperty(hash, name);
8953        }
8954
8955      }
8956
8957      @Override
8958      public Base addChild(String name) throws FHIRException {
8959        if (name.equals("itemSequence")) {
8960          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.itemSequence");
8961        }
8962        else if (name.equals("detailSequence")) {
8963          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.detailSequence");
8964        }
8965        else if (name.equals("subDetailSequence")) {
8966          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.subDetailSequence");
8967        }
8968        else if (name.equals("provider")) {
8969          return addProvider();
8970        }
8971        else if (name.equals("productOrService")) {
8972          this.productOrService = new CodeableConcept();
8973          return this.productOrService;
8974        }
8975        else if (name.equals("modifier")) {
8976          return addModifier();
8977        }
8978        else if (name.equals("programCode")) {
8979          return addProgramCode();
8980        }
8981        else if (name.equals("servicedDate")) {
8982          this.serviced = new DateType();
8983          return this.serviced;
8984        }
8985        else if (name.equals("servicedPeriod")) {
8986          this.serviced = new Period();
8987          return this.serviced;
8988        }
8989        else if (name.equals("locationCodeableConcept")) {
8990          this.location = new CodeableConcept();
8991          return this.location;
8992        }
8993        else if (name.equals("locationAddress")) {
8994          this.location = new Address();
8995          return this.location;
8996        }
8997        else if (name.equals("locationReference")) {
8998          this.location = new Reference();
8999          return this.location;
9000        }
9001        else if (name.equals("quantity")) {
9002          this.quantity = new Quantity();
9003          return this.quantity;
9004        }
9005        else if (name.equals("unitPrice")) {
9006          this.unitPrice = new Money();
9007          return this.unitPrice;
9008        }
9009        else if (name.equals("factor")) {
9010          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
9011        }
9012        else if (name.equals("net")) {
9013          this.net = new Money();
9014          return this.net;
9015        }
9016        else if (name.equals("bodySite")) {
9017          this.bodySite = new CodeableConcept();
9018          return this.bodySite;
9019        }
9020        else if (name.equals("subSite")) {
9021          return addSubSite();
9022        }
9023        else if (name.equals("noteNumber")) {
9024          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
9025        }
9026        else if (name.equals("adjudication")) {
9027          return addAdjudication();
9028        }
9029        else if (name.equals("detail")) {
9030          return addDetail();
9031        }
9032        else
9033          return super.addChild(name);
9034      }
9035
9036      public AddedItemComponent copy() {
9037        AddedItemComponent dst = new AddedItemComponent();
9038        copyValues(dst);
9039        if (itemSequence != null) {
9040          dst.itemSequence = new ArrayList<PositiveIntType>();
9041          for (PositiveIntType i : itemSequence)
9042            dst.itemSequence.add(i.copy());
9043        };
9044        if (detailSequence != null) {
9045          dst.detailSequence = new ArrayList<PositiveIntType>();
9046          for (PositiveIntType i : detailSequence)
9047            dst.detailSequence.add(i.copy());
9048        };
9049        if (subDetailSequence != null) {
9050          dst.subDetailSequence = new ArrayList<PositiveIntType>();
9051          for (PositiveIntType i : subDetailSequence)
9052            dst.subDetailSequence.add(i.copy());
9053        };
9054        if (provider != null) {
9055          dst.provider = new ArrayList<Reference>();
9056          for (Reference i : provider)
9057            dst.provider.add(i.copy());
9058        };
9059        dst.productOrService = productOrService == null ? null : productOrService.copy();
9060        if (modifier != null) {
9061          dst.modifier = new ArrayList<CodeableConcept>();
9062          for (CodeableConcept i : modifier)
9063            dst.modifier.add(i.copy());
9064        };
9065        if (programCode != null) {
9066          dst.programCode = new ArrayList<CodeableConcept>();
9067          for (CodeableConcept i : programCode)
9068            dst.programCode.add(i.copy());
9069        };
9070        dst.serviced = serviced == null ? null : serviced.copy();
9071        dst.location = location == null ? null : location.copy();
9072        dst.quantity = quantity == null ? null : quantity.copy();
9073        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
9074        dst.factor = factor == null ? null : factor.copy();
9075        dst.net = net == null ? null : net.copy();
9076        dst.bodySite = bodySite == null ? null : bodySite.copy();
9077        if (subSite != null) {
9078          dst.subSite = new ArrayList<CodeableConcept>();
9079          for (CodeableConcept i : subSite)
9080            dst.subSite.add(i.copy());
9081        };
9082        if (noteNumber != null) {
9083          dst.noteNumber = new ArrayList<PositiveIntType>();
9084          for (PositiveIntType i : noteNumber)
9085            dst.noteNumber.add(i.copy());
9086        };
9087        if (adjudication != null) {
9088          dst.adjudication = new ArrayList<AdjudicationComponent>();
9089          for (AdjudicationComponent i : adjudication)
9090            dst.adjudication.add(i.copy());
9091        };
9092        if (detail != null) {
9093          dst.detail = new ArrayList<AddedItemDetailComponent>();
9094          for (AddedItemDetailComponent i : detail)
9095            dst.detail.add(i.copy());
9096        };
9097        return dst;
9098      }
9099
9100      @Override
9101      public boolean equalsDeep(Base other_) {
9102        if (!super.equalsDeep(other_))
9103          return false;
9104        if (!(other_ instanceof AddedItemComponent))
9105          return false;
9106        AddedItemComponent o = (AddedItemComponent) other_;
9107        return compareDeep(itemSequence, o.itemSequence, true) && compareDeep(detailSequence, o.detailSequence, true)
9108           && compareDeep(subDetailSequence, o.subDetailSequence, true) && compareDeep(provider, o.provider, true)
9109           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
9110           && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
9111           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
9112           && compareDeep(net, o.net, true) && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true)
9113           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
9114           && compareDeep(detail, o.detail, true);
9115      }
9116
9117      @Override
9118      public boolean equalsShallow(Base other_) {
9119        if (!super.equalsShallow(other_))
9120          return false;
9121        if (!(other_ instanceof AddedItemComponent))
9122          return false;
9123        AddedItemComponent o = (AddedItemComponent) other_;
9124        return compareValues(itemSequence, o.itemSequence, true) && compareValues(detailSequence, o.detailSequence, true)
9125           && compareValues(subDetailSequence, o.subDetailSequence, true) && compareValues(factor, o.factor, true)
9126           && compareValues(noteNumber, o.noteNumber, true);
9127      }
9128
9129      public boolean isEmpty() {
9130        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(itemSequence, detailSequence
9131          , subDetailSequence, provider, productOrService, modifier, programCode, serviced
9132          , location, quantity, unitPrice, factor, net, bodySite, subSite, noteNumber
9133          , adjudication, detail);
9134      }
9135
9136  public String fhirType() {
9137    return "ExplanationOfBenefit.addItem";
9138
9139  }
9140
9141  }
9142
9143    @Block()
9144    public static class AddedItemDetailComponent extends BackboneElement implements IBaseBackboneElement {
9145        /**
9146         * 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.
9147         */
9148        @Child(name = "productOrService", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9149        @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." )
9150        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
9151        protected CodeableConcept productOrService;
9152
9153        /**
9154         * Item typification or modifiers codes to convey additional context for the product or service.
9155         */
9156        @Child(name = "modifier", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9157        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
9158        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
9159        protected List<CodeableConcept> modifier;
9160
9161        /**
9162         * The number of repetitions of a service or product.
9163         */
9164        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
9165        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
9166        protected Quantity quantity;
9167
9168        /**
9169         * 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.
9170         */
9171        @Child(name = "unitPrice", type = {Money.class}, order=4, min=0, max=1, modifier=false, summary=false)
9172        @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." )
9173        protected Money unitPrice;
9174
9175        /**
9176         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
9177         */
9178        @Child(name = "factor", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=false)
9179        @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." )
9180        protected DecimalType factor;
9181
9182        /**
9183         * The quantity times the unit price for an additional service or product or charge.
9184         */
9185        @Child(name = "net", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
9186        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
9187        protected Money net;
9188
9189        /**
9190         * The numbers associated with notes below which apply to the adjudication of this item.
9191         */
9192        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9193        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
9194        protected List<PositiveIntType> noteNumber;
9195
9196        /**
9197         * The adjudication results.
9198         */
9199        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9200        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
9201        protected List<AdjudicationComponent> adjudication;
9202
9203        /**
9204         * The third-tier service adjudications for payor added services.
9205         */
9206        @Child(name = "subDetail", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9207        @Description(shortDefinition="Insurer added line items", formalDefinition="The third-tier service adjudications for payor added services." )
9208        protected List<AddedItemDetailSubDetailComponent> subDetail;
9209
9210        private static final long serialVersionUID = 295910869L;
9211
9212    /**
9213     * Constructor
9214     */
9215      public AddedItemDetailComponent() {
9216        super();
9217      }
9218
9219    /**
9220     * Constructor
9221     */
9222      public AddedItemDetailComponent(CodeableConcept productOrService) {
9223        super();
9224        this.productOrService = productOrService;
9225      }
9226
9227        /**
9228         * @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.)
9229         */
9230        public CodeableConcept getProductOrService() { 
9231          if (this.productOrService == null)
9232            if (Configuration.errorOnAutoCreate())
9233              throw new Error("Attempt to auto-create AddedItemDetailComponent.productOrService");
9234            else if (Configuration.doAutoCreate())
9235              this.productOrService = new CodeableConcept(); // cc
9236          return this.productOrService;
9237        }
9238
9239        public boolean hasProductOrService() { 
9240          return this.productOrService != null && !this.productOrService.isEmpty();
9241        }
9242
9243        /**
9244         * @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.)
9245         */
9246        public AddedItemDetailComponent setProductOrService(CodeableConcept value) { 
9247          this.productOrService = value;
9248          return this;
9249        }
9250
9251        /**
9252         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
9253         */
9254        public List<CodeableConcept> getModifier() { 
9255          if (this.modifier == null)
9256            this.modifier = new ArrayList<CodeableConcept>();
9257          return this.modifier;
9258        }
9259
9260        /**
9261         * @return Returns a reference to <code>this</code> for easy method chaining
9262         */
9263        public AddedItemDetailComponent setModifier(List<CodeableConcept> theModifier) { 
9264          this.modifier = theModifier;
9265          return this;
9266        }
9267
9268        public boolean hasModifier() { 
9269          if (this.modifier == null)
9270            return false;
9271          for (CodeableConcept item : this.modifier)
9272            if (!item.isEmpty())
9273              return true;
9274          return false;
9275        }
9276
9277        public CodeableConcept addModifier() { //3
9278          CodeableConcept t = new CodeableConcept();
9279          if (this.modifier == null)
9280            this.modifier = new ArrayList<CodeableConcept>();
9281          this.modifier.add(t);
9282          return t;
9283        }
9284
9285        public AddedItemDetailComponent addModifier(CodeableConcept t) { //3
9286          if (t == null)
9287            return this;
9288          if (this.modifier == null)
9289            this.modifier = new ArrayList<CodeableConcept>();
9290          this.modifier.add(t);
9291          return this;
9292        }
9293
9294        /**
9295         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
9296         */
9297        public CodeableConcept getModifierFirstRep() { 
9298          if (getModifier().isEmpty()) {
9299            addModifier();
9300          }
9301          return getModifier().get(0);
9302        }
9303
9304        /**
9305         * @return {@link #quantity} (The number of repetitions of a service or product.)
9306         */
9307        public Quantity getQuantity() { 
9308          if (this.quantity == null)
9309            if (Configuration.errorOnAutoCreate())
9310              throw new Error("Attempt to auto-create AddedItemDetailComponent.quantity");
9311            else if (Configuration.doAutoCreate())
9312              this.quantity = new Quantity(); // cc
9313          return this.quantity;
9314        }
9315
9316        public boolean hasQuantity() { 
9317          return this.quantity != null && !this.quantity.isEmpty();
9318        }
9319
9320        /**
9321         * @param value {@link #quantity} (The number of repetitions of a service or product.)
9322         */
9323        public AddedItemDetailComponent setQuantity(Quantity value) { 
9324          this.quantity = value;
9325          return this;
9326        }
9327
9328        /**
9329         * @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.)
9330         */
9331        public Money getUnitPrice() { 
9332          if (this.unitPrice == null)
9333            if (Configuration.errorOnAutoCreate())
9334              throw new Error("Attempt to auto-create AddedItemDetailComponent.unitPrice");
9335            else if (Configuration.doAutoCreate())
9336              this.unitPrice = new Money(); // cc
9337          return this.unitPrice;
9338        }
9339
9340        public boolean hasUnitPrice() { 
9341          return this.unitPrice != null && !this.unitPrice.isEmpty();
9342        }
9343
9344        /**
9345         * @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.)
9346         */
9347        public AddedItemDetailComponent setUnitPrice(Money value) { 
9348          this.unitPrice = value;
9349          return this;
9350        }
9351
9352        /**
9353         * @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
9354         */
9355        public DecimalType getFactorElement() { 
9356          if (this.factor == null)
9357            if (Configuration.errorOnAutoCreate())
9358              throw new Error("Attempt to auto-create AddedItemDetailComponent.factor");
9359            else if (Configuration.doAutoCreate())
9360              this.factor = new DecimalType(); // bb
9361          return this.factor;
9362        }
9363
9364        public boolean hasFactorElement() { 
9365          return this.factor != null && !this.factor.isEmpty();
9366        }
9367
9368        public boolean hasFactor() { 
9369          return this.factor != null && !this.factor.isEmpty();
9370        }
9371
9372        /**
9373         * @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
9374         */
9375        public AddedItemDetailComponent setFactorElement(DecimalType value) { 
9376          this.factor = value;
9377          return this;
9378        }
9379
9380        /**
9381         * @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.
9382         */
9383        public BigDecimal getFactor() { 
9384          return this.factor == null ? null : this.factor.getValue();
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(BigDecimal value) { 
9391          if (value == null)
9392            this.factor = null;
9393          else {
9394            if (this.factor == null)
9395              this.factor = new DecimalType();
9396            this.factor.setValue(value);
9397          }
9398          return this;
9399        }
9400
9401        /**
9402         * @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.
9403         */
9404        public AddedItemDetailComponent setFactor(long value) { 
9405              this.factor = new DecimalType();
9406            this.factor.setValue(value);
9407          return this;
9408        }
9409
9410        /**
9411         * @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.
9412         */
9413        public AddedItemDetailComponent setFactor(double value) { 
9414              this.factor = new DecimalType();
9415            this.factor.setValue(value);
9416          return this;
9417        }
9418
9419        /**
9420         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9421         */
9422        public Money getNet() { 
9423          if (this.net == null)
9424            if (Configuration.errorOnAutoCreate())
9425              throw new Error("Attempt to auto-create AddedItemDetailComponent.net");
9426            else if (Configuration.doAutoCreate())
9427              this.net = new Money(); // cc
9428          return this.net;
9429        }
9430
9431        public boolean hasNet() { 
9432          return this.net != null && !this.net.isEmpty();
9433        }
9434
9435        /**
9436         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9437         */
9438        public AddedItemDetailComponent setNet(Money value) { 
9439          this.net = value;
9440          return this;
9441        }
9442
9443        /**
9444         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9445         */
9446        public List<PositiveIntType> getNoteNumber() { 
9447          if (this.noteNumber == null)
9448            this.noteNumber = new ArrayList<PositiveIntType>();
9449          return this.noteNumber;
9450        }
9451
9452        /**
9453         * @return Returns a reference to <code>this</code> for easy method chaining
9454         */
9455        public AddedItemDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
9456          this.noteNumber = theNoteNumber;
9457          return this;
9458        }
9459
9460        public boolean hasNoteNumber() { 
9461          if (this.noteNumber == null)
9462            return false;
9463          for (PositiveIntType item : this.noteNumber)
9464            if (!item.isEmpty())
9465              return true;
9466          return false;
9467        }
9468
9469        /**
9470         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9471         */
9472        public PositiveIntType addNoteNumberElement() {//2 
9473          PositiveIntType t = new PositiveIntType();
9474          if (this.noteNumber == null)
9475            this.noteNumber = new ArrayList<PositiveIntType>();
9476          this.noteNumber.add(t);
9477          return t;
9478        }
9479
9480        /**
9481         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9482         */
9483        public AddedItemDetailComponent addNoteNumber(int value) { //1
9484          PositiveIntType t = new PositiveIntType();
9485          t.setValue(value);
9486          if (this.noteNumber == null)
9487            this.noteNumber = new ArrayList<PositiveIntType>();
9488          this.noteNumber.add(t);
9489          return this;
9490        }
9491
9492        /**
9493         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9494         */
9495        public boolean hasNoteNumber(int value) { 
9496          if (this.noteNumber == null)
9497            return false;
9498          for (PositiveIntType v : this.noteNumber)
9499            if (v.getValue().equals(value)) // positiveInt
9500              return true;
9501          return false;
9502        }
9503
9504        /**
9505         * @return {@link #adjudication} (The adjudication results.)
9506         */
9507        public List<AdjudicationComponent> getAdjudication() { 
9508          if (this.adjudication == null)
9509            this.adjudication = new ArrayList<AdjudicationComponent>();
9510          return this.adjudication;
9511        }
9512
9513        /**
9514         * @return Returns a reference to <code>this</code> for easy method chaining
9515         */
9516        public AddedItemDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
9517          this.adjudication = theAdjudication;
9518          return this;
9519        }
9520
9521        public boolean hasAdjudication() { 
9522          if (this.adjudication == null)
9523            return false;
9524          for (AdjudicationComponent item : this.adjudication)
9525            if (!item.isEmpty())
9526              return true;
9527          return false;
9528        }
9529
9530        public AdjudicationComponent addAdjudication() { //3
9531          AdjudicationComponent t = new AdjudicationComponent();
9532          if (this.adjudication == null)
9533            this.adjudication = new ArrayList<AdjudicationComponent>();
9534          this.adjudication.add(t);
9535          return t;
9536        }
9537
9538        public AddedItemDetailComponent addAdjudication(AdjudicationComponent t) { //3
9539          if (t == null)
9540            return this;
9541          if (this.adjudication == null)
9542            this.adjudication = new ArrayList<AdjudicationComponent>();
9543          this.adjudication.add(t);
9544          return this;
9545        }
9546
9547        /**
9548         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
9549         */
9550        public AdjudicationComponent getAdjudicationFirstRep() { 
9551          if (getAdjudication().isEmpty()) {
9552            addAdjudication();
9553          }
9554          return getAdjudication().get(0);
9555        }
9556
9557        /**
9558         * @return {@link #subDetail} (The third-tier service adjudications for payor added services.)
9559         */
9560        public List<AddedItemDetailSubDetailComponent> getSubDetail() { 
9561          if (this.subDetail == null)
9562            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9563          return this.subDetail;
9564        }
9565
9566        /**
9567         * @return Returns a reference to <code>this</code> for easy method chaining
9568         */
9569        public AddedItemDetailComponent setSubDetail(List<AddedItemDetailSubDetailComponent> theSubDetail) { 
9570          this.subDetail = theSubDetail;
9571          return this;
9572        }
9573
9574        public boolean hasSubDetail() { 
9575          if (this.subDetail == null)
9576            return false;
9577          for (AddedItemDetailSubDetailComponent item : this.subDetail)
9578            if (!item.isEmpty())
9579              return true;
9580          return false;
9581        }
9582
9583        public AddedItemDetailSubDetailComponent addSubDetail() { //3
9584          AddedItemDetailSubDetailComponent t = new AddedItemDetailSubDetailComponent();
9585          if (this.subDetail == null)
9586            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9587          this.subDetail.add(t);
9588          return t;
9589        }
9590
9591        public AddedItemDetailComponent addSubDetail(AddedItemDetailSubDetailComponent t) { //3
9592          if (t == null)
9593            return this;
9594          if (this.subDetail == null)
9595            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9596          this.subDetail.add(t);
9597          return this;
9598        }
9599
9600        /**
9601         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist
9602         */
9603        public AddedItemDetailSubDetailComponent getSubDetailFirstRep() { 
9604          if (getSubDetail().isEmpty()) {
9605            addSubDetail();
9606          }
9607          return getSubDetail().get(0);
9608        }
9609
9610        protected void listChildren(List<Property> children) {
9611          super.listChildren(children);
9612          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));
9613          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));
9614          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
9615          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));
9616          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));
9617          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
9618          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));
9619          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
9620          children.add(new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
9621        }
9622
9623        @Override
9624        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9625          switch (_hash) {
9626          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);
9627          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);
9628          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
9629          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);
9630          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);
9631          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);
9632          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);
9633          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
9634          case -828829007: /*subDetail*/  return new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
9635          default: return super.getNamedProperty(_hash, _name, _checkValid);
9636          }
9637
9638        }
9639
9640      @Override
9641      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9642        switch (hash) {
9643        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
9644        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
9645        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
9646        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
9647        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
9648        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
9649        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
9650        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
9651        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // AddedItemDetailSubDetailComponent
9652        default: return super.getProperty(hash, name, checkValid);
9653        }
9654
9655      }
9656
9657      @Override
9658      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9659        switch (hash) {
9660        case 1957227299: // productOrService
9661          this.productOrService = castToCodeableConcept(value); // CodeableConcept
9662          return value;
9663        case -615513385: // modifier
9664          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
9665          return value;
9666        case -1285004149: // quantity
9667          this.quantity = castToQuantity(value); // Quantity
9668          return value;
9669        case -486196699: // unitPrice
9670          this.unitPrice = castToMoney(value); // Money
9671          return value;
9672        case -1282148017: // factor
9673          this.factor = castToDecimal(value); // DecimalType
9674          return value;
9675        case 108957: // net
9676          this.net = castToMoney(value); // Money
9677          return value;
9678        case -1110033957: // noteNumber
9679          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
9680          return value;
9681        case -231349275: // adjudication
9682          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
9683          return value;
9684        case -828829007: // subDetail
9685          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value); // AddedItemDetailSubDetailComponent
9686          return value;
9687        default: return super.setProperty(hash, name, value);
9688        }
9689
9690      }
9691
9692      @Override
9693      public Base setProperty(String name, Base value) throws FHIRException {
9694        if (name.equals("productOrService")) {
9695          this.productOrService = castToCodeableConcept(value); // CodeableConcept
9696        } else if (name.equals("modifier")) {
9697          this.getModifier().add(castToCodeableConcept(value));
9698        } else if (name.equals("quantity")) {
9699          this.quantity = castToQuantity(value); // Quantity
9700        } else if (name.equals("unitPrice")) {
9701          this.unitPrice = castToMoney(value); // Money
9702        } else if (name.equals("factor")) {
9703          this.factor = castToDecimal(value); // DecimalType
9704        } else if (name.equals("net")) {
9705          this.net = castToMoney(value); // Money
9706        } else if (name.equals("noteNumber")) {
9707          this.getNoteNumber().add(castToPositiveInt(value));
9708        } else if (name.equals("adjudication")) {
9709          this.getAdjudication().add((AdjudicationComponent) value);
9710        } else if (name.equals("subDetail")) {
9711          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value);
9712        } else
9713          return super.setProperty(name, value);
9714        return value;
9715      }
9716
9717      @Override
9718      public Base makeProperty(int hash, String name) throws FHIRException {
9719        switch (hash) {
9720        case 1957227299:  return getProductOrService(); 
9721        case -615513385:  return addModifier(); 
9722        case -1285004149:  return getQuantity(); 
9723        case -486196699:  return getUnitPrice(); 
9724        case -1282148017:  return getFactorElement();
9725        case 108957:  return getNet(); 
9726        case -1110033957:  return addNoteNumberElement();
9727        case -231349275:  return addAdjudication(); 
9728        case -828829007:  return addSubDetail(); 
9729        default: return super.makeProperty(hash, name);
9730        }
9731
9732      }
9733
9734      @Override
9735      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9736        switch (hash) {
9737        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
9738        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
9739        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
9740        case -486196699: /*unitPrice*/ return new String[] {"Money"};
9741        case -1282148017: /*factor*/ return new String[] {"decimal"};
9742        case 108957: /*net*/ return new String[] {"Money"};
9743        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
9744        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
9745        case -828829007: /*subDetail*/ return new String[] {};
9746        default: return super.getTypesForProperty(hash, name);
9747        }
9748
9749      }
9750
9751      @Override
9752      public Base addChild(String name) throws FHIRException {
9753        if (name.equals("productOrService")) {
9754          this.productOrService = new CodeableConcept();
9755          return this.productOrService;
9756        }
9757        else if (name.equals("modifier")) {
9758          return addModifier();
9759        }
9760        else if (name.equals("quantity")) {
9761          this.quantity = new Quantity();
9762          return this.quantity;
9763        }
9764        else if (name.equals("unitPrice")) {
9765          this.unitPrice = new Money();
9766          return this.unitPrice;
9767        }
9768        else if (name.equals("factor")) {
9769          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
9770        }
9771        else if (name.equals("net")) {
9772          this.net = new Money();
9773          return this.net;
9774        }
9775        else if (name.equals("noteNumber")) {
9776          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
9777        }
9778        else if (name.equals("adjudication")) {
9779          return addAdjudication();
9780        }
9781        else if (name.equals("subDetail")) {
9782          return addSubDetail();
9783        }
9784        else
9785          return super.addChild(name);
9786      }
9787
9788      public AddedItemDetailComponent copy() {
9789        AddedItemDetailComponent dst = new AddedItemDetailComponent();
9790        copyValues(dst);
9791        dst.productOrService = productOrService == null ? null : productOrService.copy();
9792        if (modifier != null) {
9793          dst.modifier = new ArrayList<CodeableConcept>();
9794          for (CodeableConcept i : modifier)
9795            dst.modifier.add(i.copy());
9796        };
9797        dst.quantity = quantity == null ? null : quantity.copy();
9798        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
9799        dst.factor = factor == null ? null : factor.copy();
9800        dst.net = net == null ? null : net.copy();
9801        if (noteNumber != null) {
9802          dst.noteNumber = new ArrayList<PositiveIntType>();
9803          for (PositiveIntType i : noteNumber)
9804            dst.noteNumber.add(i.copy());
9805        };
9806        if (adjudication != null) {
9807          dst.adjudication = new ArrayList<AdjudicationComponent>();
9808          for (AdjudicationComponent i : adjudication)
9809            dst.adjudication.add(i.copy());
9810        };
9811        if (subDetail != null) {
9812          dst.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9813          for (AddedItemDetailSubDetailComponent i : subDetail)
9814            dst.subDetail.add(i.copy());
9815        };
9816        return dst;
9817      }
9818
9819      @Override
9820      public boolean equalsDeep(Base other_) {
9821        if (!super.equalsDeep(other_))
9822          return false;
9823        if (!(other_ instanceof AddedItemDetailComponent))
9824          return false;
9825        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
9826        return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
9827           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
9828           && compareDeep(net, o.net, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
9829           && compareDeep(subDetail, o.subDetail, true);
9830      }
9831
9832      @Override
9833      public boolean equalsShallow(Base other_) {
9834        if (!super.equalsShallow(other_))
9835          return false;
9836        if (!(other_ instanceof AddedItemDetailComponent))
9837          return false;
9838        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
9839        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
9840      }
9841
9842      public boolean isEmpty() {
9843        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier
9844          , quantity, unitPrice, factor, net, noteNumber, adjudication, subDetail);
9845      }
9846
9847  public String fhirType() {
9848    return "ExplanationOfBenefit.addItem.detail";
9849
9850  }
9851
9852  }
9853
9854    @Block()
9855    public static class AddedItemDetailSubDetailComponent extends BackboneElement implements IBaseBackboneElement {
9856        /**
9857         * 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.
9858         */
9859        @Child(name = "productOrService", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9860        @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." )
9861        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
9862        protected CodeableConcept productOrService;
9863
9864        /**
9865         * Item typification or modifiers codes to convey additional context for the product or service.
9866         */
9867        @Child(name = "modifier", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9868        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
9869        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
9870        protected List<CodeableConcept> modifier;
9871
9872        /**
9873         * The number of repetitions of a service or product.
9874         */
9875        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
9876        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
9877        protected Quantity quantity;
9878
9879        /**
9880         * 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.
9881         */
9882        @Child(name = "unitPrice", type = {Money.class}, order=4, min=0, max=1, modifier=false, summary=false)
9883        @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." )
9884        protected Money unitPrice;
9885
9886        /**
9887         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
9888         */
9889        @Child(name = "factor", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=false)
9890        @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." )
9891        protected DecimalType factor;
9892
9893        /**
9894         * The quantity times the unit price for an additional service or product or charge.
9895         */
9896        @Child(name = "net", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
9897        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
9898        protected Money net;
9899
9900        /**
9901         * The numbers associated with notes below which apply to the adjudication of this item.
9902         */
9903        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9904        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
9905        protected List<PositiveIntType> noteNumber;
9906
9907        /**
9908         * The adjudication results.
9909         */
9910        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9911        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
9912        protected List<AdjudicationComponent> adjudication;
9913
9914        private static final long serialVersionUID = 1301363592L;
9915
9916    /**
9917     * Constructor
9918     */
9919      public AddedItemDetailSubDetailComponent() {
9920        super();
9921      }
9922
9923    /**
9924     * Constructor
9925     */
9926      public AddedItemDetailSubDetailComponent(CodeableConcept productOrService) {
9927        super();
9928        this.productOrService = productOrService;
9929      }
9930
9931        /**
9932         * @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.)
9933         */
9934        public CodeableConcept getProductOrService() { 
9935          if (this.productOrService == null)
9936            if (Configuration.errorOnAutoCreate())
9937              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.productOrService");
9938            else if (Configuration.doAutoCreate())
9939              this.productOrService = new CodeableConcept(); // cc
9940          return this.productOrService;
9941        }
9942
9943        public boolean hasProductOrService() { 
9944          return this.productOrService != null && !this.productOrService.isEmpty();
9945        }
9946
9947        /**
9948         * @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.)
9949         */
9950        public AddedItemDetailSubDetailComponent setProductOrService(CodeableConcept value) { 
9951          this.productOrService = value;
9952          return this;
9953        }
9954
9955        /**
9956         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
9957         */
9958        public List<CodeableConcept> getModifier() { 
9959          if (this.modifier == null)
9960            this.modifier = new ArrayList<CodeableConcept>();
9961          return this.modifier;
9962        }
9963
9964        /**
9965         * @return Returns a reference to <code>this</code> for easy method chaining
9966         */
9967        public AddedItemDetailSubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
9968          this.modifier = theModifier;
9969          return this;
9970        }
9971
9972        public boolean hasModifier() { 
9973          if (this.modifier == null)
9974            return false;
9975          for (CodeableConcept item : this.modifier)
9976            if (!item.isEmpty())
9977              return true;
9978          return false;
9979        }
9980
9981        public CodeableConcept addModifier() { //3
9982          CodeableConcept t = new CodeableConcept();
9983          if (this.modifier == null)
9984            this.modifier = new ArrayList<CodeableConcept>();
9985          this.modifier.add(t);
9986          return t;
9987        }
9988
9989        public AddedItemDetailSubDetailComponent addModifier(CodeableConcept t) { //3
9990          if (t == null)
9991            return this;
9992          if (this.modifier == null)
9993            this.modifier = new ArrayList<CodeableConcept>();
9994          this.modifier.add(t);
9995          return this;
9996        }
9997
9998        /**
9999         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
10000         */
10001        public CodeableConcept getModifierFirstRep() { 
10002          if (getModifier().isEmpty()) {
10003            addModifier();
10004          }
10005          return getModifier().get(0);
10006        }
10007
10008        /**
10009         * @return {@link #quantity} (The number of repetitions of a service or product.)
10010         */
10011        public Quantity getQuantity() { 
10012          if (this.quantity == null)
10013            if (Configuration.errorOnAutoCreate())
10014              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.quantity");
10015            else if (Configuration.doAutoCreate())
10016              this.quantity = new Quantity(); // cc
10017          return this.quantity;
10018        }
10019
10020        public boolean hasQuantity() { 
10021          return this.quantity != null && !this.quantity.isEmpty();
10022        }
10023
10024        /**
10025         * @param value {@link #quantity} (The number of repetitions of a service or product.)
10026         */
10027        public AddedItemDetailSubDetailComponent setQuantity(Quantity value) { 
10028          this.quantity = value;
10029          return this;
10030        }
10031
10032        /**
10033         * @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.)
10034         */
10035        public Money getUnitPrice() { 
10036          if (this.unitPrice == null)
10037            if (Configuration.errorOnAutoCreate())
10038              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.unitPrice");
10039            else if (Configuration.doAutoCreate())
10040              this.unitPrice = new Money(); // cc
10041          return this.unitPrice;
10042        }
10043
10044        public boolean hasUnitPrice() { 
10045          return this.unitPrice != null && !this.unitPrice.isEmpty();
10046        }
10047
10048        /**
10049         * @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.)
10050         */
10051        public AddedItemDetailSubDetailComponent setUnitPrice(Money value) { 
10052          this.unitPrice = value;
10053          return this;
10054        }
10055
10056        /**
10057         * @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
10058         */
10059        public DecimalType getFactorElement() { 
10060          if (this.factor == null)
10061            if (Configuration.errorOnAutoCreate())
10062              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.factor");
10063            else if (Configuration.doAutoCreate())
10064              this.factor = new DecimalType(); // bb
10065          return this.factor;
10066        }
10067
10068        public boolean hasFactorElement() { 
10069          return this.factor != null && !this.factor.isEmpty();
10070        }
10071
10072        public boolean hasFactor() { 
10073          return this.factor != null && !this.factor.isEmpty();
10074        }
10075
10076        /**
10077         * @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
10078         */
10079        public AddedItemDetailSubDetailComponent setFactorElement(DecimalType value) { 
10080          this.factor = value;
10081          return this;
10082        }
10083
10084        /**
10085         * @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.
10086         */
10087        public BigDecimal getFactor() { 
10088          return this.factor == null ? null : this.factor.getValue();
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(BigDecimal value) { 
10095          if (value == null)
10096            this.factor = null;
10097          else {
10098            if (this.factor == null)
10099              this.factor = new DecimalType();
10100            this.factor.setValue(value);
10101          }
10102          return this;
10103        }
10104
10105        /**
10106         * @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.
10107         */
10108        public AddedItemDetailSubDetailComponent setFactor(long value) { 
10109              this.factor = new DecimalType();
10110            this.factor.setValue(value);
10111          return this;
10112        }
10113
10114        /**
10115         * @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.
10116         */
10117        public AddedItemDetailSubDetailComponent setFactor(double value) { 
10118              this.factor = new DecimalType();
10119            this.factor.setValue(value);
10120          return this;
10121        }
10122
10123        /**
10124         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
10125         */
10126        public Money getNet() { 
10127          if (this.net == null)
10128            if (Configuration.errorOnAutoCreate())
10129              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.net");
10130            else if (Configuration.doAutoCreate())
10131              this.net = new Money(); // cc
10132          return this.net;
10133        }
10134
10135        public boolean hasNet() { 
10136          return this.net != null && !this.net.isEmpty();
10137        }
10138
10139        /**
10140         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
10141         */
10142        public AddedItemDetailSubDetailComponent setNet(Money value) { 
10143          this.net = value;
10144          return this;
10145        }
10146
10147        /**
10148         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10149         */
10150        public List<PositiveIntType> getNoteNumber() { 
10151          if (this.noteNumber == null)
10152            this.noteNumber = new ArrayList<PositiveIntType>();
10153          return this.noteNumber;
10154        }
10155
10156        /**
10157         * @return Returns a reference to <code>this</code> for easy method chaining
10158         */
10159        public AddedItemDetailSubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
10160          this.noteNumber = theNoteNumber;
10161          return this;
10162        }
10163
10164        public boolean hasNoteNumber() { 
10165          if (this.noteNumber == null)
10166            return false;
10167          for (PositiveIntType item : this.noteNumber)
10168            if (!item.isEmpty())
10169              return true;
10170          return false;
10171        }
10172
10173        /**
10174         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10175         */
10176        public PositiveIntType addNoteNumberElement() {//2 
10177          PositiveIntType t = new PositiveIntType();
10178          if (this.noteNumber == null)
10179            this.noteNumber = new ArrayList<PositiveIntType>();
10180          this.noteNumber.add(t);
10181          return t;
10182        }
10183
10184        /**
10185         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10186         */
10187        public AddedItemDetailSubDetailComponent addNoteNumber(int value) { //1
10188          PositiveIntType t = new PositiveIntType();
10189          t.setValue(value);
10190          if (this.noteNumber == null)
10191            this.noteNumber = new ArrayList<PositiveIntType>();
10192          this.noteNumber.add(t);
10193          return this;
10194        }
10195
10196        /**
10197         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10198         */
10199        public boolean hasNoteNumber(int value) { 
10200          if (this.noteNumber == null)
10201            return false;
10202          for (PositiveIntType v : this.noteNumber)
10203            if (v.getValue().equals(value)) // positiveInt
10204              return true;
10205          return false;
10206        }
10207
10208        /**
10209         * @return {@link #adjudication} (The adjudication results.)
10210         */
10211        public List<AdjudicationComponent> getAdjudication() { 
10212          if (this.adjudication == null)
10213            this.adjudication = new ArrayList<AdjudicationComponent>();
10214          return this.adjudication;
10215        }
10216
10217        /**
10218         * @return Returns a reference to <code>this</code> for easy method chaining
10219         */
10220        public AddedItemDetailSubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
10221          this.adjudication = theAdjudication;
10222          return this;
10223        }
10224
10225        public boolean hasAdjudication() { 
10226          if (this.adjudication == null)
10227            return false;
10228          for (AdjudicationComponent item : this.adjudication)
10229            if (!item.isEmpty())
10230              return true;
10231          return false;
10232        }
10233
10234        public AdjudicationComponent addAdjudication() { //3
10235          AdjudicationComponent t = new AdjudicationComponent();
10236          if (this.adjudication == null)
10237            this.adjudication = new ArrayList<AdjudicationComponent>();
10238          this.adjudication.add(t);
10239          return t;
10240        }
10241
10242        public AddedItemDetailSubDetailComponent addAdjudication(AdjudicationComponent t) { //3
10243          if (t == null)
10244            return this;
10245          if (this.adjudication == null)
10246            this.adjudication = new ArrayList<AdjudicationComponent>();
10247          this.adjudication.add(t);
10248          return this;
10249        }
10250
10251        /**
10252         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
10253         */
10254        public AdjudicationComponent getAdjudicationFirstRep() { 
10255          if (getAdjudication().isEmpty()) {
10256            addAdjudication();
10257          }
10258          return getAdjudication().get(0);
10259        }
10260
10261        protected void listChildren(List<Property> children) {
10262          super.listChildren(children);
10263          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));
10264          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));
10265          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
10266          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));
10267          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));
10268          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
10269          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));
10270          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
10271        }
10272
10273        @Override
10274        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10275          switch (_hash) {
10276          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);
10277          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);
10278          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
10279          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);
10280          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);
10281          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);
10282          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);
10283          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
10284          default: return super.getNamedProperty(_hash, _name, _checkValid);
10285          }
10286
10287        }
10288
10289      @Override
10290      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10291        switch (hash) {
10292        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
10293        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
10294        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
10295        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
10296        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
10297        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
10298        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
10299        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
10300        default: return super.getProperty(hash, name, checkValid);
10301        }
10302
10303      }
10304
10305      @Override
10306      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10307        switch (hash) {
10308        case 1957227299: // productOrService
10309          this.productOrService = castToCodeableConcept(value); // CodeableConcept
10310          return value;
10311        case -615513385: // modifier
10312          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
10313          return value;
10314        case -1285004149: // quantity
10315          this.quantity = castToQuantity(value); // Quantity
10316          return value;
10317        case -486196699: // unitPrice
10318          this.unitPrice = castToMoney(value); // Money
10319          return value;
10320        case -1282148017: // factor
10321          this.factor = castToDecimal(value); // DecimalType
10322          return value;
10323        case 108957: // net
10324          this.net = castToMoney(value); // Money
10325          return value;
10326        case -1110033957: // noteNumber
10327          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
10328          return value;
10329        case -231349275: // adjudication
10330          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
10331          return value;
10332        default: return super.setProperty(hash, name, value);
10333        }
10334
10335      }
10336
10337      @Override
10338      public Base setProperty(String name, Base value) throws FHIRException {
10339        if (name.equals("productOrService")) {
10340          this.productOrService = castToCodeableConcept(value); // CodeableConcept
10341        } else if (name.equals("modifier")) {
10342          this.getModifier().add(castToCodeableConcept(value));
10343        } else if (name.equals("quantity")) {
10344          this.quantity = castToQuantity(value); // Quantity
10345        } else if (name.equals("unitPrice")) {
10346          this.unitPrice = castToMoney(value); // Money
10347        } else if (name.equals("factor")) {
10348          this.factor = castToDecimal(value); // DecimalType
10349        } else if (name.equals("net")) {
10350          this.net = castToMoney(value); // Money
10351        } else if (name.equals("noteNumber")) {
10352          this.getNoteNumber().add(castToPositiveInt(value));
10353        } else if (name.equals("adjudication")) {
10354          this.getAdjudication().add((AdjudicationComponent) value);
10355        } else
10356          return super.setProperty(name, value);
10357        return value;
10358      }
10359
10360      @Override
10361      public Base makeProperty(int hash, String name) throws FHIRException {
10362        switch (hash) {
10363        case 1957227299:  return getProductOrService(); 
10364        case -615513385:  return addModifier(); 
10365        case -1285004149:  return getQuantity(); 
10366        case -486196699:  return getUnitPrice(); 
10367        case -1282148017:  return getFactorElement();
10368        case 108957:  return getNet(); 
10369        case -1110033957:  return addNoteNumberElement();
10370        case -231349275:  return addAdjudication(); 
10371        default: return super.makeProperty(hash, name);
10372        }
10373
10374      }
10375
10376      @Override
10377      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10378        switch (hash) {
10379        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
10380        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
10381        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
10382        case -486196699: /*unitPrice*/ return new String[] {"Money"};
10383        case -1282148017: /*factor*/ return new String[] {"decimal"};
10384        case 108957: /*net*/ return new String[] {"Money"};
10385        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
10386        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
10387        default: return super.getTypesForProperty(hash, name);
10388        }
10389
10390      }
10391
10392      @Override
10393      public Base addChild(String name) throws FHIRException {
10394        if (name.equals("productOrService")) {
10395          this.productOrService = new CodeableConcept();
10396          return this.productOrService;
10397        }
10398        else if (name.equals("modifier")) {
10399          return addModifier();
10400        }
10401        else if (name.equals("quantity")) {
10402          this.quantity = new Quantity();
10403          return this.quantity;
10404        }
10405        else if (name.equals("unitPrice")) {
10406          this.unitPrice = new Money();
10407          return this.unitPrice;
10408        }
10409        else if (name.equals("factor")) {
10410          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
10411        }
10412        else if (name.equals("net")) {
10413          this.net = new Money();
10414          return this.net;
10415        }
10416        else if (name.equals("noteNumber")) {
10417          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
10418        }
10419        else if (name.equals("adjudication")) {
10420          return addAdjudication();
10421        }
10422        else
10423          return super.addChild(name);
10424      }
10425
10426      public AddedItemDetailSubDetailComponent copy() {
10427        AddedItemDetailSubDetailComponent dst = new AddedItemDetailSubDetailComponent();
10428        copyValues(dst);
10429        dst.productOrService = productOrService == null ? null : productOrService.copy();
10430        if (modifier != null) {
10431          dst.modifier = new ArrayList<CodeableConcept>();
10432          for (CodeableConcept i : modifier)
10433            dst.modifier.add(i.copy());
10434        };
10435        dst.quantity = quantity == null ? null : quantity.copy();
10436        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
10437        dst.factor = factor == null ? null : factor.copy();
10438        dst.net = net == null ? null : net.copy();
10439        if (noteNumber != null) {
10440          dst.noteNumber = new ArrayList<PositiveIntType>();
10441          for (PositiveIntType i : noteNumber)
10442            dst.noteNumber.add(i.copy());
10443        };
10444        if (adjudication != null) {
10445          dst.adjudication = new ArrayList<AdjudicationComponent>();
10446          for (AdjudicationComponent i : adjudication)
10447            dst.adjudication.add(i.copy());
10448        };
10449        return dst;
10450      }
10451
10452      @Override
10453      public boolean equalsDeep(Base other_) {
10454        if (!super.equalsDeep(other_))
10455          return false;
10456        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
10457          return false;
10458        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
10459        return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
10460           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
10461           && compareDeep(net, o.net, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
10462          ;
10463      }
10464
10465      @Override
10466      public boolean equalsShallow(Base other_) {
10467        if (!super.equalsShallow(other_))
10468          return false;
10469        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
10470          return false;
10471        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
10472        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
10473      }
10474
10475      public boolean isEmpty() {
10476        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier
10477          , quantity, unitPrice, factor, net, noteNumber, adjudication);
10478      }
10479
10480  public String fhirType() {
10481    return "ExplanationOfBenefit.addItem.detail.subDetail";
10482
10483  }
10484
10485  }
10486
10487    @Block()
10488    public static class TotalComponent extends BackboneElement implements IBaseBackboneElement {
10489        /**
10490         * 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.
10491         */
10492        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
10493        @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." )
10494        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
10495        protected CodeableConcept category;
10496
10497        /**
10498         * Monetary total amount associated with the category.
10499         */
10500        @Child(name = "amount", type = {Money.class}, order=2, min=1, max=1, modifier=false, summary=true)
10501        @Description(shortDefinition="Financial total for the category", formalDefinition="Monetary total amount associated with the category." )
10502        protected Money amount;
10503
10504        private static final long serialVersionUID = 2012310309L;
10505
10506    /**
10507     * Constructor
10508     */
10509      public TotalComponent() {
10510        super();
10511      }
10512
10513    /**
10514     * Constructor
10515     */
10516      public TotalComponent(CodeableConcept category, Money amount) {
10517        super();
10518        this.category = category;
10519        this.amount = amount;
10520      }
10521
10522        /**
10523         * @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.)
10524         */
10525        public CodeableConcept getCategory() { 
10526          if (this.category == null)
10527            if (Configuration.errorOnAutoCreate())
10528              throw new Error("Attempt to auto-create TotalComponent.category");
10529            else if (Configuration.doAutoCreate())
10530              this.category = new CodeableConcept(); // cc
10531          return this.category;
10532        }
10533
10534        public boolean hasCategory() { 
10535          return this.category != null && !this.category.isEmpty();
10536        }
10537
10538        /**
10539         * @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.)
10540         */
10541        public TotalComponent setCategory(CodeableConcept value) { 
10542          this.category = value;
10543          return this;
10544        }
10545
10546        /**
10547         * @return {@link #amount} (Monetary total amount associated with the category.)
10548         */
10549        public Money getAmount() { 
10550          if (this.amount == null)
10551            if (Configuration.errorOnAutoCreate())
10552              throw new Error("Attempt to auto-create TotalComponent.amount");
10553            else if (Configuration.doAutoCreate())
10554              this.amount = new Money(); // cc
10555          return this.amount;
10556        }
10557
10558        public boolean hasAmount() { 
10559          return this.amount != null && !this.amount.isEmpty();
10560        }
10561
10562        /**
10563         * @param value {@link #amount} (Monetary total amount associated with the category.)
10564         */
10565        public TotalComponent setAmount(Money value) { 
10566          this.amount = value;
10567          return this;
10568        }
10569
10570        protected void listChildren(List<Property> children) {
10571          super.listChildren(children);
10572          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));
10573          children.add(new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount));
10574        }
10575
10576        @Override
10577        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10578          switch (_hash) {
10579          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);
10580          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount);
10581          default: return super.getNamedProperty(_hash, _name, _checkValid);
10582          }
10583
10584        }
10585
10586      @Override
10587      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10588        switch (hash) {
10589        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
10590        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
10591        default: return super.getProperty(hash, name, checkValid);
10592        }
10593
10594      }
10595
10596      @Override
10597      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10598        switch (hash) {
10599        case 50511102: // category
10600          this.category = castToCodeableConcept(value); // CodeableConcept
10601          return value;
10602        case -1413853096: // amount
10603          this.amount = castToMoney(value); // Money
10604          return value;
10605        default: return super.setProperty(hash, name, value);
10606        }
10607
10608      }
10609
10610      @Override
10611      public Base setProperty(String name, Base value) throws FHIRException {
10612        if (name.equals("category")) {
10613          this.category = castToCodeableConcept(value); // CodeableConcept
10614        } else if (name.equals("amount")) {
10615          this.amount = castToMoney(value); // Money
10616        } else
10617          return super.setProperty(name, value);
10618        return value;
10619      }
10620
10621      @Override
10622      public Base makeProperty(int hash, String name) throws FHIRException {
10623        switch (hash) {
10624        case 50511102:  return getCategory(); 
10625        case -1413853096:  return getAmount(); 
10626        default: return super.makeProperty(hash, name);
10627        }
10628
10629      }
10630
10631      @Override
10632      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10633        switch (hash) {
10634        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
10635        case -1413853096: /*amount*/ return new String[] {"Money"};
10636        default: return super.getTypesForProperty(hash, name);
10637        }
10638
10639      }
10640
10641      @Override
10642      public Base addChild(String name) throws FHIRException {
10643        if (name.equals("category")) {
10644          this.category = new CodeableConcept();
10645          return this.category;
10646        }
10647        else if (name.equals("amount")) {
10648          this.amount = new Money();
10649          return this.amount;
10650        }
10651        else
10652          return super.addChild(name);
10653      }
10654
10655      public TotalComponent copy() {
10656        TotalComponent dst = new TotalComponent();
10657        copyValues(dst);
10658        dst.category = category == null ? null : category.copy();
10659        dst.amount = amount == null ? null : amount.copy();
10660        return dst;
10661      }
10662
10663      @Override
10664      public boolean equalsDeep(Base other_) {
10665        if (!super.equalsDeep(other_))
10666          return false;
10667        if (!(other_ instanceof TotalComponent))
10668          return false;
10669        TotalComponent o = (TotalComponent) other_;
10670        return compareDeep(category, o.category, true) && compareDeep(amount, o.amount, true);
10671      }
10672
10673      @Override
10674      public boolean equalsShallow(Base other_) {
10675        if (!super.equalsShallow(other_))
10676          return false;
10677        if (!(other_ instanceof TotalComponent))
10678          return false;
10679        TotalComponent o = (TotalComponent) other_;
10680        return true;
10681      }
10682
10683      public boolean isEmpty() {
10684        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, amount);
10685      }
10686
10687  public String fhirType() {
10688    return "ExplanationOfBenefit.total";
10689
10690  }
10691
10692  }
10693
10694    @Block()
10695    public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
10696        /**
10697         * Whether this represents partial or complete payment of the benefits payable.
10698         */
10699        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
10700        @Description(shortDefinition="Partial or complete payment", formalDefinition="Whether this represents partial or complete payment of the benefits payable." )
10701        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-paymenttype")
10702        protected CodeableConcept type;
10703
10704        /**
10705         * Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.
10706         */
10707        @Child(name = "adjustment", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
10708        @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." )
10709        protected Money adjustment;
10710
10711        /**
10712         * Reason for the payment adjustment.
10713         */
10714        @Child(name = "adjustmentReason", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
10715        @Description(shortDefinition="Explanation for the variance", formalDefinition="Reason for the payment adjustment." )
10716        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
10717        protected CodeableConcept adjustmentReason;
10718
10719        /**
10720         * Estimated date the payment will be issued or the actual issue date of payment.
10721         */
10722        @Child(name = "date", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=false)
10723        @Description(shortDefinition="Expected date of payment", formalDefinition="Estimated date the payment will be issued or the actual issue date of payment." )
10724        protected DateType date;
10725
10726        /**
10727         * Benefits payable less any payment adjustment.
10728         */
10729        @Child(name = "amount", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
10730        @Description(shortDefinition="Payable amount after adjustment", formalDefinition="Benefits payable less any payment adjustment." )
10731        protected Money amount;
10732
10733        /**
10734         * Issuer's unique identifier for the payment instrument.
10735         */
10736        @Child(name = "identifier", type = {Identifier.class}, order=6, min=0, max=1, modifier=false, summary=false)
10737        @Description(shortDefinition="Business identifier for the payment", formalDefinition="Issuer's unique identifier for the payment instrument." )
10738        protected Identifier identifier;
10739
10740        private static final long serialVersionUID = 1539906026L;
10741
10742    /**
10743     * Constructor
10744     */
10745      public PaymentComponent() {
10746        super();
10747      }
10748
10749        /**
10750         * @return {@link #type} (Whether this represents partial or complete payment of the benefits payable.)
10751         */
10752        public CodeableConcept getType() { 
10753          if (this.type == null)
10754            if (Configuration.errorOnAutoCreate())
10755              throw new Error("Attempt to auto-create PaymentComponent.type");
10756            else if (Configuration.doAutoCreate())
10757              this.type = new CodeableConcept(); // cc
10758          return this.type;
10759        }
10760
10761        public boolean hasType() { 
10762          return this.type != null && !this.type.isEmpty();
10763        }
10764
10765        /**
10766         * @param value {@link #type} (Whether this represents partial or complete payment of the benefits payable.)
10767         */
10768        public PaymentComponent setType(CodeableConcept value) { 
10769          this.type = value;
10770          return this;
10771        }
10772
10773        /**
10774         * @return {@link #adjustment} (Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.)
10775         */
10776        public Money getAdjustment() { 
10777          if (this.adjustment == null)
10778            if (Configuration.errorOnAutoCreate())
10779              throw new Error("Attempt to auto-create PaymentComponent.adjustment");
10780            else if (Configuration.doAutoCreate())
10781              this.adjustment = new Money(); // cc
10782          return this.adjustment;
10783        }
10784
10785        public boolean hasAdjustment() { 
10786          return this.adjustment != null && !this.adjustment.isEmpty();
10787        }
10788
10789        /**
10790         * @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.)
10791         */
10792        public PaymentComponent setAdjustment(Money value) { 
10793          this.adjustment = value;
10794          return this;
10795        }
10796
10797        /**
10798         * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
10799         */
10800        public CodeableConcept getAdjustmentReason() { 
10801          if (this.adjustmentReason == null)
10802            if (Configuration.errorOnAutoCreate())
10803              throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
10804            else if (Configuration.doAutoCreate())
10805              this.adjustmentReason = new CodeableConcept(); // cc
10806          return this.adjustmentReason;
10807        }
10808
10809        public boolean hasAdjustmentReason() { 
10810          return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
10811        }
10812
10813        /**
10814         * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
10815         */
10816        public PaymentComponent setAdjustmentReason(CodeableConcept value) { 
10817          this.adjustmentReason = value;
10818          return this;
10819        }
10820
10821        /**
10822         * @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
10823         */
10824        public DateType getDateElement() { 
10825          if (this.date == null)
10826            if (Configuration.errorOnAutoCreate())
10827              throw new Error("Attempt to auto-create PaymentComponent.date");
10828            else if (Configuration.doAutoCreate())
10829              this.date = new DateType(); // bb
10830          return this.date;
10831        }
10832
10833        public boolean hasDateElement() { 
10834          return this.date != null && !this.date.isEmpty();
10835        }
10836
10837        public boolean hasDate() { 
10838          return this.date != null && !this.date.isEmpty();
10839        }
10840
10841        /**
10842         * @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
10843         */
10844        public PaymentComponent setDateElement(DateType value) { 
10845          this.date = value;
10846          return this;
10847        }
10848
10849        /**
10850         * @return Estimated date the payment will be issued or the actual issue date of payment.
10851         */
10852        public Date getDate() { 
10853          return this.date == null ? null : this.date.getValue();
10854        }
10855
10856        /**
10857         * @param value Estimated date the payment will be issued or the actual issue date of payment.
10858         */
10859        public PaymentComponent setDate(Date value) { 
10860          if (value == null)
10861            this.date = null;
10862          else {
10863            if (this.date == null)
10864              this.date = new DateType();
10865            this.date.setValue(value);
10866          }
10867          return this;
10868        }
10869
10870        /**
10871         * @return {@link #amount} (Benefits payable less any payment adjustment.)
10872         */
10873        public Money getAmount() { 
10874          if (this.amount == null)
10875            if (Configuration.errorOnAutoCreate())
10876              throw new Error("Attempt to auto-create PaymentComponent.amount");
10877            else if (Configuration.doAutoCreate())
10878              this.amount = new Money(); // cc
10879          return this.amount;
10880        }
10881
10882        public boolean hasAmount() { 
10883          return this.amount != null && !this.amount.isEmpty();
10884        }
10885
10886        /**
10887         * @param value {@link #amount} (Benefits payable less any payment adjustment.)
10888         */
10889        public PaymentComponent setAmount(Money value) { 
10890          this.amount = value;
10891          return this;
10892        }
10893
10894        /**
10895         * @return {@link #identifier} (Issuer's unique identifier for the payment instrument.)
10896         */
10897        public Identifier getIdentifier() { 
10898          if (this.identifier == null)
10899            if (Configuration.errorOnAutoCreate())
10900              throw new Error("Attempt to auto-create PaymentComponent.identifier");
10901            else if (Configuration.doAutoCreate())
10902              this.identifier = new Identifier(); // cc
10903          return this.identifier;
10904        }
10905
10906        public boolean hasIdentifier() { 
10907          return this.identifier != null && !this.identifier.isEmpty();
10908        }
10909
10910        /**
10911         * @param value {@link #identifier} (Issuer's unique identifier for the payment instrument.)
10912         */
10913        public PaymentComponent setIdentifier(Identifier value) { 
10914          this.identifier = value;
10915          return this;
10916        }
10917
10918        protected void listChildren(List<Property> children) {
10919          super.listChildren(children);
10920          children.add(new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type));
10921          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));
10922          children.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason));
10923          children.add(new Property("date", "date", "Estimated date the payment will be issued or the actual issue date of payment.", 0, 1, date));
10924          children.add(new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount));
10925          children.add(new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0, 1, identifier));
10926        }
10927
10928        @Override
10929        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10930          switch (_hash) {
10931          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type);
10932          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);
10933          case -1255938543: /*adjustmentReason*/  return new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason);
10934          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);
10935          case -1413853096: /*amount*/  return new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount);
10936          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0, 1, identifier);
10937          default: return super.getNamedProperty(_hash, _name, _checkValid);
10938          }
10939
10940        }
10941
10942      @Override
10943      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10944        switch (hash) {
10945        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
10946        case 1977085293: /*adjustment*/ return this.adjustment == null ? new Base[0] : new Base[] {this.adjustment}; // Money
10947        case -1255938543: /*adjustmentReason*/ return this.adjustmentReason == null ? new Base[0] : new Base[] {this.adjustmentReason}; // CodeableConcept
10948        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
10949        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
10950        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
10951        default: return super.getProperty(hash, name, checkValid);
10952        }
10953
10954      }
10955
10956      @Override
10957      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10958        switch (hash) {
10959        case 3575610: // type
10960          this.type = castToCodeableConcept(value); // CodeableConcept
10961          return value;
10962        case 1977085293: // adjustment
10963          this.adjustment = castToMoney(value); // Money
10964          return value;
10965        case -1255938543: // adjustmentReason
10966          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
10967          return value;
10968        case 3076014: // date
10969          this.date = castToDate(value); // DateType
10970          return value;
10971        case -1413853096: // amount
10972          this.amount = castToMoney(value); // Money
10973          return value;
10974        case -1618432855: // identifier
10975          this.identifier = castToIdentifier(value); // Identifier
10976          return value;
10977        default: return super.setProperty(hash, name, value);
10978        }
10979
10980      }
10981
10982      @Override
10983      public Base setProperty(String name, Base value) throws FHIRException {
10984        if (name.equals("type")) {
10985          this.type = castToCodeableConcept(value); // CodeableConcept
10986        } else if (name.equals("adjustment")) {
10987          this.adjustment = castToMoney(value); // Money
10988        } else if (name.equals("adjustmentReason")) {
10989          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
10990        } else if (name.equals("date")) {
10991          this.date = castToDate(value); // DateType
10992        } else if (name.equals("amount")) {
10993          this.amount = castToMoney(value); // Money
10994        } else if (name.equals("identifier")) {
10995          this.identifier = castToIdentifier(value); // Identifier
10996        } else
10997          return super.setProperty(name, value);
10998        return value;
10999      }
11000
11001      @Override
11002      public Base makeProperty(int hash, String name) throws FHIRException {
11003        switch (hash) {
11004        case 3575610:  return getType(); 
11005        case 1977085293:  return getAdjustment(); 
11006        case -1255938543:  return getAdjustmentReason(); 
11007        case 3076014:  return getDateElement();
11008        case -1413853096:  return getAmount(); 
11009        case -1618432855:  return getIdentifier(); 
11010        default: return super.makeProperty(hash, name);
11011        }
11012
11013      }
11014
11015      @Override
11016      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11017        switch (hash) {
11018        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
11019        case 1977085293: /*adjustment*/ return new String[] {"Money"};
11020        case -1255938543: /*adjustmentReason*/ return new String[] {"CodeableConcept"};
11021        case 3076014: /*date*/ return new String[] {"date"};
11022        case -1413853096: /*amount*/ return new String[] {"Money"};
11023        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
11024        default: return super.getTypesForProperty(hash, name);
11025        }
11026
11027      }
11028
11029      @Override
11030      public Base addChild(String name) throws FHIRException {
11031        if (name.equals("type")) {
11032          this.type = new CodeableConcept();
11033          return this.type;
11034        }
11035        else if (name.equals("adjustment")) {
11036          this.adjustment = new Money();
11037          return this.adjustment;
11038        }
11039        else if (name.equals("adjustmentReason")) {
11040          this.adjustmentReason = new CodeableConcept();
11041          return this.adjustmentReason;
11042        }
11043        else if (name.equals("date")) {
11044          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
11045        }
11046        else if (name.equals("amount")) {
11047          this.amount = new Money();
11048          return this.amount;
11049        }
11050        else if (name.equals("identifier")) {
11051          this.identifier = new Identifier();
11052          return this.identifier;
11053        }
11054        else
11055          return super.addChild(name);
11056      }
11057
11058      public PaymentComponent copy() {
11059        PaymentComponent dst = new PaymentComponent();
11060        copyValues(dst);
11061        dst.type = type == null ? null : type.copy();
11062        dst.adjustment = adjustment == null ? null : adjustment.copy();
11063        dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
11064        dst.date = date == null ? null : date.copy();
11065        dst.amount = amount == null ? null : amount.copy();
11066        dst.identifier = identifier == null ? null : identifier.copy();
11067        return dst;
11068      }
11069
11070      @Override
11071      public boolean equalsDeep(Base other_) {
11072        if (!super.equalsDeep(other_))
11073          return false;
11074        if (!(other_ instanceof PaymentComponent))
11075          return false;
11076        PaymentComponent o = (PaymentComponent) other_;
11077        return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true) && compareDeep(adjustmentReason, o.adjustmentReason, true)
11078           && compareDeep(date, o.date, true) && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true)
11079          ;
11080      }
11081
11082      @Override
11083      public boolean equalsShallow(Base other_) {
11084        if (!super.equalsShallow(other_))
11085          return false;
11086        if (!(other_ instanceof PaymentComponent))
11087          return false;
11088        PaymentComponent o = (PaymentComponent) other_;
11089        return compareValues(date, o.date, true);
11090      }
11091
11092      public boolean isEmpty() {
11093        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason
11094          , date, amount, identifier);
11095      }
11096
11097  public String fhirType() {
11098    return "ExplanationOfBenefit.payment";
11099
11100  }
11101
11102  }
11103
11104    @Block()
11105    public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
11106        /**
11107         * A number to uniquely identify a note entry.
11108         */
11109        @Child(name = "number", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
11110        @Description(shortDefinition="Note instance identifier", formalDefinition="A number to uniquely identify a note entry." )
11111        protected PositiveIntType number;
11112
11113        /**
11114         * The business purpose of the note text.
11115         */
11116        @Child(name = "type", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
11117        @Description(shortDefinition="display | print | printoper", formalDefinition="The business purpose of the note text." )
11118        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/note-type")
11119        protected Enumeration<NoteType> type;
11120
11121        /**
11122         * The explanation or description associated with the processing.
11123         */
11124        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
11125        @Description(shortDefinition="Note explanatory text", formalDefinition="The explanation or description associated with the processing." )
11126        protected StringType text;
11127
11128        /**
11129         * A code to define the language used in the text of the note.
11130         */
11131        @Child(name = "language", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
11132        @Description(shortDefinition="Language of the text", formalDefinition="A code to define the language used in the text of the note." )
11133        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
11134        protected CodeableConcept language;
11135
11136        private static final long serialVersionUID = -385184277L;
11137
11138    /**
11139     * Constructor
11140     */
11141      public NoteComponent() {
11142        super();
11143      }
11144
11145        /**
11146         * @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
11147         */
11148        public PositiveIntType getNumberElement() { 
11149          if (this.number == null)
11150            if (Configuration.errorOnAutoCreate())
11151              throw new Error("Attempt to auto-create NoteComponent.number");
11152            else if (Configuration.doAutoCreate())
11153              this.number = new PositiveIntType(); // bb
11154          return this.number;
11155        }
11156
11157        public boolean hasNumberElement() { 
11158          return this.number != null && !this.number.isEmpty();
11159        }
11160
11161        public boolean hasNumber() { 
11162          return this.number != null && !this.number.isEmpty();
11163        }
11164
11165        /**
11166         * @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
11167         */
11168        public NoteComponent setNumberElement(PositiveIntType value) { 
11169          this.number = value;
11170          return this;
11171        }
11172
11173        /**
11174         * @return A number to uniquely identify a note entry.
11175         */
11176        public int getNumber() { 
11177          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
11178        }
11179
11180        /**
11181         * @param value A number to uniquely identify a note entry.
11182         */
11183        public NoteComponent setNumber(int value) { 
11184            if (this.number == null)
11185              this.number = new PositiveIntType();
11186            this.number.setValue(value);
11187          return this;
11188        }
11189
11190        /**
11191         * @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
11192         */
11193        public Enumeration<NoteType> getTypeElement() { 
11194          if (this.type == null)
11195            if (Configuration.errorOnAutoCreate())
11196              throw new Error("Attempt to auto-create NoteComponent.type");
11197            else if (Configuration.doAutoCreate())
11198              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory()); // bb
11199          return this.type;
11200        }
11201
11202        public boolean hasTypeElement() { 
11203          return this.type != null && !this.type.isEmpty();
11204        }
11205
11206        public boolean hasType() { 
11207          return this.type != null && !this.type.isEmpty();
11208        }
11209
11210        /**
11211         * @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
11212         */
11213        public NoteComponent setTypeElement(Enumeration<NoteType> value) { 
11214          this.type = value;
11215          return this;
11216        }
11217
11218        /**
11219         * @return The business purpose of the note text.
11220         */
11221        public NoteType getType() { 
11222          return this.type == null ? null : this.type.getValue();
11223        }
11224
11225        /**
11226         * @param value The business purpose of the note text.
11227         */
11228        public NoteComponent setType(NoteType value) { 
11229          if (value == null)
11230            this.type = null;
11231          else {
11232            if (this.type == null)
11233              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory());
11234            this.type.setValue(value);
11235          }
11236          return this;
11237        }
11238
11239        /**
11240         * @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
11241         */
11242        public StringType getTextElement() { 
11243          if (this.text == null)
11244            if (Configuration.errorOnAutoCreate())
11245              throw new Error("Attempt to auto-create NoteComponent.text");
11246            else if (Configuration.doAutoCreate())
11247              this.text = new StringType(); // bb
11248          return this.text;
11249        }
11250
11251        public boolean hasTextElement() { 
11252          return this.text != null && !this.text.isEmpty();
11253        }
11254
11255        public boolean hasText() { 
11256          return this.text != null && !this.text.isEmpty();
11257        }
11258
11259        /**
11260         * @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
11261         */
11262        public NoteComponent setTextElement(StringType value) { 
11263          this.text = value;
11264          return this;
11265        }
11266
11267        /**
11268         * @return The explanation or description associated with the processing.
11269         */
11270        public String getText() { 
11271          return this.text == null ? null : this.text.getValue();
11272        }
11273
11274        /**
11275         * @param value The explanation or description associated with the processing.
11276         */
11277        public NoteComponent setText(String value) { 
11278          if (Utilities.noString(value))
11279            this.text = null;
11280          else {
11281            if (this.text == null)
11282              this.text = new StringType();
11283            this.text.setValue(value);
11284          }
11285          return this;
11286        }
11287
11288        /**
11289         * @return {@link #language} (A code to define the language used in the text of the note.)
11290         */
11291        public CodeableConcept getLanguage() { 
11292          if (this.language == null)
11293            if (Configuration.errorOnAutoCreate())
11294              throw new Error("Attempt to auto-create NoteComponent.language");
11295            else if (Configuration.doAutoCreate())
11296              this.language = new CodeableConcept(); // cc
11297          return this.language;
11298        }
11299
11300        public boolean hasLanguage() { 
11301          return this.language != null && !this.language.isEmpty();
11302        }
11303
11304        /**
11305         * @param value {@link #language} (A code to define the language used in the text of the note.)
11306         */
11307        public NoteComponent setLanguage(CodeableConcept value) { 
11308          this.language = value;
11309          return this;
11310        }
11311
11312        protected void listChildren(List<Property> children) {
11313          super.listChildren(children);
11314          children.add(new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number));
11315          children.add(new Property("type", "code", "The business purpose of the note text.", 0, 1, type));
11316          children.add(new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text));
11317          children.add(new Property("language", "CodeableConcept", "A code to define the language used in the text of the note.", 0, 1, language));
11318        }
11319
11320        @Override
11321        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11322          switch (_hash) {
11323          case -1034364087: /*number*/  return new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number);
11324          case 3575610: /*type*/  return new Property("type", "code", "The business purpose of the note text.", 0, 1, type);
11325          case 3556653: /*text*/  return new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text);
11326          case -1613589672: /*language*/  return new Property("language", "CodeableConcept", "A code to define the language used in the text of the note.", 0, 1, language);
11327          default: return super.getNamedProperty(_hash, _name, _checkValid);
11328          }
11329
11330        }
11331
11332      @Override
11333      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11334        switch (hash) {
11335        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // PositiveIntType
11336        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<NoteType>
11337        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
11338        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeableConcept
11339        default: return super.getProperty(hash, name, checkValid);
11340        }
11341
11342      }
11343
11344      @Override
11345      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11346        switch (hash) {
11347        case -1034364087: // number
11348          this.number = castToPositiveInt(value); // PositiveIntType
11349          return value;
11350        case 3575610: // type
11351          value = new NoteTypeEnumFactory().fromType(castToCode(value));
11352          this.type = (Enumeration) value; // Enumeration<NoteType>
11353          return value;
11354        case 3556653: // text
11355          this.text = castToString(value); // StringType
11356          return value;
11357        case -1613589672: // language
11358          this.language = castToCodeableConcept(value); // CodeableConcept
11359          return value;
11360        default: return super.setProperty(hash, name, value);
11361        }
11362
11363      }
11364
11365      @Override
11366      public Base setProperty(String name, Base value) throws FHIRException {
11367        if (name.equals("number")) {
11368          this.number = castToPositiveInt(value); // PositiveIntType
11369        } else if (name.equals("type")) {
11370          value = new NoteTypeEnumFactory().fromType(castToCode(value));
11371          this.type = (Enumeration) value; // Enumeration<NoteType>
11372        } else if (name.equals("text")) {
11373          this.text = castToString(value); // StringType
11374        } else if (name.equals("language")) {
11375          this.language = castToCodeableConcept(value); // CodeableConcept
11376        } else
11377          return super.setProperty(name, value);
11378        return value;
11379      }
11380
11381      @Override
11382      public Base makeProperty(int hash, String name) throws FHIRException {
11383        switch (hash) {
11384        case -1034364087:  return getNumberElement();
11385        case 3575610:  return getTypeElement();
11386        case 3556653:  return getTextElement();
11387        case -1613589672:  return getLanguage(); 
11388        default: return super.makeProperty(hash, name);
11389        }
11390
11391      }
11392
11393      @Override
11394      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11395        switch (hash) {
11396        case -1034364087: /*number*/ return new String[] {"positiveInt"};
11397        case 3575610: /*type*/ return new String[] {"code"};
11398        case 3556653: /*text*/ return new String[] {"string"};
11399        case -1613589672: /*language*/ return new String[] {"CodeableConcept"};
11400        default: return super.getTypesForProperty(hash, name);
11401        }
11402
11403      }
11404
11405      @Override
11406      public Base addChild(String name) throws FHIRException {
11407        if (name.equals("number")) {
11408          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.number");
11409        }
11410        else if (name.equals("type")) {
11411          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.type");
11412        }
11413        else if (name.equals("text")) {
11414          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.text");
11415        }
11416        else if (name.equals("language")) {
11417          this.language = new CodeableConcept();
11418          return this.language;
11419        }
11420        else
11421          return super.addChild(name);
11422      }
11423
11424      public NoteComponent copy() {
11425        NoteComponent dst = new NoteComponent();
11426        copyValues(dst);
11427        dst.number = number == null ? null : number.copy();
11428        dst.type = type == null ? null : type.copy();
11429        dst.text = text == null ? null : text.copy();
11430        dst.language = language == null ? null : language.copy();
11431        return dst;
11432      }
11433
11434      @Override
11435      public boolean equalsDeep(Base other_) {
11436        if (!super.equalsDeep(other_))
11437          return false;
11438        if (!(other_ instanceof NoteComponent))
11439          return false;
11440        NoteComponent o = (NoteComponent) other_;
11441        return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
11442           && compareDeep(language, o.language, true);
11443      }
11444
11445      @Override
11446      public boolean equalsShallow(Base other_) {
11447        if (!super.equalsShallow(other_))
11448          return false;
11449        if (!(other_ instanceof NoteComponent))
11450          return false;
11451        NoteComponent o = (NoteComponent) other_;
11452        return compareValues(number, o.number, true) && compareValues(type, o.type, true) && compareValues(text, o.text, true)
11453          ;
11454      }
11455
11456      public boolean isEmpty() {
11457        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language
11458          );
11459      }
11460
11461  public String fhirType() {
11462    return "ExplanationOfBenefit.processNote";
11463
11464  }
11465
11466  }
11467
11468    @Block()
11469    public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
11470        /**
11471         * Code to identify the general type of benefits under which products and services are provided.
11472         */
11473        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
11474        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
11475        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
11476        protected CodeableConcept category;
11477
11478        /**
11479         * 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.
11480         */
11481        @Child(name = "excluded", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
11482        @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." )
11483        protected BooleanType excluded;
11484
11485        /**
11486         * A short name or tag for the benefit.
11487         */
11488        @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
11489        @Description(shortDefinition="Short name for the benefit", formalDefinition="A short name or tag for the benefit." )
11490        protected StringType name;
11491
11492        /**
11493         * A richer description of the benefit or services covered.
11494         */
11495        @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
11496        @Description(shortDefinition="Description of the benefit or services covered", formalDefinition="A richer description of the benefit or services covered." )
11497        protected StringType description;
11498
11499        /**
11500         * Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.
11501         */
11502        @Child(name = "network", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
11503        @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." )
11504        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-network")
11505        protected CodeableConcept network;
11506
11507        /**
11508         * Indicates if the benefits apply to an individual or to the family.
11509         */
11510        @Child(name = "unit", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
11511        @Description(shortDefinition="Individual or family", formalDefinition="Indicates if the benefits apply to an individual or to the family." )
11512        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-unit")
11513        protected CodeableConcept unit;
11514
11515        /**
11516         * The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.
11517         */
11518        @Child(name = "term", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
11519        @Description(shortDefinition="Annual or lifetime", formalDefinition="The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'." )
11520        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-term")
11521        protected CodeableConcept term;
11522
11523        /**
11524         * Benefits Used to date.
11525         */
11526        @Child(name = "financial", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
11527        @Description(shortDefinition="Benefit Summary", formalDefinition="Benefits Used to date." )
11528        protected List<BenefitComponent> financial;
11529
11530        private static final long serialVersionUID = -1889655824L;
11531
11532    /**
11533     * Constructor
11534     */
11535      public BenefitBalanceComponent() {
11536        super();
11537      }
11538
11539    /**
11540     * Constructor
11541     */
11542      public BenefitBalanceComponent(CodeableConcept category) {
11543        super();
11544        this.category = category;
11545      }
11546
11547        /**
11548         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
11549         */
11550        public CodeableConcept getCategory() { 
11551          if (this.category == null)
11552            if (Configuration.errorOnAutoCreate())
11553              throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
11554            else if (Configuration.doAutoCreate())
11555              this.category = new CodeableConcept(); // cc
11556          return this.category;
11557        }
11558
11559        public boolean hasCategory() { 
11560          return this.category != null && !this.category.isEmpty();
11561        }
11562
11563        /**
11564         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
11565         */
11566        public BenefitBalanceComponent setCategory(CodeableConcept value) { 
11567          this.category = value;
11568          return this;
11569        }
11570
11571        /**
11572         * @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
11573         */
11574        public BooleanType getExcludedElement() { 
11575          if (this.excluded == null)
11576            if (Configuration.errorOnAutoCreate())
11577              throw new Error("Attempt to auto-create BenefitBalanceComponent.excluded");
11578            else if (Configuration.doAutoCreate())
11579              this.excluded = new BooleanType(); // bb
11580          return this.excluded;
11581        }
11582
11583        public boolean hasExcludedElement() { 
11584          return this.excluded != null && !this.excluded.isEmpty();
11585        }
11586
11587        public boolean hasExcluded() { 
11588          return this.excluded != null && !this.excluded.isEmpty();
11589        }
11590
11591        /**
11592         * @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
11593         */
11594        public BenefitBalanceComponent setExcludedElement(BooleanType value) { 
11595          this.excluded = value;
11596          return this;
11597        }
11598
11599        /**
11600         * @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.
11601         */
11602        public boolean getExcluded() { 
11603          return this.excluded == null || this.excluded.isEmpty() ? false : this.excluded.getValue();
11604        }
11605
11606        /**
11607         * @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.
11608         */
11609        public BenefitBalanceComponent setExcluded(boolean value) { 
11610            if (this.excluded == null)
11611              this.excluded = new BooleanType();
11612            this.excluded.setValue(value);
11613          return this;
11614        }
11615
11616        /**
11617         * @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
11618         */
11619        public StringType getNameElement() { 
11620          if (this.name == null)
11621            if (Configuration.errorOnAutoCreate())
11622              throw new Error("Attempt to auto-create BenefitBalanceComponent.name");
11623            else if (Configuration.doAutoCreate())
11624              this.name = new StringType(); // bb
11625          return this.name;
11626        }
11627
11628        public boolean hasNameElement() { 
11629          return this.name != null && !this.name.isEmpty();
11630        }
11631
11632        public boolean hasName() { 
11633          return this.name != null && !this.name.isEmpty();
11634        }
11635
11636        /**
11637         * @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
11638         */
11639        public BenefitBalanceComponent setNameElement(StringType value) { 
11640          this.name = value;
11641          return this;
11642        }
11643
11644        /**
11645         * @return A short name or tag for the benefit.
11646         */
11647        public String getName() { 
11648          return this.name == null ? null : this.name.getValue();
11649        }
11650
11651        /**
11652         * @param value A short name or tag for the benefit.
11653         */
11654        public BenefitBalanceComponent setName(String value) { 
11655          if (Utilities.noString(value))
11656            this.name = null;
11657          else {
11658            if (this.name == null)
11659              this.name = new StringType();
11660            this.name.setValue(value);
11661          }
11662          return this;
11663        }
11664
11665        /**
11666         * @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
11667         */
11668        public StringType getDescriptionElement() { 
11669          if (this.description == null)
11670            if (Configuration.errorOnAutoCreate())
11671              throw new Error("Attempt to auto-create BenefitBalanceComponent.description");
11672            else if (Configuration.doAutoCreate())
11673              this.description = new StringType(); // bb
11674          return this.description;
11675        }
11676
11677        public boolean hasDescriptionElement() { 
11678          return this.description != null && !this.description.isEmpty();
11679        }
11680
11681        public boolean hasDescription() { 
11682          return this.description != null && !this.description.isEmpty();
11683        }
11684
11685        /**
11686         * @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
11687         */
11688        public BenefitBalanceComponent setDescriptionElement(StringType value) { 
11689          this.description = value;
11690          return this;
11691        }
11692
11693        /**
11694         * @return A richer description of the benefit or services covered.
11695         */
11696        public String getDescription() { 
11697          return this.description == null ? null : this.description.getValue();
11698        }
11699
11700        /**
11701         * @param value A richer description of the benefit or services covered.
11702         */
11703        public BenefitBalanceComponent setDescription(String value) { 
11704          if (Utilities.noString(value))
11705            this.description = null;
11706          else {
11707            if (this.description == null)
11708              this.description = new StringType();
11709            this.description.setValue(value);
11710          }
11711          return this;
11712        }
11713
11714        /**
11715         * @return {@link #network} (Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.)
11716         */
11717        public CodeableConcept getNetwork() { 
11718          if (this.network == null)
11719            if (Configuration.errorOnAutoCreate())
11720              throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
11721            else if (Configuration.doAutoCreate())
11722              this.network = new CodeableConcept(); // cc
11723          return this.network;
11724        }
11725
11726        public boolean hasNetwork() { 
11727          return this.network != null && !this.network.isEmpty();
11728        }
11729
11730        /**
11731         * @param value {@link #network} (Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.)
11732         */
11733        public BenefitBalanceComponent setNetwork(CodeableConcept value) { 
11734          this.network = value;
11735          return this;
11736        }
11737
11738        /**
11739         * @return {@link #unit} (Indicates if the benefits apply to an individual or to the family.)
11740         */
11741        public CodeableConcept getUnit() { 
11742          if (this.unit == null)
11743            if (Configuration.errorOnAutoCreate())
11744              throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
11745            else if (Configuration.doAutoCreate())
11746              this.unit = new CodeableConcept(); // cc
11747          return this.unit;
11748        }
11749
11750        public boolean hasUnit() { 
11751          return this.unit != null && !this.unit.isEmpty();
11752        }
11753
11754        /**
11755         * @param value {@link #unit} (Indicates if the benefits apply to an individual or to the family.)
11756         */
11757        public BenefitBalanceComponent setUnit(CodeableConcept value) { 
11758          this.unit = value;
11759          return this;
11760        }
11761
11762        /**
11763         * @return {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.)
11764         */
11765        public CodeableConcept getTerm() { 
11766          if (this.term == null)
11767            if (Configuration.errorOnAutoCreate())
11768              throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
11769            else if (Configuration.doAutoCreate())
11770              this.term = new CodeableConcept(); // cc
11771          return this.term;
11772        }
11773
11774        public boolean hasTerm() { 
11775          return this.term != null && !this.term.isEmpty();
11776        }
11777
11778        /**
11779         * @param value {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.)
11780         */
11781        public BenefitBalanceComponent setTerm(CodeableConcept value) { 
11782          this.term = value;
11783          return this;
11784        }
11785
11786        /**
11787         * @return {@link #financial} (Benefits Used to date.)
11788         */
11789        public List<BenefitComponent> getFinancial() { 
11790          if (this.financial == null)
11791            this.financial = new ArrayList<BenefitComponent>();
11792          return this.financial;
11793        }
11794
11795        /**
11796         * @return Returns a reference to <code>this</code> for easy method chaining
11797         */
11798        public BenefitBalanceComponent setFinancial(List<BenefitComponent> theFinancial) { 
11799          this.financial = theFinancial;
11800          return this;
11801        }
11802
11803        public boolean hasFinancial() { 
11804          if (this.financial == null)
11805            return false;
11806          for (BenefitComponent item : this.financial)
11807            if (!item.isEmpty())
11808              return true;
11809          return false;
11810        }
11811
11812        public BenefitComponent addFinancial() { //3
11813          BenefitComponent t = new BenefitComponent();
11814          if (this.financial == null)
11815            this.financial = new ArrayList<BenefitComponent>();
11816          this.financial.add(t);
11817          return t;
11818        }
11819
11820        public BenefitBalanceComponent addFinancial(BenefitComponent t) { //3
11821          if (t == null)
11822            return this;
11823          if (this.financial == null)
11824            this.financial = new ArrayList<BenefitComponent>();
11825          this.financial.add(t);
11826          return this;
11827        }
11828
11829        /**
11830         * @return The first repetition of repeating field {@link #financial}, creating it if it does not already exist
11831         */
11832        public BenefitComponent getFinancialFirstRep() { 
11833          if (getFinancial().isEmpty()) {
11834            addFinancial();
11835          }
11836          return getFinancial().get(0);
11837        }
11838
11839        protected void listChildren(List<Property> children) {
11840          super.listChildren(children);
11841          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
11842          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));
11843          children.add(new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name));
11844          children.add(new Property("description", "string", "A richer description of the benefit or services covered.", 0, 1, description));
11845          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));
11846          children.add(new Property("unit", "CodeableConcept", "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit));
11847          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));
11848          children.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
11849        }
11850
11851        @Override
11852        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11853          switch (_hash) {
11854          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);
11855          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);
11856          case 3373707: /*name*/  return new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name);
11857          case -1724546052: /*description*/  return new Property("description", "string", "A richer description of the benefit or services covered.", 0, 1, description);
11858          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);
11859          case 3594628: /*unit*/  return new Property("unit", "CodeableConcept", "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit);
11860          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);
11861          case 357555337: /*financial*/  return new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial);
11862          default: return super.getNamedProperty(_hash, _name, _checkValid);
11863          }
11864
11865        }
11866
11867      @Override
11868      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11869        switch (hash) {
11870        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
11871        case 1994055114: /*excluded*/ return this.excluded == null ? new Base[0] : new Base[] {this.excluded}; // BooleanType
11872        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
11873        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
11874        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // CodeableConcept
11875        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // CodeableConcept
11876        case 3556460: /*term*/ return this.term == null ? new Base[0] : new Base[] {this.term}; // CodeableConcept
11877        case 357555337: /*financial*/ return this.financial == null ? new Base[0] : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
11878        default: return super.getProperty(hash, name, checkValid);
11879        }
11880
11881      }
11882
11883      @Override
11884      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11885        switch (hash) {
11886        case 50511102: // category
11887          this.category = castToCodeableConcept(value); // CodeableConcept
11888          return value;
11889        case 1994055114: // excluded
11890          this.excluded = castToBoolean(value); // BooleanType
11891          return value;
11892        case 3373707: // name
11893          this.name = castToString(value); // StringType
11894          return value;
11895        case -1724546052: // description
11896          this.description = castToString(value); // StringType
11897          return value;
11898        case 1843485230: // network
11899          this.network = castToCodeableConcept(value); // CodeableConcept
11900          return value;
11901        case 3594628: // unit
11902          this.unit = castToCodeableConcept(value); // CodeableConcept
11903          return value;
11904        case 3556460: // term
11905          this.term = castToCodeableConcept(value); // CodeableConcept
11906          return value;
11907        case 357555337: // financial
11908          this.getFinancial().add((BenefitComponent) value); // BenefitComponent
11909          return value;
11910        default: return super.setProperty(hash, name, value);
11911        }
11912
11913      }
11914
11915      @Override
11916      public Base setProperty(String name, Base value) throws FHIRException {
11917        if (name.equals("category")) {
11918          this.category = castToCodeableConcept(value); // CodeableConcept
11919        } else if (name.equals("excluded")) {
11920          this.excluded = castToBoolean(value); // BooleanType
11921        } else if (name.equals("name")) {
11922          this.name = castToString(value); // StringType
11923        } else if (name.equals("description")) {
11924          this.description = castToString(value); // StringType
11925        } else if (name.equals("network")) {
11926          this.network = castToCodeableConcept(value); // CodeableConcept
11927        } else if (name.equals("unit")) {
11928          this.unit = castToCodeableConcept(value); // CodeableConcept
11929        } else if (name.equals("term")) {
11930          this.term = castToCodeableConcept(value); // CodeableConcept
11931        } else if (name.equals("financial")) {
11932          this.getFinancial().add((BenefitComponent) value);
11933        } else
11934          return super.setProperty(name, value);
11935        return value;
11936      }
11937
11938      @Override
11939      public Base makeProperty(int hash, String name) throws FHIRException {
11940        switch (hash) {
11941        case 50511102:  return getCategory(); 
11942        case 1994055114:  return getExcludedElement();
11943        case 3373707:  return getNameElement();
11944        case -1724546052:  return getDescriptionElement();
11945        case 1843485230:  return getNetwork(); 
11946        case 3594628:  return getUnit(); 
11947        case 3556460:  return getTerm(); 
11948        case 357555337:  return addFinancial(); 
11949        default: return super.makeProperty(hash, name);
11950        }
11951
11952      }
11953
11954      @Override
11955      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11956        switch (hash) {
11957        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
11958        case 1994055114: /*excluded*/ return new String[] {"boolean"};
11959        case 3373707: /*name*/ return new String[] {"string"};
11960        case -1724546052: /*description*/ return new String[] {"string"};
11961        case 1843485230: /*network*/ return new String[] {"CodeableConcept"};
11962        case 3594628: /*unit*/ return new String[] {"CodeableConcept"};
11963        case 3556460: /*term*/ return new String[] {"CodeableConcept"};
11964        case 357555337: /*financial*/ return new String[] {};
11965        default: return super.getTypesForProperty(hash, name);
11966        }
11967
11968      }
11969
11970      @Override
11971      public Base addChild(String name) throws FHIRException {
11972        if (name.equals("category")) {
11973          this.category = new CodeableConcept();
11974          return this.category;
11975        }
11976        else if (name.equals("excluded")) {
11977          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.excluded");
11978        }
11979        else if (name.equals("name")) {
11980          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.name");
11981        }
11982        else if (name.equals("description")) {
11983          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.description");
11984        }
11985        else if (name.equals("network")) {
11986          this.network = new CodeableConcept();
11987          return this.network;
11988        }
11989        else if (name.equals("unit")) {
11990          this.unit = new CodeableConcept();
11991          return this.unit;
11992        }
11993        else if (name.equals("term")) {
11994          this.term = new CodeableConcept();
11995          return this.term;
11996        }
11997        else if (name.equals("financial")) {
11998          return addFinancial();
11999        }
12000        else
12001          return super.addChild(name);
12002      }
12003
12004      public BenefitBalanceComponent copy() {
12005        BenefitBalanceComponent dst = new BenefitBalanceComponent();
12006        copyValues(dst);
12007        dst.category = category == null ? null : category.copy();
12008        dst.excluded = excluded == null ? null : excluded.copy();
12009        dst.name = name == null ? null : name.copy();
12010        dst.description = description == null ? null : description.copy();
12011        dst.network = network == null ? null : network.copy();
12012        dst.unit = unit == null ? null : unit.copy();
12013        dst.term = term == null ? null : term.copy();
12014        if (financial != null) {
12015          dst.financial = new ArrayList<BenefitComponent>();
12016          for (BenefitComponent i : financial)
12017            dst.financial.add(i.copy());
12018        };
12019        return dst;
12020      }
12021
12022      @Override
12023      public boolean equalsDeep(Base other_) {
12024        if (!super.equalsDeep(other_))
12025          return false;
12026        if (!(other_ instanceof BenefitBalanceComponent))
12027          return false;
12028        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
12029        return compareDeep(category, o.category, true) && compareDeep(excluded, o.excluded, true) && compareDeep(name, o.name, true)
12030           && compareDeep(description, o.description, true) && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true)
12031           && compareDeep(term, o.term, true) && compareDeep(financial, o.financial, true);
12032      }
12033
12034      @Override
12035      public boolean equalsShallow(Base other_) {
12036        if (!super.equalsShallow(other_))
12037          return false;
12038        if (!(other_ instanceof BenefitBalanceComponent))
12039          return false;
12040        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
12041        return compareValues(excluded, o.excluded, true) && compareValues(name, o.name, true) && compareValues(description, o.description, true)
12042          ;
12043      }
12044
12045      public boolean isEmpty() {
12046        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, excluded, name
12047          , description, network, unit, term, financial);
12048      }
12049
12050  public String fhirType() {
12051    return "ExplanationOfBenefit.benefitBalance";
12052
12053  }
12054
12055  }
12056
12057    @Block()
12058    public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
12059        /**
12060         * Classification of benefit being provided.
12061         */
12062        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
12063        @Description(shortDefinition="Benefit classification", formalDefinition="Classification of benefit being provided." )
12064        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-type")
12065        protected CodeableConcept type;
12066
12067        /**
12068         * The quantity of the benefit which is permitted under the coverage.
12069         */
12070        @Child(name = "allowed", type = {UnsignedIntType.class, StringType.class, Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
12071        @Description(shortDefinition="Benefits allowed", formalDefinition="The quantity of the benefit which is permitted under the coverage." )
12072        protected Type allowed;
12073
12074        /**
12075         * The quantity of the benefit which have been consumed to date.
12076         */
12077        @Child(name = "used", type = {UnsignedIntType.class, Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
12078        @Description(shortDefinition="Benefits used", formalDefinition="The quantity of the benefit which have been consumed to date." )
12079        protected Type used;
12080
12081        private static final long serialVersionUID = -1506285314L;
12082
12083    /**
12084     * Constructor
12085     */
12086      public BenefitComponent() {
12087        super();
12088      }
12089
12090    /**
12091     * Constructor
12092     */
12093      public BenefitComponent(CodeableConcept type) {
12094        super();
12095        this.type = type;
12096      }
12097
12098        /**
12099         * @return {@link #type} (Classification of benefit being provided.)
12100         */
12101        public CodeableConcept getType() { 
12102          if (this.type == null)
12103            if (Configuration.errorOnAutoCreate())
12104              throw new Error("Attempt to auto-create BenefitComponent.type");
12105            else if (Configuration.doAutoCreate())
12106              this.type = new CodeableConcept(); // cc
12107          return this.type;
12108        }
12109
12110        public boolean hasType() { 
12111          return this.type != null && !this.type.isEmpty();
12112        }
12113
12114        /**
12115         * @param value {@link #type} (Classification of benefit being provided.)
12116         */
12117        public BenefitComponent setType(CodeableConcept value) { 
12118          this.type = value;
12119          return this;
12120        }
12121
12122        /**
12123         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12124         */
12125        public Type getAllowed() { 
12126          return this.allowed;
12127        }
12128
12129        /**
12130         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12131         */
12132        public UnsignedIntType getAllowedUnsignedIntType() throws FHIRException { 
12133          if (this.allowed == null)
12134            this.allowed = new UnsignedIntType();
12135          if (!(this.allowed instanceof UnsignedIntType))
12136            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.allowed.getClass().getName()+" was encountered");
12137          return (UnsignedIntType) this.allowed;
12138        }
12139
12140        public boolean hasAllowedUnsignedIntType() { 
12141          return this != null && this.allowed instanceof UnsignedIntType;
12142        }
12143
12144        /**
12145         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12146         */
12147        public StringType getAllowedStringType() throws FHIRException { 
12148          if (this.allowed == null)
12149            this.allowed = new StringType();
12150          if (!(this.allowed instanceof StringType))
12151            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.allowed.getClass().getName()+" was encountered");
12152          return (StringType) this.allowed;
12153        }
12154
12155        public boolean hasAllowedStringType() { 
12156          return this != null && this.allowed instanceof StringType;
12157        }
12158
12159        /**
12160         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12161         */
12162        public Money getAllowedMoney() throws FHIRException { 
12163          if (this.allowed == null)
12164            this.allowed = new Money();
12165          if (!(this.allowed instanceof Money))
12166            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.allowed.getClass().getName()+" was encountered");
12167          return (Money) this.allowed;
12168        }
12169
12170        public boolean hasAllowedMoney() { 
12171          return this != null && this.allowed instanceof Money;
12172        }
12173
12174        public boolean hasAllowed() { 
12175          return this.allowed != null && !this.allowed.isEmpty();
12176        }
12177
12178        /**
12179         * @param value {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12180         */
12181        public BenefitComponent setAllowed(Type value) { 
12182          if (value != null && !(value instanceof UnsignedIntType || value instanceof StringType || value instanceof Money))
12183            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.allowed[x]: "+value.fhirType());
12184          this.allowed = value;
12185          return this;
12186        }
12187
12188        /**
12189         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
12190         */
12191        public Type getUsed() { 
12192          return this.used;
12193        }
12194
12195        /**
12196         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
12197         */
12198        public UnsignedIntType getUsedUnsignedIntType() throws FHIRException { 
12199          if (this.used == null)
12200            this.used = new UnsignedIntType();
12201          if (!(this.used instanceof UnsignedIntType))
12202            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.used.getClass().getName()+" was encountered");
12203          return (UnsignedIntType) this.used;
12204        }
12205
12206        public boolean hasUsedUnsignedIntType() { 
12207          return this != null && this.used instanceof UnsignedIntType;
12208        }
12209
12210        /**
12211         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
12212         */
12213        public Money getUsedMoney() throws FHIRException { 
12214          if (this.used == null)
12215            this.used = new Money();
12216          if (!(this.used instanceof Money))
12217            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.used.getClass().getName()+" was encountered");
12218          return (Money) this.used;
12219        }
12220
12221        public boolean hasUsedMoney() { 
12222          return this != null && this.used instanceof Money;
12223        }
12224
12225        public boolean hasUsed() { 
12226          return this.used != null && !this.used.isEmpty();
12227        }
12228
12229        /**
12230         * @param value {@link #used} (The quantity of the benefit which have been consumed to date.)
12231         */
12232        public BenefitComponent setUsed(Type value) { 
12233          if (value != null && !(value instanceof UnsignedIntType || value instanceof Money))
12234            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.used[x]: "+value.fhirType());
12235          this.used = value;
12236          return this;
12237        }
12238
12239        protected void listChildren(List<Property> children) {
12240          super.listChildren(children);
12241          children.add(new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type));
12242          children.add(new Property("allowed[x]", "unsignedInt|string|Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed));
12243          children.add(new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used));
12244        }
12245
12246        @Override
12247        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
12248          switch (_hash) {
12249          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type);
12250          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);
12251          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);
12252          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);
12253          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);
12254          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);
12255          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);
12256          case 3599293: /*used*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
12257          case 1252740285: /*usedUnsignedInt*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
12258          case -78048509: /*usedMoney*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
12259          default: return super.getNamedProperty(_hash, _name, _checkValid);
12260          }
12261
12262        }
12263
12264      @Override
12265      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
12266        switch (hash) {
12267        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
12268        case -911343192: /*allowed*/ return this.allowed == null ? new Base[0] : new Base[] {this.allowed}; // Type
12269        case 3599293: /*used*/ return this.used == null ? new Base[0] : new Base[] {this.used}; // Type
12270        default: return super.getProperty(hash, name, checkValid);
12271        }
12272
12273      }
12274
12275      @Override
12276      public Base setProperty(int hash, String name, Base value) throws FHIRException {
12277        switch (hash) {
12278        case 3575610: // type
12279          this.type = castToCodeableConcept(value); // CodeableConcept
12280          return value;
12281        case -911343192: // allowed
12282          this.allowed = castToType(value); // Type
12283          return value;
12284        case 3599293: // used
12285          this.used = castToType(value); // Type
12286          return value;
12287        default: return super.setProperty(hash, name, value);
12288        }
12289
12290      }
12291
12292      @Override
12293      public Base setProperty(String name, Base value) throws FHIRException {
12294        if (name.equals("type")) {
12295          this.type = castToCodeableConcept(value); // CodeableConcept
12296        } else if (name.equals("allowed[x]")) {
12297          this.allowed = castToType(value); // Type
12298        } else if (name.equals("used[x]")) {
12299          this.used = castToType(value); // Type
12300        } else
12301          return super.setProperty(name, value);
12302        return value;
12303      }
12304
12305      @Override
12306      public Base makeProperty(int hash, String name) throws FHIRException {
12307        switch (hash) {
12308        case 3575610:  return getType(); 
12309        case -1336663592:  return getAllowed(); 
12310        case -911343192:  return getAllowed(); 
12311        case -147553373:  return getUsed(); 
12312        case 3599293:  return getUsed(); 
12313        default: return super.makeProperty(hash, name);
12314        }
12315
12316      }
12317
12318      @Override
12319      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12320        switch (hash) {
12321        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
12322        case -911343192: /*allowed*/ return new String[] {"unsignedInt", "string", "Money"};
12323        case 3599293: /*used*/ return new String[] {"unsignedInt", "Money"};
12324        default: return super.getTypesForProperty(hash, name);
12325        }
12326
12327      }
12328
12329      @Override
12330      public Base addChild(String name) throws FHIRException {
12331        if (name.equals("type")) {
12332          this.type = new CodeableConcept();
12333          return this.type;
12334        }
12335        else if (name.equals("allowedUnsignedInt")) {
12336          this.allowed = new UnsignedIntType();
12337          return this.allowed;
12338        }
12339        else if (name.equals("allowedString")) {
12340          this.allowed = new StringType();
12341          return this.allowed;
12342        }
12343        else if (name.equals("allowedMoney")) {
12344          this.allowed = new Money();
12345          return this.allowed;
12346        }
12347        else if (name.equals("usedUnsignedInt")) {
12348          this.used = new UnsignedIntType();
12349          return this.used;
12350        }
12351        else if (name.equals("usedMoney")) {
12352          this.used = new Money();
12353          return this.used;
12354        }
12355        else
12356          return super.addChild(name);
12357      }
12358
12359      public BenefitComponent copy() {
12360        BenefitComponent dst = new BenefitComponent();
12361        copyValues(dst);
12362        dst.type = type == null ? null : type.copy();
12363        dst.allowed = allowed == null ? null : allowed.copy();
12364        dst.used = used == null ? null : used.copy();
12365        return dst;
12366      }
12367
12368      @Override
12369      public boolean equalsDeep(Base other_) {
12370        if (!super.equalsDeep(other_))
12371          return false;
12372        if (!(other_ instanceof BenefitComponent))
12373          return false;
12374        BenefitComponent o = (BenefitComponent) other_;
12375        return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true) && compareDeep(used, o.used, true)
12376          ;
12377      }
12378
12379      @Override
12380      public boolean equalsShallow(Base other_) {
12381        if (!super.equalsShallow(other_))
12382          return false;
12383        if (!(other_ instanceof BenefitComponent))
12384          return false;
12385        BenefitComponent o = (BenefitComponent) other_;
12386        return true;
12387      }
12388
12389      public boolean isEmpty() {
12390        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed, used);
12391      }
12392
12393  public String fhirType() {
12394    return "ExplanationOfBenefit.benefitBalance.financial";
12395
12396  }
12397
12398  }
12399
12400    /**
12401     * A unique identifier assigned to this explanation of benefit.
12402     */
12403    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12404    @Description(shortDefinition="Business Identifier for the resource", formalDefinition="A unique identifier assigned to this explanation of benefit." )
12405    protected List<Identifier> identifier;
12406
12407    /**
12408     * The status of the resource instance.
12409     */
12410    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
12411    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
12412    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/explanationofbenefit-status")
12413    protected Enumeration<ExplanationOfBenefitStatus> status;
12414
12415    /**
12416     * The category of claim, e.g. oral, pharmacy, vision, institutional, professional.
12417     */
12418    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
12419    @Description(shortDefinition="Category or discipline", formalDefinition="The category of claim, e.g. oral, pharmacy, vision, institutional, professional." )
12420    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-type")
12421    protected CodeableConcept type;
12422
12423    /**
12424     * A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.
12425     */
12426    @Child(name = "subType", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
12427    @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." )
12428    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-subtype")
12429    protected CodeableConcept subType;
12430
12431    /**
12432     * 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.
12433     */
12434    @Child(name = "use", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
12435    @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." )
12436    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-use")
12437    protected Enumeration<Use> use;
12438
12439    /**
12440     * 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.
12441     */
12442    @Child(name = "patient", type = {Patient.class}, order=5, min=1, max=1, modifier=false, summary=true)
12443    @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." )
12444    protected Reference patient;
12445
12446    /**
12447     * 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.)
12448     */
12449    protected Patient patientTarget;
12450
12451    /**
12452     * The period for which charges are being submitted.
12453     */
12454    @Child(name = "billablePeriod", type = {Period.class}, order=6, min=0, max=1, modifier=false, summary=true)
12455    @Description(shortDefinition="Relevant time frame for the claim", formalDefinition="The period for which charges are being submitted." )
12456    protected Period billablePeriod;
12457
12458    /**
12459     * The date this resource was created.
12460     */
12461    @Child(name = "created", type = {DateTimeType.class}, order=7, min=1, max=1, modifier=false, summary=true)
12462    @Description(shortDefinition="Response creation date", formalDefinition="The date this resource was created." )
12463    protected DateTimeType created;
12464
12465    /**
12466     * Individual who created the claim, predetermination or preauthorization.
12467     */
12468    @Child(name = "enterer", type = {Practitioner.class, PractitionerRole.class}, order=8, min=0, max=1, modifier=false, summary=false)
12469    @Description(shortDefinition="Author of the claim", formalDefinition="Individual who created the claim, predetermination or preauthorization." )
12470    protected Reference enterer;
12471
12472    /**
12473     * The actual object that is the target of the reference (Individual who created the claim, predetermination or preauthorization.)
12474     */
12475    protected Resource entererTarget;
12476
12477    /**
12478     * The party responsible for authorization, adjudication and reimbursement.
12479     */
12480    @Child(name = "insurer", type = {Organization.class}, order=9, min=1, max=1, modifier=false, summary=true)
12481    @Description(shortDefinition="Party responsible for reimbursement", formalDefinition="The party responsible for authorization, adjudication and reimbursement." )
12482    protected Reference insurer;
12483
12484    /**
12485     * The actual object that is the target of the reference (The party responsible for authorization, adjudication and reimbursement.)
12486     */
12487    protected Organization insurerTarget;
12488
12489    /**
12490     * The provider which is responsible for the claim, predetermination or preauthorization.
12491     */
12492    @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=10, min=1, max=1, modifier=false, summary=true)
12493    @Description(shortDefinition="Party responsible for the claim", formalDefinition="The provider which is responsible for the claim, predetermination or preauthorization." )
12494    protected Reference provider;
12495
12496    /**
12497     * The actual object that is the target of the reference (The provider which is responsible for the claim, predetermination or preauthorization.)
12498     */
12499    protected Resource providerTarget;
12500
12501    /**
12502     * The provider-required urgency of processing the request. Typical values include: stat, routine deferred.
12503     */
12504    @Child(name = "priority", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=false)
12505    @Description(shortDefinition="Desired processing urgency", formalDefinition="The provider-required urgency of processing the request. Typical values include: stat, routine deferred." )
12506    protected CodeableConcept priority;
12507
12508    /**
12509     * A code to indicate whether and for whom funds are to be reserved for future claims.
12510     */
12511    @Child(name = "fundsReserveRequested", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
12512    @Description(shortDefinition="For whom to reserve funds", formalDefinition="A code to indicate whether and for whom funds are to be reserved for future claims." )
12513    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fundsreserve")
12514    protected CodeableConcept fundsReserveRequested;
12515
12516    /**
12517     * A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.
12518     */
12519    @Child(name = "fundsReserve", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
12520    @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." )
12521    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fundsreserve")
12522    protected CodeableConcept fundsReserve;
12523
12524    /**
12525     * Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.
12526     */
12527    @Child(name = "related", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12528    @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." )
12529    protected List<RelatedClaimComponent> related;
12530
12531    /**
12532     * Prescription to support the dispensing of pharmacy, device or vision products.
12533     */
12534    @Child(name = "prescription", type = {MedicationRequest.class, VisionPrescription.class}, order=15, min=0, max=1, modifier=false, summary=false)
12535    @Description(shortDefinition="Prescription authorizing services or products", formalDefinition="Prescription to support the dispensing of pharmacy, device or vision products." )
12536    protected Reference prescription;
12537
12538    /**
12539     * The actual object that is the target of the reference (Prescription to support the dispensing of pharmacy, device or vision products.)
12540     */
12541    protected Resource prescriptionTarget;
12542
12543    /**
12544     * Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.
12545     */
12546    @Child(name = "originalPrescription", type = {MedicationRequest.class}, order=16, min=0, max=1, modifier=false, summary=false)
12547    @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." )
12548    protected Reference originalPrescription;
12549
12550    /**
12551     * 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.)
12552     */
12553    protected MedicationRequest originalPrescriptionTarget;
12554
12555    /**
12556     * The party to be reimbursed for cost of the products and services according to the terms of the policy.
12557     */
12558    @Child(name = "payee", type = {}, order=17, min=0, max=1, modifier=false, summary=false)
12559    @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." )
12560    protected PayeeComponent payee;
12561
12562    /**
12563     * A reference to a referral resource.
12564     */
12565    @Child(name = "referral", type = {ServiceRequest.class}, order=18, min=0, max=1, modifier=false, summary=false)
12566    @Description(shortDefinition="Treatment Referral", formalDefinition="A reference to a referral resource." )
12567    protected Reference referral;
12568
12569    /**
12570     * The actual object that is the target of the reference (A reference to a referral resource.)
12571     */
12572    protected ServiceRequest referralTarget;
12573
12574    /**
12575     * Facility where the services were provided.
12576     */
12577    @Child(name = "facility", type = {Location.class}, order=19, min=0, max=1, modifier=false, summary=false)
12578    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
12579    protected Reference facility;
12580
12581    /**
12582     * The actual object that is the target of the reference (Facility where the services were provided.)
12583     */
12584    protected Location facilityTarget;
12585
12586    /**
12587     * The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.
12588     */
12589    @Child(name = "claim", type = {Claim.class}, order=20, min=0, max=1, modifier=false, summary=false)
12590    @Description(shortDefinition="Claim reference", formalDefinition="The business identifier for the instance of the adjudication request: claim predetermination or preauthorization." )
12591    protected Reference claim;
12592
12593    /**
12594     * The actual object that is the target of the reference (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
12595     */
12596    protected Claim claimTarget;
12597
12598    /**
12599     * The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.
12600     */
12601    @Child(name = "claimResponse", type = {ClaimResponse.class}, order=21, min=0, max=1, modifier=false, summary=false)
12602    @Description(shortDefinition="Claim response reference", formalDefinition="The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response." )
12603    protected Reference claimResponse;
12604
12605    /**
12606     * 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.)
12607     */
12608    protected ClaimResponse claimResponseTarget;
12609
12610    /**
12611     * The outcome of the claim, predetermination, or preauthorization processing.
12612     */
12613    @Child(name = "outcome", type = {CodeType.class}, order=22, min=1, max=1, modifier=false, summary=true)
12614    @Description(shortDefinition="queued | complete | error | partial", formalDefinition="The outcome of the claim, predetermination, or preauthorization processing." )
12615    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/remittance-outcome")
12616    protected Enumeration<RemittanceOutcome> outcome;
12617
12618    /**
12619     * A human readable description of the status of the adjudication.
12620     */
12621    @Child(name = "disposition", type = {StringType.class}, order=23, min=0, max=1, modifier=false, summary=false)
12622    @Description(shortDefinition="Disposition Message", formalDefinition="A human readable description of the status of the adjudication." )
12623    protected StringType disposition;
12624
12625    /**
12626     * Reference from the Insurer which is used in later communications which refers to this adjudication.
12627     */
12628    @Child(name = "preAuthRef", type = {StringType.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12629    @Description(shortDefinition="Preauthorization reference", formalDefinition="Reference from the Insurer which is used in later communications which refers to this adjudication." )
12630    protected List<StringType> preAuthRef;
12631
12632    /**
12633     * The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.
12634     */
12635    @Child(name = "preAuthRefPeriod", type = {Period.class}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12636    @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." )
12637    protected List<Period> preAuthRefPeriod;
12638
12639    /**
12640     * The members of the team who provided the products and services.
12641     */
12642    @Child(name = "careTeam", type = {}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12643    @Description(shortDefinition="Care Team members", formalDefinition="The members of the team who provided the products and services." )
12644    protected List<CareTeamComponent> careTeam;
12645
12646    /**
12647     * Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.
12648     */
12649    @Child(name = "supportingInfo", type = {}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12650    @Description(shortDefinition="Supporting information", formalDefinition="Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues." )
12651    protected List<SupportingInformationComponent> supportingInfo;
12652
12653    /**
12654     * Information about diagnoses relevant to the claim items.
12655     */
12656    @Child(name = "diagnosis", type = {}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12657    @Description(shortDefinition="Pertinent diagnosis information", formalDefinition="Information about diagnoses relevant to the claim items." )
12658    protected List<DiagnosisComponent> diagnosis;
12659
12660    /**
12661     * Procedures performed on the patient relevant to the billing items with the claim.
12662     */
12663    @Child(name = "procedure", type = {}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12664    @Description(shortDefinition="Clinical procedures performed", formalDefinition="Procedures performed on the patient relevant to the billing items with the claim." )
12665    protected List<ProcedureComponent> procedure;
12666
12667    /**
12668     * This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
12669     */
12670    @Child(name = "precedence", type = {PositiveIntType.class}, order=30, min=0, max=1, modifier=false, summary=false)
12671    @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." )
12672    protected PositiveIntType precedence;
12673
12674    /**
12675     * Financial instruments for reimbursement for the health care products and services specified on the claim.
12676     */
12677    @Child(name = "insurance", type = {}, order=31, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
12678    @Description(shortDefinition="Patient insurance information", formalDefinition="Financial instruments for reimbursement for the health care products and services specified on the claim." )
12679    protected List<InsuranceComponent> insurance;
12680
12681    /**
12682     * Details of a accident which resulted in injuries which required the products and services listed in the claim.
12683     */
12684    @Child(name = "accident", type = {}, order=32, min=0, max=1, modifier=false, summary=false)
12685    @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." )
12686    protected AccidentComponent accident;
12687
12688    /**
12689     * 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.
12690     */
12691    @Child(name = "item", type = {}, order=33, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12692    @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." )
12693    protected List<ItemComponent> item;
12694
12695    /**
12696     * The first-tier service adjudications for payor added product or service lines.
12697     */
12698    @Child(name = "addItem", type = {}, order=34, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12699    @Description(shortDefinition="Insurer added line items", formalDefinition="The first-tier service adjudications for payor added product or service lines." )
12700    protected List<AddedItemComponent> addItem;
12701
12702    /**
12703     * The adjudication results which are presented at the header level rather than at the line-item or add-item levels.
12704     */
12705    @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=35, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12706    @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." )
12707    protected List<AdjudicationComponent> adjudication;
12708
12709    /**
12710     * Categorized monetary totals for the adjudication.
12711     */
12712    @Child(name = "total", type = {}, order=36, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
12713    @Description(shortDefinition="Adjudication totals", formalDefinition="Categorized monetary totals for the adjudication." )
12714    protected List<TotalComponent> total;
12715
12716    /**
12717     * Payment details for the adjudication of the claim.
12718     */
12719    @Child(name = "payment", type = {}, order=37, min=0, max=1, modifier=false, summary=false)
12720    @Description(shortDefinition="Payment Details", formalDefinition="Payment details for the adjudication of the claim." )
12721    protected PaymentComponent payment;
12722
12723    /**
12724     * A code for the form to be used for printing the content.
12725     */
12726    @Child(name = "formCode", type = {CodeableConcept.class}, order=38, min=0, max=1, modifier=false, summary=false)
12727    @Description(shortDefinition="Printed form identifier", formalDefinition="A code for the form to be used for printing the content." )
12728    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/forms")
12729    protected CodeableConcept formCode;
12730
12731    /**
12732     * The actual form, by reference or inclusion, for printing the content or an EOB.
12733     */
12734    @Child(name = "form", type = {Attachment.class}, order=39, min=0, max=1, modifier=false, summary=false)
12735    @Description(shortDefinition="Printed reference or actual form", formalDefinition="The actual form, by reference or inclusion, for printing the content or an EOB." )
12736    protected Attachment form;
12737
12738    /**
12739     * A note that describes or explains adjudication results in a human readable form.
12740     */
12741    @Child(name = "processNote", type = {}, order=40, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12742    @Description(shortDefinition="Note concerning adjudication", formalDefinition="A note that describes or explains adjudication results in a human readable form." )
12743    protected List<NoteComponent> processNote;
12744
12745    /**
12746     * The term of the benefits documented in this response.
12747     */
12748    @Child(name = "benefitPeriod", type = {Period.class}, order=41, min=0, max=1, modifier=false, summary=false)
12749    @Description(shortDefinition="When the benefits are applicable", formalDefinition="The term of the benefits documented in this response." )
12750    protected Period benefitPeriod;
12751
12752    /**
12753     * Balance by Benefit Category.
12754     */
12755    @Child(name = "benefitBalance", type = {}, order=42, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12756    @Description(shortDefinition="Balance by Benefit Category", formalDefinition="Balance by Benefit Category." )
12757    protected List<BenefitBalanceComponent> benefitBalance;
12758
12759    private static final long serialVersionUID = -1515422099L;
12760
12761  /**
12762   * Constructor
12763   */
12764    public ExplanationOfBenefit() {
12765      super();
12766    }
12767
12768  /**
12769   * Constructor
12770   */
12771    public ExplanationOfBenefit(Enumeration<ExplanationOfBenefitStatus> status, CodeableConcept type, Enumeration<Use> use, Reference patient, DateTimeType created, Reference insurer, Reference provider, Enumeration<RemittanceOutcome> outcome) {
12772      super();
12773      this.status = status;
12774      this.type = type;
12775      this.use = use;
12776      this.patient = patient;
12777      this.created = created;
12778      this.insurer = insurer;
12779      this.provider = provider;
12780      this.outcome = outcome;
12781    }
12782
12783    /**
12784     * @return {@link #identifier} (A unique identifier assigned to this explanation of benefit.)
12785     */
12786    public List<Identifier> getIdentifier() { 
12787      if (this.identifier == null)
12788        this.identifier = new ArrayList<Identifier>();
12789      return this.identifier;
12790    }
12791
12792    /**
12793     * @return Returns a reference to <code>this</code> for easy method chaining
12794     */
12795    public ExplanationOfBenefit setIdentifier(List<Identifier> theIdentifier) { 
12796      this.identifier = theIdentifier;
12797      return this;
12798    }
12799
12800    public boolean hasIdentifier() { 
12801      if (this.identifier == null)
12802        return false;
12803      for (Identifier item : this.identifier)
12804        if (!item.isEmpty())
12805          return true;
12806      return false;
12807    }
12808
12809    public Identifier addIdentifier() { //3
12810      Identifier t = new Identifier();
12811      if (this.identifier == null)
12812        this.identifier = new ArrayList<Identifier>();
12813      this.identifier.add(t);
12814      return t;
12815    }
12816
12817    public ExplanationOfBenefit addIdentifier(Identifier t) { //3
12818      if (t == null)
12819        return this;
12820      if (this.identifier == null)
12821        this.identifier = new ArrayList<Identifier>();
12822      this.identifier.add(t);
12823      return this;
12824    }
12825
12826    /**
12827     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
12828     */
12829    public Identifier getIdentifierFirstRep() { 
12830      if (getIdentifier().isEmpty()) {
12831        addIdentifier();
12832      }
12833      return getIdentifier().get(0);
12834    }
12835
12836    /**
12837     * @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
12838     */
12839    public Enumeration<ExplanationOfBenefitStatus> getStatusElement() { 
12840      if (this.status == null)
12841        if (Configuration.errorOnAutoCreate())
12842          throw new Error("Attempt to auto-create ExplanationOfBenefit.status");
12843        else if (Configuration.doAutoCreate())
12844          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory()); // bb
12845      return this.status;
12846    }
12847
12848    public boolean hasStatusElement() { 
12849      return this.status != null && !this.status.isEmpty();
12850    }
12851
12852    public boolean hasStatus() { 
12853      return this.status != null && !this.status.isEmpty();
12854    }
12855
12856    /**
12857     * @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
12858     */
12859    public ExplanationOfBenefit setStatusElement(Enumeration<ExplanationOfBenefitStatus> value) { 
12860      this.status = value;
12861      return this;
12862    }
12863
12864    /**
12865     * @return The status of the resource instance.
12866     */
12867    public ExplanationOfBenefitStatus getStatus() { 
12868      return this.status == null ? null : this.status.getValue();
12869    }
12870
12871    /**
12872     * @param value The status of the resource instance.
12873     */
12874    public ExplanationOfBenefit setStatus(ExplanationOfBenefitStatus value) { 
12875        if (this.status == null)
12876          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory());
12877        this.status.setValue(value);
12878      return this;
12879    }
12880
12881    /**
12882     * @return {@link #type} (The category of claim, e.g. oral, pharmacy, vision, institutional, professional.)
12883     */
12884    public CodeableConcept getType() { 
12885      if (this.type == null)
12886        if (Configuration.errorOnAutoCreate())
12887          throw new Error("Attempt to auto-create ExplanationOfBenefit.type");
12888        else if (Configuration.doAutoCreate())
12889          this.type = new CodeableConcept(); // cc
12890      return this.type;
12891    }
12892
12893    public boolean hasType() { 
12894      return this.type != null && !this.type.isEmpty();
12895    }
12896
12897    /**
12898     * @param value {@link #type} (The category of claim, e.g. oral, pharmacy, vision, institutional, professional.)
12899     */
12900    public ExplanationOfBenefit setType(CodeableConcept value) { 
12901      this.type = value;
12902      return this;
12903    }
12904
12905    /**
12906     * @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.)
12907     */
12908    public CodeableConcept getSubType() { 
12909      if (this.subType == null)
12910        if (Configuration.errorOnAutoCreate())
12911          throw new Error("Attempt to auto-create ExplanationOfBenefit.subType");
12912        else if (Configuration.doAutoCreate())
12913          this.subType = new CodeableConcept(); // cc
12914      return this.subType;
12915    }
12916
12917    public boolean hasSubType() { 
12918      return this.subType != null && !this.subType.isEmpty();
12919    }
12920
12921    /**
12922     * @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.)
12923     */
12924    public ExplanationOfBenefit setSubType(CodeableConcept value) { 
12925      this.subType = value;
12926      return this;
12927    }
12928
12929    /**
12930     * @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
12931     */
12932    public Enumeration<Use> getUseElement() { 
12933      if (this.use == null)
12934        if (Configuration.errorOnAutoCreate())
12935          throw new Error("Attempt to auto-create ExplanationOfBenefit.use");
12936        else if (Configuration.doAutoCreate())
12937          this.use = new Enumeration<Use>(new UseEnumFactory()); // bb
12938      return this.use;
12939    }
12940
12941    public boolean hasUseElement() { 
12942      return this.use != null && !this.use.isEmpty();
12943    }
12944
12945    public boolean hasUse() { 
12946      return this.use != null && !this.use.isEmpty();
12947    }
12948
12949    /**
12950     * @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
12951     */
12952    public ExplanationOfBenefit setUseElement(Enumeration<Use> value) { 
12953      this.use = value;
12954      return this;
12955    }
12956
12957    /**
12958     * @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.
12959     */
12960    public Use getUse() { 
12961      return this.use == null ? null : this.use.getValue();
12962    }
12963
12964    /**
12965     * @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.
12966     */
12967    public ExplanationOfBenefit setUse(Use value) { 
12968        if (this.use == null)
12969          this.use = new Enumeration<Use>(new UseEnumFactory());
12970        this.use.setValue(value);
12971      return this;
12972    }
12973
12974    /**
12975     * @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.)
12976     */
12977    public Reference getPatient() { 
12978      if (this.patient == null)
12979        if (Configuration.errorOnAutoCreate())
12980          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
12981        else if (Configuration.doAutoCreate())
12982          this.patient = new Reference(); // cc
12983      return this.patient;
12984    }
12985
12986    public boolean hasPatient() { 
12987      return this.patient != null && !this.patient.isEmpty();
12988    }
12989
12990    /**
12991     * @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.)
12992     */
12993    public ExplanationOfBenefit setPatient(Reference value) { 
12994      this.patient = value;
12995      return this;
12996    }
12997
12998    /**
12999     * @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.)
13000     */
13001    public Patient getPatientTarget() { 
13002      if (this.patientTarget == null)
13003        if (Configuration.errorOnAutoCreate())
13004          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
13005        else if (Configuration.doAutoCreate())
13006          this.patientTarget = new Patient(); // aa
13007      return this.patientTarget;
13008    }
13009
13010    /**
13011     * @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.)
13012     */
13013    public ExplanationOfBenefit setPatientTarget(Patient value) { 
13014      this.patientTarget = value;
13015      return this;
13016    }
13017
13018    /**
13019     * @return {@link #billablePeriod} (The period for which charges are being submitted.)
13020     */
13021    public Period getBillablePeriod() { 
13022      if (this.billablePeriod == null)
13023        if (Configuration.errorOnAutoCreate())
13024          throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
13025        else if (Configuration.doAutoCreate())
13026          this.billablePeriod = new Period(); // cc
13027      return this.billablePeriod;
13028    }
13029
13030    public boolean hasBillablePeriod() { 
13031      return this.billablePeriod != null && !this.billablePeriod.isEmpty();
13032    }
13033
13034    /**
13035     * @param value {@link #billablePeriod} (The period for which charges are being submitted.)
13036     */
13037    public ExplanationOfBenefit setBillablePeriod(Period value) { 
13038      this.billablePeriod = value;
13039      return this;
13040    }
13041
13042    /**
13043     * @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
13044     */
13045    public DateTimeType getCreatedElement() { 
13046      if (this.created == null)
13047        if (Configuration.errorOnAutoCreate())
13048          throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
13049        else if (Configuration.doAutoCreate())
13050          this.created = new DateTimeType(); // bb
13051      return this.created;
13052    }
13053
13054    public boolean hasCreatedElement() { 
13055      return this.created != null && !this.created.isEmpty();
13056    }
13057
13058    public boolean hasCreated() { 
13059      return this.created != null && !this.created.isEmpty();
13060    }
13061
13062    /**
13063     * @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
13064     */
13065    public ExplanationOfBenefit setCreatedElement(DateTimeType value) { 
13066      this.created = value;
13067      return this;
13068    }
13069
13070    /**
13071     * @return The date this resource was created.
13072     */
13073    public Date getCreated() { 
13074      return this.created == null ? null : this.created.getValue();
13075    }
13076
13077    /**
13078     * @param value The date this resource was created.
13079     */
13080    public ExplanationOfBenefit setCreated(Date value) { 
13081        if (this.created == null)
13082          this.created = new DateTimeType();
13083        this.created.setValue(value);
13084      return this;
13085    }
13086
13087    /**
13088     * @return {@link #enterer} (Individual who created the claim, predetermination or preauthorization.)
13089     */
13090    public Reference getEnterer() { 
13091      if (this.enterer == null)
13092        if (Configuration.errorOnAutoCreate())
13093          throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
13094        else if (Configuration.doAutoCreate())
13095          this.enterer = new Reference(); // cc
13096      return this.enterer;
13097    }
13098
13099    public boolean hasEnterer() { 
13100      return this.enterer != null && !this.enterer.isEmpty();
13101    }
13102
13103    /**
13104     * @param value {@link #enterer} (Individual who created the claim, predetermination or preauthorization.)
13105     */
13106    public ExplanationOfBenefit setEnterer(Reference value) { 
13107      this.enterer = value;
13108      return this;
13109    }
13110
13111    /**
13112     * @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.)
13113     */
13114    public Resource getEntererTarget() { 
13115      return this.entererTarget;
13116    }
13117
13118    /**
13119     * @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.)
13120     */
13121    public ExplanationOfBenefit setEntererTarget(Resource value) { 
13122      this.entererTarget = value;
13123      return this;
13124    }
13125
13126    /**
13127     * @return {@link #insurer} (The party responsible for authorization, adjudication and reimbursement.)
13128     */
13129    public Reference getInsurer() { 
13130      if (this.insurer == null)
13131        if (Configuration.errorOnAutoCreate())
13132          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
13133        else if (Configuration.doAutoCreate())
13134          this.insurer = new Reference(); // cc
13135      return this.insurer;
13136    }
13137
13138    public boolean hasInsurer() { 
13139      return this.insurer != null && !this.insurer.isEmpty();
13140    }
13141
13142    /**
13143     * @param value {@link #insurer} (The party responsible for authorization, adjudication and reimbursement.)
13144     */
13145    public ExplanationOfBenefit setInsurer(Reference value) { 
13146      this.insurer = value;
13147      return this;
13148    }
13149
13150    /**
13151     * @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.)
13152     */
13153    public Organization getInsurerTarget() { 
13154      if (this.insurerTarget == null)
13155        if (Configuration.errorOnAutoCreate())
13156          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
13157        else if (Configuration.doAutoCreate())
13158          this.insurerTarget = new Organization(); // aa
13159      return this.insurerTarget;
13160    }
13161
13162    /**
13163     * @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.)
13164     */
13165    public ExplanationOfBenefit setInsurerTarget(Organization value) { 
13166      this.insurerTarget = value;
13167      return this;
13168    }
13169
13170    /**
13171     * @return {@link #provider} (The provider which is responsible for the claim, predetermination or preauthorization.)
13172     */
13173    public Reference getProvider() { 
13174      if (this.provider == null)
13175        if (Configuration.errorOnAutoCreate())
13176          throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
13177        else if (Configuration.doAutoCreate())
13178          this.provider = new Reference(); // cc
13179      return this.provider;
13180    }
13181
13182    public boolean hasProvider() { 
13183      return this.provider != null && !this.provider.isEmpty();
13184    }
13185
13186    /**
13187     * @param value {@link #provider} (The provider which is responsible for the claim, predetermination or preauthorization.)
13188     */
13189    public ExplanationOfBenefit setProvider(Reference value) { 
13190      this.provider = value;
13191      return this;
13192    }
13193
13194    /**
13195     * @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.)
13196     */
13197    public Resource getProviderTarget() { 
13198      return this.providerTarget;
13199    }
13200
13201    /**
13202     * @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.)
13203     */
13204    public ExplanationOfBenefit setProviderTarget(Resource value) { 
13205      this.providerTarget = value;
13206      return this;
13207    }
13208
13209    /**
13210     * @return {@link #priority} (The provider-required urgency of processing the request. Typical values include: stat, routine deferred.)
13211     */
13212    public CodeableConcept getPriority() { 
13213      if (this.priority == null)
13214        if (Configuration.errorOnAutoCreate())
13215          throw new Error("Attempt to auto-create ExplanationOfBenefit.priority");
13216        else if (Configuration.doAutoCreate())
13217          this.priority = new CodeableConcept(); // cc
13218      return this.priority;
13219    }
13220
13221    public boolean hasPriority() { 
13222      return this.priority != null && !this.priority.isEmpty();
13223    }
13224
13225    /**
13226     * @param value {@link #priority} (The provider-required urgency of processing the request. Typical values include: stat, routine deferred.)
13227     */
13228    public ExplanationOfBenefit setPriority(CodeableConcept value) { 
13229      this.priority = value;
13230      return this;
13231    }
13232
13233    /**
13234     * @return {@link #fundsReserveRequested} (A code to indicate whether and for whom funds are to be reserved for future claims.)
13235     */
13236    public CodeableConcept getFundsReserveRequested() { 
13237      if (this.fundsReserveRequested == null)
13238        if (Configuration.errorOnAutoCreate())
13239          throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserveRequested");
13240        else if (Configuration.doAutoCreate())
13241          this.fundsReserveRequested = new CodeableConcept(); // cc
13242      return this.fundsReserveRequested;
13243    }
13244
13245    public boolean hasFundsReserveRequested() { 
13246      return this.fundsReserveRequested != null && !this.fundsReserveRequested.isEmpty();
13247    }
13248
13249    /**
13250     * @param value {@link #fundsReserveRequested} (A code to indicate whether and for whom funds are to be reserved for future claims.)
13251     */
13252    public ExplanationOfBenefit setFundsReserveRequested(CodeableConcept value) { 
13253      this.fundsReserveRequested = value;
13254      return this;
13255    }
13256
13257    /**
13258     * @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.)
13259     */
13260    public CodeableConcept getFundsReserve() { 
13261      if (this.fundsReserve == null)
13262        if (Configuration.errorOnAutoCreate())
13263          throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserve");
13264        else if (Configuration.doAutoCreate())
13265          this.fundsReserve = new CodeableConcept(); // cc
13266      return this.fundsReserve;
13267    }
13268
13269    public boolean hasFundsReserve() { 
13270      return this.fundsReserve != null && !this.fundsReserve.isEmpty();
13271    }
13272
13273    /**
13274     * @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.)
13275     */
13276    public ExplanationOfBenefit setFundsReserve(CodeableConcept value) { 
13277      this.fundsReserve = value;
13278      return this;
13279    }
13280
13281    /**
13282     * @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.)
13283     */
13284    public List<RelatedClaimComponent> getRelated() { 
13285      if (this.related == null)
13286        this.related = new ArrayList<RelatedClaimComponent>();
13287      return this.related;
13288    }
13289
13290    /**
13291     * @return Returns a reference to <code>this</code> for easy method chaining
13292     */
13293    public ExplanationOfBenefit setRelated(List<RelatedClaimComponent> theRelated) { 
13294      this.related = theRelated;
13295      return this;
13296    }
13297
13298    public boolean hasRelated() { 
13299      if (this.related == null)
13300        return false;
13301      for (RelatedClaimComponent item : this.related)
13302        if (!item.isEmpty())
13303          return true;
13304      return false;
13305    }
13306
13307    public RelatedClaimComponent addRelated() { //3
13308      RelatedClaimComponent t = new RelatedClaimComponent();
13309      if (this.related == null)
13310        this.related = new ArrayList<RelatedClaimComponent>();
13311      this.related.add(t);
13312      return t;
13313    }
13314
13315    public ExplanationOfBenefit addRelated(RelatedClaimComponent t) { //3
13316      if (t == null)
13317        return this;
13318      if (this.related == null)
13319        this.related = new ArrayList<RelatedClaimComponent>();
13320      this.related.add(t);
13321      return this;
13322    }
13323
13324    /**
13325     * @return The first repetition of repeating field {@link #related}, creating it if it does not already exist
13326     */
13327    public RelatedClaimComponent getRelatedFirstRep() { 
13328      if (getRelated().isEmpty()) {
13329        addRelated();
13330      }
13331      return getRelated().get(0);
13332    }
13333
13334    /**
13335     * @return {@link #prescription} (Prescription to support the dispensing of pharmacy, device or vision products.)
13336     */
13337    public Reference getPrescription() { 
13338      if (this.prescription == null)
13339        if (Configuration.errorOnAutoCreate())
13340          throw new Error("Attempt to auto-create ExplanationOfBenefit.prescription");
13341        else if (Configuration.doAutoCreate())
13342          this.prescription = new Reference(); // cc
13343      return this.prescription;
13344    }
13345
13346    public boolean hasPrescription() { 
13347      return this.prescription != null && !this.prescription.isEmpty();
13348    }
13349
13350    /**
13351     * @param value {@link #prescription} (Prescription to support the dispensing of pharmacy, device or vision products.)
13352     */
13353    public ExplanationOfBenefit setPrescription(Reference value) { 
13354      this.prescription = value;
13355      return this;
13356    }
13357
13358    /**
13359     * @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.)
13360     */
13361    public Resource getPrescriptionTarget() { 
13362      return this.prescriptionTarget;
13363    }
13364
13365    /**
13366     * @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.)
13367     */
13368    public ExplanationOfBenefit setPrescriptionTarget(Resource value) { 
13369      this.prescriptionTarget = value;
13370      return this;
13371    }
13372
13373    /**
13374     * @return {@link #originalPrescription} (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
13375     */
13376    public Reference getOriginalPrescription() { 
13377      if (this.originalPrescription == null)
13378        if (Configuration.errorOnAutoCreate())
13379          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
13380        else if (Configuration.doAutoCreate())
13381          this.originalPrescription = new Reference(); // cc
13382      return this.originalPrescription;
13383    }
13384
13385    public boolean hasOriginalPrescription() { 
13386      return this.originalPrescription != null && !this.originalPrescription.isEmpty();
13387    }
13388
13389    /**
13390     * @param value {@link #originalPrescription} (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
13391     */
13392    public ExplanationOfBenefit setOriginalPrescription(Reference value) { 
13393      this.originalPrescription = value;
13394      return this;
13395    }
13396
13397    /**
13398     * @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.)
13399     */
13400    public MedicationRequest getOriginalPrescriptionTarget() { 
13401      if (this.originalPrescriptionTarget == null)
13402        if (Configuration.errorOnAutoCreate())
13403          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
13404        else if (Configuration.doAutoCreate())
13405          this.originalPrescriptionTarget = new MedicationRequest(); // aa
13406      return this.originalPrescriptionTarget;
13407    }
13408
13409    /**
13410     * @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.)
13411     */
13412    public ExplanationOfBenefit setOriginalPrescriptionTarget(MedicationRequest value) { 
13413      this.originalPrescriptionTarget = value;
13414      return this;
13415    }
13416
13417    /**
13418     * @return {@link #payee} (The party to be reimbursed for cost of the products and services according to the terms of the policy.)
13419     */
13420    public PayeeComponent getPayee() { 
13421      if (this.payee == null)
13422        if (Configuration.errorOnAutoCreate())
13423          throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
13424        else if (Configuration.doAutoCreate())
13425          this.payee = new PayeeComponent(); // cc
13426      return this.payee;
13427    }
13428
13429    public boolean hasPayee() { 
13430      return this.payee != null && !this.payee.isEmpty();
13431    }
13432
13433    /**
13434     * @param value {@link #payee} (The party to be reimbursed for cost of the products and services according to the terms of the policy.)
13435     */
13436    public ExplanationOfBenefit setPayee(PayeeComponent value) { 
13437      this.payee = value;
13438      return this;
13439    }
13440
13441    /**
13442     * @return {@link #referral} (A reference to a referral resource.)
13443     */
13444    public Reference getReferral() { 
13445      if (this.referral == null)
13446        if (Configuration.errorOnAutoCreate())
13447          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
13448        else if (Configuration.doAutoCreate())
13449          this.referral = new Reference(); // cc
13450      return this.referral;
13451    }
13452
13453    public boolean hasReferral() { 
13454      return this.referral != null && !this.referral.isEmpty();
13455    }
13456
13457    /**
13458     * @param value {@link #referral} (A reference to a referral resource.)
13459     */
13460    public ExplanationOfBenefit setReferral(Reference value) { 
13461      this.referral = value;
13462      return this;
13463    }
13464
13465    /**
13466     * @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.)
13467     */
13468    public ServiceRequest getReferralTarget() { 
13469      if (this.referralTarget == null)
13470        if (Configuration.errorOnAutoCreate())
13471          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
13472        else if (Configuration.doAutoCreate())
13473          this.referralTarget = new ServiceRequest(); // aa
13474      return this.referralTarget;
13475    }
13476
13477    /**
13478     * @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.)
13479     */
13480    public ExplanationOfBenefit setReferralTarget(ServiceRequest value) { 
13481      this.referralTarget = value;
13482      return this;
13483    }
13484
13485    /**
13486     * @return {@link #facility} (Facility where the services were provided.)
13487     */
13488    public Reference getFacility() { 
13489      if (this.facility == null)
13490        if (Configuration.errorOnAutoCreate())
13491          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
13492        else if (Configuration.doAutoCreate())
13493          this.facility = new Reference(); // cc
13494      return this.facility;
13495    }
13496
13497    public boolean hasFacility() { 
13498      return this.facility != null && !this.facility.isEmpty();
13499    }
13500
13501    /**
13502     * @param value {@link #facility} (Facility where the services were provided.)
13503     */
13504    public ExplanationOfBenefit setFacility(Reference value) { 
13505      this.facility = value;
13506      return this;
13507    }
13508
13509    /**
13510     * @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.)
13511     */
13512    public Location getFacilityTarget() { 
13513      if (this.facilityTarget == null)
13514        if (Configuration.errorOnAutoCreate())
13515          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
13516        else if (Configuration.doAutoCreate())
13517          this.facilityTarget = new Location(); // aa
13518      return this.facilityTarget;
13519    }
13520
13521    /**
13522     * @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.)
13523     */
13524    public ExplanationOfBenefit setFacilityTarget(Location value) { 
13525      this.facilityTarget = value;
13526      return this;
13527    }
13528
13529    /**
13530     * @return {@link #claim} (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
13531     */
13532    public Reference getClaim() { 
13533      if (this.claim == null)
13534        if (Configuration.errorOnAutoCreate())
13535          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
13536        else if (Configuration.doAutoCreate())
13537          this.claim = new Reference(); // cc
13538      return this.claim;
13539    }
13540
13541    public boolean hasClaim() { 
13542      return this.claim != null && !this.claim.isEmpty();
13543    }
13544
13545    /**
13546     * @param value {@link #claim} (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
13547     */
13548    public ExplanationOfBenefit setClaim(Reference value) { 
13549      this.claim = value;
13550      return this;
13551    }
13552
13553    /**
13554     * @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.)
13555     */
13556    public Claim getClaimTarget() { 
13557      if (this.claimTarget == null)
13558        if (Configuration.errorOnAutoCreate())
13559          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
13560        else if (Configuration.doAutoCreate())
13561          this.claimTarget = new Claim(); // aa
13562      return this.claimTarget;
13563    }
13564
13565    /**
13566     * @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.)
13567     */
13568    public ExplanationOfBenefit setClaimTarget(Claim value) { 
13569      this.claimTarget = value;
13570      return this;
13571    }
13572
13573    /**
13574     * @return {@link #claimResponse} (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
13575     */
13576    public Reference getClaimResponse() { 
13577      if (this.claimResponse == null)
13578        if (Configuration.errorOnAutoCreate())
13579          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
13580        else if (Configuration.doAutoCreate())
13581          this.claimResponse = new Reference(); // cc
13582      return this.claimResponse;
13583    }
13584
13585    public boolean hasClaimResponse() { 
13586      return this.claimResponse != null && !this.claimResponse.isEmpty();
13587    }
13588
13589    /**
13590     * @param value {@link #claimResponse} (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
13591     */
13592    public ExplanationOfBenefit setClaimResponse(Reference value) { 
13593      this.claimResponse = value;
13594      return this;
13595    }
13596
13597    /**
13598     * @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.)
13599     */
13600    public ClaimResponse getClaimResponseTarget() { 
13601      if (this.claimResponseTarget == null)
13602        if (Configuration.errorOnAutoCreate())
13603          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
13604        else if (Configuration.doAutoCreate())
13605          this.claimResponseTarget = new ClaimResponse(); // aa
13606      return this.claimResponseTarget;
13607    }
13608
13609    /**
13610     * @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.)
13611     */
13612    public ExplanationOfBenefit setClaimResponseTarget(ClaimResponse value) { 
13613      this.claimResponseTarget = value;
13614      return this;
13615    }
13616
13617    /**
13618     * @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
13619     */
13620    public Enumeration<RemittanceOutcome> getOutcomeElement() { 
13621      if (this.outcome == null)
13622        if (Configuration.errorOnAutoCreate())
13623          throw new Error("Attempt to auto-create ExplanationOfBenefit.outcome");
13624        else if (Configuration.doAutoCreate())
13625          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory()); // bb
13626      return this.outcome;
13627    }
13628
13629    public boolean hasOutcomeElement() { 
13630      return this.outcome != null && !this.outcome.isEmpty();
13631    }
13632
13633    public boolean hasOutcome() { 
13634      return this.outcome != null && !this.outcome.isEmpty();
13635    }
13636
13637    /**
13638     * @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
13639     */
13640    public ExplanationOfBenefit setOutcomeElement(Enumeration<RemittanceOutcome> value) { 
13641      this.outcome = value;
13642      return this;
13643    }
13644
13645    /**
13646     * @return The outcome of the claim, predetermination, or preauthorization processing.
13647     */
13648    public RemittanceOutcome getOutcome() { 
13649      return this.outcome == null ? null : this.outcome.getValue();
13650    }
13651
13652    /**
13653     * @param value The outcome of the claim, predetermination, or preauthorization processing.
13654     */
13655    public ExplanationOfBenefit setOutcome(RemittanceOutcome value) { 
13656        if (this.outcome == null)
13657          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory());
13658        this.outcome.setValue(value);
13659      return this;
13660    }
13661
13662    /**
13663     * @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
13664     */
13665    public StringType getDispositionElement() { 
13666      if (this.disposition == null)
13667        if (Configuration.errorOnAutoCreate())
13668          throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
13669        else if (Configuration.doAutoCreate())
13670          this.disposition = new StringType(); // bb
13671      return this.disposition;
13672    }
13673
13674    public boolean hasDispositionElement() { 
13675      return this.disposition != null && !this.disposition.isEmpty();
13676    }
13677
13678    public boolean hasDisposition() { 
13679      return this.disposition != null && !this.disposition.isEmpty();
13680    }
13681
13682    /**
13683     * @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
13684     */
13685    public ExplanationOfBenefit setDispositionElement(StringType value) { 
13686      this.disposition = value;
13687      return this;
13688    }
13689
13690    /**
13691     * @return A human readable description of the status of the adjudication.
13692     */
13693    public String getDisposition() { 
13694      return this.disposition == null ? null : this.disposition.getValue();
13695    }
13696
13697    /**
13698     * @param value A human readable description of the status of the adjudication.
13699     */
13700    public ExplanationOfBenefit setDisposition(String value) { 
13701      if (Utilities.noString(value))
13702        this.disposition = null;
13703      else {
13704        if (this.disposition == null)
13705          this.disposition = new StringType();
13706        this.disposition.setValue(value);
13707      }
13708      return this;
13709    }
13710
13711    /**
13712     * @return {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13713     */
13714    public List<StringType> getPreAuthRef() { 
13715      if (this.preAuthRef == null)
13716        this.preAuthRef = new ArrayList<StringType>();
13717      return this.preAuthRef;
13718    }
13719
13720    /**
13721     * @return Returns a reference to <code>this</code> for easy method chaining
13722     */
13723    public ExplanationOfBenefit setPreAuthRef(List<StringType> thePreAuthRef) { 
13724      this.preAuthRef = thePreAuthRef;
13725      return this;
13726    }
13727
13728    public boolean hasPreAuthRef() { 
13729      if (this.preAuthRef == null)
13730        return false;
13731      for (StringType item : this.preAuthRef)
13732        if (!item.isEmpty())
13733          return true;
13734      return false;
13735    }
13736
13737    /**
13738     * @return {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13739     */
13740    public StringType addPreAuthRefElement() {//2 
13741      StringType t = new StringType();
13742      if (this.preAuthRef == null)
13743        this.preAuthRef = new ArrayList<StringType>();
13744      this.preAuthRef.add(t);
13745      return t;
13746    }
13747
13748    /**
13749     * @param value {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13750     */
13751    public ExplanationOfBenefit addPreAuthRef(String value) { //1
13752      StringType t = new StringType();
13753      t.setValue(value);
13754      if (this.preAuthRef == null)
13755        this.preAuthRef = new ArrayList<StringType>();
13756      this.preAuthRef.add(t);
13757      return this;
13758    }
13759
13760    /**
13761     * @param value {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13762     */
13763    public boolean hasPreAuthRef(String value) { 
13764      if (this.preAuthRef == null)
13765        return false;
13766      for (StringType v : this.preAuthRef)
13767        if (v.getValue().equals(value)) // string
13768          return true;
13769      return false;
13770    }
13771
13772    /**
13773     * @return {@link #preAuthRefPeriod} (The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.)
13774     */
13775    public List<Period> getPreAuthRefPeriod() { 
13776      if (this.preAuthRefPeriod == null)
13777        this.preAuthRefPeriod = new ArrayList<Period>();
13778      return this.preAuthRefPeriod;
13779    }
13780
13781    /**
13782     * @return Returns a reference to <code>this</code> for easy method chaining
13783     */
13784    public ExplanationOfBenefit setPreAuthRefPeriod(List<Period> thePreAuthRefPeriod) { 
13785      this.preAuthRefPeriod = thePreAuthRefPeriod;
13786      return this;
13787    }
13788
13789    public boolean hasPreAuthRefPeriod() { 
13790      if (this.preAuthRefPeriod == null)
13791        return false;
13792      for (Period item : this.preAuthRefPeriod)
13793        if (!item.isEmpty())
13794          return true;
13795      return false;
13796    }
13797
13798    public Period addPreAuthRefPeriod() { //3
13799      Period t = new Period();
13800      if (this.preAuthRefPeriod == null)
13801        this.preAuthRefPeriod = new ArrayList<Period>();
13802      this.preAuthRefPeriod.add(t);
13803      return t;
13804    }
13805
13806    public ExplanationOfBenefit addPreAuthRefPeriod(Period t) { //3
13807      if (t == null)
13808        return this;
13809      if (this.preAuthRefPeriod == null)
13810        this.preAuthRefPeriod = new ArrayList<Period>();
13811      this.preAuthRefPeriod.add(t);
13812      return this;
13813    }
13814
13815    /**
13816     * @return The first repetition of repeating field {@link #preAuthRefPeriod}, creating it if it does not already exist
13817     */
13818    public Period getPreAuthRefPeriodFirstRep() { 
13819      if (getPreAuthRefPeriod().isEmpty()) {
13820        addPreAuthRefPeriod();
13821      }
13822      return getPreAuthRefPeriod().get(0);
13823    }
13824
13825    /**
13826     * @return {@link #careTeam} (The members of the team who provided the products and services.)
13827     */
13828    public List<CareTeamComponent> getCareTeam() { 
13829      if (this.careTeam == null)
13830        this.careTeam = new ArrayList<CareTeamComponent>();
13831      return this.careTeam;
13832    }
13833
13834    /**
13835     * @return Returns a reference to <code>this</code> for easy method chaining
13836     */
13837    public ExplanationOfBenefit setCareTeam(List<CareTeamComponent> theCareTeam) { 
13838      this.careTeam = theCareTeam;
13839      return this;
13840    }
13841
13842    public boolean hasCareTeam() { 
13843      if (this.careTeam == null)
13844        return false;
13845      for (CareTeamComponent item : this.careTeam)
13846        if (!item.isEmpty())
13847          return true;
13848      return false;
13849    }
13850
13851    public CareTeamComponent addCareTeam() { //3
13852      CareTeamComponent t = new CareTeamComponent();
13853      if (this.careTeam == null)
13854        this.careTeam = new ArrayList<CareTeamComponent>();
13855      this.careTeam.add(t);
13856      return t;
13857    }
13858
13859    public ExplanationOfBenefit addCareTeam(CareTeamComponent t) { //3
13860      if (t == null)
13861        return this;
13862      if (this.careTeam == null)
13863        this.careTeam = new ArrayList<CareTeamComponent>();
13864      this.careTeam.add(t);
13865      return this;
13866    }
13867
13868    /**
13869     * @return The first repetition of repeating field {@link #careTeam}, creating it if it does not already exist
13870     */
13871    public CareTeamComponent getCareTeamFirstRep() { 
13872      if (getCareTeam().isEmpty()) {
13873        addCareTeam();
13874      }
13875      return getCareTeam().get(0);
13876    }
13877
13878    /**
13879     * @return {@link #supportingInfo} (Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.)
13880     */
13881    public List<SupportingInformationComponent> getSupportingInfo() { 
13882      if (this.supportingInfo == null)
13883        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13884      return this.supportingInfo;
13885    }
13886
13887    /**
13888     * @return Returns a reference to <code>this</code> for easy method chaining
13889     */
13890    public ExplanationOfBenefit setSupportingInfo(List<SupportingInformationComponent> theSupportingInfo) { 
13891      this.supportingInfo = theSupportingInfo;
13892      return this;
13893    }
13894
13895    public boolean hasSupportingInfo() { 
13896      if (this.supportingInfo == null)
13897        return false;
13898      for (SupportingInformationComponent item : this.supportingInfo)
13899        if (!item.isEmpty())
13900          return true;
13901      return false;
13902    }
13903
13904    public SupportingInformationComponent addSupportingInfo() { //3
13905      SupportingInformationComponent t = new SupportingInformationComponent();
13906      if (this.supportingInfo == null)
13907        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13908      this.supportingInfo.add(t);
13909      return t;
13910    }
13911
13912    public ExplanationOfBenefit addSupportingInfo(SupportingInformationComponent t) { //3
13913      if (t == null)
13914        return this;
13915      if (this.supportingInfo == null)
13916        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13917      this.supportingInfo.add(t);
13918      return this;
13919    }
13920
13921    /**
13922     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist
13923     */
13924    public SupportingInformationComponent getSupportingInfoFirstRep() { 
13925      if (getSupportingInfo().isEmpty()) {
13926        addSupportingInfo();
13927      }
13928      return getSupportingInfo().get(0);
13929    }
13930
13931    /**
13932     * @return {@link #diagnosis} (Information about diagnoses relevant to the claim items.)
13933     */
13934    public List<DiagnosisComponent> getDiagnosis() { 
13935      if (this.diagnosis == null)
13936        this.diagnosis = new ArrayList<DiagnosisComponent>();
13937      return this.diagnosis;
13938    }
13939
13940    /**
13941     * @return Returns a reference to <code>this</code> for easy method chaining
13942     */
13943    public ExplanationOfBenefit setDiagnosis(List<DiagnosisComponent> theDiagnosis) { 
13944      this.diagnosis = theDiagnosis;
13945      return this;
13946    }
13947
13948    public boolean hasDiagnosis() { 
13949      if (this.diagnosis == null)
13950        return false;
13951      for (DiagnosisComponent item : this.diagnosis)
13952        if (!item.isEmpty())
13953          return true;
13954      return false;
13955    }
13956
13957    public DiagnosisComponent addDiagnosis() { //3
13958      DiagnosisComponent t = new DiagnosisComponent();
13959      if (this.diagnosis == null)
13960        this.diagnosis = new ArrayList<DiagnosisComponent>();
13961      this.diagnosis.add(t);
13962      return t;
13963    }
13964
13965    public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { //3
13966      if (t == null)
13967        return this;
13968      if (this.diagnosis == null)
13969        this.diagnosis = new ArrayList<DiagnosisComponent>();
13970      this.diagnosis.add(t);
13971      return this;
13972    }
13973
13974    /**
13975     * @return The first repetition of repeating field {@link #diagnosis}, creating it if it does not already exist
13976     */
13977    public DiagnosisComponent getDiagnosisFirstRep() { 
13978      if (getDiagnosis().isEmpty()) {
13979        addDiagnosis();
13980      }
13981      return getDiagnosis().get(0);
13982    }
13983
13984    /**
13985     * @return {@link #procedure} (Procedures performed on the patient relevant to the billing items with the claim.)
13986     */
13987    public List<ProcedureComponent> getProcedure() { 
13988      if (this.procedure == null)
13989        this.procedure = new ArrayList<ProcedureComponent>();
13990      return this.procedure;
13991    }
13992
13993    /**
13994     * @return Returns a reference to <code>this</code> for easy method chaining
13995     */
13996    public ExplanationOfBenefit setProcedure(List<ProcedureComponent> theProcedure) { 
13997      this.procedure = theProcedure;
13998      return this;
13999    }
14000
14001    public boolean hasProcedure() { 
14002      if (this.procedure == null)
14003        return false;
14004      for (ProcedureComponent item : this.procedure)
14005        if (!item.isEmpty())
14006          return true;
14007      return false;
14008    }
14009
14010    public ProcedureComponent addProcedure() { //3
14011      ProcedureComponent t = new ProcedureComponent();
14012      if (this.procedure == null)
14013        this.procedure = new ArrayList<ProcedureComponent>();
14014      this.procedure.add(t);
14015      return t;
14016    }
14017
14018    public ExplanationOfBenefit addProcedure(ProcedureComponent t) { //3
14019      if (t == null)
14020        return this;
14021      if (this.procedure == null)
14022        this.procedure = new ArrayList<ProcedureComponent>();
14023      this.procedure.add(t);
14024      return this;
14025    }
14026
14027    /**
14028     * @return The first repetition of repeating field {@link #procedure}, creating it if it does not already exist
14029     */
14030    public ProcedureComponent getProcedureFirstRep() { 
14031      if (getProcedure().isEmpty()) {
14032        addProcedure();
14033      }
14034      return getProcedure().get(0);
14035    }
14036
14037    /**
14038     * @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
14039     */
14040    public PositiveIntType getPrecedenceElement() { 
14041      if (this.precedence == null)
14042        if (Configuration.errorOnAutoCreate())
14043          throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
14044        else if (Configuration.doAutoCreate())
14045          this.precedence = new PositiveIntType(); // bb
14046      return this.precedence;
14047    }
14048
14049    public boolean hasPrecedenceElement() { 
14050      return this.precedence != null && !this.precedence.isEmpty();
14051    }
14052
14053    public boolean hasPrecedence() { 
14054      return this.precedence != null && !this.precedence.isEmpty();
14055    }
14056
14057    /**
14058     * @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
14059     */
14060    public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) { 
14061      this.precedence = value;
14062      return this;
14063    }
14064
14065    /**
14066     * @return This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
14067     */
14068    public int getPrecedence() { 
14069      return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
14070    }
14071
14072    /**
14073     * @param value This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
14074     */
14075    public ExplanationOfBenefit setPrecedence(int value) { 
14076        if (this.precedence == null)
14077          this.precedence = new PositiveIntType();
14078        this.precedence.setValue(value);
14079      return this;
14080    }
14081
14082    /**
14083     * @return {@link #insurance} (Financial instruments for reimbursement for the health care products and services specified on the claim.)
14084     */
14085    public List<InsuranceComponent> getInsurance() { 
14086      if (this.insurance == null)
14087        this.insurance = new ArrayList<InsuranceComponent>();
14088      return this.insurance;
14089    }
14090
14091    /**
14092     * @return Returns a reference to <code>this</code> for easy method chaining
14093     */
14094    public ExplanationOfBenefit setInsurance(List<InsuranceComponent> theInsurance) { 
14095      this.insurance = theInsurance;
14096      return this;
14097    }
14098
14099    public boolean hasInsurance() { 
14100      if (this.insurance == null)
14101        return false;
14102      for (InsuranceComponent item : this.insurance)
14103        if (!item.isEmpty())
14104          return true;
14105      return false;
14106    }
14107
14108    public InsuranceComponent addInsurance() { //3
14109      InsuranceComponent t = new InsuranceComponent();
14110      if (this.insurance == null)
14111        this.insurance = new ArrayList<InsuranceComponent>();
14112      this.insurance.add(t);
14113      return t;
14114    }
14115
14116    public ExplanationOfBenefit addInsurance(InsuranceComponent t) { //3
14117      if (t == null)
14118        return this;
14119      if (this.insurance == null)
14120        this.insurance = new ArrayList<InsuranceComponent>();
14121      this.insurance.add(t);
14122      return this;
14123    }
14124
14125    /**
14126     * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist
14127     */
14128    public InsuranceComponent getInsuranceFirstRep() { 
14129      if (getInsurance().isEmpty()) {
14130        addInsurance();
14131      }
14132      return getInsurance().get(0);
14133    }
14134
14135    /**
14136     * @return {@link #accident} (Details of a accident which resulted in injuries which required the products and services listed in the claim.)
14137     */
14138    public AccidentComponent getAccident() { 
14139      if (this.accident == null)
14140        if (Configuration.errorOnAutoCreate())
14141          throw new Error("Attempt to auto-create ExplanationOfBenefit.accident");
14142        else if (Configuration.doAutoCreate())
14143          this.accident = new AccidentComponent(); // cc
14144      return this.accident;
14145    }
14146
14147    public boolean hasAccident() { 
14148      return this.accident != null && !this.accident.isEmpty();
14149    }
14150
14151    /**
14152     * @param value {@link #accident} (Details of a accident which resulted in injuries which required the products and services listed in the claim.)
14153     */
14154    public ExplanationOfBenefit setAccident(AccidentComponent value) { 
14155      this.accident = value;
14156      return this;
14157    }
14158
14159    /**
14160     * @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.)
14161     */
14162    public List<ItemComponent> getItem() { 
14163      if (this.item == null)
14164        this.item = new ArrayList<ItemComponent>();
14165      return this.item;
14166    }
14167
14168    /**
14169     * @return Returns a reference to <code>this</code> for easy method chaining
14170     */
14171    public ExplanationOfBenefit setItem(List<ItemComponent> theItem) { 
14172      this.item = theItem;
14173      return this;
14174    }
14175
14176    public boolean hasItem() { 
14177      if (this.item == null)
14178        return false;
14179      for (ItemComponent item : this.item)
14180        if (!item.isEmpty())
14181          return true;
14182      return false;
14183    }
14184
14185    public ItemComponent addItem() { //3
14186      ItemComponent t = new ItemComponent();
14187      if (this.item == null)
14188        this.item = new ArrayList<ItemComponent>();
14189      this.item.add(t);
14190      return t;
14191    }
14192
14193    public ExplanationOfBenefit addItem(ItemComponent t) { //3
14194      if (t == null)
14195        return this;
14196      if (this.item == null)
14197        this.item = new ArrayList<ItemComponent>();
14198      this.item.add(t);
14199      return this;
14200    }
14201
14202    /**
14203     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
14204     */
14205    public ItemComponent getItemFirstRep() { 
14206      if (getItem().isEmpty()) {
14207        addItem();
14208      }
14209      return getItem().get(0);
14210    }
14211
14212    /**
14213     * @return {@link #addItem} (The first-tier service adjudications for payor added product or service lines.)
14214     */
14215    public List<AddedItemComponent> getAddItem() { 
14216      if (this.addItem == null)
14217        this.addItem = new ArrayList<AddedItemComponent>();
14218      return this.addItem;
14219    }
14220
14221    /**
14222     * @return Returns a reference to <code>this</code> for easy method chaining
14223     */
14224    public ExplanationOfBenefit setAddItem(List<AddedItemComponent> theAddItem) { 
14225      this.addItem = theAddItem;
14226      return this;
14227    }
14228
14229    public boolean hasAddItem() { 
14230      if (this.addItem == null)
14231        return false;
14232      for (AddedItemComponent item : this.addItem)
14233        if (!item.isEmpty())
14234          return true;
14235      return false;
14236    }
14237
14238    public AddedItemComponent addAddItem() { //3
14239      AddedItemComponent t = new AddedItemComponent();
14240      if (this.addItem == null)
14241        this.addItem = new ArrayList<AddedItemComponent>();
14242      this.addItem.add(t);
14243      return t;
14244    }
14245
14246    public ExplanationOfBenefit addAddItem(AddedItemComponent t) { //3
14247      if (t == null)
14248        return this;
14249      if (this.addItem == null)
14250        this.addItem = new ArrayList<AddedItemComponent>();
14251      this.addItem.add(t);
14252      return this;
14253    }
14254
14255    /**
14256     * @return The first repetition of repeating field {@link #addItem}, creating it if it does not already exist
14257     */
14258    public AddedItemComponent getAddItemFirstRep() { 
14259      if (getAddItem().isEmpty()) {
14260        addAddItem();
14261      }
14262      return getAddItem().get(0);
14263    }
14264
14265    /**
14266     * @return {@link #adjudication} (The adjudication results which are presented at the header level rather than at the line-item or add-item levels.)
14267     */
14268    public List<AdjudicationComponent> getAdjudication() { 
14269      if (this.adjudication == null)
14270        this.adjudication = new ArrayList<AdjudicationComponent>();
14271      return this.adjudication;
14272    }
14273
14274    /**
14275     * @return Returns a reference to <code>this</code> for easy method chaining
14276     */
14277    public ExplanationOfBenefit setAdjudication(List<AdjudicationComponent> theAdjudication) { 
14278      this.adjudication = theAdjudication;
14279      return this;
14280    }
14281
14282    public boolean hasAdjudication() { 
14283      if (this.adjudication == null)
14284        return false;
14285      for (AdjudicationComponent item : this.adjudication)
14286        if (!item.isEmpty())
14287          return true;
14288      return false;
14289    }
14290
14291    public AdjudicationComponent addAdjudication() { //3
14292      AdjudicationComponent t = new AdjudicationComponent();
14293      if (this.adjudication == null)
14294        this.adjudication = new ArrayList<AdjudicationComponent>();
14295      this.adjudication.add(t);
14296      return t;
14297    }
14298
14299    public ExplanationOfBenefit addAdjudication(AdjudicationComponent t) { //3
14300      if (t == null)
14301        return this;
14302      if (this.adjudication == null)
14303        this.adjudication = new ArrayList<AdjudicationComponent>();
14304      this.adjudication.add(t);
14305      return this;
14306    }
14307
14308    /**
14309     * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
14310     */
14311    public AdjudicationComponent getAdjudicationFirstRep() { 
14312      if (getAdjudication().isEmpty()) {
14313        addAdjudication();
14314      }
14315      return getAdjudication().get(0);
14316    }
14317
14318    /**
14319     * @return {@link #total} (Categorized monetary totals for the adjudication.)
14320     */
14321    public List<TotalComponent> getTotal() { 
14322      if (this.total == null)
14323        this.total = new ArrayList<TotalComponent>();
14324      return this.total;
14325    }
14326
14327    /**
14328     * @return Returns a reference to <code>this</code> for easy method chaining
14329     */
14330    public ExplanationOfBenefit setTotal(List<TotalComponent> theTotal) { 
14331      this.total = theTotal;
14332      return this;
14333    }
14334
14335    public boolean hasTotal() { 
14336      if (this.total == null)
14337        return false;
14338      for (TotalComponent item : this.total)
14339        if (!item.isEmpty())
14340          return true;
14341      return false;
14342    }
14343
14344    public TotalComponent addTotal() { //3
14345      TotalComponent t = new TotalComponent();
14346      if (this.total == null)
14347        this.total = new ArrayList<TotalComponent>();
14348      this.total.add(t);
14349      return t;
14350    }
14351
14352    public ExplanationOfBenefit addTotal(TotalComponent t) { //3
14353      if (t == null)
14354        return this;
14355      if (this.total == null)
14356        this.total = new ArrayList<TotalComponent>();
14357      this.total.add(t);
14358      return this;
14359    }
14360
14361    /**
14362     * @return The first repetition of repeating field {@link #total}, creating it if it does not already exist
14363     */
14364    public TotalComponent getTotalFirstRep() { 
14365      if (getTotal().isEmpty()) {
14366        addTotal();
14367      }
14368      return getTotal().get(0);
14369    }
14370
14371    /**
14372     * @return {@link #payment} (Payment details for the adjudication of the claim.)
14373     */
14374    public PaymentComponent getPayment() { 
14375      if (this.payment == null)
14376        if (Configuration.errorOnAutoCreate())
14377          throw new Error("Attempt to auto-create ExplanationOfBenefit.payment");
14378        else if (Configuration.doAutoCreate())
14379          this.payment = new PaymentComponent(); // cc
14380      return this.payment;
14381    }
14382
14383    public boolean hasPayment() { 
14384      return this.payment != null && !this.payment.isEmpty();
14385    }
14386
14387    /**
14388     * @param value {@link #payment} (Payment details for the adjudication of the claim.)
14389     */
14390    public ExplanationOfBenefit setPayment(PaymentComponent value) { 
14391      this.payment = value;
14392      return this;
14393    }
14394
14395    /**
14396     * @return {@link #formCode} (A code for the form to be used for printing the content.)
14397     */
14398    public CodeableConcept getFormCode() { 
14399      if (this.formCode == null)
14400        if (Configuration.errorOnAutoCreate())
14401          throw new Error("Attempt to auto-create ExplanationOfBenefit.formCode");
14402        else if (Configuration.doAutoCreate())
14403          this.formCode = new CodeableConcept(); // cc
14404      return this.formCode;
14405    }
14406
14407    public boolean hasFormCode() { 
14408      return this.formCode != null && !this.formCode.isEmpty();
14409    }
14410
14411    /**
14412     * @param value {@link #formCode} (A code for the form to be used for printing the content.)
14413     */
14414    public ExplanationOfBenefit setFormCode(CodeableConcept value) { 
14415      this.formCode = value;
14416      return this;
14417    }
14418
14419    /**
14420     * @return {@link #form} (The actual form, by reference or inclusion, for printing the content or an EOB.)
14421     */
14422    public Attachment getForm() { 
14423      if (this.form == null)
14424        if (Configuration.errorOnAutoCreate())
14425          throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
14426        else if (Configuration.doAutoCreate())
14427          this.form = new Attachment(); // cc
14428      return this.form;
14429    }
14430
14431    public boolean hasForm() { 
14432      return this.form != null && !this.form.isEmpty();
14433    }
14434
14435    /**
14436     * @param value {@link #form} (The actual form, by reference or inclusion, for printing the content or an EOB.)
14437     */
14438    public ExplanationOfBenefit setForm(Attachment value) { 
14439      this.form = value;
14440      return this;
14441    }
14442
14443    /**
14444     * @return {@link #processNote} (A note that describes or explains adjudication results in a human readable form.)
14445     */
14446    public List<NoteComponent> getProcessNote() { 
14447      if (this.processNote == null)
14448        this.processNote = new ArrayList<NoteComponent>();
14449      return this.processNote;
14450    }
14451
14452    /**
14453     * @return Returns a reference to <code>this</code> for easy method chaining
14454     */
14455    public ExplanationOfBenefit setProcessNote(List<NoteComponent> theProcessNote) { 
14456      this.processNote = theProcessNote;
14457      return this;
14458    }
14459
14460    public boolean hasProcessNote() { 
14461      if (this.processNote == null)
14462        return false;
14463      for (NoteComponent item : this.processNote)
14464        if (!item.isEmpty())
14465          return true;
14466      return false;
14467    }
14468
14469    public NoteComponent addProcessNote() { //3
14470      NoteComponent t = new NoteComponent();
14471      if (this.processNote == null)
14472        this.processNote = new ArrayList<NoteComponent>();
14473      this.processNote.add(t);
14474      return t;
14475    }
14476
14477    public ExplanationOfBenefit addProcessNote(NoteComponent t) { //3
14478      if (t == null)
14479        return this;
14480      if (this.processNote == null)
14481        this.processNote = new ArrayList<NoteComponent>();
14482      this.processNote.add(t);
14483      return this;
14484    }
14485
14486    /**
14487     * @return The first repetition of repeating field {@link #processNote}, creating it if it does not already exist
14488     */
14489    public NoteComponent getProcessNoteFirstRep() { 
14490      if (getProcessNote().isEmpty()) {
14491        addProcessNote();
14492      }
14493      return getProcessNote().get(0);
14494    }
14495
14496    /**
14497     * @return {@link #benefitPeriod} (The term of the benefits documented in this response.)
14498     */
14499    public Period getBenefitPeriod() { 
14500      if (this.benefitPeriod == null)
14501        if (Configuration.errorOnAutoCreate())
14502          throw new Error("Attempt to auto-create ExplanationOfBenefit.benefitPeriod");
14503        else if (Configuration.doAutoCreate())
14504          this.benefitPeriod = new Period(); // cc
14505      return this.benefitPeriod;
14506    }
14507
14508    public boolean hasBenefitPeriod() { 
14509      return this.benefitPeriod != null && !this.benefitPeriod.isEmpty();
14510    }
14511
14512    /**
14513     * @param value {@link #benefitPeriod} (The term of the benefits documented in this response.)
14514     */
14515    public ExplanationOfBenefit setBenefitPeriod(Period value) { 
14516      this.benefitPeriod = value;
14517      return this;
14518    }
14519
14520    /**
14521     * @return {@link #benefitBalance} (Balance by Benefit Category.)
14522     */
14523    public List<BenefitBalanceComponent> getBenefitBalance() { 
14524      if (this.benefitBalance == null)
14525        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14526      return this.benefitBalance;
14527    }
14528
14529    /**
14530     * @return Returns a reference to <code>this</code> for easy method chaining
14531     */
14532    public ExplanationOfBenefit setBenefitBalance(List<BenefitBalanceComponent> theBenefitBalance) { 
14533      this.benefitBalance = theBenefitBalance;
14534      return this;
14535    }
14536
14537    public boolean hasBenefitBalance() { 
14538      if (this.benefitBalance == null)
14539        return false;
14540      for (BenefitBalanceComponent item : this.benefitBalance)
14541        if (!item.isEmpty())
14542          return true;
14543      return false;
14544    }
14545
14546    public BenefitBalanceComponent addBenefitBalance() { //3
14547      BenefitBalanceComponent t = new BenefitBalanceComponent();
14548      if (this.benefitBalance == null)
14549        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14550      this.benefitBalance.add(t);
14551      return t;
14552    }
14553
14554    public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { //3
14555      if (t == null)
14556        return this;
14557      if (this.benefitBalance == null)
14558        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14559      this.benefitBalance.add(t);
14560      return this;
14561    }
14562
14563    /**
14564     * @return The first repetition of repeating field {@link #benefitBalance}, creating it if it does not already exist
14565     */
14566    public BenefitBalanceComponent getBenefitBalanceFirstRep() { 
14567      if (getBenefitBalance().isEmpty()) {
14568        addBenefitBalance();
14569      }
14570      return getBenefitBalance().get(0);
14571    }
14572
14573      protected void listChildren(List<Property> children) {
14574        super.listChildren(children);
14575        children.add(new Property("identifier", "Identifier", "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier));
14576        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
14577        children.add(new Property("type", "CodeableConcept", "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type));
14578        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));
14579        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));
14580        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));
14581        children.add(new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1, billablePeriod));
14582        children.add(new Property("created", "dateTime", "The date this resource was created.", 0, 1, created));
14583        children.add(new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer));
14584        children.add(new Property("insurer", "Reference(Organization)", "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer));
14585        children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider));
14586        children.add(new Property("priority", "CodeableConcept", "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.", 0, 1, priority));
14587        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));
14588        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));
14589        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));
14590        children.add(new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription));
14591        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));
14592        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));
14593        children.add(new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral));
14594        children.add(new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility));
14595        children.add(new Property("claim", "Reference(Claim)", "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.", 0, 1, claim));
14596        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));
14597        children.add(new Property("outcome", "code", "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome));
14598        children.add(new Property("disposition", "string", "A human readable description of the status of the adjudication.", 0, 1, disposition));
14599        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));
14600        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));
14601        children.add(new Property("careTeam", "", "The members of the team who provided the products and services.", 0, java.lang.Integer.MAX_VALUE, careTeam));
14602        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));
14603        children.add(new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
14604        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));
14605        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));
14606        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));
14607        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));
14608        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));
14609        children.add(new Property("addItem", "", "The first-tier service adjudications for payor added product or service lines.", 0, java.lang.Integer.MAX_VALUE, addItem));
14610        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));
14611        children.add(new Property("total", "", "Categorized monetary totals for the adjudication.", 0, java.lang.Integer.MAX_VALUE, total));
14612        children.add(new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment));
14613        children.add(new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.", 0, 1, formCode));
14614        children.add(new Property("form", "Attachment", "The actual form, by reference or inclusion, for printing the content or an EOB.", 0, 1, form));
14615        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));
14616        children.add(new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1, benefitPeriod));
14617        children.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance));
14618      }
14619
14620      @Override
14621      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
14622        switch (_hash) {
14623        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier);
14624        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
14625        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type);
14626        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);
14627        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);
14628        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);
14629        case -332066046: /*billablePeriod*/  return new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1, billablePeriod);
14630        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date this resource was created.", 0, 1, created);
14631        case -1591951995: /*enterer*/  return new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer);
14632        case 1957615864: /*insurer*/  return new Property("insurer", "Reference(Organization)", "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer);
14633        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);
14634        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);
14635        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);
14636        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);
14637        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);
14638        case 460301338: /*prescription*/  return new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription);
14639        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);
14640        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);
14641        case -722568291: /*referral*/  return new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral);
14642        case 501116579: /*facility*/  return new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility);
14643        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);
14644        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);
14645        case -1106507950: /*outcome*/  return new Property("outcome", "code", "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome);
14646        case 583380919: /*disposition*/  return new Property("disposition", "string", "A human readable description of the status of the adjudication.", 0, 1, disposition);
14647        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);
14648        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);
14649        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);
14650        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);
14651        case 1196993265: /*diagnosis*/  return new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0, java.lang.Integer.MAX_VALUE, diagnosis);
14652        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);
14653        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);
14654        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);
14655        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);
14656        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);
14657        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);
14658        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);
14659        case 110549828: /*total*/  return new Property("total", "", "Categorized monetary totals for the adjudication.", 0, java.lang.Integer.MAX_VALUE, total);
14660        case -786681338: /*payment*/  return new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment);
14661        case 473181393: /*formCode*/  return new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.", 0, 1, formCode);
14662        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);
14663        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);
14664        case -407369416: /*benefitPeriod*/  return new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1, benefitPeriod);
14665        case 596003397: /*benefitBalance*/  return new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance);
14666        default: return super.getNamedProperty(_hash, _name, _checkValid);
14667        }
14668
14669      }
14670
14671      @Override
14672      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
14673        switch (hash) {
14674        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
14675        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ExplanationOfBenefitStatus>
14676        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
14677        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
14678        case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<Use>
14679        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
14680        case -332066046: /*billablePeriod*/ return this.billablePeriod == null ? new Base[0] : new Base[] {this.billablePeriod}; // Period
14681        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
14682        case -1591951995: /*enterer*/ return this.enterer == null ? new Base[0] : new Base[] {this.enterer}; // Reference
14683        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
14684        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
14685        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
14686        case -1688904576: /*fundsReserveRequested*/ return this.fundsReserveRequested == null ? new Base[0] : new Base[] {this.fundsReserveRequested}; // CodeableConcept
14687        case 1314609806: /*fundsReserve*/ return this.fundsReserve == null ? new Base[0] : new Base[] {this.fundsReserve}; // CodeableConcept
14688        case 1090493483: /*related*/ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimComponent
14689        case 460301338: /*prescription*/ return this.prescription == null ? new Base[0] : new Base[] {this.prescription}; // Reference
14690        case -1814015861: /*originalPrescription*/ return this.originalPrescription == null ? new Base[0] : new Base[] {this.originalPrescription}; // Reference
14691        case 106443592: /*payee*/ return this.payee == null ? new Base[0] : new Base[] {this.payee}; // PayeeComponent
14692        case -722568291: /*referral*/ return this.referral == null ? new Base[0] : new Base[] {this.referral}; // Reference
14693        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Reference
14694        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
14695        case 689513629: /*claimResponse*/ return this.claimResponse == null ? new Base[0] : new Base[] {this.claimResponse}; // Reference
14696        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // Enumeration<RemittanceOutcome>
14697        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
14698        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
14699        case -1262920311: /*preAuthRefPeriod*/ return this.preAuthRefPeriod == null ? new Base[0] : this.preAuthRefPeriod.toArray(new Base[this.preAuthRefPeriod.size()]); // Period
14700        case -7323378: /*careTeam*/ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // CareTeamComponent
14701        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // SupportingInformationComponent
14702        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
14703        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
14704        case 159695370: /*precedence*/ return this.precedence == null ? new Base[0] : new Base[] {this.precedence}; // PositiveIntType
14705        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // InsuranceComponent
14706        case -2143202801: /*accident*/ return this.accident == null ? new Base[0] : new Base[] {this.accident}; // AccidentComponent
14707        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
14708        case -1148899500: /*addItem*/ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
14709        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
14710        case 110549828: /*total*/ return this.total == null ? new Base[0] : this.total.toArray(new Base[this.total.size()]); // TotalComponent
14711        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // PaymentComponent
14712        case 473181393: /*formCode*/ return this.formCode == null ? new Base[0] : new Base[] {this.formCode}; // CodeableConcept
14713        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // Attachment
14714        case 202339073: /*processNote*/ return this.processNote == null ? new Base[0] : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
14715        case -407369416: /*benefitPeriod*/ return this.benefitPeriod == null ? new Base[0] : new Base[] {this.benefitPeriod}; // Period
14716        case 596003397: /*benefitBalance*/ return this.benefitBalance == null ? new Base[0] : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
14717        default: return super.getProperty(hash, name, checkValid);
14718        }
14719
14720      }
14721
14722      @Override
14723      public Base setProperty(int hash, String name, Base value) throws FHIRException {
14724        switch (hash) {
14725        case -1618432855: // identifier
14726          this.getIdentifier().add(castToIdentifier(value)); // Identifier
14727          return value;
14728        case -892481550: // status
14729          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
14730          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
14731          return value;
14732        case 3575610: // type
14733          this.type = castToCodeableConcept(value); // CodeableConcept
14734          return value;
14735        case -1868521062: // subType
14736          this.subType = castToCodeableConcept(value); // CodeableConcept
14737          return value;
14738        case 116103: // use
14739          value = new UseEnumFactory().fromType(castToCode(value));
14740          this.use = (Enumeration) value; // Enumeration<Use>
14741          return value;
14742        case -791418107: // patient
14743          this.patient = castToReference(value); // Reference
14744          return value;
14745        case -332066046: // billablePeriod
14746          this.billablePeriod = castToPeriod(value); // Period
14747          return value;
14748        case 1028554472: // created
14749          this.created = castToDateTime(value); // DateTimeType
14750          return value;
14751        case -1591951995: // enterer
14752          this.enterer = castToReference(value); // Reference
14753          return value;
14754        case 1957615864: // insurer
14755          this.insurer = castToReference(value); // Reference
14756          return value;
14757        case -987494927: // provider
14758          this.provider = castToReference(value); // Reference
14759          return value;
14760        case -1165461084: // priority
14761          this.priority = castToCodeableConcept(value); // CodeableConcept
14762          return value;
14763        case -1688904576: // fundsReserveRequested
14764          this.fundsReserveRequested = castToCodeableConcept(value); // CodeableConcept
14765          return value;
14766        case 1314609806: // fundsReserve
14767          this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
14768          return value;
14769        case 1090493483: // related
14770          this.getRelated().add((RelatedClaimComponent) value); // RelatedClaimComponent
14771          return value;
14772        case 460301338: // prescription
14773          this.prescription = castToReference(value); // Reference
14774          return value;
14775        case -1814015861: // originalPrescription
14776          this.originalPrescription = castToReference(value); // Reference
14777          return value;
14778        case 106443592: // payee
14779          this.payee = (PayeeComponent) value; // PayeeComponent
14780          return value;
14781        case -722568291: // referral
14782          this.referral = castToReference(value); // Reference
14783          return value;
14784        case 501116579: // facility
14785          this.facility = castToReference(value); // Reference
14786          return value;
14787        case 94742588: // claim
14788          this.claim = castToReference(value); // Reference
14789          return value;
14790        case 689513629: // claimResponse
14791          this.claimResponse = castToReference(value); // Reference
14792          return value;
14793        case -1106507950: // outcome
14794          value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
14795          this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
14796          return value;
14797        case 583380919: // disposition
14798          this.disposition = castToString(value); // StringType
14799          return value;
14800        case 522246568: // preAuthRef
14801          this.getPreAuthRef().add(castToString(value)); // StringType
14802          return value;
14803        case -1262920311: // preAuthRefPeriod
14804          this.getPreAuthRefPeriod().add(castToPeriod(value)); // Period
14805          return value;
14806        case -7323378: // careTeam
14807          this.getCareTeam().add((CareTeamComponent) value); // CareTeamComponent
14808          return value;
14809        case 1922406657: // supportingInfo
14810          this.getSupportingInfo().add((SupportingInformationComponent) value); // SupportingInformationComponent
14811          return value;
14812        case 1196993265: // diagnosis
14813          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
14814          return value;
14815        case -1095204141: // procedure
14816          this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
14817          return value;
14818        case 159695370: // precedence
14819          this.precedence = castToPositiveInt(value); // PositiveIntType
14820          return value;
14821        case 73049818: // insurance
14822          this.getInsurance().add((InsuranceComponent) value); // InsuranceComponent
14823          return value;
14824        case -2143202801: // accident
14825          this.accident = (AccidentComponent) value; // AccidentComponent
14826          return value;
14827        case 3242771: // item
14828          this.getItem().add((ItemComponent) value); // ItemComponent
14829          return value;
14830        case -1148899500: // addItem
14831          this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
14832          return value;
14833        case -231349275: // adjudication
14834          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
14835          return value;
14836        case 110549828: // total
14837          this.getTotal().add((TotalComponent) value); // TotalComponent
14838          return value;
14839        case -786681338: // payment
14840          this.payment = (PaymentComponent) value; // PaymentComponent
14841          return value;
14842        case 473181393: // formCode
14843          this.formCode = castToCodeableConcept(value); // CodeableConcept
14844          return value;
14845        case 3148996: // form
14846          this.form = castToAttachment(value); // Attachment
14847          return value;
14848        case 202339073: // processNote
14849          this.getProcessNote().add((NoteComponent) value); // NoteComponent
14850          return value;
14851        case -407369416: // benefitPeriod
14852          this.benefitPeriod = castToPeriod(value); // Period
14853          return value;
14854        case 596003397: // benefitBalance
14855          this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
14856          return value;
14857        default: return super.setProperty(hash, name, value);
14858        }
14859
14860      }
14861
14862      @Override
14863      public Base setProperty(String name, Base value) throws FHIRException {
14864        if (name.equals("identifier")) {
14865          this.getIdentifier().add(castToIdentifier(value));
14866        } else if (name.equals("status")) {
14867          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
14868          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
14869        } else if (name.equals("type")) {
14870          this.type = castToCodeableConcept(value); // CodeableConcept
14871        } else if (name.equals("subType")) {
14872          this.subType = castToCodeableConcept(value); // CodeableConcept
14873        } else if (name.equals("use")) {
14874          value = new UseEnumFactory().fromType(castToCode(value));
14875          this.use = (Enumeration) value; // Enumeration<Use>
14876        } else if (name.equals("patient")) {
14877          this.patient = castToReference(value); // Reference
14878        } else if (name.equals("billablePeriod")) {
14879          this.billablePeriod = castToPeriod(value); // Period
14880        } else if (name.equals("created")) {
14881          this.created = castToDateTime(value); // DateTimeType
14882        } else if (name.equals("enterer")) {
14883          this.enterer = castToReference(value); // Reference
14884        } else if (name.equals("insurer")) {
14885          this.insurer = castToReference(value); // Reference
14886        } else if (name.equals("provider")) {
14887          this.provider = castToReference(value); // Reference
14888        } else if (name.equals("priority")) {
14889          this.priority = castToCodeableConcept(value); // CodeableConcept
14890        } else if (name.equals("fundsReserveRequested")) {
14891          this.fundsReserveRequested = castToCodeableConcept(value); // CodeableConcept
14892        } else if (name.equals("fundsReserve")) {
14893          this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
14894        } else if (name.equals("related")) {
14895          this.getRelated().add((RelatedClaimComponent) value);
14896        } else if (name.equals("prescription")) {
14897          this.prescription = castToReference(value); // Reference
14898        } else if (name.equals("originalPrescription")) {
14899          this.originalPrescription = castToReference(value); // Reference
14900        } else if (name.equals("payee")) {
14901          this.payee = (PayeeComponent) value; // PayeeComponent
14902        } else if (name.equals("referral")) {
14903          this.referral = castToReference(value); // Reference
14904        } else if (name.equals("facility")) {
14905          this.facility = castToReference(value); // Reference
14906        } else if (name.equals("claim")) {
14907          this.claim = castToReference(value); // Reference
14908        } else if (name.equals("claimResponse")) {
14909          this.claimResponse = castToReference(value); // Reference
14910        } else if (name.equals("outcome")) {
14911          value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
14912          this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
14913        } else if (name.equals("disposition")) {
14914          this.disposition = castToString(value); // StringType
14915        } else if (name.equals("preAuthRef")) {
14916          this.getPreAuthRef().add(castToString(value));
14917        } else if (name.equals("preAuthRefPeriod")) {
14918          this.getPreAuthRefPeriod().add(castToPeriod(value));
14919        } else if (name.equals("careTeam")) {
14920          this.getCareTeam().add((CareTeamComponent) value);
14921        } else if (name.equals("supportingInfo")) {
14922          this.getSupportingInfo().add((SupportingInformationComponent) value);
14923        } else if (name.equals("diagnosis")) {
14924          this.getDiagnosis().add((DiagnosisComponent) value);
14925        } else if (name.equals("procedure")) {
14926          this.getProcedure().add((ProcedureComponent) value);
14927        } else if (name.equals("precedence")) {
14928          this.precedence = castToPositiveInt(value); // PositiveIntType
14929        } else if (name.equals("insurance")) {
14930          this.getInsurance().add((InsuranceComponent) value);
14931        } else if (name.equals("accident")) {
14932          this.accident = (AccidentComponent) value; // AccidentComponent
14933        } else if (name.equals("item")) {
14934          this.getItem().add((ItemComponent) value);
14935        } else if (name.equals("addItem")) {
14936          this.getAddItem().add((AddedItemComponent) value);
14937        } else if (name.equals("adjudication")) {
14938          this.getAdjudication().add((AdjudicationComponent) value);
14939        } else if (name.equals("total")) {
14940          this.getTotal().add((TotalComponent) value);
14941        } else if (name.equals("payment")) {
14942          this.payment = (PaymentComponent) value; // PaymentComponent
14943        } else if (name.equals("formCode")) {
14944          this.formCode = castToCodeableConcept(value); // CodeableConcept
14945        } else if (name.equals("form")) {
14946          this.form = castToAttachment(value); // Attachment
14947        } else if (name.equals("processNote")) {
14948          this.getProcessNote().add((NoteComponent) value);
14949        } else if (name.equals("benefitPeriod")) {
14950          this.benefitPeriod = castToPeriod(value); // Period
14951        } else if (name.equals("benefitBalance")) {
14952          this.getBenefitBalance().add((BenefitBalanceComponent) value);
14953        } else
14954          return super.setProperty(name, value);
14955        return value;
14956      }
14957
14958      @Override
14959      public Base makeProperty(int hash, String name) throws FHIRException {
14960        switch (hash) {
14961        case -1618432855:  return addIdentifier(); 
14962        case -892481550:  return getStatusElement();
14963        case 3575610:  return getType(); 
14964        case -1868521062:  return getSubType(); 
14965        case 116103:  return getUseElement();
14966        case -791418107:  return getPatient(); 
14967        case -332066046:  return getBillablePeriod(); 
14968        case 1028554472:  return getCreatedElement();
14969        case -1591951995:  return getEnterer(); 
14970        case 1957615864:  return getInsurer(); 
14971        case -987494927:  return getProvider(); 
14972        case -1165461084:  return getPriority(); 
14973        case -1688904576:  return getFundsReserveRequested(); 
14974        case 1314609806:  return getFundsReserve(); 
14975        case 1090493483:  return addRelated(); 
14976        case 460301338:  return getPrescription(); 
14977        case -1814015861:  return getOriginalPrescription(); 
14978        case 106443592:  return getPayee(); 
14979        case -722568291:  return getReferral(); 
14980        case 501116579:  return getFacility(); 
14981        case 94742588:  return getClaim(); 
14982        case 689513629:  return getClaimResponse(); 
14983        case -1106507950:  return getOutcomeElement();
14984        case 583380919:  return getDispositionElement();
14985        case 522246568:  return addPreAuthRefElement();
14986        case -1262920311:  return addPreAuthRefPeriod(); 
14987        case -7323378:  return addCareTeam(); 
14988        case 1922406657:  return addSupportingInfo(); 
14989        case 1196993265:  return addDiagnosis(); 
14990        case -1095204141:  return addProcedure(); 
14991        case 159695370:  return getPrecedenceElement();
14992        case 73049818:  return addInsurance(); 
14993        case -2143202801:  return getAccident(); 
14994        case 3242771:  return addItem(); 
14995        case -1148899500:  return addAddItem(); 
14996        case -231349275:  return addAdjudication(); 
14997        case 110549828:  return addTotal(); 
14998        case -786681338:  return getPayment(); 
14999        case 473181393:  return getFormCode(); 
15000        case 3148996:  return getForm(); 
15001        case 202339073:  return addProcessNote(); 
15002        case -407369416:  return getBenefitPeriod(); 
15003        case 596003397:  return addBenefitBalance(); 
15004        default: return super.makeProperty(hash, name);
15005        }
15006
15007      }
15008
15009      @Override
15010      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
15011        switch (hash) {
15012        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
15013        case -892481550: /*status*/ return new String[] {"code"};
15014        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
15015        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
15016        case 116103: /*use*/ return new String[] {"code"};
15017        case -791418107: /*patient*/ return new String[] {"Reference"};
15018        case -332066046: /*billablePeriod*/ return new String[] {"Period"};
15019        case 1028554472: /*created*/ return new String[] {"dateTime"};
15020        case -1591951995: /*enterer*/ return new String[] {"Reference"};
15021        case 1957615864: /*insurer*/ return new String[] {"Reference"};
15022        case -987494927: /*provider*/ return new String[] {"Reference"};
15023        case -1165461084: /*priority*/ return new String[] {"CodeableConcept"};
15024        case -1688904576: /*fundsReserveRequested*/ return new String[] {"CodeableConcept"};
15025        case 1314609806: /*fundsReserve*/ return new String[] {"CodeableConcept"};
15026        case 1090493483: /*related*/ return new String[] {};
15027        case 460301338: /*prescription*/ return new String[] {"Reference"};
15028        case -1814015861: /*originalPrescription*/ return new String[] {"Reference"};
15029        case 106443592: /*payee*/ return new String[] {};
15030        case -722568291: /*referral*/ return new String[] {"Reference"};
15031        case 501116579: /*facility*/ return new String[] {"Reference"};
15032        case 94742588: /*claim*/ return new String[] {"Reference"};
15033        case 689513629: /*claimResponse*/ return new String[] {"Reference"};
15034        case -1106507950: /*outcome*/ return new String[] {"code"};
15035        case 583380919: /*disposition*/ return new String[] {"string"};
15036        case 522246568: /*preAuthRef*/ return new String[] {"string"};
15037        case -1262920311: /*preAuthRefPeriod*/ return new String[] {"Period"};
15038        case -7323378: /*careTeam*/ return new String[] {};
15039        case 1922406657: /*supportingInfo*/ return new String[] {};
15040        case 1196993265: /*diagnosis*/ return new String[] {};
15041        case -1095204141: /*procedure*/ return new String[] {};
15042        case 159695370: /*precedence*/ return new String[] {"positiveInt"};
15043        case 73049818: /*insurance*/ return new String[] {};
15044        case -2143202801: /*accident*/ return new String[] {};
15045        case 3242771: /*item*/ return new String[] {};
15046        case -1148899500: /*addItem*/ return new String[] {};
15047        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
15048        case 110549828: /*total*/ return new String[] {};
15049        case -786681338: /*payment*/ return new String[] {};
15050        case 473181393: /*formCode*/ return new String[] {"CodeableConcept"};
15051        case 3148996: /*form*/ return new String[] {"Attachment"};
15052        case 202339073: /*processNote*/ return new String[] {};
15053        case -407369416: /*benefitPeriod*/ return new String[] {"Period"};
15054        case 596003397: /*benefitBalance*/ return new String[] {};
15055        default: return super.getTypesForProperty(hash, name);
15056        }
15057
15058      }
15059
15060      @Override
15061      public Base addChild(String name) throws FHIRException {
15062        if (name.equals("identifier")) {
15063          return addIdentifier();
15064        }
15065        else if (name.equals("status")) {
15066          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.status");
15067        }
15068        else if (name.equals("type")) {
15069          this.type = new CodeableConcept();
15070          return this.type;
15071        }
15072        else if (name.equals("subType")) {
15073          this.subType = new CodeableConcept();
15074          return this.subType;
15075        }
15076        else if (name.equals("use")) {
15077          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.use");
15078        }
15079        else if (name.equals("patient")) {
15080          this.patient = new Reference();
15081          return this.patient;
15082        }
15083        else if (name.equals("billablePeriod")) {
15084          this.billablePeriod = new Period();
15085          return this.billablePeriod;
15086        }
15087        else if (name.equals("created")) {
15088          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.created");
15089        }
15090        else if (name.equals("enterer")) {
15091          this.enterer = new Reference();
15092          return this.enterer;
15093        }
15094        else if (name.equals("insurer")) {
15095          this.insurer = new Reference();
15096          return this.insurer;
15097        }
15098        else if (name.equals("provider")) {
15099          this.provider = new Reference();
15100          return this.provider;
15101        }
15102        else if (name.equals("priority")) {
15103          this.priority = new CodeableConcept();
15104          return this.priority;
15105        }
15106        else if (name.equals("fundsReserveRequested")) {
15107          this.fundsReserveRequested = new CodeableConcept();
15108          return this.fundsReserveRequested;
15109        }
15110        else if (name.equals("fundsReserve")) {
15111          this.fundsReserve = new CodeableConcept();
15112          return this.fundsReserve;
15113        }
15114        else if (name.equals("related")) {
15115          return addRelated();
15116        }
15117        else if (name.equals("prescription")) {
15118          this.prescription = new Reference();
15119          return this.prescription;
15120        }
15121        else if (name.equals("originalPrescription")) {
15122          this.originalPrescription = new Reference();
15123          return this.originalPrescription;
15124        }
15125        else if (name.equals("payee")) {
15126          this.payee = new PayeeComponent();
15127          return this.payee;
15128        }
15129        else if (name.equals("referral")) {
15130          this.referral = new Reference();
15131          return this.referral;
15132        }
15133        else if (name.equals("facility")) {
15134          this.facility = new Reference();
15135          return this.facility;
15136        }
15137        else if (name.equals("claim")) {
15138          this.claim = new Reference();
15139          return this.claim;
15140        }
15141        else if (name.equals("claimResponse")) {
15142          this.claimResponse = new Reference();
15143          return this.claimResponse;
15144        }
15145        else if (name.equals("outcome")) {
15146          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.outcome");
15147        }
15148        else if (name.equals("disposition")) {
15149          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.disposition");
15150        }
15151        else if (name.equals("preAuthRef")) {
15152          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
15153        }
15154        else if (name.equals("preAuthRefPeriod")) {
15155          return addPreAuthRefPeriod();
15156        }
15157        else if (name.equals("careTeam")) {
15158          return addCareTeam();
15159        }
15160        else if (name.equals("supportingInfo")) {
15161          return addSupportingInfo();
15162        }
15163        else if (name.equals("diagnosis")) {
15164          return addDiagnosis();
15165        }
15166        else if (name.equals("procedure")) {
15167          return addProcedure();
15168        }
15169        else if (name.equals("precedence")) {
15170          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.precedence");
15171        }
15172        else if (name.equals("insurance")) {
15173          return addInsurance();
15174        }
15175        else if (name.equals("accident")) {
15176          this.accident = new AccidentComponent();
15177          return this.accident;
15178        }
15179        else if (name.equals("item")) {
15180          return addItem();
15181        }
15182        else if (name.equals("addItem")) {
15183          return addAddItem();
15184        }
15185        else if (name.equals("adjudication")) {
15186          return addAdjudication();
15187        }
15188        else if (name.equals("total")) {
15189          return addTotal();
15190        }
15191        else if (name.equals("payment")) {
15192          this.payment = new PaymentComponent();
15193          return this.payment;
15194        }
15195        else if (name.equals("formCode")) {
15196          this.formCode = new CodeableConcept();
15197          return this.formCode;
15198        }
15199        else if (name.equals("form")) {
15200          this.form = new Attachment();
15201          return this.form;
15202        }
15203        else if (name.equals("processNote")) {
15204          return addProcessNote();
15205        }
15206        else if (name.equals("benefitPeriod")) {
15207          this.benefitPeriod = new Period();
15208          return this.benefitPeriod;
15209        }
15210        else if (name.equals("benefitBalance")) {
15211          return addBenefitBalance();
15212        }
15213        else
15214          return super.addChild(name);
15215      }
15216
15217  public String fhirType() {
15218    return "ExplanationOfBenefit";
15219
15220  }
15221
15222      public ExplanationOfBenefit copy() {
15223        ExplanationOfBenefit dst = new ExplanationOfBenefit();
15224        copyValues(dst);
15225        if (identifier != null) {
15226          dst.identifier = new ArrayList<Identifier>();
15227          for (Identifier i : identifier)
15228            dst.identifier.add(i.copy());
15229        };
15230        dst.status = status == null ? null : status.copy();
15231        dst.type = type == null ? null : type.copy();
15232        dst.subType = subType == null ? null : subType.copy();
15233        dst.use = use == null ? null : use.copy();
15234        dst.patient = patient == null ? null : patient.copy();
15235        dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
15236        dst.created = created == null ? null : created.copy();
15237        dst.enterer = enterer == null ? null : enterer.copy();
15238        dst.insurer = insurer == null ? null : insurer.copy();
15239        dst.provider = provider == null ? null : provider.copy();
15240        dst.priority = priority == null ? null : priority.copy();
15241        dst.fundsReserveRequested = fundsReserveRequested == null ? null : fundsReserveRequested.copy();
15242        dst.fundsReserve = fundsReserve == null ? null : fundsReserve.copy();
15243        if (related != null) {
15244          dst.related = new ArrayList<RelatedClaimComponent>();
15245          for (RelatedClaimComponent i : related)
15246            dst.related.add(i.copy());
15247        };
15248        dst.prescription = prescription == null ? null : prescription.copy();
15249        dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
15250        dst.payee = payee == null ? null : payee.copy();
15251        dst.referral = referral == null ? null : referral.copy();
15252        dst.facility = facility == null ? null : facility.copy();
15253        dst.claim = claim == null ? null : claim.copy();
15254        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
15255        dst.outcome = outcome == null ? null : outcome.copy();
15256        dst.disposition = disposition == null ? null : disposition.copy();
15257        if (preAuthRef != null) {
15258          dst.preAuthRef = new ArrayList<StringType>();
15259          for (StringType i : preAuthRef)
15260            dst.preAuthRef.add(i.copy());
15261        };
15262        if (preAuthRefPeriod != null) {
15263          dst.preAuthRefPeriod = new ArrayList<Period>();
15264          for (Period i : preAuthRefPeriod)
15265            dst.preAuthRefPeriod.add(i.copy());
15266        };
15267        if (careTeam != null) {
15268          dst.careTeam = new ArrayList<CareTeamComponent>();
15269          for (CareTeamComponent i : careTeam)
15270            dst.careTeam.add(i.copy());
15271        };
15272        if (supportingInfo != null) {
15273          dst.supportingInfo = new ArrayList<SupportingInformationComponent>();
15274          for (SupportingInformationComponent i : supportingInfo)
15275            dst.supportingInfo.add(i.copy());
15276        };
15277        if (diagnosis != null) {
15278          dst.diagnosis = new ArrayList<DiagnosisComponent>();
15279          for (DiagnosisComponent i : diagnosis)
15280            dst.diagnosis.add(i.copy());
15281        };
15282        if (procedure != null) {
15283          dst.procedure = new ArrayList<ProcedureComponent>();
15284          for (ProcedureComponent i : procedure)
15285            dst.procedure.add(i.copy());
15286        };
15287        dst.precedence = precedence == null ? null : precedence.copy();
15288        if (insurance != null) {
15289          dst.insurance = new ArrayList<InsuranceComponent>();
15290          for (InsuranceComponent i : insurance)
15291            dst.insurance.add(i.copy());
15292        };
15293        dst.accident = accident == null ? null : accident.copy();
15294        if (item != null) {
15295          dst.item = new ArrayList<ItemComponent>();
15296          for (ItemComponent i : item)
15297            dst.item.add(i.copy());
15298        };
15299        if (addItem != null) {
15300          dst.addItem = new ArrayList<AddedItemComponent>();
15301          for (AddedItemComponent i : addItem)
15302            dst.addItem.add(i.copy());
15303        };
15304        if (adjudication != null) {
15305          dst.adjudication = new ArrayList<AdjudicationComponent>();
15306          for (AdjudicationComponent i : adjudication)
15307            dst.adjudication.add(i.copy());
15308        };
15309        if (total != null) {
15310          dst.total = new ArrayList<TotalComponent>();
15311          for (TotalComponent i : total)
15312            dst.total.add(i.copy());
15313        };
15314        dst.payment = payment == null ? null : payment.copy();
15315        dst.formCode = formCode == null ? null : formCode.copy();
15316        dst.form = form == null ? null : form.copy();
15317        if (processNote != null) {
15318          dst.processNote = new ArrayList<NoteComponent>();
15319          for (NoteComponent i : processNote)
15320            dst.processNote.add(i.copy());
15321        };
15322        dst.benefitPeriod = benefitPeriod == null ? null : benefitPeriod.copy();
15323        if (benefitBalance != null) {
15324          dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
15325          for (BenefitBalanceComponent i : benefitBalance)
15326            dst.benefitBalance.add(i.copy());
15327        };
15328        return dst;
15329      }
15330
15331      protected ExplanationOfBenefit typedCopy() {
15332        return copy();
15333      }
15334
15335      @Override
15336      public boolean equalsDeep(Base other_) {
15337        if (!super.equalsDeep(other_))
15338          return false;
15339        if (!(other_ instanceof ExplanationOfBenefit))
15340          return false;
15341        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
15342        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
15343           && compareDeep(subType, o.subType, true) && compareDeep(use, o.use, true) && compareDeep(patient, o.patient, true)
15344           && compareDeep(billablePeriod, o.billablePeriod, true) && compareDeep(created, o.created, true)
15345           && compareDeep(enterer, o.enterer, true) && compareDeep(insurer, o.insurer, true) && compareDeep(provider, o.provider, true)
15346           && compareDeep(priority, o.priority, true) && compareDeep(fundsReserveRequested, o.fundsReserveRequested, true)
15347           && compareDeep(fundsReserve, o.fundsReserve, true) && compareDeep(related, o.related, true) && compareDeep(prescription, o.prescription, true)
15348           && compareDeep(originalPrescription, o.originalPrescription, true) && compareDeep(payee, o.payee, true)
15349           && compareDeep(referral, o.referral, true) && compareDeep(facility, o.facility, true) && compareDeep(claim, o.claim, true)
15350           && compareDeep(claimResponse, o.claimResponse, true) && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true)
15351           && compareDeep(preAuthRef, o.preAuthRef, true) && compareDeep(preAuthRefPeriod, o.preAuthRefPeriod, true)
15352           && compareDeep(careTeam, o.careTeam, true) && compareDeep(supportingInfo, o.supportingInfo, true)
15353           && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true) && compareDeep(precedence, o.precedence, true)
15354           && compareDeep(insurance, o.insurance, true) && compareDeep(accident, o.accident, true) && compareDeep(item, o.item, true)
15355           && compareDeep(addItem, o.addItem, true) && compareDeep(adjudication, o.adjudication, true) && compareDeep(total, o.total, true)
15356           && compareDeep(payment, o.payment, true) && compareDeep(formCode, o.formCode, true) && compareDeep(form, o.form, true)
15357           && compareDeep(processNote, o.processNote, true) && compareDeep(benefitPeriod, o.benefitPeriod, true)
15358           && compareDeep(benefitBalance, o.benefitBalance, true);
15359      }
15360
15361      @Override
15362      public boolean equalsShallow(Base other_) {
15363        if (!super.equalsShallow(other_))
15364          return false;
15365        if (!(other_ instanceof ExplanationOfBenefit))
15366          return false;
15367        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
15368        return compareValues(status, o.status, true) && compareValues(use, o.use, true) && compareValues(created, o.created, true)
15369           && compareValues(outcome, o.outcome, true) && compareValues(disposition, o.disposition, true) && compareValues(preAuthRef, o.preAuthRef, true)
15370           && compareValues(precedence, o.precedence, true);
15371      }
15372
15373      public boolean isEmpty() {
15374        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
15375          , subType, use, patient, billablePeriod, created, enterer, insurer, provider
15376          , priority, fundsReserveRequested, fundsReserve, related, prescription, originalPrescription
15377          , payee, referral, facility, claim, claimResponse, outcome, disposition, preAuthRef
15378          , preAuthRefPeriod, careTeam, supportingInfo, diagnosis, procedure, precedence, insurance
15379          , accident, item, addItem, adjudication, total, payment, formCode, form, processNote
15380          , benefitPeriod, benefitBalance);
15381      }
15382
15383  @Override
15384  public ResourceType getResourceType() {
15385    return ResourceType.ExplanationOfBenefit;
15386   }
15387
15388 /**
15389   * Search parameter: <b>coverage</b>
15390   * <p>
15391   * Description: <b>The plan under which the claim was adjudicated</b><br>
15392   * Type: <b>reference</b><br>
15393   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
15394   * </p>
15395   */
15396  @SearchParamDefinition(name="coverage", path="ExplanationOfBenefit.insurance.coverage", description="The plan under which the claim was adjudicated", type="reference", target={Coverage.class } )
15397  public static final String SP_COVERAGE = "coverage";
15398 /**
15399   * <b>Fluent Client</b> search parameter constant for <b>coverage</b>
15400   * <p>
15401   * Description: <b>The plan under which the claim was adjudicated</b><br>
15402   * Type: <b>reference</b><br>
15403   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
15404   * </p>
15405   */
15406  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COVERAGE);
15407
15408/**
15409   * Constant for fluent queries to be used to add include statements. Specifies
15410   * the path value of "<b>ExplanationOfBenefit:coverage</b>".
15411   */
15412  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:coverage").toLocked();
15413
15414 /**
15415   * Search parameter: <b>care-team</b>
15416   * <p>
15417   * Description: <b>Member of the CareTeam</b><br>
15418   * Type: <b>reference</b><br>
15419   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
15420   * </p>
15421   */
15422  @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 } )
15423  public static final String SP_CARE_TEAM = "care-team";
15424 /**
15425   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
15426   * <p>
15427   * Description: <b>Member of the CareTeam</b><br>
15428   * Type: <b>reference</b><br>
15429   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
15430   * </p>
15431   */
15432  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CARE_TEAM);
15433
15434/**
15435   * Constant for fluent queries to be used to add include statements. Specifies
15436   * the path value of "<b>ExplanationOfBenefit:care-team</b>".
15437   */
15438  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:care-team").toLocked();
15439
15440 /**
15441   * Search parameter: <b>identifier</b>
15442   * <p>
15443   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
15444   * Type: <b>token</b><br>
15445   * Path: <b>ExplanationOfBenefit.identifier</b><br>
15446   * </p>
15447   */
15448  @SearchParamDefinition(name="identifier", path="ExplanationOfBenefit.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
15449  public static final String SP_IDENTIFIER = "identifier";
15450 /**
15451   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
15452   * <p>
15453   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
15454   * Type: <b>token</b><br>
15455   * Path: <b>ExplanationOfBenefit.identifier</b><br>
15456   * </p>
15457   */
15458  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
15459
15460 /**
15461   * Search parameter: <b>created</b>
15462   * <p>
15463   * Description: <b>The creation date for the EOB</b><br>
15464   * Type: <b>date</b><br>
15465   * Path: <b>ExplanationOfBenefit.created</b><br>
15466   * </p>
15467   */
15468  @SearchParamDefinition(name="created", path="ExplanationOfBenefit.created", description="The creation date for the EOB", type="date" )
15469  public static final String SP_CREATED = "created";
15470 /**
15471   * <b>Fluent Client</b> search parameter constant for <b>created</b>
15472   * <p>
15473   * Description: <b>The creation date for the EOB</b><br>
15474   * Type: <b>date</b><br>
15475   * Path: <b>ExplanationOfBenefit.created</b><br>
15476   * </p>
15477   */
15478  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
15479
15480 /**
15481   * Search parameter: <b>encounter</b>
15482   * <p>
15483   * Description: <b>Encounters associated with a billed line item</b><br>
15484   * Type: <b>reference</b><br>
15485   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
15486   * </p>
15487   */
15488  @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 } )
15489  public static final String SP_ENCOUNTER = "encounter";
15490 /**
15491   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
15492   * <p>
15493   * Description: <b>Encounters associated with a billed line item</b><br>
15494   * Type: <b>reference</b><br>
15495   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
15496   * </p>
15497   */
15498  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
15499
15500/**
15501   * Constant for fluent queries to be used to add include statements. Specifies
15502   * the path value of "<b>ExplanationOfBenefit:encounter</b>".
15503   */
15504  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:encounter").toLocked();
15505
15506 /**
15507   * Search parameter: <b>payee</b>
15508   * <p>
15509   * Description: <b>The party receiving any payment for the Claim</b><br>
15510   * Type: <b>reference</b><br>
15511   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
15512   * </p>
15513   */
15514  @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 } )
15515  public static final String SP_PAYEE = "payee";
15516 /**
15517   * <b>Fluent Client</b> search parameter constant for <b>payee</b>
15518   * <p>
15519   * Description: <b>The party receiving any payment for the Claim</b><br>
15520   * Type: <b>reference</b><br>
15521   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
15522   * </p>
15523   */
15524  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PAYEE);
15525
15526/**
15527   * Constant for fluent queries to be used to add include statements. Specifies
15528   * the path value of "<b>ExplanationOfBenefit:payee</b>".
15529   */
15530  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYEE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:payee").toLocked();
15531
15532 /**
15533   * Search parameter: <b>disposition</b>
15534   * <p>
15535   * Description: <b>The contents of the disposition message</b><br>
15536   * Type: <b>string</b><br>
15537   * Path: <b>ExplanationOfBenefit.disposition</b><br>
15538   * </p>
15539   */
15540  @SearchParamDefinition(name="disposition", path="ExplanationOfBenefit.disposition", description="The contents of the disposition message", type="string" )
15541  public static final String SP_DISPOSITION = "disposition";
15542 /**
15543   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
15544   * <p>
15545   * Description: <b>The contents of the disposition message</b><br>
15546   * Type: <b>string</b><br>
15547   * Path: <b>ExplanationOfBenefit.disposition</b><br>
15548   * </p>
15549   */
15550  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
15551
15552 /**
15553   * Search parameter: <b>provider</b>
15554   * <p>
15555   * Description: <b>The reference to the provider</b><br>
15556   * Type: <b>reference</b><br>
15557   * Path: <b>ExplanationOfBenefit.provider</b><br>
15558   * </p>
15559   */
15560  @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 } )
15561  public static final String SP_PROVIDER = "provider";
15562 /**
15563   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
15564   * <p>
15565   * Description: <b>The reference to the provider</b><br>
15566   * Type: <b>reference</b><br>
15567   * Path: <b>ExplanationOfBenefit.provider</b><br>
15568   * </p>
15569   */
15570  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
15571
15572/**
15573   * Constant for fluent queries to be used to add include statements. Specifies
15574   * the path value of "<b>ExplanationOfBenefit:provider</b>".
15575   */
15576  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:provider").toLocked();
15577
15578 /**
15579   * Search parameter: <b>patient</b>
15580   * <p>
15581   * Description: <b>The reference to the patient</b><br>
15582   * Type: <b>reference</b><br>
15583   * Path: <b>ExplanationOfBenefit.patient</b><br>
15584   * </p>
15585   */
15586  @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 } )
15587  public static final String SP_PATIENT = "patient";
15588 /**
15589   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
15590   * <p>
15591   * Description: <b>The reference to the patient</b><br>
15592   * Type: <b>reference</b><br>
15593   * Path: <b>ExplanationOfBenefit.patient</b><br>
15594   * </p>
15595   */
15596  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
15597
15598/**
15599   * Constant for fluent queries to be used to add include statements. Specifies
15600   * the path value of "<b>ExplanationOfBenefit:patient</b>".
15601   */
15602  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:patient").toLocked();
15603
15604 /**
15605   * Search parameter: <b>detail-udi</b>
15606   * <p>
15607   * Description: <b>UDI associated with a line item detail product or service</b><br>
15608   * Type: <b>reference</b><br>
15609   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
15610   * </p>
15611   */
15612  @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 } )
15613  public static final String SP_DETAIL_UDI = "detail-udi";
15614 /**
15615   * <b>Fluent Client</b> search parameter constant for <b>detail-udi</b>
15616   * <p>
15617   * Description: <b>UDI associated with a line item detail product or service</b><br>
15618   * Type: <b>reference</b><br>
15619   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
15620   * </p>
15621   */
15622  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DETAIL_UDI);
15623
15624/**
15625   * Constant for fluent queries to be used to add include statements. Specifies
15626   * the path value of "<b>ExplanationOfBenefit:detail-udi</b>".
15627   */
15628  public static final ca.uhn.fhir.model.api.Include INCLUDE_DETAIL_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:detail-udi").toLocked();
15629
15630 /**
15631   * Search parameter: <b>claim</b>
15632   * <p>
15633   * Description: <b>The reference to the claim</b><br>
15634   * Type: <b>reference</b><br>
15635   * Path: <b>ExplanationOfBenefit.claim</b><br>
15636   * </p>
15637   */
15638  @SearchParamDefinition(name="claim", path="ExplanationOfBenefit.claim", description="The reference to the claim", type="reference", target={Claim.class } )
15639  public static final String SP_CLAIM = "claim";
15640 /**
15641   * <b>Fluent Client</b> search parameter constant for <b>claim</b>
15642   * <p>
15643   * Description: <b>The reference to the claim</b><br>
15644   * Type: <b>reference</b><br>
15645   * Path: <b>ExplanationOfBenefit.claim</b><br>
15646   * </p>
15647   */
15648  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CLAIM);
15649
15650/**
15651   * Constant for fluent queries to be used to add include statements. Specifies
15652   * the path value of "<b>ExplanationOfBenefit:claim</b>".
15653   */
15654  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:claim").toLocked();
15655
15656 /**
15657   * Search parameter: <b>enterer</b>
15658   * <p>
15659   * Description: <b>The party responsible for the entry of the Claim</b><br>
15660   * Type: <b>reference</b><br>
15661   * Path: <b>ExplanationOfBenefit.enterer</b><br>
15662   * </p>
15663   */
15664  @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 } )
15665  public static final String SP_ENTERER = "enterer";
15666 /**
15667   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
15668   * <p>
15669   * Description: <b>The party responsible for the entry of the Claim</b><br>
15670   * Type: <b>reference</b><br>
15671   * Path: <b>ExplanationOfBenefit.enterer</b><br>
15672   * </p>
15673   */
15674  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTERER);
15675
15676/**
15677   * Constant for fluent queries to be used to add include statements. Specifies
15678   * the path value of "<b>ExplanationOfBenefit:enterer</b>".
15679   */
15680  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:enterer").toLocked();
15681
15682 /**
15683   * Search parameter: <b>procedure-udi</b>
15684   * <p>
15685   * Description: <b>UDI associated with a procedure</b><br>
15686   * Type: <b>reference</b><br>
15687   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
15688   * </p>
15689   */
15690  @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 } )
15691  public static final String SP_PROCEDURE_UDI = "procedure-udi";
15692 /**
15693   * <b>Fluent Client</b> search parameter constant for <b>procedure-udi</b>
15694   * <p>
15695   * Description: <b>UDI associated with a procedure</b><br>
15696   * Type: <b>reference</b><br>
15697   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
15698   * </p>
15699   */
15700  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROCEDURE_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROCEDURE_UDI);
15701
15702/**
15703   * Constant for fluent queries to be used to add include statements. Specifies
15704   * the path value of "<b>ExplanationOfBenefit:procedure-udi</b>".
15705   */
15706  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROCEDURE_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:procedure-udi").toLocked();
15707
15708 /**
15709   * Search parameter: <b>subdetail-udi</b>
15710   * <p>
15711   * Description: <b>UDI associated with a line item detail subdetail product or service</b><br>
15712   * Type: <b>reference</b><br>
15713   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
15714   * </p>
15715   */
15716  @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 } )
15717  public static final String SP_SUBDETAIL_UDI = "subdetail-udi";
15718 /**
15719   * <b>Fluent Client</b> search parameter constant for <b>subdetail-udi</b>
15720   * <p>
15721   * Description: <b>UDI associated with a line item detail subdetail product or service</b><br>
15722   * Type: <b>reference</b><br>
15723   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
15724   * </p>
15725   */
15726  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBDETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBDETAIL_UDI);
15727
15728/**
15729   * Constant for fluent queries to be used to add include statements. Specifies
15730   * the path value of "<b>ExplanationOfBenefit:subdetail-udi</b>".
15731   */
15732  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBDETAIL_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:subdetail-udi").toLocked();
15733
15734 /**
15735   * Search parameter: <b>facility</b>
15736   * <p>
15737   * Description: <b>Facility responsible for the goods and services</b><br>
15738   * Type: <b>reference</b><br>
15739   * Path: <b>ExplanationOfBenefit.facility</b><br>
15740   * </p>
15741   */
15742  @SearchParamDefinition(name="facility", path="ExplanationOfBenefit.facility", description="Facility responsible for the goods and services", type="reference", target={Location.class } )
15743  public static final String SP_FACILITY = "facility";
15744 /**
15745   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
15746   * <p>
15747   * Description: <b>Facility responsible for the goods and services</b><br>
15748   * Type: <b>reference</b><br>
15749   * Path: <b>ExplanationOfBenefit.facility</b><br>
15750   * </p>
15751   */
15752  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITY);
15753
15754/**
15755   * Constant for fluent queries to be used to add include statements. Specifies
15756   * the path value of "<b>ExplanationOfBenefit:facility</b>".
15757   */
15758  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:facility").toLocked();
15759
15760 /**
15761   * Search parameter: <b>item-udi</b>
15762   * <p>
15763   * Description: <b>UDI associated with a line item product or service</b><br>
15764   * Type: <b>reference</b><br>
15765   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
15766   * </p>
15767   */
15768  @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 } )
15769  public static final String SP_ITEM_UDI = "item-udi";
15770 /**
15771   * <b>Fluent Client</b> search parameter constant for <b>item-udi</b>
15772   * <p>
15773   * Description: <b>UDI associated with a line item product or service</b><br>
15774   * Type: <b>reference</b><br>
15775   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
15776   * </p>
15777   */
15778  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ITEM_UDI);
15779
15780/**
15781   * Constant for fluent queries to be used to add include statements. Specifies
15782   * the path value of "<b>ExplanationOfBenefit:item-udi</b>".
15783   */
15784  public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:item-udi").toLocked();
15785
15786 /**
15787   * Search parameter: <b>status</b>
15788   * <p>
15789   * Description: <b>Status of the instance</b><br>
15790   * Type: <b>token</b><br>
15791   * Path: <b>ExplanationOfBenefit.status</b><br>
15792   * </p>
15793   */
15794  @SearchParamDefinition(name="status", path="ExplanationOfBenefit.status", description="Status of the instance", type="token" )
15795  public static final String SP_STATUS = "status";
15796 /**
15797   * <b>Fluent Client</b> search parameter constant for <b>status</b>
15798   * <p>
15799   * Description: <b>Status of the instance</b><br>
15800   * Type: <b>token</b><br>
15801   * Path: <b>ExplanationOfBenefit.status</b><br>
15802   * </p>
15803   */
15804  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
15805
15806
15807}
15808