001package org.hl7.fhir.r5.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r5
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.ArrayList;
054import java.util.Date;
055import java.util.List;
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.ICompositeType;
058
059import java.math.*;
060import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
061import org.hl7.fhir.utilities.Utilities;
062import org.hl7.fhir.r5.model.Enumerations.*;
063import ca.uhn.fhir.model.api.annotation.ResourceDef;
064import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
065import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
066import ca.uhn.fhir.model.api.annotation.Child;
067import ca.uhn.fhir.model.api.annotation.ChildOrder;
068import ca.uhn.fhir.model.api.annotation.Description;
069import ca.uhn.fhir.model.api.annotation.Block;
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         * A code to convey how the claims are related.
443         */
444        @Child(name = "relationship", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
445        @Description(shortDefinition="How the reference claim is related", formalDefinition="A code to convey how the claims are related." )
446        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/related-claim-relationship")
447        protected CodeableConcept relationship;
448
449        /**
450         * An alternate organizational reference to the case or file to which this particular claim pertains.
451         */
452        @Child(name = "reference", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=false)
453        @Description(shortDefinition="File or case reference", formalDefinition="An alternate organizational reference to the case or file to which this particular claim pertains." )
454        protected Identifier reference;
455
456        private static final long serialVersionUID = 1047077926L;
457
458    /**
459     * Constructor
460     */
461      public RelatedClaimComponent() {
462        super();
463      }
464
465        /**
466         * @return {@link #claim} (Reference to a related claim.)
467         */
468        public Reference getClaim() { 
469          if (this.claim == null)
470            if (Configuration.errorOnAutoCreate())
471              throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
472            else if (Configuration.doAutoCreate())
473              this.claim = new Reference(); // cc
474          return this.claim;
475        }
476
477        public boolean hasClaim() { 
478          return this.claim != null && !this.claim.isEmpty();
479        }
480
481        /**
482         * @param value {@link #claim} (Reference to a related claim.)
483         */
484        public RelatedClaimComponent setClaim(Reference value) { 
485          this.claim = value;
486          return this;
487        }
488
489        /**
490         * @return {@link #relationship} (A code to convey how the claims are related.)
491         */
492        public CodeableConcept getRelationship() { 
493          if (this.relationship == null)
494            if (Configuration.errorOnAutoCreate())
495              throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
496            else if (Configuration.doAutoCreate())
497              this.relationship = new CodeableConcept(); // cc
498          return this.relationship;
499        }
500
501        public boolean hasRelationship() { 
502          return this.relationship != null && !this.relationship.isEmpty();
503        }
504
505        /**
506         * @param value {@link #relationship} (A code to convey how the claims are related.)
507         */
508        public RelatedClaimComponent setRelationship(CodeableConcept value) { 
509          this.relationship = value;
510          return this;
511        }
512
513        /**
514         * @return {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
515         */
516        public Identifier getReference() { 
517          if (this.reference == null)
518            if (Configuration.errorOnAutoCreate())
519              throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
520            else if (Configuration.doAutoCreate())
521              this.reference = new Identifier(); // cc
522          return this.reference;
523        }
524
525        public boolean hasReference() { 
526          return this.reference != null && !this.reference.isEmpty();
527        }
528
529        /**
530         * @param value {@link #reference} (An alternate organizational reference to the case or file to which this particular claim pertains.)
531         */
532        public RelatedClaimComponent setReference(Identifier value) { 
533          this.reference = value;
534          return this;
535        }
536
537        protected void listChildren(List<Property> children) {
538          super.listChildren(children);
539          children.add(new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim));
540          children.add(new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship));
541          children.add(new Property("reference", "Identifier", "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1, reference));
542        }
543
544        @Override
545        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
546          switch (_hash) {
547          case 94742588: /*claim*/  return new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim);
548          case -261851592: /*relationship*/  return new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1, relationship);
549          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);
550          default: return super.getNamedProperty(_hash, _name, _checkValid);
551          }
552
553        }
554
555      @Override
556      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
557        switch (hash) {
558        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
559        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
560        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Identifier
561        default: return super.getProperty(hash, name, checkValid);
562        }
563
564      }
565
566      @Override
567      public Base setProperty(int hash, String name, Base value) throws FHIRException {
568        switch (hash) {
569        case 94742588: // claim
570          this.claim = castToReference(value); // Reference
571          return value;
572        case -261851592: // relationship
573          this.relationship = castToCodeableConcept(value); // CodeableConcept
574          return value;
575        case -925155509: // reference
576          this.reference = castToIdentifier(value); // Identifier
577          return value;
578        default: return super.setProperty(hash, name, value);
579        }
580
581      }
582
583      @Override
584      public Base setProperty(String name, Base value) throws FHIRException {
585        if (name.equals("claim")) {
586          this.claim = castToReference(value); // Reference
587        } else if (name.equals("relationship")) {
588          this.relationship = castToCodeableConcept(value); // CodeableConcept
589        } else if (name.equals("reference")) {
590          this.reference = castToIdentifier(value); // Identifier
591        } else
592          return super.setProperty(name, value);
593        return value;
594      }
595
596      @Override
597      public Base makeProperty(int hash, String name) throws FHIRException {
598        switch (hash) {
599        case 94742588:  return getClaim();
600        case -261851592:  return getRelationship();
601        case -925155509:  return getReference();
602        default: return super.makeProperty(hash, name);
603        }
604
605      }
606
607      @Override
608      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
609        switch (hash) {
610        case 94742588: /*claim*/ return new String[] {"Reference"};
611        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
612        case -925155509: /*reference*/ return new String[] {"Identifier"};
613        default: return super.getTypesForProperty(hash, name);
614        }
615
616      }
617
618      @Override
619      public Base addChild(String name) throws FHIRException {
620        if (name.equals("claim")) {
621          this.claim = new Reference();
622          return this.claim;
623        }
624        else if (name.equals("relationship")) {
625          this.relationship = new CodeableConcept();
626          return this.relationship;
627        }
628        else if (name.equals("reference")) {
629          this.reference = new Identifier();
630          return this.reference;
631        }
632        else
633          return super.addChild(name);
634      }
635
636      public RelatedClaimComponent copy() {
637        RelatedClaimComponent dst = new RelatedClaimComponent();
638        copyValues(dst);
639        return dst;
640      }
641
642      public void copyValues(RelatedClaimComponent dst) {
643        super.copyValues(dst);
644        dst.claim = claim == null ? null : claim.copy();
645        dst.relationship = relationship == null ? null : relationship.copy();
646        dst.reference = reference == null ? null : reference.copy();
647      }
648
649      @Override
650      public boolean equalsDeep(Base other_) {
651        if (!super.equalsDeep(other_))
652          return false;
653        if (!(other_ instanceof RelatedClaimComponent))
654          return false;
655        RelatedClaimComponent o = (RelatedClaimComponent) other_;
656        return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true) && compareDeep(reference, o.reference, true)
657          ;
658      }
659
660      @Override
661      public boolean equalsShallow(Base other_) {
662        if (!super.equalsShallow(other_))
663          return false;
664        if (!(other_ instanceof RelatedClaimComponent))
665          return false;
666        RelatedClaimComponent o = (RelatedClaimComponent) other_;
667        return true;
668      }
669
670      public boolean isEmpty() {
671        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference
672          );
673      }
674
675  public String fhirType() {
676    return "ExplanationOfBenefit.related";
677
678  }
679
680  }
681
682    @Block()
683    public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
684        /**
685         * Type of Party to be reimbursed: Subscriber, provider, other.
686         */
687        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
688        @Description(shortDefinition="Category of recipient", formalDefinition="Type of Party to be reimbursed: Subscriber, provider, other." )
689        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payeetype")
690        protected CodeableConcept type;
691
692        /**
693         * Reference to the individual or organization to whom any payment will be made.
694         */
695        @Child(name = "party", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, RelatedPerson.class}, order=2, min=0, max=1, modifier=false, summary=false)
696        @Description(shortDefinition="Recipient reference", formalDefinition="Reference to the individual or organization to whom any payment will be made." )
697        protected Reference party;
698
699        private static final long serialVersionUID = -1948897146L;
700
701    /**
702     * Constructor
703     */
704      public PayeeComponent() {
705        super();
706      }
707
708        /**
709         * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
710         */
711        public CodeableConcept getType() { 
712          if (this.type == null)
713            if (Configuration.errorOnAutoCreate())
714              throw new Error("Attempt to auto-create PayeeComponent.type");
715            else if (Configuration.doAutoCreate())
716              this.type = new CodeableConcept(); // cc
717          return this.type;
718        }
719
720        public boolean hasType() { 
721          return this.type != null && !this.type.isEmpty();
722        }
723
724        /**
725         * @param value {@link #type} (Type of Party to be reimbursed: Subscriber, provider, other.)
726         */
727        public PayeeComponent setType(CodeableConcept value) { 
728          this.type = value;
729          return this;
730        }
731
732        /**
733         * @return {@link #party} (Reference to the individual or organization to whom any payment will be made.)
734         */
735        public Reference getParty() { 
736          if (this.party == null)
737            if (Configuration.errorOnAutoCreate())
738              throw new Error("Attempt to auto-create PayeeComponent.party");
739            else if (Configuration.doAutoCreate())
740              this.party = new Reference(); // cc
741          return this.party;
742        }
743
744        public boolean hasParty() { 
745          return this.party != null && !this.party.isEmpty();
746        }
747
748        /**
749         * @param value {@link #party} (Reference to the individual or organization to whom any payment will be made.)
750         */
751        public PayeeComponent setParty(Reference value) { 
752          this.party = value;
753          return this;
754        }
755
756        protected void listChildren(List<Property> children) {
757          super.listChildren(children);
758          children.add(new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type));
759          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));
760        }
761
762        @Override
763        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
764          switch (_hash) {
765          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type);
766          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);
767          default: return super.getNamedProperty(_hash, _name, _checkValid);
768          }
769
770        }
771
772      @Override
773      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
774        switch (hash) {
775        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
776        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
777        default: return super.getProperty(hash, name, checkValid);
778        }
779
780      }
781
782      @Override
783      public Base setProperty(int hash, String name, Base value) throws FHIRException {
784        switch (hash) {
785        case 3575610: // type
786          this.type = castToCodeableConcept(value); // CodeableConcept
787          return value;
788        case 106437350: // party
789          this.party = castToReference(value); // Reference
790          return value;
791        default: return super.setProperty(hash, name, value);
792        }
793
794      }
795
796      @Override
797      public Base setProperty(String name, Base value) throws FHIRException {
798        if (name.equals("type")) {
799          this.type = castToCodeableConcept(value); // CodeableConcept
800        } else if (name.equals("party")) {
801          this.party = castToReference(value); // Reference
802        } else
803          return super.setProperty(name, value);
804        return value;
805      }
806
807      @Override
808      public Base makeProperty(int hash, String name) throws FHIRException {
809        switch (hash) {
810        case 3575610:  return getType();
811        case 106437350:  return getParty();
812        default: return super.makeProperty(hash, name);
813        }
814
815      }
816
817      @Override
818      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
819        switch (hash) {
820        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
821        case 106437350: /*party*/ return new String[] {"Reference"};
822        default: return super.getTypesForProperty(hash, name);
823        }
824
825      }
826
827      @Override
828      public Base addChild(String name) throws FHIRException {
829        if (name.equals("type")) {
830          this.type = new CodeableConcept();
831          return this.type;
832        }
833        else if (name.equals("party")) {
834          this.party = new Reference();
835          return this.party;
836        }
837        else
838          return super.addChild(name);
839      }
840
841      public PayeeComponent copy() {
842        PayeeComponent dst = new PayeeComponent();
843        copyValues(dst);
844        return dst;
845      }
846
847      public void copyValues(PayeeComponent dst) {
848        super.copyValues(dst);
849        dst.type = type == null ? null : type.copy();
850        dst.party = party == null ? null : party.copy();
851      }
852
853      @Override
854      public boolean equalsDeep(Base other_) {
855        if (!super.equalsDeep(other_))
856          return false;
857        if (!(other_ instanceof PayeeComponent))
858          return false;
859        PayeeComponent o = (PayeeComponent) other_;
860        return compareDeep(type, o.type, true) && compareDeep(party, o.party, true);
861      }
862
863      @Override
864      public boolean equalsShallow(Base other_) {
865        if (!super.equalsShallow(other_))
866          return false;
867        if (!(other_ instanceof PayeeComponent))
868          return false;
869        PayeeComponent o = (PayeeComponent) other_;
870        return true;
871      }
872
873      public boolean isEmpty() {
874        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party);
875      }
876
877  public String fhirType() {
878    return "ExplanationOfBenefit.payee";
879
880  }
881
882  }
883
884    @Block()
885    public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
886        /**
887         * A number to uniquely identify care team entries.
888         */
889        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
890        @Description(shortDefinition="Order of care team", formalDefinition="A number to uniquely identify care team entries." )
891        protected PositiveIntType sequence;
892
893        /**
894         * Member of the team who provided the product or service.
895         */
896        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=2, min=1, max=1, modifier=false, summary=false)
897        @Description(shortDefinition="Practitioner or organization", formalDefinition="Member of the team who provided the product or service." )
898        protected Reference provider;
899
900        /**
901         * The party who is billing and/or responsible for the claimed products or services.
902         */
903        @Child(name = "responsible", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
904        @Description(shortDefinition="Indicator of the lead practitioner", formalDefinition="The party who is billing and/or responsible for the claimed products or services." )
905        protected BooleanType responsible;
906
907        /**
908         * The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.
909         */
910        @Child(name = "role", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
911        @Description(shortDefinition="Function within the team", formalDefinition="The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team." )
912        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-careteamrole")
913        protected CodeableConcept role;
914
915        /**
916         * The qualification of the practitioner which is applicable for this service.
917         */
918        @Child(name = "qualification", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
919        @Description(shortDefinition="Practitioner credential or specialization", formalDefinition="The qualification of the practitioner which is applicable for this service." )
920        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provider-qualification")
921        protected CodeableConcept qualification;
922
923        private static final long serialVersionUID = 1479624238L;
924
925    /**
926     * Constructor
927     */
928      public CareTeamComponent() {
929        super();
930      }
931
932    /**
933     * Constructor
934     */
935      public CareTeamComponent(PositiveIntType sequence, Reference provider) {
936        super();
937        this.sequence = sequence;
938        this.provider = provider;
939      }
940
941        /**
942         * @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
943         */
944        public PositiveIntType getSequenceElement() { 
945          if (this.sequence == null)
946            if (Configuration.errorOnAutoCreate())
947              throw new Error("Attempt to auto-create CareTeamComponent.sequence");
948            else if (Configuration.doAutoCreate())
949              this.sequence = new PositiveIntType(); // bb
950          return this.sequence;
951        }
952
953        public boolean hasSequenceElement() { 
954          return this.sequence != null && !this.sequence.isEmpty();
955        }
956
957        public boolean hasSequence() { 
958          return this.sequence != null && !this.sequence.isEmpty();
959        }
960
961        /**
962         * @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
963         */
964        public CareTeamComponent setSequenceElement(PositiveIntType value) { 
965          this.sequence = value;
966          return this;
967        }
968
969        /**
970         * @return A number to uniquely identify care team entries.
971         */
972        public int getSequence() { 
973          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
974        }
975
976        /**
977         * @param value A number to uniquely identify care team entries.
978         */
979        public CareTeamComponent setSequence(int value) { 
980            if (this.sequence == null)
981              this.sequence = new PositiveIntType();
982            this.sequence.setValue(value);
983          return this;
984        }
985
986        /**
987         * @return {@link #provider} (Member of the team who provided the product or service.)
988         */
989        public Reference getProvider() { 
990          if (this.provider == null)
991            if (Configuration.errorOnAutoCreate())
992              throw new Error("Attempt to auto-create CareTeamComponent.provider");
993            else if (Configuration.doAutoCreate())
994              this.provider = new Reference(); // cc
995          return this.provider;
996        }
997
998        public boolean hasProvider() { 
999          return this.provider != null && !this.provider.isEmpty();
1000        }
1001
1002        /**
1003         * @param value {@link #provider} (Member of the team who provided the product or service.)
1004         */
1005        public CareTeamComponent setProvider(Reference value) { 
1006          this.provider = value;
1007          return this;
1008        }
1009
1010        /**
1011         * @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
1012         */
1013        public BooleanType getResponsibleElement() { 
1014          if (this.responsible == null)
1015            if (Configuration.errorOnAutoCreate())
1016              throw new Error("Attempt to auto-create CareTeamComponent.responsible");
1017            else if (Configuration.doAutoCreate())
1018              this.responsible = new BooleanType(); // bb
1019          return this.responsible;
1020        }
1021
1022        public boolean hasResponsibleElement() { 
1023          return this.responsible != null && !this.responsible.isEmpty();
1024        }
1025
1026        public boolean hasResponsible() { 
1027          return this.responsible != null && !this.responsible.isEmpty();
1028        }
1029
1030        /**
1031         * @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
1032         */
1033        public CareTeamComponent setResponsibleElement(BooleanType value) { 
1034          this.responsible = value;
1035          return this;
1036        }
1037
1038        /**
1039         * @return The party who is billing and/or responsible for the claimed products or services.
1040         */
1041        public boolean getResponsible() { 
1042          return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
1043        }
1044
1045        /**
1046         * @param value The party who is billing and/or responsible for the claimed products or services.
1047         */
1048        public CareTeamComponent setResponsible(boolean value) { 
1049            if (this.responsible == null)
1050              this.responsible = new BooleanType();
1051            this.responsible.setValue(value);
1052          return this;
1053        }
1054
1055        /**
1056         * @return {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.)
1057         */
1058        public CodeableConcept getRole() { 
1059          if (this.role == null)
1060            if (Configuration.errorOnAutoCreate())
1061              throw new Error("Attempt to auto-create CareTeamComponent.role");
1062            else if (Configuration.doAutoCreate())
1063              this.role = new CodeableConcept(); // cc
1064          return this.role;
1065        }
1066
1067        public boolean hasRole() { 
1068          return this.role != null && !this.role.isEmpty();
1069        }
1070
1071        /**
1072         * @param value {@link #role} (The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.)
1073         */
1074        public CareTeamComponent setRole(CodeableConcept value) { 
1075          this.role = value;
1076          return this;
1077        }
1078
1079        /**
1080         * @return {@link #qualification} (The qualification of the practitioner which is applicable for this service.)
1081         */
1082        public CodeableConcept getQualification() { 
1083          if (this.qualification == null)
1084            if (Configuration.errorOnAutoCreate())
1085              throw new Error("Attempt to auto-create CareTeamComponent.qualification");
1086            else if (Configuration.doAutoCreate())
1087              this.qualification = new CodeableConcept(); // cc
1088          return this.qualification;
1089        }
1090
1091        public boolean hasQualification() { 
1092          return this.qualification != null && !this.qualification.isEmpty();
1093        }
1094
1095        /**
1096         * @param value {@link #qualification} (The qualification of the practitioner which is applicable for this service.)
1097         */
1098        public CareTeamComponent setQualification(CodeableConcept value) { 
1099          this.qualification = value;
1100          return this;
1101        }
1102
1103        protected void listChildren(List<Property> children) {
1104          super.listChildren(children);
1105          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence));
1106          children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "Member of the team who provided the product or service.", 0, 1, provider));
1107          children.add(new Property("responsible", "boolean", "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible));
1108          children.add(new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1, role));
1109          children.add(new Property("qualification", "CodeableConcept", "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification));
1110        }
1111
1112        @Override
1113        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1114          switch (_hash) {
1115          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence);
1116          case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "Member of the team who provided the product or service.", 0, 1, provider);
1117          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);
1118          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1, role);
1119          case -631333393: /*qualification*/  return new Property("qualification", "CodeableConcept", "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification);
1120          default: return super.getNamedProperty(_hash, _name, _checkValid);
1121          }
1122
1123        }
1124
1125      @Override
1126      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1127        switch (hash) {
1128        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1129        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
1130        case 1847674614: /*responsible*/ return this.responsible == null ? new Base[0] : new Base[] {this.responsible}; // BooleanType
1131        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
1132        case -631333393: /*qualification*/ return this.qualification == null ? new Base[0] : new Base[] {this.qualification}; // CodeableConcept
1133        default: return super.getProperty(hash, name, checkValid);
1134        }
1135
1136      }
1137
1138      @Override
1139      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1140        switch (hash) {
1141        case 1349547969: // sequence
1142          this.sequence = castToPositiveInt(value); // PositiveIntType
1143          return value;
1144        case -987494927: // provider
1145          this.provider = castToReference(value); // Reference
1146          return value;
1147        case 1847674614: // responsible
1148          this.responsible = castToBoolean(value); // BooleanType
1149          return value;
1150        case 3506294: // role
1151          this.role = castToCodeableConcept(value); // CodeableConcept
1152          return value;
1153        case -631333393: // qualification
1154          this.qualification = castToCodeableConcept(value); // CodeableConcept
1155          return value;
1156        default: return super.setProperty(hash, name, value);
1157        }
1158
1159      }
1160
1161      @Override
1162      public Base setProperty(String name, Base value) throws FHIRException {
1163        if (name.equals("sequence")) {
1164          this.sequence = castToPositiveInt(value); // PositiveIntType
1165        } else if (name.equals("provider")) {
1166          this.provider = castToReference(value); // Reference
1167        } else if (name.equals("responsible")) {
1168          this.responsible = castToBoolean(value); // BooleanType
1169        } else if (name.equals("role")) {
1170          this.role = castToCodeableConcept(value); // CodeableConcept
1171        } else if (name.equals("qualification")) {
1172          this.qualification = castToCodeableConcept(value); // CodeableConcept
1173        } else
1174          return super.setProperty(name, value);
1175        return value;
1176      }
1177
1178      @Override
1179      public Base makeProperty(int hash, String name) throws FHIRException {
1180        switch (hash) {
1181        case 1349547969:  return getSequenceElement();
1182        case -987494927:  return getProvider();
1183        case 1847674614:  return getResponsibleElement();
1184        case 3506294:  return getRole();
1185        case -631333393:  return getQualification();
1186        default: return super.makeProperty(hash, name);
1187        }
1188
1189      }
1190
1191      @Override
1192      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1193        switch (hash) {
1194        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1195        case -987494927: /*provider*/ return new String[] {"Reference"};
1196        case 1847674614: /*responsible*/ return new String[] {"boolean"};
1197        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
1198        case -631333393: /*qualification*/ return new String[] {"CodeableConcept"};
1199        default: return super.getTypesForProperty(hash, name);
1200        }
1201
1202      }
1203
1204      @Override
1205      public Base addChild(String name) throws FHIRException {
1206        if (name.equals("sequence")) {
1207          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1208        }
1209        else if (name.equals("provider")) {
1210          this.provider = new Reference();
1211          return this.provider;
1212        }
1213        else if (name.equals("responsible")) {
1214          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.responsible");
1215        }
1216        else if (name.equals("role")) {
1217          this.role = new CodeableConcept();
1218          return this.role;
1219        }
1220        else if (name.equals("qualification")) {
1221          this.qualification = new CodeableConcept();
1222          return this.qualification;
1223        }
1224        else
1225          return super.addChild(name);
1226      }
1227
1228      public CareTeamComponent copy() {
1229        CareTeamComponent dst = new CareTeamComponent();
1230        copyValues(dst);
1231        return dst;
1232      }
1233
1234      public void copyValues(CareTeamComponent dst) {
1235        super.copyValues(dst);
1236        dst.sequence = sequence == null ? null : sequence.copy();
1237        dst.provider = provider == null ? null : provider.copy();
1238        dst.responsible = responsible == null ? null : responsible.copy();
1239        dst.role = role == null ? null : role.copy();
1240        dst.qualification = qualification == null ? null : qualification.copy();
1241      }
1242
1243      @Override
1244      public boolean equalsDeep(Base other_) {
1245        if (!super.equalsDeep(other_))
1246          return false;
1247        if (!(other_ instanceof CareTeamComponent))
1248          return false;
1249        CareTeamComponent o = (CareTeamComponent) other_;
1250        return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true) && compareDeep(responsible, o.responsible, true)
1251           && compareDeep(role, o.role, true) && compareDeep(qualification, o.qualification, true);
1252      }
1253
1254      @Override
1255      public boolean equalsShallow(Base other_) {
1256        if (!super.equalsShallow(other_))
1257          return false;
1258        if (!(other_ instanceof CareTeamComponent))
1259          return false;
1260        CareTeamComponent o = (CareTeamComponent) other_;
1261        return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true)
1262          ;
1263      }
1264
1265      public boolean isEmpty() {
1266        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible
1267          , role, qualification);
1268      }
1269
1270  public String fhirType() {
1271    return "ExplanationOfBenefit.careTeam";
1272
1273  }
1274
1275  }
1276
1277    @Block()
1278    public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
1279        /**
1280         * A number to uniquely identify supporting information entries.
1281         */
1282        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1283        @Description(shortDefinition="Information instance identifier", formalDefinition="A number to uniquely identify supporting information entries." )
1284        protected PositiveIntType sequence;
1285
1286        /**
1287         * The general class of the information supplied: information; exception; accident, employment; onset, etc.
1288         */
1289        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
1290        @Description(shortDefinition="Classification of the supplied information", formalDefinition="The general class of the information supplied: information; exception; accident, employment; onset, etc." )
1291        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-informationcategory")
1292        protected CodeableConcept category;
1293
1294        /**
1295         * System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.
1296         */
1297        @Child(name = "code", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1298        @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." )
1299        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-exception")
1300        protected CodeableConcept code;
1301
1302        /**
1303         * The date when or period to which this information refers.
1304         */
1305        @Child(name = "timing", type = {DateType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
1306        @Description(shortDefinition="When it occurred", formalDefinition="The date when or period to which this information refers." )
1307        protected Type timing;
1308
1309        /**
1310         * Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.
1311         */
1312        @Child(name = "value", type = {BooleanType.class, StringType.class, Quantity.class, Attachment.class, Reference.class}, order=5, min=0, max=1, modifier=false, summary=false)
1313        @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." )
1314        protected Type value;
1315
1316        /**
1317         * Provides the reason in the situation where a reason code is required in addition to the content.
1318         */
1319        @Child(name = "reason", type = {Coding.class}, order=6, min=0, max=1, modifier=false, summary=false)
1320        @Description(shortDefinition="Explanation for the information", formalDefinition="Provides the reason in the situation where a reason code is required in addition to the content." )
1321        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/missing-tooth-reason")
1322        protected Coding reason;
1323
1324        private static final long serialVersionUID = -410136661L;
1325
1326    /**
1327     * Constructor
1328     */
1329      public SupportingInformationComponent() {
1330        super();
1331      }
1332
1333    /**
1334     * Constructor
1335     */
1336      public SupportingInformationComponent(PositiveIntType sequence, CodeableConcept category) {
1337        super();
1338        this.sequence = sequence;
1339        this.category = category;
1340      }
1341
1342        /**
1343         * @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
1344         */
1345        public PositiveIntType getSequenceElement() { 
1346          if (this.sequence == null)
1347            if (Configuration.errorOnAutoCreate())
1348              throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
1349            else if (Configuration.doAutoCreate())
1350              this.sequence = new PositiveIntType(); // bb
1351          return this.sequence;
1352        }
1353
1354        public boolean hasSequenceElement() { 
1355          return this.sequence != null && !this.sequence.isEmpty();
1356        }
1357
1358        public boolean hasSequence() { 
1359          return this.sequence != null && !this.sequence.isEmpty();
1360        }
1361
1362        /**
1363         * @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
1364         */
1365        public SupportingInformationComponent setSequenceElement(PositiveIntType value) { 
1366          this.sequence = value;
1367          return this;
1368        }
1369
1370        /**
1371         * @return A number to uniquely identify supporting information entries.
1372         */
1373        public int getSequence() { 
1374          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1375        }
1376
1377        /**
1378         * @param value A number to uniquely identify supporting information entries.
1379         */
1380        public SupportingInformationComponent setSequence(int value) { 
1381            if (this.sequence == null)
1382              this.sequence = new PositiveIntType();
1383            this.sequence.setValue(value);
1384          return this;
1385        }
1386
1387        /**
1388         * @return {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1389         */
1390        public CodeableConcept getCategory() { 
1391          if (this.category == null)
1392            if (Configuration.errorOnAutoCreate())
1393              throw new Error("Attempt to auto-create SupportingInformationComponent.category");
1394            else if (Configuration.doAutoCreate())
1395              this.category = new CodeableConcept(); // cc
1396          return this.category;
1397        }
1398
1399        public boolean hasCategory() { 
1400          return this.category != null && !this.category.isEmpty();
1401        }
1402
1403        /**
1404         * @param value {@link #category} (The general class of the information supplied: information; exception; accident, employment; onset, etc.)
1405         */
1406        public SupportingInformationComponent setCategory(CodeableConcept value) { 
1407          this.category = value;
1408          return this;
1409        }
1410
1411        /**
1412         * @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.)
1413         */
1414        public CodeableConcept getCode() { 
1415          if (this.code == null)
1416            if (Configuration.errorOnAutoCreate())
1417              throw new Error("Attempt to auto-create SupportingInformationComponent.code");
1418            else if (Configuration.doAutoCreate())
1419              this.code = new CodeableConcept(); // cc
1420          return this.code;
1421        }
1422
1423        public boolean hasCode() { 
1424          return this.code != null && !this.code.isEmpty();
1425        }
1426
1427        /**
1428         * @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.)
1429         */
1430        public SupportingInformationComponent setCode(CodeableConcept value) { 
1431          this.code = value;
1432          return this;
1433        }
1434
1435        /**
1436         * @return {@link #timing} (The date when or period to which this information refers.)
1437         */
1438        public Type getTiming() { 
1439          return this.timing;
1440        }
1441
1442        /**
1443         * @return {@link #timing} (The date when or period to which this information refers.)
1444         */
1445        public DateType getTimingDateType() throws FHIRException { 
1446          if (this.timing == null)
1447            this.timing = new DateType();
1448          if (!(this.timing instanceof DateType))
1449            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.timing.getClass().getName()+" was encountered");
1450          return (DateType) this.timing;
1451        }
1452
1453        public boolean hasTimingDateType() { 
1454          return this != null && this.timing instanceof DateType;
1455        }
1456
1457        /**
1458         * @return {@link #timing} (The date when or period to which this information refers.)
1459         */
1460        public Period getTimingPeriod() throws FHIRException { 
1461          if (this.timing == null)
1462            this.timing = new Period();
1463          if (!(this.timing instanceof Period))
1464            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
1465          return (Period) this.timing;
1466        }
1467
1468        public boolean hasTimingPeriod() { 
1469          return this != null && this.timing instanceof Period;
1470        }
1471
1472        public boolean hasTiming() { 
1473          return this.timing != null && !this.timing.isEmpty();
1474        }
1475
1476        /**
1477         * @param value {@link #timing} (The date when or period to which this information refers.)
1478         */
1479        public SupportingInformationComponent setTiming(Type value) { 
1480          if (value != null && !(value instanceof DateType || value instanceof Period))
1481            throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.timing[x]: "+value.fhirType());
1482          this.timing = value;
1483          return this;
1484        }
1485
1486        /**
1487         * @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.)
1488         */
1489        public Type getValue() { 
1490          return this.value;
1491        }
1492
1493        /**
1494         * @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.)
1495         */
1496        public BooleanType getValueBooleanType() throws FHIRException { 
1497          if (this.value == null)
1498            this.value = new BooleanType();
1499          if (!(this.value instanceof BooleanType))
1500            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
1501          return (BooleanType) this.value;
1502        }
1503
1504        public boolean hasValueBooleanType() { 
1505          return this != null && this.value instanceof BooleanType;
1506        }
1507
1508        /**
1509         * @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.)
1510         */
1511        public StringType getValueStringType() throws FHIRException { 
1512          if (this.value == null)
1513            this.value = new StringType();
1514          if (!(this.value instanceof StringType))
1515            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
1516          return (StringType) this.value;
1517        }
1518
1519        public boolean hasValueStringType() { 
1520          return this != null && this.value instanceof StringType;
1521        }
1522
1523        /**
1524         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
1525         */
1526        public Quantity getValueQuantity() throws FHIRException { 
1527          if (this.value == null)
1528            this.value = new Quantity();
1529          if (!(this.value instanceof Quantity))
1530            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
1531          return (Quantity) this.value;
1532        }
1533
1534        public boolean hasValueQuantity() { 
1535          return this != null && this.value instanceof Quantity;
1536        }
1537
1538        /**
1539         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
1540         */
1541        public Attachment getValueAttachment() throws FHIRException { 
1542          if (this.value == null)
1543            this.value = new Attachment();
1544          if (!(this.value instanceof Attachment))
1545            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
1546          return (Attachment) this.value;
1547        }
1548
1549        public boolean hasValueAttachment() { 
1550          return this != null && this.value instanceof Attachment;
1551        }
1552
1553        /**
1554         * @return {@link #value} (Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.)
1555         */
1556        public Reference getValueReference() throws FHIRException { 
1557          if (this.value == null)
1558            this.value = new Reference();
1559          if (!(this.value instanceof Reference))
1560            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
1561          return (Reference) this.value;
1562        }
1563
1564        public boolean hasValueReference() { 
1565          return this != null && this.value instanceof Reference;
1566        }
1567
1568        public boolean hasValue() { 
1569          return this.value != null && !this.value.isEmpty();
1570        }
1571
1572        /**
1573         * @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.)
1574         */
1575        public SupportingInformationComponent setValue(Type value) { 
1576          if (value != null && !(value instanceof BooleanType || value instanceof StringType || value instanceof Quantity || value instanceof Attachment || value instanceof Reference))
1577            throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.value[x]: "+value.fhirType());
1578          this.value = value;
1579          return this;
1580        }
1581
1582        /**
1583         * @return {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1584         */
1585        public Coding getReason() { 
1586          if (this.reason == null)
1587            if (Configuration.errorOnAutoCreate())
1588              throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1589            else if (Configuration.doAutoCreate())
1590              this.reason = new Coding(); // cc
1591          return this.reason;
1592        }
1593
1594        public boolean hasReason() { 
1595          return this.reason != null && !this.reason.isEmpty();
1596        }
1597
1598        /**
1599         * @param value {@link #reason} (Provides the reason in the situation where a reason code is required in addition to the content.)
1600         */
1601        public SupportingInformationComponent setReason(Coding value) { 
1602          this.reason = value;
1603          return this;
1604        }
1605
1606        protected void listChildren(List<Property> children) {
1607          super.listChildren(children);
1608          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence));
1609          children.add(new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category));
1610          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));
1611          children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing));
1612          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));
1613          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));
1614        }
1615
1616        @Override
1617        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1618          switch (_hash) {
1619          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify supporting information entries.", 0, 1, sequence);
1620          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0, 1, category);
1621          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);
1622          case 164632566: /*timing[x]*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1623          case -873664438: /*timing*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1624          case 807935768: /*timingDate*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1625          case -615615829: /*timingPeriod*/  return new Property("timing[x]", "date|Period", "The date when or period to which this information refers.", 0, 1, timing);
1626          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);
1627          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);
1628          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);
1629          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);
1630          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);
1631          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);
1632          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);
1633          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);
1634          default: return super.getNamedProperty(_hash, _name, _checkValid);
1635          }
1636
1637        }
1638
1639      @Override
1640      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1641        switch (hash) {
1642        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
1643        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1644        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1645        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Type
1646        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
1647        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Coding
1648        default: return super.getProperty(hash, name, checkValid);
1649        }
1650
1651      }
1652
1653      @Override
1654      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1655        switch (hash) {
1656        case 1349547969: // sequence
1657          this.sequence = castToPositiveInt(value); // PositiveIntType
1658          return value;
1659        case 50511102: // category
1660          this.category = castToCodeableConcept(value); // CodeableConcept
1661          return value;
1662        case 3059181: // code
1663          this.code = castToCodeableConcept(value); // CodeableConcept
1664          return value;
1665        case -873664438: // timing
1666          this.timing = castToType(value); // Type
1667          return value;
1668        case 111972721: // value
1669          this.value = castToType(value); // Type
1670          return value;
1671        case -934964668: // reason
1672          this.reason = castToCoding(value); // Coding
1673          return value;
1674        default: return super.setProperty(hash, name, value);
1675        }
1676
1677      }
1678
1679      @Override
1680      public Base setProperty(String name, Base value) throws FHIRException {
1681        if (name.equals("sequence")) {
1682          this.sequence = castToPositiveInt(value); // PositiveIntType
1683        } else if (name.equals("category")) {
1684          this.category = castToCodeableConcept(value); // CodeableConcept
1685        } else if (name.equals("code")) {
1686          this.code = castToCodeableConcept(value); // CodeableConcept
1687        } else if (name.equals("timing[x]")) {
1688          this.timing = castToType(value); // Type
1689        } else if (name.equals("value[x]")) {
1690          this.value = castToType(value); // Type
1691        } else if (name.equals("reason")) {
1692          this.reason = castToCoding(value); // Coding
1693        } else
1694          return super.setProperty(name, value);
1695        return value;
1696      }
1697
1698      @Override
1699      public Base makeProperty(int hash, String name) throws FHIRException {
1700        switch (hash) {
1701        case 1349547969:  return getSequenceElement();
1702        case 50511102:  return getCategory();
1703        case 3059181:  return getCode();
1704        case 164632566:  return getTiming();
1705        case -873664438:  return getTiming();
1706        case -1410166417:  return getValue();
1707        case 111972721:  return getValue();
1708        case -934964668:  return getReason();
1709        default: return super.makeProperty(hash, name);
1710        }
1711
1712      }
1713
1714      @Override
1715      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1716        switch (hash) {
1717        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
1718        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1719        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1720        case -873664438: /*timing*/ return new String[] {"date", "Period"};
1721        case 111972721: /*value*/ return new String[] {"boolean", "string", "Quantity", "Attachment", "Reference"};
1722        case -934964668: /*reason*/ return new String[] {"Coding"};
1723        default: return super.getTypesForProperty(hash, name);
1724        }
1725
1726      }
1727
1728      @Override
1729      public Base addChild(String name) throws FHIRException {
1730        if (name.equals("sequence")) {
1731          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
1732        }
1733        else if (name.equals("category")) {
1734          this.category = new CodeableConcept();
1735          return this.category;
1736        }
1737        else if (name.equals("code")) {
1738          this.code = new CodeableConcept();
1739          return this.code;
1740        }
1741        else if (name.equals("timingDate")) {
1742          this.timing = new DateType();
1743          return this.timing;
1744        }
1745        else if (name.equals("timingPeriod")) {
1746          this.timing = new Period();
1747          return this.timing;
1748        }
1749        else if (name.equals("valueBoolean")) {
1750          this.value = new BooleanType();
1751          return this.value;
1752        }
1753        else if (name.equals("valueString")) {
1754          this.value = new StringType();
1755          return this.value;
1756        }
1757        else if (name.equals("valueQuantity")) {
1758          this.value = new Quantity();
1759          return this.value;
1760        }
1761        else if (name.equals("valueAttachment")) {
1762          this.value = new Attachment();
1763          return this.value;
1764        }
1765        else if (name.equals("valueReference")) {
1766          this.value = new Reference();
1767          return this.value;
1768        }
1769        else if (name.equals("reason")) {
1770          this.reason = new Coding();
1771          return this.reason;
1772        }
1773        else
1774          return super.addChild(name);
1775      }
1776
1777      public SupportingInformationComponent copy() {
1778        SupportingInformationComponent dst = new SupportingInformationComponent();
1779        copyValues(dst);
1780        return dst;
1781      }
1782
1783      public void copyValues(SupportingInformationComponent dst) {
1784        super.copyValues(dst);
1785        dst.sequence = sequence == null ? null : sequence.copy();
1786        dst.category = category == null ? null : category.copy();
1787        dst.code = code == null ? null : code.copy();
1788        dst.timing = timing == null ? null : timing.copy();
1789        dst.value = value == null ? null : value.copy();
1790        dst.reason = reason == null ? null : reason.copy();
1791      }
1792
1793      @Override
1794      public boolean equalsDeep(Base other_) {
1795        if (!super.equalsDeep(other_))
1796          return false;
1797        if (!(other_ instanceof SupportingInformationComponent))
1798          return false;
1799        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1800        return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true) && compareDeep(code, o.code, true)
1801           && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true) && compareDeep(reason, o.reason, true)
1802          ;
1803      }
1804
1805      @Override
1806      public boolean equalsShallow(Base other_) {
1807        if (!super.equalsShallow(other_))
1808          return false;
1809        if (!(other_ instanceof SupportingInformationComponent))
1810          return false;
1811        SupportingInformationComponent o = (SupportingInformationComponent) other_;
1812        return compareValues(sequence, o.sequence, true);
1813      }
1814
1815      public boolean isEmpty() {
1816        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code
1817          , timing, value, reason);
1818      }
1819
1820  public String fhirType() {
1821    return "ExplanationOfBenefit.supportingInfo";
1822
1823  }
1824
1825  }
1826
1827    @Block()
1828    public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
1829        /**
1830         * A number to uniquely identify diagnosis entries.
1831         */
1832        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1833        @Description(shortDefinition="Diagnosis instance identifier", formalDefinition="A number to uniquely identify diagnosis entries." )
1834        protected PositiveIntType sequence;
1835
1836        /**
1837         * The nature of illness or problem in a coded form or as a reference to an external defined Condition.
1838         */
1839        @Child(name = "diagnosis", type = {CodeableConcept.class, Condition.class}, order=2, min=1, max=1, modifier=false, summary=false)
1840        @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." )
1841        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10")
1842        protected Type diagnosis;
1843
1844        /**
1845         * When the condition was observed or the relative ranking.
1846         */
1847        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1848        @Description(shortDefinition="Timing or nature of the diagnosis", formalDefinition="When the condition was observed or the relative ranking." )
1849        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosistype")
1850        protected List<CodeableConcept> type;
1851
1852        /**
1853         * Indication of whether the diagnosis was present on admission to a facility.
1854         */
1855        @Child(name = "onAdmission", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1856        @Description(shortDefinition="Present on admission", formalDefinition="Indication of whether the diagnosis was present on admission to a facility." )
1857        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosis-on-admission")
1858        protected CodeableConcept onAdmission;
1859
1860        /**
1861         * 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.
1862         */
1863        @Child(name = "packageCode", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1864        @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." )
1865        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
1866        protected CodeableConcept packageCode;
1867
1868        private static final long serialVersionUID = 2120593974L;
1869
1870    /**
1871     * Constructor
1872     */
1873      public DiagnosisComponent() {
1874        super();
1875      }
1876
1877    /**
1878     * Constructor
1879     */
1880      public DiagnosisComponent(PositiveIntType sequence, Type diagnosis) {
1881        super();
1882        this.sequence = sequence;
1883        this.diagnosis = diagnosis;
1884      }
1885
1886        /**
1887         * @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
1888         */
1889        public PositiveIntType getSequenceElement() { 
1890          if (this.sequence == null)
1891            if (Configuration.errorOnAutoCreate())
1892              throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
1893            else if (Configuration.doAutoCreate())
1894              this.sequence = new PositiveIntType(); // bb
1895          return this.sequence;
1896        }
1897
1898        public boolean hasSequenceElement() { 
1899          return this.sequence != null && !this.sequence.isEmpty();
1900        }
1901
1902        public boolean hasSequence() { 
1903          return this.sequence != null && !this.sequence.isEmpty();
1904        }
1905
1906        /**
1907         * @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
1908         */
1909        public DiagnosisComponent setSequenceElement(PositiveIntType value) { 
1910          this.sequence = value;
1911          return this;
1912        }
1913
1914        /**
1915         * @return A number to uniquely identify diagnosis entries.
1916         */
1917        public int getSequence() { 
1918          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1919        }
1920
1921        /**
1922         * @param value A number to uniquely identify diagnosis entries.
1923         */
1924        public DiagnosisComponent setSequence(int value) { 
1925            if (this.sequence == null)
1926              this.sequence = new PositiveIntType();
1927            this.sequence.setValue(value);
1928          return this;
1929        }
1930
1931        /**
1932         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1933         */
1934        public Type getDiagnosis() { 
1935          return this.diagnosis;
1936        }
1937
1938        /**
1939         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1940         */
1941        public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException { 
1942          if (this.diagnosis == null)
1943            this.diagnosis = new CodeableConcept();
1944          if (!(this.diagnosis instanceof CodeableConcept))
1945            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1946          return (CodeableConcept) this.diagnosis;
1947        }
1948
1949        public boolean hasDiagnosisCodeableConcept() { 
1950          return this != null && this.diagnosis instanceof CodeableConcept;
1951        }
1952
1953        /**
1954         * @return {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1955         */
1956        public Reference getDiagnosisReference() throws FHIRException { 
1957          if (this.diagnosis == null)
1958            this.diagnosis = new Reference();
1959          if (!(this.diagnosis instanceof Reference))
1960            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.diagnosis.getClass().getName()+" was encountered");
1961          return (Reference) this.diagnosis;
1962        }
1963
1964        public boolean hasDiagnosisReference() { 
1965          return this != null && this.diagnosis instanceof Reference;
1966        }
1967
1968        public boolean hasDiagnosis() { 
1969          return this.diagnosis != null && !this.diagnosis.isEmpty();
1970        }
1971
1972        /**
1973         * @param value {@link #diagnosis} (The nature of illness or problem in a coded form or as a reference to an external defined Condition.)
1974         */
1975        public DiagnosisComponent setDiagnosis(Type value) { 
1976          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1977            throw new Error("Not the right type for ExplanationOfBenefit.diagnosis.diagnosis[x]: "+value.fhirType());
1978          this.diagnosis = value;
1979          return this;
1980        }
1981
1982        /**
1983         * @return {@link #type} (When the condition was observed or the relative ranking.)
1984         */
1985        public List<CodeableConcept> getType() { 
1986          if (this.type == null)
1987            this.type = new ArrayList<CodeableConcept>();
1988          return this.type;
1989        }
1990
1991        /**
1992         * @return Returns a reference to <code>this</code> for easy method chaining
1993         */
1994        public DiagnosisComponent setType(List<CodeableConcept> theType) { 
1995          this.type = theType;
1996          return this;
1997        }
1998
1999        public boolean hasType() { 
2000          if (this.type == null)
2001            return false;
2002          for (CodeableConcept item : this.type)
2003            if (!item.isEmpty())
2004              return true;
2005          return false;
2006        }
2007
2008        public CodeableConcept addType() { //3
2009          CodeableConcept t = new CodeableConcept();
2010          if (this.type == null)
2011            this.type = new ArrayList<CodeableConcept>();
2012          this.type.add(t);
2013          return t;
2014        }
2015
2016        public DiagnosisComponent addType(CodeableConcept t) { //3
2017          if (t == null)
2018            return this;
2019          if (this.type == null)
2020            this.type = new ArrayList<CodeableConcept>();
2021          this.type.add(t);
2022          return this;
2023        }
2024
2025        /**
2026         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
2027         */
2028        public CodeableConcept getTypeFirstRep() { 
2029          if (getType().isEmpty()) {
2030            addType();
2031          }
2032          return getType().get(0);
2033        }
2034
2035        /**
2036         * @return {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
2037         */
2038        public CodeableConcept getOnAdmission() { 
2039          if (this.onAdmission == null)
2040            if (Configuration.errorOnAutoCreate())
2041              throw new Error("Attempt to auto-create DiagnosisComponent.onAdmission");
2042            else if (Configuration.doAutoCreate())
2043              this.onAdmission = new CodeableConcept(); // cc
2044          return this.onAdmission;
2045        }
2046
2047        public boolean hasOnAdmission() { 
2048          return this.onAdmission != null && !this.onAdmission.isEmpty();
2049        }
2050
2051        /**
2052         * @param value {@link #onAdmission} (Indication of whether the diagnosis was present on admission to a facility.)
2053         */
2054        public DiagnosisComponent setOnAdmission(CodeableConcept value) { 
2055          this.onAdmission = value;
2056          return this;
2057        }
2058
2059        /**
2060         * @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.)
2061         */
2062        public CodeableConcept getPackageCode() { 
2063          if (this.packageCode == null)
2064            if (Configuration.errorOnAutoCreate())
2065              throw new Error("Attempt to auto-create DiagnosisComponent.packageCode");
2066            else if (Configuration.doAutoCreate())
2067              this.packageCode = new CodeableConcept(); // cc
2068          return this.packageCode;
2069        }
2070
2071        public boolean hasPackageCode() { 
2072          return this.packageCode != null && !this.packageCode.isEmpty();
2073        }
2074
2075        /**
2076         * @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.)
2077         */
2078        public DiagnosisComponent setPackageCode(CodeableConcept value) { 
2079          this.packageCode = value;
2080          return this;
2081        }
2082
2083        protected void listChildren(List<Property> children) {
2084          super.listChildren(children);
2085          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence));
2086          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));
2087          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
2088          children.add(new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission));
2089          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));
2090        }
2091
2092        @Override
2093        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2094          switch (_hash) {
2095          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence);
2096          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);
2097          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);
2098          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);
2099          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);
2100          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2101          case -3386134: /*onAdmission*/  return new Property("onAdmission", "CodeableConcept", "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission);
2102          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);
2103          default: return super.getNamedProperty(_hash, _name, _checkValid);
2104          }
2105
2106        }
2107
2108      @Override
2109      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2110        switch (hash) {
2111        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2112        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : new Base[] {this.diagnosis}; // Type
2113        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2114        case -3386134: /*onAdmission*/ return this.onAdmission == null ? new Base[0] : new Base[] {this.onAdmission}; // CodeableConcept
2115        case 908444499: /*packageCode*/ return this.packageCode == null ? new Base[0] : new Base[] {this.packageCode}; // CodeableConcept
2116        default: return super.getProperty(hash, name, checkValid);
2117        }
2118
2119      }
2120
2121      @Override
2122      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2123        switch (hash) {
2124        case 1349547969: // sequence
2125          this.sequence = castToPositiveInt(value); // PositiveIntType
2126          return value;
2127        case 1196993265: // diagnosis
2128          this.diagnosis = castToType(value); // Type
2129          return value;
2130        case 3575610: // type
2131          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
2132          return value;
2133        case -3386134: // onAdmission
2134          this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2135          return value;
2136        case 908444499: // packageCode
2137          this.packageCode = castToCodeableConcept(value); // CodeableConcept
2138          return value;
2139        default: return super.setProperty(hash, name, value);
2140        }
2141
2142      }
2143
2144      @Override
2145      public Base setProperty(String name, Base value) throws FHIRException {
2146        if (name.equals("sequence")) {
2147          this.sequence = castToPositiveInt(value); // PositiveIntType
2148        } else if (name.equals("diagnosis[x]")) {
2149          this.diagnosis = castToType(value); // Type
2150        } else if (name.equals("type")) {
2151          this.getType().add(castToCodeableConcept(value));
2152        } else if (name.equals("onAdmission")) {
2153          this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2154        } else if (name.equals("packageCode")) {
2155          this.packageCode = castToCodeableConcept(value); // CodeableConcept
2156        } else
2157          return super.setProperty(name, value);
2158        return value;
2159      }
2160
2161      @Override
2162      public Base makeProperty(int hash, String name) throws FHIRException {
2163        switch (hash) {
2164        case 1349547969:  return getSequenceElement();
2165        case -1487009809:  return getDiagnosis();
2166        case 1196993265:  return getDiagnosis();
2167        case 3575610:  return addType(); 
2168        case -3386134:  return getOnAdmission();
2169        case 908444499:  return getPackageCode();
2170        default: return super.makeProperty(hash, name);
2171        }
2172
2173      }
2174
2175      @Override
2176      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2177        switch (hash) {
2178        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2179        case 1196993265: /*diagnosis*/ return new String[] {"CodeableConcept", "Reference"};
2180        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2181        case -3386134: /*onAdmission*/ return new String[] {"CodeableConcept"};
2182        case 908444499: /*packageCode*/ return new String[] {"CodeableConcept"};
2183        default: return super.getTypesForProperty(hash, name);
2184        }
2185
2186      }
2187
2188      @Override
2189      public Base addChild(String name) throws FHIRException {
2190        if (name.equals("sequence")) {
2191          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
2192        }
2193        else if (name.equals("diagnosisCodeableConcept")) {
2194          this.diagnosis = new CodeableConcept();
2195          return this.diagnosis;
2196        }
2197        else if (name.equals("diagnosisReference")) {
2198          this.diagnosis = new Reference();
2199          return this.diagnosis;
2200        }
2201        else if (name.equals("type")) {
2202          return addType();
2203        }
2204        else if (name.equals("onAdmission")) {
2205          this.onAdmission = new CodeableConcept();
2206          return this.onAdmission;
2207        }
2208        else if (name.equals("packageCode")) {
2209          this.packageCode = new CodeableConcept();
2210          return this.packageCode;
2211        }
2212        else
2213          return super.addChild(name);
2214      }
2215
2216      public DiagnosisComponent copy() {
2217        DiagnosisComponent dst = new DiagnosisComponent();
2218        copyValues(dst);
2219        return dst;
2220      }
2221
2222      public void copyValues(DiagnosisComponent dst) {
2223        super.copyValues(dst);
2224        dst.sequence = sequence == null ? null : sequence.copy();
2225        dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
2226        if (type != null) {
2227          dst.type = new ArrayList<CodeableConcept>();
2228          for (CodeableConcept i : type)
2229            dst.type.add(i.copy());
2230        };
2231        dst.onAdmission = onAdmission == null ? null : onAdmission.copy();
2232        dst.packageCode = packageCode == null ? null : packageCode.copy();
2233      }
2234
2235      @Override
2236      public boolean equalsDeep(Base other_) {
2237        if (!super.equalsDeep(other_))
2238          return false;
2239        if (!(other_ instanceof DiagnosisComponent))
2240          return false;
2241        DiagnosisComponent o = (DiagnosisComponent) other_;
2242        return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(type, o.type, true)
2243           && compareDeep(onAdmission, o.onAdmission, true) && compareDeep(packageCode, o.packageCode, true)
2244          ;
2245      }
2246
2247      @Override
2248      public boolean equalsShallow(Base other_) {
2249        if (!super.equalsShallow(other_))
2250          return false;
2251        if (!(other_ instanceof DiagnosisComponent))
2252          return false;
2253        DiagnosisComponent o = (DiagnosisComponent) other_;
2254        return compareValues(sequence, o.sequence, true);
2255      }
2256
2257      public boolean isEmpty() {
2258        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type
2259          , onAdmission, packageCode);
2260      }
2261
2262  public String fhirType() {
2263    return "ExplanationOfBenefit.diagnosis";
2264
2265  }
2266
2267  }
2268
2269    @Block()
2270    public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
2271        /**
2272         * A number to uniquely identify procedure entries.
2273         */
2274        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2275        @Description(shortDefinition="Procedure instance identifier", formalDefinition="A number to uniquely identify procedure entries." )
2276        protected PositiveIntType sequence;
2277
2278        /**
2279         * When the condition was observed or the relative ranking.
2280         */
2281        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2282        @Description(shortDefinition="Category of Procedure", formalDefinition="When the condition was observed or the relative ranking." )
2283        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-procedure-type")
2284        protected List<CodeableConcept> type;
2285
2286        /**
2287         * Date and optionally time the procedure was performed.
2288         */
2289        @Child(name = "date", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2290        @Description(shortDefinition="When the procedure was performed", formalDefinition="Date and optionally time the procedure was performed." )
2291        protected DateTimeType date;
2292
2293        /**
2294         * The code or reference to a Procedure resource which identifies the clinical intervention performed.
2295         */
2296        @Child(name = "procedure", type = {CodeableConcept.class, Procedure.class}, order=4, min=1, max=1, modifier=false, summary=false)
2297        @Description(shortDefinition="Specific clinical procedure", formalDefinition="The code or reference to a Procedure resource which identifies the clinical intervention performed." )
2298        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/icd-10-procedures")
2299        protected Type procedure;
2300
2301        /**
2302         * Unique Device Identifiers associated with this line item.
2303         */
2304        @Child(name = "udi", type = {Device.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2305        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
2306        protected List<Reference> udi;
2307
2308        private static final long serialVersionUID = -1550802443L;
2309
2310    /**
2311     * Constructor
2312     */
2313      public ProcedureComponent() {
2314        super();
2315      }
2316
2317    /**
2318     * Constructor
2319     */
2320      public ProcedureComponent(PositiveIntType sequence, Type procedure) {
2321        super();
2322        this.sequence = sequence;
2323        this.procedure = procedure;
2324      }
2325
2326        /**
2327         * @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
2328         */
2329        public PositiveIntType getSequenceElement() { 
2330          if (this.sequence == null)
2331            if (Configuration.errorOnAutoCreate())
2332              throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2333            else if (Configuration.doAutoCreate())
2334              this.sequence = new PositiveIntType(); // bb
2335          return this.sequence;
2336        }
2337
2338        public boolean hasSequenceElement() { 
2339          return this.sequence != null && !this.sequence.isEmpty();
2340        }
2341
2342        public boolean hasSequence() { 
2343          return this.sequence != null && !this.sequence.isEmpty();
2344        }
2345
2346        /**
2347         * @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
2348         */
2349        public ProcedureComponent setSequenceElement(PositiveIntType value) { 
2350          this.sequence = value;
2351          return this;
2352        }
2353
2354        /**
2355         * @return A number to uniquely identify procedure entries.
2356         */
2357        public int getSequence() { 
2358          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2359        }
2360
2361        /**
2362         * @param value A number to uniquely identify procedure entries.
2363         */
2364        public ProcedureComponent setSequence(int value) { 
2365            if (this.sequence == null)
2366              this.sequence = new PositiveIntType();
2367            this.sequence.setValue(value);
2368          return this;
2369        }
2370
2371        /**
2372         * @return {@link #type} (When the condition was observed or the relative ranking.)
2373         */
2374        public List<CodeableConcept> getType() { 
2375          if (this.type == null)
2376            this.type = new ArrayList<CodeableConcept>();
2377          return this.type;
2378        }
2379
2380        /**
2381         * @return Returns a reference to <code>this</code> for easy method chaining
2382         */
2383        public ProcedureComponent setType(List<CodeableConcept> theType) { 
2384          this.type = theType;
2385          return this;
2386        }
2387
2388        public boolean hasType() { 
2389          if (this.type == null)
2390            return false;
2391          for (CodeableConcept item : this.type)
2392            if (!item.isEmpty())
2393              return true;
2394          return false;
2395        }
2396
2397        public CodeableConcept addType() { //3
2398          CodeableConcept t = new CodeableConcept();
2399          if (this.type == null)
2400            this.type = new ArrayList<CodeableConcept>();
2401          this.type.add(t);
2402          return t;
2403        }
2404
2405        public ProcedureComponent addType(CodeableConcept t) { //3
2406          if (t == null)
2407            return this;
2408          if (this.type == null)
2409            this.type = new ArrayList<CodeableConcept>();
2410          this.type.add(t);
2411          return this;
2412        }
2413
2414        /**
2415         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
2416         */
2417        public CodeableConcept getTypeFirstRep() { 
2418          if (getType().isEmpty()) {
2419            addType();
2420          }
2421          return getType().get(0);
2422        }
2423
2424        /**
2425         * @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
2426         */
2427        public DateTimeType getDateElement() { 
2428          if (this.date == null)
2429            if (Configuration.errorOnAutoCreate())
2430              throw new Error("Attempt to auto-create ProcedureComponent.date");
2431            else if (Configuration.doAutoCreate())
2432              this.date = new DateTimeType(); // bb
2433          return this.date;
2434        }
2435
2436        public boolean hasDateElement() { 
2437          return this.date != null && !this.date.isEmpty();
2438        }
2439
2440        public boolean hasDate() { 
2441          return this.date != null && !this.date.isEmpty();
2442        }
2443
2444        /**
2445         * @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
2446         */
2447        public ProcedureComponent setDateElement(DateTimeType value) { 
2448          this.date = value;
2449          return this;
2450        }
2451
2452        /**
2453         * @return Date and optionally time the procedure was performed.
2454         */
2455        public Date getDate() { 
2456          return this.date == null ? null : this.date.getValue();
2457        }
2458
2459        /**
2460         * @param value Date and optionally time the procedure was performed.
2461         */
2462        public ProcedureComponent setDate(Date value) { 
2463          if (value == null)
2464            this.date = null;
2465          else {
2466            if (this.date == null)
2467              this.date = new DateTimeType();
2468            this.date.setValue(value);
2469          }
2470          return this;
2471        }
2472
2473        /**
2474         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2475         */
2476        public Type getProcedure() { 
2477          return this.procedure;
2478        }
2479
2480        /**
2481         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2482         */
2483        public CodeableConcept getProcedureCodeableConcept() throws FHIRException { 
2484          if (this.procedure == null)
2485            this.procedure = new CodeableConcept();
2486          if (!(this.procedure instanceof CodeableConcept))
2487            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.procedure.getClass().getName()+" was encountered");
2488          return (CodeableConcept) this.procedure;
2489        }
2490
2491        public boolean hasProcedureCodeableConcept() { 
2492          return this != null && this.procedure instanceof CodeableConcept;
2493        }
2494
2495        /**
2496         * @return {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2497         */
2498        public Reference getProcedureReference() throws FHIRException { 
2499          if (this.procedure == null)
2500            this.procedure = new Reference();
2501          if (!(this.procedure instanceof Reference))
2502            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.procedure.getClass().getName()+" was encountered");
2503          return (Reference) this.procedure;
2504        }
2505
2506        public boolean hasProcedureReference() { 
2507          return this != null && this.procedure instanceof Reference;
2508        }
2509
2510        public boolean hasProcedure() { 
2511          return this.procedure != null && !this.procedure.isEmpty();
2512        }
2513
2514        /**
2515         * @param value {@link #procedure} (The code or reference to a Procedure resource which identifies the clinical intervention performed.)
2516         */
2517        public ProcedureComponent setProcedure(Type value) { 
2518          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2519            throw new Error("Not the right type for ExplanationOfBenefit.procedure.procedure[x]: "+value.fhirType());
2520          this.procedure = value;
2521          return this;
2522        }
2523
2524        /**
2525         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
2526         */
2527        public List<Reference> getUdi() { 
2528          if (this.udi == null)
2529            this.udi = new ArrayList<Reference>();
2530          return this.udi;
2531        }
2532
2533        /**
2534         * @return Returns a reference to <code>this</code> for easy method chaining
2535         */
2536        public ProcedureComponent setUdi(List<Reference> theUdi) { 
2537          this.udi = theUdi;
2538          return this;
2539        }
2540
2541        public boolean hasUdi() { 
2542          if (this.udi == null)
2543            return false;
2544          for (Reference item : this.udi)
2545            if (!item.isEmpty())
2546              return true;
2547          return false;
2548        }
2549
2550        public Reference addUdi() { //3
2551          Reference t = new Reference();
2552          if (this.udi == null)
2553            this.udi = new ArrayList<Reference>();
2554          this.udi.add(t);
2555          return t;
2556        }
2557
2558        public ProcedureComponent addUdi(Reference t) { //3
2559          if (t == null)
2560            return this;
2561          if (this.udi == null)
2562            this.udi = new ArrayList<Reference>();
2563          this.udi.add(t);
2564          return this;
2565        }
2566
2567        /**
2568         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
2569         */
2570        public Reference getUdiFirstRep() { 
2571          if (getUdi().isEmpty()) {
2572            addUdi();
2573          }
2574          return getUdi().get(0);
2575        }
2576
2577        protected void listChildren(List<Property> children) {
2578          super.listChildren(children);
2579          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence));
2580          children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type));
2581          children.add(new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date));
2582          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));
2583          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
2584        }
2585
2586        @Override
2587        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2588          switch (_hash) {
2589          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence);
2590          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2591          case 3076014: /*date*/  return new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date);
2592          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);
2593          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);
2594          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);
2595          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);
2596          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
2597          default: return super.getNamedProperty(_hash, _name, _checkValid);
2598          }
2599
2600        }
2601
2602      @Override
2603      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2604        switch (hash) {
2605        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
2606        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2607        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2608        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // Type
2609        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
2610        default: return super.getProperty(hash, name, checkValid);
2611        }
2612
2613      }
2614
2615      @Override
2616      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2617        switch (hash) {
2618        case 1349547969: // sequence
2619          this.sequence = castToPositiveInt(value); // PositiveIntType
2620          return value;
2621        case 3575610: // type
2622          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
2623          return value;
2624        case 3076014: // date
2625          this.date = castToDateTime(value); // DateTimeType
2626          return value;
2627        case -1095204141: // procedure
2628          this.procedure = castToType(value); // Type
2629          return value;
2630        case 115642: // udi
2631          this.getUdi().add(castToReference(value)); // Reference
2632          return value;
2633        default: return super.setProperty(hash, name, value);
2634        }
2635
2636      }
2637
2638      @Override
2639      public Base setProperty(String name, Base value) throws FHIRException {
2640        if (name.equals("sequence")) {
2641          this.sequence = castToPositiveInt(value); // PositiveIntType
2642        } else if (name.equals("type")) {
2643          this.getType().add(castToCodeableConcept(value));
2644        } else if (name.equals("date")) {
2645          this.date = castToDateTime(value); // DateTimeType
2646        } else if (name.equals("procedure[x]")) {
2647          this.procedure = castToType(value); // Type
2648        } else if (name.equals("udi")) {
2649          this.getUdi().add(castToReference(value));
2650        } else
2651          return super.setProperty(name, value);
2652        return value;
2653      }
2654
2655      @Override
2656      public Base makeProperty(int hash, String name) throws FHIRException {
2657        switch (hash) {
2658        case 1349547969:  return getSequenceElement();
2659        case 3575610:  return addType(); 
2660        case 3076014:  return getDateElement();
2661        case 1640074445:  return getProcedure();
2662        case -1095204141:  return getProcedure();
2663        case 115642:  return addUdi(); 
2664        default: return super.makeProperty(hash, name);
2665        }
2666
2667      }
2668
2669      @Override
2670      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2671        switch (hash) {
2672        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
2673        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2674        case 3076014: /*date*/ return new String[] {"dateTime"};
2675        case -1095204141: /*procedure*/ return new String[] {"CodeableConcept", "Reference"};
2676        case 115642: /*udi*/ return new String[] {"Reference"};
2677        default: return super.getTypesForProperty(hash, name);
2678        }
2679
2680      }
2681
2682      @Override
2683      public Base addChild(String name) throws FHIRException {
2684        if (name.equals("sequence")) {
2685          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
2686        }
2687        else if (name.equals("type")) {
2688          return addType();
2689        }
2690        else if (name.equals("date")) {
2691          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
2692        }
2693        else if (name.equals("procedureCodeableConcept")) {
2694          this.procedure = new CodeableConcept();
2695          return this.procedure;
2696        }
2697        else if (name.equals("procedureReference")) {
2698          this.procedure = new Reference();
2699          return this.procedure;
2700        }
2701        else if (name.equals("udi")) {
2702          return addUdi();
2703        }
2704        else
2705          return super.addChild(name);
2706      }
2707
2708      public ProcedureComponent copy() {
2709        ProcedureComponent dst = new ProcedureComponent();
2710        copyValues(dst);
2711        return dst;
2712      }
2713
2714      public void copyValues(ProcedureComponent dst) {
2715        super.copyValues(dst);
2716        dst.sequence = sequence == null ? null : sequence.copy();
2717        if (type != null) {
2718          dst.type = new ArrayList<CodeableConcept>();
2719          for (CodeableConcept i : type)
2720            dst.type.add(i.copy());
2721        };
2722        dst.date = date == null ? null : date.copy();
2723        dst.procedure = procedure == null ? null : procedure.copy();
2724        if (udi != null) {
2725          dst.udi = new ArrayList<Reference>();
2726          for (Reference i : udi)
2727            dst.udi.add(i.copy());
2728        };
2729      }
2730
2731      @Override
2732      public boolean equalsDeep(Base other_) {
2733        if (!super.equalsDeep(other_))
2734          return false;
2735        if (!(other_ instanceof ProcedureComponent))
2736          return false;
2737        ProcedureComponent o = (ProcedureComponent) other_;
2738        return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true) && compareDeep(date, o.date, true)
2739           && compareDeep(procedure, o.procedure, true) && compareDeep(udi, o.udi, true);
2740      }
2741
2742      @Override
2743      public boolean equalsShallow(Base other_) {
2744        if (!super.equalsShallow(other_))
2745          return false;
2746        if (!(other_ instanceof ProcedureComponent))
2747          return false;
2748        ProcedureComponent o = (ProcedureComponent) other_;
2749        return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
2750      }
2751
2752      public boolean isEmpty() {
2753        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, date, procedure
2754          , udi);
2755      }
2756
2757  public String fhirType() {
2758    return "ExplanationOfBenefit.procedure";
2759
2760  }
2761
2762  }
2763
2764    @Block()
2765    public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
2766        /**
2767         * A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2768         */
2769        @Child(name = "focal", type = {BooleanType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2770        @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." )
2771        protected BooleanType focal;
2772
2773        /**
2774         * 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.
2775         */
2776        @Child(name = "coverage", type = {Coverage.class}, order=2, min=1, max=1, modifier=false, summary=true)
2777        @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." )
2778        protected Reference coverage;
2779
2780        /**
2781         * 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.
2782         */
2783        @Child(name = "preAuthRef", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2784        @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." )
2785        protected List<StringType> preAuthRef;
2786
2787        private static final long serialVersionUID = 1519900285L;
2788
2789    /**
2790     * Constructor
2791     */
2792      public InsuranceComponent() {
2793        super();
2794      }
2795
2796    /**
2797     * Constructor
2798     */
2799      public InsuranceComponent(BooleanType focal, Reference coverage) {
2800        super();
2801        this.focal = focal;
2802        this.coverage = coverage;
2803      }
2804
2805        /**
2806         * @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
2807         */
2808        public BooleanType getFocalElement() { 
2809          if (this.focal == null)
2810            if (Configuration.errorOnAutoCreate())
2811              throw new Error("Attempt to auto-create InsuranceComponent.focal");
2812            else if (Configuration.doAutoCreate())
2813              this.focal = new BooleanType(); // bb
2814          return this.focal;
2815        }
2816
2817        public boolean hasFocalElement() { 
2818          return this.focal != null && !this.focal.isEmpty();
2819        }
2820
2821        public boolean hasFocal() { 
2822          return this.focal != null && !this.focal.isEmpty();
2823        }
2824
2825        /**
2826         * @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
2827         */
2828        public InsuranceComponent setFocalElement(BooleanType value) { 
2829          this.focal = value;
2830          return this;
2831        }
2832
2833        /**
2834         * @return A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2835         */
2836        public boolean getFocal() { 
2837          return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
2838        }
2839
2840        /**
2841         * @param value A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.
2842         */
2843        public InsuranceComponent setFocal(boolean value) { 
2844            if (this.focal == null)
2845              this.focal = new BooleanType();
2846            this.focal.setValue(value);
2847          return this;
2848        }
2849
2850        /**
2851         * @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.)
2852         */
2853        public Reference getCoverage() { 
2854          if (this.coverage == null)
2855            if (Configuration.errorOnAutoCreate())
2856              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
2857            else if (Configuration.doAutoCreate())
2858              this.coverage = new Reference(); // cc
2859          return this.coverage;
2860        }
2861
2862        public boolean hasCoverage() { 
2863          return this.coverage != null && !this.coverage.isEmpty();
2864        }
2865
2866        /**
2867         * @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.)
2868         */
2869        public InsuranceComponent setCoverage(Reference value) { 
2870          this.coverage = value;
2871          return this;
2872        }
2873
2874        /**
2875         * @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.)
2876         */
2877        public List<StringType> getPreAuthRef() { 
2878          if (this.preAuthRef == null)
2879            this.preAuthRef = new ArrayList<StringType>();
2880          return this.preAuthRef;
2881        }
2882
2883        /**
2884         * @return Returns a reference to <code>this</code> for easy method chaining
2885         */
2886        public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) { 
2887          this.preAuthRef = thePreAuthRef;
2888          return this;
2889        }
2890
2891        public boolean hasPreAuthRef() { 
2892          if (this.preAuthRef == null)
2893            return false;
2894          for (StringType item : this.preAuthRef)
2895            if (!item.isEmpty())
2896              return true;
2897          return false;
2898        }
2899
2900        /**
2901         * @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.)
2902         */
2903        public StringType addPreAuthRefElement() {//2 
2904          StringType t = new StringType();
2905          if (this.preAuthRef == null)
2906            this.preAuthRef = new ArrayList<StringType>();
2907          this.preAuthRef.add(t);
2908          return t;
2909        }
2910
2911        /**
2912         * @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.)
2913         */
2914        public InsuranceComponent addPreAuthRef(String value) { //1
2915          StringType t = new StringType();
2916          t.setValue(value);
2917          if (this.preAuthRef == null)
2918            this.preAuthRef = new ArrayList<StringType>();
2919          this.preAuthRef.add(t);
2920          return this;
2921        }
2922
2923        /**
2924         * @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.)
2925         */
2926        public boolean hasPreAuthRef(String value) { 
2927          if (this.preAuthRef == null)
2928            return false;
2929          for (StringType v : this.preAuthRef)
2930            if (v.getValue().equals(value)) // string
2931              return true;
2932          return false;
2933        }
2934
2935        protected void listChildren(List<Property> children) {
2936          super.listChildren(children);
2937          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));
2938          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));
2939          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));
2940        }
2941
2942        @Override
2943        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2944          switch (_hash) {
2945          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);
2946          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);
2947          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);
2948          default: return super.getNamedProperty(_hash, _name, _checkValid);
2949          }
2950
2951        }
2952
2953      @Override
2954      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2955        switch (hash) {
2956        case 97604197: /*focal*/ return this.focal == null ? new Base[0] : new Base[] {this.focal}; // BooleanType
2957        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
2958        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
2959        default: return super.getProperty(hash, name, checkValid);
2960        }
2961
2962      }
2963
2964      @Override
2965      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2966        switch (hash) {
2967        case 97604197: // focal
2968          this.focal = castToBoolean(value); // BooleanType
2969          return value;
2970        case -351767064: // coverage
2971          this.coverage = castToReference(value); // Reference
2972          return value;
2973        case 522246568: // preAuthRef
2974          this.getPreAuthRef().add(castToString(value)); // StringType
2975          return value;
2976        default: return super.setProperty(hash, name, value);
2977        }
2978
2979      }
2980
2981      @Override
2982      public Base setProperty(String name, Base value) throws FHIRException {
2983        if (name.equals("focal")) {
2984          this.focal = castToBoolean(value); // BooleanType
2985        } else if (name.equals("coverage")) {
2986          this.coverage = castToReference(value); // Reference
2987        } else if (name.equals("preAuthRef")) {
2988          this.getPreAuthRef().add(castToString(value));
2989        } else
2990          return super.setProperty(name, value);
2991        return value;
2992      }
2993
2994      @Override
2995      public Base makeProperty(int hash, String name) throws FHIRException {
2996        switch (hash) {
2997        case 97604197:  return getFocalElement();
2998        case -351767064:  return getCoverage();
2999        case 522246568:  return addPreAuthRefElement();
3000        default: return super.makeProperty(hash, name);
3001        }
3002
3003      }
3004
3005      @Override
3006      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3007        switch (hash) {
3008        case 97604197: /*focal*/ return new String[] {"boolean"};
3009        case -351767064: /*coverage*/ return new String[] {"Reference"};
3010        case 522246568: /*preAuthRef*/ return new String[] {"string"};
3011        default: return super.getTypesForProperty(hash, name);
3012        }
3013
3014      }
3015
3016      @Override
3017      public Base addChild(String name) throws FHIRException {
3018        if (name.equals("focal")) {
3019          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.focal");
3020        }
3021        else if (name.equals("coverage")) {
3022          this.coverage = new Reference();
3023          return this.coverage;
3024        }
3025        else if (name.equals("preAuthRef")) {
3026          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
3027        }
3028        else
3029          return super.addChild(name);
3030      }
3031
3032      public InsuranceComponent copy() {
3033        InsuranceComponent dst = new InsuranceComponent();
3034        copyValues(dst);
3035        return dst;
3036      }
3037
3038      public void copyValues(InsuranceComponent dst) {
3039        super.copyValues(dst);
3040        dst.focal = focal == null ? null : focal.copy();
3041        dst.coverage = coverage == null ? null : coverage.copy();
3042        if (preAuthRef != null) {
3043          dst.preAuthRef = new ArrayList<StringType>();
3044          for (StringType i : preAuthRef)
3045            dst.preAuthRef.add(i.copy());
3046        };
3047      }
3048
3049      @Override
3050      public boolean equalsDeep(Base other_) {
3051        if (!super.equalsDeep(other_))
3052          return false;
3053        if (!(other_ instanceof InsuranceComponent))
3054          return false;
3055        InsuranceComponent o = (InsuranceComponent) other_;
3056        return compareDeep(focal, o.focal, true) && compareDeep(coverage, o.coverage, true) && compareDeep(preAuthRef, o.preAuthRef, true)
3057          ;
3058      }
3059
3060      @Override
3061      public boolean equalsShallow(Base other_) {
3062        if (!super.equalsShallow(other_))
3063          return false;
3064        if (!(other_ instanceof InsuranceComponent))
3065          return false;
3066        InsuranceComponent o = (InsuranceComponent) other_;
3067        return compareValues(focal, o.focal, true) && compareValues(preAuthRef, o.preAuthRef, true);
3068      }
3069
3070      public boolean isEmpty() {
3071        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(focal, coverage, preAuthRef
3072          );
3073      }
3074
3075  public String fhirType() {
3076    return "ExplanationOfBenefit.insurance";
3077
3078  }
3079
3080  }
3081
3082    @Block()
3083    public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
3084        /**
3085         * Date of an accident event  related to the products and services contained in the claim.
3086         */
3087        @Child(name = "date", type = {DateType.class}, order=1, min=0, max=1, modifier=false, summary=false)
3088        @Description(shortDefinition="When the incident occurred", formalDefinition="Date of an accident event  related to the products and services contained in the claim." )
3089        protected DateType date;
3090
3091        /**
3092         * The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.
3093         */
3094        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
3095        @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." )
3096        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActIncidentCode")
3097        protected CodeableConcept type;
3098
3099        /**
3100         * The physical location of the accident event.
3101         */
3102        @Child(name = "location", type = {Address.class, Location.class}, order=3, min=0, max=1, modifier=false, summary=false)
3103        @Description(shortDefinition="Where the event occurred", formalDefinition="The physical location of the accident event." )
3104        protected Type location;
3105
3106        private static final long serialVersionUID = 622904984L;
3107
3108    /**
3109     * Constructor
3110     */
3111      public AccidentComponent() {
3112        super();
3113      }
3114
3115        /**
3116         * @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
3117         */
3118        public DateType getDateElement() { 
3119          if (this.date == null)
3120            if (Configuration.errorOnAutoCreate())
3121              throw new Error("Attempt to auto-create AccidentComponent.date");
3122            else if (Configuration.doAutoCreate())
3123              this.date = new DateType(); // bb
3124          return this.date;
3125        }
3126
3127        public boolean hasDateElement() { 
3128          return this.date != null && !this.date.isEmpty();
3129        }
3130
3131        public boolean hasDate() { 
3132          return this.date != null && !this.date.isEmpty();
3133        }
3134
3135        /**
3136         * @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
3137         */
3138        public AccidentComponent setDateElement(DateType value) { 
3139          this.date = value;
3140          return this;
3141        }
3142
3143        /**
3144         * @return Date of an accident event  related to the products and services contained in the claim.
3145         */
3146        public Date getDate() { 
3147          return this.date == null ? null : this.date.getValue();
3148        }
3149
3150        /**
3151         * @param value Date of an accident event  related to the products and services contained in the claim.
3152         */
3153        public AccidentComponent setDate(Date value) { 
3154          if (value == null)
3155            this.date = null;
3156          else {
3157            if (this.date == null)
3158              this.date = new DateType();
3159            this.date.setValue(value);
3160          }
3161          return this;
3162        }
3163
3164        /**
3165         * @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.)
3166         */
3167        public CodeableConcept getType() { 
3168          if (this.type == null)
3169            if (Configuration.errorOnAutoCreate())
3170              throw new Error("Attempt to auto-create AccidentComponent.type");
3171            else if (Configuration.doAutoCreate())
3172              this.type = new CodeableConcept(); // cc
3173          return this.type;
3174        }
3175
3176        public boolean hasType() { 
3177          return this.type != null && !this.type.isEmpty();
3178        }
3179
3180        /**
3181         * @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.)
3182         */
3183        public AccidentComponent setType(CodeableConcept value) { 
3184          this.type = value;
3185          return this;
3186        }
3187
3188        /**
3189         * @return {@link #location} (The physical location of the accident event.)
3190         */
3191        public Type getLocation() { 
3192          return this.location;
3193        }
3194
3195        /**
3196         * @return {@link #location} (The physical location of the accident event.)
3197         */
3198        public Address getLocationAddress() throws FHIRException { 
3199          if (this.location == null)
3200            this.location = new Address();
3201          if (!(this.location instanceof Address))
3202            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
3203          return (Address) this.location;
3204        }
3205
3206        public boolean hasLocationAddress() { 
3207          return this != null && this.location instanceof Address;
3208        }
3209
3210        /**
3211         * @return {@link #location} (The physical location of the accident event.)
3212         */
3213        public Reference getLocationReference() throws FHIRException { 
3214          if (this.location == null)
3215            this.location = new Reference();
3216          if (!(this.location instanceof Reference))
3217            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
3218          return (Reference) this.location;
3219        }
3220
3221        public boolean hasLocationReference() { 
3222          return this != null && this.location instanceof Reference;
3223        }
3224
3225        public boolean hasLocation() { 
3226          return this.location != null && !this.location.isEmpty();
3227        }
3228
3229        /**
3230         * @param value {@link #location} (The physical location of the accident event.)
3231         */
3232        public AccidentComponent setLocation(Type value) { 
3233          if (value != null && !(value instanceof Address || value instanceof Reference))
3234            throw new Error("Not the right type for ExplanationOfBenefit.accident.location[x]: "+value.fhirType());
3235          this.location = value;
3236          return this;
3237        }
3238
3239        protected void listChildren(List<Property> children) {
3240          super.listChildren(children);
3241          children.add(new Property("date", "date", "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date));
3242          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));
3243          children.add(new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location));
3244        }
3245
3246        @Override
3247        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3248          switch (_hash) {
3249          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);
3250          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);
3251          case 552316075: /*location[x]*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3252          case 1901043637: /*location*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3253          case -1280020865: /*locationAddress*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3254          case 755866390: /*locationReference*/  return new Property("location[x]", "Address|Reference(Location)", "The physical location of the accident event.", 0, 1, location);
3255          default: return super.getNamedProperty(_hash, _name, _checkValid);
3256          }
3257
3258        }
3259
3260      @Override
3261      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3262        switch (hash) {
3263        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
3264        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3265        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
3266        default: return super.getProperty(hash, name, checkValid);
3267        }
3268
3269      }
3270
3271      @Override
3272      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3273        switch (hash) {
3274        case 3076014: // date
3275          this.date = castToDate(value); // DateType
3276          return value;
3277        case 3575610: // type
3278          this.type = castToCodeableConcept(value); // CodeableConcept
3279          return value;
3280        case 1901043637: // location
3281          this.location = castToType(value); // Type
3282          return value;
3283        default: return super.setProperty(hash, name, value);
3284        }
3285
3286      }
3287
3288      @Override
3289      public Base setProperty(String name, Base value) throws FHIRException {
3290        if (name.equals("date")) {
3291          this.date = castToDate(value); // DateType
3292        } else if (name.equals("type")) {
3293          this.type = castToCodeableConcept(value); // CodeableConcept
3294        } else if (name.equals("location[x]")) {
3295          this.location = castToType(value); // Type
3296        } else
3297          return super.setProperty(name, value);
3298        return value;
3299      }
3300
3301      @Override
3302      public Base makeProperty(int hash, String name) throws FHIRException {
3303        switch (hash) {
3304        case 3076014:  return getDateElement();
3305        case 3575610:  return getType();
3306        case 552316075:  return getLocation();
3307        case 1901043637:  return getLocation();
3308        default: return super.makeProperty(hash, name);
3309        }
3310
3311      }
3312
3313      @Override
3314      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3315        switch (hash) {
3316        case 3076014: /*date*/ return new String[] {"date"};
3317        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3318        case 1901043637: /*location*/ return new String[] {"Address", "Reference"};
3319        default: return super.getTypesForProperty(hash, name);
3320        }
3321
3322      }
3323
3324      @Override
3325      public Base addChild(String name) throws FHIRException {
3326        if (name.equals("date")) {
3327          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
3328        }
3329        else if (name.equals("type")) {
3330          this.type = new CodeableConcept();
3331          return this.type;
3332        }
3333        else if (name.equals("locationAddress")) {
3334          this.location = new Address();
3335          return this.location;
3336        }
3337        else if (name.equals("locationReference")) {
3338          this.location = new Reference();
3339          return this.location;
3340        }
3341        else
3342          return super.addChild(name);
3343      }
3344
3345      public AccidentComponent copy() {
3346        AccidentComponent dst = new AccidentComponent();
3347        copyValues(dst);
3348        return dst;
3349      }
3350
3351      public void copyValues(AccidentComponent dst) {
3352        super.copyValues(dst);
3353        dst.date = date == null ? null : date.copy();
3354        dst.type = type == null ? null : type.copy();
3355        dst.location = location == null ? null : location.copy();
3356      }
3357
3358      @Override
3359      public boolean equalsDeep(Base other_) {
3360        if (!super.equalsDeep(other_))
3361          return false;
3362        if (!(other_ instanceof AccidentComponent))
3363          return false;
3364        AccidentComponent o = (AccidentComponent) other_;
3365        return compareDeep(date, o.date, true) && compareDeep(type, o.type, true) && compareDeep(location, o.location, true)
3366          ;
3367      }
3368
3369      @Override
3370      public boolean equalsShallow(Base other_) {
3371        if (!super.equalsShallow(other_))
3372          return false;
3373        if (!(other_ instanceof AccidentComponent))
3374          return false;
3375        AccidentComponent o = (AccidentComponent) other_;
3376        return compareValues(date, o.date, true);
3377      }
3378
3379      public boolean isEmpty() {
3380        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
3381      }
3382
3383  public String fhirType() {
3384    return "ExplanationOfBenefit.accident";
3385
3386  }
3387
3388  }
3389
3390    @Block()
3391    public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
3392        /**
3393         * A number to uniquely identify item entries.
3394         */
3395        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
3396        @Description(shortDefinition="Item instance identifier", formalDefinition="A number to uniquely identify item entries." )
3397        protected PositiveIntType sequence;
3398
3399        /**
3400         * Care team members related to this service or product.
3401         */
3402        @Child(name = "careTeamSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3403        @Description(shortDefinition="Applicable care team members", formalDefinition="Care team members related to this service or product." )
3404        protected List<PositiveIntType> careTeamSequence;
3405
3406        /**
3407         * Diagnoses applicable for this service or product.
3408         */
3409        @Child(name = "diagnosisSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3410        @Description(shortDefinition="Applicable diagnoses", formalDefinition="Diagnoses applicable for this service or product." )
3411        protected List<PositiveIntType> diagnosisSequence;
3412
3413        /**
3414         * Procedures applicable for this service or product.
3415         */
3416        @Child(name = "procedureSequence", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3417        @Description(shortDefinition="Applicable procedures", formalDefinition="Procedures applicable for this service or product." )
3418        protected List<PositiveIntType> procedureSequence;
3419
3420        /**
3421         * Exceptions, special conditions and supporting information applicable for this service or product.
3422         */
3423        @Child(name = "informationSequence", type = {PositiveIntType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3424        @Description(shortDefinition="Applicable exception and supporting information", formalDefinition="Exceptions, special conditions and supporting information applicable for this service or product." )
3425        protected List<PositiveIntType> informationSequence;
3426
3427        /**
3428         * The type of revenue or cost center providing the product and/or service.
3429         */
3430        @Child(name = "revenue", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
3431        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
3432        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
3433        protected CodeableConcept revenue;
3434
3435        /**
3436         * Code to identify the general type of benefits under which products and services are provided.
3437         */
3438        @Child(name = "category", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
3439        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
3440        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
3441        protected CodeableConcept category;
3442
3443        /**
3444         * 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.
3445         */
3446        @Child(name = "productOrService", type = {CodeableConcept.class}, order=8, min=1, max=1, modifier=false, summary=false)
3447        @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." )
3448        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
3449        protected CodeableConcept productOrService;
3450
3451        /**
3452         * Item typification or modifiers codes to convey additional context for the product or service.
3453         */
3454        @Child(name = "modifier", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3455        @Description(shortDefinition="Product or service billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
3456        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
3457        protected List<CodeableConcept> modifier;
3458
3459        /**
3460         * Identifies the program under which this may be recovered.
3461         */
3462        @Child(name = "programCode", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3463        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
3464        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
3465        protected List<CodeableConcept> programCode;
3466
3467        /**
3468         * The date or dates when the service or product was supplied, performed or completed.
3469         */
3470        @Child(name = "serviced", type = {DateType.class, Period.class}, order=11, min=0, max=1, modifier=false, summary=false)
3471        @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." )
3472        protected Type serviced;
3473
3474        /**
3475         * Where the product or service was provided.
3476         */
3477        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
3478        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
3479        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
3480        protected Type location;
3481
3482        /**
3483         * The number of repetitions of a service or product.
3484         */
3485        @Child(name = "quantity", type = {Quantity.class}, order=13, min=0, max=1, modifier=false, summary=false)
3486        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
3487        protected Quantity quantity;
3488
3489        /**
3490         * 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.
3491         */
3492        @Child(name = "unitPrice", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
3493        @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." )
3494        protected Money unitPrice;
3495
3496        /**
3497         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
3498         */
3499        @Child(name = "factor", type = {DecimalType.class}, order=15, min=0, max=1, modifier=false, summary=false)
3500        @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." )
3501        protected DecimalType factor;
3502
3503        /**
3504         * The quantity times the unit price for an additional service or product or charge.
3505         */
3506        @Child(name = "net", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=false)
3507        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
3508        protected Money net;
3509
3510        /**
3511         * Unique Device Identifiers associated with this line item.
3512         */
3513        @Child(name = "udi", type = {Device.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3514        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
3515        protected List<Reference> udi;
3516
3517        /**
3518         * Physical service site on the patient (limb, tooth, etc.).
3519         */
3520        @Child(name = "bodySite", type = {CodeableConcept.class}, order=18, min=0, max=1, modifier=false, summary=false)
3521        @Description(shortDefinition="Anatomical location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
3522        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
3523        protected CodeableConcept bodySite;
3524
3525        /**
3526         * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
3527         */
3528        @Child(name = "subSite", type = {CodeableConcept.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3529        @Description(shortDefinition="Anatomical sub-location", formalDefinition="A region or surface of the bodySite, e.g. limb region or tooth surface(s)." )
3530        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
3531        protected List<CodeableConcept> subSite;
3532
3533        /**
3534         * A billed item may include goods or services provided in multiple encounters.
3535         */
3536        @Child(name = "encounter", type = {Encounter.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3537        @Description(shortDefinition="Encounters related to this billed item", formalDefinition="A billed item may include goods or services provided in multiple encounters." )
3538        protected List<Reference> encounter;
3539
3540        /**
3541         * The numbers associated with notes below which apply to the adjudication of this item.
3542         */
3543        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3544        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
3545        protected List<PositiveIntType> noteNumber;
3546
3547        /**
3548         * 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.
3549         */
3550        @Child(name = "adjudication", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3551        @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." )
3552        protected List<AdjudicationComponent> adjudication;
3553
3554        /**
3555         * Second-tier of goods and services.
3556         */
3557        @Child(name = "detail", type = {}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3558        @Description(shortDefinition="Additional items", formalDefinition="Second-tier of goods and services." )
3559        protected List<DetailComponent> detail;
3560
3561        private static final long serialVersionUID = 2136686267L;
3562
3563    /**
3564     * Constructor
3565     */
3566      public ItemComponent() {
3567        super();
3568      }
3569
3570    /**
3571     * Constructor
3572     */
3573      public ItemComponent(PositiveIntType sequence, CodeableConcept productOrService) {
3574        super();
3575        this.sequence = sequence;
3576        this.productOrService = productOrService;
3577      }
3578
3579        /**
3580         * @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
3581         */
3582        public PositiveIntType getSequenceElement() { 
3583          if (this.sequence == null)
3584            if (Configuration.errorOnAutoCreate())
3585              throw new Error("Attempt to auto-create ItemComponent.sequence");
3586            else if (Configuration.doAutoCreate())
3587              this.sequence = new PositiveIntType(); // bb
3588          return this.sequence;
3589        }
3590
3591        public boolean hasSequenceElement() { 
3592          return this.sequence != null && !this.sequence.isEmpty();
3593        }
3594
3595        public boolean hasSequence() { 
3596          return this.sequence != null && !this.sequence.isEmpty();
3597        }
3598
3599        /**
3600         * @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
3601         */
3602        public ItemComponent setSequenceElement(PositiveIntType value) { 
3603          this.sequence = value;
3604          return this;
3605        }
3606
3607        /**
3608         * @return A number to uniquely identify item entries.
3609         */
3610        public int getSequence() { 
3611          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3612        }
3613
3614        /**
3615         * @param value A number to uniquely identify item entries.
3616         */
3617        public ItemComponent setSequence(int value) { 
3618            if (this.sequence == null)
3619              this.sequence = new PositiveIntType();
3620            this.sequence.setValue(value);
3621          return this;
3622        }
3623
3624        /**
3625         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3626         */
3627        public List<PositiveIntType> getCareTeamSequence() { 
3628          if (this.careTeamSequence == null)
3629            this.careTeamSequence = new ArrayList<PositiveIntType>();
3630          return this.careTeamSequence;
3631        }
3632
3633        /**
3634         * @return Returns a reference to <code>this</code> for easy method chaining
3635         */
3636        public ItemComponent setCareTeamSequence(List<PositiveIntType> theCareTeamSequence) { 
3637          this.careTeamSequence = theCareTeamSequence;
3638          return this;
3639        }
3640
3641        public boolean hasCareTeamSequence() { 
3642          if (this.careTeamSequence == null)
3643            return false;
3644          for (PositiveIntType item : this.careTeamSequence)
3645            if (!item.isEmpty())
3646              return true;
3647          return false;
3648        }
3649
3650        /**
3651         * @return {@link #careTeamSequence} (Care team members related to this service or product.)
3652         */
3653        public PositiveIntType addCareTeamSequenceElement() {//2 
3654          PositiveIntType t = new PositiveIntType();
3655          if (this.careTeamSequence == null)
3656            this.careTeamSequence = new ArrayList<PositiveIntType>();
3657          this.careTeamSequence.add(t);
3658          return t;
3659        }
3660
3661        /**
3662         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3663         */
3664        public ItemComponent addCareTeamSequence(int value) { //1
3665          PositiveIntType t = new PositiveIntType();
3666          t.setValue(value);
3667          if (this.careTeamSequence == null)
3668            this.careTeamSequence = new ArrayList<PositiveIntType>();
3669          this.careTeamSequence.add(t);
3670          return this;
3671        }
3672
3673        /**
3674         * @param value {@link #careTeamSequence} (Care team members related to this service or product.)
3675         */
3676        public boolean hasCareTeamSequence(int value) { 
3677          if (this.careTeamSequence == null)
3678            return false;
3679          for (PositiveIntType v : this.careTeamSequence)
3680            if (v.getValue().equals(value)) // positiveInt
3681              return true;
3682          return false;
3683        }
3684
3685        /**
3686         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3687         */
3688        public List<PositiveIntType> getDiagnosisSequence() { 
3689          if (this.diagnosisSequence == null)
3690            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3691          return this.diagnosisSequence;
3692        }
3693
3694        /**
3695         * @return Returns a reference to <code>this</code> for easy method chaining
3696         */
3697        public ItemComponent setDiagnosisSequence(List<PositiveIntType> theDiagnosisSequence) { 
3698          this.diagnosisSequence = theDiagnosisSequence;
3699          return this;
3700        }
3701
3702        public boolean hasDiagnosisSequence() { 
3703          if (this.diagnosisSequence == null)
3704            return false;
3705          for (PositiveIntType item : this.diagnosisSequence)
3706            if (!item.isEmpty())
3707              return true;
3708          return false;
3709        }
3710
3711        /**
3712         * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3713         */
3714        public PositiveIntType addDiagnosisSequenceElement() {//2 
3715          PositiveIntType t = new PositiveIntType();
3716          if (this.diagnosisSequence == null)
3717            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3718          this.diagnosisSequence.add(t);
3719          return t;
3720        }
3721
3722        /**
3723         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3724         */
3725        public ItemComponent addDiagnosisSequence(int value) { //1
3726          PositiveIntType t = new PositiveIntType();
3727          t.setValue(value);
3728          if (this.diagnosisSequence == null)
3729            this.diagnosisSequence = new ArrayList<PositiveIntType>();
3730          this.diagnosisSequence.add(t);
3731          return this;
3732        }
3733
3734        /**
3735         * @param value {@link #diagnosisSequence} (Diagnoses applicable for this service or product.)
3736         */
3737        public boolean hasDiagnosisSequence(int value) { 
3738          if (this.diagnosisSequence == null)
3739            return false;
3740          for (PositiveIntType v : this.diagnosisSequence)
3741            if (v.getValue().equals(value)) // positiveInt
3742              return true;
3743          return false;
3744        }
3745
3746        /**
3747         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3748         */
3749        public List<PositiveIntType> getProcedureSequence() { 
3750          if (this.procedureSequence == null)
3751            this.procedureSequence = new ArrayList<PositiveIntType>();
3752          return this.procedureSequence;
3753        }
3754
3755        /**
3756         * @return Returns a reference to <code>this</code> for easy method chaining
3757         */
3758        public ItemComponent setProcedureSequence(List<PositiveIntType> theProcedureSequence) { 
3759          this.procedureSequence = theProcedureSequence;
3760          return this;
3761        }
3762
3763        public boolean hasProcedureSequence() { 
3764          if (this.procedureSequence == null)
3765            return false;
3766          for (PositiveIntType item : this.procedureSequence)
3767            if (!item.isEmpty())
3768              return true;
3769          return false;
3770        }
3771
3772        /**
3773         * @return {@link #procedureSequence} (Procedures applicable for this service or product.)
3774         */
3775        public PositiveIntType addProcedureSequenceElement() {//2 
3776          PositiveIntType t = new PositiveIntType();
3777          if (this.procedureSequence == null)
3778            this.procedureSequence = new ArrayList<PositiveIntType>();
3779          this.procedureSequence.add(t);
3780          return t;
3781        }
3782
3783        /**
3784         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3785         */
3786        public ItemComponent addProcedureSequence(int value) { //1
3787          PositiveIntType t = new PositiveIntType();
3788          t.setValue(value);
3789          if (this.procedureSequence == null)
3790            this.procedureSequence = new ArrayList<PositiveIntType>();
3791          this.procedureSequence.add(t);
3792          return this;
3793        }
3794
3795        /**
3796         * @param value {@link #procedureSequence} (Procedures applicable for this service or product.)
3797         */
3798        public boolean hasProcedureSequence(int value) { 
3799          if (this.procedureSequence == null)
3800            return false;
3801          for (PositiveIntType v : this.procedureSequence)
3802            if (v.getValue().equals(value)) // positiveInt
3803              return true;
3804          return false;
3805        }
3806
3807        /**
3808         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3809         */
3810        public List<PositiveIntType> getInformationSequence() { 
3811          if (this.informationSequence == null)
3812            this.informationSequence = new ArrayList<PositiveIntType>();
3813          return this.informationSequence;
3814        }
3815
3816        /**
3817         * @return Returns a reference to <code>this</code> for easy method chaining
3818         */
3819        public ItemComponent setInformationSequence(List<PositiveIntType> theInformationSequence) { 
3820          this.informationSequence = theInformationSequence;
3821          return this;
3822        }
3823
3824        public boolean hasInformationSequence() { 
3825          if (this.informationSequence == null)
3826            return false;
3827          for (PositiveIntType item : this.informationSequence)
3828            if (!item.isEmpty())
3829              return true;
3830          return false;
3831        }
3832
3833        /**
3834         * @return {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3835         */
3836        public PositiveIntType addInformationSequenceElement() {//2 
3837          PositiveIntType t = new PositiveIntType();
3838          if (this.informationSequence == null)
3839            this.informationSequence = new ArrayList<PositiveIntType>();
3840          this.informationSequence.add(t);
3841          return t;
3842        }
3843
3844        /**
3845         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3846         */
3847        public ItemComponent addInformationSequence(int value) { //1
3848          PositiveIntType t = new PositiveIntType();
3849          t.setValue(value);
3850          if (this.informationSequence == null)
3851            this.informationSequence = new ArrayList<PositiveIntType>();
3852          this.informationSequence.add(t);
3853          return this;
3854        }
3855
3856        /**
3857         * @param value {@link #informationSequence} (Exceptions, special conditions and supporting information applicable for this service or product.)
3858         */
3859        public boolean hasInformationSequence(int value) { 
3860          if (this.informationSequence == null)
3861            return false;
3862          for (PositiveIntType v : this.informationSequence)
3863            if (v.getValue().equals(value)) // positiveInt
3864              return true;
3865          return false;
3866        }
3867
3868        /**
3869         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3870         */
3871        public CodeableConcept getRevenue() { 
3872          if (this.revenue == null)
3873            if (Configuration.errorOnAutoCreate())
3874              throw new Error("Attempt to auto-create ItemComponent.revenue");
3875            else if (Configuration.doAutoCreate())
3876              this.revenue = new CodeableConcept(); // cc
3877          return this.revenue;
3878        }
3879
3880        public boolean hasRevenue() { 
3881          return this.revenue != null && !this.revenue.isEmpty();
3882        }
3883
3884        /**
3885         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
3886         */
3887        public ItemComponent setRevenue(CodeableConcept value) { 
3888          this.revenue = value;
3889          return this;
3890        }
3891
3892        /**
3893         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
3894         */
3895        public CodeableConcept getCategory() { 
3896          if (this.category == null)
3897            if (Configuration.errorOnAutoCreate())
3898              throw new Error("Attempt to auto-create ItemComponent.category");
3899            else if (Configuration.doAutoCreate())
3900              this.category = new CodeableConcept(); // cc
3901          return this.category;
3902        }
3903
3904        public boolean hasCategory() { 
3905          return this.category != null && !this.category.isEmpty();
3906        }
3907
3908        /**
3909         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
3910         */
3911        public ItemComponent setCategory(CodeableConcept value) { 
3912          this.category = value;
3913          return this;
3914        }
3915
3916        /**
3917         * @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.)
3918         */
3919        public CodeableConcept getProductOrService() { 
3920          if (this.productOrService == null)
3921            if (Configuration.errorOnAutoCreate())
3922              throw new Error("Attempt to auto-create ItemComponent.productOrService");
3923            else if (Configuration.doAutoCreate())
3924              this.productOrService = new CodeableConcept(); // cc
3925          return this.productOrService;
3926        }
3927
3928        public boolean hasProductOrService() { 
3929          return this.productOrService != null && !this.productOrService.isEmpty();
3930        }
3931
3932        /**
3933         * @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.)
3934         */
3935        public ItemComponent setProductOrService(CodeableConcept value) { 
3936          this.productOrService = value;
3937          return this;
3938        }
3939
3940        /**
3941         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
3942         */
3943        public List<CodeableConcept> getModifier() { 
3944          if (this.modifier == null)
3945            this.modifier = new ArrayList<CodeableConcept>();
3946          return this.modifier;
3947        }
3948
3949        /**
3950         * @return Returns a reference to <code>this</code> for easy method chaining
3951         */
3952        public ItemComponent setModifier(List<CodeableConcept> theModifier) { 
3953          this.modifier = theModifier;
3954          return this;
3955        }
3956
3957        public boolean hasModifier() { 
3958          if (this.modifier == null)
3959            return false;
3960          for (CodeableConcept item : this.modifier)
3961            if (!item.isEmpty())
3962              return true;
3963          return false;
3964        }
3965
3966        public CodeableConcept addModifier() { //3
3967          CodeableConcept t = new CodeableConcept();
3968          if (this.modifier == null)
3969            this.modifier = new ArrayList<CodeableConcept>();
3970          this.modifier.add(t);
3971          return t;
3972        }
3973
3974        public ItemComponent addModifier(CodeableConcept t) { //3
3975          if (t == null)
3976            return this;
3977          if (this.modifier == null)
3978            this.modifier = new ArrayList<CodeableConcept>();
3979          this.modifier.add(t);
3980          return this;
3981        }
3982
3983        /**
3984         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
3985         */
3986        public CodeableConcept getModifierFirstRep() { 
3987          if (getModifier().isEmpty()) {
3988            addModifier();
3989          }
3990          return getModifier().get(0);
3991        }
3992
3993        /**
3994         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
3995         */
3996        public List<CodeableConcept> getProgramCode() { 
3997          if (this.programCode == null)
3998            this.programCode = new ArrayList<CodeableConcept>();
3999          return this.programCode;
4000        }
4001
4002        /**
4003         * @return Returns a reference to <code>this</code> for easy method chaining
4004         */
4005        public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
4006          this.programCode = theProgramCode;
4007          return this;
4008        }
4009
4010        public boolean hasProgramCode() { 
4011          if (this.programCode == null)
4012            return false;
4013          for (CodeableConcept item : this.programCode)
4014            if (!item.isEmpty())
4015              return true;
4016          return false;
4017        }
4018
4019        public CodeableConcept addProgramCode() { //3
4020          CodeableConcept t = new CodeableConcept();
4021          if (this.programCode == null)
4022            this.programCode = new ArrayList<CodeableConcept>();
4023          this.programCode.add(t);
4024          return t;
4025        }
4026
4027        public ItemComponent addProgramCode(CodeableConcept t) { //3
4028          if (t == null)
4029            return this;
4030          if (this.programCode == null)
4031            this.programCode = new ArrayList<CodeableConcept>();
4032          this.programCode.add(t);
4033          return this;
4034        }
4035
4036        /**
4037         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
4038         */
4039        public CodeableConcept getProgramCodeFirstRep() { 
4040          if (getProgramCode().isEmpty()) {
4041            addProgramCode();
4042          }
4043          return getProgramCode().get(0);
4044        }
4045
4046        /**
4047         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4048         */
4049        public Type getServiced() { 
4050          return this.serviced;
4051        }
4052
4053        /**
4054         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4055         */
4056        public DateType getServicedDateType() throws FHIRException { 
4057          if (this.serviced == null)
4058            this.serviced = new DateType();
4059          if (!(this.serviced instanceof DateType))
4060            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
4061          return (DateType) this.serviced;
4062        }
4063
4064        public boolean hasServicedDateType() { 
4065          return this != null && this.serviced instanceof DateType;
4066        }
4067
4068        /**
4069         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4070         */
4071        public Period getServicedPeriod() throws FHIRException { 
4072          if (this.serviced == null)
4073            this.serviced = new Period();
4074          if (!(this.serviced instanceof Period))
4075            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
4076          return (Period) this.serviced;
4077        }
4078
4079        public boolean hasServicedPeriod() { 
4080          return this != null && this.serviced instanceof Period;
4081        }
4082
4083        public boolean hasServiced() { 
4084          return this.serviced != null && !this.serviced.isEmpty();
4085        }
4086
4087        /**
4088         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
4089         */
4090        public ItemComponent setServiced(Type value) { 
4091          if (value != null && !(value instanceof DateType || value instanceof Period))
4092            throw new Error("Not the right type for ExplanationOfBenefit.item.serviced[x]: "+value.fhirType());
4093          this.serviced = value;
4094          return this;
4095        }
4096
4097        /**
4098         * @return {@link #location} (Where the product or service was provided.)
4099         */
4100        public Type getLocation() { 
4101          return this.location;
4102        }
4103
4104        /**
4105         * @return {@link #location} (Where the product or service was provided.)
4106         */
4107        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
4108          if (this.location == null)
4109            this.location = new CodeableConcept();
4110          if (!(this.location instanceof CodeableConcept))
4111            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
4112          return (CodeableConcept) this.location;
4113        }
4114
4115        public boolean hasLocationCodeableConcept() { 
4116          return this != null && this.location instanceof CodeableConcept;
4117        }
4118
4119        /**
4120         * @return {@link #location} (Where the product or service was provided.)
4121         */
4122        public Address getLocationAddress() throws FHIRException { 
4123          if (this.location == null)
4124            this.location = new Address();
4125          if (!(this.location instanceof Address))
4126            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
4127          return (Address) this.location;
4128        }
4129
4130        public boolean hasLocationAddress() { 
4131          return this != null && this.location instanceof Address;
4132        }
4133
4134        /**
4135         * @return {@link #location} (Where the product or service was provided.)
4136         */
4137        public Reference getLocationReference() throws FHIRException { 
4138          if (this.location == null)
4139            this.location = new Reference();
4140          if (!(this.location instanceof Reference))
4141            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
4142          return (Reference) this.location;
4143        }
4144
4145        public boolean hasLocationReference() { 
4146          return this != null && this.location instanceof Reference;
4147        }
4148
4149        public boolean hasLocation() { 
4150          return this.location != null && !this.location.isEmpty();
4151        }
4152
4153        /**
4154         * @param value {@link #location} (Where the product or service was provided.)
4155         */
4156        public ItemComponent setLocation(Type value) { 
4157          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
4158            throw new Error("Not the right type for ExplanationOfBenefit.item.location[x]: "+value.fhirType());
4159          this.location = value;
4160          return this;
4161        }
4162
4163        /**
4164         * @return {@link #quantity} (The number of repetitions of a service or product.)
4165         */
4166        public Quantity getQuantity() { 
4167          if (this.quantity == null)
4168            if (Configuration.errorOnAutoCreate())
4169              throw new Error("Attempt to auto-create ItemComponent.quantity");
4170            else if (Configuration.doAutoCreate())
4171              this.quantity = new Quantity(); // cc
4172          return this.quantity;
4173        }
4174
4175        public boolean hasQuantity() { 
4176          return this.quantity != null && !this.quantity.isEmpty();
4177        }
4178
4179        /**
4180         * @param value {@link #quantity} (The number of repetitions of a service or product.)
4181         */
4182        public ItemComponent setQuantity(Quantity value) { 
4183          this.quantity = value;
4184          return this;
4185        }
4186
4187        /**
4188         * @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.)
4189         */
4190        public Money getUnitPrice() { 
4191          if (this.unitPrice == null)
4192            if (Configuration.errorOnAutoCreate())
4193              throw new Error("Attempt to auto-create ItemComponent.unitPrice");
4194            else if (Configuration.doAutoCreate())
4195              this.unitPrice = new Money(); // cc
4196          return this.unitPrice;
4197        }
4198
4199        public boolean hasUnitPrice() { 
4200          return this.unitPrice != null && !this.unitPrice.isEmpty();
4201        }
4202
4203        /**
4204         * @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.)
4205         */
4206        public ItemComponent setUnitPrice(Money value) { 
4207          this.unitPrice = value;
4208          return this;
4209        }
4210
4211        /**
4212         * @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
4213         */
4214        public DecimalType getFactorElement() { 
4215          if (this.factor == null)
4216            if (Configuration.errorOnAutoCreate())
4217              throw new Error("Attempt to auto-create ItemComponent.factor");
4218            else if (Configuration.doAutoCreate())
4219              this.factor = new DecimalType(); // bb
4220          return this.factor;
4221        }
4222
4223        public boolean hasFactorElement() { 
4224          return this.factor != null && !this.factor.isEmpty();
4225        }
4226
4227        public boolean hasFactor() { 
4228          return this.factor != null && !this.factor.isEmpty();
4229        }
4230
4231        /**
4232         * @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
4233         */
4234        public ItemComponent setFactorElement(DecimalType value) { 
4235          this.factor = value;
4236          return this;
4237        }
4238
4239        /**
4240         * @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.
4241         */
4242        public BigDecimal getFactor() { 
4243          return this.factor == null ? null : this.factor.getValue();
4244        }
4245
4246        /**
4247         * @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.
4248         */
4249        public ItemComponent setFactor(BigDecimal value) { 
4250          if (value == null)
4251            this.factor = null;
4252          else {
4253            if (this.factor == null)
4254              this.factor = new DecimalType();
4255            this.factor.setValue(value);
4256          }
4257          return this;
4258        }
4259
4260        /**
4261         * @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.
4262         */
4263        public ItemComponent setFactor(long value) { 
4264              this.factor = new DecimalType();
4265            this.factor.setValue(value);
4266          return this;
4267        }
4268
4269        /**
4270         * @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.
4271         */
4272        public ItemComponent setFactor(double value) { 
4273              this.factor = new DecimalType();
4274            this.factor.setValue(value);
4275          return this;
4276        }
4277
4278        /**
4279         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4280         */
4281        public Money getNet() { 
4282          if (this.net == null)
4283            if (Configuration.errorOnAutoCreate())
4284              throw new Error("Attempt to auto-create ItemComponent.net");
4285            else if (Configuration.doAutoCreate())
4286              this.net = new Money(); // cc
4287          return this.net;
4288        }
4289
4290        public boolean hasNet() { 
4291          return this.net != null && !this.net.isEmpty();
4292        }
4293
4294        /**
4295         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
4296         */
4297        public ItemComponent setNet(Money value) { 
4298          this.net = value;
4299          return this;
4300        }
4301
4302        /**
4303         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
4304         */
4305        public List<Reference> getUdi() { 
4306          if (this.udi == null)
4307            this.udi = new ArrayList<Reference>();
4308          return this.udi;
4309        }
4310
4311        /**
4312         * @return Returns a reference to <code>this</code> for easy method chaining
4313         */
4314        public ItemComponent setUdi(List<Reference> theUdi) { 
4315          this.udi = theUdi;
4316          return this;
4317        }
4318
4319        public boolean hasUdi() { 
4320          if (this.udi == null)
4321            return false;
4322          for (Reference item : this.udi)
4323            if (!item.isEmpty())
4324              return true;
4325          return false;
4326        }
4327
4328        public Reference addUdi() { //3
4329          Reference t = new Reference();
4330          if (this.udi == null)
4331            this.udi = new ArrayList<Reference>();
4332          this.udi.add(t);
4333          return t;
4334        }
4335
4336        public ItemComponent addUdi(Reference t) { //3
4337          if (t == null)
4338            return this;
4339          if (this.udi == null)
4340            this.udi = new ArrayList<Reference>();
4341          this.udi.add(t);
4342          return this;
4343        }
4344
4345        /**
4346         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
4347         */
4348        public Reference getUdiFirstRep() { 
4349          if (getUdi().isEmpty()) {
4350            addUdi();
4351          }
4352          return getUdi().get(0);
4353        }
4354
4355        /**
4356         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4357         */
4358        public CodeableConcept getBodySite() { 
4359          if (this.bodySite == null)
4360            if (Configuration.errorOnAutoCreate())
4361              throw new Error("Attempt to auto-create ItemComponent.bodySite");
4362            else if (Configuration.doAutoCreate())
4363              this.bodySite = new CodeableConcept(); // cc
4364          return this.bodySite;
4365        }
4366
4367        public boolean hasBodySite() { 
4368          return this.bodySite != null && !this.bodySite.isEmpty();
4369        }
4370
4371        /**
4372         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
4373         */
4374        public ItemComponent setBodySite(CodeableConcept value) { 
4375          this.bodySite = value;
4376          return this;
4377        }
4378
4379        /**
4380         * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb region or tooth surface(s).)
4381         */
4382        public List<CodeableConcept> getSubSite() { 
4383          if (this.subSite == null)
4384            this.subSite = new ArrayList<CodeableConcept>();
4385          return this.subSite;
4386        }
4387
4388        /**
4389         * @return Returns a reference to <code>this</code> for easy method chaining
4390         */
4391        public ItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
4392          this.subSite = theSubSite;
4393          return this;
4394        }
4395
4396        public boolean hasSubSite() { 
4397          if (this.subSite == null)
4398            return false;
4399          for (CodeableConcept item : this.subSite)
4400            if (!item.isEmpty())
4401              return true;
4402          return false;
4403        }
4404
4405        public CodeableConcept addSubSite() { //3
4406          CodeableConcept t = new CodeableConcept();
4407          if (this.subSite == null)
4408            this.subSite = new ArrayList<CodeableConcept>();
4409          this.subSite.add(t);
4410          return t;
4411        }
4412
4413        public ItemComponent addSubSite(CodeableConcept t) { //3
4414          if (t == null)
4415            return this;
4416          if (this.subSite == null)
4417            this.subSite = new ArrayList<CodeableConcept>();
4418          this.subSite.add(t);
4419          return this;
4420        }
4421
4422        /**
4423         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist
4424         */
4425        public CodeableConcept getSubSiteFirstRep() { 
4426          if (getSubSite().isEmpty()) {
4427            addSubSite();
4428          }
4429          return getSubSite().get(0);
4430        }
4431
4432        /**
4433         * @return {@link #encounter} (A billed item may include goods or services provided in multiple encounters.)
4434         */
4435        public List<Reference> getEncounter() { 
4436          if (this.encounter == null)
4437            this.encounter = new ArrayList<Reference>();
4438          return this.encounter;
4439        }
4440
4441        /**
4442         * @return Returns a reference to <code>this</code> for easy method chaining
4443         */
4444        public ItemComponent setEncounter(List<Reference> theEncounter) { 
4445          this.encounter = theEncounter;
4446          return this;
4447        }
4448
4449        public boolean hasEncounter() { 
4450          if (this.encounter == null)
4451            return false;
4452          for (Reference item : this.encounter)
4453            if (!item.isEmpty())
4454              return true;
4455          return false;
4456        }
4457
4458        public Reference addEncounter() { //3
4459          Reference t = new Reference();
4460          if (this.encounter == null)
4461            this.encounter = new ArrayList<Reference>();
4462          this.encounter.add(t);
4463          return t;
4464        }
4465
4466        public ItemComponent addEncounter(Reference t) { //3
4467          if (t == null)
4468            return this;
4469          if (this.encounter == null)
4470            this.encounter = new ArrayList<Reference>();
4471          this.encounter.add(t);
4472          return this;
4473        }
4474
4475        /**
4476         * @return The first repetition of repeating field {@link #encounter}, creating it if it does not already exist
4477         */
4478        public Reference getEncounterFirstRep() { 
4479          if (getEncounter().isEmpty()) {
4480            addEncounter();
4481          }
4482          return getEncounter().get(0);
4483        }
4484
4485        /**
4486         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4487         */
4488        public List<PositiveIntType> getNoteNumber() { 
4489          if (this.noteNumber == null)
4490            this.noteNumber = new ArrayList<PositiveIntType>();
4491          return this.noteNumber;
4492        }
4493
4494        /**
4495         * @return Returns a reference to <code>this</code> for easy method chaining
4496         */
4497        public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
4498          this.noteNumber = theNoteNumber;
4499          return this;
4500        }
4501
4502        public boolean hasNoteNumber() { 
4503          if (this.noteNumber == null)
4504            return false;
4505          for (PositiveIntType item : this.noteNumber)
4506            if (!item.isEmpty())
4507              return true;
4508          return false;
4509        }
4510
4511        /**
4512         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4513         */
4514        public PositiveIntType addNoteNumberElement() {//2 
4515          PositiveIntType t = new PositiveIntType();
4516          if (this.noteNumber == null)
4517            this.noteNumber = new ArrayList<PositiveIntType>();
4518          this.noteNumber.add(t);
4519          return t;
4520        }
4521
4522        /**
4523         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4524         */
4525        public ItemComponent addNoteNumber(int value) { //1
4526          PositiveIntType t = new PositiveIntType();
4527          t.setValue(value);
4528          if (this.noteNumber == null)
4529            this.noteNumber = new ArrayList<PositiveIntType>();
4530          this.noteNumber.add(t);
4531          return this;
4532        }
4533
4534        /**
4535         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
4536         */
4537        public boolean hasNoteNumber(int value) { 
4538          if (this.noteNumber == null)
4539            return false;
4540          for (PositiveIntType v : this.noteNumber)
4541            if (v.getValue().equals(value)) // positiveInt
4542              return true;
4543          return false;
4544        }
4545
4546        /**
4547         * @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.)
4548         */
4549        public List<AdjudicationComponent> getAdjudication() { 
4550          if (this.adjudication == null)
4551            this.adjudication = new ArrayList<AdjudicationComponent>();
4552          return this.adjudication;
4553        }
4554
4555        /**
4556         * @return Returns a reference to <code>this</code> for easy method chaining
4557         */
4558        public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
4559          this.adjudication = theAdjudication;
4560          return this;
4561        }
4562
4563        public boolean hasAdjudication() { 
4564          if (this.adjudication == null)
4565            return false;
4566          for (AdjudicationComponent item : this.adjudication)
4567            if (!item.isEmpty())
4568              return true;
4569          return false;
4570        }
4571
4572        public AdjudicationComponent addAdjudication() { //3
4573          AdjudicationComponent t = new AdjudicationComponent();
4574          if (this.adjudication == null)
4575            this.adjudication = new ArrayList<AdjudicationComponent>();
4576          this.adjudication.add(t);
4577          return t;
4578        }
4579
4580        public ItemComponent addAdjudication(AdjudicationComponent t) { //3
4581          if (t == null)
4582            return this;
4583          if (this.adjudication == null)
4584            this.adjudication = new ArrayList<AdjudicationComponent>();
4585          this.adjudication.add(t);
4586          return this;
4587        }
4588
4589        /**
4590         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
4591         */
4592        public AdjudicationComponent getAdjudicationFirstRep() { 
4593          if (getAdjudication().isEmpty()) {
4594            addAdjudication();
4595          }
4596          return getAdjudication().get(0);
4597        }
4598
4599        /**
4600         * @return {@link #detail} (Second-tier of goods and services.)
4601         */
4602        public List<DetailComponent> getDetail() { 
4603          if (this.detail == null)
4604            this.detail = new ArrayList<DetailComponent>();
4605          return this.detail;
4606        }
4607
4608        /**
4609         * @return Returns a reference to <code>this</code> for easy method chaining
4610         */
4611        public ItemComponent setDetail(List<DetailComponent> theDetail) { 
4612          this.detail = theDetail;
4613          return this;
4614        }
4615
4616        public boolean hasDetail() { 
4617          if (this.detail == null)
4618            return false;
4619          for (DetailComponent item : this.detail)
4620            if (!item.isEmpty())
4621              return true;
4622          return false;
4623        }
4624
4625        public DetailComponent addDetail() { //3
4626          DetailComponent t = new DetailComponent();
4627          if (this.detail == null)
4628            this.detail = new ArrayList<DetailComponent>();
4629          this.detail.add(t);
4630          return t;
4631        }
4632
4633        public ItemComponent addDetail(DetailComponent t) { //3
4634          if (t == null)
4635            return this;
4636          if (this.detail == null)
4637            this.detail = new ArrayList<DetailComponent>();
4638          this.detail.add(t);
4639          return this;
4640        }
4641
4642        /**
4643         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
4644         */
4645        public DetailComponent getDetailFirstRep() { 
4646          if (getDetail().isEmpty()) {
4647            addDetail();
4648          }
4649          return getDetail().get(0);
4650        }
4651
4652        protected void listChildren(List<Property> children) {
4653          super.listChildren(children);
4654          children.add(new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence));
4655          children.add(new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence));
4656          children.add(new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence));
4657          children.add(new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence));
4658          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));
4659          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
4660          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
4661          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));
4662          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));
4663          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
4664          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));
4665          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location));
4666          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
4667          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));
4668          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));
4669          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
4670          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
4671          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
4672          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));
4673          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));
4674          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));
4675          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));
4676          children.add(new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
4677        }
4678
4679        @Override
4680        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4681          switch (_hash) {
4682          case 1349547969: /*sequence*/  return new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence);
4683          case 1070083823: /*careTeamSequence*/  return new Property("careTeamSequence", "positiveInt", "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence);
4684          case -909769262: /*diagnosisSequence*/  return new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence);
4685          case -808920140: /*procedureSequence*/  return new Property("procedureSequence", "positiveInt", "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence);
4686          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);
4687          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
4688          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);
4689          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);
4690          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);
4691          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
4692          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);
4693          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);
4694          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);
4695          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);
4696          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4697          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4698          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4699          case -1280020865: /*locationAddress*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4700          case 755866390: /*locationReference*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
4701          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
4702          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);
4703          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);
4704          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);
4705          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
4706          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
4707          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);
4708          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);
4709          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);
4710          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);
4711          case -1335224239: /*detail*/  return new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail);
4712          default: return super.getNamedProperty(_hash, _name, _checkValid);
4713          }
4714
4715        }
4716
4717      @Override
4718      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4719        switch (hash) {
4720        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
4721        case 1070083823: /*careTeamSequence*/ return this.careTeamSequence == null ? new Base[0] : this.careTeamSequence.toArray(new Base[this.careTeamSequence.size()]); // PositiveIntType
4722        case -909769262: /*diagnosisSequence*/ return this.diagnosisSequence == null ? new Base[0] : this.diagnosisSequence.toArray(new Base[this.diagnosisSequence.size()]); // PositiveIntType
4723        case -808920140: /*procedureSequence*/ return this.procedureSequence == null ? new Base[0] : this.procedureSequence.toArray(new Base[this.procedureSequence.size()]); // PositiveIntType
4724        case -702585587: /*informationSequence*/ return this.informationSequence == null ? new Base[0] : this.informationSequence.toArray(new Base[this.informationSequence.size()]); // PositiveIntType
4725        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
4726        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
4727        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
4728        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
4729        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
4730        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
4731        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
4732        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
4733        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
4734        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
4735        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
4736        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
4737        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
4738        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
4739        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
4740        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
4741        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
4742        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
4743        default: return super.getProperty(hash, name, checkValid);
4744        }
4745
4746      }
4747
4748      @Override
4749      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4750        switch (hash) {
4751        case 1349547969: // sequence
4752          this.sequence = castToPositiveInt(value); // PositiveIntType
4753          return value;
4754        case 1070083823: // careTeamSequence
4755          this.getCareTeamSequence().add(castToPositiveInt(value)); // PositiveIntType
4756          return value;
4757        case -909769262: // diagnosisSequence
4758          this.getDiagnosisSequence().add(castToPositiveInt(value)); // PositiveIntType
4759          return value;
4760        case -808920140: // procedureSequence
4761          this.getProcedureSequence().add(castToPositiveInt(value)); // PositiveIntType
4762          return value;
4763        case -702585587: // informationSequence
4764          this.getInformationSequence().add(castToPositiveInt(value)); // PositiveIntType
4765          return value;
4766        case 1099842588: // revenue
4767          this.revenue = castToCodeableConcept(value); // CodeableConcept
4768          return value;
4769        case 50511102: // category
4770          this.category = castToCodeableConcept(value); // CodeableConcept
4771          return value;
4772        case 1957227299: // productOrService
4773          this.productOrService = castToCodeableConcept(value); // CodeableConcept
4774          return value;
4775        case -615513385: // modifier
4776          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
4777          return value;
4778        case 1010065041: // programCode
4779          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
4780          return value;
4781        case 1379209295: // serviced
4782          this.serviced = castToType(value); // Type
4783          return value;
4784        case 1901043637: // location
4785          this.location = castToType(value); // Type
4786          return value;
4787        case -1285004149: // quantity
4788          this.quantity = castToQuantity(value); // Quantity
4789          return value;
4790        case -486196699: // unitPrice
4791          this.unitPrice = castToMoney(value); // Money
4792          return value;
4793        case -1282148017: // factor
4794          this.factor = castToDecimal(value); // DecimalType
4795          return value;
4796        case 108957: // net
4797          this.net = castToMoney(value); // Money
4798          return value;
4799        case 115642: // udi
4800          this.getUdi().add(castToReference(value)); // Reference
4801          return value;
4802        case 1702620169: // bodySite
4803          this.bodySite = castToCodeableConcept(value); // CodeableConcept
4804          return value;
4805        case -1868566105: // subSite
4806          this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
4807          return value;
4808        case 1524132147: // encounter
4809          this.getEncounter().add(castToReference(value)); // Reference
4810          return value;
4811        case -1110033957: // noteNumber
4812          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
4813          return value;
4814        case -231349275: // adjudication
4815          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
4816          return value;
4817        case -1335224239: // detail
4818          this.getDetail().add((DetailComponent) value); // DetailComponent
4819          return value;
4820        default: return super.setProperty(hash, name, value);
4821        }
4822
4823      }
4824
4825      @Override
4826      public Base setProperty(String name, Base value) throws FHIRException {
4827        if (name.equals("sequence")) {
4828          this.sequence = castToPositiveInt(value); // PositiveIntType
4829        } else if (name.equals("careTeamSequence")) {
4830          this.getCareTeamSequence().add(castToPositiveInt(value));
4831        } else if (name.equals("diagnosisSequence")) {
4832          this.getDiagnosisSequence().add(castToPositiveInt(value));
4833        } else if (name.equals("procedureSequence")) {
4834          this.getProcedureSequence().add(castToPositiveInt(value));
4835        } else if (name.equals("informationSequence")) {
4836          this.getInformationSequence().add(castToPositiveInt(value));
4837        } else if (name.equals("revenue")) {
4838          this.revenue = castToCodeableConcept(value); // CodeableConcept
4839        } else if (name.equals("category")) {
4840          this.category = castToCodeableConcept(value); // CodeableConcept
4841        } else if (name.equals("productOrService")) {
4842          this.productOrService = castToCodeableConcept(value); // CodeableConcept
4843        } else if (name.equals("modifier")) {
4844          this.getModifier().add(castToCodeableConcept(value));
4845        } else if (name.equals("programCode")) {
4846          this.getProgramCode().add(castToCodeableConcept(value));
4847        } else if (name.equals("serviced[x]")) {
4848          this.serviced = castToType(value); // Type
4849        } else if (name.equals("location[x]")) {
4850          this.location = castToType(value); // Type
4851        } else if (name.equals("quantity")) {
4852          this.quantity = castToQuantity(value); // Quantity
4853        } else if (name.equals("unitPrice")) {
4854          this.unitPrice = castToMoney(value); // Money
4855        } else if (name.equals("factor")) {
4856          this.factor = castToDecimal(value); // DecimalType
4857        } else if (name.equals("net")) {
4858          this.net = castToMoney(value); // Money
4859        } else if (name.equals("udi")) {
4860          this.getUdi().add(castToReference(value));
4861        } else if (name.equals("bodySite")) {
4862          this.bodySite = castToCodeableConcept(value); // CodeableConcept
4863        } else if (name.equals("subSite")) {
4864          this.getSubSite().add(castToCodeableConcept(value));
4865        } else if (name.equals("encounter")) {
4866          this.getEncounter().add(castToReference(value));
4867        } else if (name.equals("noteNumber")) {
4868          this.getNoteNumber().add(castToPositiveInt(value));
4869        } else if (name.equals("adjudication")) {
4870          this.getAdjudication().add((AdjudicationComponent) value);
4871        } else if (name.equals("detail")) {
4872          this.getDetail().add((DetailComponent) value);
4873        } else
4874          return super.setProperty(name, value);
4875        return value;
4876      }
4877
4878      @Override
4879      public Base makeProperty(int hash, String name) throws FHIRException {
4880        switch (hash) {
4881        case 1349547969:  return getSequenceElement();
4882        case 1070083823:  return addCareTeamSequenceElement();
4883        case -909769262:  return addDiagnosisSequenceElement();
4884        case -808920140:  return addProcedureSequenceElement();
4885        case -702585587:  return addInformationSequenceElement();
4886        case 1099842588:  return getRevenue();
4887        case 50511102:  return getCategory();
4888        case 1957227299:  return getProductOrService();
4889        case -615513385:  return addModifier(); 
4890        case 1010065041:  return addProgramCode(); 
4891        case -1927922223:  return getServiced();
4892        case 1379209295:  return getServiced();
4893        case 552316075:  return getLocation();
4894        case 1901043637:  return getLocation();
4895        case -1285004149:  return getQuantity();
4896        case -486196699:  return getUnitPrice();
4897        case -1282148017:  return getFactorElement();
4898        case 108957:  return getNet();
4899        case 115642:  return addUdi(); 
4900        case 1702620169:  return getBodySite();
4901        case -1868566105:  return addSubSite(); 
4902        case 1524132147:  return addEncounter(); 
4903        case -1110033957:  return addNoteNumberElement();
4904        case -231349275:  return addAdjudication(); 
4905        case -1335224239:  return addDetail(); 
4906        default: return super.makeProperty(hash, name);
4907        }
4908
4909      }
4910
4911      @Override
4912      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4913        switch (hash) {
4914        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
4915        case 1070083823: /*careTeamSequence*/ return new String[] {"positiveInt"};
4916        case -909769262: /*diagnosisSequence*/ return new String[] {"positiveInt"};
4917        case -808920140: /*procedureSequence*/ return new String[] {"positiveInt"};
4918        case -702585587: /*informationSequence*/ return new String[] {"positiveInt"};
4919        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
4920        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
4921        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
4922        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
4923        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
4924        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
4925        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
4926        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
4927        case -486196699: /*unitPrice*/ return new String[] {"Money"};
4928        case -1282148017: /*factor*/ return new String[] {"decimal"};
4929        case 108957: /*net*/ return new String[] {"Money"};
4930        case 115642: /*udi*/ return new String[] {"Reference"};
4931        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
4932        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
4933        case 1524132147: /*encounter*/ return new String[] {"Reference"};
4934        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
4935        case -231349275: /*adjudication*/ return new String[] {};
4936        case -1335224239: /*detail*/ return new String[] {};
4937        default: return super.getTypesForProperty(hash, name);
4938        }
4939
4940      }
4941
4942      @Override
4943      public Base addChild(String name) throws FHIRException {
4944        if (name.equals("sequence")) {
4945          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
4946        }
4947        else if (name.equals("careTeamSequence")) {
4948          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.careTeamSequence");
4949        }
4950        else if (name.equals("diagnosisSequence")) {
4951          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.diagnosisSequence");
4952        }
4953        else if (name.equals("procedureSequence")) {
4954          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.procedureSequence");
4955        }
4956        else if (name.equals("informationSequence")) {
4957          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.informationSequence");
4958        }
4959        else if (name.equals("revenue")) {
4960          this.revenue = new CodeableConcept();
4961          return this.revenue;
4962        }
4963        else if (name.equals("category")) {
4964          this.category = new CodeableConcept();
4965          return this.category;
4966        }
4967        else if (name.equals("productOrService")) {
4968          this.productOrService = new CodeableConcept();
4969          return this.productOrService;
4970        }
4971        else if (name.equals("modifier")) {
4972          return addModifier();
4973        }
4974        else if (name.equals("programCode")) {
4975          return addProgramCode();
4976        }
4977        else if (name.equals("servicedDate")) {
4978          this.serviced = new DateType();
4979          return this.serviced;
4980        }
4981        else if (name.equals("servicedPeriod")) {
4982          this.serviced = new Period();
4983          return this.serviced;
4984        }
4985        else if (name.equals("locationCodeableConcept")) {
4986          this.location = new CodeableConcept();
4987          return this.location;
4988        }
4989        else if (name.equals("locationAddress")) {
4990          this.location = new Address();
4991          return this.location;
4992        }
4993        else if (name.equals("locationReference")) {
4994          this.location = new Reference();
4995          return this.location;
4996        }
4997        else if (name.equals("quantity")) {
4998          this.quantity = new Quantity();
4999          return this.quantity;
5000        }
5001        else if (name.equals("unitPrice")) {
5002          this.unitPrice = new Money();
5003          return this.unitPrice;
5004        }
5005        else if (name.equals("factor")) {
5006          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
5007        }
5008        else if (name.equals("net")) {
5009          this.net = new Money();
5010          return this.net;
5011        }
5012        else if (name.equals("udi")) {
5013          return addUdi();
5014        }
5015        else if (name.equals("bodySite")) {
5016          this.bodySite = new CodeableConcept();
5017          return this.bodySite;
5018        }
5019        else if (name.equals("subSite")) {
5020          return addSubSite();
5021        }
5022        else if (name.equals("encounter")) {
5023          return addEncounter();
5024        }
5025        else if (name.equals("noteNumber")) {
5026          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
5027        }
5028        else if (name.equals("adjudication")) {
5029          return addAdjudication();
5030        }
5031        else if (name.equals("detail")) {
5032          return addDetail();
5033        }
5034        else
5035          return super.addChild(name);
5036      }
5037
5038      public ItemComponent copy() {
5039        ItemComponent dst = new ItemComponent();
5040        copyValues(dst);
5041        return dst;
5042      }
5043
5044      public void copyValues(ItemComponent dst) {
5045        super.copyValues(dst);
5046        dst.sequence = sequence == null ? null : sequence.copy();
5047        if (careTeamSequence != null) {
5048          dst.careTeamSequence = new ArrayList<PositiveIntType>();
5049          for (PositiveIntType i : careTeamSequence)
5050            dst.careTeamSequence.add(i.copy());
5051        };
5052        if (diagnosisSequence != null) {
5053          dst.diagnosisSequence = new ArrayList<PositiveIntType>();
5054          for (PositiveIntType i : diagnosisSequence)
5055            dst.diagnosisSequence.add(i.copy());
5056        };
5057        if (procedureSequence != null) {
5058          dst.procedureSequence = new ArrayList<PositiveIntType>();
5059          for (PositiveIntType i : procedureSequence)
5060            dst.procedureSequence.add(i.copy());
5061        };
5062        if (informationSequence != null) {
5063          dst.informationSequence = new ArrayList<PositiveIntType>();
5064          for (PositiveIntType i : informationSequence)
5065            dst.informationSequence.add(i.copy());
5066        };
5067        dst.revenue = revenue == null ? null : revenue.copy();
5068        dst.category = category == null ? null : category.copy();
5069        dst.productOrService = productOrService == null ? null : productOrService.copy();
5070        if (modifier != null) {
5071          dst.modifier = new ArrayList<CodeableConcept>();
5072          for (CodeableConcept i : modifier)
5073            dst.modifier.add(i.copy());
5074        };
5075        if (programCode != null) {
5076          dst.programCode = new ArrayList<CodeableConcept>();
5077          for (CodeableConcept i : programCode)
5078            dst.programCode.add(i.copy());
5079        };
5080        dst.serviced = serviced == null ? null : serviced.copy();
5081        dst.location = location == null ? null : location.copy();
5082        dst.quantity = quantity == null ? null : quantity.copy();
5083        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
5084        dst.factor = factor == null ? null : factor.copy();
5085        dst.net = net == null ? null : net.copy();
5086        if (udi != null) {
5087          dst.udi = new ArrayList<Reference>();
5088          for (Reference i : udi)
5089            dst.udi.add(i.copy());
5090        };
5091        dst.bodySite = bodySite == null ? null : bodySite.copy();
5092        if (subSite != null) {
5093          dst.subSite = new ArrayList<CodeableConcept>();
5094          for (CodeableConcept i : subSite)
5095            dst.subSite.add(i.copy());
5096        };
5097        if (encounter != null) {
5098          dst.encounter = new ArrayList<Reference>();
5099          for (Reference i : encounter)
5100            dst.encounter.add(i.copy());
5101        };
5102        if (noteNumber != null) {
5103          dst.noteNumber = new ArrayList<PositiveIntType>();
5104          for (PositiveIntType i : noteNumber)
5105            dst.noteNumber.add(i.copy());
5106        };
5107        if (adjudication != null) {
5108          dst.adjudication = new ArrayList<AdjudicationComponent>();
5109          for (AdjudicationComponent i : adjudication)
5110            dst.adjudication.add(i.copy());
5111        };
5112        if (detail != null) {
5113          dst.detail = new ArrayList<DetailComponent>();
5114          for (DetailComponent i : detail)
5115            dst.detail.add(i.copy());
5116        };
5117      }
5118
5119      @Override
5120      public boolean equalsDeep(Base other_) {
5121        if (!super.equalsDeep(other_))
5122          return false;
5123        if (!(other_ instanceof ItemComponent))
5124          return false;
5125        ItemComponent o = (ItemComponent) other_;
5126        return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamSequence, o.careTeamSequence, true)
5127           && compareDeep(diagnosisSequence, o.diagnosisSequence, true) && compareDeep(procedureSequence, o.procedureSequence, true)
5128           && compareDeep(informationSequence, o.informationSequence, true) && compareDeep(revenue, o.revenue, true)
5129           && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
5130           && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true)
5131           && compareDeep(location, o.location, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
5132           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
5133           && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true) && compareDeep(encounter, o.encounter, true)
5134           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
5135           && compareDeep(detail, o.detail, true);
5136      }
5137
5138      @Override
5139      public boolean equalsShallow(Base other_) {
5140        if (!super.equalsShallow(other_))
5141          return false;
5142        if (!(other_ instanceof ItemComponent))
5143          return false;
5144        ItemComponent o = (ItemComponent) other_;
5145        return compareValues(sequence, o.sequence, true) && compareValues(careTeamSequence, o.careTeamSequence, true)
5146           && compareValues(diagnosisSequence, o.diagnosisSequence, true) && compareValues(procedureSequence, o.procedureSequence, true)
5147           && compareValues(informationSequence, o.informationSequence, true) && compareValues(factor, o.factor, true)
5148           && compareValues(noteNumber, o.noteNumber, true);
5149      }
5150
5151      public boolean isEmpty() {
5152        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamSequence
5153          , diagnosisSequence, procedureSequence, informationSequence, revenue, category, productOrService
5154          , modifier, programCode, serviced, location, quantity, unitPrice, factor, net
5155          , udi, bodySite, subSite, encounter, noteNumber, adjudication, detail);
5156      }
5157
5158  public String fhirType() {
5159    return "ExplanationOfBenefit.item";
5160
5161  }
5162
5163  }
5164
5165    @Block()
5166    public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
5167        /**
5168         * 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.
5169         */
5170        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
5171        @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." )
5172        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
5173        protected CodeableConcept category;
5174
5175        /**
5176         * A code supporting the understanding of the adjudication result and explaining variance from expected amount.
5177         */
5178        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5179        @Description(shortDefinition="Explanation of adjudication outcome", formalDefinition="A code supporting the understanding of the adjudication result and explaining variance from expected amount." )
5180        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-reason")
5181        protected CodeableConcept reason;
5182
5183        /**
5184         * Monetary amount associated with the category.
5185         */
5186        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
5187        @Description(shortDefinition="Monetary amount", formalDefinition="Monetary amount associated with the category." )
5188        protected Money amount;
5189
5190        /**
5191         * A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5192         */
5193        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
5194        @Description(shortDefinition="Non-monitary value", formalDefinition="A non-monetary value associated with the category. Mutually exclusive to the amount element above." )
5195        protected DecimalType value;
5196
5197        private static final long serialVersionUID = 1559898786L;
5198
5199    /**
5200     * Constructor
5201     */
5202      public AdjudicationComponent() {
5203        super();
5204      }
5205
5206    /**
5207     * Constructor
5208     */
5209      public AdjudicationComponent(CodeableConcept category) {
5210        super();
5211        this.category = category;
5212      }
5213
5214        /**
5215         * @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.)
5216         */
5217        public CodeableConcept getCategory() { 
5218          if (this.category == null)
5219            if (Configuration.errorOnAutoCreate())
5220              throw new Error("Attempt to auto-create AdjudicationComponent.category");
5221            else if (Configuration.doAutoCreate())
5222              this.category = new CodeableConcept(); // cc
5223          return this.category;
5224        }
5225
5226        public boolean hasCategory() { 
5227          return this.category != null && !this.category.isEmpty();
5228        }
5229
5230        /**
5231         * @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.)
5232         */
5233        public AdjudicationComponent setCategory(CodeableConcept value) { 
5234          this.category = value;
5235          return this;
5236        }
5237
5238        /**
5239         * @return {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
5240         */
5241        public CodeableConcept getReason() { 
5242          if (this.reason == null)
5243            if (Configuration.errorOnAutoCreate())
5244              throw new Error("Attempt to auto-create AdjudicationComponent.reason");
5245            else if (Configuration.doAutoCreate())
5246              this.reason = new CodeableConcept(); // cc
5247          return this.reason;
5248        }
5249
5250        public boolean hasReason() { 
5251          return this.reason != null && !this.reason.isEmpty();
5252        }
5253
5254        /**
5255         * @param value {@link #reason} (A code supporting the understanding of the adjudication result and explaining variance from expected amount.)
5256         */
5257        public AdjudicationComponent setReason(CodeableConcept value) { 
5258          this.reason = value;
5259          return this;
5260        }
5261
5262        /**
5263         * @return {@link #amount} (Monetary amount associated with the category.)
5264         */
5265        public Money getAmount() { 
5266          if (this.amount == null)
5267            if (Configuration.errorOnAutoCreate())
5268              throw new Error("Attempt to auto-create AdjudicationComponent.amount");
5269            else if (Configuration.doAutoCreate())
5270              this.amount = new Money(); // cc
5271          return this.amount;
5272        }
5273
5274        public boolean hasAmount() { 
5275          return this.amount != null && !this.amount.isEmpty();
5276        }
5277
5278        /**
5279         * @param value {@link #amount} (Monetary amount associated with the category.)
5280         */
5281        public AdjudicationComponent setAmount(Money value) { 
5282          this.amount = value;
5283          return this;
5284        }
5285
5286        /**
5287         * @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
5288         */
5289        public DecimalType getValueElement() { 
5290          if (this.value == null)
5291            if (Configuration.errorOnAutoCreate())
5292              throw new Error("Attempt to auto-create AdjudicationComponent.value");
5293            else if (Configuration.doAutoCreate())
5294              this.value = new DecimalType(); // bb
5295          return this.value;
5296        }
5297
5298        public boolean hasValueElement() { 
5299          return this.value != null && !this.value.isEmpty();
5300        }
5301
5302        public boolean hasValue() { 
5303          return this.value != null && !this.value.isEmpty();
5304        }
5305
5306        /**
5307         * @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
5308         */
5309        public AdjudicationComponent setValueElement(DecimalType value) { 
5310          this.value = value;
5311          return this;
5312        }
5313
5314        /**
5315         * @return A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5316         */
5317        public BigDecimal getValue() { 
5318          return this.value == null ? null : this.value.getValue();
5319        }
5320
5321        /**
5322         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5323         */
5324        public AdjudicationComponent setValue(BigDecimal value) { 
5325          if (value == null)
5326            this.value = null;
5327          else {
5328            if (this.value == null)
5329              this.value = new DecimalType();
5330            this.value.setValue(value);
5331          }
5332          return this;
5333        }
5334
5335        /**
5336         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5337         */
5338        public AdjudicationComponent setValue(long value) { 
5339              this.value = new DecimalType();
5340            this.value.setValue(value);
5341          return this;
5342        }
5343
5344        /**
5345         * @param value A non-monetary value associated with the category. Mutually exclusive to the amount element above.
5346         */
5347        public AdjudicationComponent setValue(double value) { 
5348              this.value = new DecimalType();
5349            this.value.setValue(value);
5350          return this;
5351        }
5352
5353        protected void listChildren(List<Property> children) {
5354          super.listChildren(children);
5355          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));
5356          children.add(new Property("reason", "CodeableConcept", "A code supporting the understanding of the adjudication result and explaining variance from expected amount.", 0, 1, reason));
5357          children.add(new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount));
5358          children.add(new Property("value", "decimal", "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1, value));
5359        }
5360
5361        @Override
5362        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5363          switch (_hash) {
5364          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);
5365          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);
5366          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount);
5367          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);
5368          default: return super.getNamedProperty(_hash, _name, _checkValid);
5369          }
5370
5371        }
5372
5373      @Override
5374      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5375        switch (hash) {
5376        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
5377        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
5378        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
5379        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
5380        default: return super.getProperty(hash, name, checkValid);
5381        }
5382
5383      }
5384
5385      @Override
5386      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5387        switch (hash) {
5388        case 50511102: // category
5389          this.category = castToCodeableConcept(value); // CodeableConcept
5390          return value;
5391        case -934964668: // reason
5392          this.reason = castToCodeableConcept(value); // CodeableConcept
5393          return value;
5394        case -1413853096: // amount
5395          this.amount = castToMoney(value); // Money
5396          return value;
5397        case 111972721: // value
5398          this.value = castToDecimal(value); // DecimalType
5399          return value;
5400        default: return super.setProperty(hash, name, value);
5401        }
5402
5403      }
5404
5405      @Override
5406      public Base setProperty(String name, Base value) throws FHIRException {
5407        if (name.equals("category")) {
5408          this.category = castToCodeableConcept(value); // CodeableConcept
5409        } else if (name.equals("reason")) {
5410          this.reason = castToCodeableConcept(value); // CodeableConcept
5411        } else if (name.equals("amount")) {
5412          this.amount = castToMoney(value); // Money
5413        } else if (name.equals("value")) {
5414          this.value = castToDecimal(value); // DecimalType
5415        } else
5416          return super.setProperty(name, value);
5417        return value;
5418      }
5419
5420      @Override
5421      public Base makeProperty(int hash, String name) throws FHIRException {
5422        switch (hash) {
5423        case 50511102:  return getCategory();
5424        case -934964668:  return getReason();
5425        case -1413853096:  return getAmount();
5426        case 111972721:  return getValueElement();
5427        default: return super.makeProperty(hash, name);
5428        }
5429
5430      }
5431
5432      @Override
5433      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5434        switch (hash) {
5435        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
5436        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
5437        case -1413853096: /*amount*/ return new String[] {"Money"};
5438        case 111972721: /*value*/ return new String[] {"decimal"};
5439        default: return super.getTypesForProperty(hash, name);
5440        }
5441
5442      }
5443
5444      @Override
5445      public Base addChild(String name) throws FHIRException {
5446        if (name.equals("category")) {
5447          this.category = new CodeableConcept();
5448          return this.category;
5449        }
5450        else if (name.equals("reason")) {
5451          this.reason = new CodeableConcept();
5452          return this.reason;
5453        }
5454        else if (name.equals("amount")) {
5455          this.amount = new Money();
5456          return this.amount;
5457        }
5458        else if (name.equals("value")) {
5459          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.value");
5460        }
5461        else
5462          return super.addChild(name);
5463      }
5464
5465      public AdjudicationComponent copy() {
5466        AdjudicationComponent dst = new AdjudicationComponent();
5467        copyValues(dst);
5468        return dst;
5469      }
5470
5471      public void copyValues(AdjudicationComponent dst) {
5472        super.copyValues(dst);
5473        dst.category = category == null ? null : category.copy();
5474        dst.reason = reason == null ? null : reason.copy();
5475        dst.amount = amount == null ? null : amount.copy();
5476        dst.value = value == null ? null : value.copy();
5477      }
5478
5479      @Override
5480      public boolean equalsDeep(Base other_) {
5481        if (!super.equalsDeep(other_))
5482          return false;
5483        if (!(other_ instanceof AdjudicationComponent))
5484          return false;
5485        AdjudicationComponent o = (AdjudicationComponent) other_;
5486        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
5487           && compareDeep(value, o.value, true);
5488      }
5489
5490      @Override
5491      public boolean equalsShallow(Base other_) {
5492        if (!super.equalsShallow(other_))
5493          return false;
5494        if (!(other_ instanceof AdjudicationComponent))
5495          return false;
5496        AdjudicationComponent o = (AdjudicationComponent) other_;
5497        return compareValues(value, o.value, true);
5498      }
5499
5500      public boolean isEmpty() {
5501        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount
5502          , value);
5503      }
5504
5505  public String fhirType() {
5506    return "ExplanationOfBenefit.item.adjudication";
5507
5508  }
5509
5510  }
5511
5512    @Block()
5513    public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
5514        /**
5515         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5516         */
5517        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
5518        @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." )
5519        protected PositiveIntType sequence;
5520
5521        /**
5522         * The type of revenue or cost center providing the product and/or service.
5523         */
5524        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
5525        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
5526        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
5527        protected CodeableConcept revenue;
5528
5529        /**
5530         * Code to identify the general type of benefits under which products and services are provided.
5531         */
5532        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
5533        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
5534        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
5535        protected CodeableConcept category;
5536
5537        /**
5538         * 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.
5539         */
5540        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
5541        @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." )
5542        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
5543        protected CodeableConcept productOrService;
5544
5545        /**
5546         * Item typification or modifiers codes to convey additional context for the product or service.
5547         */
5548        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5549        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
5550        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
5551        protected List<CodeableConcept> modifier;
5552
5553        /**
5554         * Identifies the program under which this may be recovered.
5555         */
5556        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5557        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
5558        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
5559        protected List<CodeableConcept> programCode;
5560
5561        /**
5562         * The number of repetitions of a service or product.
5563         */
5564        @Child(name = "quantity", type = {Quantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
5565        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
5566        protected Quantity quantity;
5567
5568        /**
5569         * 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.
5570         */
5571        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
5572        @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." )
5573        protected Money unitPrice;
5574
5575        /**
5576         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
5577         */
5578        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
5579        @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." )
5580        protected DecimalType factor;
5581
5582        /**
5583         * The quantity times the unit price for an additional service or product or charge.
5584         */
5585        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
5586        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
5587        protected Money net;
5588
5589        /**
5590         * Unique Device Identifiers associated with this line item.
5591         */
5592        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5593        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
5594        protected List<Reference> udi;
5595
5596        /**
5597         * The numbers associated with notes below which apply to the adjudication of this item.
5598         */
5599        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5600        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
5601        protected List<PositiveIntType> noteNumber;
5602
5603        /**
5604         * The adjudication results.
5605         */
5606        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5607        @Description(shortDefinition="Detail level adjudication details", formalDefinition="The adjudication results." )
5608        protected List<AdjudicationComponent> adjudication;
5609
5610        /**
5611         * Third-tier of goods and services.
5612         */
5613        @Child(name = "subDetail", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5614        @Description(shortDefinition="Additional items", formalDefinition="Third-tier of goods and services." )
5615        protected List<SubDetailComponent> subDetail;
5616
5617        private static final long serialVersionUID = -318460001L;
5618
5619    /**
5620     * Constructor
5621     */
5622      public DetailComponent() {
5623        super();
5624      }
5625
5626    /**
5627     * Constructor
5628     */
5629      public DetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
5630        super();
5631        this.sequence = sequence;
5632        this.productOrService = productOrService;
5633      }
5634
5635        /**
5636         * @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
5637         */
5638        public PositiveIntType getSequenceElement() { 
5639          if (this.sequence == null)
5640            if (Configuration.errorOnAutoCreate())
5641              throw new Error("Attempt to auto-create DetailComponent.sequence");
5642            else if (Configuration.doAutoCreate())
5643              this.sequence = new PositiveIntType(); // bb
5644          return this.sequence;
5645        }
5646
5647        public boolean hasSequenceElement() { 
5648          return this.sequence != null && !this.sequence.isEmpty();
5649        }
5650
5651        public boolean hasSequence() { 
5652          return this.sequence != null && !this.sequence.isEmpty();
5653        }
5654
5655        /**
5656         * @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
5657         */
5658        public DetailComponent setSequenceElement(PositiveIntType value) { 
5659          this.sequence = value;
5660          return this;
5661        }
5662
5663        /**
5664         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5665         */
5666        public int getSequence() { 
5667          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
5668        }
5669
5670        /**
5671         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
5672         */
5673        public DetailComponent setSequence(int value) { 
5674            if (this.sequence == null)
5675              this.sequence = new PositiveIntType();
5676            this.sequence.setValue(value);
5677          return this;
5678        }
5679
5680        /**
5681         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5682         */
5683        public CodeableConcept getRevenue() { 
5684          if (this.revenue == null)
5685            if (Configuration.errorOnAutoCreate())
5686              throw new Error("Attempt to auto-create DetailComponent.revenue");
5687            else if (Configuration.doAutoCreate())
5688              this.revenue = new CodeableConcept(); // cc
5689          return this.revenue;
5690        }
5691
5692        public boolean hasRevenue() { 
5693          return this.revenue != null && !this.revenue.isEmpty();
5694        }
5695
5696        /**
5697         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
5698         */
5699        public DetailComponent setRevenue(CodeableConcept value) { 
5700          this.revenue = value;
5701          return this;
5702        }
5703
5704        /**
5705         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5706         */
5707        public CodeableConcept getCategory() { 
5708          if (this.category == null)
5709            if (Configuration.errorOnAutoCreate())
5710              throw new Error("Attempt to auto-create DetailComponent.category");
5711            else if (Configuration.doAutoCreate())
5712              this.category = new CodeableConcept(); // cc
5713          return this.category;
5714        }
5715
5716        public boolean hasCategory() { 
5717          return this.category != null && !this.category.isEmpty();
5718        }
5719
5720        /**
5721         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
5722         */
5723        public DetailComponent setCategory(CodeableConcept value) { 
5724          this.category = value;
5725          return this;
5726        }
5727
5728        /**
5729         * @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.)
5730         */
5731        public CodeableConcept getProductOrService() { 
5732          if (this.productOrService == null)
5733            if (Configuration.errorOnAutoCreate())
5734              throw new Error("Attempt to auto-create DetailComponent.productOrService");
5735            else if (Configuration.doAutoCreate())
5736              this.productOrService = new CodeableConcept(); // cc
5737          return this.productOrService;
5738        }
5739
5740        public boolean hasProductOrService() { 
5741          return this.productOrService != null && !this.productOrService.isEmpty();
5742        }
5743
5744        /**
5745         * @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.)
5746         */
5747        public DetailComponent setProductOrService(CodeableConcept value) { 
5748          this.productOrService = value;
5749          return this;
5750        }
5751
5752        /**
5753         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
5754         */
5755        public List<CodeableConcept> getModifier() { 
5756          if (this.modifier == null)
5757            this.modifier = new ArrayList<CodeableConcept>();
5758          return this.modifier;
5759        }
5760
5761        /**
5762         * @return Returns a reference to <code>this</code> for easy method chaining
5763         */
5764        public DetailComponent setModifier(List<CodeableConcept> theModifier) { 
5765          this.modifier = theModifier;
5766          return this;
5767        }
5768
5769        public boolean hasModifier() { 
5770          if (this.modifier == null)
5771            return false;
5772          for (CodeableConcept item : this.modifier)
5773            if (!item.isEmpty())
5774              return true;
5775          return false;
5776        }
5777
5778        public CodeableConcept addModifier() { //3
5779          CodeableConcept t = new CodeableConcept();
5780          if (this.modifier == null)
5781            this.modifier = new ArrayList<CodeableConcept>();
5782          this.modifier.add(t);
5783          return t;
5784        }
5785
5786        public DetailComponent addModifier(CodeableConcept t) { //3
5787          if (t == null)
5788            return this;
5789          if (this.modifier == null)
5790            this.modifier = new ArrayList<CodeableConcept>();
5791          this.modifier.add(t);
5792          return this;
5793        }
5794
5795        /**
5796         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
5797         */
5798        public CodeableConcept getModifierFirstRep() { 
5799          if (getModifier().isEmpty()) {
5800            addModifier();
5801          }
5802          return getModifier().get(0);
5803        }
5804
5805        /**
5806         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
5807         */
5808        public List<CodeableConcept> getProgramCode() { 
5809          if (this.programCode == null)
5810            this.programCode = new ArrayList<CodeableConcept>();
5811          return this.programCode;
5812        }
5813
5814        /**
5815         * @return Returns a reference to <code>this</code> for easy method chaining
5816         */
5817        public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
5818          this.programCode = theProgramCode;
5819          return this;
5820        }
5821
5822        public boolean hasProgramCode() { 
5823          if (this.programCode == null)
5824            return false;
5825          for (CodeableConcept item : this.programCode)
5826            if (!item.isEmpty())
5827              return true;
5828          return false;
5829        }
5830
5831        public CodeableConcept addProgramCode() { //3
5832          CodeableConcept t = new CodeableConcept();
5833          if (this.programCode == null)
5834            this.programCode = new ArrayList<CodeableConcept>();
5835          this.programCode.add(t);
5836          return t;
5837        }
5838
5839        public DetailComponent addProgramCode(CodeableConcept t) { //3
5840          if (t == null)
5841            return this;
5842          if (this.programCode == null)
5843            this.programCode = new ArrayList<CodeableConcept>();
5844          this.programCode.add(t);
5845          return this;
5846        }
5847
5848        /**
5849         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
5850         */
5851        public CodeableConcept getProgramCodeFirstRep() { 
5852          if (getProgramCode().isEmpty()) {
5853            addProgramCode();
5854          }
5855          return getProgramCode().get(0);
5856        }
5857
5858        /**
5859         * @return {@link #quantity} (The number of repetitions of a service or product.)
5860         */
5861        public Quantity getQuantity() { 
5862          if (this.quantity == null)
5863            if (Configuration.errorOnAutoCreate())
5864              throw new Error("Attempt to auto-create DetailComponent.quantity");
5865            else if (Configuration.doAutoCreate())
5866              this.quantity = new Quantity(); // cc
5867          return this.quantity;
5868        }
5869
5870        public boolean hasQuantity() { 
5871          return this.quantity != null && !this.quantity.isEmpty();
5872        }
5873
5874        /**
5875         * @param value {@link #quantity} (The number of repetitions of a service or product.)
5876         */
5877        public DetailComponent setQuantity(Quantity value) { 
5878          this.quantity = value;
5879          return this;
5880        }
5881
5882        /**
5883         * @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.)
5884         */
5885        public Money getUnitPrice() { 
5886          if (this.unitPrice == null)
5887            if (Configuration.errorOnAutoCreate())
5888              throw new Error("Attempt to auto-create DetailComponent.unitPrice");
5889            else if (Configuration.doAutoCreate())
5890              this.unitPrice = new Money(); // cc
5891          return this.unitPrice;
5892        }
5893
5894        public boolean hasUnitPrice() { 
5895          return this.unitPrice != null && !this.unitPrice.isEmpty();
5896        }
5897
5898        /**
5899         * @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.)
5900         */
5901        public DetailComponent setUnitPrice(Money value) { 
5902          this.unitPrice = value;
5903          return this;
5904        }
5905
5906        /**
5907         * @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
5908         */
5909        public DecimalType getFactorElement() { 
5910          if (this.factor == null)
5911            if (Configuration.errorOnAutoCreate())
5912              throw new Error("Attempt to auto-create DetailComponent.factor");
5913            else if (Configuration.doAutoCreate())
5914              this.factor = new DecimalType(); // bb
5915          return this.factor;
5916        }
5917
5918        public boolean hasFactorElement() { 
5919          return this.factor != null && !this.factor.isEmpty();
5920        }
5921
5922        public boolean hasFactor() { 
5923          return this.factor != null && !this.factor.isEmpty();
5924        }
5925
5926        /**
5927         * @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
5928         */
5929        public DetailComponent setFactorElement(DecimalType value) { 
5930          this.factor = value;
5931          return this;
5932        }
5933
5934        /**
5935         * @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.
5936         */
5937        public BigDecimal getFactor() { 
5938          return this.factor == null ? null : this.factor.getValue();
5939        }
5940
5941        /**
5942         * @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.
5943         */
5944        public DetailComponent setFactor(BigDecimal value) { 
5945          if (value == null)
5946            this.factor = null;
5947          else {
5948            if (this.factor == null)
5949              this.factor = new DecimalType();
5950            this.factor.setValue(value);
5951          }
5952          return this;
5953        }
5954
5955        /**
5956         * @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.
5957         */
5958        public DetailComponent setFactor(long value) { 
5959              this.factor = new DecimalType();
5960            this.factor.setValue(value);
5961          return this;
5962        }
5963
5964        /**
5965         * @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.
5966         */
5967        public DetailComponent setFactor(double value) { 
5968              this.factor = new DecimalType();
5969            this.factor.setValue(value);
5970          return this;
5971        }
5972
5973        /**
5974         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
5975         */
5976        public Money getNet() { 
5977          if (this.net == null)
5978            if (Configuration.errorOnAutoCreate())
5979              throw new Error("Attempt to auto-create DetailComponent.net");
5980            else if (Configuration.doAutoCreate())
5981              this.net = new Money(); // cc
5982          return this.net;
5983        }
5984
5985        public boolean hasNet() { 
5986          return this.net != null && !this.net.isEmpty();
5987        }
5988
5989        /**
5990         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
5991         */
5992        public DetailComponent setNet(Money value) { 
5993          this.net = value;
5994          return this;
5995        }
5996
5997        /**
5998         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
5999         */
6000        public List<Reference> getUdi() { 
6001          if (this.udi == null)
6002            this.udi = new ArrayList<Reference>();
6003          return this.udi;
6004        }
6005
6006        /**
6007         * @return Returns a reference to <code>this</code> for easy method chaining
6008         */
6009        public DetailComponent setUdi(List<Reference> theUdi) { 
6010          this.udi = theUdi;
6011          return this;
6012        }
6013
6014        public boolean hasUdi() { 
6015          if (this.udi == null)
6016            return false;
6017          for (Reference item : this.udi)
6018            if (!item.isEmpty())
6019              return true;
6020          return false;
6021        }
6022
6023        public Reference addUdi() { //3
6024          Reference t = new Reference();
6025          if (this.udi == null)
6026            this.udi = new ArrayList<Reference>();
6027          this.udi.add(t);
6028          return t;
6029        }
6030
6031        public DetailComponent addUdi(Reference t) { //3
6032          if (t == null)
6033            return this;
6034          if (this.udi == null)
6035            this.udi = new ArrayList<Reference>();
6036          this.udi.add(t);
6037          return this;
6038        }
6039
6040        /**
6041         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
6042         */
6043        public Reference getUdiFirstRep() { 
6044          if (getUdi().isEmpty()) {
6045            addUdi();
6046          }
6047          return getUdi().get(0);
6048        }
6049
6050        /**
6051         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6052         */
6053        public List<PositiveIntType> getNoteNumber() { 
6054          if (this.noteNumber == null)
6055            this.noteNumber = new ArrayList<PositiveIntType>();
6056          return this.noteNumber;
6057        }
6058
6059        /**
6060         * @return Returns a reference to <code>this</code> for easy method chaining
6061         */
6062        public DetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
6063          this.noteNumber = theNoteNumber;
6064          return this;
6065        }
6066
6067        public boolean hasNoteNumber() { 
6068          if (this.noteNumber == null)
6069            return false;
6070          for (PositiveIntType item : this.noteNumber)
6071            if (!item.isEmpty())
6072              return true;
6073          return false;
6074        }
6075
6076        /**
6077         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6078         */
6079        public PositiveIntType addNoteNumberElement() {//2 
6080          PositiveIntType t = new PositiveIntType();
6081          if (this.noteNumber == null)
6082            this.noteNumber = new ArrayList<PositiveIntType>();
6083          this.noteNumber.add(t);
6084          return t;
6085        }
6086
6087        /**
6088         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6089         */
6090        public DetailComponent addNoteNumber(int value) { //1
6091          PositiveIntType t = new PositiveIntType();
6092          t.setValue(value);
6093          if (this.noteNumber == null)
6094            this.noteNumber = new ArrayList<PositiveIntType>();
6095          this.noteNumber.add(t);
6096          return this;
6097        }
6098
6099        /**
6100         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
6101         */
6102        public boolean hasNoteNumber(int value) { 
6103          if (this.noteNumber == null)
6104            return false;
6105          for (PositiveIntType v : this.noteNumber)
6106            if (v.getValue().equals(value)) // positiveInt
6107              return true;
6108          return false;
6109        }
6110
6111        /**
6112         * @return {@link #adjudication} (The adjudication results.)
6113         */
6114        public List<AdjudicationComponent> getAdjudication() { 
6115          if (this.adjudication == null)
6116            this.adjudication = new ArrayList<AdjudicationComponent>();
6117          return this.adjudication;
6118        }
6119
6120        /**
6121         * @return Returns a reference to <code>this</code> for easy method chaining
6122         */
6123        public DetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
6124          this.adjudication = theAdjudication;
6125          return this;
6126        }
6127
6128        public boolean hasAdjudication() { 
6129          if (this.adjudication == null)
6130            return false;
6131          for (AdjudicationComponent item : this.adjudication)
6132            if (!item.isEmpty())
6133              return true;
6134          return false;
6135        }
6136
6137        public AdjudicationComponent addAdjudication() { //3
6138          AdjudicationComponent t = new AdjudicationComponent();
6139          if (this.adjudication == null)
6140            this.adjudication = new ArrayList<AdjudicationComponent>();
6141          this.adjudication.add(t);
6142          return t;
6143        }
6144
6145        public DetailComponent addAdjudication(AdjudicationComponent t) { //3
6146          if (t == null)
6147            return this;
6148          if (this.adjudication == null)
6149            this.adjudication = new ArrayList<AdjudicationComponent>();
6150          this.adjudication.add(t);
6151          return this;
6152        }
6153
6154        /**
6155         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
6156         */
6157        public AdjudicationComponent getAdjudicationFirstRep() { 
6158          if (getAdjudication().isEmpty()) {
6159            addAdjudication();
6160          }
6161          return getAdjudication().get(0);
6162        }
6163
6164        /**
6165         * @return {@link #subDetail} (Third-tier of goods and services.)
6166         */
6167        public List<SubDetailComponent> getSubDetail() { 
6168          if (this.subDetail == null)
6169            this.subDetail = new ArrayList<SubDetailComponent>();
6170          return this.subDetail;
6171        }
6172
6173        /**
6174         * @return Returns a reference to <code>this</code> for easy method chaining
6175         */
6176        public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) { 
6177          this.subDetail = theSubDetail;
6178          return this;
6179        }
6180
6181        public boolean hasSubDetail() { 
6182          if (this.subDetail == null)
6183            return false;
6184          for (SubDetailComponent item : this.subDetail)
6185            if (!item.isEmpty())
6186              return true;
6187          return false;
6188        }
6189
6190        public SubDetailComponent addSubDetail() { //3
6191          SubDetailComponent t = new SubDetailComponent();
6192          if (this.subDetail == null)
6193            this.subDetail = new ArrayList<SubDetailComponent>();
6194          this.subDetail.add(t);
6195          return t;
6196        }
6197
6198        public DetailComponent addSubDetail(SubDetailComponent t) { //3
6199          if (t == null)
6200            return this;
6201          if (this.subDetail == null)
6202            this.subDetail = new ArrayList<SubDetailComponent>();
6203          this.subDetail.add(t);
6204          return this;
6205        }
6206
6207        /**
6208         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist
6209         */
6210        public SubDetailComponent getSubDetailFirstRep() { 
6211          if (getSubDetail().isEmpty()) {
6212            addSubDetail();
6213          }
6214          return getSubDetail().get(0);
6215        }
6216
6217        protected void listChildren(List<Property> children) {
6218          super.listChildren(children);
6219          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));
6220          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
6221          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
6222          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));
6223          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));
6224          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
6225          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
6226          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));
6227          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));
6228          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
6229          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
6230          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));
6231          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
6232          children.add(new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
6233        }
6234
6235        @Override
6236        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6237          switch (_hash) {
6238          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);
6239          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
6240          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);
6241          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);
6242          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);
6243          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
6244          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
6245          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);
6246          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);
6247          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);
6248          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
6249          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);
6250          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
6251          case -828829007: /*subDetail*/  return new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
6252          default: return super.getNamedProperty(_hash, _name, _checkValid);
6253          }
6254
6255        }
6256
6257      @Override
6258      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6259        switch (hash) {
6260        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
6261        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
6262        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
6263        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
6264        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
6265        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
6266        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
6267        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
6268        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
6269        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
6270        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
6271        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
6272        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
6273        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
6274        default: return super.getProperty(hash, name, checkValid);
6275        }
6276
6277      }
6278
6279      @Override
6280      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6281        switch (hash) {
6282        case 1349547969: // sequence
6283          this.sequence = castToPositiveInt(value); // PositiveIntType
6284          return value;
6285        case 1099842588: // revenue
6286          this.revenue = castToCodeableConcept(value); // CodeableConcept
6287          return value;
6288        case 50511102: // category
6289          this.category = castToCodeableConcept(value); // CodeableConcept
6290          return value;
6291        case 1957227299: // productOrService
6292          this.productOrService = castToCodeableConcept(value); // CodeableConcept
6293          return value;
6294        case -615513385: // modifier
6295          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
6296          return value;
6297        case 1010065041: // programCode
6298          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
6299          return value;
6300        case -1285004149: // quantity
6301          this.quantity = castToQuantity(value); // Quantity
6302          return value;
6303        case -486196699: // unitPrice
6304          this.unitPrice = castToMoney(value); // Money
6305          return value;
6306        case -1282148017: // factor
6307          this.factor = castToDecimal(value); // DecimalType
6308          return value;
6309        case 108957: // net
6310          this.net = castToMoney(value); // Money
6311          return value;
6312        case 115642: // udi
6313          this.getUdi().add(castToReference(value)); // Reference
6314          return value;
6315        case -1110033957: // noteNumber
6316          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
6317          return value;
6318        case -231349275: // adjudication
6319          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
6320          return value;
6321        case -828829007: // subDetail
6322          this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
6323          return value;
6324        default: return super.setProperty(hash, name, value);
6325        }
6326
6327      }
6328
6329      @Override
6330      public Base setProperty(String name, Base value) throws FHIRException {
6331        if (name.equals("sequence")) {
6332          this.sequence = castToPositiveInt(value); // PositiveIntType
6333        } else if (name.equals("revenue")) {
6334          this.revenue = castToCodeableConcept(value); // CodeableConcept
6335        } else if (name.equals("category")) {
6336          this.category = castToCodeableConcept(value); // CodeableConcept
6337        } else if (name.equals("productOrService")) {
6338          this.productOrService = castToCodeableConcept(value); // CodeableConcept
6339        } else if (name.equals("modifier")) {
6340          this.getModifier().add(castToCodeableConcept(value));
6341        } else if (name.equals("programCode")) {
6342          this.getProgramCode().add(castToCodeableConcept(value));
6343        } else if (name.equals("quantity")) {
6344          this.quantity = castToQuantity(value); // Quantity
6345        } else if (name.equals("unitPrice")) {
6346          this.unitPrice = castToMoney(value); // Money
6347        } else if (name.equals("factor")) {
6348          this.factor = castToDecimal(value); // DecimalType
6349        } else if (name.equals("net")) {
6350          this.net = castToMoney(value); // Money
6351        } else if (name.equals("udi")) {
6352          this.getUdi().add(castToReference(value));
6353        } else if (name.equals("noteNumber")) {
6354          this.getNoteNumber().add(castToPositiveInt(value));
6355        } else if (name.equals("adjudication")) {
6356          this.getAdjudication().add((AdjudicationComponent) value);
6357        } else if (name.equals("subDetail")) {
6358          this.getSubDetail().add((SubDetailComponent) value);
6359        } else
6360          return super.setProperty(name, value);
6361        return value;
6362      }
6363
6364      @Override
6365      public Base makeProperty(int hash, String name) throws FHIRException {
6366        switch (hash) {
6367        case 1349547969:  return getSequenceElement();
6368        case 1099842588:  return getRevenue();
6369        case 50511102:  return getCategory();
6370        case 1957227299:  return getProductOrService();
6371        case -615513385:  return addModifier(); 
6372        case 1010065041:  return addProgramCode(); 
6373        case -1285004149:  return getQuantity();
6374        case -486196699:  return getUnitPrice();
6375        case -1282148017:  return getFactorElement();
6376        case 108957:  return getNet();
6377        case 115642:  return addUdi(); 
6378        case -1110033957:  return addNoteNumberElement();
6379        case -231349275:  return addAdjudication(); 
6380        case -828829007:  return addSubDetail(); 
6381        default: return super.makeProperty(hash, name);
6382        }
6383
6384      }
6385
6386      @Override
6387      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6388        switch (hash) {
6389        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
6390        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
6391        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
6392        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
6393        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
6394        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
6395        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
6396        case -486196699: /*unitPrice*/ return new String[] {"Money"};
6397        case -1282148017: /*factor*/ return new String[] {"decimal"};
6398        case 108957: /*net*/ return new String[] {"Money"};
6399        case 115642: /*udi*/ return new String[] {"Reference"};
6400        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
6401        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
6402        case -828829007: /*subDetail*/ return new String[] {};
6403        default: return super.getTypesForProperty(hash, name);
6404        }
6405
6406      }
6407
6408      @Override
6409      public Base addChild(String name) throws FHIRException {
6410        if (name.equals("sequence")) {
6411          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
6412        }
6413        else if (name.equals("revenue")) {
6414          this.revenue = new CodeableConcept();
6415          return this.revenue;
6416        }
6417        else if (name.equals("category")) {
6418          this.category = new CodeableConcept();
6419          return this.category;
6420        }
6421        else if (name.equals("productOrService")) {
6422          this.productOrService = new CodeableConcept();
6423          return this.productOrService;
6424        }
6425        else if (name.equals("modifier")) {
6426          return addModifier();
6427        }
6428        else if (name.equals("programCode")) {
6429          return addProgramCode();
6430        }
6431        else if (name.equals("quantity")) {
6432          this.quantity = new Quantity();
6433          return this.quantity;
6434        }
6435        else if (name.equals("unitPrice")) {
6436          this.unitPrice = new Money();
6437          return this.unitPrice;
6438        }
6439        else if (name.equals("factor")) {
6440          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
6441        }
6442        else if (name.equals("net")) {
6443          this.net = new Money();
6444          return this.net;
6445        }
6446        else if (name.equals("udi")) {
6447          return addUdi();
6448        }
6449        else if (name.equals("noteNumber")) {
6450          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
6451        }
6452        else if (name.equals("adjudication")) {
6453          return addAdjudication();
6454        }
6455        else if (name.equals("subDetail")) {
6456          return addSubDetail();
6457        }
6458        else
6459          return super.addChild(name);
6460      }
6461
6462      public DetailComponent copy() {
6463        DetailComponent dst = new DetailComponent();
6464        copyValues(dst);
6465        return dst;
6466      }
6467
6468      public void copyValues(DetailComponent dst) {
6469        super.copyValues(dst);
6470        dst.sequence = sequence == null ? null : sequence.copy();
6471        dst.revenue = revenue == null ? null : revenue.copy();
6472        dst.category = category == null ? null : category.copy();
6473        dst.productOrService = productOrService == null ? null : productOrService.copy();
6474        if (modifier != null) {
6475          dst.modifier = new ArrayList<CodeableConcept>();
6476          for (CodeableConcept i : modifier)
6477            dst.modifier.add(i.copy());
6478        };
6479        if (programCode != null) {
6480          dst.programCode = new ArrayList<CodeableConcept>();
6481          for (CodeableConcept i : programCode)
6482            dst.programCode.add(i.copy());
6483        };
6484        dst.quantity = quantity == null ? null : quantity.copy();
6485        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6486        dst.factor = factor == null ? null : factor.copy();
6487        dst.net = net == null ? null : net.copy();
6488        if (udi != null) {
6489          dst.udi = new ArrayList<Reference>();
6490          for (Reference i : udi)
6491            dst.udi.add(i.copy());
6492        };
6493        if (noteNumber != null) {
6494          dst.noteNumber = new ArrayList<PositiveIntType>();
6495          for (PositiveIntType i : noteNumber)
6496            dst.noteNumber.add(i.copy());
6497        };
6498        if (adjudication != null) {
6499          dst.adjudication = new ArrayList<AdjudicationComponent>();
6500          for (AdjudicationComponent i : adjudication)
6501            dst.adjudication.add(i.copy());
6502        };
6503        if (subDetail != null) {
6504          dst.subDetail = new ArrayList<SubDetailComponent>();
6505          for (SubDetailComponent i : subDetail)
6506            dst.subDetail.add(i.copy());
6507        };
6508      }
6509
6510      @Override
6511      public boolean equalsDeep(Base other_) {
6512        if (!super.equalsDeep(other_))
6513          return false;
6514        if (!(other_ instanceof DetailComponent))
6515          return false;
6516        DetailComponent o = (DetailComponent) other_;
6517        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
6518           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
6519           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
6520           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
6521           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
6522           && compareDeep(subDetail, o.subDetail, true);
6523      }
6524
6525      @Override
6526      public boolean equalsShallow(Base other_) {
6527        if (!super.equalsShallow(other_))
6528          return false;
6529        if (!(other_ instanceof DetailComponent))
6530          return false;
6531        DetailComponent o = (DetailComponent) other_;
6532        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
6533          ;
6534      }
6535
6536      public boolean isEmpty() {
6537        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
6538          , productOrService, modifier, programCode, quantity, unitPrice, factor, net, udi
6539          , noteNumber, adjudication, subDetail);
6540      }
6541
6542  public String fhirType() {
6543    return "ExplanationOfBenefit.item.detail";
6544
6545  }
6546
6547  }
6548
6549    @Block()
6550    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
6551        /**
6552         * A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6553         */
6554        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
6555        @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." )
6556        protected PositiveIntType sequence;
6557
6558        /**
6559         * The type of revenue or cost center providing the product and/or service.
6560         */
6561        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
6562        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of revenue or cost center providing the product and/or service." )
6563        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
6564        protected CodeableConcept revenue;
6565
6566        /**
6567         * Code to identify the general type of benefits under which products and services are provided.
6568         */
6569        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
6570        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
6571        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
6572        protected CodeableConcept category;
6573
6574        /**
6575         * 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.
6576         */
6577        @Child(name = "productOrService", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
6578        @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." )
6579        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
6580        protected CodeableConcept productOrService;
6581
6582        /**
6583         * Item typification or modifiers codes to convey additional context for the product or service.
6584         */
6585        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6586        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
6587        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
6588        protected List<CodeableConcept> modifier;
6589
6590        /**
6591         * Identifies the program under which this may be recovered.
6592         */
6593        @Child(name = "programCode", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6594        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
6595        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
6596        protected List<CodeableConcept> programCode;
6597
6598        /**
6599         * The number of repetitions of a service or product.
6600         */
6601        @Child(name = "quantity", type = {Quantity.class}, order=7, min=0, max=1, modifier=false, summary=false)
6602        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
6603        protected Quantity quantity;
6604
6605        /**
6606         * 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.
6607         */
6608        @Child(name = "unitPrice", type = {Money.class}, order=8, min=0, max=1, modifier=false, summary=false)
6609        @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." )
6610        protected Money unitPrice;
6611
6612        /**
6613         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
6614         */
6615        @Child(name = "factor", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
6616        @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." )
6617        protected DecimalType factor;
6618
6619        /**
6620         * The quantity times the unit price for an additional service or product or charge.
6621         */
6622        @Child(name = "net", type = {Money.class}, order=10, min=0, max=1, modifier=false, summary=false)
6623        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
6624        protected Money net;
6625
6626        /**
6627         * Unique Device Identifiers associated with this line item.
6628         */
6629        @Child(name = "udi", type = {Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6630        @Description(shortDefinition="Unique device identifier", formalDefinition="Unique Device Identifiers associated with this line item." )
6631        protected List<Reference> udi;
6632
6633        /**
6634         * The numbers associated with notes below which apply to the adjudication of this item.
6635         */
6636        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6637        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
6638        protected List<PositiveIntType> noteNumber;
6639
6640        /**
6641         * The adjudication results.
6642         */
6643        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6644        @Description(shortDefinition="Subdetail level adjudication details", formalDefinition="The adjudication results." )
6645        protected List<AdjudicationComponent> adjudication;
6646
6647        private static final long serialVersionUID = -579551678L;
6648
6649    /**
6650     * Constructor
6651     */
6652      public SubDetailComponent() {
6653        super();
6654      }
6655
6656    /**
6657     * Constructor
6658     */
6659      public SubDetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
6660        super();
6661        this.sequence = sequence;
6662        this.productOrService = productOrService;
6663      }
6664
6665        /**
6666         * @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
6667         */
6668        public PositiveIntType getSequenceElement() { 
6669          if (this.sequence == null)
6670            if (Configuration.errorOnAutoCreate())
6671              throw new Error("Attempt to auto-create SubDetailComponent.sequence");
6672            else if (Configuration.doAutoCreate())
6673              this.sequence = new PositiveIntType(); // bb
6674          return this.sequence;
6675        }
6676
6677        public boolean hasSequenceElement() { 
6678          return this.sequence != null && !this.sequence.isEmpty();
6679        }
6680
6681        public boolean hasSequence() { 
6682          return this.sequence != null && !this.sequence.isEmpty();
6683        }
6684
6685        /**
6686         * @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
6687         */
6688        public SubDetailComponent setSequenceElement(PositiveIntType value) { 
6689          this.sequence = value;
6690          return this;
6691        }
6692
6693        /**
6694         * @return A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6695         */
6696        public int getSequence() { 
6697          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
6698        }
6699
6700        /**
6701         * @param value A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.
6702         */
6703        public SubDetailComponent setSequence(int value) { 
6704            if (this.sequence == null)
6705              this.sequence = new PositiveIntType();
6706            this.sequence.setValue(value);
6707          return this;
6708        }
6709
6710        /**
6711         * @return {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
6712         */
6713        public CodeableConcept getRevenue() { 
6714          if (this.revenue == null)
6715            if (Configuration.errorOnAutoCreate())
6716              throw new Error("Attempt to auto-create SubDetailComponent.revenue");
6717            else if (Configuration.doAutoCreate())
6718              this.revenue = new CodeableConcept(); // cc
6719          return this.revenue;
6720        }
6721
6722        public boolean hasRevenue() { 
6723          return this.revenue != null && !this.revenue.isEmpty();
6724        }
6725
6726        /**
6727         * @param value {@link #revenue} (The type of revenue or cost center providing the product and/or service.)
6728         */
6729        public SubDetailComponent setRevenue(CodeableConcept value) { 
6730          this.revenue = value;
6731          return this;
6732        }
6733
6734        /**
6735         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
6736         */
6737        public CodeableConcept getCategory() { 
6738          if (this.category == null)
6739            if (Configuration.errorOnAutoCreate())
6740              throw new Error("Attempt to auto-create SubDetailComponent.category");
6741            else if (Configuration.doAutoCreate())
6742              this.category = new CodeableConcept(); // cc
6743          return this.category;
6744        }
6745
6746        public boolean hasCategory() { 
6747          return this.category != null && !this.category.isEmpty();
6748        }
6749
6750        /**
6751         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
6752         */
6753        public SubDetailComponent setCategory(CodeableConcept value) { 
6754          this.category = value;
6755          return this;
6756        }
6757
6758        /**
6759         * @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.)
6760         */
6761        public CodeableConcept getProductOrService() { 
6762          if (this.productOrService == null)
6763            if (Configuration.errorOnAutoCreate())
6764              throw new Error("Attempt to auto-create SubDetailComponent.productOrService");
6765            else if (Configuration.doAutoCreate())
6766              this.productOrService = new CodeableConcept(); // cc
6767          return this.productOrService;
6768        }
6769
6770        public boolean hasProductOrService() { 
6771          return this.productOrService != null && !this.productOrService.isEmpty();
6772        }
6773
6774        /**
6775         * @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.)
6776         */
6777        public SubDetailComponent setProductOrService(CodeableConcept value) { 
6778          this.productOrService = value;
6779          return this;
6780        }
6781
6782        /**
6783         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
6784         */
6785        public List<CodeableConcept> getModifier() { 
6786          if (this.modifier == null)
6787            this.modifier = new ArrayList<CodeableConcept>();
6788          return this.modifier;
6789        }
6790
6791        /**
6792         * @return Returns a reference to <code>this</code> for easy method chaining
6793         */
6794        public SubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
6795          this.modifier = theModifier;
6796          return this;
6797        }
6798
6799        public boolean hasModifier() { 
6800          if (this.modifier == null)
6801            return false;
6802          for (CodeableConcept item : this.modifier)
6803            if (!item.isEmpty())
6804              return true;
6805          return false;
6806        }
6807
6808        public CodeableConcept addModifier() { //3
6809          CodeableConcept t = new CodeableConcept();
6810          if (this.modifier == null)
6811            this.modifier = new ArrayList<CodeableConcept>();
6812          this.modifier.add(t);
6813          return t;
6814        }
6815
6816        public SubDetailComponent addModifier(CodeableConcept t) { //3
6817          if (t == null)
6818            return this;
6819          if (this.modifier == null)
6820            this.modifier = new ArrayList<CodeableConcept>();
6821          this.modifier.add(t);
6822          return this;
6823        }
6824
6825        /**
6826         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
6827         */
6828        public CodeableConcept getModifierFirstRep() { 
6829          if (getModifier().isEmpty()) {
6830            addModifier();
6831          }
6832          return getModifier().get(0);
6833        }
6834
6835        /**
6836         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
6837         */
6838        public List<CodeableConcept> getProgramCode() { 
6839          if (this.programCode == null)
6840            this.programCode = new ArrayList<CodeableConcept>();
6841          return this.programCode;
6842        }
6843
6844        /**
6845         * @return Returns a reference to <code>this</code> for easy method chaining
6846         */
6847        public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
6848          this.programCode = theProgramCode;
6849          return this;
6850        }
6851
6852        public boolean hasProgramCode() { 
6853          if (this.programCode == null)
6854            return false;
6855          for (CodeableConcept item : this.programCode)
6856            if (!item.isEmpty())
6857              return true;
6858          return false;
6859        }
6860
6861        public CodeableConcept addProgramCode() { //3
6862          CodeableConcept t = new CodeableConcept();
6863          if (this.programCode == null)
6864            this.programCode = new ArrayList<CodeableConcept>();
6865          this.programCode.add(t);
6866          return t;
6867        }
6868
6869        public SubDetailComponent addProgramCode(CodeableConcept t) { //3
6870          if (t == null)
6871            return this;
6872          if (this.programCode == null)
6873            this.programCode = new ArrayList<CodeableConcept>();
6874          this.programCode.add(t);
6875          return this;
6876        }
6877
6878        /**
6879         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
6880         */
6881        public CodeableConcept getProgramCodeFirstRep() { 
6882          if (getProgramCode().isEmpty()) {
6883            addProgramCode();
6884          }
6885          return getProgramCode().get(0);
6886        }
6887
6888        /**
6889         * @return {@link #quantity} (The number of repetitions of a service or product.)
6890         */
6891        public Quantity getQuantity() { 
6892          if (this.quantity == null)
6893            if (Configuration.errorOnAutoCreate())
6894              throw new Error("Attempt to auto-create SubDetailComponent.quantity");
6895            else if (Configuration.doAutoCreate())
6896              this.quantity = new Quantity(); // cc
6897          return this.quantity;
6898        }
6899
6900        public boolean hasQuantity() { 
6901          return this.quantity != null && !this.quantity.isEmpty();
6902        }
6903
6904        /**
6905         * @param value {@link #quantity} (The number of repetitions of a service or product.)
6906         */
6907        public SubDetailComponent setQuantity(Quantity value) { 
6908          this.quantity = value;
6909          return this;
6910        }
6911
6912        /**
6913         * @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.)
6914         */
6915        public Money getUnitPrice() { 
6916          if (this.unitPrice == null)
6917            if (Configuration.errorOnAutoCreate())
6918              throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
6919            else if (Configuration.doAutoCreate())
6920              this.unitPrice = new Money(); // cc
6921          return this.unitPrice;
6922        }
6923
6924        public boolean hasUnitPrice() { 
6925          return this.unitPrice != null && !this.unitPrice.isEmpty();
6926        }
6927
6928        /**
6929         * @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.)
6930         */
6931        public SubDetailComponent setUnitPrice(Money value) { 
6932          this.unitPrice = value;
6933          return this;
6934        }
6935
6936        /**
6937         * @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
6938         */
6939        public DecimalType getFactorElement() { 
6940          if (this.factor == null)
6941            if (Configuration.errorOnAutoCreate())
6942              throw new Error("Attempt to auto-create SubDetailComponent.factor");
6943            else if (Configuration.doAutoCreate())
6944              this.factor = new DecimalType(); // bb
6945          return this.factor;
6946        }
6947
6948        public boolean hasFactorElement() { 
6949          return this.factor != null && !this.factor.isEmpty();
6950        }
6951
6952        public boolean hasFactor() { 
6953          return this.factor != null && !this.factor.isEmpty();
6954        }
6955
6956        /**
6957         * @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
6958         */
6959        public SubDetailComponent setFactorElement(DecimalType value) { 
6960          this.factor = value;
6961          return this;
6962        }
6963
6964        /**
6965         * @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.
6966         */
6967        public BigDecimal getFactor() { 
6968          return this.factor == null ? null : this.factor.getValue();
6969        }
6970
6971        /**
6972         * @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.
6973         */
6974        public SubDetailComponent setFactor(BigDecimal value) { 
6975          if (value == null)
6976            this.factor = null;
6977          else {
6978            if (this.factor == null)
6979              this.factor = new DecimalType();
6980            this.factor.setValue(value);
6981          }
6982          return this;
6983        }
6984
6985        /**
6986         * @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.
6987         */
6988        public SubDetailComponent setFactor(long value) { 
6989              this.factor = new DecimalType();
6990            this.factor.setValue(value);
6991          return this;
6992        }
6993
6994        /**
6995         * @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.
6996         */
6997        public SubDetailComponent setFactor(double value) { 
6998              this.factor = new DecimalType();
6999            this.factor.setValue(value);
7000          return this;
7001        }
7002
7003        /**
7004         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
7005         */
7006        public Money getNet() { 
7007          if (this.net == null)
7008            if (Configuration.errorOnAutoCreate())
7009              throw new Error("Attempt to auto-create SubDetailComponent.net");
7010            else if (Configuration.doAutoCreate())
7011              this.net = new Money(); // cc
7012          return this.net;
7013        }
7014
7015        public boolean hasNet() { 
7016          return this.net != null && !this.net.isEmpty();
7017        }
7018
7019        /**
7020         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
7021         */
7022        public SubDetailComponent setNet(Money value) { 
7023          this.net = value;
7024          return this;
7025        }
7026
7027        /**
7028         * @return {@link #udi} (Unique Device Identifiers associated with this line item.)
7029         */
7030        public List<Reference> getUdi() { 
7031          if (this.udi == null)
7032            this.udi = new ArrayList<Reference>();
7033          return this.udi;
7034        }
7035
7036        /**
7037         * @return Returns a reference to <code>this</code> for easy method chaining
7038         */
7039        public SubDetailComponent setUdi(List<Reference> theUdi) { 
7040          this.udi = theUdi;
7041          return this;
7042        }
7043
7044        public boolean hasUdi() { 
7045          if (this.udi == null)
7046            return false;
7047          for (Reference item : this.udi)
7048            if (!item.isEmpty())
7049              return true;
7050          return false;
7051        }
7052
7053        public Reference addUdi() { //3
7054          Reference t = new Reference();
7055          if (this.udi == null)
7056            this.udi = new ArrayList<Reference>();
7057          this.udi.add(t);
7058          return t;
7059        }
7060
7061        public SubDetailComponent addUdi(Reference t) { //3
7062          if (t == null)
7063            return this;
7064          if (this.udi == null)
7065            this.udi = new ArrayList<Reference>();
7066          this.udi.add(t);
7067          return this;
7068        }
7069
7070        /**
7071         * @return The first repetition of repeating field {@link #udi}, creating it if it does not already exist
7072         */
7073        public Reference getUdiFirstRep() { 
7074          if (getUdi().isEmpty()) {
7075            addUdi();
7076          }
7077          return getUdi().get(0);
7078        }
7079
7080        /**
7081         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7082         */
7083        public List<PositiveIntType> getNoteNumber() { 
7084          if (this.noteNumber == null)
7085            this.noteNumber = new ArrayList<PositiveIntType>();
7086          return this.noteNumber;
7087        }
7088
7089        /**
7090         * @return Returns a reference to <code>this</code> for easy method chaining
7091         */
7092        public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
7093          this.noteNumber = theNoteNumber;
7094          return this;
7095        }
7096
7097        public boolean hasNoteNumber() { 
7098          if (this.noteNumber == null)
7099            return false;
7100          for (PositiveIntType item : this.noteNumber)
7101            if (!item.isEmpty())
7102              return true;
7103          return false;
7104        }
7105
7106        /**
7107         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7108         */
7109        public PositiveIntType addNoteNumberElement() {//2 
7110          PositiveIntType t = new PositiveIntType();
7111          if (this.noteNumber == null)
7112            this.noteNumber = new ArrayList<PositiveIntType>();
7113          this.noteNumber.add(t);
7114          return t;
7115        }
7116
7117        /**
7118         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7119         */
7120        public SubDetailComponent addNoteNumber(int value) { //1
7121          PositiveIntType t = new PositiveIntType();
7122          t.setValue(value);
7123          if (this.noteNumber == null)
7124            this.noteNumber = new ArrayList<PositiveIntType>();
7125          this.noteNumber.add(t);
7126          return this;
7127        }
7128
7129        /**
7130         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
7131         */
7132        public boolean hasNoteNumber(int value) { 
7133          if (this.noteNumber == null)
7134            return false;
7135          for (PositiveIntType v : this.noteNumber)
7136            if (v.getValue().equals(value)) // positiveInt
7137              return true;
7138          return false;
7139        }
7140
7141        /**
7142         * @return {@link #adjudication} (The adjudication results.)
7143         */
7144        public List<AdjudicationComponent> getAdjudication() { 
7145          if (this.adjudication == null)
7146            this.adjudication = new ArrayList<AdjudicationComponent>();
7147          return this.adjudication;
7148        }
7149
7150        /**
7151         * @return Returns a reference to <code>this</code> for easy method chaining
7152         */
7153        public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
7154          this.adjudication = theAdjudication;
7155          return this;
7156        }
7157
7158        public boolean hasAdjudication() { 
7159          if (this.adjudication == null)
7160            return false;
7161          for (AdjudicationComponent item : this.adjudication)
7162            if (!item.isEmpty())
7163              return true;
7164          return false;
7165        }
7166
7167        public AdjudicationComponent addAdjudication() { //3
7168          AdjudicationComponent t = new AdjudicationComponent();
7169          if (this.adjudication == null)
7170            this.adjudication = new ArrayList<AdjudicationComponent>();
7171          this.adjudication.add(t);
7172          return t;
7173        }
7174
7175        public SubDetailComponent addAdjudication(AdjudicationComponent t) { //3
7176          if (t == null)
7177            return this;
7178          if (this.adjudication == null)
7179            this.adjudication = new ArrayList<AdjudicationComponent>();
7180          this.adjudication.add(t);
7181          return this;
7182        }
7183
7184        /**
7185         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
7186         */
7187        public AdjudicationComponent getAdjudicationFirstRep() { 
7188          if (getAdjudication().isEmpty()) {
7189            addAdjudication();
7190          }
7191          return getAdjudication().get(0);
7192        }
7193
7194        protected void listChildren(List<Property> children) {
7195          super.listChildren(children);
7196          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));
7197          children.add(new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
7198          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
7199          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));
7200          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));
7201          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
7202          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
7203          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));
7204          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));
7205          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
7206          children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi));
7207          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));
7208          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
7209        }
7210
7211        @Override
7212        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7213          switch (_hash) {
7214          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);
7215          case 1099842588: /*revenue*/  return new Property("revenue", "CodeableConcept", "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
7216          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);
7217          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);
7218          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);
7219          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
7220          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
7221          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);
7222          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);
7223          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);
7224          case 115642: /*udi*/  return new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
7225          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);
7226          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
7227          default: return super.getNamedProperty(_hash, _name, _checkValid);
7228          }
7229
7230        }
7231
7232      @Override
7233      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7234        switch (hash) {
7235        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
7236        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
7237        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
7238        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
7239        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7240        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
7241        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
7242        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
7243        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
7244        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
7245        case 115642: /*udi*/ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
7246        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
7247        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
7248        default: return super.getProperty(hash, name, checkValid);
7249        }
7250
7251      }
7252
7253      @Override
7254      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7255        switch (hash) {
7256        case 1349547969: // sequence
7257          this.sequence = castToPositiveInt(value); // PositiveIntType
7258          return value;
7259        case 1099842588: // revenue
7260          this.revenue = castToCodeableConcept(value); // CodeableConcept
7261          return value;
7262        case 50511102: // category
7263          this.category = castToCodeableConcept(value); // CodeableConcept
7264          return value;
7265        case 1957227299: // productOrService
7266          this.productOrService = castToCodeableConcept(value); // CodeableConcept
7267          return value;
7268        case -615513385: // modifier
7269          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
7270          return value;
7271        case 1010065041: // programCode
7272          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
7273          return value;
7274        case -1285004149: // quantity
7275          this.quantity = castToQuantity(value); // Quantity
7276          return value;
7277        case -486196699: // unitPrice
7278          this.unitPrice = castToMoney(value); // Money
7279          return value;
7280        case -1282148017: // factor
7281          this.factor = castToDecimal(value); // DecimalType
7282          return value;
7283        case 108957: // net
7284          this.net = castToMoney(value); // Money
7285          return value;
7286        case 115642: // udi
7287          this.getUdi().add(castToReference(value)); // Reference
7288          return value;
7289        case -1110033957: // noteNumber
7290          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
7291          return value;
7292        case -231349275: // adjudication
7293          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7294          return value;
7295        default: return super.setProperty(hash, name, value);
7296        }
7297
7298      }
7299
7300      @Override
7301      public Base setProperty(String name, Base value) throws FHIRException {
7302        if (name.equals("sequence")) {
7303          this.sequence = castToPositiveInt(value); // PositiveIntType
7304        } else if (name.equals("revenue")) {
7305          this.revenue = castToCodeableConcept(value); // CodeableConcept
7306        } else if (name.equals("category")) {
7307          this.category = castToCodeableConcept(value); // CodeableConcept
7308        } else if (name.equals("productOrService")) {
7309          this.productOrService = castToCodeableConcept(value); // CodeableConcept
7310        } else if (name.equals("modifier")) {
7311          this.getModifier().add(castToCodeableConcept(value));
7312        } else if (name.equals("programCode")) {
7313          this.getProgramCode().add(castToCodeableConcept(value));
7314        } else if (name.equals("quantity")) {
7315          this.quantity = castToQuantity(value); // Quantity
7316        } else if (name.equals("unitPrice")) {
7317          this.unitPrice = castToMoney(value); // Money
7318        } else if (name.equals("factor")) {
7319          this.factor = castToDecimal(value); // DecimalType
7320        } else if (name.equals("net")) {
7321          this.net = castToMoney(value); // Money
7322        } else if (name.equals("udi")) {
7323          this.getUdi().add(castToReference(value));
7324        } else if (name.equals("noteNumber")) {
7325          this.getNoteNumber().add(castToPositiveInt(value));
7326        } else if (name.equals("adjudication")) {
7327          this.getAdjudication().add((AdjudicationComponent) value);
7328        } else
7329          return super.setProperty(name, value);
7330        return value;
7331      }
7332
7333      @Override
7334      public Base makeProperty(int hash, String name) throws FHIRException {
7335        switch (hash) {
7336        case 1349547969:  return getSequenceElement();
7337        case 1099842588:  return getRevenue();
7338        case 50511102:  return getCategory();
7339        case 1957227299:  return getProductOrService();
7340        case -615513385:  return addModifier(); 
7341        case 1010065041:  return addProgramCode(); 
7342        case -1285004149:  return getQuantity();
7343        case -486196699:  return getUnitPrice();
7344        case -1282148017:  return getFactorElement();
7345        case 108957:  return getNet();
7346        case 115642:  return addUdi(); 
7347        case -1110033957:  return addNoteNumberElement();
7348        case -231349275:  return addAdjudication(); 
7349        default: return super.makeProperty(hash, name);
7350        }
7351
7352      }
7353
7354      @Override
7355      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7356        switch (hash) {
7357        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
7358        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
7359        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
7360        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
7361        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
7362        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
7363        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
7364        case -486196699: /*unitPrice*/ return new String[] {"Money"};
7365        case -1282148017: /*factor*/ return new String[] {"decimal"};
7366        case 108957: /*net*/ return new String[] {"Money"};
7367        case 115642: /*udi*/ return new String[] {"Reference"};
7368        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
7369        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
7370        default: return super.getTypesForProperty(hash, name);
7371        }
7372
7373      }
7374
7375      @Override
7376      public Base addChild(String name) throws FHIRException {
7377        if (name.equals("sequence")) {
7378          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.sequence");
7379        }
7380        else if (name.equals("revenue")) {
7381          this.revenue = new CodeableConcept();
7382          return this.revenue;
7383        }
7384        else if (name.equals("category")) {
7385          this.category = new CodeableConcept();
7386          return this.category;
7387        }
7388        else if (name.equals("productOrService")) {
7389          this.productOrService = new CodeableConcept();
7390          return this.productOrService;
7391        }
7392        else if (name.equals("modifier")) {
7393          return addModifier();
7394        }
7395        else if (name.equals("programCode")) {
7396          return addProgramCode();
7397        }
7398        else if (name.equals("quantity")) {
7399          this.quantity = new Quantity();
7400          return this.quantity;
7401        }
7402        else if (name.equals("unitPrice")) {
7403          this.unitPrice = new Money();
7404          return this.unitPrice;
7405        }
7406        else if (name.equals("factor")) {
7407          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
7408        }
7409        else if (name.equals("net")) {
7410          this.net = new Money();
7411          return this.net;
7412        }
7413        else if (name.equals("udi")) {
7414          return addUdi();
7415        }
7416        else if (name.equals("noteNumber")) {
7417          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
7418        }
7419        else if (name.equals("adjudication")) {
7420          return addAdjudication();
7421        }
7422        else
7423          return super.addChild(name);
7424      }
7425
7426      public SubDetailComponent copy() {
7427        SubDetailComponent dst = new SubDetailComponent();
7428        copyValues(dst);
7429        return dst;
7430      }
7431
7432      public void copyValues(SubDetailComponent dst) {
7433        super.copyValues(dst);
7434        dst.sequence = sequence == null ? null : sequence.copy();
7435        dst.revenue = revenue == null ? null : revenue.copy();
7436        dst.category = category == null ? null : category.copy();
7437        dst.productOrService = productOrService == null ? null : productOrService.copy();
7438        if (modifier != null) {
7439          dst.modifier = new ArrayList<CodeableConcept>();
7440          for (CodeableConcept i : modifier)
7441            dst.modifier.add(i.copy());
7442        };
7443        if (programCode != null) {
7444          dst.programCode = new ArrayList<CodeableConcept>();
7445          for (CodeableConcept i : programCode)
7446            dst.programCode.add(i.copy());
7447        };
7448        dst.quantity = quantity == null ? null : quantity.copy();
7449        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7450        dst.factor = factor == null ? null : factor.copy();
7451        dst.net = net == null ? null : net.copy();
7452        if (udi != null) {
7453          dst.udi = new ArrayList<Reference>();
7454          for (Reference i : udi)
7455            dst.udi.add(i.copy());
7456        };
7457        if (noteNumber != null) {
7458          dst.noteNumber = new ArrayList<PositiveIntType>();
7459          for (PositiveIntType i : noteNumber)
7460            dst.noteNumber.add(i.copy());
7461        };
7462        if (adjudication != null) {
7463          dst.adjudication = new ArrayList<AdjudicationComponent>();
7464          for (AdjudicationComponent i : adjudication)
7465            dst.adjudication.add(i.copy());
7466        };
7467      }
7468
7469      @Override
7470      public boolean equalsDeep(Base other_) {
7471        if (!super.equalsDeep(other_))
7472          return false;
7473        if (!(other_ instanceof SubDetailComponent))
7474          return false;
7475        SubDetailComponent o = (SubDetailComponent) other_;
7476        return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true)
7477           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
7478           && compareDeep(programCode, o.programCode, true) && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
7479           && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
7480           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
7481          ;
7482      }
7483
7484      @Override
7485      public boolean equalsShallow(Base other_) {
7486        if (!super.equalsShallow(other_))
7487          return false;
7488        if (!(other_ instanceof SubDetailComponent))
7489          return false;
7490        SubDetailComponent o = (SubDetailComponent) other_;
7491        return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true)
7492          ;
7493      }
7494
7495      public boolean isEmpty() {
7496        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category
7497          , productOrService, modifier, programCode, quantity, unitPrice, factor, net, udi
7498          , noteNumber, adjudication);
7499      }
7500
7501  public String fhirType() {
7502    return "ExplanationOfBenefit.item.detail.subDetail";
7503
7504  }
7505
7506  }
7507
7508    @Block()
7509    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
7510        /**
7511         * Claim items which this service line is intended to replace.
7512         */
7513        @Child(name = "itemSequence", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7514        @Description(shortDefinition="Item sequence number", formalDefinition="Claim items which this service line is intended to replace." )
7515        protected List<PositiveIntType> itemSequence;
7516
7517        /**
7518         * The sequence number of the details within the claim item which this line is intended to replace.
7519         */
7520        @Child(name = "detailSequence", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7521        @Description(shortDefinition="Detail sequence number", formalDefinition="The sequence number of the details within the claim item which this line is intended to replace." )
7522        protected List<PositiveIntType> detailSequence;
7523
7524        /**
7525         * The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.
7526         */
7527        @Child(name = "subDetailSequence", type = {PositiveIntType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7528        @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." )
7529        protected List<PositiveIntType> subDetailSequence;
7530
7531        /**
7532         * The providers who are authorized for the services rendered to the patient.
7533         */
7534        @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7535        @Description(shortDefinition="Authorized providers", formalDefinition="The providers who are authorized for the services rendered to the patient." )
7536        protected List<Reference> provider;
7537
7538        /**
7539         * 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.
7540         */
7541        @Child(name = "productOrService", type = {CodeableConcept.class}, order=5, min=1, max=1, modifier=false, summary=false)
7542        @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." )
7543        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
7544        protected CodeableConcept productOrService;
7545
7546        /**
7547         * Item typification or modifiers codes to convey additional context for the product or service.
7548         */
7549        @Child(name = "modifier", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7550        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
7551        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
7552        protected List<CodeableConcept> modifier;
7553
7554        /**
7555         * Identifies the program under which this may be recovered.
7556         */
7557        @Child(name = "programCode", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7558        @Description(shortDefinition="Program the product or service is provided under", formalDefinition="Identifies the program under which this may be recovered." )
7559        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-program-code")
7560        protected List<CodeableConcept> programCode;
7561
7562        /**
7563         * The date or dates when the service or product was supplied, performed or completed.
7564         */
7565        @Child(name = "serviced", type = {DateType.class, Period.class}, order=8, min=0, max=1, modifier=false, summary=false)
7566        @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." )
7567        protected Type serviced;
7568
7569        /**
7570         * Where the product or service was provided.
7571         */
7572        @Child(name = "location", type = {CodeableConcept.class, Address.class, Location.class}, order=9, min=0, max=1, modifier=false, summary=false)
7573        @Description(shortDefinition="Place of service or where product was supplied", formalDefinition="Where the product or service was provided." )
7574        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-place")
7575        protected Type location;
7576
7577        /**
7578         * The number of repetitions of a service or product.
7579         */
7580        @Child(name = "quantity", type = {Quantity.class}, order=10, min=0, max=1, modifier=false, summary=false)
7581        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
7582        protected Quantity quantity;
7583
7584        /**
7585         * 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.
7586         */
7587        @Child(name = "unitPrice", type = {Money.class}, order=11, min=0, max=1, modifier=false, summary=false)
7588        @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." )
7589        protected Money unitPrice;
7590
7591        /**
7592         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
7593         */
7594        @Child(name = "factor", type = {DecimalType.class}, order=12, min=0, max=1, modifier=false, summary=false)
7595        @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." )
7596        protected DecimalType factor;
7597
7598        /**
7599         * The quantity times the unit price for an additional service or product or charge.
7600         */
7601        @Child(name = "net", type = {Money.class}, order=13, min=0, max=1, modifier=false, summary=false)
7602        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
7603        protected Money net;
7604
7605        /**
7606         * Physical service site on the patient (limb, tooth, etc.).
7607         */
7608        @Child(name = "bodySite", type = {CodeableConcept.class}, order=14, min=0, max=1, modifier=false, summary=false)
7609        @Description(shortDefinition="Anatomical location", formalDefinition="Physical service site on the patient (limb, tooth, etc.)." )
7610        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/tooth")
7611        protected CodeableConcept bodySite;
7612
7613        /**
7614         * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
7615         */
7616        @Child(name = "subSite", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7617        @Description(shortDefinition="Anatomical sub-location", formalDefinition="A region or surface of the bodySite, e.g. limb region or tooth surface(s)." )
7618        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/surface")
7619        protected List<CodeableConcept> subSite;
7620
7621        /**
7622         * The numbers associated with notes below which apply to the adjudication of this item.
7623         */
7624        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7625        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
7626        protected List<PositiveIntType> noteNumber;
7627
7628        /**
7629         * The adjudication results.
7630         */
7631        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7632        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
7633        protected List<AdjudicationComponent> adjudication;
7634
7635        /**
7636         * The second-tier service adjudications for payor added services.
7637         */
7638        @Child(name = "detail", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
7639        @Description(shortDefinition="Insurer added line items", formalDefinition="The second-tier service adjudications for payor added services." )
7640        protected List<AddedItemDetailComponent> detail;
7641
7642        private static final long serialVersionUID = -1270390028L;
7643
7644    /**
7645     * Constructor
7646     */
7647      public AddedItemComponent() {
7648        super();
7649      }
7650
7651    /**
7652     * Constructor
7653     */
7654      public AddedItemComponent(CodeableConcept productOrService) {
7655        super();
7656        this.productOrService = productOrService;
7657      }
7658
7659        /**
7660         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
7661         */
7662        public List<PositiveIntType> getItemSequence() { 
7663          if (this.itemSequence == null)
7664            this.itemSequence = new ArrayList<PositiveIntType>();
7665          return this.itemSequence;
7666        }
7667
7668        /**
7669         * @return Returns a reference to <code>this</code> for easy method chaining
7670         */
7671        public AddedItemComponent setItemSequence(List<PositiveIntType> theItemSequence) { 
7672          this.itemSequence = theItemSequence;
7673          return this;
7674        }
7675
7676        public boolean hasItemSequence() { 
7677          if (this.itemSequence == null)
7678            return false;
7679          for (PositiveIntType item : this.itemSequence)
7680            if (!item.isEmpty())
7681              return true;
7682          return false;
7683        }
7684
7685        /**
7686         * @return {@link #itemSequence} (Claim items which this service line is intended to replace.)
7687         */
7688        public PositiveIntType addItemSequenceElement() {//2 
7689          PositiveIntType t = new PositiveIntType();
7690          if (this.itemSequence == null)
7691            this.itemSequence = new ArrayList<PositiveIntType>();
7692          this.itemSequence.add(t);
7693          return t;
7694        }
7695
7696        /**
7697         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
7698         */
7699        public AddedItemComponent addItemSequence(int value) { //1
7700          PositiveIntType t = new PositiveIntType();
7701          t.setValue(value);
7702          if (this.itemSequence == null)
7703            this.itemSequence = new ArrayList<PositiveIntType>();
7704          this.itemSequence.add(t);
7705          return this;
7706        }
7707
7708        /**
7709         * @param value {@link #itemSequence} (Claim items which this service line is intended to replace.)
7710         */
7711        public boolean hasItemSequence(int value) { 
7712          if (this.itemSequence == null)
7713            return false;
7714          for (PositiveIntType v : this.itemSequence)
7715            if (v.getValue().equals(value)) // positiveInt
7716              return true;
7717          return false;
7718        }
7719
7720        /**
7721         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7722         */
7723        public List<PositiveIntType> getDetailSequence() { 
7724          if (this.detailSequence == null)
7725            this.detailSequence = new ArrayList<PositiveIntType>();
7726          return this.detailSequence;
7727        }
7728
7729        /**
7730         * @return Returns a reference to <code>this</code> for easy method chaining
7731         */
7732        public AddedItemComponent setDetailSequence(List<PositiveIntType> theDetailSequence) { 
7733          this.detailSequence = theDetailSequence;
7734          return this;
7735        }
7736
7737        public boolean hasDetailSequence() { 
7738          if (this.detailSequence == null)
7739            return false;
7740          for (PositiveIntType item : this.detailSequence)
7741            if (!item.isEmpty())
7742              return true;
7743          return false;
7744        }
7745
7746        /**
7747         * @return {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7748         */
7749        public PositiveIntType addDetailSequenceElement() {//2 
7750          PositiveIntType t = new PositiveIntType();
7751          if (this.detailSequence == null)
7752            this.detailSequence = new ArrayList<PositiveIntType>();
7753          this.detailSequence.add(t);
7754          return t;
7755        }
7756
7757        /**
7758         * @param value {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7759         */
7760        public AddedItemComponent addDetailSequence(int value) { //1
7761          PositiveIntType t = new PositiveIntType();
7762          t.setValue(value);
7763          if (this.detailSequence == null)
7764            this.detailSequence = new ArrayList<PositiveIntType>();
7765          this.detailSequence.add(t);
7766          return this;
7767        }
7768
7769        /**
7770         * @param value {@link #detailSequence} (The sequence number of the details within the claim item which this line is intended to replace.)
7771         */
7772        public boolean hasDetailSequence(int value) { 
7773          if (this.detailSequence == null)
7774            return false;
7775          for (PositiveIntType v : this.detailSequence)
7776            if (v.getValue().equals(value)) // positiveInt
7777              return true;
7778          return false;
7779        }
7780
7781        /**
7782         * @return {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
7783         */
7784        public List<PositiveIntType> getSubDetailSequence() { 
7785          if (this.subDetailSequence == null)
7786            this.subDetailSequence = new ArrayList<PositiveIntType>();
7787          return this.subDetailSequence;
7788        }
7789
7790        /**
7791         * @return Returns a reference to <code>this</code> for easy method chaining
7792         */
7793        public AddedItemComponent setSubDetailSequence(List<PositiveIntType> theSubDetailSequence) { 
7794          this.subDetailSequence = theSubDetailSequence;
7795          return this;
7796        }
7797
7798        public boolean hasSubDetailSequence() { 
7799          if (this.subDetailSequence == null)
7800            return false;
7801          for (PositiveIntType item : this.subDetailSequence)
7802            if (!item.isEmpty())
7803              return true;
7804          return false;
7805        }
7806
7807        /**
7808         * @return {@link #subDetailSequence} (The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.)
7809         */
7810        public PositiveIntType addSubDetailSequenceElement() {//2 
7811          PositiveIntType t = new PositiveIntType();
7812          if (this.subDetailSequence == null)
7813            this.subDetailSequence = new ArrayList<PositiveIntType>();
7814          this.subDetailSequence.add(t);
7815          return t;
7816        }
7817
7818        /**
7819         * @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.)
7820         */
7821        public AddedItemComponent addSubDetailSequence(int value) { //1
7822          PositiveIntType t = new PositiveIntType();
7823          t.setValue(value);
7824          if (this.subDetailSequence == null)
7825            this.subDetailSequence = new ArrayList<PositiveIntType>();
7826          this.subDetailSequence.add(t);
7827          return this;
7828        }
7829
7830        /**
7831         * @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.)
7832         */
7833        public boolean hasSubDetailSequence(int value) { 
7834          if (this.subDetailSequence == null)
7835            return false;
7836          for (PositiveIntType v : this.subDetailSequence)
7837            if (v.getValue().equals(value)) // positiveInt
7838              return true;
7839          return false;
7840        }
7841
7842        /**
7843         * @return {@link #provider} (The providers who are authorized for the services rendered to the patient.)
7844         */
7845        public List<Reference> getProvider() { 
7846          if (this.provider == null)
7847            this.provider = new ArrayList<Reference>();
7848          return this.provider;
7849        }
7850
7851        /**
7852         * @return Returns a reference to <code>this</code> for easy method chaining
7853         */
7854        public AddedItemComponent setProvider(List<Reference> theProvider) { 
7855          this.provider = theProvider;
7856          return this;
7857        }
7858
7859        public boolean hasProvider() { 
7860          if (this.provider == null)
7861            return false;
7862          for (Reference item : this.provider)
7863            if (!item.isEmpty())
7864              return true;
7865          return false;
7866        }
7867
7868        public Reference addProvider() { //3
7869          Reference t = new Reference();
7870          if (this.provider == null)
7871            this.provider = new ArrayList<Reference>();
7872          this.provider.add(t);
7873          return t;
7874        }
7875
7876        public AddedItemComponent addProvider(Reference t) { //3
7877          if (t == null)
7878            return this;
7879          if (this.provider == null)
7880            this.provider = new ArrayList<Reference>();
7881          this.provider.add(t);
7882          return this;
7883        }
7884
7885        /**
7886         * @return The first repetition of repeating field {@link #provider}, creating it if it does not already exist
7887         */
7888        public Reference getProviderFirstRep() { 
7889          if (getProvider().isEmpty()) {
7890            addProvider();
7891          }
7892          return getProvider().get(0);
7893        }
7894
7895        /**
7896         * @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.)
7897         */
7898        public CodeableConcept getProductOrService() { 
7899          if (this.productOrService == null)
7900            if (Configuration.errorOnAutoCreate())
7901              throw new Error("Attempt to auto-create AddedItemComponent.productOrService");
7902            else if (Configuration.doAutoCreate())
7903              this.productOrService = new CodeableConcept(); // cc
7904          return this.productOrService;
7905        }
7906
7907        public boolean hasProductOrService() { 
7908          return this.productOrService != null && !this.productOrService.isEmpty();
7909        }
7910
7911        /**
7912         * @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.)
7913         */
7914        public AddedItemComponent setProductOrService(CodeableConcept value) { 
7915          this.productOrService = value;
7916          return this;
7917        }
7918
7919        /**
7920         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
7921         */
7922        public List<CodeableConcept> getModifier() { 
7923          if (this.modifier == null)
7924            this.modifier = new ArrayList<CodeableConcept>();
7925          return this.modifier;
7926        }
7927
7928        /**
7929         * @return Returns a reference to <code>this</code> for easy method chaining
7930         */
7931        public AddedItemComponent setModifier(List<CodeableConcept> theModifier) { 
7932          this.modifier = theModifier;
7933          return this;
7934        }
7935
7936        public boolean hasModifier() { 
7937          if (this.modifier == null)
7938            return false;
7939          for (CodeableConcept item : this.modifier)
7940            if (!item.isEmpty())
7941              return true;
7942          return false;
7943        }
7944
7945        public CodeableConcept addModifier() { //3
7946          CodeableConcept t = new CodeableConcept();
7947          if (this.modifier == null)
7948            this.modifier = new ArrayList<CodeableConcept>();
7949          this.modifier.add(t);
7950          return t;
7951        }
7952
7953        public AddedItemComponent addModifier(CodeableConcept t) { //3
7954          if (t == null)
7955            return this;
7956          if (this.modifier == null)
7957            this.modifier = new ArrayList<CodeableConcept>();
7958          this.modifier.add(t);
7959          return this;
7960        }
7961
7962        /**
7963         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
7964         */
7965        public CodeableConcept getModifierFirstRep() { 
7966          if (getModifier().isEmpty()) {
7967            addModifier();
7968          }
7969          return getModifier().get(0);
7970        }
7971
7972        /**
7973         * @return {@link #programCode} (Identifies the program under which this may be recovered.)
7974         */
7975        public List<CodeableConcept> getProgramCode() { 
7976          if (this.programCode == null)
7977            this.programCode = new ArrayList<CodeableConcept>();
7978          return this.programCode;
7979        }
7980
7981        /**
7982         * @return Returns a reference to <code>this</code> for easy method chaining
7983         */
7984        public AddedItemComponent setProgramCode(List<CodeableConcept> theProgramCode) { 
7985          this.programCode = theProgramCode;
7986          return this;
7987        }
7988
7989        public boolean hasProgramCode() { 
7990          if (this.programCode == null)
7991            return false;
7992          for (CodeableConcept item : this.programCode)
7993            if (!item.isEmpty())
7994              return true;
7995          return false;
7996        }
7997
7998        public CodeableConcept addProgramCode() { //3
7999          CodeableConcept t = new CodeableConcept();
8000          if (this.programCode == null)
8001            this.programCode = new ArrayList<CodeableConcept>();
8002          this.programCode.add(t);
8003          return t;
8004        }
8005
8006        public AddedItemComponent addProgramCode(CodeableConcept t) { //3
8007          if (t == null)
8008            return this;
8009          if (this.programCode == null)
8010            this.programCode = new ArrayList<CodeableConcept>();
8011          this.programCode.add(t);
8012          return this;
8013        }
8014
8015        /**
8016         * @return The first repetition of repeating field {@link #programCode}, creating it if it does not already exist
8017         */
8018        public CodeableConcept getProgramCodeFirstRep() { 
8019          if (getProgramCode().isEmpty()) {
8020            addProgramCode();
8021          }
8022          return getProgramCode().get(0);
8023        }
8024
8025        /**
8026         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8027         */
8028        public Type getServiced() { 
8029          return this.serviced;
8030        }
8031
8032        /**
8033         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8034         */
8035        public DateType getServicedDateType() throws FHIRException { 
8036          if (this.serviced == null)
8037            this.serviced = new DateType();
8038          if (!(this.serviced instanceof DateType))
8039            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.serviced.getClass().getName()+" was encountered");
8040          return (DateType) this.serviced;
8041        }
8042
8043        public boolean hasServicedDateType() { 
8044          return this != null && this.serviced instanceof DateType;
8045        }
8046
8047        /**
8048         * @return {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8049         */
8050        public Period getServicedPeriod() throws FHIRException { 
8051          if (this.serviced == null)
8052            this.serviced = new Period();
8053          if (!(this.serviced instanceof Period))
8054            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.serviced.getClass().getName()+" was encountered");
8055          return (Period) this.serviced;
8056        }
8057
8058        public boolean hasServicedPeriod() { 
8059          return this != null && this.serviced instanceof Period;
8060        }
8061
8062        public boolean hasServiced() { 
8063          return this.serviced != null && !this.serviced.isEmpty();
8064        }
8065
8066        /**
8067         * @param value {@link #serviced} (The date or dates when the service or product was supplied, performed or completed.)
8068         */
8069        public AddedItemComponent setServiced(Type value) { 
8070          if (value != null && !(value instanceof DateType || value instanceof Period))
8071            throw new Error("Not the right type for ExplanationOfBenefit.addItem.serviced[x]: "+value.fhirType());
8072          this.serviced = value;
8073          return this;
8074        }
8075
8076        /**
8077         * @return {@link #location} (Where the product or service was provided.)
8078         */
8079        public Type getLocation() { 
8080          return this.location;
8081        }
8082
8083        /**
8084         * @return {@link #location} (Where the product or service was provided.)
8085         */
8086        public CodeableConcept getLocationCodeableConcept() throws FHIRException { 
8087          if (this.location == null)
8088            this.location = new CodeableConcept();
8089          if (!(this.location instanceof CodeableConcept))
8090            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.location.getClass().getName()+" was encountered");
8091          return (CodeableConcept) this.location;
8092        }
8093
8094        public boolean hasLocationCodeableConcept() { 
8095          return this != null && this.location instanceof CodeableConcept;
8096        }
8097
8098        /**
8099         * @return {@link #location} (Where the product or service was provided.)
8100         */
8101        public Address getLocationAddress() throws FHIRException { 
8102          if (this.location == null)
8103            this.location = new Address();
8104          if (!(this.location instanceof Address))
8105            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.location.getClass().getName()+" was encountered");
8106          return (Address) this.location;
8107        }
8108
8109        public boolean hasLocationAddress() { 
8110          return this != null && this.location instanceof Address;
8111        }
8112
8113        /**
8114         * @return {@link #location} (Where the product or service was provided.)
8115         */
8116        public Reference getLocationReference() throws FHIRException { 
8117          if (this.location == null)
8118            this.location = new Reference();
8119          if (!(this.location instanceof Reference))
8120            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.location.getClass().getName()+" was encountered");
8121          return (Reference) this.location;
8122        }
8123
8124        public boolean hasLocationReference() { 
8125          return this != null && this.location instanceof Reference;
8126        }
8127
8128        public boolean hasLocation() { 
8129          return this.location != null && !this.location.isEmpty();
8130        }
8131
8132        /**
8133         * @param value {@link #location} (Where the product or service was provided.)
8134         */
8135        public AddedItemComponent setLocation(Type value) { 
8136          if (value != null && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
8137            throw new Error("Not the right type for ExplanationOfBenefit.addItem.location[x]: "+value.fhirType());
8138          this.location = value;
8139          return this;
8140        }
8141
8142        /**
8143         * @return {@link #quantity} (The number of repetitions of a service or product.)
8144         */
8145        public Quantity getQuantity() { 
8146          if (this.quantity == null)
8147            if (Configuration.errorOnAutoCreate())
8148              throw new Error("Attempt to auto-create AddedItemComponent.quantity");
8149            else if (Configuration.doAutoCreate())
8150              this.quantity = new Quantity(); // cc
8151          return this.quantity;
8152        }
8153
8154        public boolean hasQuantity() { 
8155          return this.quantity != null && !this.quantity.isEmpty();
8156        }
8157
8158        /**
8159         * @param value {@link #quantity} (The number of repetitions of a service or product.)
8160         */
8161        public AddedItemComponent setQuantity(Quantity value) { 
8162          this.quantity = value;
8163          return this;
8164        }
8165
8166        /**
8167         * @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.)
8168         */
8169        public Money getUnitPrice() { 
8170          if (this.unitPrice == null)
8171            if (Configuration.errorOnAutoCreate())
8172              throw new Error("Attempt to auto-create AddedItemComponent.unitPrice");
8173            else if (Configuration.doAutoCreate())
8174              this.unitPrice = new Money(); // cc
8175          return this.unitPrice;
8176        }
8177
8178        public boolean hasUnitPrice() { 
8179          return this.unitPrice != null && !this.unitPrice.isEmpty();
8180        }
8181
8182        /**
8183         * @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.)
8184         */
8185        public AddedItemComponent setUnitPrice(Money value) { 
8186          this.unitPrice = value;
8187          return this;
8188        }
8189
8190        /**
8191         * @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
8192         */
8193        public DecimalType getFactorElement() { 
8194          if (this.factor == null)
8195            if (Configuration.errorOnAutoCreate())
8196              throw new Error("Attempt to auto-create AddedItemComponent.factor");
8197            else if (Configuration.doAutoCreate())
8198              this.factor = new DecimalType(); // bb
8199          return this.factor;
8200        }
8201
8202        public boolean hasFactorElement() { 
8203          return this.factor != null && !this.factor.isEmpty();
8204        }
8205
8206        public boolean hasFactor() { 
8207          return this.factor != null && !this.factor.isEmpty();
8208        }
8209
8210        /**
8211         * @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
8212         */
8213        public AddedItemComponent setFactorElement(DecimalType value) { 
8214          this.factor = value;
8215          return this;
8216        }
8217
8218        /**
8219         * @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.
8220         */
8221        public BigDecimal getFactor() { 
8222          return this.factor == null ? null : this.factor.getValue();
8223        }
8224
8225        /**
8226         * @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.
8227         */
8228        public AddedItemComponent setFactor(BigDecimal value) { 
8229          if (value == null)
8230            this.factor = null;
8231          else {
8232            if (this.factor == null)
8233              this.factor = new DecimalType();
8234            this.factor.setValue(value);
8235          }
8236          return this;
8237        }
8238
8239        /**
8240         * @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.
8241         */
8242        public AddedItemComponent setFactor(long value) { 
8243              this.factor = new DecimalType();
8244            this.factor.setValue(value);
8245          return this;
8246        }
8247
8248        /**
8249         * @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.
8250         */
8251        public AddedItemComponent setFactor(double value) { 
8252              this.factor = new DecimalType();
8253            this.factor.setValue(value);
8254          return this;
8255        }
8256
8257        /**
8258         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8259         */
8260        public Money getNet() { 
8261          if (this.net == null)
8262            if (Configuration.errorOnAutoCreate())
8263              throw new Error("Attempt to auto-create AddedItemComponent.net");
8264            else if (Configuration.doAutoCreate())
8265              this.net = new Money(); // cc
8266          return this.net;
8267        }
8268
8269        public boolean hasNet() { 
8270          return this.net != null && !this.net.isEmpty();
8271        }
8272
8273        /**
8274         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
8275         */
8276        public AddedItemComponent setNet(Money value) { 
8277          this.net = value;
8278          return this;
8279        }
8280
8281        /**
8282         * @return {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
8283         */
8284        public CodeableConcept getBodySite() { 
8285          if (this.bodySite == null)
8286            if (Configuration.errorOnAutoCreate())
8287              throw new Error("Attempt to auto-create AddedItemComponent.bodySite");
8288            else if (Configuration.doAutoCreate())
8289              this.bodySite = new CodeableConcept(); // cc
8290          return this.bodySite;
8291        }
8292
8293        public boolean hasBodySite() { 
8294          return this.bodySite != null && !this.bodySite.isEmpty();
8295        }
8296
8297        /**
8298         * @param value {@link #bodySite} (Physical service site on the patient (limb, tooth, etc.).)
8299         */
8300        public AddedItemComponent setBodySite(CodeableConcept value) { 
8301          this.bodySite = value;
8302          return this;
8303        }
8304
8305        /**
8306         * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb region or tooth surface(s).)
8307         */
8308        public List<CodeableConcept> getSubSite() { 
8309          if (this.subSite == null)
8310            this.subSite = new ArrayList<CodeableConcept>();
8311          return this.subSite;
8312        }
8313
8314        /**
8315         * @return Returns a reference to <code>this</code> for easy method chaining
8316         */
8317        public AddedItemComponent setSubSite(List<CodeableConcept> theSubSite) { 
8318          this.subSite = theSubSite;
8319          return this;
8320        }
8321
8322        public boolean hasSubSite() { 
8323          if (this.subSite == null)
8324            return false;
8325          for (CodeableConcept item : this.subSite)
8326            if (!item.isEmpty())
8327              return true;
8328          return false;
8329        }
8330
8331        public CodeableConcept addSubSite() { //3
8332          CodeableConcept t = new CodeableConcept();
8333          if (this.subSite == null)
8334            this.subSite = new ArrayList<CodeableConcept>();
8335          this.subSite.add(t);
8336          return t;
8337        }
8338
8339        public AddedItemComponent addSubSite(CodeableConcept t) { //3
8340          if (t == null)
8341            return this;
8342          if (this.subSite == null)
8343            this.subSite = new ArrayList<CodeableConcept>();
8344          this.subSite.add(t);
8345          return this;
8346        }
8347
8348        /**
8349         * @return The first repetition of repeating field {@link #subSite}, creating it if it does not already exist
8350         */
8351        public CodeableConcept getSubSiteFirstRep() { 
8352          if (getSubSite().isEmpty()) {
8353            addSubSite();
8354          }
8355          return getSubSite().get(0);
8356        }
8357
8358        /**
8359         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8360         */
8361        public List<PositiveIntType> getNoteNumber() { 
8362          if (this.noteNumber == null)
8363            this.noteNumber = new ArrayList<PositiveIntType>();
8364          return this.noteNumber;
8365        }
8366
8367        /**
8368         * @return Returns a reference to <code>this</code> for easy method chaining
8369         */
8370        public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
8371          this.noteNumber = theNoteNumber;
8372          return this;
8373        }
8374
8375        public boolean hasNoteNumber() { 
8376          if (this.noteNumber == null)
8377            return false;
8378          for (PositiveIntType item : this.noteNumber)
8379            if (!item.isEmpty())
8380              return true;
8381          return false;
8382        }
8383
8384        /**
8385         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8386         */
8387        public PositiveIntType addNoteNumberElement() {//2 
8388          PositiveIntType t = new PositiveIntType();
8389          if (this.noteNumber == null)
8390            this.noteNumber = new ArrayList<PositiveIntType>();
8391          this.noteNumber.add(t);
8392          return t;
8393        }
8394
8395        /**
8396         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8397         */
8398        public AddedItemComponent addNoteNumber(int value) { //1
8399          PositiveIntType t = new PositiveIntType();
8400          t.setValue(value);
8401          if (this.noteNumber == null)
8402            this.noteNumber = new ArrayList<PositiveIntType>();
8403          this.noteNumber.add(t);
8404          return this;
8405        }
8406
8407        /**
8408         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
8409         */
8410        public boolean hasNoteNumber(int value) { 
8411          if (this.noteNumber == null)
8412            return false;
8413          for (PositiveIntType v : this.noteNumber)
8414            if (v.getValue().equals(value)) // positiveInt
8415              return true;
8416          return false;
8417        }
8418
8419        /**
8420         * @return {@link #adjudication} (The adjudication results.)
8421         */
8422        public List<AdjudicationComponent> getAdjudication() { 
8423          if (this.adjudication == null)
8424            this.adjudication = new ArrayList<AdjudicationComponent>();
8425          return this.adjudication;
8426        }
8427
8428        /**
8429         * @return Returns a reference to <code>this</code> for easy method chaining
8430         */
8431        public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
8432          this.adjudication = theAdjudication;
8433          return this;
8434        }
8435
8436        public boolean hasAdjudication() { 
8437          if (this.adjudication == null)
8438            return false;
8439          for (AdjudicationComponent item : this.adjudication)
8440            if (!item.isEmpty())
8441              return true;
8442          return false;
8443        }
8444
8445        public AdjudicationComponent addAdjudication() { //3
8446          AdjudicationComponent t = new AdjudicationComponent();
8447          if (this.adjudication == null)
8448            this.adjudication = new ArrayList<AdjudicationComponent>();
8449          this.adjudication.add(t);
8450          return t;
8451        }
8452
8453        public AddedItemComponent addAdjudication(AdjudicationComponent t) { //3
8454          if (t == null)
8455            return this;
8456          if (this.adjudication == null)
8457            this.adjudication = new ArrayList<AdjudicationComponent>();
8458          this.adjudication.add(t);
8459          return this;
8460        }
8461
8462        /**
8463         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
8464         */
8465        public AdjudicationComponent getAdjudicationFirstRep() { 
8466          if (getAdjudication().isEmpty()) {
8467            addAdjudication();
8468          }
8469          return getAdjudication().get(0);
8470        }
8471
8472        /**
8473         * @return {@link #detail} (The second-tier service adjudications for payor added services.)
8474         */
8475        public List<AddedItemDetailComponent> getDetail() { 
8476          if (this.detail == null)
8477            this.detail = new ArrayList<AddedItemDetailComponent>();
8478          return this.detail;
8479        }
8480
8481        /**
8482         * @return Returns a reference to <code>this</code> for easy method chaining
8483         */
8484        public AddedItemComponent setDetail(List<AddedItemDetailComponent> theDetail) { 
8485          this.detail = theDetail;
8486          return this;
8487        }
8488
8489        public boolean hasDetail() { 
8490          if (this.detail == null)
8491            return false;
8492          for (AddedItemDetailComponent item : this.detail)
8493            if (!item.isEmpty())
8494              return true;
8495          return false;
8496        }
8497
8498        public AddedItemDetailComponent addDetail() { //3
8499          AddedItemDetailComponent t = new AddedItemDetailComponent();
8500          if (this.detail == null)
8501            this.detail = new ArrayList<AddedItemDetailComponent>();
8502          this.detail.add(t);
8503          return t;
8504        }
8505
8506        public AddedItemComponent addDetail(AddedItemDetailComponent t) { //3
8507          if (t == null)
8508            return this;
8509          if (this.detail == null)
8510            this.detail = new ArrayList<AddedItemDetailComponent>();
8511          this.detail.add(t);
8512          return this;
8513        }
8514
8515        /**
8516         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
8517         */
8518        public AddedItemDetailComponent getDetailFirstRep() { 
8519          if (getDetail().isEmpty()) {
8520            addDetail();
8521          }
8522          return getDetail().get(0);
8523        }
8524
8525        protected void listChildren(List<Property> children) {
8526          super.listChildren(children);
8527          children.add(new Property("itemSequence", "positiveInt", "Claim items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, itemSequence));
8528          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));
8529          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));
8530          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));
8531          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));
8532          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));
8533          children.add(new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
8534          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));
8535          children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location));
8536          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
8537          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));
8538          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));
8539          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
8540          children.add(new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
8541          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));
8542          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));
8543          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
8544          children.add(new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail));
8545        }
8546
8547        @Override
8548        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8549          switch (_hash) {
8550          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);
8551          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);
8552          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);
8553          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);
8554          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);
8555          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);
8556          case 1010065041: /*programCode*/  return new Property("programCode", "CodeableConcept", "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
8557          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);
8558          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);
8559          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);
8560          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);
8561          case 552316075: /*location[x]*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8562          case 1901043637: /*location*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8563          case -1224800468: /*locationCodeableConcept*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8564          case -1280020865: /*locationAddress*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8565          case 755866390: /*locationReference*/  return new Property("location[x]", "CodeableConcept|Address|Reference(Location)", "Where the product or service was provided.", 0, 1, location);
8566          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
8567          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);
8568          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);
8569          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);
8570          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
8571          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);
8572          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);
8573          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
8574          case -1335224239: /*detail*/  return new Property("detail", "", "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail);
8575          default: return super.getNamedProperty(_hash, _name, _checkValid);
8576          }
8577
8578        }
8579
8580      @Override
8581      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8582        switch (hash) {
8583        case 1977979892: /*itemSequence*/ return this.itemSequence == null ? new Base[0] : this.itemSequence.toArray(new Base[this.itemSequence.size()]); // PositiveIntType
8584        case 1321472818: /*detailSequence*/ return this.detailSequence == null ? new Base[0] : this.detailSequence.toArray(new Base[this.detailSequence.size()]); // PositiveIntType
8585        case -855462510: /*subDetailSequence*/ return this.subDetailSequence == null ? new Base[0] : this.subDetailSequence.toArray(new Base[this.subDetailSequence.size()]); // PositiveIntType
8586        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : this.provider.toArray(new Base[this.provider.size()]); // Reference
8587        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
8588        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
8589        case 1010065041: /*programCode*/ return this.programCode == null ? new Base[0] : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
8590        case 1379209295: /*serviced*/ return this.serviced == null ? new Base[0] : new Base[] {this.serviced}; // Type
8591        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Type
8592        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
8593        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
8594        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
8595        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
8596        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
8597        case -1868566105: /*subSite*/ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
8598        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
8599        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
8600        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemDetailComponent
8601        default: return super.getProperty(hash, name, checkValid);
8602        }
8603
8604      }
8605
8606      @Override
8607      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8608        switch (hash) {
8609        case 1977979892: // itemSequence
8610          this.getItemSequence().add(castToPositiveInt(value)); // PositiveIntType
8611          return value;
8612        case 1321472818: // detailSequence
8613          this.getDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
8614          return value;
8615        case -855462510: // subDetailSequence
8616          this.getSubDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
8617          return value;
8618        case -987494927: // provider
8619          this.getProvider().add(castToReference(value)); // Reference
8620          return value;
8621        case 1957227299: // productOrService
8622          this.productOrService = castToCodeableConcept(value); // CodeableConcept
8623          return value;
8624        case -615513385: // modifier
8625          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
8626          return value;
8627        case 1010065041: // programCode
8628          this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
8629          return value;
8630        case 1379209295: // serviced
8631          this.serviced = castToType(value); // Type
8632          return value;
8633        case 1901043637: // location
8634          this.location = castToType(value); // Type
8635          return value;
8636        case -1285004149: // quantity
8637          this.quantity = castToQuantity(value); // Quantity
8638          return value;
8639        case -486196699: // unitPrice
8640          this.unitPrice = castToMoney(value); // Money
8641          return value;
8642        case -1282148017: // factor
8643          this.factor = castToDecimal(value); // DecimalType
8644          return value;
8645        case 108957: // net
8646          this.net = castToMoney(value); // Money
8647          return value;
8648        case 1702620169: // bodySite
8649          this.bodySite = castToCodeableConcept(value); // CodeableConcept
8650          return value;
8651        case -1868566105: // subSite
8652          this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
8653          return value;
8654        case -1110033957: // noteNumber
8655          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
8656          return value;
8657        case -231349275: // adjudication
8658          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
8659          return value;
8660        case -1335224239: // detail
8661          this.getDetail().add((AddedItemDetailComponent) value); // AddedItemDetailComponent
8662          return value;
8663        default: return super.setProperty(hash, name, value);
8664        }
8665
8666      }
8667
8668      @Override
8669      public Base setProperty(String name, Base value) throws FHIRException {
8670        if (name.equals("itemSequence")) {
8671          this.getItemSequence().add(castToPositiveInt(value));
8672        } else if (name.equals("detailSequence")) {
8673          this.getDetailSequence().add(castToPositiveInt(value));
8674        } else if (name.equals("subDetailSequence")) {
8675          this.getSubDetailSequence().add(castToPositiveInt(value));
8676        } else if (name.equals("provider")) {
8677          this.getProvider().add(castToReference(value));
8678        } else if (name.equals("productOrService")) {
8679          this.productOrService = castToCodeableConcept(value); // CodeableConcept
8680        } else if (name.equals("modifier")) {
8681          this.getModifier().add(castToCodeableConcept(value));
8682        } else if (name.equals("programCode")) {
8683          this.getProgramCode().add(castToCodeableConcept(value));
8684        } else if (name.equals("serviced[x]")) {
8685          this.serviced = castToType(value); // Type
8686        } else if (name.equals("location[x]")) {
8687          this.location = castToType(value); // Type
8688        } else if (name.equals("quantity")) {
8689          this.quantity = castToQuantity(value); // Quantity
8690        } else if (name.equals("unitPrice")) {
8691          this.unitPrice = castToMoney(value); // Money
8692        } else if (name.equals("factor")) {
8693          this.factor = castToDecimal(value); // DecimalType
8694        } else if (name.equals("net")) {
8695          this.net = castToMoney(value); // Money
8696        } else if (name.equals("bodySite")) {
8697          this.bodySite = castToCodeableConcept(value); // CodeableConcept
8698        } else if (name.equals("subSite")) {
8699          this.getSubSite().add(castToCodeableConcept(value));
8700        } else if (name.equals("noteNumber")) {
8701          this.getNoteNumber().add(castToPositiveInt(value));
8702        } else if (name.equals("adjudication")) {
8703          this.getAdjudication().add((AdjudicationComponent) value);
8704        } else if (name.equals("detail")) {
8705          this.getDetail().add((AddedItemDetailComponent) value);
8706        } else
8707          return super.setProperty(name, value);
8708        return value;
8709      }
8710
8711      @Override
8712      public Base makeProperty(int hash, String name) throws FHIRException {
8713        switch (hash) {
8714        case 1977979892:  return addItemSequenceElement();
8715        case 1321472818:  return addDetailSequenceElement();
8716        case -855462510:  return addSubDetailSequenceElement();
8717        case -987494927:  return addProvider(); 
8718        case 1957227299:  return getProductOrService();
8719        case -615513385:  return addModifier(); 
8720        case 1010065041:  return addProgramCode(); 
8721        case -1927922223:  return getServiced();
8722        case 1379209295:  return getServiced();
8723        case 552316075:  return getLocation();
8724        case 1901043637:  return getLocation();
8725        case -1285004149:  return getQuantity();
8726        case -486196699:  return getUnitPrice();
8727        case -1282148017:  return getFactorElement();
8728        case 108957:  return getNet();
8729        case 1702620169:  return getBodySite();
8730        case -1868566105:  return addSubSite(); 
8731        case -1110033957:  return addNoteNumberElement();
8732        case -231349275:  return addAdjudication(); 
8733        case -1335224239:  return addDetail(); 
8734        default: return super.makeProperty(hash, name);
8735        }
8736
8737      }
8738
8739      @Override
8740      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8741        switch (hash) {
8742        case 1977979892: /*itemSequence*/ return new String[] {"positiveInt"};
8743        case 1321472818: /*detailSequence*/ return new String[] {"positiveInt"};
8744        case -855462510: /*subDetailSequence*/ return new String[] {"positiveInt"};
8745        case -987494927: /*provider*/ return new String[] {"Reference"};
8746        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
8747        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
8748        case 1010065041: /*programCode*/ return new String[] {"CodeableConcept"};
8749        case 1379209295: /*serviced*/ return new String[] {"date", "Period"};
8750        case 1901043637: /*location*/ return new String[] {"CodeableConcept", "Address", "Reference"};
8751        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
8752        case -486196699: /*unitPrice*/ return new String[] {"Money"};
8753        case -1282148017: /*factor*/ return new String[] {"decimal"};
8754        case 108957: /*net*/ return new String[] {"Money"};
8755        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
8756        case -1868566105: /*subSite*/ return new String[] {"CodeableConcept"};
8757        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
8758        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
8759        case -1335224239: /*detail*/ return new String[] {};
8760        default: return super.getTypesForProperty(hash, name);
8761        }
8762
8763      }
8764
8765      @Override
8766      public Base addChild(String name) throws FHIRException {
8767        if (name.equals("itemSequence")) {
8768          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.itemSequence");
8769        }
8770        else if (name.equals("detailSequence")) {
8771          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.detailSequence");
8772        }
8773        else if (name.equals("subDetailSequence")) {
8774          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.subDetailSequence");
8775        }
8776        else if (name.equals("provider")) {
8777          return addProvider();
8778        }
8779        else if (name.equals("productOrService")) {
8780          this.productOrService = new CodeableConcept();
8781          return this.productOrService;
8782        }
8783        else if (name.equals("modifier")) {
8784          return addModifier();
8785        }
8786        else if (name.equals("programCode")) {
8787          return addProgramCode();
8788        }
8789        else if (name.equals("servicedDate")) {
8790          this.serviced = new DateType();
8791          return this.serviced;
8792        }
8793        else if (name.equals("servicedPeriod")) {
8794          this.serviced = new Period();
8795          return this.serviced;
8796        }
8797        else if (name.equals("locationCodeableConcept")) {
8798          this.location = new CodeableConcept();
8799          return this.location;
8800        }
8801        else if (name.equals("locationAddress")) {
8802          this.location = new Address();
8803          return this.location;
8804        }
8805        else if (name.equals("locationReference")) {
8806          this.location = new Reference();
8807          return this.location;
8808        }
8809        else if (name.equals("quantity")) {
8810          this.quantity = new Quantity();
8811          return this.quantity;
8812        }
8813        else if (name.equals("unitPrice")) {
8814          this.unitPrice = new Money();
8815          return this.unitPrice;
8816        }
8817        else if (name.equals("factor")) {
8818          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
8819        }
8820        else if (name.equals("net")) {
8821          this.net = new Money();
8822          return this.net;
8823        }
8824        else if (name.equals("bodySite")) {
8825          this.bodySite = new CodeableConcept();
8826          return this.bodySite;
8827        }
8828        else if (name.equals("subSite")) {
8829          return addSubSite();
8830        }
8831        else if (name.equals("noteNumber")) {
8832          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
8833        }
8834        else if (name.equals("adjudication")) {
8835          return addAdjudication();
8836        }
8837        else if (name.equals("detail")) {
8838          return addDetail();
8839        }
8840        else
8841          return super.addChild(name);
8842      }
8843
8844      public AddedItemComponent copy() {
8845        AddedItemComponent dst = new AddedItemComponent();
8846        copyValues(dst);
8847        return dst;
8848      }
8849
8850      public void copyValues(AddedItemComponent dst) {
8851        super.copyValues(dst);
8852        if (itemSequence != null) {
8853          dst.itemSequence = new ArrayList<PositiveIntType>();
8854          for (PositiveIntType i : itemSequence)
8855            dst.itemSequence.add(i.copy());
8856        };
8857        if (detailSequence != null) {
8858          dst.detailSequence = new ArrayList<PositiveIntType>();
8859          for (PositiveIntType i : detailSequence)
8860            dst.detailSequence.add(i.copy());
8861        };
8862        if (subDetailSequence != null) {
8863          dst.subDetailSequence = new ArrayList<PositiveIntType>();
8864          for (PositiveIntType i : subDetailSequence)
8865            dst.subDetailSequence.add(i.copy());
8866        };
8867        if (provider != null) {
8868          dst.provider = new ArrayList<Reference>();
8869          for (Reference i : provider)
8870            dst.provider.add(i.copy());
8871        };
8872        dst.productOrService = productOrService == null ? null : productOrService.copy();
8873        if (modifier != null) {
8874          dst.modifier = new ArrayList<CodeableConcept>();
8875          for (CodeableConcept i : modifier)
8876            dst.modifier.add(i.copy());
8877        };
8878        if (programCode != null) {
8879          dst.programCode = new ArrayList<CodeableConcept>();
8880          for (CodeableConcept i : programCode)
8881            dst.programCode.add(i.copy());
8882        };
8883        dst.serviced = serviced == null ? null : serviced.copy();
8884        dst.location = location == null ? null : location.copy();
8885        dst.quantity = quantity == null ? null : quantity.copy();
8886        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
8887        dst.factor = factor == null ? null : factor.copy();
8888        dst.net = net == null ? null : net.copy();
8889        dst.bodySite = bodySite == null ? null : bodySite.copy();
8890        if (subSite != null) {
8891          dst.subSite = new ArrayList<CodeableConcept>();
8892          for (CodeableConcept i : subSite)
8893            dst.subSite.add(i.copy());
8894        };
8895        if (noteNumber != null) {
8896          dst.noteNumber = new ArrayList<PositiveIntType>();
8897          for (PositiveIntType i : noteNumber)
8898            dst.noteNumber.add(i.copy());
8899        };
8900        if (adjudication != null) {
8901          dst.adjudication = new ArrayList<AdjudicationComponent>();
8902          for (AdjudicationComponent i : adjudication)
8903            dst.adjudication.add(i.copy());
8904        };
8905        if (detail != null) {
8906          dst.detail = new ArrayList<AddedItemDetailComponent>();
8907          for (AddedItemDetailComponent i : detail)
8908            dst.detail.add(i.copy());
8909        };
8910      }
8911
8912      @Override
8913      public boolean equalsDeep(Base other_) {
8914        if (!super.equalsDeep(other_))
8915          return false;
8916        if (!(other_ instanceof AddedItemComponent))
8917          return false;
8918        AddedItemComponent o = (AddedItemComponent) other_;
8919        return compareDeep(itemSequence, o.itemSequence, true) && compareDeep(detailSequence, o.detailSequence, true)
8920           && compareDeep(subDetailSequence, o.subDetailSequence, true) && compareDeep(provider, o.provider, true)
8921           && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
8922           && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
8923           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
8924           && compareDeep(net, o.net, true) && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true)
8925           && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
8926           && compareDeep(detail, o.detail, true);
8927      }
8928
8929      @Override
8930      public boolean equalsShallow(Base other_) {
8931        if (!super.equalsShallow(other_))
8932          return false;
8933        if (!(other_ instanceof AddedItemComponent))
8934          return false;
8935        AddedItemComponent o = (AddedItemComponent) other_;
8936        return compareValues(itemSequence, o.itemSequence, true) && compareValues(detailSequence, o.detailSequence, true)
8937           && compareValues(subDetailSequence, o.subDetailSequence, true) && compareValues(factor, o.factor, true)
8938           && compareValues(noteNumber, o.noteNumber, true);
8939      }
8940
8941      public boolean isEmpty() {
8942        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(itemSequence, detailSequence
8943          , subDetailSequence, provider, productOrService, modifier, programCode, serviced
8944          , location, quantity, unitPrice, factor, net, bodySite, subSite, noteNumber
8945          , adjudication, detail);
8946      }
8947
8948  public String fhirType() {
8949    return "ExplanationOfBenefit.addItem";
8950
8951  }
8952
8953  }
8954
8955    @Block()
8956    public static class AddedItemDetailComponent extends BackboneElement implements IBaseBackboneElement {
8957        /**
8958         * 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.
8959         */
8960        @Child(name = "productOrService", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
8961        @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." )
8962        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
8963        protected CodeableConcept productOrService;
8964
8965        /**
8966         * Item typification or modifiers codes to convey additional context for the product or service.
8967         */
8968        @Child(name = "modifier", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
8969        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
8970        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
8971        protected List<CodeableConcept> modifier;
8972
8973        /**
8974         * The number of repetitions of a service or product.
8975         */
8976        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
8977        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
8978        protected Quantity quantity;
8979
8980        /**
8981         * 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.
8982         */
8983        @Child(name = "unitPrice", type = {Money.class}, order=4, min=0, max=1, modifier=false, summary=false)
8984        @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." )
8985        protected Money unitPrice;
8986
8987        /**
8988         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
8989         */
8990        @Child(name = "factor", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=false)
8991        @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." )
8992        protected DecimalType factor;
8993
8994        /**
8995         * The quantity times the unit price for an additional service or product or charge.
8996         */
8997        @Child(name = "net", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
8998        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
8999        protected Money net;
9000
9001        /**
9002         * The numbers associated with notes below which apply to the adjudication of this item.
9003         */
9004        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9005        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
9006        protected List<PositiveIntType> noteNumber;
9007
9008        /**
9009         * The adjudication results.
9010         */
9011        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9012        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
9013        protected List<AdjudicationComponent> adjudication;
9014
9015        /**
9016         * The third-tier service adjudications for payor added services.
9017         */
9018        @Child(name = "subDetail", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9019        @Description(shortDefinition="Insurer added line items", formalDefinition="The third-tier service adjudications for payor added services." )
9020        protected List<AddedItemDetailSubDetailComponent> subDetail;
9021
9022        private static final long serialVersionUID = 295910869L;
9023
9024    /**
9025     * Constructor
9026     */
9027      public AddedItemDetailComponent() {
9028        super();
9029      }
9030
9031    /**
9032     * Constructor
9033     */
9034      public AddedItemDetailComponent(CodeableConcept productOrService) {
9035        super();
9036        this.productOrService = productOrService;
9037      }
9038
9039        /**
9040         * @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.)
9041         */
9042        public CodeableConcept getProductOrService() { 
9043          if (this.productOrService == null)
9044            if (Configuration.errorOnAutoCreate())
9045              throw new Error("Attempt to auto-create AddedItemDetailComponent.productOrService");
9046            else if (Configuration.doAutoCreate())
9047              this.productOrService = new CodeableConcept(); // cc
9048          return this.productOrService;
9049        }
9050
9051        public boolean hasProductOrService() { 
9052          return this.productOrService != null && !this.productOrService.isEmpty();
9053        }
9054
9055        /**
9056         * @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.)
9057         */
9058        public AddedItemDetailComponent setProductOrService(CodeableConcept value) { 
9059          this.productOrService = value;
9060          return this;
9061        }
9062
9063        /**
9064         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
9065         */
9066        public List<CodeableConcept> getModifier() { 
9067          if (this.modifier == null)
9068            this.modifier = new ArrayList<CodeableConcept>();
9069          return this.modifier;
9070        }
9071
9072        /**
9073         * @return Returns a reference to <code>this</code> for easy method chaining
9074         */
9075        public AddedItemDetailComponent setModifier(List<CodeableConcept> theModifier) { 
9076          this.modifier = theModifier;
9077          return this;
9078        }
9079
9080        public boolean hasModifier() { 
9081          if (this.modifier == null)
9082            return false;
9083          for (CodeableConcept item : this.modifier)
9084            if (!item.isEmpty())
9085              return true;
9086          return false;
9087        }
9088
9089        public CodeableConcept addModifier() { //3
9090          CodeableConcept t = new CodeableConcept();
9091          if (this.modifier == null)
9092            this.modifier = new ArrayList<CodeableConcept>();
9093          this.modifier.add(t);
9094          return t;
9095        }
9096
9097        public AddedItemDetailComponent addModifier(CodeableConcept t) { //3
9098          if (t == null)
9099            return this;
9100          if (this.modifier == null)
9101            this.modifier = new ArrayList<CodeableConcept>();
9102          this.modifier.add(t);
9103          return this;
9104        }
9105
9106        /**
9107         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
9108         */
9109        public CodeableConcept getModifierFirstRep() { 
9110          if (getModifier().isEmpty()) {
9111            addModifier();
9112          }
9113          return getModifier().get(0);
9114        }
9115
9116        /**
9117         * @return {@link #quantity} (The number of repetitions of a service or product.)
9118         */
9119        public Quantity getQuantity() { 
9120          if (this.quantity == null)
9121            if (Configuration.errorOnAutoCreate())
9122              throw new Error("Attempt to auto-create AddedItemDetailComponent.quantity");
9123            else if (Configuration.doAutoCreate())
9124              this.quantity = new Quantity(); // cc
9125          return this.quantity;
9126        }
9127
9128        public boolean hasQuantity() { 
9129          return this.quantity != null && !this.quantity.isEmpty();
9130        }
9131
9132        /**
9133         * @param value {@link #quantity} (The number of repetitions of a service or product.)
9134         */
9135        public AddedItemDetailComponent setQuantity(Quantity value) { 
9136          this.quantity = value;
9137          return this;
9138        }
9139
9140        /**
9141         * @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.)
9142         */
9143        public Money getUnitPrice() { 
9144          if (this.unitPrice == null)
9145            if (Configuration.errorOnAutoCreate())
9146              throw new Error("Attempt to auto-create AddedItemDetailComponent.unitPrice");
9147            else if (Configuration.doAutoCreate())
9148              this.unitPrice = new Money(); // cc
9149          return this.unitPrice;
9150        }
9151
9152        public boolean hasUnitPrice() { 
9153          return this.unitPrice != null && !this.unitPrice.isEmpty();
9154        }
9155
9156        /**
9157         * @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.)
9158         */
9159        public AddedItemDetailComponent setUnitPrice(Money value) { 
9160          this.unitPrice = value;
9161          return this;
9162        }
9163
9164        /**
9165         * @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
9166         */
9167        public DecimalType getFactorElement() { 
9168          if (this.factor == null)
9169            if (Configuration.errorOnAutoCreate())
9170              throw new Error("Attempt to auto-create AddedItemDetailComponent.factor");
9171            else if (Configuration.doAutoCreate())
9172              this.factor = new DecimalType(); // bb
9173          return this.factor;
9174        }
9175
9176        public boolean hasFactorElement() { 
9177          return this.factor != null && !this.factor.isEmpty();
9178        }
9179
9180        public boolean hasFactor() { 
9181          return this.factor != null && !this.factor.isEmpty();
9182        }
9183
9184        /**
9185         * @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
9186         */
9187        public AddedItemDetailComponent setFactorElement(DecimalType value) { 
9188          this.factor = value;
9189          return this;
9190        }
9191
9192        /**
9193         * @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.
9194         */
9195        public BigDecimal getFactor() { 
9196          return this.factor == null ? null : this.factor.getValue();
9197        }
9198
9199        /**
9200         * @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.
9201         */
9202        public AddedItemDetailComponent setFactor(BigDecimal value) { 
9203          if (value == null)
9204            this.factor = null;
9205          else {
9206            if (this.factor == null)
9207              this.factor = new DecimalType();
9208            this.factor.setValue(value);
9209          }
9210          return this;
9211        }
9212
9213        /**
9214         * @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.
9215         */
9216        public AddedItemDetailComponent setFactor(long value) { 
9217              this.factor = new DecimalType();
9218            this.factor.setValue(value);
9219          return this;
9220        }
9221
9222        /**
9223         * @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.
9224         */
9225        public AddedItemDetailComponent setFactor(double value) { 
9226              this.factor = new DecimalType();
9227            this.factor.setValue(value);
9228          return this;
9229        }
9230
9231        /**
9232         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9233         */
9234        public Money getNet() { 
9235          if (this.net == null)
9236            if (Configuration.errorOnAutoCreate())
9237              throw new Error("Attempt to auto-create AddedItemDetailComponent.net");
9238            else if (Configuration.doAutoCreate())
9239              this.net = new Money(); // cc
9240          return this.net;
9241        }
9242
9243        public boolean hasNet() { 
9244          return this.net != null && !this.net.isEmpty();
9245        }
9246
9247        /**
9248         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9249         */
9250        public AddedItemDetailComponent setNet(Money value) { 
9251          this.net = value;
9252          return this;
9253        }
9254
9255        /**
9256         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9257         */
9258        public List<PositiveIntType> getNoteNumber() { 
9259          if (this.noteNumber == null)
9260            this.noteNumber = new ArrayList<PositiveIntType>();
9261          return this.noteNumber;
9262        }
9263
9264        /**
9265         * @return Returns a reference to <code>this</code> for easy method chaining
9266         */
9267        public AddedItemDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
9268          this.noteNumber = theNoteNumber;
9269          return this;
9270        }
9271
9272        public boolean hasNoteNumber() { 
9273          if (this.noteNumber == null)
9274            return false;
9275          for (PositiveIntType item : this.noteNumber)
9276            if (!item.isEmpty())
9277              return true;
9278          return false;
9279        }
9280
9281        /**
9282         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9283         */
9284        public PositiveIntType addNoteNumberElement() {//2 
9285          PositiveIntType t = new PositiveIntType();
9286          if (this.noteNumber == null)
9287            this.noteNumber = new ArrayList<PositiveIntType>();
9288          this.noteNumber.add(t);
9289          return t;
9290        }
9291
9292        /**
9293         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9294         */
9295        public AddedItemDetailComponent addNoteNumber(int value) { //1
9296          PositiveIntType t = new PositiveIntType();
9297          t.setValue(value);
9298          if (this.noteNumber == null)
9299            this.noteNumber = new ArrayList<PositiveIntType>();
9300          this.noteNumber.add(t);
9301          return this;
9302        }
9303
9304        /**
9305         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9306         */
9307        public boolean hasNoteNumber(int value) { 
9308          if (this.noteNumber == null)
9309            return false;
9310          for (PositiveIntType v : this.noteNumber)
9311            if (v.getValue().equals(value)) // positiveInt
9312              return true;
9313          return false;
9314        }
9315
9316        /**
9317         * @return {@link #adjudication} (The adjudication results.)
9318         */
9319        public List<AdjudicationComponent> getAdjudication() { 
9320          if (this.adjudication == null)
9321            this.adjudication = new ArrayList<AdjudicationComponent>();
9322          return this.adjudication;
9323        }
9324
9325        /**
9326         * @return Returns a reference to <code>this</code> for easy method chaining
9327         */
9328        public AddedItemDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
9329          this.adjudication = theAdjudication;
9330          return this;
9331        }
9332
9333        public boolean hasAdjudication() { 
9334          if (this.adjudication == null)
9335            return false;
9336          for (AdjudicationComponent item : this.adjudication)
9337            if (!item.isEmpty())
9338              return true;
9339          return false;
9340        }
9341
9342        public AdjudicationComponent addAdjudication() { //3
9343          AdjudicationComponent t = new AdjudicationComponent();
9344          if (this.adjudication == null)
9345            this.adjudication = new ArrayList<AdjudicationComponent>();
9346          this.adjudication.add(t);
9347          return t;
9348        }
9349
9350        public AddedItemDetailComponent addAdjudication(AdjudicationComponent t) { //3
9351          if (t == null)
9352            return this;
9353          if (this.adjudication == null)
9354            this.adjudication = new ArrayList<AdjudicationComponent>();
9355          this.adjudication.add(t);
9356          return this;
9357        }
9358
9359        /**
9360         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
9361         */
9362        public AdjudicationComponent getAdjudicationFirstRep() { 
9363          if (getAdjudication().isEmpty()) {
9364            addAdjudication();
9365          }
9366          return getAdjudication().get(0);
9367        }
9368
9369        /**
9370         * @return {@link #subDetail} (The third-tier service adjudications for payor added services.)
9371         */
9372        public List<AddedItemDetailSubDetailComponent> getSubDetail() { 
9373          if (this.subDetail == null)
9374            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9375          return this.subDetail;
9376        }
9377
9378        /**
9379         * @return Returns a reference to <code>this</code> for easy method chaining
9380         */
9381        public AddedItemDetailComponent setSubDetail(List<AddedItemDetailSubDetailComponent> theSubDetail) { 
9382          this.subDetail = theSubDetail;
9383          return this;
9384        }
9385
9386        public boolean hasSubDetail() { 
9387          if (this.subDetail == null)
9388            return false;
9389          for (AddedItemDetailSubDetailComponent item : this.subDetail)
9390            if (!item.isEmpty())
9391              return true;
9392          return false;
9393        }
9394
9395        public AddedItemDetailSubDetailComponent addSubDetail() { //3
9396          AddedItemDetailSubDetailComponent t = new AddedItemDetailSubDetailComponent();
9397          if (this.subDetail == null)
9398            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9399          this.subDetail.add(t);
9400          return t;
9401        }
9402
9403        public AddedItemDetailComponent addSubDetail(AddedItemDetailSubDetailComponent t) { //3
9404          if (t == null)
9405            return this;
9406          if (this.subDetail == null)
9407            this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9408          this.subDetail.add(t);
9409          return this;
9410        }
9411
9412        /**
9413         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist
9414         */
9415        public AddedItemDetailSubDetailComponent getSubDetailFirstRep() { 
9416          if (getSubDetail().isEmpty()) {
9417            addSubDetail();
9418          }
9419          return getSubDetail().get(0);
9420        }
9421
9422        protected void listChildren(List<Property> children) {
9423          super.listChildren(children);
9424          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));
9425          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));
9426          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
9427          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));
9428          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));
9429          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
9430          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));
9431          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
9432          children.add(new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
9433        }
9434
9435        @Override
9436        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9437          switch (_hash) {
9438          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);
9439          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);
9440          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
9441          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);
9442          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);
9443          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);
9444          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);
9445          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
9446          case -828829007: /*subDetail*/  return new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, subDetail);
9447          default: return super.getNamedProperty(_hash, _name, _checkValid);
9448          }
9449
9450        }
9451
9452      @Override
9453      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9454        switch (hash) {
9455        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
9456        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
9457        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
9458        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
9459        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
9460        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
9461        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
9462        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
9463        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // AddedItemDetailSubDetailComponent
9464        default: return super.getProperty(hash, name, checkValid);
9465        }
9466
9467      }
9468
9469      @Override
9470      public Base setProperty(int hash, String name, Base value) throws FHIRException {
9471        switch (hash) {
9472        case 1957227299: // productOrService
9473          this.productOrService = castToCodeableConcept(value); // CodeableConcept
9474          return value;
9475        case -615513385: // modifier
9476          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
9477          return value;
9478        case -1285004149: // quantity
9479          this.quantity = castToQuantity(value); // Quantity
9480          return value;
9481        case -486196699: // unitPrice
9482          this.unitPrice = castToMoney(value); // Money
9483          return value;
9484        case -1282148017: // factor
9485          this.factor = castToDecimal(value); // DecimalType
9486          return value;
9487        case 108957: // net
9488          this.net = castToMoney(value); // Money
9489          return value;
9490        case -1110033957: // noteNumber
9491          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
9492          return value;
9493        case -231349275: // adjudication
9494          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
9495          return value;
9496        case -828829007: // subDetail
9497          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value); // AddedItemDetailSubDetailComponent
9498          return value;
9499        default: return super.setProperty(hash, name, value);
9500        }
9501
9502      }
9503
9504      @Override
9505      public Base setProperty(String name, Base value) throws FHIRException {
9506        if (name.equals("productOrService")) {
9507          this.productOrService = castToCodeableConcept(value); // CodeableConcept
9508        } else if (name.equals("modifier")) {
9509          this.getModifier().add(castToCodeableConcept(value));
9510        } else if (name.equals("quantity")) {
9511          this.quantity = castToQuantity(value); // Quantity
9512        } else if (name.equals("unitPrice")) {
9513          this.unitPrice = castToMoney(value); // Money
9514        } else if (name.equals("factor")) {
9515          this.factor = castToDecimal(value); // DecimalType
9516        } else if (name.equals("net")) {
9517          this.net = castToMoney(value); // Money
9518        } else if (name.equals("noteNumber")) {
9519          this.getNoteNumber().add(castToPositiveInt(value));
9520        } else if (name.equals("adjudication")) {
9521          this.getAdjudication().add((AdjudicationComponent) value);
9522        } else if (name.equals("subDetail")) {
9523          this.getSubDetail().add((AddedItemDetailSubDetailComponent) value);
9524        } else
9525          return super.setProperty(name, value);
9526        return value;
9527      }
9528
9529      @Override
9530      public Base makeProperty(int hash, String name) throws FHIRException {
9531        switch (hash) {
9532        case 1957227299:  return getProductOrService();
9533        case -615513385:  return addModifier(); 
9534        case -1285004149:  return getQuantity();
9535        case -486196699:  return getUnitPrice();
9536        case -1282148017:  return getFactorElement();
9537        case 108957:  return getNet();
9538        case -1110033957:  return addNoteNumberElement();
9539        case -231349275:  return addAdjudication(); 
9540        case -828829007:  return addSubDetail(); 
9541        default: return super.makeProperty(hash, name);
9542        }
9543
9544      }
9545
9546      @Override
9547      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9548        switch (hash) {
9549        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
9550        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
9551        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
9552        case -486196699: /*unitPrice*/ return new String[] {"Money"};
9553        case -1282148017: /*factor*/ return new String[] {"decimal"};
9554        case 108957: /*net*/ return new String[] {"Money"};
9555        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
9556        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
9557        case -828829007: /*subDetail*/ return new String[] {};
9558        default: return super.getTypesForProperty(hash, name);
9559        }
9560
9561      }
9562
9563      @Override
9564      public Base addChild(String name) throws FHIRException {
9565        if (name.equals("productOrService")) {
9566          this.productOrService = new CodeableConcept();
9567          return this.productOrService;
9568        }
9569        else if (name.equals("modifier")) {
9570          return addModifier();
9571        }
9572        else if (name.equals("quantity")) {
9573          this.quantity = new Quantity();
9574          return this.quantity;
9575        }
9576        else if (name.equals("unitPrice")) {
9577          this.unitPrice = new Money();
9578          return this.unitPrice;
9579        }
9580        else if (name.equals("factor")) {
9581          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
9582        }
9583        else if (name.equals("net")) {
9584          this.net = new Money();
9585          return this.net;
9586        }
9587        else if (name.equals("noteNumber")) {
9588          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
9589        }
9590        else if (name.equals("adjudication")) {
9591          return addAdjudication();
9592        }
9593        else if (name.equals("subDetail")) {
9594          return addSubDetail();
9595        }
9596        else
9597          return super.addChild(name);
9598      }
9599
9600      public AddedItemDetailComponent copy() {
9601        AddedItemDetailComponent dst = new AddedItemDetailComponent();
9602        copyValues(dst);
9603        return dst;
9604      }
9605
9606      public void copyValues(AddedItemDetailComponent dst) {
9607        super.copyValues(dst);
9608        dst.productOrService = productOrService == null ? null : productOrService.copy();
9609        if (modifier != null) {
9610          dst.modifier = new ArrayList<CodeableConcept>();
9611          for (CodeableConcept i : modifier)
9612            dst.modifier.add(i.copy());
9613        };
9614        dst.quantity = quantity == null ? null : quantity.copy();
9615        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
9616        dst.factor = factor == null ? null : factor.copy();
9617        dst.net = net == null ? null : net.copy();
9618        if (noteNumber != null) {
9619          dst.noteNumber = new ArrayList<PositiveIntType>();
9620          for (PositiveIntType i : noteNumber)
9621            dst.noteNumber.add(i.copy());
9622        };
9623        if (adjudication != null) {
9624          dst.adjudication = new ArrayList<AdjudicationComponent>();
9625          for (AdjudicationComponent i : adjudication)
9626            dst.adjudication.add(i.copy());
9627        };
9628        if (subDetail != null) {
9629          dst.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
9630          for (AddedItemDetailSubDetailComponent i : subDetail)
9631            dst.subDetail.add(i.copy());
9632        };
9633      }
9634
9635      @Override
9636      public boolean equalsDeep(Base other_) {
9637        if (!super.equalsDeep(other_))
9638          return false;
9639        if (!(other_ instanceof AddedItemDetailComponent))
9640          return false;
9641        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
9642        return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
9643           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
9644           && compareDeep(net, o.net, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
9645           && compareDeep(subDetail, o.subDetail, true);
9646      }
9647
9648      @Override
9649      public boolean equalsShallow(Base other_) {
9650        if (!super.equalsShallow(other_))
9651          return false;
9652        if (!(other_ instanceof AddedItemDetailComponent))
9653          return false;
9654        AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
9655        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
9656      }
9657
9658      public boolean isEmpty() {
9659        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier
9660          , quantity, unitPrice, factor, net, noteNumber, adjudication, subDetail);
9661      }
9662
9663  public String fhirType() {
9664    return "ExplanationOfBenefit.addItem.detail";
9665
9666  }
9667
9668  }
9669
9670    @Block()
9671    public static class AddedItemDetailSubDetailComponent extends BackboneElement implements IBaseBackboneElement {
9672        /**
9673         * 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.
9674         */
9675        @Child(name = "productOrService", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
9676        @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." )
9677        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
9678        protected CodeableConcept productOrService;
9679
9680        /**
9681         * Item typification or modifiers codes to convey additional context for the product or service.
9682         */
9683        @Child(name = "modifier", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9684        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes to convey additional context for the product or service." )
9685        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
9686        protected List<CodeableConcept> modifier;
9687
9688        /**
9689         * The number of repetitions of a service or product.
9690         */
9691        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
9692        @Description(shortDefinition="Count of products or services", formalDefinition="The number of repetitions of a service or product." )
9693        protected Quantity quantity;
9694
9695        /**
9696         * 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.
9697         */
9698        @Child(name = "unitPrice", type = {Money.class}, order=4, min=0, max=1, modifier=false, summary=false)
9699        @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." )
9700        protected Money unitPrice;
9701
9702        /**
9703         * A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.
9704         */
9705        @Child(name = "factor", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=false)
9706        @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." )
9707        protected DecimalType factor;
9708
9709        /**
9710         * The quantity times the unit price for an additional service or product or charge.
9711         */
9712        @Child(name = "net", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
9713        @Description(shortDefinition="Total item cost", formalDefinition="The quantity times the unit price for an additional service or product or charge." )
9714        protected Money net;
9715
9716        /**
9717         * The numbers associated with notes below which apply to the adjudication of this item.
9718         */
9719        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9720        @Description(shortDefinition="Applicable note numbers", formalDefinition="The numbers associated with notes below which apply to the adjudication of this item." )
9721        protected List<PositiveIntType> noteNumber;
9722
9723        /**
9724         * The adjudication results.
9725         */
9726        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
9727        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudication results." )
9728        protected List<AdjudicationComponent> adjudication;
9729
9730        private static final long serialVersionUID = 1301363592L;
9731
9732    /**
9733     * Constructor
9734     */
9735      public AddedItemDetailSubDetailComponent() {
9736        super();
9737      }
9738
9739    /**
9740     * Constructor
9741     */
9742      public AddedItemDetailSubDetailComponent(CodeableConcept productOrService) {
9743        super();
9744        this.productOrService = productOrService;
9745      }
9746
9747        /**
9748         * @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.)
9749         */
9750        public CodeableConcept getProductOrService() { 
9751          if (this.productOrService == null)
9752            if (Configuration.errorOnAutoCreate())
9753              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.productOrService");
9754            else if (Configuration.doAutoCreate())
9755              this.productOrService = new CodeableConcept(); // cc
9756          return this.productOrService;
9757        }
9758
9759        public boolean hasProductOrService() { 
9760          return this.productOrService != null && !this.productOrService.isEmpty();
9761        }
9762
9763        /**
9764         * @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.)
9765         */
9766        public AddedItemDetailSubDetailComponent setProductOrService(CodeableConcept value) { 
9767          this.productOrService = value;
9768          return this;
9769        }
9770
9771        /**
9772         * @return {@link #modifier} (Item typification or modifiers codes to convey additional context for the product or service.)
9773         */
9774        public List<CodeableConcept> getModifier() { 
9775          if (this.modifier == null)
9776            this.modifier = new ArrayList<CodeableConcept>();
9777          return this.modifier;
9778        }
9779
9780        /**
9781         * @return Returns a reference to <code>this</code> for easy method chaining
9782         */
9783        public AddedItemDetailSubDetailComponent setModifier(List<CodeableConcept> theModifier) { 
9784          this.modifier = theModifier;
9785          return this;
9786        }
9787
9788        public boolean hasModifier() { 
9789          if (this.modifier == null)
9790            return false;
9791          for (CodeableConcept item : this.modifier)
9792            if (!item.isEmpty())
9793              return true;
9794          return false;
9795        }
9796
9797        public CodeableConcept addModifier() { //3
9798          CodeableConcept t = new CodeableConcept();
9799          if (this.modifier == null)
9800            this.modifier = new ArrayList<CodeableConcept>();
9801          this.modifier.add(t);
9802          return t;
9803        }
9804
9805        public AddedItemDetailSubDetailComponent addModifier(CodeableConcept t) { //3
9806          if (t == null)
9807            return this;
9808          if (this.modifier == null)
9809            this.modifier = new ArrayList<CodeableConcept>();
9810          this.modifier.add(t);
9811          return this;
9812        }
9813
9814        /**
9815         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
9816         */
9817        public CodeableConcept getModifierFirstRep() { 
9818          if (getModifier().isEmpty()) {
9819            addModifier();
9820          }
9821          return getModifier().get(0);
9822        }
9823
9824        /**
9825         * @return {@link #quantity} (The number of repetitions of a service or product.)
9826         */
9827        public Quantity getQuantity() { 
9828          if (this.quantity == null)
9829            if (Configuration.errorOnAutoCreate())
9830              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.quantity");
9831            else if (Configuration.doAutoCreate())
9832              this.quantity = new Quantity(); // cc
9833          return this.quantity;
9834        }
9835
9836        public boolean hasQuantity() { 
9837          return this.quantity != null && !this.quantity.isEmpty();
9838        }
9839
9840        /**
9841         * @param value {@link #quantity} (The number of repetitions of a service or product.)
9842         */
9843        public AddedItemDetailSubDetailComponent setQuantity(Quantity value) { 
9844          this.quantity = value;
9845          return this;
9846        }
9847
9848        /**
9849         * @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.)
9850         */
9851        public Money getUnitPrice() { 
9852          if (this.unitPrice == null)
9853            if (Configuration.errorOnAutoCreate())
9854              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.unitPrice");
9855            else if (Configuration.doAutoCreate())
9856              this.unitPrice = new Money(); // cc
9857          return this.unitPrice;
9858        }
9859
9860        public boolean hasUnitPrice() { 
9861          return this.unitPrice != null && !this.unitPrice.isEmpty();
9862        }
9863
9864        /**
9865         * @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.)
9866         */
9867        public AddedItemDetailSubDetailComponent setUnitPrice(Money value) { 
9868          this.unitPrice = value;
9869          return this;
9870        }
9871
9872        /**
9873         * @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
9874         */
9875        public DecimalType getFactorElement() { 
9876          if (this.factor == null)
9877            if (Configuration.errorOnAutoCreate())
9878              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.factor");
9879            else if (Configuration.doAutoCreate())
9880              this.factor = new DecimalType(); // bb
9881          return this.factor;
9882        }
9883
9884        public boolean hasFactorElement() { 
9885          return this.factor != null && !this.factor.isEmpty();
9886        }
9887
9888        public boolean hasFactor() { 
9889          return this.factor != null && !this.factor.isEmpty();
9890        }
9891
9892        /**
9893         * @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
9894         */
9895        public AddedItemDetailSubDetailComponent setFactorElement(DecimalType value) { 
9896          this.factor = value;
9897          return this;
9898        }
9899
9900        /**
9901         * @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.
9902         */
9903        public BigDecimal getFactor() { 
9904          return this.factor == null ? null : this.factor.getValue();
9905        }
9906
9907        /**
9908         * @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.
9909         */
9910        public AddedItemDetailSubDetailComponent setFactor(BigDecimal value) { 
9911          if (value == null)
9912            this.factor = null;
9913          else {
9914            if (this.factor == null)
9915              this.factor = new DecimalType();
9916            this.factor.setValue(value);
9917          }
9918          return this;
9919        }
9920
9921        /**
9922         * @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.
9923         */
9924        public AddedItemDetailSubDetailComponent setFactor(long value) { 
9925              this.factor = new DecimalType();
9926            this.factor.setValue(value);
9927          return this;
9928        }
9929
9930        /**
9931         * @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.
9932         */
9933        public AddedItemDetailSubDetailComponent setFactor(double value) { 
9934              this.factor = new DecimalType();
9935            this.factor.setValue(value);
9936          return this;
9937        }
9938
9939        /**
9940         * @return {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9941         */
9942        public Money getNet() { 
9943          if (this.net == null)
9944            if (Configuration.errorOnAutoCreate())
9945              throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.net");
9946            else if (Configuration.doAutoCreate())
9947              this.net = new Money(); // cc
9948          return this.net;
9949        }
9950
9951        public boolean hasNet() { 
9952          return this.net != null && !this.net.isEmpty();
9953        }
9954
9955        /**
9956         * @param value {@link #net} (The quantity times the unit price for an additional service or product or charge.)
9957         */
9958        public AddedItemDetailSubDetailComponent setNet(Money value) { 
9959          this.net = value;
9960          return this;
9961        }
9962
9963        /**
9964         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9965         */
9966        public List<PositiveIntType> getNoteNumber() { 
9967          if (this.noteNumber == null)
9968            this.noteNumber = new ArrayList<PositiveIntType>();
9969          return this.noteNumber;
9970        }
9971
9972        /**
9973         * @return Returns a reference to <code>this</code> for easy method chaining
9974         */
9975        public AddedItemDetailSubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
9976          this.noteNumber = theNoteNumber;
9977          return this;
9978        }
9979
9980        public boolean hasNoteNumber() { 
9981          if (this.noteNumber == null)
9982            return false;
9983          for (PositiveIntType item : this.noteNumber)
9984            if (!item.isEmpty())
9985              return true;
9986          return false;
9987        }
9988
9989        /**
9990         * @return {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
9991         */
9992        public PositiveIntType addNoteNumberElement() {//2 
9993          PositiveIntType t = new PositiveIntType();
9994          if (this.noteNumber == null)
9995            this.noteNumber = new ArrayList<PositiveIntType>();
9996          this.noteNumber.add(t);
9997          return t;
9998        }
9999
10000        /**
10001         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10002         */
10003        public AddedItemDetailSubDetailComponent addNoteNumber(int value) { //1
10004          PositiveIntType t = new PositiveIntType();
10005          t.setValue(value);
10006          if (this.noteNumber == null)
10007            this.noteNumber = new ArrayList<PositiveIntType>();
10008          this.noteNumber.add(t);
10009          return this;
10010        }
10011
10012        /**
10013         * @param value {@link #noteNumber} (The numbers associated with notes below which apply to the adjudication of this item.)
10014         */
10015        public boolean hasNoteNumber(int value) { 
10016          if (this.noteNumber == null)
10017            return false;
10018          for (PositiveIntType v : this.noteNumber)
10019            if (v.getValue().equals(value)) // positiveInt
10020              return true;
10021          return false;
10022        }
10023
10024        /**
10025         * @return {@link #adjudication} (The adjudication results.)
10026         */
10027        public List<AdjudicationComponent> getAdjudication() { 
10028          if (this.adjudication == null)
10029            this.adjudication = new ArrayList<AdjudicationComponent>();
10030          return this.adjudication;
10031        }
10032
10033        /**
10034         * @return Returns a reference to <code>this</code> for easy method chaining
10035         */
10036        public AddedItemDetailSubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
10037          this.adjudication = theAdjudication;
10038          return this;
10039        }
10040
10041        public boolean hasAdjudication() { 
10042          if (this.adjudication == null)
10043            return false;
10044          for (AdjudicationComponent item : this.adjudication)
10045            if (!item.isEmpty())
10046              return true;
10047          return false;
10048        }
10049
10050        public AdjudicationComponent addAdjudication() { //3
10051          AdjudicationComponent t = new AdjudicationComponent();
10052          if (this.adjudication == null)
10053            this.adjudication = new ArrayList<AdjudicationComponent>();
10054          this.adjudication.add(t);
10055          return t;
10056        }
10057
10058        public AddedItemDetailSubDetailComponent addAdjudication(AdjudicationComponent t) { //3
10059          if (t == null)
10060            return this;
10061          if (this.adjudication == null)
10062            this.adjudication = new ArrayList<AdjudicationComponent>();
10063          this.adjudication.add(t);
10064          return this;
10065        }
10066
10067        /**
10068         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
10069         */
10070        public AdjudicationComponent getAdjudicationFirstRep() { 
10071          if (getAdjudication().isEmpty()) {
10072            addAdjudication();
10073          }
10074          return getAdjudication().get(0);
10075        }
10076
10077        protected void listChildren(List<Property> children) {
10078          super.listChildren(children);
10079          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));
10080          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));
10081          children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity));
10082          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));
10083          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));
10084          children.add(new Property("net", "Money", "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
10085          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));
10086          children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
10087        }
10088
10089        @Override
10090        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10091          switch (_hash) {
10092          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);
10093          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);
10094          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0, 1, quantity);
10095          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);
10096          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);
10097          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);
10098          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);
10099          case -231349275: /*adjudication*/  return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
10100          default: return super.getNamedProperty(_hash, _name, _checkValid);
10101          }
10102
10103        }
10104
10105      @Override
10106      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10107        switch (hash) {
10108        case 1957227299: /*productOrService*/ return this.productOrService == null ? new Base[0] : new Base[] {this.productOrService}; // CodeableConcept
10109        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
10110        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
10111        case -486196699: /*unitPrice*/ return this.unitPrice == null ? new Base[0] : new Base[] {this.unitPrice}; // Money
10112        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
10113        case 108957: /*net*/ return this.net == null ? new Base[0] : new Base[] {this.net}; // Money
10114        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
10115        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
10116        default: return super.getProperty(hash, name, checkValid);
10117        }
10118
10119      }
10120
10121      @Override
10122      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10123        switch (hash) {
10124        case 1957227299: // productOrService
10125          this.productOrService = castToCodeableConcept(value); // CodeableConcept
10126          return value;
10127        case -615513385: // modifier
10128          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
10129          return value;
10130        case -1285004149: // quantity
10131          this.quantity = castToQuantity(value); // Quantity
10132          return value;
10133        case -486196699: // unitPrice
10134          this.unitPrice = castToMoney(value); // Money
10135          return value;
10136        case -1282148017: // factor
10137          this.factor = castToDecimal(value); // DecimalType
10138          return value;
10139        case 108957: // net
10140          this.net = castToMoney(value); // Money
10141          return value;
10142        case -1110033957: // noteNumber
10143          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
10144          return value;
10145        case -231349275: // adjudication
10146          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
10147          return value;
10148        default: return super.setProperty(hash, name, value);
10149        }
10150
10151      }
10152
10153      @Override
10154      public Base setProperty(String name, Base value) throws FHIRException {
10155        if (name.equals("productOrService")) {
10156          this.productOrService = castToCodeableConcept(value); // CodeableConcept
10157        } else if (name.equals("modifier")) {
10158          this.getModifier().add(castToCodeableConcept(value));
10159        } else if (name.equals("quantity")) {
10160          this.quantity = castToQuantity(value); // Quantity
10161        } else if (name.equals("unitPrice")) {
10162          this.unitPrice = castToMoney(value); // Money
10163        } else if (name.equals("factor")) {
10164          this.factor = castToDecimal(value); // DecimalType
10165        } else if (name.equals("net")) {
10166          this.net = castToMoney(value); // Money
10167        } else if (name.equals("noteNumber")) {
10168          this.getNoteNumber().add(castToPositiveInt(value));
10169        } else if (name.equals("adjudication")) {
10170          this.getAdjudication().add((AdjudicationComponent) value);
10171        } else
10172          return super.setProperty(name, value);
10173        return value;
10174      }
10175
10176      @Override
10177      public Base makeProperty(int hash, String name) throws FHIRException {
10178        switch (hash) {
10179        case 1957227299:  return getProductOrService();
10180        case -615513385:  return addModifier(); 
10181        case -1285004149:  return getQuantity();
10182        case -486196699:  return getUnitPrice();
10183        case -1282148017:  return getFactorElement();
10184        case 108957:  return getNet();
10185        case -1110033957:  return addNoteNumberElement();
10186        case -231349275:  return addAdjudication(); 
10187        default: return super.makeProperty(hash, name);
10188        }
10189
10190      }
10191
10192      @Override
10193      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10194        switch (hash) {
10195        case 1957227299: /*productOrService*/ return new String[] {"CodeableConcept"};
10196        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
10197        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
10198        case -486196699: /*unitPrice*/ return new String[] {"Money"};
10199        case -1282148017: /*factor*/ return new String[] {"decimal"};
10200        case 108957: /*net*/ return new String[] {"Money"};
10201        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
10202        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
10203        default: return super.getTypesForProperty(hash, name);
10204        }
10205
10206      }
10207
10208      @Override
10209      public Base addChild(String name) throws FHIRException {
10210        if (name.equals("productOrService")) {
10211          this.productOrService = new CodeableConcept();
10212          return this.productOrService;
10213        }
10214        else if (name.equals("modifier")) {
10215          return addModifier();
10216        }
10217        else if (name.equals("quantity")) {
10218          this.quantity = new Quantity();
10219          return this.quantity;
10220        }
10221        else if (name.equals("unitPrice")) {
10222          this.unitPrice = new Money();
10223          return this.unitPrice;
10224        }
10225        else if (name.equals("factor")) {
10226          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.factor");
10227        }
10228        else if (name.equals("net")) {
10229          this.net = new Money();
10230          return this.net;
10231        }
10232        else if (name.equals("noteNumber")) {
10233          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.noteNumber");
10234        }
10235        else if (name.equals("adjudication")) {
10236          return addAdjudication();
10237        }
10238        else
10239          return super.addChild(name);
10240      }
10241
10242      public AddedItemDetailSubDetailComponent copy() {
10243        AddedItemDetailSubDetailComponent dst = new AddedItemDetailSubDetailComponent();
10244        copyValues(dst);
10245        return dst;
10246      }
10247
10248      public void copyValues(AddedItemDetailSubDetailComponent dst) {
10249        super.copyValues(dst);
10250        dst.productOrService = productOrService == null ? null : productOrService.copy();
10251        if (modifier != null) {
10252          dst.modifier = new ArrayList<CodeableConcept>();
10253          for (CodeableConcept i : modifier)
10254            dst.modifier.add(i.copy());
10255        };
10256        dst.quantity = quantity == null ? null : quantity.copy();
10257        dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
10258        dst.factor = factor == null ? null : factor.copy();
10259        dst.net = net == null ? null : net.copy();
10260        if (noteNumber != null) {
10261          dst.noteNumber = new ArrayList<PositiveIntType>();
10262          for (PositiveIntType i : noteNumber)
10263            dst.noteNumber.add(i.copy());
10264        };
10265        if (adjudication != null) {
10266          dst.adjudication = new ArrayList<AdjudicationComponent>();
10267          for (AdjudicationComponent i : adjudication)
10268            dst.adjudication.add(i.copy());
10269        };
10270      }
10271
10272      @Override
10273      public boolean equalsDeep(Base other_) {
10274        if (!super.equalsDeep(other_))
10275          return false;
10276        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
10277          return false;
10278        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
10279        return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
10280           && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
10281           && compareDeep(net, o.net, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
10282          ;
10283      }
10284
10285      @Override
10286      public boolean equalsShallow(Base other_) {
10287        if (!super.equalsShallow(other_))
10288          return false;
10289        if (!(other_ instanceof AddedItemDetailSubDetailComponent))
10290          return false;
10291        AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
10292        return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
10293      }
10294
10295      public boolean isEmpty() {
10296        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier
10297          , quantity, unitPrice, factor, net, noteNumber, adjudication);
10298      }
10299
10300  public String fhirType() {
10301    return "ExplanationOfBenefit.addItem.detail.subDetail";
10302
10303  }
10304
10305  }
10306
10307    @Block()
10308    public static class TotalComponent extends BackboneElement implements IBaseBackboneElement {
10309        /**
10310         * 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.
10311         */
10312        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
10313        @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." )
10314        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
10315        protected CodeableConcept category;
10316
10317        /**
10318         * Monetary total amount associated with the category.
10319         */
10320        @Child(name = "amount", type = {Money.class}, order=2, min=1, max=1, modifier=false, summary=true)
10321        @Description(shortDefinition="Financial total for the category", formalDefinition="Monetary total amount associated with the category." )
10322        protected Money amount;
10323
10324        private static final long serialVersionUID = 2012310309L;
10325
10326    /**
10327     * Constructor
10328     */
10329      public TotalComponent() {
10330        super();
10331      }
10332
10333    /**
10334     * Constructor
10335     */
10336      public TotalComponent(CodeableConcept category, Money amount) {
10337        super();
10338        this.category = category;
10339        this.amount = amount;
10340      }
10341
10342        /**
10343         * @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.)
10344         */
10345        public CodeableConcept getCategory() { 
10346          if (this.category == null)
10347            if (Configuration.errorOnAutoCreate())
10348              throw new Error("Attempt to auto-create TotalComponent.category");
10349            else if (Configuration.doAutoCreate())
10350              this.category = new CodeableConcept(); // cc
10351          return this.category;
10352        }
10353
10354        public boolean hasCategory() { 
10355          return this.category != null && !this.category.isEmpty();
10356        }
10357
10358        /**
10359         * @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.)
10360         */
10361        public TotalComponent setCategory(CodeableConcept value) { 
10362          this.category = value;
10363          return this;
10364        }
10365
10366        /**
10367         * @return {@link #amount} (Monetary total amount associated with the category.)
10368         */
10369        public Money getAmount() { 
10370          if (this.amount == null)
10371            if (Configuration.errorOnAutoCreate())
10372              throw new Error("Attempt to auto-create TotalComponent.amount");
10373            else if (Configuration.doAutoCreate())
10374              this.amount = new Money(); // cc
10375          return this.amount;
10376        }
10377
10378        public boolean hasAmount() { 
10379          return this.amount != null && !this.amount.isEmpty();
10380        }
10381
10382        /**
10383         * @param value {@link #amount} (Monetary total amount associated with the category.)
10384         */
10385        public TotalComponent setAmount(Money value) { 
10386          this.amount = value;
10387          return this;
10388        }
10389
10390        protected void listChildren(List<Property> children) {
10391          super.listChildren(children);
10392          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));
10393          children.add(new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount));
10394        }
10395
10396        @Override
10397        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10398          switch (_hash) {
10399          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);
10400          case -1413853096: /*amount*/  return new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount);
10401          default: return super.getNamedProperty(_hash, _name, _checkValid);
10402          }
10403
10404        }
10405
10406      @Override
10407      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10408        switch (hash) {
10409        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
10410        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
10411        default: return super.getProperty(hash, name, checkValid);
10412        }
10413
10414      }
10415
10416      @Override
10417      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10418        switch (hash) {
10419        case 50511102: // category
10420          this.category = castToCodeableConcept(value); // CodeableConcept
10421          return value;
10422        case -1413853096: // amount
10423          this.amount = castToMoney(value); // Money
10424          return value;
10425        default: return super.setProperty(hash, name, value);
10426        }
10427
10428      }
10429
10430      @Override
10431      public Base setProperty(String name, Base value) throws FHIRException {
10432        if (name.equals("category")) {
10433          this.category = castToCodeableConcept(value); // CodeableConcept
10434        } else if (name.equals("amount")) {
10435          this.amount = castToMoney(value); // Money
10436        } else
10437          return super.setProperty(name, value);
10438        return value;
10439      }
10440
10441      @Override
10442      public Base makeProperty(int hash, String name) throws FHIRException {
10443        switch (hash) {
10444        case 50511102:  return getCategory();
10445        case -1413853096:  return getAmount();
10446        default: return super.makeProperty(hash, name);
10447        }
10448
10449      }
10450
10451      @Override
10452      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10453        switch (hash) {
10454        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
10455        case -1413853096: /*amount*/ return new String[] {"Money"};
10456        default: return super.getTypesForProperty(hash, name);
10457        }
10458
10459      }
10460
10461      @Override
10462      public Base addChild(String name) throws FHIRException {
10463        if (name.equals("category")) {
10464          this.category = new CodeableConcept();
10465          return this.category;
10466        }
10467        else if (name.equals("amount")) {
10468          this.amount = new Money();
10469          return this.amount;
10470        }
10471        else
10472          return super.addChild(name);
10473      }
10474
10475      public TotalComponent copy() {
10476        TotalComponent dst = new TotalComponent();
10477        copyValues(dst);
10478        return dst;
10479      }
10480
10481      public void copyValues(TotalComponent dst) {
10482        super.copyValues(dst);
10483        dst.category = category == null ? null : category.copy();
10484        dst.amount = amount == null ? null : amount.copy();
10485      }
10486
10487      @Override
10488      public boolean equalsDeep(Base other_) {
10489        if (!super.equalsDeep(other_))
10490          return false;
10491        if (!(other_ instanceof TotalComponent))
10492          return false;
10493        TotalComponent o = (TotalComponent) other_;
10494        return compareDeep(category, o.category, true) && compareDeep(amount, o.amount, true);
10495      }
10496
10497      @Override
10498      public boolean equalsShallow(Base other_) {
10499        if (!super.equalsShallow(other_))
10500          return false;
10501        if (!(other_ instanceof TotalComponent))
10502          return false;
10503        TotalComponent o = (TotalComponent) other_;
10504        return true;
10505      }
10506
10507      public boolean isEmpty() {
10508        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, amount);
10509      }
10510
10511  public String fhirType() {
10512    return "ExplanationOfBenefit.total";
10513
10514  }
10515
10516  }
10517
10518    @Block()
10519    public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
10520        /**
10521         * Whether this represents partial or complete payment of the benefits payable.
10522         */
10523        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
10524        @Description(shortDefinition="Partial or complete payment", formalDefinition="Whether this represents partial or complete payment of the benefits payable." )
10525        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-paymenttype")
10526        protected CodeableConcept type;
10527
10528        /**
10529         * Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.
10530         */
10531        @Child(name = "adjustment", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
10532        @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." )
10533        protected Money adjustment;
10534
10535        /**
10536         * Reason for the payment adjustment.
10537         */
10538        @Child(name = "adjustmentReason", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
10539        @Description(shortDefinition="Explanation for the variance", formalDefinition="Reason for the payment adjustment." )
10540        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
10541        protected CodeableConcept adjustmentReason;
10542
10543        /**
10544         * Estimated date the payment will be issued or the actual issue date of payment.
10545         */
10546        @Child(name = "date", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=false)
10547        @Description(shortDefinition="Expected date of payment", formalDefinition="Estimated date the payment will be issued or the actual issue date of payment." )
10548        protected DateType date;
10549
10550        /**
10551         * Benefits payable less any payment adjustment.
10552         */
10553        @Child(name = "amount", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
10554        @Description(shortDefinition="Payable amount after adjustment", formalDefinition="Benefits payable less any payment adjustment." )
10555        protected Money amount;
10556
10557        /**
10558         * Issuer's unique identifier for the payment instrument.
10559         */
10560        @Child(name = "identifier", type = {Identifier.class}, order=6, min=0, max=1, modifier=false, summary=false)
10561        @Description(shortDefinition="Business identifier for the payment", formalDefinition="Issuer's unique identifier for the payment instrument." )
10562        protected Identifier identifier;
10563
10564        private static final long serialVersionUID = 1539906026L;
10565
10566    /**
10567     * Constructor
10568     */
10569      public PaymentComponent() {
10570        super();
10571      }
10572
10573        /**
10574         * @return {@link #type} (Whether this represents partial or complete payment of the benefits payable.)
10575         */
10576        public CodeableConcept getType() { 
10577          if (this.type == null)
10578            if (Configuration.errorOnAutoCreate())
10579              throw new Error("Attempt to auto-create PaymentComponent.type");
10580            else if (Configuration.doAutoCreate())
10581              this.type = new CodeableConcept(); // cc
10582          return this.type;
10583        }
10584
10585        public boolean hasType() { 
10586          return this.type != null && !this.type.isEmpty();
10587        }
10588
10589        /**
10590         * @param value {@link #type} (Whether this represents partial or complete payment of the benefits payable.)
10591         */
10592        public PaymentComponent setType(CodeableConcept value) { 
10593          this.type = value;
10594          return this;
10595        }
10596
10597        /**
10598         * @return {@link #adjustment} (Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.)
10599         */
10600        public Money getAdjustment() { 
10601          if (this.adjustment == null)
10602            if (Configuration.errorOnAutoCreate())
10603              throw new Error("Attempt to auto-create PaymentComponent.adjustment");
10604            else if (Configuration.doAutoCreate())
10605              this.adjustment = new Money(); // cc
10606          return this.adjustment;
10607        }
10608
10609        public boolean hasAdjustment() { 
10610          return this.adjustment != null && !this.adjustment.isEmpty();
10611        }
10612
10613        /**
10614         * @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.)
10615         */
10616        public PaymentComponent setAdjustment(Money value) { 
10617          this.adjustment = value;
10618          return this;
10619        }
10620
10621        /**
10622         * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
10623         */
10624        public CodeableConcept getAdjustmentReason() { 
10625          if (this.adjustmentReason == null)
10626            if (Configuration.errorOnAutoCreate())
10627              throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
10628            else if (Configuration.doAutoCreate())
10629              this.adjustmentReason = new CodeableConcept(); // cc
10630          return this.adjustmentReason;
10631        }
10632
10633        public boolean hasAdjustmentReason() { 
10634          return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
10635        }
10636
10637        /**
10638         * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
10639         */
10640        public PaymentComponent setAdjustmentReason(CodeableConcept value) { 
10641          this.adjustmentReason = value;
10642          return this;
10643        }
10644
10645        /**
10646         * @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
10647         */
10648        public DateType getDateElement() { 
10649          if (this.date == null)
10650            if (Configuration.errorOnAutoCreate())
10651              throw new Error("Attempt to auto-create PaymentComponent.date");
10652            else if (Configuration.doAutoCreate())
10653              this.date = new DateType(); // bb
10654          return this.date;
10655        }
10656
10657        public boolean hasDateElement() { 
10658          return this.date != null && !this.date.isEmpty();
10659        }
10660
10661        public boolean hasDate() { 
10662          return this.date != null && !this.date.isEmpty();
10663        }
10664
10665        /**
10666         * @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
10667         */
10668        public PaymentComponent setDateElement(DateType value) { 
10669          this.date = value;
10670          return this;
10671        }
10672
10673        /**
10674         * @return Estimated date the payment will be issued or the actual issue date of payment.
10675         */
10676        public Date getDate() { 
10677          return this.date == null ? null : this.date.getValue();
10678        }
10679
10680        /**
10681         * @param value Estimated date the payment will be issued or the actual issue date of payment.
10682         */
10683        public PaymentComponent setDate(Date value) { 
10684          if (value == null)
10685            this.date = null;
10686          else {
10687            if (this.date == null)
10688              this.date = new DateType();
10689            this.date.setValue(value);
10690          }
10691          return this;
10692        }
10693
10694        /**
10695         * @return {@link #amount} (Benefits payable less any payment adjustment.)
10696         */
10697        public Money getAmount() { 
10698          if (this.amount == null)
10699            if (Configuration.errorOnAutoCreate())
10700              throw new Error("Attempt to auto-create PaymentComponent.amount");
10701            else if (Configuration.doAutoCreate())
10702              this.amount = new Money(); // cc
10703          return this.amount;
10704        }
10705
10706        public boolean hasAmount() { 
10707          return this.amount != null && !this.amount.isEmpty();
10708        }
10709
10710        /**
10711         * @param value {@link #amount} (Benefits payable less any payment adjustment.)
10712         */
10713        public PaymentComponent setAmount(Money value) { 
10714          this.amount = value;
10715          return this;
10716        }
10717
10718        /**
10719         * @return {@link #identifier} (Issuer's unique identifier for the payment instrument.)
10720         */
10721        public Identifier getIdentifier() { 
10722          if (this.identifier == null)
10723            if (Configuration.errorOnAutoCreate())
10724              throw new Error("Attempt to auto-create PaymentComponent.identifier");
10725            else if (Configuration.doAutoCreate())
10726              this.identifier = new Identifier(); // cc
10727          return this.identifier;
10728        }
10729
10730        public boolean hasIdentifier() { 
10731          return this.identifier != null && !this.identifier.isEmpty();
10732        }
10733
10734        /**
10735         * @param value {@link #identifier} (Issuer's unique identifier for the payment instrument.)
10736         */
10737        public PaymentComponent setIdentifier(Identifier value) { 
10738          this.identifier = value;
10739          return this;
10740        }
10741
10742        protected void listChildren(List<Property> children) {
10743          super.listChildren(children);
10744          children.add(new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type));
10745          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));
10746          children.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason));
10747          children.add(new Property("date", "date", "Estimated date the payment will be issued or the actual issue date of payment.", 0, 1, date));
10748          children.add(new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount));
10749          children.add(new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0, 1, identifier));
10750        }
10751
10752        @Override
10753        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10754          switch (_hash) {
10755          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type);
10756          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);
10757          case -1255938543: /*adjustmentReason*/  return new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1, adjustmentReason);
10758          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);
10759          case -1413853096: /*amount*/  return new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount);
10760          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0, 1, identifier);
10761          default: return super.getNamedProperty(_hash, _name, _checkValid);
10762          }
10763
10764        }
10765
10766      @Override
10767      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10768        switch (hash) {
10769        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
10770        case 1977085293: /*adjustment*/ return this.adjustment == null ? new Base[0] : new Base[] {this.adjustment}; // Money
10771        case -1255938543: /*adjustmentReason*/ return this.adjustmentReason == null ? new Base[0] : new Base[] {this.adjustmentReason}; // CodeableConcept
10772        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
10773        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
10774        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
10775        default: return super.getProperty(hash, name, checkValid);
10776        }
10777
10778      }
10779
10780      @Override
10781      public Base setProperty(int hash, String name, Base value) throws FHIRException {
10782        switch (hash) {
10783        case 3575610: // type
10784          this.type = castToCodeableConcept(value); // CodeableConcept
10785          return value;
10786        case 1977085293: // adjustment
10787          this.adjustment = castToMoney(value); // Money
10788          return value;
10789        case -1255938543: // adjustmentReason
10790          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
10791          return value;
10792        case 3076014: // date
10793          this.date = castToDate(value); // DateType
10794          return value;
10795        case -1413853096: // amount
10796          this.amount = castToMoney(value); // Money
10797          return value;
10798        case -1618432855: // identifier
10799          this.identifier = castToIdentifier(value); // Identifier
10800          return value;
10801        default: return super.setProperty(hash, name, value);
10802        }
10803
10804      }
10805
10806      @Override
10807      public Base setProperty(String name, Base value) throws FHIRException {
10808        if (name.equals("type")) {
10809          this.type = castToCodeableConcept(value); // CodeableConcept
10810        } else if (name.equals("adjustment")) {
10811          this.adjustment = castToMoney(value); // Money
10812        } else if (name.equals("adjustmentReason")) {
10813          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
10814        } else if (name.equals("date")) {
10815          this.date = castToDate(value); // DateType
10816        } else if (name.equals("amount")) {
10817          this.amount = castToMoney(value); // Money
10818        } else if (name.equals("identifier")) {
10819          this.identifier = castToIdentifier(value); // Identifier
10820        } else
10821          return super.setProperty(name, value);
10822        return value;
10823      }
10824
10825      @Override
10826      public Base makeProperty(int hash, String name) throws FHIRException {
10827        switch (hash) {
10828        case 3575610:  return getType();
10829        case 1977085293:  return getAdjustment();
10830        case -1255938543:  return getAdjustmentReason();
10831        case 3076014:  return getDateElement();
10832        case -1413853096:  return getAmount();
10833        case -1618432855:  return getIdentifier();
10834        default: return super.makeProperty(hash, name);
10835        }
10836
10837      }
10838
10839      @Override
10840      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10841        switch (hash) {
10842        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
10843        case 1977085293: /*adjustment*/ return new String[] {"Money"};
10844        case -1255938543: /*adjustmentReason*/ return new String[] {"CodeableConcept"};
10845        case 3076014: /*date*/ return new String[] {"date"};
10846        case -1413853096: /*amount*/ return new String[] {"Money"};
10847        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
10848        default: return super.getTypesForProperty(hash, name);
10849        }
10850
10851      }
10852
10853      @Override
10854      public Base addChild(String name) throws FHIRException {
10855        if (name.equals("type")) {
10856          this.type = new CodeableConcept();
10857          return this.type;
10858        }
10859        else if (name.equals("adjustment")) {
10860          this.adjustment = new Money();
10861          return this.adjustment;
10862        }
10863        else if (name.equals("adjustmentReason")) {
10864          this.adjustmentReason = new CodeableConcept();
10865          return this.adjustmentReason;
10866        }
10867        else if (name.equals("date")) {
10868          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.date");
10869        }
10870        else if (name.equals("amount")) {
10871          this.amount = new Money();
10872          return this.amount;
10873        }
10874        else if (name.equals("identifier")) {
10875          this.identifier = new Identifier();
10876          return this.identifier;
10877        }
10878        else
10879          return super.addChild(name);
10880      }
10881
10882      public PaymentComponent copy() {
10883        PaymentComponent dst = new PaymentComponent();
10884        copyValues(dst);
10885        return dst;
10886      }
10887
10888      public void copyValues(PaymentComponent dst) {
10889        super.copyValues(dst);
10890        dst.type = type == null ? null : type.copy();
10891        dst.adjustment = adjustment == null ? null : adjustment.copy();
10892        dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
10893        dst.date = date == null ? null : date.copy();
10894        dst.amount = amount == null ? null : amount.copy();
10895        dst.identifier = identifier == null ? null : identifier.copy();
10896      }
10897
10898      @Override
10899      public boolean equalsDeep(Base other_) {
10900        if (!super.equalsDeep(other_))
10901          return false;
10902        if (!(other_ instanceof PaymentComponent))
10903          return false;
10904        PaymentComponent o = (PaymentComponent) other_;
10905        return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true) && compareDeep(adjustmentReason, o.adjustmentReason, true)
10906           && compareDeep(date, o.date, true) && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true)
10907          ;
10908      }
10909
10910      @Override
10911      public boolean equalsShallow(Base other_) {
10912        if (!super.equalsShallow(other_))
10913          return false;
10914        if (!(other_ instanceof PaymentComponent))
10915          return false;
10916        PaymentComponent o = (PaymentComponent) other_;
10917        return compareValues(date, o.date, true);
10918      }
10919
10920      public boolean isEmpty() {
10921        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason
10922          , date, amount, identifier);
10923      }
10924
10925  public String fhirType() {
10926    return "ExplanationOfBenefit.payment";
10927
10928  }
10929
10930  }
10931
10932    @Block()
10933    public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
10934        /**
10935         * A number to uniquely identify a note entry.
10936         */
10937        @Child(name = "number", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
10938        @Description(shortDefinition="Note instance identifier", formalDefinition="A number to uniquely identify a note entry." )
10939        protected PositiveIntType number;
10940
10941        /**
10942         * The business purpose of the note text.
10943         */
10944        @Child(name = "type", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
10945        @Description(shortDefinition="display | print | printoper", formalDefinition="The business purpose of the note text." )
10946        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/note-type")
10947        protected Enumeration<NoteType> type;
10948
10949        /**
10950         * The explanation or description associated with the processing.
10951         */
10952        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
10953        @Description(shortDefinition="Note explanatory text", formalDefinition="The explanation or description associated with the processing." )
10954        protected StringType text;
10955
10956        /**
10957         * A code to define the language used in the text of the note.
10958         */
10959        @Child(name = "language", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
10960        @Description(shortDefinition="Language of the text", formalDefinition="A code to define the language used in the text of the note." )
10961        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
10962        protected CodeableConcept language;
10963
10964        private static final long serialVersionUID = -385184277L;
10965
10966    /**
10967     * Constructor
10968     */
10969      public NoteComponent() {
10970        super();
10971      }
10972
10973        /**
10974         * @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
10975         */
10976        public PositiveIntType getNumberElement() { 
10977          if (this.number == null)
10978            if (Configuration.errorOnAutoCreate())
10979              throw new Error("Attempt to auto-create NoteComponent.number");
10980            else if (Configuration.doAutoCreate())
10981              this.number = new PositiveIntType(); // bb
10982          return this.number;
10983        }
10984
10985        public boolean hasNumberElement() { 
10986          return this.number != null && !this.number.isEmpty();
10987        }
10988
10989        public boolean hasNumber() { 
10990          return this.number != null && !this.number.isEmpty();
10991        }
10992
10993        /**
10994         * @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
10995         */
10996        public NoteComponent setNumberElement(PositiveIntType value) { 
10997          this.number = value;
10998          return this;
10999        }
11000
11001        /**
11002         * @return A number to uniquely identify a note entry.
11003         */
11004        public int getNumber() { 
11005          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
11006        }
11007
11008        /**
11009         * @param value A number to uniquely identify a note entry.
11010         */
11011        public NoteComponent setNumber(int value) { 
11012            if (this.number == null)
11013              this.number = new PositiveIntType();
11014            this.number.setValue(value);
11015          return this;
11016        }
11017
11018        /**
11019         * @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
11020         */
11021        public Enumeration<NoteType> getTypeElement() { 
11022          if (this.type == null)
11023            if (Configuration.errorOnAutoCreate())
11024              throw new Error("Attempt to auto-create NoteComponent.type");
11025            else if (Configuration.doAutoCreate())
11026              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory()); // bb
11027          return this.type;
11028        }
11029
11030        public boolean hasTypeElement() { 
11031          return this.type != null && !this.type.isEmpty();
11032        }
11033
11034        public boolean hasType() { 
11035          return this.type != null && !this.type.isEmpty();
11036        }
11037
11038        /**
11039         * @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
11040         */
11041        public NoteComponent setTypeElement(Enumeration<NoteType> value) { 
11042          this.type = value;
11043          return this;
11044        }
11045
11046        /**
11047         * @return The business purpose of the note text.
11048         */
11049        public NoteType getType() { 
11050          return this.type == null ? null : this.type.getValue();
11051        }
11052
11053        /**
11054         * @param value The business purpose of the note text.
11055         */
11056        public NoteComponent setType(NoteType value) { 
11057          if (value == null)
11058            this.type = null;
11059          else {
11060            if (this.type == null)
11061              this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory());
11062            this.type.setValue(value);
11063          }
11064          return this;
11065        }
11066
11067        /**
11068         * @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
11069         */
11070        public StringType getTextElement() { 
11071          if (this.text == null)
11072            if (Configuration.errorOnAutoCreate())
11073              throw new Error("Attempt to auto-create NoteComponent.text");
11074            else if (Configuration.doAutoCreate())
11075              this.text = new StringType(); // bb
11076          return this.text;
11077        }
11078
11079        public boolean hasTextElement() { 
11080          return this.text != null && !this.text.isEmpty();
11081        }
11082
11083        public boolean hasText() { 
11084          return this.text != null && !this.text.isEmpty();
11085        }
11086
11087        /**
11088         * @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
11089         */
11090        public NoteComponent setTextElement(StringType value) { 
11091          this.text = value;
11092          return this;
11093        }
11094
11095        /**
11096         * @return The explanation or description associated with the processing.
11097         */
11098        public String getText() { 
11099          return this.text == null ? null : this.text.getValue();
11100        }
11101
11102        /**
11103         * @param value The explanation or description associated with the processing.
11104         */
11105        public NoteComponent setText(String value) { 
11106          if (Utilities.noString(value))
11107            this.text = null;
11108          else {
11109            if (this.text == null)
11110              this.text = new StringType();
11111            this.text.setValue(value);
11112          }
11113          return this;
11114        }
11115
11116        /**
11117         * @return {@link #language} (A code to define the language used in the text of the note.)
11118         */
11119        public CodeableConcept getLanguage() { 
11120          if (this.language == null)
11121            if (Configuration.errorOnAutoCreate())
11122              throw new Error("Attempt to auto-create NoteComponent.language");
11123            else if (Configuration.doAutoCreate())
11124              this.language = new CodeableConcept(); // cc
11125          return this.language;
11126        }
11127
11128        public boolean hasLanguage() { 
11129          return this.language != null && !this.language.isEmpty();
11130        }
11131
11132        /**
11133         * @param value {@link #language} (A code to define the language used in the text of the note.)
11134         */
11135        public NoteComponent setLanguage(CodeableConcept value) { 
11136          this.language = value;
11137          return this;
11138        }
11139
11140        protected void listChildren(List<Property> children) {
11141          super.listChildren(children);
11142          children.add(new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number));
11143          children.add(new Property("type", "code", "The business purpose of the note text.", 0, 1, type));
11144          children.add(new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text));
11145          children.add(new Property("language", "CodeableConcept", "A code to define the language used in the text of the note.", 0, 1, language));
11146        }
11147
11148        @Override
11149        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11150          switch (_hash) {
11151          case -1034364087: /*number*/  return new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number);
11152          case 3575610: /*type*/  return new Property("type", "code", "The business purpose of the note text.", 0, 1, type);
11153          case 3556653: /*text*/  return new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text);
11154          case -1613589672: /*language*/  return new Property("language", "CodeableConcept", "A code to define the language used in the text of the note.", 0, 1, language);
11155          default: return super.getNamedProperty(_hash, _name, _checkValid);
11156          }
11157
11158        }
11159
11160      @Override
11161      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11162        switch (hash) {
11163        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // PositiveIntType
11164        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<NoteType>
11165        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
11166        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeableConcept
11167        default: return super.getProperty(hash, name, checkValid);
11168        }
11169
11170      }
11171
11172      @Override
11173      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11174        switch (hash) {
11175        case -1034364087: // number
11176          this.number = castToPositiveInt(value); // PositiveIntType
11177          return value;
11178        case 3575610: // type
11179          value = new NoteTypeEnumFactory().fromType(castToCode(value));
11180          this.type = (Enumeration) value; // Enumeration<NoteType>
11181          return value;
11182        case 3556653: // text
11183          this.text = castToString(value); // StringType
11184          return value;
11185        case -1613589672: // language
11186          this.language = castToCodeableConcept(value); // CodeableConcept
11187          return value;
11188        default: return super.setProperty(hash, name, value);
11189        }
11190
11191      }
11192
11193      @Override
11194      public Base setProperty(String name, Base value) throws FHIRException {
11195        if (name.equals("number")) {
11196          this.number = castToPositiveInt(value); // PositiveIntType
11197        } else if (name.equals("type")) {
11198          value = new NoteTypeEnumFactory().fromType(castToCode(value));
11199          this.type = (Enumeration) value; // Enumeration<NoteType>
11200        } else if (name.equals("text")) {
11201          this.text = castToString(value); // StringType
11202        } else if (name.equals("language")) {
11203          this.language = castToCodeableConcept(value); // CodeableConcept
11204        } else
11205          return super.setProperty(name, value);
11206        return value;
11207      }
11208
11209      @Override
11210      public Base makeProperty(int hash, String name) throws FHIRException {
11211        switch (hash) {
11212        case -1034364087:  return getNumberElement();
11213        case 3575610:  return getTypeElement();
11214        case 3556653:  return getTextElement();
11215        case -1613589672:  return getLanguage();
11216        default: return super.makeProperty(hash, name);
11217        }
11218
11219      }
11220
11221      @Override
11222      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11223        switch (hash) {
11224        case -1034364087: /*number*/ return new String[] {"positiveInt"};
11225        case 3575610: /*type*/ return new String[] {"code"};
11226        case 3556653: /*text*/ return new String[] {"string"};
11227        case -1613589672: /*language*/ return new String[] {"CodeableConcept"};
11228        default: return super.getTypesForProperty(hash, name);
11229        }
11230
11231      }
11232
11233      @Override
11234      public Base addChild(String name) throws FHIRException {
11235        if (name.equals("number")) {
11236          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.number");
11237        }
11238        else if (name.equals("type")) {
11239          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.type");
11240        }
11241        else if (name.equals("text")) {
11242          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.text");
11243        }
11244        else if (name.equals("language")) {
11245          this.language = new CodeableConcept();
11246          return this.language;
11247        }
11248        else
11249          return super.addChild(name);
11250      }
11251
11252      public NoteComponent copy() {
11253        NoteComponent dst = new NoteComponent();
11254        copyValues(dst);
11255        return dst;
11256      }
11257
11258      public void copyValues(NoteComponent dst) {
11259        super.copyValues(dst);
11260        dst.number = number == null ? null : number.copy();
11261        dst.type = type == null ? null : type.copy();
11262        dst.text = text == null ? null : text.copy();
11263        dst.language = language == null ? null : language.copy();
11264      }
11265
11266      @Override
11267      public boolean equalsDeep(Base other_) {
11268        if (!super.equalsDeep(other_))
11269          return false;
11270        if (!(other_ instanceof NoteComponent))
11271          return false;
11272        NoteComponent o = (NoteComponent) other_;
11273        return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
11274           && compareDeep(language, o.language, true);
11275      }
11276
11277      @Override
11278      public boolean equalsShallow(Base other_) {
11279        if (!super.equalsShallow(other_))
11280          return false;
11281        if (!(other_ instanceof NoteComponent))
11282          return false;
11283        NoteComponent o = (NoteComponent) other_;
11284        return compareValues(number, o.number, true) && compareValues(type, o.type, true) && compareValues(text, o.text, true)
11285          ;
11286      }
11287
11288      public boolean isEmpty() {
11289        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language
11290          );
11291      }
11292
11293  public String fhirType() {
11294    return "ExplanationOfBenefit.processNote";
11295
11296  }
11297
11298  }
11299
11300    @Block()
11301    public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
11302        /**
11303         * Code to identify the general type of benefits under which products and services are provided.
11304         */
11305        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
11306        @Description(shortDefinition="Benefit classification", formalDefinition="Code to identify the general type of benefits under which products and services are provided." )
11307        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-benefitcategory")
11308        protected CodeableConcept category;
11309
11310        /**
11311         * 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.
11312         */
11313        @Child(name = "excluded", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
11314        @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." )
11315        protected BooleanType excluded;
11316
11317        /**
11318         * A short name or tag for the benefit.
11319         */
11320        @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
11321        @Description(shortDefinition="Short name for the benefit", formalDefinition="A short name or tag for the benefit." )
11322        protected StringType name;
11323
11324        /**
11325         * A richer description of the benefit or services covered.
11326         */
11327        @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
11328        @Description(shortDefinition="Description of the benefit or services covered", formalDefinition="A richer description of the benefit or services covered." )
11329        protected StringType description;
11330
11331        /**
11332         * Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.
11333         */
11334        @Child(name = "network", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
11335        @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." )
11336        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-network")
11337        protected CodeableConcept network;
11338
11339        /**
11340         * Indicates if the benefits apply to an individual or to the family.
11341         */
11342        @Child(name = "unit", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
11343        @Description(shortDefinition="Individual or family", formalDefinition="Indicates if the benefits apply to an individual or to the family." )
11344        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-unit")
11345        protected CodeableConcept unit;
11346
11347        /**
11348         * The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.
11349         */
11350        @Child(name = "term", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
11351        @Description(shortDefinition="Annual or lifetime", formalDefinition="The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'." )
11352        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-term")
11353        protected CodeableConcept term;
11354
11355        /**
11356         * Benefits Used to date.
11357         */
11358        @Child(name = "financial", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
11359        @Description(shortDefinition="Benefit Summary", formalDefinition="Benefits Used to date." )
11360        protected List<BenefitComponent> financial;
11361
11362        private static final long serialVersionUID = -1889655824L;
11363
11364    /**
11365     * Constructor
11366     */
11367      public BenefitBalanceComponent() {
11368        super();
11369      }
11370
11371    /**
11372     * Constructor
11373     */
11374      public BenefitBalanceComponent(CodeableConcept category) {
11375        super();
11376        this.category = category;
11377      }
11378
11379        /**
11380         * @return {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
11381         */
11382        public CodeableConcept getCategory() { 
11383          if (this.category == null)
11384            if (Configuration.errorOnAutoCreate())
11385              throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
11386            else if (Configuration.doAutoCreate())
11387              this.category = new CodeableConcept(); // cc
11388          return this.category;
11389        }
11390
11391        public boolean hasCategory() { 
11392          return this.category != null && !this.category.isEmpty();
11393        }
11394
11395        /**
11396         * @param value {@link #category} (Code to identify the general type of benefits under which products and services are provided.)
11397         */
11398        public BenefitBalanceComponent setCategory(CodeableConcept value) { 
11399          this.category = value;
11400          return this;
11401        }
11402
11403        /**
11404         * @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
11405         */
11406        public BooleanType getExcludedElement() { 
11407          if (this.excluded == null)
11408            if (Configuration.errorOnAutoCreate())
11409              throw new Error("Attempt to auto-create BenefitBalanceComponent.excluded");
11410            else if (Configuration.doAutoCreate())
11411              this.excluded = new BooleanType(); // bb
11412          return this.excluded;
11413        }
11414
11415        public boolean hasExcludedElement() { 
11416          return this.excluded != null && !this.excluded.isEmpty();
11417        }
11418
11419        public boolean hasExcluded() { 
11420          return this.excluded != null && !this.excluded.isEmpty();
11421        }
11422
11423        /**
11424         * @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
11425         */
11426        public BenefitBalanceComponent setExcludedElement(BooleanType value) { 
11427          this.excluded = value;
11428          return this;
11429        }
11430
11431        /**
11432         * @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.
11433         */
11434        public boolean getExcluded() { 
11435          return this.excluded == null || this.excluded.isEmpty() ? false : this.excluded.getValue();
11436        }
11437
11438        /**
11439         * @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.
11440         */
11441        public BenefitBalanceComponent setExcluded(boolean value) { 
11442            if (this.excluded == null)
11443              this.excluded = new BooleanType();
11444            this.excluded.setValue(value);
11445          return this;
11446        }
11447
11448        /**
11449         * @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
11450         */
11451        public StringType getNameElement() { 
11452          if (this.name == null)
11453            if (Configuration.errorOnAutoCreate())
11454              throw new Error("Attempt to auto-create BenefitBalanceComponent.name");
11455            else if (Configuration.doAutoCreate())
11456              this.name = new StringType(); // bb
11457          return this.name;
11458        }
11459
11460        public boolean hasNameElement() { 
11461          return this.name != null && !this.name.isEmpty();
11462        }
11463
11464        public boolean hasName() { 
11465          return this.name != null && !this.name.isEmpty();
11466        }
11467
11468        /**
11469         * @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
11470         */
11471        public BenefitBalanceComponent setNameElement(StringType value) { 
11472          this.name = value;
11473          return this;
11474        }
11475
11476        /**
11477         * @return A short name or tag for the benefit.
11478         */
11479        public String getName() { 
11480          return this.name == null ? null : this.name.getValue();
11481        }
11482
11483        /**
11484         * @param value A short name or tag for the benefit.
11485         */
11486        public BenefitBalanceComponent setName(String value) { 
11487          if (Utilities.noString(value))
11488            this.name = null;
11489          else {
11490            if (this.name == null)
11491              this.name = new StringType();
11492            this.name.setValue(value);
11493          }
11494          return this;
11495        }
11496
11497        /**
11498         * @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
11499         */
11500        public StringType getDescriptionElement() { 
11501          if (this.description == null)
11502            if (Configuration.errorOnAutoCreate())
11503              throw new Error("Attempt to auto-create BenefitBalanceComponent.description");
11504            else if (Configuration.doAutoCreate())
11505              this.description = new StringType(); // bb
11506          return this.description;
11507        }
11508
11509        public boolean hasDescriptionElement() { 
11510          return this.description != null && !this.description.isEmpty();
11511        }
11512
11513        public boolean hasDescription() { 
11514          return this.description != null && !this.description.isEmpty();
11515        }
11516
11517        /**
11518         * @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
11519         */
11520        public BenefitBalanceComponent setDescriptionElement(StringType value) { 
11521          this.description = value;
11522          return this;
11523        }
11524
11525        /**
11526         * @return A richer description of the benefit or services covered.
11527         */
11528        public String getDescription() { 
11529          return this.description == null ? null : this.description.getValue();
11530        }
11531
11532        /**
11533         * @param value A richer description of the benefit or services covered.
11534         */
11535        public BenefitBalanceComponent setDescription(String value) { 
11536          if (Utilities.noString(value))
11537            this.description = null;
11538          else {
11539            if (this.description == null)
11540              this.description = new StringType();
11541            this.description.setValue(value);
11542          }
11543          return this;
11544        }
11545
11546        /**
11547         * @return {@link #network} (Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.)
11548         */
11549        public CodeableConcept getNetwork() { 
11550          if (this.network == null)
11551            if (Configuration.errorOnAutoCreate())
11552              throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
11553            else if (Configuration.doAutoCreate())
11554              this.network = new CodeableConcept(); // cc
11555          return this.network;
11556        }
11557
11558        public boolean hasNetwork() { 
11559          return this.network != null && !this.network.isEmpty();
11560        }
11561
11562        /**
11563         * @param value {@link #network} (Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.)
11564         */
11565        public BenefitBalanceComponent setNetwork(CodeableConcept value) { 
11566          this.network = value;
11567          return this;
11568        }
11569
11570        /**
11571         * @return {@link #unit} (Indicates if the benefits apply to an individual or to the family.)
11572         */
11573        public CodeableConcept getUnit() { 
11574          if (this.unit == null)
11575            if (Configuration.errorOnAutoCreate())
11576              throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
11577            else if (Configuration.doAutoCreate())
11578              this.unit = new CodeableConcept(); // cc
11579          return this.unit;
11580        }
11581
11582        public boolean hasUnit() { 
11583          return this.unit != null && !this.unit.isEmpty();
11584        }
11585
11586        /**
11587         * @param value {@link #unit} (Indicates if the benefits apply to an individual or to the family.)
11588         */
11589        public BenefitBalanceComponent setUnit(CodeableConcept value) { 
11590          this.unit = value;
11591          return this;
11592        }
11593
11594        /**
11595         * @return {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.)
11596         */
11597        public CodeableConcept getTerm() { 
11598          if (this.term == null)
11599            if (Configuration.errorOnAutoCreate())
11600              throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
11601            else if (Configuration.doAutoCreate())
11602              this.term = new CodeableConcept(); // cc
11603          return this.term;
11604        }
11605
11606        public boolean hasTerm() { 
11607          return this.term != null && !this.term.isEmpty();
11608        }
11609
11610        /**
11611         * @param value {@link #term} (The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.)
11612         */
11613        public BenefitBalanceComponent setTerm(CodeableConcept value) { 
11614          this.term = value;
11615          return this;
11616        }
11617
11618        /**
11619         * @return {@link #financial} (Benefits Used to date.)
11620         */
11621        public List<BenefitComponent> getFinancial() { 
11622          if (this.financial == null)
11623            this.financial = new ArrayList<BenefitComponent>();
11624          return this.financial;
11625        }
11626
11627        /**
11628         * @return Returns a reference to <code>this</code> for easy method chaining
11629         */
11630        public BenefitBalanceComponent setFinancial(List<BenefitComponent> theFinancial) { 
11631          this.financial = theFinancial;
11632          return this;
11633        }
11634
11635        public boolean hasFinancial() { 
11636          if (this.financial == null)
11637            return false;
11638          for (BenefitComponent item : this.financial)
11639            if (!item.isEmpty())
11640              return true;
11641          return false;
11642        }
11643
11644        public BenefitComponent addFinancial() { //3
11645          BenefitComponent t = new BenefitComponent();
11646          if (this.financial == null)
11647            this.financial = new ArrayList<BenefitComponent>();
11648          this.financial.add(t);
11649          return t;
11650        }
11651
11652        public BenefitBalanceComponent addFinancial(BenefitComponent t) { //3
11653          if (t == null)
11654            return this;
11655          if (this.financial == null)
11656            this.financial = new ArrayList<BenefitComponent>();
11657          this.financial.add(t);
11658          return this;
11659        }
11660
11661        /**
11662         * @return The first repetition of repeating field {@link #financial}, creating it if it does not already exist
11663         */
11664        public BenefitComponent getFinancialFirstRep() { 
11665          if (getFinancial().isEmpty()) {
11666            addFinancial();
11667          }
11668          return getFinancial().get(0);
11669        }
11670
11671        protected void listChildren(List<Property> children) {
11672          super.listChildren(children);
11673          children.add(new Property("category", "CodeableConcept", "Code to identify the general type of benefits under which products and services are provided.", 0, 1, category));
11674          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));
11675          children.add(new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name));
11676          children.add(new Property("description", "string", "A richer description of the benefit or services covered.", 0, 1, description));
11677          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));
11678          children.add(new Property("unit", "CodeableConcept", "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit));
11679          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));
11680          children.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
11681        }
11682
11683        @Override
11684        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11685          switch (_hash) {
11686          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);
11687          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);
11688          case 3373707: /*name*/  return new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name);
11689          case -1724546052: /*description*/  return new Property("description", "string", "A richer description of the benefit or services covered.", 0, 1, description);
11690          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);
11691          case 3594628: /*unit*/  return new Property("unit", "CodeableConcept", "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit);
11692          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);
11693          case 357555337: /*financial*/  return new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial);
11694          default: return super.getNamedProperty(_hash, _name, _checkValid);
11695          }
11696
11697        }
11698
11699      @Override
11700      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11701        switch (hash) {
11702        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
11703        case 1994055114: /*excluded*/ return this.excluded == null ? new Base[0] : new Base[] {this.excluded}; // BooleanType
11704        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
11705        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
11706        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // CodeableConcept
11707        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // CodeableConcept
11708        case 3556460: /*term*/ return this.term == null ? new Base[0] : new Base[] {this.term}; // CodeableConcept
11709        case 357555337: /*financial*/ return this.financial == null ? new Base[0] : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
11710        default: return super.getProperty(hash, name, checkValid);
11711        }
11712
11713      }
11714
11715      @Override
11716      public Base setProperty(int hash, String name, Base value) throws FHIRException {
11717        switch (hash) {
11718        case 50511102: // category
11719          this.category = castToCodeableConcept(value); // CodeableConcept
11720          return value;
11721        case 1994055114: // excluded
11722          this.excluded = castToBoolean(value); // BooleanType
11723          return value;
11724        case 3373707: // name
11725          this.name = castToString(value); // StringType
11726          return value;
11727        case -1724546052: // description
11728          this.description = castToString(value); // StringType
11729          return value;
11730        case 1843485230: // network
11731          this.network = castToCodeableConcept(value); // CodeableConcept
11732          return value;
11733        case 3594628: // unit
11734          this.unit = castToCodeableConcept(value); // CodeableConcept
11735          return value;
11736        case 3556460: // term
11737          this.term = castToCodeableConcept(value); // CodeableConcept
11738          return value;
11739        case 357555337: // financial
11740          this.getFinancial().add((BenefitComponent) value); // BenefitComponent
11741          return value;
11742        default: return super.setProperty(hash, name, value);
11743        }
11744
11745      }
11746
11747      @Override
11748      public Base setProperty(String name, Base value) throws FHIRException {
11749        if (name.equals("category")) {
11750          this.category = castToCodeableConcept(value); // CodeableConcept
11751        } else if (name.equals("excluded")) {
11752          this.excluded = castToBoolean(value); // BooleanType
11753        } else if (name.equals("name")) {
11754          this.name = castToString(value); // StringType
11755        } else if (name.equals("description")) {
11756          this.description = castToString(value); // StringType
11757        } else if (name.equals("network")) {
11758          this.network = castToCodeableConcept(value); // CodeableConcept
11759        } else if (name.equals("unit")) {
11760          this.unit = castToCodeableConcept(value); // CodeableConcept
11761        } else if (name.equals("term")) {
11762          this.term = castToCodeableConcept(value); // CodeableConcept
11763        } else if (name.equals("financial")) {
11764          this.getFinancial().add((BenefitComponent) value);
11765        } else
11766          return super.setProperty(name, value);
11767        return value;
11768      }
11769
11770      @Override
11771      public Base makeProperty(int hash, String name) throws FHIRException {
11772        switch (hash) {
11773        case 50511102:  return getCategory();
11774        case 1994055114:  return getExcludedElement();
11775        case 3373707:  return getNameElement();
11776        case -1724546052:  return getDescriptionElement();
11777        case 1843485230:  return getNetwork();
11778        case 3594628:  return getUnit();
11779        case 3556460:  return getTerm();
11780        case 357555337:  return addFinancial(); 
11781        default: return super.makeProperty(hash, name);
11782        }
11783
11784      }
11785
11786      @Override
11787      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11788        switch (hash) {
11789        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
11790        case 1994055114: /*excluded*/ return new String[] {"boolean"};
11791        case 3373707: /*name*/ return new String[] {"string"};
11792        case -1724546052: /*description*/ return new String[] {"string"};
11793        case 1843485230: /*network*/ return new String[] {"CodeableConcept"};
11794        case 3594628: /*unit*/ return new String[] {"CodeableConcept"};
11795        case 3556460: /*term*/ return new String[] {"CodeableConcept"};
11796        case 357555337: /*financial*/ return new String[] {};
11797        default: return super.getTypesForProperty(hash, name);
11798        }
11799
11800      }
11801
11802      @Override
11803      public Base addChild(String name) throws FHIRException {
11804        if (name.equals("category")) {
11805          this.category = new CodeableConcept();
11806          return this.category;
11807        }
11808        else if (name.equals("excluded")) {
11809          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.excluded");
11810        }
11811        else if (name.equals("name")) {
11812          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.name");
11813        }
11814        else if (name.equals("description")) {
11815          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.description");
11816        }
11817        else if (name.equals("network")) {
11818          this.network = new CodeableConcept();
11819          return this.network;
11820        }
11821        else if (name.equals("unit")) {
11822          this.unit = new CodeableConcept();
11823          return this.unit;
11824        }
11825        else if (name.equals("term")) {
11826          this.term = new CodeableConcept();
11827          return this.term;
11828        }
11829        else if (name.equals("financial")) {
11830          return addFinancial();
11831        }
11832        else
11833          return super.addChild(name);
11834      }
11835
11836      public BenefitBalanceComponent copy() {
11837        BenefitBalanceComponent dst = new BenefitBalanceComponent();
11838        copyValues(dst);
11839        return dst;
11840      }
11841
11842      public void copyValues(BenefitBalanceComponent dst) {
11843        super.copyValues(dst);
11844        dst.category = category == null ? null : category.copy();
11845        dst.excluded = excluded == null ? null : excluded.copy();
11846        dst.name = name == null ? null : name.copy();
11847        dst.description = description == null ? null : description.copy();
11848        dst.network = network == null ? null : network.copy();
11849        dst.unit = unit == null ? null : unit.copy();
11850        dst.term = term == null ? null : term.copy();
11851        if (financial != null) {
11852          dst.financial = new ArrayList<BenefitComponent>();
11853          for (BenefitComponent i : financial)
11854            dst.financial.add(i.copy());
11855        };
11856      }
11857
11858      @Override
11859      public boolean equalsDeep(Base other_) {
11860        if (!super.equalsDeep(other_))
11861          return false;
11862        if (!(other_ instanceof BenefitBalanceComponent))
11863          return false;
11864        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
11865        return compareDeep(category, o.category, true) && compareDeep(excluded, o.excluded, true) && compareDeep(name, o.name, true)
11866           && compareDeep(description, o.description, true) && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true)
11867           && compareDeep(term, o.term, true) && compareDeep(financial, o.financial, true);
11868      }
11869
11870      @Override
11871      public boolean equalsShallow(Base other_) {
11872        if (!super.equalsShallow(other_))
11873          return false;
11874        if (!(other_ instanceof BenefitBalanceComponent))
11875          return false;
11876        BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
11877        return compareValues(excluded, o.excluded, true) && compareValues(name, o.name, true) && compareValues(description, o.description, true)
11878          ;
11879      }
11880
11881      public boolean isEmpty() {
11882        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, excluded, name
11883          , description, network, unit, term, financial);
11884      }
11885
11886  public String fhirType() {
11887    return "ExplanationOfBenefit.benefitBalance";
11888
11889  }
11890
11891  }
11892
11893    @Block()
11894    public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
11895        /**
11896         * Classification of benefit being provided.
11897         */
11898        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
11899        @Description(shortDefinition="Benefit classification", formalDefinition="Classification of benefit being provided." )
11900        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-type")
11901        protected CodeableConcept type;
11902
11903        /**
11904         * The quantity of the benefit which is permitted under the coverage.
11905         */
11906        @Child(name = "allowed", type = {UnsignedIntType.class, StringType.class, Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
11907        @Description(shortDefinition="Benefits allowed", formalDefinition="The quantity of the benefit which is permitted under the coverage." )
11908        protected Type allowed;
11909
11910        /**
11911         * The quantity of the benefit which have been consumed to date.
11912         */
11913        @Child(name = "used", type = {UnsignedIntType.class, Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
11914        @Description(shortDefinition="Benefits used", formalDefinition="The quantity of the benefit which have been consumed to date." )
11915        protected Type used;
11916
11917        private static final long serialVersionUID = -1506285314L;
11918
11919    /**
11920     * Constructor
11921     */
11922      public BenefitComponent() {
11923        super();
11924      }
11925
11926    /**
11927     * Constructor
11928     */
11929      public BenefitComponent(CodeableConcept type) {
11930        super();
11931        this.type = type;
11932      }
11933
11934        /**
11935         * @return {@link #type} (Classification of benefit being provided.)
11936         */
11937        public CodeableConcept getType() { 
11938          if (this.type == null)
11939            if (Configuration.errorOnAutoCreate())
11940              throw new Error("Attempt to auto-create BenefitComponent.type");
11941            else if (Configuration.doAutoCreate())
11942              this.type = new CodeableConcept(); // cc
11943          return this.type;
11944        }
11945
11946        public boolean hasType() { 
11947          return this.type != null && !this.type.isEmpty();
11948        }
11949
11950        /**
11951         * @param value {@link #type} (Classification of benefit being provided.)
11952         */
11953        public BenefitComponent setType(CodeableConcept value) { 
11954          this.type = value;
11955          return this;
11956        }
11957
11958        /**
11959         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
11960         */
11961        public Type getAllowed() { 
11962          return this.allowed;
11963        }
11964
11965        /**
11966         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
11967         */
11968        public UnsignedIntType getAllowedUnsignedIntType() throws FHIRException { 
11969          if (this.allowed == null)
11970            this.allowed = new UnsignedIntType();
11971          if (!(this.allowed instanceof UnsignedIntType))
11972            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.allowed.getClass().getName()+" was encountered");
11973          return (UnsignedIntType) this.allowed;
11974        }
11975
11976        public boolean hasAllowedUnsignedIntType() { 
11977          return this != null && this.allowed instanceof UnsignedIntType;
11978        }
11979
11980        /**
11981         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
11982         */
11983        public StringType getAllowedStringType() throws FHIRException { 
11984          if (this.allowed == null)
11985            this.allowed = new StringType();
11986          if (!(this.allowed instanceof StringType))
11987            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.allowed.getClass().getName()+" was encountered");
11988          return (StringType) this.allowed;
11989        }
11990
11991        public boolean hasAllowedStringType() { 
11992          return this != null && this.allowed instanceof StringType;
11993        }
11994
11995        /**
11996         * @return {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
11997         */
11998        public Money getAllowedMoney() throws FHIRException { 
11999          if (this.allowed == null)
12000            this.allowed = new Money();
12001          if (!(this.allowed instanceof Money))
12002            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.allowed.getClass().getName()+" was encountered");
12003          return (Money) this.allowed;
12004        }
12005
12006        public boolean hasAllowedMoney() { 
12007          return this != null && this.allowed instanceof Money;
12008        }
12009
12010        public boolean hasAllowed() { 
12011          return this.allowed != null && !this.allowed.isEmpty();
12012        }
12013
12014        /**
12015         * @param value {@link #allowed} (The quantity of the benefit which is permitted under the coverage.)
12016         */
12017        public BenefitComponent setAllowed(Type value) { 
12018          if (value != null && !(value instanceof UnsignedIntType || value instanceof StringType || value instanceof Money))
12019            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.allowed[x]: "+value.fhirType());
12020          this.allowed = value;
12021          return this;
12022        }
12023
12024        /**
12025         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
12026         */
12027        public Type getUsed() { 
12028          return this.used;
12029        }
12030
12031        /**
12032         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
12033         */
12034        public UnsignedIntType getUsedUnsignedIntType() throws FHIRException { 
12035          if (this.used == null)
12036            this.used = new UnsignedIntType();
12037          if (!(this.used instanceof UnsignedIntType))
12038            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.used.getClass().getName()+" was encountered");
12039          return (UnsignedIntType) this.used;
12040        }
12041
12042        public boolean hasUsedUnsignedIntType() { 
12043          return this != null && this.used instanceof UnsignedIntType;
12044        }
12045
12046        /**
12047         * @return {@link #used} (The quantity of the benefit which have been consumed to date.)
12048         */
12049        public Money getUsedMoney() throws FHIRException { 
12050          if (this.used == null)
12051            this.used = new Money();
12052          if (!(this.used instanceof Money))
12053            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.used.getClass().getName()+" was encountered");
12054          return (Money) this.used;
12055        }
12056
12057        public boolean hasUsedMoney() { 
12058          return this != null && this.used instanceof Money;
12059        }
12060
12061        public boolean hasUsed() { 
12062          return this.used != null && !this.used.isEmpty();
12063        }
12064
12065        /**
12066         * @param value {@link #used} (The quantity of the benefit which have been consumed to date.)
12067         */
12068        public BenefitComponent setUsed(Type value) { 
12069          if (value != null && !(value instanceof UnsignedIntType || value instanceof Money))
12070            throw new Error("Not the right type for ExplanationOfBenefit.benefitBalance.financial.used[x]: "+value.fhirType());
12071          this.used = value;
12072          return this;
12073        }
12074
12075        protected void listChildren(List<Property> children) {
12076          super.listChildren(children);
12077          children.add(new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type));
12078          children.add(new Property("allowed[x]", "unsignedInt|string|Money", "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed));
12079          children.add(new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used));
12080        }
12081
12082        @Override
12083        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
12084          switch (_hash) {
12085          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type);
12086          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);
12087          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);
12088          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);
12089          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);
12090          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);
12091          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);
12092          case 3599293: /*used*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
12093          case 1252740285: /*usedUnsignedInt*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
12094          case -78048509: /*usedMoney*/  return new Property("used[x]", "unsignedInt|Money", "The quantity of the benefit which have been consumed to date.", 0, 1, used);
12095          default: return super.getNamedProperty(_hash, _name, _checkValid);
12096          }
12097
12098        }
12099
12100      @Override
12101      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
12102        switch (hash) {
12103        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
12104        case -911343192: /*allowed*/ return this.allowed == null ? new Base[0] : new Base[] {this.allowed}; // Type
12105        case 3599293: /*used*/ return this.used == null ? new Base[0] : new Base[] {this.used}; // Type
12106        default: return super.getProperty(hash, name, checkValid);
12107        }
12108
12109      }
12110
12111      @Override
12112      public Base setProperty(int hash, String name, Base value) throws FHIRException {
12113        switch (hash) {
12114        case 3575610: // type
12115          this.type = castToCodeableConcept(value); // CodeableConcept
12116          return value;
12117        case -911343192: // allowed
12118          this.allowed = castToType(value); // Type
12119          return value;
12120        case 3599293: // used
12121          this.used = castToType(value); // Type
12122          return value;
12123        default: return super.setProperty(hash, name, value);
12124        }
12125
12126      }
12127
12128      @Override
12129      public Base setProperty(String name, Base value) throws FHIRException {
12130        if (name.equals("type")) {
12131          this.type = castToCodeableConcept(value); // CodeableConcept
12132        } else if (name.equals("allowed[x]")) {
12133          this.allowed = castToType(value); // Type
12134        } else if (name.equals("used[x]")) {
12135          this.used = castToType(value); // Type
12136        } else
12137          return super.setProperty(name, value);
12138        return value;
12139      }
12140
12141      @Override
12142      public Base makeProperty(int hash, String name) throws FHIRException {
12143        switch (hash) {
12144        case 3575610:  return getType();
12145        case -1336663592:  return getAllowed();
12146        case -911343192:  return getAllowed();
12147        case -147553373:  return getUsed();
12148        case 3599293:  return getUsed();
12149        default: return super.makeProperty(hash, name);
12150        }
12151
12152      }
12153
12154      @Override
12155      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12156        switch (hash) {
12157        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
12158        case -911343192: /*allowed*/ return new String[] {"unsignedInt", "string", "Money"};
12159        case 3599293: /*used*/ return new String[] {"unsignedInt", "Money"};
12160        default: return super.getTypesForProperty(hash, name);
12161        }
12162
12163      }
12164
12165      @Override
12166      public Base addChild(String name) throws FHIRException {
12167        if (name.equals("type")) {
12168          this.type = new CodeableConcept();
12169          return this.type;
12170        }
12171        else if (name.equals("allowedUnsignedInt")) {
12172          this.allowed = new UnsignedIntType();
12173          return this.allowed;
12174        }
12175        else if (name.equals("allowedString")) {
12176          this.allowed = new StringType();
12177          return this.allowed;
12178        }
12179        else if (name.equals("allowedMoney")) {
12180          this.allowed = new Money();
12181          return this.allowed;
12182        }
12183        else if (name.equals("usedUnsignedInt")) {
12184          this.used = new UnsignedIntType();
12185          return this.used;
12186        }
12187        else if (name.equals("usedMoney")) {
12188          this.used = new Money();
12189          return this.used;
12190        }
12191        else
12192          return super.addChild(name);
12193      }
12194
12195      public BenefitComponent copy() {
12196        BenefitComponent dst = new BenefitComponent();
12197        copyValues(dst);
12198        return dst;
12199      }
12200
12201      public void copyValues(BenefitComponent dst) {
12202        super.copyValues(dst);
12203        dst.type = type == null ? null : type.copy();
12204        dst.allowed = allowed == null ? null : allowed.copy();
12205        dst.used = used == null ? null : used.copy();
12206      }
12207
12208      @Override
12209      public boolean equalsDeep(Base other_) {
12210        if (!super.equalsDeep(other_))
12211          return false;
12212        if (!(other_ instanceof BenefitComponent))
12213          return false;
12214        BenefitComponent o = (BenefitComponent) other_;
12215        return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true) && compareDeep(used, o.used, true)
12216          ;
12217      }
12218
12219      @Override
12220      public boolean equalsShallow(Base other_) {
12221        if (!super.equalsShallow(other_))
12222          return false;
12223        if (!(other_ instanceof BenefitComponent))
12224          return false;
12225        BenefitComponent o = (BenefitComponent) other_;
12226        return true;
12227      }
12228
12229      public boolean isEmpty() {
12230        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed, used);
12231      }
12232
12233  public String fhirType() {
12234    return "ExplanationOfBenefit.benefitBalance.financial";
12235
12236  }
12237
12238  }
12239
12240    /**
12241     * A unique identifier assigned to this explanation of benefit.
12242     */
12243    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12244    @Description(shortDefinition="Business Identifier for the resource", formalDefinition="A unique identifier assigned to this explanation of benefit." )
12245    protected List<Identifier> identifier;
12246
12247    /**
12248     * The status of the resource instance.
12249     */
12250    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
12251    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
12252    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/explanationofbenefit-status")
12253    protected Enumeration<ExplanationOfBenefitStatus> status;
12254
12255    /**
12256     * The category of claim, e.g. oral, pharmacy, vision, institutional, professional.
12257     */
12258    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
12259    @Description(shortDefinition="Category or discipline", formalDefinition="The category of claim, e.g. oral, pharmacy, vision, institutional, professional." )
12260    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-type")
12261    protected CodeableConcept type;
12262
12263    /**
12264     * A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.
12265     */
12266    @Child(name = "subType", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
12267    @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." )
12268    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-subtype")
12269    protected CodeableConcept subType;
12270
12271    /**
12272     * 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.
12273     */
12274    @Child(name = "use", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
12275    @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." )
12276    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-use")
12277    protected Enumeration<Use> use;
12278
12279    /**
12280     * 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.
12281     */
12282    @Child(name = "patient", type = {Patient.class}, order=5, min=1, max=1, modifier=false, summary=true)
12283    @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." )
12284    protected Reference patient;
12285
12286    /**
12287     * The period for which charges are being submitted.
12288     */
12289    @Child(name = "billablePeriod", type = {Period.class}, order=6, min=0, max=1, modifier=false, summary=true)
12290    @Description(shortDefinition="Relevant time frame for the claim", formalDefinition="The period for which charges are being submitted." )
12291    protected Period billablePeriod;
12292
12293    /**
12294     * The date this resource was created.
12295     */
12296    @Child(name = "created", type = {DateTimeType.class}, order=7, min=1, max=1, modifier=false, summary=true)
12297    @Description(shortDefinition="Response creation date", formalDefinition="The date this resource was created." )
12298    protected DateTimeType created;
12299
12300    /**
12301     * Individual who created the claim, predetermination or preauthorization.
12302     */
12303    @Child(name = "enterer", type = {Practitioner.class, PractitionerRole.class}, order=8, min=0, max=1, modifier=false, summary=false)
12304    @Description(shortDefinition="Author of the claim", formalDefinition="Individual who created the claim, predetermination or preauthorization." )
12305    protected Reference enterer;
12306
12307    /**
12308     * The party responsible for authorization, adjudication and reimbursement.
12309     */
12310    @Child(name = "insurer", type = {Organization.class}, order=9, min=1, max=1, modifier=false, summary=true)
12311    @Description(shortDefinition="Party responsible for reimbursement", formalDefinition="The party responsible for authorization, adjudication and reimbursement." )
12312    protected Reference insurer;
12313
12314    /**
12315     * The provider which is responsible for the claim, predetermination or preauthorization.
12316     */
12317    @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=10, min=1, max=1, modifier=false, summary=true)
12318    @Description(shortDefinition="Party responsible for the claim", formalDefinition="The provider which is responsible for the claim, predetermination or preauthorization." )
12319    protected Reference provider;
12320
12321    /**
12322     * The provider-required urgency of processing the request. Typical values include: stat, routine deferred.
12323     */
12324    @Child(name = "priority", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=false)
12325    @Description(shortDefinition="Desired processing urgency", formalDefinition="The provider-required urgency of processing the request. Typical values include: stat, routine deferred." )
12326    protected CodeableConcept priority;
12327
12328    /**
12329     * A code to indicate whether and for whom funds are to be reserved for future claims.
12330     */
12331    @Child(name = "fundsReserveRequested", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
12332    @Description(shortDefinition="For whom to reserve funds", formalDefinition="A code to indicate whether and for whom funds are to be reserved for future claims." )
12333    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fundsreserve")
12334    protected CodeableConcept fundsReserveRequested;
12335
12336    /**
12337     * A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.
12338     */
12339    @Child(name = "fundsReserve", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
12340    @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." )
12341    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fundsreserve")
12342    protected CodeableConcept fundsReserve;
12343
12344    /**
12345     * Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.
12346     */
12347    @Child(name = "related", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12348    @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." )
12349    protected List<RelatedClaimComponent> related;
12350
12351    /**
12352     * Prescription to support the dispensing of pharmacy, device or vision products.
12353     */
12354    @Child(name = "prescription", type = {MedicationRequest.class, VisionPrescription.class}, order=15, min=0, max=1, modifier=false, summary=false)
12355    @Description(shortDefinition="Prescription authorizing services or products", formalDefinition="Prescription to support the dispensing of pharmacy, device or vision products." )
12356    protected Reference prescription;
12357
12358    /**
12359     * Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.
12360     */
12361    @Child(name = "originalPrescription", type = {MedicationRequest.class}, order=16, min=0, max=1, modifier=false, summary=false)
12362    @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." )
12363    protected Reference originalPrescription;
12364
12365    /**
12366     * The party to be reimbursed for cost of the products and services according to the terms of the policy.
12367     */
12368    @Child(name = "payee", type = {}, order=17, min=0, max=1, modifier=false, summary=false)
12369    @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." )
12370    protected PayeeComponent payee;
12371
12372    /**
12373     * A reference to a referral resource.
12374     */
12375    @Child(name = "referral", type = {ServiceRequest.class}, order=18, min=0, max=1, modifier=false, summary=false)
12376    @Description(shortDefinition="Treatment Referral", formalDefinition="A reference to a referral resource." )
12377    protected Reference referral;
12378
12379    /**
12380     * Facility where the services were provided.
12381     */
12382    @Child(name = "facility", type = {Location.class}, order=19, min=0, max=1, modifier=false, summary=false)
12383    @Description(shortDefinition="Servicing Facility", formalDefinition="Facility where the services were provided." )
12384    protected Reference facility;
12385
12386    /**
12387     * The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.
12388     */
12389    @Child(name = "claim", type = {Claim.class}, order=20, min=0, max=1, modifier=false, summary=false)
12390    @Description(shortDefinition="Claim reference", formalDefinition="The business identifier for the instance of the adjudication request: claim predetermination or preauthorization." )
12391    protected Reference claim;
12392
12393    /**
12394     * The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.
12395     */
12396    @Child(name = "claimResponse", type = {ClaimResponse.class}, order=21, min=0, max=1, modifier=false, summary=false)
12397    @Description(shortDefinition="Claim response reference", formalDefinition="The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response." )
12398    protected Reference claimResponse;
12399
12400    /**
12401     * The outcome of the claim, predetermination, or preauthorization processing.
12402     */
12403    @Child(name = "outcome", type = {CodeType.class}, order=22, min=1, max=1, modifier=false, summary=true)
12404    @Description(shortDefinition="queued | complete | error | partial", formalDefinition="The outcome of the claim, predetermination, or preauthorization processing." )
12405    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/remittance-outcome")
12406    protected Enumeration<RemittanceOutcome> outcome;
12407
12408    /**
12409     * A human readable description of the status of the adjudication.
12410     */
12411    @Child(name = "disposition", type = {StringType.class}, order=23, min=0, max=1, modifier=false, summary=false)
12412    @Description(shortDefinition="Disposition Message", formalDefinition="A human readable description of the status of the adjudication." )
12413    protected StringType disposition;
12414
12415    /**
12416     * Reference from the Insurer which is used in later communications which refers to this adjudication.
12417     */
12418    @Child(name = "preAuthRef", type = {StringType.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12419    @Description(shortDefinition="Preauthorization reference", formalDefinition="Reference from the Insurer which is used in later communications which refers to this adjudication." )
12420    protected List<StringType> preAuthRef;
12421
12422    /**
12423     * The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.
12424     */
12425    @Child(name = "preAuthRefPeriod", type = {Period.class}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12426    @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." )
12427    protected List<Period> preAuthRefPeriod;
12428
12429    /**
12430     * The members of the team who provided the products and services.
12431     */
12432    @Child(name = "careTeam", type = {}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12433    @Description(shortDefinition="Care Team members", formalDefinition="The members of the team who provided the products and services." )
12434    protected List<CareTeamComponent> careTeam;
12435
12436    /**
12437     * Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.
12438     */
12439    @Child(name = "supportingInfo", type = {}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12440    @Description(shortDefinition="Supporting information", formalDefinition="Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues." )
12441    protected List<SupportingInformationComponent> supportingInfo;
12442
12443    /**
12444     * Information about diagnoses relevant to the claim items.
12445     */
12446    @Child(name = "diagnosis", type = {}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12447    @Description(shortDefinition="Pertinent diagnosis information", formalDefinition="Information about diagnoses relevant to the claim items." )
12448    protected List<DiagnosisComponent> diagnosis;
12449
12450    /**
12451     * Procedures performed on the patient relevant to the billing items with the claim.
12452     */
12453    @Child(name = "procedure", type = {}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12454    @Description(shortDefinition="Clinical procedures performed", formalDefinition="Procedures performed on the patient relevant to the billing items with the claim." )
12455    protected List<ProcedureComponent> procedure;
12456
12457    /**
12458     * This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
12459     */
12460    @Child(name = "precedence", type = {PositiveIntType.class}, order=30, min=0, max=1, modifier=false, summary=false)
12461    @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." )
12462    protected PositiveIntType precedence;
12463
12464    /**
12465     * Financial instruments for reimbursement for the health care products and services specified on the claim.
12466     */
12467    @Child(name = "insurance", type = {}, order=31, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
12468    @Description(shortDefinition="Patient insurance information", formalDefinition="Financial instruments for reimbursement for the health care products and services specified on the claim." )
12469    protected List<InsuranceComponent> insurance;
12470
12471    /**
12472     * Details of a accident which resulted in injuries which required the products and services listed in the claim.
12473     */
12474    @Child(name = "accident", type = {}, order=32, min=0, max=1, modifier=false, summary=false)
12475    @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." )
12476    protected AccidentComponent accident;
12477
12478    /**
12479     * 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.
12480     */
12481    @Child(name = "item", type = {}, order=33, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12482    @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." )
12483    protected List<ItemComponent> item;
12484
12485    /**
12486     * The first-tier service adjudications for payor added product or service lines.
12487     */
12488    @Child(name = "addItem", type = {}, order=34, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12489    @Description(shortDefinition="Insurer added line items", formalDefinition="The first-tier service adjudications for payor added product or service lines." )
12490    protected List<AddedItemComponent> addItem;
12491
12492    /**
12493     * The adjudication results which are presented at the header level rather than at the line-item or add-item levels.
12494     */
12495    @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=35, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12496    @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." )
12497    protected List<AdjudicationComponent> adjudication;
12498
12499    /**
12500     * Categorized monetary totals for the adjudication.
12501     */
12502    @Child(name = "total", type = {}, order=36, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
12503    @Description(shortDefinition="Adjudication totals", formalDefinition="Categorized monetary totals for the adjudication." )
12504    protected List<TotalComponent> total;
12505
12506    /**
12507     * Payment details for the adjudication of the claim.
12508     */
12509    @Child(name = "payment", type = {}, order=37, min=0, max=1, modifier=false, summary=false)
12510    @Description(shortDefinition="Payment Details", formalDefinition="Payment details for the adjudication of the claim." )
12511    protected PaymentComponent payment;
12512
12513    /**
12514     * A code for the form to be used for printing the content.
12515     */
12516    @Child(name = "formCode", type = {CodeableConcept.class}, order=38, min=0, max=1, modifier=false, summary=false)
12517    @Description(shortDefinition="Printed form identifier", formalDefinition="A code for the form to be used for printing the content." )
12518    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/forms")
12519    protected CodeableConcept formCode;
12520
12521    /**
12522     * The actual form, by reference or inclusion, for printing the content or an EOB.
12523     */
12524    @Child(name = "form", type = {Attachment.class}, order=39, min=0, max=1, modifier=false, summary=false)
12525    @Description(shortDefinition="Printed reference or actual form", formalDefinition="The actual form, by reference or inclusion, for printing the content or an EOB." )
12526    protected Attachment form;
12527
12528    /**
12529     * A note that describes or explains adjudication results in a human readable form.
12530     */
12531    @Child(name = "processNote", type = {}, order=40, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12532    @Description(shortDefinition="Note concerning adjudication", formalDefinition="A note that describes or explains adjudication results in a human readable form." )
12533    protected List<NoteComponent> processNote;
12534
12535    /**
12536     * The term of the benefits documented in this response.
12537     */
12538    @Child(name = "benefitPeriod", type = {Period.class}, order=41, min=0, max=1, modifier=false, summary=false)
12539    @Description(shortDefinition="When the benefits are applicable", formalDefinition="The term of the benefits documented in this response." )
12540    protected Period benefitPeriod;
12541
12542    /**
12543     * Balance by Benefit Category.
12544     */
12545    @Child(name = "benefitBalance", type = {}, order=42, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
12546    @Description(shortDefinition="Balance by Benefit Category", formalDefinition="Balance by Benefit Category." )
12547    protected List<BenefitBalanceComponent> benefitBalance;
12548
12549    private static final long serialVersionUID = 1403248694L;
12550
12551  /**
12552   * Constructor
12553   */
12554    public ExplanationOfBenefit() {
12555      super();
12556    }
12557
12558  /**
12559   * Constructor
12560   */
12561    public ExplanationOfBenefit(Enumeration<ExplanationOfBenefitStatus> status, CodeableConcept type, Enumeration<Use> use, Reference patient, DateTimeType created, Reference insurer, Reference provider, Enumeration<RemittanceOutcome> outcome) {
12562      super();
12563      this.status = status;
12564      this.type = type;
12565      this.use = use;
12566      this.patient = patient;
12567      this.created = created;
12568      this.insurer = insurer;
12569      this.provider = provider;
12570      this.outcome = outcome;
12571    }
12572
12573    /**
12574     * @return {@link #identifier} (A unique identifier assigned to this explanation of benefit.)
12575     */
12576    public List<Identifier> getIdentifier() { 
12577      if (this.identifier == null)
12578        this.identifier = new ArrayList<Identifier>();
12579      return this.identifier;
12580    }
12581
12582    /**
12583     * @return Returns a reference to <code>this</code> for easy method chaining
12584     */
12585    public ExplanationOfBenefit setIdentifier(List<Identifier> theIdentifier) { 
12586      this.identifier = theIdentifier;
12587      return this;
12588    }
12589
12590    public boolean hasIdentifier() { 
12591      if (this.identifier == null)
12592        return false;
12593      for (Identifier item : this.identifier)
12594        if (!item.isEmpty())
12595          return true;
12596      return false;
12597    }
12598
12599    public Identifier addIdentifier() { //3
12600      Identifier t = new Identifier();
12601      if (this.identifier == null)
12602        this.identifier = new ArrayList<Identifier>();
12603      this.identifier.add(t);
12604      return t;
12605    }
12606
12607    public ExplanationOfBenefit addIdentifier(Identifier t) { //3
12608      if (t == null)
12609        return this;
12610      if (this.identifier == null)
12611        this.identifier = new ArrayList<Identifier>();
12612      this.identifier.add(t);
12613      return this;
12614    }
12615
12616    /**
12617     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
12618     */
12619    public Identifier getIdentifierFirstRep() { 
12620      if (getIdentifier().isEmpty()) {
12621        addIdentifier();
12622      }
12623      return getIdentifier().get(0);
12624    }
12625
12626    /**
12627     * @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
12628     */
12629    public Enumeration<ExplanationOfBenefitStatus> getStatusElement() { 
12630      if (this.status == null)
12631        if (Configuration.errorOnAutoCreate())
12632          throw new Error("Attempt to auto-create ExplanationOfBenefit.status");
12633        else if (Configuration.doAutoCreate())
12634          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory()); // bb
12635      return this.status;
12636    }
12637
12638    public boolean hasStatusElement() { 
12639      return this.status != null && !this.status.isEmpty();
12640    }
12641
12642    public boolean hasStatus() { 
12643      return this.status != null && !this.status.isEmpty();
12644    }
12645
12646    /**
12647     * @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
12648     */
12649    public ExplanationOfBenefit setStatusElement(Enumeration<ExplanationOfBenefitStatus> value) { 
12650      this.status = value;
12651      return this;
12652    }
12653
12654    /**
12655     * @return The status of the resource instance.
12656     */
12657    public ExplanationOfBenefitStatus getStatus() { 
12658      return this.status == null ? null : this.status.getValue();
12659    }
12660
12661    /**
12662     * @param value The status of the resource instance.
12663     */
12664    public ExplanationOfBenefit setStatus(ExplanationOfBenefitStatus value) { 
12665        if (this.status == null)
12666          this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory());
12667        this.status.setValue(value);
12668      return this;
12669    }
12670
12671    /**
12672     * @return {@link #type} (The category of claim, e.g. oral, pharmacy, vision, institutional, professional.)
12673     */
12674    public CodeableConcept getType() { 
12675      if (this.type == null)
12676        if (Configuration.errorOnAutoCreate())
12677          throw new Error("Attempt to auto-create ExplanationOfBenefit.type");
12678        else if (Configuration.doAutoCreate())
12679          this.type = new CodeableConcept(); // cc
12680      return this.type;
12681    }
12682
12683    public boolean hasType() { 
12684      return this.type != null && !this.type.isEmpty();
12685    }
12686
12687    /**
12688     * @param value {@link #type} (The category of claim, e.g. oral, pharmacy, vision, institutional, professional.)
12689     */
12690    public ExplanationOfBenefit setType(CodeableConcept value) { 
12691      this.type = value;
12692      return this;
12693    }
12694
12695    /**
12696     * @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.)
12697     */
12698    public CodeableConcept getSubType() { 
12699      if (this.subType == null)
12700        if (Configuration.errorOnAutoCreate())
12701          throw new Error("Attempt to auto-create ExplanationOfBenefit.subType");
12702        else if (Configuration.doAutoCreate())
12703          this.subType = new CodeableConcept(); // cc
12704      return this.subType;
12705    }
12706
12707    public boolean hasSubType() { 
12708      return this.subType != null && !this.subType.isEmpty();
12709    }
12710
12711    /**
12712     * @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.)
12713     */
12714    public ExplanationOfBenefit setSubType(CodeableConcept value) { 
12715      this.subType = value;
12716      return this;
12717    }
12718
12719    /**
12720     * @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
12721     */
12722    public Enumeration<Use> getUseElement() { 
12723      if (this.use == null)
12724        if (Configuration.errorOnAutoCreate())
12725          throw new Error("Attempt to auto-create ExplanationOfBenefit.use");
12726        else if (Configuration.doAutoCreate())
12727          this.use = new Enumeration<Use>(new UseEnumFactory()); // bb
12728      return this.use;
12729    }
12730
12731    public boolean hasUseElement() { 
12732      return this.use != null && !this.use.isEmpty();
12733    }
12734
12735    public boolean hasUse() { 
12736      return this.use != null && !this.use.isEmpty();
12737    }
12738
12739    /**
12740     * @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
12741     */
12742    public ExplanationOfBenefit setUseElement(Enumeration<Use> value) { 
12743      this.use = value;
12744      return this;
12745    }
12746
12747    /**
12748     * @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.
12749     */
12750    public Use getUse() { 
12751      return this.use == null ? null : this.use.getValue();
12752    }
12753
12754    /**
12755     * @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.
12756     */
12757    public ExplanationOfBenefit setUse(Use value) { 
12758        if (this.use == null)
12759          this.use = new Enumeration<Use>(new UseEnumFactory());
12760        this.use.setValue(value);
12761      return this;
12762    }
12763
12764    /**
12765     * @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.)
12766     */
12767    public Reference getPatient() { 
12768      if (this.patient == null)
12769        if (Configuration.errorOnAutoCreate())
12770          throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
12771        else if (Configuration.doAutoCreate())
12772          this.patient = new Reference(); // cc
12773      return this.patient;
12774    }
12775
12776    public boolean hasPatient() { 
12777      return this.patient != null && !this.patient.isEmpty();
12778    }
12779
12780    /**
12781     * @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.)
12782     */
12783    public ExplanationOfBenefit setPatient(Reference value) { 
12784      this.patient = value;
12785      return this;
12786    }
12787
12788    /**
12789     * @return {@link #billablePeriod} (The period for which charges are being submitted.)
12790     */
12791    public Period getBillablePeriod() { 
12792      if (this.billablePeriod == null)
12793        if (Configuration.errorOnAutoCreate())
12794          throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
12795        else if (Configuration.doAutoCreate())
12796          this.billablePeriod = new Period(); // cc
12797      return this.billablePeriod;
12798    }
12799
12800    public boolean hasBillablePeriod() { 
12801      return this.billablePeriod != null && !this.billablePeriod.isEmpty();
12802    }
12803
12804    /**
12805     * @param value {@link #billablePeriod} (The period for which charges are being submitted.)
12806     */
12807    public ExplanationOfBenefit setBillablePeriod(Period value) { 
12808      this.billablePeriod = value;
12809      return this;
12810    }
12811
12812    /**
12813     * @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
12814     */
12815    public DateTimeType getCreatedElement() { 
12816      if (this.created == null)
12817        if (Configuration.errorOnAutoCreate())
12818          throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
12819        else if (Configuration.doAutoCreate())
12820          this.created = new DateTimeType(); // bb
12821      return this.created;
12822    }
12823
12824    public boolean hasCreatedElement() { 
12825      return this.created != null && !this.created.isEmpty();
12826    }
12827
12828    public boolean hasCreated() { 
12829      return this.created != null && !this.created.isEmpty();
12830    }
12831
12832    /**
12833     * @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
12834     */
12835    public ExplanationOfBenefit setCreatedElement(DateTimeType value) { 
12836      this.created = value;
12837      return this;
12838    }
12839
12840    /**
12841     * @return The date this resource was created.
12842     */
12843    public Date getCreated() { 
12844      return this.created == null ? null : this.created.getValue();
12845    }
12846
12847    /**
12848     * @param value The date this resource was created.
12849     */
12850    public ExplanationOfBenefit setCreated(Date value) { 
12851        if (this.created == null)
12852          this.created = new DateTimeType();
12853        this.created.setValue(value);
12854      return this;
12855    }
12856
12857    /**
12858     * @return {@link #enterer} (Individual who created the claim, predetermination or preauthorization.)
12859     */
12860    public Reference getEnterer() { 
12861      if (this.enterer == null)
12862        if (Configuration.errorOnAutoCreate())
12863          throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
12864        else if (Configuration.doAutoCreate())
12865          this.enterer = new Reference(); // cc
12866      return this.enterer;
12867    }
12868
12869    public boolean hasEnterer() { 
12870      return this.enterer != null && !this.enterer.isEmpty();
12871    }
12872
12873    /**
12874     * @param value {@link #enterer} (Individual who created the claim, predetermination or preauthorization.)
12875     */
12876    public ExplanationOfBenefit setEnterer(Reference value) { 
12877      this.enterer = value;
12878      return this;
12879    }
12880
12881    /**
12882     * @return {@link #insurer} (The party responsible for authorization, adjudication and reimbursement.)
12883     */
12884    public Reference getInsurer() { 
12885      if (this.insurer == null)
12886        if (Configuration.errorOnAutoCreate())
12887          throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
12888        else if (Configuration.doAutoCreate())
12889          this.insurer = new Reference(); // cc
12890      return this.insurer;
12891    }
12892
12893    public boolean hasInsurer() { 
12894      return this.insurer != null && !this.insurer.isEmpty();
12895    }
12896
12897    /**
12898     * @param value {@link #insurer} (The party responsible for authorization, adjudication and reimbursement.)
12899     */
12900    public ExplanationOfBenefit setInsurer(Reference value) { 
12901      this.insurer = value;
12902      return this;
12903    }
12904
12905    /**
12906     * @return {@link #provider} (The provider which is responsible for the claim, predetermination or preauthorization.)
12907     */
12908    public Reference getProvider() { 
12909      if (this.provider == null)
12910        if (Configuration.errorOnAutoCreate())
12911          throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
12912        else if (Configuration.doAutoCreate())
12913          this.provider = new Reference(); // cc
12914      return this.provider;
12915    }
12916
12917    public boolean hasProvider() { 
12918      return this.provider != null && !this.provider.isEmpty();
12919    }
12920
12921    /**
12922     * @param value {@link #provider} (The provider which is responsible for the claim, predetermination or preauthorization.)
12923     */
12924    public ExplanationOfBenefit setProvider(Reference value) { 
12925      this.provider = value;
12926      return this;
12927    }
12928
12929    /**
12930     * @return {@link #priority} (The provider-required urgency of processing the request. Typical values include: stat, routine deferred.)
12931     */
12932    public CodeableConcept getPriority() { 
12933      if (this.priority == null)
12934        if (Configuration.errorOnAutoCreate())
12935          throw new Error("Attempt to auto-create ExplanationOfBenefit.priority");
12936        else if (Configuration.doAutoCreate())
12937          this.priority = new CodeableConcept(); // cc
12938      return this.priority;
12939    }
12940
12941    public boolean hasPriority() { 
12942      return this.priority != null && !this.priority.isEmpty();
12943    }
12944
12945    /**
12946     * @param value {@link #priority} (The provider-required urgency of processing the request. Typical values include: stat, routine deferred.)
12947     */
12948    public ExplanationOfBenefit setPriority(CodeableConcept value) { 
12949      this.priority = value;
12950      return this;
12951    }
12952
12953    /**
12954     * @return {@link #fundsReserveRequested} (A code to indicate whether and for whom funds are to be reserved for future claims.)
12955     */
12956    public CodeableConcept getFundsReserveRequested() { 
12957      if (this.fundsReserveRequested == null)
12958        if (Configuration.errorOnAutoCreate())
12959          throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserveRequested");
12960        else if (Configuration.doAutoCreate())
12961          this.fundsReserveRequested = new CodeableConcept(); // cc
12962      return this.fundsReserveRequested;
12963    }
12964
12965    public boolean hasFundsReserveRequested() { 
12966      return this.fundsReserveRequested != null && !this.fundsReserveRequested.isEmpty();
12967    }
12968
12969    /**
12970     * @param value {@link #fundsReserveRequested} (A code to indicate whether and for whom funds are to be reserved for future claims.)
12971     */
12972    public ExplanationOfBenefit setFundsReserveRequested(CodeableConcept value) { 
12973      this.fundsReserveRequested = value;
12974      return this;
12975    }
12976
12977    /**
12978     * @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.)
12979     */
12980    public CodeableConcept getFundsReserve() { 
12981      if (this.fundsReserve == null)
12982        if (Configuration.errorOnAutoCreate())
12983          throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserve");
12984        else if (Configuration.doAutoCreate())
12985          this.fundsReserve = new CodeableConcept(); // cc
12986      return this.fundsReserve;
12987    }
12988
12989    public boolean hasFundsReserve() { 
12990      return this.fundsReserve != null && !this.fundsReserve.isEmpty();
12991    }
12992
12993    /**
12994     * @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.)
12995     */
12996    public ExplanationOfBenefit setFundsReserve(CodeableConcept value) { 
12997      this.fundsReserve = value;
12998      return this;
12999    }
13000
13001    /**
13002     * @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.)
13003     */
13004    public List<RelatedClaimComponent> getRelated() { 
13005      if (this.related == null)
13006        this.related = new ArrayList<RelatedClaimComponent>();
13007      return this.related;
13008    }
13009
13010    /**
13011     * @return Returns a reference to <code>this</code> for easy method chaining
13012     */
13013    public ExplanationOfBenefit setRelated(List<RelatedClaimComponent> theRelated) { 
13014      this.related = theRelated;
13015      return this;
13016    }
13017
13018    public boolean hasRelated() { 
13019      if (this.related == null)
13020        return false;
13021      for (RelatedClaimComponent item : this.related)
13022        if (!item.isEmpty())
13023          return true;
13024      return false;
13025    }
13026
13027    public RelatedClaimComponent addRelated() { //3
13028      RelatedClaimComponent t = new RelatedClaimComponent();
13029      if (this.related == null)
13030        this.related = new ArrayList<RelatedClaimComponent>();
13031      this.related.add(t);
13032      return t;
13033    }
13034
13035    public ExplanationOfBenefit addRelated(RelatedClaimComponent t) { //3
13036      if (t == null)
13037        return this;
13038      if (this.related == null)
13039        this.related = new ArrayList<RelatedClaimComponent>();
13040      this.related.add(t);
13041      return this;
13042    }
13043
13044    /**
13045     * @return The first repetition of repeating field {@link #related}, creating it if it does not already exist
13046     */
13047    public RelatedClaimComponent getRelatedFirstRep() { 
13048      if (getRelated().isEmpty()) {
13049        addRelated();
13050      }
13051      return getRelated().get(0);
13052    }
13053
13054    /**
13055     * @return {@link #prescription} (Prescription to support the dispensing of pharmacy, device or vision products.)
13056     */
13057    public Reference getPrescription() { 
13058      if (this.prescription == null)
13059        if (Configuration.errorOnAutoCreate())
13060          throw new Error("Attempt to auto-create ExplanationOfBenefit.prescription");
13061        else if (Configuration.doAutoCreate())
13062          this.prescription = new Reference(); // cc
13063      return this.prescription;
13064    }
13065
13066    public boolean hasPrescription() { 
13067      return this.prescription != null && !this.prescription.isEmpty();
13068    }
13069
13070    /**
13071     * @param value {@link #prescription} (Prescription to support the dispensing of pharmacy, device or vision products.)
13072     */
13073    public ExplanationOfBenefit setPrescription(Reference value) { 
13074      this.prescription = value;
13075      return this;
13076    }
13077
13078    /**
13079     * @return {@link #originalPrescription} (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
13080     */
13081    public Reference getOriginalPrescription() { 
13082      if (this.originalPrescription == null)
13083        if (Configuration.errorOnAutoCreate())
13084          throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
13085        else if (Configuration.doAutoCreate())
13086          this.originalPrescription = new Reference(); // cc
13087      return this.originalPrescription;
13088    }
13089
13090    public boolean hasOriginalPrescription() { 
13091      return this.originalPrescription != null && !this.originalPrescription.isEmpty();
13092    }
13093
13094    /**
13095     * @param value {@link #originalPrescription} (Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.)
13096     */
13097    public ExplanationOfBenefit setOriginalPrescription(Reference value) { 
13098      this.originalPrescription = value;
13099      return this;
13100    }
13101
13102    /**
13103     * @return {@link #payee} (The party to be reimbursed for cost of the products and services according to the terms of the policy.)
13104     */
13105    public PayeeComponent getPayee() { 
13106      if (this.payee == null)
13107        if (Configuration.errorOnAutoCreate())
13108          throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
13109        else if (Configuration.doAutoCreate())
13110          this.payee = new PayeeComponent(); // cc
13111      return this.payee;
13112    }
13113
13114    public boolean hasPayee() { 
13115      return this.payee != null && !this.payee.isEmpty();
13116    }
13117
13118    /**
13119     * @param value {@link #payee} (The party to be reimbursed for cost of the products and services according to the terms of the policy.)
13120     */
13121    public ExplanationOfBenefit setPayee(PayeeComponent value) { 
13122      this.payee = value;
13123      return this;
13124    }
13125
13126    /**
13127     * @return {@link #referral} (A reference to a referral resource.)
13128     */
13129    public Reference getReferral() { 
13130      if (this.referral == null)
13131        if (Configuration.errorOnAutoCreate())
13132          throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
13133        else if (Configuration.doAutoCreate())
13134          this.referral = new Reference(); // cc
13135      return this.referral;
13136    }
13137
13138    public boolean hasReferral() { 
13139      return this.referral != null && !this.referral.isEmpty();
13140    }
13141
13142    /**
13143     * @param value {@link #referral} (A reference to a referral resource.)
13144     */
13145    public ExplanationOfBenefit setReferral(Reference value) { 
13146      this.referral = value;
13147      return this;
13148    }
13149
13150    /**
13151     * @return {@link #facility} (Facility where the services were provided.)
13152     */
13153    public Reference getFacility() { 
13154      if (this.facility == null)
13155        if (Configuration.errorOnAutoCreate())
13156          throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
13157        else if (Configuration.doAutoCreate())
13158          this.facility = new Reference(); // cc
13159      return this.facility;
13160    }
13161
13162    public boolean hasFacility() { 
13163      return this.facility != null && !this.facility.isEmpty();
13164    }
13165
13166    /**
13167     * @param value {@link #facility} (Facility where the services were provided.)
13168     */
13169    public ExplanationOfBenefit setFacility(Reference value) { 
13170      this.facility = value;
13171      return this;
13172    }
13173
13174    /**
13175     * @return {@link #claim} (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
13176     */
13177    public Reference getClaim() { 
13178      if (this.claim == null)
13179        if (Configuration.errorOnAutoCreate())
13180          throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
13181        else if (Configuration.doAutoCreate())
13182          this.claim = new Reference(); // cc
13183      return this.claim;
13184    }
13185
13186    public boolean hasClaim() { 
13187      return this.claim != null && !this.claim.isEmpty();
13188    }
13189
13190    /**
13191     * @param value {@link #claim} (The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.)
13192     */
13193    public ExplanationOfBenefit setClaim(Reference value) { 
13194      this.claim = value;
13195      return this;
13196    }
13197
13198    /**
13199     * @return {@link #claimResponse} (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
13200     */
13201    public Reference getClaimResponse() { 
13202      if (this.claimResponse == null)
13203        if (Configuration.errorOnAutoCreate())
13204          throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
13205        else if (Configuration.doAutoCreate())
13206          this.claimResponse = new Reference(); // cc
13207      return this.claimResponse;
13208    }
13209
13210    public boolean hasClaimResponse() { 
13211      return this.claimResponse != null && !this.claimResponse.isEmpty();
13212    }
13213
13214    /**
13215     * @param value {@link #claimResponse} (The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.)
13216     */
13217    public ExplanationOfBenefit setClaimResponse(Reference value) { 
13218      this.claimResponse = value;
13219      return this;
13220    }
13221
13222    /**
13223     * @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
13224     */
13225    public Enumeration<RemittanceOutcome> getOutcomeElement() { 
13226      if (this.outcome == null)
13227        if (Configuration.errorOnAutoCreate())
13228          throw new Error("Attempt to auto-create ExplanationOfBenefit.outcome");
13229        else if (Configuration.doAutoCreate())
13230          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory()); // bb
13231      return this.outcome;
13232    }
13233
13234    public boolean hasOutcomeElement() { 
13235      return this.outcome != null && !this.outcome.isEmpty();
13236    }
13237
13238    public boolean hasOutcome() { 
13239      return this.outcome != null && !this.outcome.isEmpty();
13240    }
13241
13242    /**
13243     * @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
13244     */
13245    public ExplanationOfBenefit setOutcomeElement(Enumeration<RemittanceOutcome> value) { 
13246      this.outcome = value;
13247      return this;
13248    }
13249
13250    /**
13251     * @return The outcome of the claim, predetermination, or preauthorization processing.
13252     */
13253    public RemittanceOutcome getOutcome() { 
13254      return this.outcome == null ? null : this.outcome.getValue();
13255    }
13256
13257    /**
13258     * @param value The outcome of the claim, predetermination, or preauthorization processing.
13259     */
13260    public ExplanationOfBenefit setOutcome(RemittanceOutcome value) { 
13261        if (this.outcome == null)
13262          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory());
13263        this.outcome.setValue(value);
13264      return this;
13265    }
13266
13267    /**
13268     * @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
13269     */
13270    public StringType getDispositionElement() { 
13271      if (this.disposition == null)
13272        if (Configuration.errorOnAutoCreate())
13273          throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
13274        else if (Configuration.doAutoCreate())
13275          this.disposition = new StringType(); // bb
13276      return this.disposition;
13277    }
13278
13279    public boolean hasDispositionElement() { 
13280      return this.disposition != null && !this.disposition.isEmpty();
13281    }
13282
13283    public boolean hasDisposition() { 
13284      return this.disposition != null && !this.disposition.isEmpty();
13285    }
13286
13287    /**
13288     * @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
13289     */
13290    public ExplanationOfBenefit setDispositionElement(StringType value) { 
13291      this.disposition = value;
13292      return this;
13293    }
13294
13295    /**
13296     * @return A human readable description of the status of the adjudication.
13297     */
13298    public String getDisposition() { 
13299      return this.disposition == null ? null : this.disposition.getValue();
13300    }
13301
13302    /**
13303     * @param value A human readable description of the status of the adjudication.
13304     */
13305    public ExplanationOfBenefit setDisposition(String value) { 
13306      if (Utilities.noString(value))
13307        this.disposition = null;
13308      else {
13309        if (this.disposition == null)
13310          this.disposition = new StringType();
13311        this.disposition.setValue(value);
13312      }
13313      return this;
13314    }
13315
13316    /**
13317     * @return {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13318     */
13319    public List<StringType> getPreAuthRef() { 
13320      if (this.preAuthRef == null)
13321        this.preAuthRef = new ArrayList<StringType>();
13322      return this.preAuthRef;
13323    }
13324
13325    /**
13326     * @return Returns a reference to <code>this</code> for easy method chaining
13327     */
13328    public ExplanationOfBenefit setPreAuthRef(List<StringType> thePreAuthRef) { 
13329      this.preAuthRef = thePreAuthRef;
13330      return this;
13331    }
13332
13333    public boolean hasPreAuthRef() { 
13334      if (this.preAuthRef == null)
13335        return false;
13336      for (StringType item : this.preAuthRef)
13337        if (!item.isEmpty())
13338          return true;
13339      return false;
13340    }
13341
13342    /**
13343     * @return {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13344     */
13345    public StringType addPreAuthRefElement() {//2 
13346      StringType t = new StringType();
13347      if (this.preAuthRef == null)
13348        this.preAuthRef = new ArrayList<StringType>();
13349      this.preAuthRef.add(t);
13350      return t;
13351    }
13352
13353    /**
13354     * @param value {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13355     */
13356    public ExplanationOfBenefit addPreAuthRef(String value) { //1
13357      StringType t = new StringType();
13358      t.setValue(value);
13359      if (this.preAuthRef == null)
13360        this.preAuthRef = new ArrayList<StringType>();
13361      this.preAuthRef.add(t);
13362      return this;
13363    }
13364
13365    /**
13366     * @param value {@link #preAuthRef} (Reference from the Insurer which is used in later communications which refers to this adjudication.)
13367     */
13368    public boolean hasPreAuthRef(String value) { 
13369      if (this.preAuthRef == null)
13370        return false;
13371      for (StringType v : this.preAuthRef)
13372        if (v.getValue().equals(value)) // string
13373          return true;
13374      return false;
13375    }
13376
13377    /**
13378     * @return {@link #preAuthRefPeriod} (The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.)
13379     */
13380    public List<Period> getPreAuthRefPeriod() { 
13381      if (this.preAuthRefPeriod == null)
13382        this.preAuthRefPeriod = new ArrayList<Period>();
13383      return this.preAuthRefPeriod;
13384    }
13385
13386    /**
13387     * @return Returns a reference to <code>this</code> for easy method chaining
13388     */
13389    public ExplanationOfBenefit setPreAuthRefPeriod(List<Period> thePreAuthRefPeriod) { 
13390      this.preAuthRefPeriod = thePreAuthRefPeriod;
13391      return this;
13392    }
13393
13394    public boolean hasPreAuthRefPeriod() { 
13395      if (this.preAuthRefPeriod == null)
13396        return false;
13397      for (Period item : this.preAuthRefPeriod)
13398        if (!item.isEmpty())
13399          return true;
13400      return false;
13401    }
13402
13403    public Period addPreAuthRefPeriod() { //3
13404      Period t = new Period();
13405      if (this.preAuthRefPeriod == null)
13406        this.preAuthRefPeriod = new ArrayList<Period>();
13407      this.preAuthRefPeriod.add(t);
13408      return t;
13409    }
13410
13411    public ExplanationOfBenefit addPreAuthRefPeriod(Period t) { //3
13412      if (t == null)
13413        return this;
13414      if (this.preAuthRefPeriod == null)
13415        this.preAuthRefPeriod = new ArrayList<Period>();
13416      this.preAuthRefPeriod.add(t);
13417      return this;
13418    }
13419
13420    /**
13421     * @return The first repetition of repeating field {@link #preAuthRefPeriod}, creating it if it does not already exist
13422     */
13423    public Period getPreAuthRefPeriodFirstRep() { 
13424      if (getPreAuthRefPeriod().isEmpty()) {
13425        addPreAuthRefPeriod();
13426      }
13427      return getPreAuthRefPeriod().get(0);
13428    }
13429
13430    /**
13431     * @return {@link #careTeam} (The members of the team who provided the products and services.)
13432     */
13433    public List<CareTeamComponent> getCareTeam() { 
13434      if (this.careTeam == null)
13435        this.careTeam = new ArrayList<CareTeamComponent>();
13436      return this.careTeam;
13437    }
13438
13439    /**
13440     * @return Returns a reference to <code>this</code> for easy method chaining
13441     */
13442    public ExplanationOfBenefit setCareTeam(List<CareTeamComponent> theCareTeam) { 
13443      this.careTeam = theCareTeam;
13444      return this;
13445    }
13446
13447    public boolean hasCareTeam() { 
13448      if (this.careTeam == null)
13449        return false;
13450      for (CareTeamComponent item : this.careTeam)
13451        if (!item.isEmpty())
13452          return true;
13453      return false;
13454    }
13455
13456    public CareTeamComponent addCareTeam() { //3
13457      CareTeamComponent t = new CareTeamComponent();
13458      if (this.careTeam == null)
13459        this.careTeam = new ArrayList<CareTeamComponent>();
13460      this.careTeam.add(t);
13461      return t;
13462    }
13463
13464    public ExplanationOfBenefit addCareTeam(CareTeamComponent t) { //3
13465      if (t == null)
13466        return this;
13467      if (this.careTeam == null)
13468        this.careTeam = new ArrayList<CareTeamComponent>();
13469      this.careTeam.add(t);
13470      return this;
13471    }
13472
13473    /**
13474     * @return The first repetition of repeating field {@link #careTeam}, creating it if it does not already exist
13475     */
13476    public CareTeamComponent getCareTeamFirstRep() { 
13477      if (getCareTeam().isEmpty()) {
13478        addCareTeam();
13479      }
13480      return getCareTeam().get(0);
13481    }
13482
13483    /**
13484     * @return {@link #supportingInfo} (Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.)
13485     */
13486    public List<SupportingInformationComponent> getSupportingInfo() { 
13487      if (this.supportingInfo == null)
13488        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13489      return this.supportingInfo;
13490    }
13491
13492    /**
13493     * @return Returns a reference to <code>this</code> for easy method chaining
13494     */
13495    public ExplanationOfBenefit setSupportingInfo(List<SupportingInformationComponent> theSupportingInfo) { 
13496      this.supportingInfo = theSupportingInfo;
13497      return this;
13498    }
13499
13500    public boolean hasSupportingInfo() { 
13501      if (this.supportingInfo == null)
13502        return false;
13503      for (SupportingInformationComponent item : this.supportingInfo)
13504        if (!item.isEmpty())
13505          return true;
13506      return false;
13507    }
13508
13509    public SupportingInformationComponent addSupportingInfo() { //3
13510      SupportingInformationComponent t = new SupportingInformationComponent();
13511      if (this.supportingInfo == null)
13512        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13513      this.supportingInfo.add(t);
13514      return t;
13515    }
13516
13517    public ExplanationOfBenefit addSupportingInfo(SupportingInformationComponent t) { //3
13518      if (t == null)
13519        return this;
13520      if (this.supportingInfo == null)
13521        this.supportingInfo = new ArrayList<SupportingInformationComponent>();
13522      this.supportingInfo.add(t);
13523      return this;
13524    }
13525
13526    /**
13527     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist
13528     */
13529    public SupportingInformationComponent getSupportingInfoFirstRep() { 
13530      if (getSupportingInfo().isEmpty()) {
13531        addSupportingInfo();
13532      }
13533      return getSupportingInfo().get(0);
13534    }
13535
13536    /**
13537     * @return {@link #diagnosis} (Information about diagnoses relevant to the claim items.)
13538     */
13539    public List<DiagnosisComponent> getDiagnosis() { 
13540      if (this.diagnosis == null)
13541        this.diagnosis = new ArrayList<DiagnosisComponent>();
13542      return this.diagnosis;
13543    }
13544
13545    /**
13546     * @return Returns a reference to <code>this</code> for easy method chaining
13547     */
13548    public ExplanationOfBenefit setDiagnosis(List<DiagnosisComponent> theDiagnosis) { 
13549      this.diagnosis = theDiagnosis;
13550      return this;
13551    }
13552
13553    public boolean hasDiagnosis() { 
13554      if (this.diagnosis == null)
13555        return false;
13556      for (DiagnosisComponent item : this.diagnosis)
13557        if (!item.isEmpty())
13558          return true;
13559      return false;
13560    }
13561
13562    public DiagnosisComponent addDiagnosis() { //3
13563      DiagnosisComponent t = new DiagnosisComponent();
13564      if (this.diagnosis == null)
13565        this.diagnosis = new ArrayList<DiagnosisComponent>();
13566      this.diagnosis.add(t);
13567      return t;
13568    }
13569
13570    public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { //3
13571      if (t == null)
13572        return this;
13573      if (this.diagnosis == null)
13574        this.diagnosis = new ArrayList<DiagnosisComponent>();
13575      this.diagnosis.add(t);
13576      return this;
13577    }
13578
13579    /**
13580     * @return The first repetition of repeating field {@link #diagnosis}, creating it if it does not already exist
13581     */
13582    public DiagnosisComponent getDiagnosisFirstRep() { 
13583      if (getDiagnosis().isEmpty()) {
13584        addDiagnosis();
13585      }
13586      return getDiagnosis().get(0);
13587    }
13588
13589    /**
13590     * @return {@link #procedure} (Procedures performed on the patient relevant to the billing items with the claim.)
13591     */
13592    public List<ProcedureComponent> getProcedure() { 
13593      if (this.procedure == null)
13594        this.procedure = new ArrayList<ProcedureComponent>();
13595      return this.procedure;
13596    }
13597
13598    /**
13599     * @return Returns a reference to <code>this</code> for easy method chaining
13600     */
13601    public ExplanationOfBenefit setProcedure(List<ProcedureComponent> theProcedure) { 
13602      this.procedure = theProcedure;
13603      return this;
13604    }
13605
13606    public boolean hasProcedure() { 
13607      if (this.procedure == null)
13608        return false;
13609      for (ProcedureComponent item : this.procedure)
13610        if (!item.isEmpty())
13611          return true;
13612      return false;
13613    }
13614
13615    public ProcedureComponent addProcedure() { //3
13616      ProcedureComponent t = new ProcedureComponent();
13617      if (this.procedure == null)
13618        this.procedure = new ArrayList<ProcedureComponent>();
13619      this.procedure.add(t);
13620      return t;
13621    }
13622
13623    public ExplanationOfBenefit addProcedure(ProcedureComponent t) { //3
13624      if (t == null)
13625        return this;
13626      if (this.procedure == null)
13627        this.procedure = new ArrayList<ProcedureComponent>();
13628      this.procedure.add(t);
13629      return this;
13630    }
13631
13632    /**
13633     * @return The first repetition of repeating field {@link #procedure}, creating it if it does not already exist
13634     */
13635    public ProcedureComponent getProcedureFirstRep() { 
13636      if (getProcedure().isEmpty()) {
13637        addProcedure();
13638      }
13639      return getProcedure().get(0);
13640    }
13641
13642    /**
13643     * @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
13644     */
13645    public PositiveIntType getPrecedenceElement() { 
13646      if (this.precedence == null)
13647        if (Configuration.errorOnAutoCreate())
13648          throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
13649        else if (Configuration.doAutoCreate())
13650          this.precedence = new PositiveIntType(); // bb
13651      return this.precedence;
13652    }
13653
13654    public boolean hasPrecedenceElement() { 
13655      return this.precedence != null && !this.precedence.isEmpty();
13656    }
13657
13658    public boolean hasPrecedence() { 
13659      return this.precedence != null && !this.precedence.isEmpty();
13660    }
13661
13662    /**
13663     * @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
13664     */
13665    public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) { 
13666      this.precedence = value;
13667      return this;
13668    }
13669
13670    /**
13671     * @return This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
13672     */
13673    public int getPrecedence() { 
13674      return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
13675    }
13676
13677    /**
13678     * @param value This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.
13679     */
13680    public ExplanationOfBenefit setPrecedence(int value) { 
13681        if (this.precedence == null)
13682          this.precedence = new PositiveIntType();
13683        this.precedence.setValue(value);
13684      return this;
13685    }
13686
13687    /**
13688     * @return {@link #insurance} (Financial instruments for reimbursement for the health care products and services specified on the claim.)
13689     */
13690    public List<InsuranceComponent> getInsurance() { 
13691      if (this.insurance == null)
13692        this.insurance = new ArrayList<InsuranceComponent>();
13693      return this.insurance;
13694    }
13695
13696    /**
13697     * @return Returns a reference to <code>this</code> for easy method chaining
13698     */
13699    public ExplanationOfBenefit setInsurance(List<InsuranceComponent> theInsurance) { 
13700      this.insurance = theInsurance;
13701      return this;
13702    }
13703
13704    public boolean hasInsurance() { 
13705      if (this.insurance == null)
13706        return false;
13707      for (InsuranceComponent item : this.insurance)
13708        if (!item.isEmpty())
13709          return true;
13710      return false;
13711    }
13712
13713    public InsuranceComponent addInsurance() { //3
13714      InsuranceComponent t = new InsuranceComponent();
13715      if (this.insurance == null)
13716        this.insurance = new ArrayList<InsuranceComponent>();
13717      this.insurance.add(t);
13718      return t;
13719    }
13720
13721    public ExplanationOfBenefit addInsurance(InsuranceComponent t) { //3
13722      if (t == null)
13723        return this;
13724      if (this.insurance == null)
13725        this.insurance = new ArrayList<InsuranceComponent>();
13726      this.insurance.add(t);
13727      return this;
13728    }
13729
13730    /**
13731     * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist
13732     */
13733    public InsuranceComponent getInsuranceFirstRep() { 
13734      if (getInsurance().isEmpty()) {
13735        addInsurance();
13736      }
13737      return getInsurance().get(0);
13738    }
13739
13740    /**
13741     * @return {@link #accident} (Details of a accident which resulted in injuries which required the products and services listed in the claim.)
13742     */
13743    public AccidentComponent getAccident() { 
13744      if (this.accident == null)
13745        if (Configuration.errorOnAutoCreate())
13746          throw new Error("Attempt to auto-create ExplanationOfBenefit.accident");
13747        else if (Configuration.doAutoCreate())
13748          this.accident = new AccidentComponent(); // cc
13749      return this.accident;
13750    }
13751
13752    public boolean hasAccident() { 
13753      return this.accident != null && !this.accident.isEmpty();
13754    }
13755
13756    /**
13757     * @param value {@link #accident} (Details of a accident which resulted in injuries which required the products and services listed in the claim.)
13758     */
13759    public ExplanationOfBenefit setAccident(AccidentComponent value) { 
13760      this.accident = value;
13761      return this;
13762    }
13763
13764    /**
13765     * @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.)
13766     */
13767    public List<ItemComponent> getItem() { 
13768      if (this.item == null)
13769        this.item = new ArrayList<ItemComponent>();
13770      return this.item;
13771    }
13772
13773    /**
13774     * @return Returns a reference to <code>this</code> for easy method chaining
13775     */
13776    public ExplanationOfBenefit setItem(List<ItemComponent> theItem) { 
13777      this.item = theItem;
13778      return this;
13779    }
13780
13781    public boolean hasItem() { 
13782      if (this.item == null)
13783        return false;
13784      for (ItemComponent item : this.item)
13785        if (!item.isEmpty())
13786          return true;
13787      return false;
13788    }
13789
13790    public ItemComponent addItem() { //3
13791      ItemComponent t = new ItemComponent();
13792      if (this.item == null)
13793        this.item = new ArrayList<ItemComponent>();
13794      this.item.add(t);
13795      return t;
13796    }
13797
13798    public ExplanationOfBenefit addItem(ItemComponent t) { //3
13799      if (t == null)
13800        return this;
13801      if (this.item == null)
13802        this.item = new ArrayList<ItemComponent>();
13803      this.item.add(t);
13804      return this;
13805    }
13806
13807    /**
13808     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
13809     */
13810    public ItemComponent getItemFirstRep() { 
13811      if (getItem().isEmpty()) {
13812        addItem();
13813      }
13814      return getItem().get(0);
13815    }
13816
13817    /**
13818     * @return {@link #addItem} (The first-tier service adjudications for payor added product or service lines.)
13819     */
13820    public List<AddedItemComponent> getAddItem() { 
13821      if (this.addItem == null)
13822        this.addItem = new ArrayList<AddedItemComponent>();
13823      return this.addItem;
13824    }
13825
13826    /**
13827     * @return Returns a reference to <code>this</code> for easy method chaining
13828     */
13829    public ExplanationOfBenefit setAddItem(List<AddedItemComponent> theAddItem) { 
13830      this.addItem = theAddItem;
13831      return this;
13832    }
13833
13834    public boolean hasAddItem() { 
13835      if (this.addItem == null)
13836        return false;
13837      for (AddedItemComponent item : this.addItem)
13838        if (!item.isEmpty())
13839          return true;
13840      return false;
13841    }
13842
13843    public AddedItemComponent addAddItem() { //3
13844      AddedItemComponent t = new AddedItemComponent();
13845      if (this.addItem == null)
13846        this.addItem = new ArrayList<AddedItemComponent>();
13847      this.addItem.add(t);
13848      return t;
13849    }
13850
13851    public ExplanationOfBenefit addAddItem(AddedItemComponent t) { //3
13852      if (t == null)
13853        return this;
13854      if (this.addItem == null)
13855        this.addItem = new ArrayList<AddedItemComponent>();
13856      this.addItem.add(t);
13857      return this;
13858    }
13859
13860    /**
13861     * @return The first repetition of repeating field {@link #addItem}, creating it if it does not already exist
13862     */
13863    public AddedItemComponent getAddItemFirstRep() { 
13864      if (getAddItem().isEmpty()) {
13865        addAddItem();
13866      }
13867      return getAddItem().get(0);
13868    }
13869
13870    /**
13871     * @return {@link #adjudication} (The adjudication results which are presented at the header level rather than at the line-item or add-item levels.)
13872     */
13873    public List<AdjudicationComponent> getAdjudication() { 
13874      if (this.adjudication == null)
13875        this.adjudication = new ArrayList<AdjudicationComponent>();
13876      return this.adjudication;
13877    }
13878
13879    /**
13880     * @return Returns a reference to <code>this</code> for easy method chaining
13881     */
13882    public ExplanationOfBenefit setAdjudication(List<AdjudicationComponent> theAdjudication) { 
13883      this.adjudication = theAdjudication;
13884      return this;
13885    }
13886
13887    public boolean hasAdjudication() { 
13888      if (this.adjudication == null)
13889        return false;
13890      for (AdjudicationComponent item : this.adjudication)
13891        if (!item.isEmpty())
13892          return true;
13893      return false;
13894    }
13895
13896    public AdjudicationComponent addAdjudication() { //3
13897      AdjudicationComponent t = new AdjudicationComponent();
13898      if (this.adjudication == null)
13899        this.adjudication = new ArrayList<AdjudicationComponent>();
13900      this.adjudication.add(t);
13901      return t;
13902    }
13903
13904    public ExplanationOfBenefit addAdjudication(AdjudicationComponent t) { //3
13905      if (t == null)
13906        return this;
13907      if (this.adjudication == null)
13908        this.adjudication = new ArrayList<AdjudicationComponent>();
13909      this.adjudication.add(t);
13910      return this;
13911    }
13912
13913    /**
13914     * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
13915     */
13916    public AdjudicationComponent getAdjudicationFirstRep() { 
13917      if (getAdjudication().isEmpty()) {
13918        addAdjudication();
13919      }
13920      return getAdjudication().get(0);
13921    }
13922
13923    /**
13924     * @return {@link #total} (Categorized monetary totals for the adjudication.)
13925     */
13926    public List<TotalComponent> getTotal() { 
13927      if (this.total == null)
13928        this.total = new ArrayList<TotalComponent>();
13929      return this.total;
13930    }
13931
13932    /**
13933     * @return Returns a reference to <code>this</code> for easy method chaining
13934     */
13935    public ExplanationOfBenefit setTotal(List<TotalComponent> theTotal) { 
13936      this.total = theTotal;
13937      return this;
13938    }
13939
13940    public boolean hasTotal() { 
13941      if (this.total == null)
13942        return false;
13943      for (TotalComponent item : this.total)
13944        if (!item.isEmpty())
13945          return true;
13946      return false;
13947    }
13948
13949    public TotalComponent addTotal() { //3
13950      TotalComponent t = new TotalComponent();
13951      if (this.total == null)
13952        this.total = new ArrayList<TotalComponent>();
13953      this.total.add(t);
13954      return t;
13955    }
13956
13957    public ExplanationOfBenefit addTotal(TotalComponent t) { //3
13958      if (t == null)
13959        return this;
13960      if (this.total == null)
13961        this.total = new ArrayList<TotalComponent>();
13962      this.total.add(t);
13963      return this;
13964    }
13965
13966    /**
13967     * @return The first repetition of repeating field {@link #total}, creating it if it does not already exist
13968     */
13969    public TotalComponent getTotalFirstRep() { 
13970      if (getTotal().isEmpty()) {
13971        addTotal();
13972      }
13973      return getTotal().get(0);
13974    }
13975
13976    /**
13977     * @return {@link #payment} (Payment details for the adjudication of the claim.)
13978     */
13979    public PaymentComponent getPayment() { 
13980      if (this.payment == null)
13981        if (Configuration.errorOnAutoCreate())
13982          throw new Error("Attempt to auto-create ExplanationOfBenefit.payment");
13983        else if (Configuration.doAutoCreate())
13984          this.payment = new PaymentComponent(); // cc
13985      return this.payment;
13986    }
13987
13988    public boolean hasPayment() { 
13989      return this.payment != null && !this.payment.isEmpty();
13990    }
13991
13992    /**
13993     * @param value {@link #payment} (Payment details for the adjudication of the claim.)
13994     */
13995    public ExplanationOfBenefit setPayment(PaymentComponent value) { 
13996      this.payment = value;
13997      return this;
13998    }
13999
14000    /**
14001     * @return {@link #formCode} (A code for the form to be used for printing the content.)
14002     */
14003    public CodeableConcept getFormCode() { 
14004      if (this.formCode == null)
14005        if (Configuration.errorOnAutoCreate())
14006          throw new Error("Attempt to auto-create ExplanationOfBenefit.formCode");
14007        else if (Configuration.doAutoCreate())
14008          this.formCode = new CodeableConcept(); // cc
14009      return this.formCode;
14010    }
14011
14012    public boolean hasFormCode() { 
14013      return this.formCode != null && !this.formCode.isEmpty();
14014    }
14015
14016    /**
14017     * @param value {@link #formCode} (A code for the form to be used for printing the content.)
14018     */
14019    public ExplanationOfBenefit setFormCode(CodeableConcept value) { 
14020      this.formCode = value;
14021      return this;
14022    }
14023
14024    /**
14025     * @return {@link #form} (The actual form, by reference or inclusion, for printing the content or an EOB.)
14026     */
14027    public Attachment getForm() { 
14028      if (this.form == null)
14029        if (Configuration.errorOnAutoCreate())
14030          throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
14031        else if (Configuration.doAutoCreate())
14032          this.form = new Attachment(); // cc
14033      return this.form;
14034    }
14035
14036    public boolean hasForm() { 
14037      return this.form != null && !this.form.isEmpty();
14038    }
14039
14040    /**
14041     * @param value {@link #form} (The actual form, by reference or inclusion, for printing the content or an EOB.)
14042     */
14043    public ExplanationOfBenefit setForm(Attachment value) { 
14044      this.form = value;
14045      return this;
14046    }
14047
14048    /**
14049     * @return {@link #processNote} (A note that describes or explains adjudication results in a human readable form.)
14050     */
14051    public List<NoteComponent> getProcessNote() { 
14052      if (this.processNote == null)
14053        this.processNote = new ArrayList<NoteComponent>();
14054      return this.processNote;
14055    }
14056
14057    /**
14058     * @return Returns a reference to <code>this</code> for easy method chaining
14059     */
14060    public ExplanationOfBenefit setProcessNote(List<NoteComponent> theProcessNote) { 
14061      this.processNote = theProcessNote;
14062      return this;
14063    }
14064
14065    public boolean hasProcessNote() { 
14066      if (this.processNote == null)
14067        return false;
14068      for (NoteComponent item : this.processNote)
14069        if (!item.isEmpty())
14070          return true;
14071      return false;
14072    }
14073
14074    public NoteComponent addProcessNote() { //3
14075      NoteComponent t = new NoteComponent();
14076      if (this.processNote == null)
14077        this.processNote = new ArrayList<NoteComponent>();
14078      this.processNote.add(t);
14079      return t;
14080    }
14081
14082    public ExplanationOfBenefit addProcessNote(NoteComponent t) { //3
14083      if (t == null)
14084        return this;
14085      if (this.processNote == null)
14086        this.processNote = new ArrayList<NoteComponent>();
14087      this.processNote.add(t);
14088      return this;
14089    }
14090
14091    /**
14092     * @return The first repetition of repeating field {@link #processNote}, creating it if it does not already exist
14093     */
14094    public NoteComponent getProcessNoteFirstRep() { 
14095      if (getProcessNote().isEmpty()) {
14096        addProcessNote();
14097      }
14098      return getProcessNote().get(0);
14099    }
14100
14101    /**
14102     * @return {@link #benefitPeriod} (The term of the benefits documented in this response.)
14103     */
14104    public Period getBenefitPeriod() { 
14105      if (this.benefitPeriod == null)
14106        if (Configuration.errorOnAutoCreate())
14107          throw new Error("Attempt to auto-create ExplanationOfBenefit.benefitPeriod");
14108        else if (Configuration.doAutoCreate())
14109          this.benefitPeriod = new Period(); // cc
14110      return this.benefitPeriod;
14111    }
14112
14113    public boolean hasBenefitPeriod() { 
14114      return this.benefitPeriod != null && !this.benefitPeriod.isEmpty();
14115    }
14116
14117    /**
14118     * @param value {@link #benefitPeriod} (The term of the benefits documented in this response.)
14119     */
14120    public ExplanationOfBenefit setBenefitPeriod(Period value) { 
14121      this.benefitPeriod = value;
14122      return this;
14123    }
14124
14125    /**
14126     * @return {@link #benefitBalance} (Balance by Benefit Category.)
14127     */
14128    public List<BenefitBalanceComponent> getBenefitBalance() { 
14129      if (this.benefitBalance == null)
14130        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14131      return this.benefitBalance;
14132    }
14133
14134    /**
14135     * @return Returns a reference to <code>this</code> for easy method chaining
14136     */
14137    public ExplanationOfBenefit setBenefitBalance(List<BenefitBalanceComponent> theBenefitBalance) { 
14138      this.benefitBalance = theBenefitBalance;
14139      return this;
14140    }
14141
14142    public boolean hasBenefitBalance() { 
14143      if (this.benefitBalance == null)
14144        return false;
14145      for (BenefitBalanceComponent item : this.benefitBalance)
14146        if (!item.isEmpty())
14147          return true;
14148      return false;
14149    }
14150
14151    public BenefitBalanceComponent addBenefitBalance() { //3
14152      BenefitBalanceComponent t = new BenefitBalanceComponent();
14153      if (this.benefitBalance == null)
14154        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14155      this.benefitBalance.add(t);
14156      return t;
14157    }
14158
14159    public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { //3
14160      if (t == null)
14161        return this;
14162      if (this.benefitBalance == null)
14163        this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14164      this.benefitBalance.add(t);
14165      return this;
14166    }
14167
14168    /**
14169     * @return The first repetition of repeating field {@link #benefitBalance}, creating it if it does not already exist
14170     */
14171    public BenefitBalanceComponent getBenefitBalanceFirstRep() { 
14172      if (getBenefitBalance().isEmpty()) {
14173        addBenefitBalance();
14174      }
14175      return getBenefitBalance().get(0);
14176    }
14177
14178      protected void listChildren(List<Property> children) {
14179        super.listChildren(children);
14180        children.add(new Property("identifier", "Identifier", "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier));
14181        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
14182        children.add(new Property("type", "CodeableConcept", "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type));
14183        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));
14184        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));
14185        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));
14186        children.add(new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1, billablePeriod));
14187        children.add(new Property("created", "dateTime", "The date this resource was created.", 0, 1, created));
14188        children.add(new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer));
14189        children.add(new Property("insurer", "Reference(Organization)", "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer));
14190        children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider));
14191        children.add(new Property("priority", "CodeableConcept", "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.", 0, 1, priority));
14192        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));
14193        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));
14194        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));
14195        children.add(new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription));
14196        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));
14197        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));
14198        children.add(new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral));
14199        children.add(new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility));
14200        children.add(new Property("claim", "Reference(Claim)", "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.", 0, 1, claim));
14201        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));
14202        children.add(new Property("outcome", "code", "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome));
14203        children.add(new Property("disposition", "string", "A human readable description of the status of the adjudication.", 0, 1, disposition));
14204        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));
14205        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));
14206        children.add(new Property("careTeam", "", "The members of the team who provided the products and services.", 0, java.lang.Integer.MAX_VALUE, careTeam));
14207        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));
14208        children.add(new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0, java.lang.Integer.MAX_VALUE, diagnosis));
14209        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));
14210        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));
14211        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));
14212        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));
14213        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));
14214        children.add(new Property("addItem", "", "The first-tier service adjudications for payor added product or service lines.", 0, java.lang.Integer.MAX_VALUE, addItem));
14215        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));
14216        children.add(new Property("total", "", "Categorized monetary totals for the adjudication.", 0, java.lang.Integer.MAX_VALUE, total));
14217        children.add(new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment));
14218        children.add(new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.", 0, 1, formCode));
14219        children.add(new Property("form", "Attachment", "The actual form, by reference or inclusion, for printing the content or an EOB.", 0, 1, form));
14220        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));
14221        children.add(new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1, benefitPeriod));
14222        children.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance));
14223      }
14224
14225      @Override
14226      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
14227        switch (_hash) {
14228        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier);
14229        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
14230        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type);
14231        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);
14232        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);
14233        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);
14234        case -332066046: /*billablePeriod*/  return new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1, billablePeriod);
14235        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date this resource was created.", 0, 1, created);
14236        case -1591951995: /*enterer*/  return new Property("enterer", "Reference(Practitioner|PractitionerRole)", "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer);
14237        case 1957615864: /*insurer*/  return new Property("insurer", "Reference(Organization)", "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer);
14238        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);
14239        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);
14240        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);
14241        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);
14242        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);
14243        case 460301338: /*prescription*/  return new Property("prescription", "Reference(MedicationRequest|VisionPrescription)", "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription);
14244        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);
14245        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);
14246        case -722568291: /*referral*/  return new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral);
14247        case 501116579: /*facility*/  return new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility);
14248        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);
14249        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);
14250        case -1106507950: /*outcome*/  return new Property("outcome", "code", "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome);
14251        case 583380919: /*disposition*/  return new Property("disposition", "string", "A human readable description of the status of the adjudication.", 0, 1, disposition);
14252        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);
14253        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);
14254        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);
14255        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);
14256        case 1196993265: /*diagnosis*/  return new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0, java.lang.Integer.MAX_VALUE, diagnosis);
14257        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);
14258        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);
14259        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);
14260        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);
14261        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);
14262        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);
14263        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);
14264        case 110549828: /*total*/  return new Property("total", "", "Categorized monetary totals for the adjudication.", 0, java.lang.Integer.MAX_VALUE, total);
14265        case -786681338: /*payment*/  return new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment);
14266        case 473181393: /*formCode*/  return new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.", 0, 1, formCode);
14267        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);
14268        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);
14269        case -407369416: /*benefitPeriod*/  return new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1, benefitPeriod);
14270        case 596003397: /*benefitBalance*/  return new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE, benefitBalance);
14271        default: return super.getNamedProperty(_hash, _name, _checkValid);
14272        }
14273
14274      }
14275
14276      @Override
14277      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
14278        switch (hash) {
14279        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
14280        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ExplanationOfBenefitStatus>
14281        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
14282        case -1868521062: /*subType*/ return this.subType == null ? new Base[0] : new Base[] {this.subType}; // CodeableConcept
14283        case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<Use>
14284        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
14285        case -332066046: /*billablePeriod*/ return this.billablePeriod == null ? new Base[0] : new Base[] {this.billablePeriod}; // Period
14286        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
14287        case -1591951995: /*enterer*/ return this.enterer == null ? new Base[0] : new Base[] {this.enterer}; // Reference
14288        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
14289        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
14290        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
14291        case -1688904576: /*fundsReserveRequested*/ return this.fundsReserveRequested == null ? new Base[0] : new Base[] {this.fundsReserveRequested}; // CodeableConcept
14292        case 1314609806: /*fundsReserve*/ return this.fundsReserve == null ? new Base[0] : new Base[] {this.fundsReserve}; // CodeableConcept
14293        case 1090493483: /*related*/ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimComponent
14294        case 460301338: /*prescription*/ return this.prescription == null ? new Base[0] : new Base[] {this.prescription}; // Reference
14295        case -1814015861: /*originalPrescription*/ return this.originalPrescription == null ? new Base[0] : new Base[] {this.originalPrescription}; // Reference
14296        case 106443592: /*payee*/ return this.payee == null ? new Base[0] : new Base[] {this.payee}; // PayeeComponent
14297        case -722568291: /*referral*/ return this.referral == null ? new Base[0] : new Base[] {this.referral}; // Reference
14298        case 501116579: /*facility*/ return this.facility == null ? new Base[0] : new Base[] {this.facility}; // Reference
14299        case 94742588: /*claim*/ return this.claim == null ? new Base[0] : new Base[] {this.claim}; // Reference
14300        case 689513629: /*claimResponse*/ return this.claimResponse == null ? new Base[0] : new Base[] {this.claimResponse}; // Reference
14301        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // Enumeration<RemittanceOutcome>
14302        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
14303        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
14304        case -1262920311: /*preAuthRefPeriod*/ return this.preAuthRefPeriod == null ? new Base[0] : this.preAuthRefPeriod.toArray(new Base[this.preAuthRefPeriod.size()]); // Period
14305        case -7323378: /*careTeam*/ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // CareTeamComponent
14306        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // SupportingInformationComponent
14307        case 1196993265: /*diagnosis*/ return this.diagnosis == null ? new Base[0] : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
14308        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
14309        case 159695370: /*precedence*/ return this.precedence == null ? new Base[0] : new Base[] {this.precedence}; // PositiveIntType
14310        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // InsuranceComponent
14311        case -2143202801: /*accident*/ return this.accident == null ? new Base[0] : new Base[] {this.accident}; // AccidentComponent
14312        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
14313        case -1148899500: /*addItem*/ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
14314        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
14315        case 110549828: /*total*/ return this.total == null ? new Base[0] : this.total.toArray(new Base[this.total.size()]); // TotalComponent
14316        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // PaymentComponent
14317        case 473181393: /*formCode*/ return this.formCode == null ? new Base[0] : new Base[] {this.formCode}; // CodeableConcept
14318        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // Attachment
14319        case 202339073: /*processNote*/ return this.processNote == null ? new Base[0] : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
14320        case -407369416: /*benefitPeriod*/ return this.benefitPeriod == null ? new Base[0] : new Base[] {this.benefitPeriod}; // Period
14321        case 596003397: /*benefitBalance*/ return this.benefitBalance == null ? new Base[0] : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
14322        default: return super.getProperty(hash, name, checkValid);
14323        }
14324
14325      }
14326
14327      @Override
14328      public Base setProperty(int hash, String name, Base value) throws FHIRException {
14329        switch (hash) {
14330        case -1618432855: // identifier
14331          this.getIdentifier().add(castToIdentifier(value)); // Identifier
14332          return value;
14333        case -892481550: // status
14334          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
14335          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
14336          return value;
14337        case 3575610: // type
14338          this.type = castToCodeableConcept(value); // CodeableConcept
14339          return value;
14340        case -1868521062: // subType
14341          this.subType = castToCodeableConcept(value); // CodeableConcept
14342          return value;
14343        case 116103: // use
14344          value = new UseEnumFactory().fromType(castToCode(value));
14345          this.use = (Enumeration) value; // Enumeration<Use>
14346          return value;
14347        case -791418107: // patient
14348          this.patient = castToReference(value); // Reference
14349          return value;
14350        case -332066046: // billablePeriod
14351          this.billablePeriod = castToPeriod(value); // Period
14352          return value;
14353        case 1028554472: // created
14354          this.created = castToDateTime(value); // DateTimeType
14355          return value;
14356        case -1591951995: // enterer
14357          this.enterer = castToReference(value); // Reference
14358          return value;
14359        case 1957615864: // insurer
14360          this.insurer = castToReference(value); // Reference
14361          return value;
14362        case -987494927: // provider
14363          this.provider = castToReference(value); // Reference
14364          return value;
14365        case -1165461084: // priority
14366          this.priority = castToCodeableConcept(value); // CodeableConcept
14367          return value;
14368        case -1688904576: // fundsReserveRequested
14369          this.fundsReserveRequested = castToCodeableConcept(value); // CodeableConcept
14370          return value;
14371        case 1314609806: // fundsReserve
14372          this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
14373          return value;
14374        case 1090493483: // related
14375          this.getRelated().add((RelatedClaimComponent) value); // RelatedClaimComponent
14376          return value;
14377        case 460301338: // prescription
14378          this.prescription = castToReference(value); // Reference
14379          return value;
14380        case -1814015861: // originalPrescription
14381          this.originalPrescription = castToReference(value); // Reference
14382          return value;
14383        case 106443592: // payee
14384          this.payee = (PayeeComponent) value; // PayeeComponent
14385          return value;
14386        case -722568291: // referral
14387          this.referral = castToReference(value); // Reference
14388          return value;
14389        case 501116579: // facility
14390          this.facility = castToReference(value); // Reference
14391          return value;
14392        case 94742588: // claim
14393          this.claim = castToReference(value); // Reference
14394          return value;
14395        case 689513629: // claimResponse
14396          this.claimResponse = castToReference(value); // Reference
14397          return value;
14398        case -1106507950: // outcome
14399          value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
14400          this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
14401          return value;
14402        case 583380919: // disposition
14403          this.disposition = castToString(value); // StringType
14404          return value;
14405        case 522246568: // preAuthRef
14406          this.getPreAuthRef().add(castToString(value)); // StringType
14407          return value;
14408        case -1262920311: // preAuthRefPeriod
14409          this.getPreAuthRefPeriod().add(castToPeriod(value)); // Period
14410          return value;
14411        case -7323378: // careTeam
14412          this.getCareTeam().add((CareTeamComponent) value); // CareTeamComponent
14413          return value;
14414        case 1922406657: // supportingInfo
14415          this.getSupportingInfo().add((SupportingInformationComponent) value); // SupportingInformationComponent
14416          return value;
14417        case 1196993265: // diagnosis
14418          this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
14419          return value;
14420        case -1095204141: // procedure
14421          this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
14422          return value;
14423        case 159695370: // precedence
14424          this.precedence = castToPositiveInt(value); // PositiveIntType
14425          return value;
14426        case 73049818: // insurance
14427          this.getInsurance().add((InsuranceComponent) value); // InsuranceComponent
14428          return value;
14429        case -2143202801: // accident
14430          this.accident = (AccidentComponent) value; // AccidentComponent
14431          return value;
14432        case 3242771: // item
14433          this.getItem().add((ItemComponent) value); // ItemComponent
14434          return value;
14435        case -1148899500: // addItem
14436          this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
14437          return value;
14438        case -231349275: // adjudication
14439          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
14440          return value;
14441        case 110549828: // total
14442          this.getTotal().add((TotalComponent) value); // TotalComponent
14443          return value;
14444        case -786681338: // payment
14445          this.payment = (PaymentComponent) value; // PaymentComponent
14446          return value;
14447        case 473181393: // formCode
14448          this.formCode = castToCodeableConcept(value); // CodeableConcept
14449          return value;
14450        case 3148996: // form
14451          this.form = castToAttachment(value); // Attachment
14452          return value;
14453        case 202339073: // processNote
14454          this.getProcessNote().add((NoteComponent) value); // NoteComponent
14455          return value;
14456        case -407369416: // benefitPeriod
14457          this.benefitPeriod = castToPeriod(value); // Period
14458          return value;
14459        case 596003397: // benefitBalance
14460          this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
14461          return value;
14462        default: return super.setProperty(hash, name, value);
14463        }
14464
14465      }
14466
14467      @Override
14468      public Base setProperty(String name, Base value) throws FHIRException {
14469        if (name.equals("identifier")) {
14470          this.getIdentifier().add(castToIdentifier(value));
14471        } else if (name.equals("status")) {
14472          value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
14473          this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
14474        } else if (name.equals("type")) {
14475          this.type = castToCodeableConcept(value); // CodeableConcept
14476        } else if (name.equals("subType")) {
14477          this.subType = castToCodeableConcept(value); // CodeableConcept
14478        } else if (name.equals("use")) {
14479          value = new UseEnumFactory().fromType(castToCode(value));
14480          this.use = (Enumeration) value; // Enumeration<Use>
14481        } else if (name.equals("patient")) {
14482          this.patient = castToReference(value); // Reference
14483        } else if (name.equals("billablePeriod")) {
14484          this.billablePeriod = castToPeriod(value); // Period
14485        } else if (name.equals("created")) {
14486          this.created = castToDateTime(value); // DateTimeType
14487        } else if (name.equals("enterer")) {
14488          this.enterer = castToReference(value); // Reference
14489        } else if (name.equals("insurer")) {
14490          this.insurer = castToReference(value); // Reference
14491        } else if (name.equals("provider")) {
14492          this.provider = castToReference(value); // Reference
14493        } else if (name.equals("priority")) {
14494          this.priority = castToCodeableConcept(value); // CodeableConcept
14495        } else if (name.equals("fundsReserveRequested")) {
14496          this.fundsReserveRequested = castToCodeableConcept(value); // CodeableConcept
14497        } else if (name.equals("fundsReserve")) {
14498          this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
14499        } else if (name.equals("related")) {
14500          this.getRelated().add((RelatedClaimComponent) value);
14501        } else if (name.equals("prescription")) {
14502          this.prescription = castToReference(value); // Reference
14503        } else if (name.equals("originalPrescription")) {
14504          this.originalPrescription = castToReference(value); // Reference
14505        } else if (name.equals("payee")) {
14506          this.payee = (PayeeComponent) value; // PayeeComponent
14507        } else if (name.equals("referral")) {
14508          this.referral = castToReference(value); // Reference
14509        } else if (name.equals("facility")) {
14510          this.facility = castToReference(value); // Reference
14511        } else if (name.equals("claim")) {
14512          this.claim = castToReference(value); // Reference
14513        } else if (name.equals("claimResponse")) {
14514          this.claimResponse = castToReference(value); // Reference
14515        } else if (name.equals("outcome")) {
14516          value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
14517          this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
14518        } else if (name.equals("disposition")) {
14519          this.disposition = castToString(value); // StringType
14520        } else if (name.equals("preAuthRef")) {
14521          this.getPreAuthRef().add(castToString(value));
14522        } else if (name.equals("preAuthRefPeriod")) {
14523          this.getPreAuthRefPeriod().add(castToPeriod(value));
14524        } else if (name.equals("careTeam")) {
14525          this.getCareTeam().add((CareTeamComponent) value);
14526        } else if (name.equals("supportingInfo")) {
14527          this.getSupportingInfo().add((SupportingInformationComponent) value);
14528        } else if (name.equals("diagnosis")) {
14529          this.getDiagnosis().add((DiagnosisComponent) value);
14530        } else if (name.equals("procedure")) {
14531          this.getProcedure().add((ProcedureComponent) value);
14532        } else if (name.equals("precedence")) {
14533          this.precedence = castToPositiveInt(value); // PositiveIntType
14534        } else if (name.equals("insurance")) {
14535          this.getInsurance().add((InsuranceComponent) value);
14536        } else if (name.equals("accident")) {
14537          this.accident = (AccidentComponent) value; // AccidentComponent
14538        } else if (name.equals("item")) {
14539          this.getItem().add((ItemComponent) value);
14540        } else if (name.equals("addItem")) {
14541          this.getAddItem().add((AddedItemComponent) value);
14542        } else if (name.equals("adjudication")) {
14543          this.getAdjudication().add((AdjudicationComponent) value);
14544        } else if (name.equals("total")) {
14545          this.getTotal().add((TotalComponent) value);
14546        } else if (name.equals("payment")) {
14547          this.payment = (PaymentComponent) value; // PaymentComponent
14548        } else if (name.equals("formCode")) {
14549          this.formCode = castToCodeableConcept(value); // CodeableConcept
14550        } else if (name.equals("form")) {
14551          this.form = castToAttachment(value); // Attachment
14552        } else if (name.equals("processNote")) {
14553          this.getProcessNote().add((NoteComponent) value);
14554        } else if (name.equals("benefitPeriod")) {
14555          this.benefitPeriod = castToPeriod(value); // Period
14556        } else if (name.equals("benefitBalance")) {
14557          this.getBenefitBalance().add((BenefitBalanceComponent) value);
14558        } else
14559          return super.setProperty(name, value);
14560        return value;
14561      }
14562
14563      @Override
14564      public Base makeProperty(int hash, String name) throws FHIRException {
14565        switch (hash) {
14566        case -1618432855:  return addIdentifier(); 
14567        case -892481550:  return getStatusElement();
14568        case 3575610:  return getType();
14569        case -1868521062:  return getSubType();
14570        case 116103:  return getUseElement();
14571        case -791418107:  return getPatient();
14572        case -332066046:  return getBillablePeriod();
14573        case 1028554472:  return getCreatedElement();
14574        case -1591951995:  return getEnterer();
14575        case 1957615864:  return getInsurer();
14576        case -987494927:  return getProvider();
14577        case -1165461084:  return getPriority();
14578        case -1688904576:  return getFundsReserveRequested();
14579        case 1314609806:  return getFundsReserve();
14580        case 1090493483:  return addRelated(); 
14581        case 460301338:  return getPrescription();
14582        case -1814015861:  return getOriginalPrescription();
14583        case 106443592:  return getPayee();
14584        case -722568291:  return getReferral();
14585        case 501116579:  return getFacility();
14586        case 94742588:  return getClaim();
14587        case 689513629:  return getClaimResponse();
14588        case -1106507950:  return getOutcomeElement();
14589        case 583380919:  return getDispositionElement();
14590        case 522246568:  return addPreAuthRefElement();
14591        case -1262920311:  return addPreAuthRefPeriod(); 
14592        case -7323378:  return addCareTeam(); 
14593        case 1922406657:  return addSupportingInfo(); 
14594        case 1196993265:  return addDiagnosis(); 
14595        case -1095204141:  return addProcedure(); 
14596        case 159695370:  return getPrecedenceElement();
14597        case 73049818:  return addInsurance(); 
14598        case -2143202801:  return getAccident();
14599        case 3242771:  return addItem(); 
14600        case -1148899500:  return addAddItem(); 
14601        case -231349275:  return addAdjudication(); 
14602        case 110549828:  return addTotal(); 
14603        case -786681338:  return getPayment();
14604        case 473181393:  return getFormCode();
14605        case 3148996:  return getForm();
14606        case 202339073:  return addProcessNote(); 
14607        case -407369416:  return getBenefitPeriod();
14608        case 596003397:  return addBenefitBalance(); 
14609        default: return super.makeProperty(hash, name);
14610        }
14611
14612      }
14613
14614      @Override
14615      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
14616        switch (hash) {
14617        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
14618        case -892481550: /*status*/ return new String[] {"code"};
14619        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
14620        case -1868521062: /*subType*/ return new String[] {"CodeableConcept"};
14621        case 116103: /*use*/ return new String[] {"code"};
14622        case -791418107: /*patient*/ return new String[] {"Reference"};
14623        case -332066046: /*billablePeriod*/ return new String[] {"Period"};
14624        case 1028554472: /*created*/ return new String[] {"dateTime"};
14625        case -1591951995: /*enterer*/ return new String[] {"Reference"};
14626        case 1957615864: /*insurer*/ return new String[] {"Reference"};
14627        case -987494927: /*provider*/ return new String[] {"Reference"};
14628        case -1165461084: /*priority*/ return new String[] {"CodeableConcept"};
14629        case -1688904576: /*fundsReserveRequested*/ return new String[] {"CodeableConcept"};
14630        case 1314609806: /*fundsReserve*/ return new String[] {"CodeableConcept"};
14631        case 1090493483: /*related*/ return new String[] {};
14632        case 460301338: /*prescription*/ return new String[] {"Reference"};
14633        case -1814015861: /*originalPrescription*/ return new String[] {"Reference"};
14634        case 106443592: /*payee*/ return new String[] {};
14635        case -722568291: /*referral*/ return new String[] {"Reference"};
14636        case 501116579: /*facility*/ return new String[] {"Reference"};
14637        case 94742588: /*claim*/ return new String[] {"Reference"};
14638        case 689513629: /*claimResponse*/ return new String[] {"Reference"};
14639        case -1106507950: /*outcome*/ return new String[] {"code"};
14640        case 583380919: /*disposition*/ return new String[] {"string"};
14641        case 522246568: /*preAuthRef*/ return new String[] {"string"};
14642        case -1262920311: /*preAuthRefPeriod*/ return new String[] {"Period"};
14643        case -7323378: /*careTeam*/ return new String[] {};
14644        case 1922406657: /*supportingInfo*/ return new String[] {};
14645        case 1196993265: /*diagnosis*/ return new String[] {};
14646        case -1095204141: /*procedure*/ return new String[] {};
14647        case 159695370: /*precedence*/ return new String[] {"positiveInt"};
14648        case 73049818: /*insurance*/ return new String[] {};
14649        case -2143202801: /*accident*/ return new String[] {};
14650        case 3242771: /*item*/ return new String[] {};
14651        case -1148899500: /*addItem*/ return new String[] {};
14652        case -231349275: /*adjudication*/ return new String[] {"@ExplanationOfBenefit.item.adjudication"};
14653        case 110549828: /*total*/ return new String[] {};
14654        case -786681338: /*payment*/ return new String[] {};
14655        case 473181393: /*formCode*/ return new String[] {"CodeableConcept"};
14656        case 3148996: /*form*/ return new String[] {"Attachment"};
14657        case 202339073: /*processNote*/ return new String[] {};
14658        case -407369416: /*benefitPeriod*/ return new String[] {"Period"};
14659        case 596003397: /*benefitBalance*/ return new String[] {};
14660        default: return super.getTypesForProperty(hash, name);
14661        }
14662
14663      }
14664
14665      @Override
14666      public Base addChild(String name) throws FHIRException {
14667        if (name.equals("identifier")) {
14668          return addIdentifier();
14669        }
14670        else if (name.equals("status")) {
14671          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.status");
14672        }
14673        else if (name.equals("type")) {
14674          this.type = new CodeableConcept();
14675          return this.type;
14676        }
14677        else if (name.equals("subType")) {
14678          this.subType = new CodeableConcept();
14679          return this.subType;
14680        }
14681        else if (name.equals("use")) {
14682          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.use");
14683        }
14684        else if (name.equals("patient")) {
14685          this.patient = new Reference();
14686          return this.patient;
14687        }
14688        else if (name.equals("billablePeriod")) {
14689          this.billablePeriod = new Period();
14690          return this.billablePeriod;
14691        }
14692        else if (name.equals("created")) {
14693          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.created");
14694        }
14695        else if (name.equals("enterer")) {
14696          this.enterer = new Reference();
14697          return this.enterer;
14698        }
14699        else if (name.equals("insurer")) {
14700          this.insurer = new Reference();
14701          return this.insurer;
14702        }
14703        else if (name.equals("provider")) {
14704          this.provider = new Reference();
14705          return this.provider;
14706        }
14707        else if (name.equals("priority")) {
14708          this.priority = new CodeableConcept();
14709          return this.priority;
14710        }
14711        else if (name.equals("fundsReserveRequested")) {
14712          this.fundsReserveRequested = new CodeableConcept();
14713          return this.fundsReserveRequested;
14714        }
14715        else if (name.equals("fundsReserve")) {
14716          this.fundsReserve = new CodeableConcept();
14717          return this.fundsReserve;
14718        }
14719        else if (name.equals("related")) {
14720          return addRelated();
14721        }
14722        else if (name.equals("prescription")) {
14723          this.prescription = new Reference();
14724          return this.prescription;
14725        }
14726        else if (name.equals("originalPrescription")) {
14727          this.originalPrescription = new Reference();
14728          return this.originalPrescription;
14729        }
14730        else if (name.equals("payee")) {
14731          this.payee = new PayeeComponent();
14732          return this.payee;
14733        }
14734        else if (name.equals("referral")) {
14735          this.referral = new Reference();
14736          return this.referral;
14737        }
14738        else if (name.equals("facility")) {
14739          this.facility = new Reference();
14740          return this.facility;
14741        }
14742        else if (name.equals("claim")) {
14743          this.claim = new Reference();
14744          return this.claim;
14745        }
14746        else if (name.equals("claimResponse")) {
14747          this.claimResponse = new Reference();
14748          return this.claimResponse;
14749        }
14750        else if (name.equals("outcome")) {
14751          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.outcome");
14752        }
14753        else if (name.equals("disposition")) {
14754          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.disposition");
14755        }
14756        else if (name.equals("preAuthRef")) {
14757          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.preAuthRef");
14758        }
14759        else if (name.equals("preAuthRefPeriod")) {
14760          return addPreAuthRefPeriod();
14761        }
14762        else if (name.equals("careTeam")) {
14763          return addCareTeam();
14764        }
14765        else if (name.equals("supportingInfo")) {
14766          return addSupportingInfo();
14767        }
14768        else if (name.equals("diagnosis")) {
14769          return addDiagnosis();
14770        }
14771        else if (name.equals("procedure")) {
14772          return addProcedure();
14773        }
14774        else if (name.equals("precedence")) {
14775          throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.precedence");
14776        }
14777        else if (name.equals("insurance")) {
14778          return addInsurance();
14779        }
14780        else if (name.equals("accident")) {
14781          this.accident = new AccidentComponent();
14782          return this.accident;
14783        }
14784        else if (name.equals("item")) {
14785          return addItem();
14786        }
14787        else if (name.equals("addItem")) {
14788          return addAddItem();
14789        }
14790        else if (name.equals("adjudication")) {
14791          return addAdjudication();
14792        }
14793        else if (name.equals("total")) {
14794          return addTotal();
14795        }
14796        else if (name.equals("payment")) {
14797          this.payment = new PaymentComponent();
14798          return this.payment;
14799        }
14800        else if (name.equals("formCode")) {
14801          this.formCode = new CodeableConcept();
14802          return this.formCode;
14803        }
14804        else if (name.equals("form")) {
14805          this.form = new Attachment();
14806          return this.form;
14807        }
14808        else if (name.equals("processNote")) {
14809          return addProcessNote();
14810        }
14811        else if (name.equals("benefitPeriod")) {
14812          this.benefitPeriod = new Period();
14813          return this.benefitPeriod;
14814        }
14815        else if (name.equals("benefitBalance")) {
14816          return addBenefitBalance();
14817        }
14818        else
14819          return super.addChild(name);
14820      }
14821
14822  public String fhirType() {
14823    return "ExplanationOfBenefit";
14824
14825  }
14826
14827      public ExplanationOfBenefit copy() {
14828        ExplanationOfBenefit dst = new ExplanationOfBenefit();
14829        copyValues(dst);
14830        return dst;
14831      }
14832
14833      public void copyValues(ExplanationOfBenefit dst) {
14834        super.copyValues(dst);
14835        if (identifier != null) {
14836          dst.identifier = new ArrayList<Identifier>();
14837          for (Identifier i : identifier)
14838            dst.identifier.add(i.copy());
14839        };
14840        dst.status = status == null ? null : status.copy();
14841        dst.type = type == null ? null : type.copy();
14842        dst.subType = subType == null ? null : subType.copy();
14843        dst.use = use == null ? null : use.copy();
14844        dst.patient = patient == null ? null : patient.copy();
14845        dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
14846        dst.created = created == null ? null : created.copy();
14847        dst.enterer = enterer == null ? null : enterer.copy();
14848        dst.insurer = insurer == null ? null : insurer.copy();
14849        dst.provider = provider == null ? null : provider.copy();
14850        dst.priority = priority == null ? null : priority.copy();
14851        dst.fundsReserveRequested = fundsReserveRequested == null ? null : fundsReserveRequested.copy();
14852        dst.fundsReserve = fundsReserve == null ? null : fundsReserve.copy();
14853        if (related != null) {
14854          dst.related = new ArrayList<RelatedClaimComponent>();
14855          for (RelatedClaimComponent i : related)
14856            dst.related.add(i.copy());
14857        };
14858        dst.prescription = prescription == null ? null : prescription.copy();
14859        dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
14860        dst.payee = payee == null ? null : payee.copy();
14861        dst.referral = referral == null ? null : referral.copy();
14862        dst.facility = facility == null ? null : facility.copy();
14863        dst.claim = claim == null ? null : claim.copy();
14864        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
14865        dst.outcome = outcome == null ? null : outcome.copy();
14866        dst.disposition = disposition == null ? null : disposition.copy();
14867        if (preAuthRef != null) {
14868          dst.preAuthRef = new ArrayList<StringType>();
14869          for (StringType i : preAuthRef)
14870            dst.preAuthRef.add(i.copy());
14871        };
14872        if (preAuthRefPeriod != null) {
14873          dst.preAuthRefPeriod = new ArrayList<Period>();
14874          for (Period i : preAuthRefPeriod)
14875            dst.preAuthRefPeriod.add(i.copy());
14876        };
14877        if (careTeam != null) {
14878          dst.careTeam = new ArrayList<CareTeamComponent>();
14879          for (CareTeamComponent i : careTeam)
14880            dst.careTeam.add(i.copy());
14881        };
14882        if (supportingInfo != null) {
14883          dst.supportingInfo = new ArrayList<SupportingInformationComponent>();
14884          for (SupportingInformationComponent i : supportingInfo)
14885            dst.supportingInfo.add(i.copy());
14886        };
14887        if (diagnosis != null) {
14888          dst.diagnosis = new ArrayList<DiagnosisComponent>();
14889          for (DiagnosisComponent i : diagnosis)
14890            dst.diagnosis.add(i.copy());
14891        };
14892        if (procedure != null) {
14893          dst.procedure = new ArrayList<ProcedureComponent>();
14894          for (ProcedureComponent i : procedure)
14895            dst.procedure.add(i.copy());
14896        };
14897        dst.precedence = precedence == null ? null : precedence.copy();
14898        if (insurance != null) {
14899          dst.insurance = new ArrayList<InsuranceComponent>();
14900          for (InsuranceComponent i : insurance)
14901            dst.insurance.add(i.copy());
14902        };
14903        dst.accident = accident == null ? null : accident.copy();
14904        if (item != null) {
14905          dst.item = new ArrayList<ItemComponent>();
14906          for (ItemComponent i : item)
14907            dst.item.add(i.copy());
14908        };
14909        if (addItem != null) {
14910          dst.addItem = new ArrayList<AddedItemComponent>();
14911          for (AddedItemComponent i : addItem)
14912            dst.addItem.add(i.copy());
14913        };
14914        if (adjudication != null) {
14915          dst.adjudication = new ArrayList<AdjudicationComponent>();
14916          for (AdjudicationComponent i : adjudication)
14917            dst.adjudication.add(i.copy());
14918        };
14919        if (total != null) {
14920          dst.total = new ArrayList<TotalComponent>();
14921          for (TotalComponent i : total)
14922            dst.total.add(i.copy());
14923        };
14924        dst.payment = payment == null ? null : payment.copy();
14925        dst.formCode = formCode == null ? null : formCode.copy();
14926        dst.form = form == null ? null : form.copy();
14927        if (processNote != null) {
14928          dst.processNote = new ArrayList<NoteComponent>();
14929          for (NoteComponent i : processNote)
14930            dst.processNote.add(i.copy());
14931        };
14932        dst.benefitPeriod = benefitPeriod == null ? null : benefitPeriod.copy();
14933        if (benefitBalance != null) {
14934          dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
14935          for (BenefitBalanceComponent i : benefitBalance)
14936            dst.benefitBalance.add(i.copy());
14937        };
14938      }
14939
14940      protected ExplanationOfBenefit typedCopy() {
14941        return copy();
14942      }
14943
14944      @Override
14945      public boolean equalsDeep(Base other_) {
14946        if (!super.equalsDeep(other_))
14947          return false;
14948        if (!(other_ instanceof ExplanationOfBenefit))
14949          return false;
14950        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
14951        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
14952           && compareDeep(subType, o.subType, true) && compareDeep(use, o.use, true) && compareDeep(patient, o.patient, true)
14953           && compareDeep(billablePeriod, o.billablePeriod, true) && compareDeep(created, o.created, true)
14954           && compareDeep(enterer, o.enterer, true) && compareDeep(insurer, o.insurer, true) && compareDeep(provider, o.provider, true)
14955           && compareDeep(priority, o.priority, true) && compareDeep(fundsReserveRequested, o.fundsReserveRequested, true)
14956           && compareDeep(fundsReserve, o.fundsReserve, true) && compareDeep(related, o.related, true) && compareDeep(prescription, o.prescription, true)
14957           && compareDeep(originalPrescription, o.originalPrescription, true) && compareDeep(payee, o.payee, true)
14958           && compareDeep(referral, o.referral, true) && compareDeep(facility, o.facility, true) && compareDeep(claim, o.claim, true)
14959           && compareDeep(claimResponse, o.claimResponse, true) && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true)
14960           && compareDeep(preAuthRef, o.preAuthRef, true) && compareDeep(preAuthRefPeriod, o.preAuthRefPeriod, true)
14961           && compareDeep(careTeam, o.careTeam, true) && compareDeep(supportingInfo, o.supportingInfo, true)
14962           && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true) && compareDeep(precedence, o.precedence, true)
14963           && compareDeep(insurance, o.insurance, true) && compareDeep(accident, o.accident, true) && compareDeep(item, o.item, true)
14964           && compareDeep(addItem, o.addItem, true) && compareDeep(adjudication, o.adjudication, true) && compareDeep(total, o.total, true)
14965           && compareDeep(payment, o.payment, true) && compareDeep(formCode, o.formCode, true) && compareDeep(form, o.form, true)
14966           && compareDeep(processNote, o.processNote, true) && compareDeep(benefitPeriod, o.benefitPeriod, true)
14967           && compareDeep(benefitBalance, o.benefitBalance, true);
14968      }
14969
14970      @Override
14971      public boolean equalsShallow(Base other_) {
14972        if (!super.equalsShallow(other_))
14973          return false;
14974        if (!(other_ instanceof ExplanationOfBenefit))
14975          return false;
14976        ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
14977        return compareValues(status, o.status, true) && compareValues(use, o.use, true) && compareValues(created, o.created, true)
14978           && compareValues(outcome, o.outcome, true) && compareValues(disposition, o.disposition, true) && compareValues(preAuthRef, o.preAuthRef, true)
14979           && compareValues(precedence, o.precedence, true);
14980      }
14981
14982      public boolean isEmpty() {
14983        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
14984          , subType, use, patient, billablePeriod, created, enterer, insurer, provider
14985          , priority, fundsReserveRequested, fundsReserve, related, prescription, originalPrescription
14986          , payee, referral, facility, claim, claimResponse, outcome, disposition, preAuthRef
14987          , preAuthRefPeriod, careTeam, supportingInfo, diagnosis, procedure, precedence, insurance
14988          , accident, item, addItem, adjudication, total, payment, formCode, form, processNote
14989          , benefitPeriod, benefitBalance);
14990      }
14991
14992  @Override
14993  public ResourceType getResourceType() {
14994    return ResourceType.ExplanationOfBenefit;
14995   }
14996
14997 /**
14998   * Search parameter: <b>coverage</b>
14999   * <p>
15000   * Description: <b>The plan under which the claim was adjudicated</b><br>
15001   * Type: <b>reference</b><br>
15002   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
15003   * </p>
15004   */
15005  @SearchParamDefinition(name="coverage", path="ExplanationOfBenefit.insurance.coverage", description="The plan under which the claim was adjudicated", type="reference", target={Coverage.class } )
15006  public static final String SP_COVERAGE = "coverage";
15007 /**
15008   * <b>Fluent Client</b> search parameter constant for <b>coverage</b>
15009   * <p>
15010   * Description: <b>The plan under which the claim was adjudicated</b><br>
15011   * Type: <b>reference</b><br>
15012   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
15013   * </p>
15014   */
15015  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COVERAGE);
15016
15017/**
15018   * Constant for fluent queries to be used to add include statements. Specifies
15019   * the path value of "<b>ExplanationOfBenefit:coverage</b>".
15020   */
15021  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:coverage").toLocked();
15022
15023 /**
15024   * Search parameter: <b>care-team</b>
15025   * <p>
15026   * Description: <b>Member of the CareTeam</b><br>
15027   * Type: <b>reference</b><br>
15028   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
15029   * </p>
15030   */
15031  @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 } )
15032  public static final String SP_CARE_TEAM = "care-team";
15033 /**
15034   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
15035   * <p>
15036   * Description: <b>Member of the CareTeam</b><br>
15037   * Type: <b>reference</b><br>
15038   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
15039   * </p>
15040   */
15041  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CARE_TEAM);
15042
15043/**
15044   * Constant for fluent queries to be used to add include statements. Specifies
15045   * the path value of "<b>ExplanationOfBenefit:care-team</b>".
15046   */
15047  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:care-team").toLocked();
15048
15049 /**
15050   * Search parameter: <b>identifier</b>
15051   * <p>
15052   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
15053   * Type: <b>token</b><br>
15054   * Path: <b>ExplanationOfBenefit.identifier</b><br>
15055   * </p>
15056   */
15057  @SearchParamDefinition(name="identifier", path="ExplanationOfBenefit.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
15058  public static final String SP_IDENTIFIER = "identifier";
15059 /**
15060   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
15061   * <p>
15062   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
15063   * Type: <b>token</b><br>
15064   * Path: <b>ExplanationOfBenefit.identifier</b><br>
15065   * </p>
15066   */
15067  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
15068
15069 /**
15070   * Search parameter: <b>created</b>
15071   * <p>
15072   * Description: <b>The creation date for the EOB</b><br>
15073   * Type: <b>date</b><br>
15074   * Path: <b>ExplanationOfBenefit.created</b><br>
15075   * </p>
15076   */
15077  @SearchParamDefinition(name="created", path="ExplanationOfBenefit.created", description="The creation date for the EOB", type="date" )
15078  public static final String SP_CREATED = "created";
15079 /**
15080   * <b>Fluent Client</b> search parameter constant for <b>created</b>
15081   * <p>
15082   * Description: <b>The creation date for the EOB</b><br>
15083   * Type: <b>date</b><br>
15084   * Path: <b>ExplanationOfBenefit.created</b><br>
15085   * </p>
15086   */
15087  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
15088
15089 /**
15090   * Search parameter: <b>encounter</b>
15091   * <p>
15092   * Description: <b>Encounters associated with a billed line item</b><br>
15093   * Type: <b>reference</b><br>
15094   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
15095   * </p>
15096   */
15097  @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 } )
15098  public static final String SP_ENCOUNTER = "encounter";
15099 /**
15100   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
15101   * <p>
15102   * Description: <b>Encounters associated with a billed line item</b><br>
15103   * Type: <b>reference</b><br>
15104   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
15105   * </p>
15106   */
15107  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
15108
15109/**
15110   * Constant for fluent queries to be used to add include statements. Specifies
15111   * the path value of "<b>ExplanationOfBenefit:encounter</b>".
15112   */
15113  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:encounter").toLocked();
15114
15115 /**
15116   * Search parameter: <b>payee</b>
15117   * <p>
15118   * Description: <b>The party receiving any payment for the Claim</b><br>
15119   * Type: <b>reference</b><br>
15120   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
15121   * </p>
15122   */
15123  @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 } )
15124  public static final String SP_PAYEE = "payee";
15125 /**
15126   * <b>Fluent Client</b> search parameter constant for <b>payee</b>
15127   * <p>
15128   * Description: <b>The party receiving any payment for the Claim</b><br>
15129   * Type: <b>reference</b><br>
15130   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
15131   * </p>
15132   */
15133  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PAYEE);
15134
15135/**
15136   * Constant for fluent queries to be used to add include statements. Specifies
15137   * the path value of "<b>ExplanationOfBenefit:payee</b>".
15138   */
15139  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYEE = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:payee").toLocked();
15140
15141 /**
15142   * Search parameter: <b>disposition</b>
15143   * <p>
15144   * Description: <b>The contents of the disposition message</b><br>
15145   * Type: <b>string</b><br>
15146   * Path: <b>ExplanationOfBenefit.disposition</b><br>
15147   * </p>
15148   */
15149  @SearchParamDefinition(name="disposition", path="ExplanationOfBenefit.disposition", description="The contents of the disposition message", type="string" )
15150  public static final String SP_DISPOSITION = "disposition";
15151 /**
15152   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
15153   * <p>
15154   * Description: <b>The contents of the disposition message</b><br>
15155   * Type: <b>string</b><br>
15156   * Path: <b>ExplanationOfBenefit.disposition</b><br>
15157   * </p>
15158   */
15159  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
15160
15161 /**
15162   * Search parameter: <b>provider</b>
15163   * <p>
15164   * Description: <b>The reference to the provider</b><br>
15165   * Type: <b>reference</b><br>
15166   * Path: <b>ExplanationOfBenefit.provider</b><br>
15167   * </p>
15168   */
15169  @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 } )
15170  public static final String SP_PROVIDER = "provider";
15171 /**
15172   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
15173   * <p>
15174   * Description: <b>The reference to the provider</b><br>
15175   * Type: <b>reference</b><br>
15176   * Path: <b>ExplanationOfBenefit.provider</b><br>
15177   * </p>
15178   */
15179  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
15180
15181/**
15182   * Constant for fluent queries to be used to add include statements. Specifies
15183   * the path value of "<b>ExplanationOfBenefit:provider</b>".
15184   */
15185  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:provider").toLocked();
15186
15187 /**
15188   * Search parameter: <b>patient</b>
15189   * <p>
15190   * Description: <b>The reference to the patient</b><br>
15191   * Type: <b>reference</b><br>
15192   * Path: <b>ExplanationOfBenefit.patient</b><br>
15193   * </p>
15194   */
15195  @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 } )
15196  public static final String SP_PATIENT = "patient";
15197 /**
15198   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
15199   * <p>
15200   * Description: <b>The reference to the patient</b><br>
15201   * Type: <b>reference</b><br>
15202   * Path: <b>ExplanationOfBenefit.patient</b><br>
15203   * </p>
15204   */
15205  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
15206
15207/**
15208   * Constant for fluent queries to be used to add include statements. Specifies
15209   * the path value of "<b>ExplanationOfBenefit:patient</b>".
15210   */
15211  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:patient").toLocked();
15212
15213 /**
15214   * Search parameter: <b>detail-udi</b>
15215   * <p>
15216   * Description: <b>UDI associated with a line item detail product or service</b><br>
15217   * Type: <b>reference</b><br>
15218   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
15219   * </p>
15220   */
15221  @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 } )
15222  public static final String SP_DETAIL_UDI = "detail-udi";
15223 /**
15224   * <b>Fluent Client</b> search parameter constant for <b>detail-udi</b>
15225   * <p>
15226   * Description: <b>UDI associated with a line item detail product or service</b><br>
15227   * Type: <b>reference</b><br>
15228   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
15229   * </p>
15230   */
15231  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DETAIL_UDI);
15232
15233/**
15234   * Constant for fluent queries to be used to add include statements. Specifies
15235   * the path value of "<b>ExplanationOfBenefit:detail-udi</b>".
15236   */
15237  public static final ca.uhn.fhir.model.api.Include INCLUDE_DETAIL_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:detail-udi").toLocked();
15238
15239 /**
15240   * Search parameter: <b>claim</b>
15241   * <p>
15242   * Description: <b>The reference to the claim</b><br>
15243   * Type: <b>reference</b><br>
15244   * Path: <b>ExplanationOfBenefit.claim</b><br>
15245   * </p>
15246   */
15247  @SearchParamDefinition(name="claim", path="ExplanationOfBenefit.claim", description="The reference to the claim", type="reference", target={Claim.class } )
15248  public static final String SP_CLAIM = "claim";
15249 /**
15250   * <b>Fluent Client</b> search parameter constant for <b>claim</b>
15251   * <p>
15252   * Description: <b>The reference to the claim</b><br>
15253   * Type: <b>reference</b><br>
15254   * Path: <b>ExplanationOfBenefit.claim</b><br>
15255   * </p>
15256   */
15257  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CLAIM);
15258
15259/**
15260   * Constant for fluent queries to be used to add include statements. Specifies
15261   * the path value of "<b>ExplanationOfBenefit:claim</b>".
15262   */
15263  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIM = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:claim").toLocked();
15264
15265 /**
15266   * Search parameter: <b>enterer</b>
15267   * <p>
15268   * Description: <b>The party responsible for the entry of the Claim</b><br>
15269   * Type: <b>reference</b><br>
15270   * Path: <b>ExplanationOfBenefit.enterer</b><br>
15271   * </p>
15272   */
15273  @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 } )
15274  public static final String SP_ENTERER = "enterer";
15275 /**
15276   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
15277   * <p>
15278   * Description: <b>The party responsible for the entry of the Claim</b><br>
15279   * Type: <b>reference</b><br>
15280   * Path: <b>ExplanationOfBenefit.enterer</b><br>
15281   * </p>
15282   */
15283  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTERER);
15284
15285/**
15286   * Constant for fluent queries to be used to add include statements. Specifies
15287   * the path value of "<b>ExplanationOfBenefit:enterer</b>".
15288   */
15289  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:enterer").toLocked();
15290
15291 /**
15292   * Search parameter: <b>procedure-udi</b>
15293   * <p>
15294   * Description: <b>UDI associated with a procedure</b><br>
15295   * Type: <b>reference</b><br>
15296   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
15297   * </p>
15298   */
15299  @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 } )
15300  public static final String SP_PROCEDURE_UDI = "procedure-udi";
15301 /**
15302   * <b>Fluent Client</b> search parameter constant for <b>procedure-udi</b>
15303   * <p>
15304   * Description: <b>UDI associated with a procedure</b><br>
15305   * Type: <b>reference</b><br>
15306   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
15307   * </p>
15308   */
15309  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROCEDURE_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROCEDURE_UDI);
15310
15311/**
15312   * Constant for fluent queries to be used to add include statements. Specifies
15313   * the path value of "<b>ExplanationOfBenefit:procedure-udi</b>".
15314   */
15315  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROCEDURE_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:procedure-udi").toLocked();
15316
15317 /**
15318   * Search parameter: <b>subdetail-udi</b>
15319   * <p>
15320   * Description: <b>UDI associated with a line item detail subdetail product or service</b><br>
15321   * Type: <b>reference</b><br>
15322   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
15323   * </p>
15324   */
15325  @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 } )
15326  public static final String SP_SUBDETAIL_UDI = "subdetail-udi";
15327 /**
15328   * <b>Fluent Client</b> search parameter constant for <b>subdetail-udi</b>
15329   * <p>
15330   * Description: <b>UDI associated with a line item detail subdetail product or service</b><br>
15331   * Type: <b>reference</b><br>
15332   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
15333   * </p>
15334   */
15335  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBDETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBDETAIL_UDI);
15336
15337/**
15338   * Constant for fluent queries to be used to add include statements. Specifies
15339   * the path value of "<b>ExplanationOfBenefit:subdetail-udi</b>".
15340   */
15341  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBDETAIL_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:subdetail-udi").toLocked();
15342
15343 /**
15344   * Search parameter: <b>facility</b>
15345   * <p>
15346   * Description: <b>Facility responsible for the goods and services</b><br>
15347   * Type: <b>reference</b><br>
15348   * Path: <b>ExplanationOfBenefit.facility</b><br>
15349   * </p>
15350   */
15351  @SearchParamDefinition(name="facility", path="ExplanationOfBenefit.facility", description="Facility responsible for the goods and services", type="reference", target={Location.class } )
15352  public static final String SP_FACILITY = "facility";
15353 /**
15354   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
15355   * <p>
15356   * Description: <b>Facility responsible for the goods and services</b><br>
15357   * Type: <b>reference</b><br>
15358   * Path: <b>ExplanationOfBenefit.facility</b><br>
15359   * </p>
15360   */
15361  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FACILITY);
15362
15363/**
15364   * Constant for fluent queries to be used to add include statements. Specifies
15365   * the path value of "<b>ExplanationOfBenefit:facility</b>".
15366   */
15367  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:facility").toLocked();
15368
15369 /**
15370   * Search parameter: <b>item-udi</b>
15371   * <p>
15372   * Description: <b>UDI associated with a line item product or service</b><br>
15373   * Type: <b>reference</b><br>
15374   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
15375   * </p>
15376   */
15377  @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 } )
15378  public static final String SP_ITEM_UDI = "item-udi";
15379 /**
15380   * <b>Fluent Client</b> search parameter constant for <b>item-udi</b>
15381   * <p>
15382   * Description: <b>UDI associated with a line item product or service</b><br>
15383   * Type: <b>reference</b><br>
15384   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
15385   * </p>
15386   */
15387  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ITEM_UDI);
15388
15389/**
15390   * Constant for fluent queries to be used to add include statements. Specifies
15391   * the path value of "<b>ExplanationOfBenefit:item-udi</b>".
15392   */
15393  public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM_UDI = new ca.uhn.fhir.model.api.Include("ExplanationOfBenefit:item-udi").toLocked();
15394
15395 /**
15396   * Search parameter: <b>status</b>
15397   * <p>
15398   * Description: <b>Status of the instance</b><br>
15399   * Type: <b>token</b><br>
15400   * Path: <b>ExplanationOfBenefit.status</b><br>
15401   * </p>
15402   */
15403  @SearchParamDefinition(name="status", path="ExplanationOfBenefit.status", description="Status of the instance", type="token" )
15404  public static final String SP_STATUS = "status";
15405 /**
15406   * <b>Fluent Client</b> search parameter constant for <b>status</b>
15407   * <p>
15408   * Description: <b>Status of the instance</b><br>
15409   * Type: <b>token</b><br>
15410   * Path: <b>ExplanationOfBenefit.status</b><br>
15411   * </p>
15412   */
15413  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
15414
15415
15416}
15417