001package org.hl7.fhir.r4.model;
002
003import java.math.BigDecimal;
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
035import java.util.ArrayList;
036import java.util.Date;
037import java.util.List;
038
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041import org.hl7.fhir.r4.model.Enumerations.NoteType;
042import org.hl7.fhir.r4.model.Enumerations.NoteTypeEnumFactory;
043import org.hl7.fhir.utilities.Utilities;
044
045import ca.uhn.fhir.model.api.annotation.Block;
046import ca.uhn.fhir.model.api.annotation.Child;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.ResourceDef;
049import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
050
051/**
052 * This resource provides: the claim details; adjudication details from the
053 * processing of a Claim; and optionally account balance information, for
054 * informing the subscriber of the benefits provided.
055 */
056@ResourceDef(name = "ExplanationOfBenefit", profile = "http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit")
057public class ExplanationOfBenefit extends DomainResource {
058
059  public enum ExplanationOfBenefitStatus {
060    /**
061     * The resource instance is currently in-force.
062     */
063    ACTIVE,
064    /**
065     * The resource instance is withdrawn, rescinded or reversed.
066     */
067    CANCELLED,
068    /**
069     * A new resource instance the contents of which is not complete.
070     */
071    DRAFT,
072    /**
073     * The resource instance was entered in error.
074     */
075    ENTEREDINERROR,
076    /**
077     * added to help the parsers with the generic types
078     */
079    NULL;
080
081    public static ExplanationOfBenefitStatus fromCode(String codeString) throws FHIRException {
082      if (codeString == null || "".equals(codeString))
083        return null;
084      if ("active".equals(codeString))
085        return ACTIVE;
086      if ("cancelled".equals(codeString))
087        return CANCELLED;
088      if ("draft".equals(codeString))
089        return DRAFT;
090      if ("entered-in-error".equals(codeString))
091        return ENTEREDINERROR;
092      if (Configuration.isAcceptInvalidEnums())
093        return null;
094      else
095        throw new FHIRException("Unknown ExplanationOfBenefitStatus code '" + codeString + "'");
096    }
097
098    public String toCode() {
099      switch (this) {
100      case ACTIVE:
101        return "active";
102      case CANCELLED:
103        return "cancelled";
104      case DRAFT:
105        return "draft";
106      case ENTEREDINERROR:
107        return "entered-in-error";
108      case NULL:
109        return null;
110      default:
111        return "?";
112      }
113    }
114
115    public String getSystem() {
116      switch (this) {
117      case ACTIVE:
118        return "http://hl7.org/fhir/explanationofbenefit-status";
119      case CANCELLED:
120        return "http://hl7.org/fhir/explanationofbenefit-status";
121      case DRAFT:
122        return "http://hl7.org/fhir/explanationofbenefit-status";
123      case ENTEREDINERROR:
124        return "http://hl7.org/fhir/explanationofbenefit-status";
125      case NULL:
126        return null;
127      default:
128        return "?";
129      }
130    }
131
132    public String getDefinition() {
133      switch (this) {
134      case ACTIVE:
135        return "The resource instance is currently in-force.";
136      case CANCELLED:
137        return "The resource instance is withdrawn, rescinded or reversed.";
138      case DRAFT:
139        return "A new resource instance the contents of which is not complete.";
140      case ENTEREDINERROR:
141        return "The resource instance was entered in error.";
142      case NULL:
143        return null;
144      default:
145        return "?";
146      }
147    }
148
149    public String getDisplay() {
150      switch (this) {
151      case ACTIVE:
152        return "Active";
153      case CANCELLED:
154        return "Cancelled";
155      case DRAFT:
156        return "Draft";
157      case ENTEREDINERROR:
158        return "Entered In Error";
159      case NULL:
160        return null;
161      default:
162        return "?";
163      }
164    }
165  }
166
167  public static class ExplanationOfBenefitStatusEnumFactory implements EnumFactory<ExplanationOfBenefitStatus> {
168    public ExplanationOfBenefitStatus fromCode(String codeString) throws IllegalArgumentException {
169      if (codeString == null || "".equals(codeString))
170        if (codeString == null || "".equals(codeString))
171          return null;
172      if ("active".equals(codeString))
173        return ExplanationOfBenefitStatus.ACTIVE;
174      if ("cancelled".equals(codeString))
175        return ExplanationOfBenefitStatus.CANCELLED;
176      if ("draft".equals(codeString))
177        return ExplanationOfBenefitStatus.DRAFT;
178      if ("entered-in-error".equals(codeString))
179        return ExplanationOfBenefitStatus.ENTEREDINERROR;
180      throw new IllegalArgumentException("Unknown ExplanationOfBenefitStatus code '" + codeString + "'");
181    }
182
183    public Enumeration<ExplanationOfBenefitStatus> fromType(PrimitiveType<?> code) throws FHIRException {
184      if (code == null)
185        return null;
186      if (code.isEmpty())
187        return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.NULL, code);
188      String codeString = code.asStringValue();
189      if (codeString == null || "".equals(codeString))
190        return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.NULL, code);
191      if ("active".equals(codeString))
192        return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ACTIVE, code);
193      if ("cancelled".equals(codeString))
194        return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.CANCELLED, code);
195      if ("draft".equals(codeString))
196        return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.DRAFT, code);
197      if ("entered-in-error".equals(codeString))
198        return new Enumeration<ExplanationOfBenefitStatus>(this, ExplanationOfBenefitStatus.ENTEREDINERROR, code);
199      throw new FHIRException("Unknown ExplanationOfBenefitStatus code '" + codeString + "'");
200    }
201
202    public String toCode(ExplanationOfBenefitStatus code) {
203      if (code == ExplanationOfBenefitStatus.ACTIVE)
204        return "active";
205      if (code == ExplanationOfBenefitStatus.CANCELLED)
206        return "cancelled";
207      if (code == ExplanationOfBenefitStatus.DRAFT)
208        return "draft";
209      if (code == ExplanationOfBenefitStatus.ENTEREDINERROR)
210        return "entered-in-error";
211      return "?";
212    }
213
214    public String toSystem(ExplanationOfBenefitStatus code) {
215      return code.getSystem();
216    }
217  }
218
219  public enum Use {
220    /**
221     * The treatment is complete and this represents a Claim for the services.
222     */
223    CLAIM,
224    /**
225     * The treatment is proposed and this represents a Pre-authorization for the
226     * services.
227     */
228    PREAUTHORIZATION,
229    /**
230     * The treatment is proposed and this represents a Pre-determination for the
231     * services.
232     */
233    PREDETERMINATION,
234    /**
235     * added to help the parsers with the generic types
236     */
237    NULL;
238
239    public static Use fromCode(String codeString) throws FHIRException {
240      if (codeString == null || "".equals(codeString))
241        return null;
242      if ("claim".equals(codeString))
243        return CLAIM;
244      if ("preauthorization".equals(codeString))
245        return PREAUTHORIZATION;
246      if ("predetermination".equals(codeString))
247        return PREDETERMINATION;
248      if (Configuration.isAcceptInvalidEnums())
249        return null;
250      else
251        throw new FHIRException("Unknown Use code '" + codeString + "'");
252    }
253
254    public String toCode() {
255      switch (this) {
256      case CLAIM:
257        return "claim";
258      case PREAUTHORIZATION:
259        return "preauthorization";
260      case PREDETERMINATION:
261        return "predetermination";
262      case NULL:
263        return null;
264      default:
265        return "?";
266      }
267    }
268
269    public String getSystem() {
270      switch (this) {
271      case CLAIM:
272        return "http://hl7.org/fhir/claim-use";
273      case PREAUTHORIZATION:
274        return "http://hl7.org/fhir/claim-use";
275      case PREDETERMINATION:
276        return "http://hl7.org/fhir/claim-use";
277      case NULL:
278        return null;
279      default:
280        return "?";
281      }
282    }
283
284    public String getDefinition() {
285      switch (this) {
286      case CLAIM:
287        return "The treatment is complete and this represents a Claim for the services.";
288      case PREAUTHORIZATION:
289        return "The treatment is proposed and this represents a Pre-authorization for the services.";
290      case PREDETERMINATION:
291        return "The treatment is proposed and this represents a Pre-determination for the services.";
292      case NULL:
293        return null;
294      default:
295        return "?";
296      }
297    }
298
299    public String getDisplay() {
300      switch (this) {
301      case CLAIM:
302        return "Claim";
303      case PREAUTHORIZATION:
304        return "Preauthorization";
305      case PREDETERMINATION:
306        return "Predetermination";
307      case NULL:
308        return null;
309      default:
310        return "?";
311      }
312    }
313  }
314
315  public static class UseEnumFactory implements EnumFactory<Use> {
316    public Use fromCode(String codeString) throws IllegalArgumentException {
317      if (codeString == null || "".equals(codeString))
318        if (codeString == null || "".equals(codeString))
319          return null;
320      if ("claim".equals(codeString))
321        return Use.CLAIM;
322      if ("preauthorization".equals(codeString))
323        return Use.PREAUTHORIZATION;
324      if ("predetermination".equals(codeString))
325        return Use.PREDETERMINATION;
326      throw new IllegalArgumentException("Unknown Use code '" + codeString + "'");
327    }
328
329    public Enumeration<Use> fromType(PrimitiveType<?> code) throws FHIRException {
330      if (code == null)
331        return null;
332      if (code.isEmpty())
333        return new Enumeration<Use>(this, Use.NULL, code);
334      String codeString = code.asStringValue();
335      if (codeString == null || "".equals(codeString))
336        return new Enumeration<Use>(this, Use.NULL, code);
337      if ("claim".equals(codeString))
338        return new Enumeration<Use>(this, Use.CLAIM, code);
339      if ("preauthorization".equals(codeString))
340        return new Enumeration<Use>(this, Use.PREAUTHORIZATION, code);
341      if ("predetermination".equals(codeString))
342        return new Enumeration<Use>(this, Use.PREDETERMINATION, code);
343      throw new FHIRException("Unknown Use code '" + codeString + "'");
344    }
345
346    public String toCode(Use code) {
347      if (code == Use.CLAIM)
348        return "claim";
349      if (code == Use.PREAUTHORIZATION)
350        return "preauthorization";
351      if (code == Use.PREDETERMINATION)
352        return "predetermination";
353      return "?";
354    }
355
356    public String toSystem(Use code) {
357      return code.getSystem();
358    }
359  }
360
361  public enum RemittanceOutcome {
362    /**
363     * The Claim/Pre-authorization/Pre-determination has been received but
364     * processing has not begun.
365     */
366    QUEUED,
367    /**
368     * The processing has completed without errors
369     */
370    COMPLETE,
371    /**
372     * One or more errors have been detected in the Claim
373     */
374    ERROR,
375    /**
376     * No errors have been detected in the Claim and some of the adjudication has
377     * been performed.
378     */
379    PARTIAL,
380    /**
381     * added to help the parsers with the generic types
382     */
383    NULL;
384
385    public static RemittanceOutcome fromCode(String codeString) throws FHIRException {
386      if (codeString == null || "".equals(codeString))
387        return null;
388      if ("queued".equals(codeString))
389        return QUEUED;
390      if ("complete".equals(codeString))
391        return COMPLETE;
392      if ("error".equals(codeString))
393        return ERROR;
394      if ("partial".equals(codeString))
395        return PARTIAL;
396      if (Configuration.isAcceptInvalidEnums())
397        return null;
398      else
399        throw new FHIRException("Unknown RemittanceOutcome code '" + codeString + "'");
400    }
401
402    public String toCode() {
403      switch (this) {
404      case QUEUED:
405        return "queued";
406      case COMPLETE:
407        return "complete";
408      case ERROR:
409        return "error";
410      case PARTIAL:
411        return "partial";
412      case NULL:
413        return null;
414      default:
415        return "?";
416      }
417    }
418
419    public String getSystem() {
420      switch (this) {
421      case QUEUED:
422        return "http://hl7.org/fhir/remittance-outcome";
423      case COMPLETE:
424        return "http://hl7.org/fhir/remittance-outcome";
425      case ERROR:
426        return "http://hl7.org/fhir/remittance-outcome";
427      case PARTIAL:
428        return "http://hl7.org/fhir/remittance-outcome";
429      case NULL:
430        return null;
431      default:
432        return "?";
433      }
434    }
435
436    public String getDefinition() {
437      switch (this) {
438      case QUEUED:
439        return "The Claim/Pre-authorization/Pre-determination has been received but processing has not begun.";
440      case COMPLETE:
441        return "The processing has completed without errors";
442      case ERROR:
443        return "One or more errors have been detected in the Claim";
444      case PARTIAL:
445        return "No errors have been detected in the Claim and some of the adjudication has been performed.";
446      case NULL:
447        return null;
448      default:
449        return "?";
450      }
451    }
452
453    public String getDisplay() {
454      switch (this) {
455      case QUEUED:
456        return "Queued";
457      case COMPLETE:
458        return "Processing Complete";
459      case ERROR:
460        return "Error";
461      case PARTIAL:
462        return "Partial Processing";
463      case NULL:
464        return null;
465      default:
466        return "?";
467      }
468    }
469  }
470
471  public static class RemittanceOutcomeEnumFactory implements EnumFactory<RemittanceOutcome> {
472    public RemittanceOutcome fromCode(String codeString) throws IllegalArgumentException {
473      if (codeString == null || "".equals(codeString))
474        if (codeString == null || "".equals(codeString))
475          return null;
476      if ("queued".equals(codeString))
477        return RemittanceOutcome.QUEUED;
478      if ("complete".equals(codeString))
479        return RemittanceOutcome.COMPLETE;
480      if ("error".equals(codeString))
481        return RemittanceOutcome.ERROR;
482      if ("partial".equals(codeString))
483        return RemittanceOutcome.PARTIAL;
484      throw new IllegalArgumentException("Unknown RemittanceOutcome code '" + codeString + "'");
485    }
486
487    public Enumeration<RemittanceOutcome> fromType(PrimitiveType<?> code) throws FHIRException {
488      if (code == null)
489        return null;
490      if (code.isEmpty())
491        return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.NULL, code);
492      String codeString = code.asStringValue();
493      if (codeString == null || "".equals(codeString))
494        return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.NULL, code);
495      if ("queued".equals(codeString))
496        return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.QUEUED, code);
497      if ("complete".equals(codeString))
498        return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.COMPLETE, code);
499      if ("error".equals(codeString))
500        return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.ERROR, code);
501      if ("partial".equals(codeString))
502        return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.PARTIAL, code);
503      throw new FHIRException("Unknown RemittanceOutcome code '" + codeString + "'");
504    }
505
506    public String toCode(RemittanceOutcome code) {
507      if (code == RemittanceOutcome.QUEUED)
508        return "queued";
509      if (code == RemittanceOutcome.COMPLETE)
510        return "complete";
511      if (code == RemittanceOutcome.ERROR)
512        return "error";
513      if (code == RemittanceOutcome.PARTIAL)
514        return "partial";
515      return "?";
516    }
517
518    public String toSystem(RemittanceOutcome code) {
519      return code.getSystem();
520    }
521  }
522
523  @Block()
524  public static class RelatedClaimComponent extends BackboneElement implements IBaseBackboneElement {
525    /**
526     * Reference to a related claim.
527     */
528    @Child(name = "claim", type = { Claim.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
529    @Description(shortDefinition = "Reference to the related claim", formalDefinition = "Reference to a related claim.")
530    protected Reference claim;
531
532    /**
533     * The actual object that is the target of the reference (Reference to a related
534     * claim.)
535     */
536    protected Claim claimTarget;
537
538    /**
539     * A code to convey how the claims are related.
540     */
541    @Child(name = "relationship", type = {
542        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
543    @Description(shortDefinition = "How the reference claim is related", formalDefinition = "A code to convey how the claims are related.")
544    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/related-claim-relationship")
545    protected CodeableConcept relationship;
546
547    /**
548     * An alternate organizational reference to the case or file to which this
549     * particular claim pertains.
550     */
551    @Child(name = "reference", type = {
552        Identifier.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
553    @Description(shortDefinition = "File or case reference", formalDefinition = "An alternate organizational reference to the case or file to which this particular claim pertains.")
554    protected Identifier reference;
555
556    private static final long serialVersionUID = -379338905L;
557
558    /**
559     * Constructor
560     */
561    public RelatedClaimComponent() {
562      super();
563    }
564
565    /**
566     * @return {@link #claim} (Reference to a related claim.)
567     */
568    public Reference getClaim() {
569      if (this.claim == null)
570        if (Configuration.errorOnAutoCreate())
571          throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
572        else if (Configuration.doAutoCreate())
573          this.claim = new Reference(); // cc
574      return this.claim;
575    }
576
577    public boolean hasClaim() {
578      return this.claim != null && !this.claim.isEmpty();
579    }
580
581    /**
582     * @param value {@link #claim} (Reference to a related claim.)
583     */
584    public RelatedClaimComponent setClaim(Reference value) {
585      this.claim = value;
586      return this;
587    }
588
589    /**
590     * @return {@link #claim} The actual object that is the target of the reference.
591     *         The reference library doesn't populate this, but you can use it to
592     *         hold the resource if you resolve it. (Reference to a related claim.)
593     */
594    public Claim getClaimTarget() {
595      if (this.claimTarget == null)
596        if (Configuration.errorOnAutoCreate())
597          throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
598        else if (Configuration.doAutoCreate())
599          this.claimTarget = new Claim(); // aa
600      return this.claimTarget;
601    }
602
603    /**
604     * @param value {@link #claim} The actual object that is the target of the
605     *              reference. The reference library doesn't use these, but you can
606     *              use it to hold the resource if you resolve it. (Reference to a
607     *              related claim.)
608     */
609    public RelatedClaimComponent setClaimTarget(Claim value) {
610      this.claimTarget = value;
611      return this;
612    }
613
614    /**
615     * @return {@link #relationship} (A code to convey how the claims are related.)
616     */
617    public CodeableConcept getRelationship() {
618      if (this.relationship == null)
619        if (Configuration.errorOnAutoCreate())
620          throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
621        else if (Configuration.doAutoCreate())
622          this.relationship = new CodeableConcept(); // cc
623      return this.relationship;
624    }
625
626    public boolean hasRelationship() {
627      return this.relationship != null && !this.relationship.isEmpty();
628    }
629
630    /**
631     * @param value {@link #relationship} (A code to convey how the claims are
632     *              related.)
633     */
634    public RelatedClaimComponent setRelationship(CodeableConcept value) {
635      this.relationship = value;
636      return this;
637    }
638
639    /**
640     * @return {@link #reference} (An alternate organizational reference to the case
641     *         or file to which this particular claim pertains.)
642     */
643    public Identifier getReference() {
644      if (this.reference == null)
645        if (Configuration.errorOnAutoCreate())
646          throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
647        else if (Configuration.doAutoCreate())
648          this.reference = new Identifier(); // cc
649      return this.reference;
650    }
651
652    public boolean hasReference() {
653      return this.reference != null && !this.reference.isEmpty();
654    }
655
656    /**
657     * @param value {@link #reference} (An alternate organizational reference to the
658     *              case or file to which this particular claim pertains.)
659     */
660    public RelatedClaimComponent setReference(Identifier value) {
661      this.reference = value;
662      return this;
663    }
664
665    protected void listChildren(List<Property> children) {
666      super.listChildren(children);
667      children.add(new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim));
668      children.add(new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1,
669          relationship));
670      children.add(new Property("reference", "Identifier",
671          "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1,
672          reference));
673    }
674
675    @Override
676    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
677      switch (_hash) {
678      case 94742588:
679        /* claim */ return new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim);
680      case -261851592:
681        /* relationship */ return new Property("relationship", "CodeableConcept",
682            "A code to convey how the claims are related.", 0, 1, relationship);
683      case -925155509:
684        /* reference */ return new Property("reference", "Identifier",
685            "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1,
686            reference);
687      default:
688        return super.getNamedProperty(_hash, _name, _checkValid);
689      }
690
691    }
692
693    @Override
694    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
695      switch (hash) {
696      case 94742588:
697        /* claim */ return this.claim == null ? new Base[0] : new Base[] { this.claim }; // Reference
698      case -261851592:
699        /* relationship */ return this.relationship == null ? new Base[0] : new Base[] { this.relationship }; // CodeableConcept
700      case -925155509:
701        /* reference */ return this.reference == null ? new Base[0] : new Base[] { this.reference }; // Identifier
702      default:
703        return super.getProperty(hash, name, checkValid);
704      }
705
706    }
707
708    @Override
709    public Base setProperty(int hash, String name, Base value) throws FHIRException {
710      switch (hash) {
711      case 94742588: // claim
712        this.claim = castToReference(value); // Reference
713        return value;
714      case -261851592: // relationship
715        this.relationship = castToCodeableConcept(value); // CodeableConcept
716        return value;
717      case -925155509: // reference
718        this.reference = castToIdentifier(value); // Identifier
719        return value;
720      default:
721        return super.setProperty(hash, name, value);
722      }
723
724    }
725
726    @Override
727    public Base setProperty(String name, Base value) throws FHIRException {
728      if (name.equals("claim")) {
729        this.claim = castToReference(value); // Reference
730      } else if (name.equals("relationship")) {
731        this.relationship = castToCodeableConcept(value); // CodeableConcept
732      } else if (name.equals("reference")) {
733        this.reference = castToIdentifier(value); // Identifier
734      } else
735        return super.setProperty(name, value);
736      return value;
737    }
738
739  @Override
740  public void removeChild(String name, Base value) throws FHIRException {
741      if (name.equals("claim")) {
742        this.claim = null;
743      } else if (name.equals("relationship")) {
744        this.relationship = null;
745      } else if (name.equals("reference")) {
746        this.reference = null;
747      } else
748        super.removeChild(name, value);
749      
750    }
751
752    @Override
753    public Base makeProperty(int hash, String name) throws FHIRException {
754      switch (hash) {
755      case 94742588:
756        return getClaim();
757      case -261851592:
758        return getRelationship();
759      case -925155509:
760        return getReference();
761      default:
762        return super.makeProperty(hash, name);
763      }
764
765    }
766
767    @Override
768    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
769      switch (hash) {
770      case 94742588:
771        /* claim */ return new String[] { "Reference" };
772      case -261851592:
773        /* relationship */ return new String[] { "CodeableConcept" };
774      case -925155509:
775        /* reference */ return new String[] { "Identifier" };
776      default:
777        return super.getTypesForProperty(hash, name);
778      }
779
780    }
781
782    @Override
783    public Base addChild(String name) throws FHIRException {
784      if (name.equals("claim")) {
785        this.claim = new Reference();
786        return this.claim;
787      } else if (name.equals("relationship")) {
788        this.relationship = new CodeableConcept();
789        return this.relationship;
790      } else if (name.equals("reference")) {
791        this.reference = new Identifier();
792        return this.reference;
793      } else
794        return super.addChild(name);
795    }
796
797    public RelatedClaimComponent copy() {
798      RelatedClaimComponent dst = new RelatedClaimComponent();
799      copyValues(dst);
800      return dst;
801    }
802
803    public void copyValues(RelatedClaimComponent dst) {
804      super.copyValues(dst);
805      dst.claim = claim == null ? null : claim.copy();
806      dst.relationship = relationship == null ? null : relationship.copy();
807      dst.reference = reference == null ? null : reference.copy();
808    }
809
810    @Override
811    public boolean equalsDeep(Base other_) {
812      if (!super.equalsDeep(other_))
813        return false;
814      if (!(other_ instanceof RelatedClaimComponent))
815        return false;
816      RelatedClaimComponent o = (RelatedClaimComponent) other_;
817      return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true)
818          && compareDeep(reference, o.reference, true);
819    }
820
821    @Override
822    public boolean equalsShallow(Base other_) {
823      if (!super.equalsShallow(other_))
824        return false;
825      if (!(other_ instanceof RelatedClaimComponent))
826        return false;
827      RelatedClaimComponent o = (RelatedClaimComponent) other_;
828      return true;
829    }
830
831    public boolean isEmpty() {
832      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference);
833    }
834
835    public String fhirType() {
836      return "ExplanationOfBenefit.related";
837
838    }
839
840  }
841
842  @Block()
843  public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
844    /**
845     * Type of Party to be reimbursed: Subscriber, provider, other.
846     */
847    @Child(name = "type", type = {
848        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
849    @Description(shortDefinition = "Category of recipient", formalDefinition = "Type of Party to be reimbursed: Subscriber, provider, other.")
850    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/payeetype")
851    protected CodeableConcept type;
852
853    /**
854     * Reference to the individual or organization to whom any payment will be made.
855     */
856    @Child(name = "party", type = { Practitioner.class, PractitionerRole.class, Organization.class, Patient.class,
857        RelatedPerson.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
858    @Description(shortDefinition = "Recipient reference", formalDefinition = "Reference to the individual or organization to whom any payment will be made.")
859    protected Reference party;
860
861    /**
862     * The actual object that is the target of the reference (Reference to the
863     * individual or organization to whom any payment will be made.)
864     */
865    protected Resource partyTarget;
866
867    private static final long serialVersionUID = 1609484699L;
868
869    /**
870     * Constructor
871     */
872    public PayeeComponent() {
873      super();
874    }
875
876    /**
877     * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider,
878     *         other.)
879     */
880    public CodeableConcept getType() {
881      if (this.type == null)
882        if (Configuration.errorOnAutoCreate())
883          throw new Error("Attempt to auto-create PayeeComponent.type");
884        else if (Configuration.doAutoCreate())
885          this.type = new CodeableConcept(); // cc
886      return this.type;
887    }
888
889    public boolean hasType() {
890      return this.type != null && !this.type.isEmpty();
891    }
892
893    /**
894     * @param value {@link #type} (Type of Party to be reimbursed: Subscriber,
895     *              provider, other.)
896     */
897    public PayeeComponent setType(CodeableConcept value) {
898      this.type = value;
899      return this;
900    }
901
902    /**
903     * @return {@link #party} (Reference to the individual or organization to whom
904     *         any payment will be made.)
905     */
906    public Reference getParty() {
907      if (this.party == null)
908        if (Configuration.errorOnAutoCreate())
909          throw new Error("Attempt to auto-create PayeeComponent.party");
910        else if (Configuration.doAutoCreate())
911          this.party = new Reference(); // cc
912      return this.party;
913    }
914
915    public boolean hasParty() {
916      return this.party != null && !this.party.isEmpty();
917    }
918
919    /**
920     * @param value {@link #party} (Reference to the individual or organization to
921     *              whom any payment will be made.)
922     */
923    public PayeeComponent setParty(Reference value) {
924      this.party = value;
925      return this;
926    }
927
928    /**
929     * @return {@link #party} The actual object that is the target of the reference.
930     *         The reference library doesn't populate this, but you can use it to
931     *         hold the resource if you resolve it. (Reference to the individual or
932     *         organization to whom any payment will be made.)
933     */
934    public Resource getPartyTarget() {
935      return this.partyTarget;
936    }
937
938    /**
939     * @param value {@link #party} The actual object that is the target of the
940     *              reference. The reference library doesn't use these, but you can
941     *              use it to hold the resource if you resolve it. (Reference to the
942     *              individual or organization to whom any payment will be made.)
943     */
944    public PayeeComponent setPartyTarget(Resource value) {
945      this.partyTarget = value;
946      return this;
947    }
948
949    protected void listChildren(List<Property> children) {
950      super.listChildren(children);
951      children.add(new Property("type", "CodeableConcept",
952          "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type));
953      children.add(new Property("party", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)",
954          "Reference to the individual or organization to whom any payment will be made.", 0, 1, party));
955    }
956
957    @Override
958    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
959      switch (_hash) {
960      case 3575610:
961        /* type */ return new Property("type", "CodeableConcept",
962            "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type);
963      case 106437350:
964        /* party */ return new Property("party",
965            "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)",
966            "Reference to the individual or organization to whom any payment will be made.", 0, 1, party);
967      default:
968        return super.getNamedProperty(_hash, _name, _checkValid);
969      }
970
971    }
972
973    @Override
974    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
975      switch (hash) {
976      case 3575610:
977        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
978      case 106437350:
979        /* party */ return this.party == null ? new Base[0] : new Base[] { this.party }; // Reference
980      default:
981        return super.getProperty(hash, name, checkValid);
982      }
983
984    }
985
986    @Override
987    public Base setProperty(int hash, String name, Base value) throws FHIRException {
988      switch (hash) {
989      case 3575610: // type
990        this.type = castToCodeableConcept(value); // CodeableConcept
991        return value;
992      case 106437350: // party
993        this.party = castToReference(value); // Reference
994        return value;
995      default:
996        return super.setProperty(hash, name, value);
997      }
998
999    }
1000
1001    @Override
1002    public Base setProperty(String name, Base value) throws FHIRException {
1003      if (name.equals("type")) {
1004        this.type = castToCodeableConcept(value); // CodeableConcept
1005      } else if (name.equals("party")) {
1006        this.party = castToReference(value); // Reference
1007      } else
1008        return super.setProperty(name, value);
1009      return value;
1010    }
1011
1012  @Override
1013  public void removeChild(String name, Base value) throws FHIRException {
1014      if (name.equals("type")) {
1015        this.type = null;
1016      } else if (name.equals("party")) {
1017        this.party = null;
1018      } else
1019        super.removeChild(name, value);
1020      
1021    }
1022
1023    @Override
1024    public Base makeProperty(int hash, String name) throws FHIRException {
1025      switch (hash) {
1026      case 3575610:
1027        return getType();
1028      case 106437350:
1029        return getParty();
1030      default:
1031        return super.makeProperty(hash, name);
1032      }
1033
1034    }
1035
1036    @Override
1037    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1038      switch (hash) {
1039      case 3575610:
1040        /* type */ return new String[] { "CodeableConcept" };
1041      case 106437350:
1042        /* party */ return new String[] { "Reference" };
1043      default:
1044        return super.getTypesForProperty(hash, name);
1045      }
1046
1047    }
1048
1049    @Override
1050    public Base addChild(String name) throws FHIRException {
1051      if (name.equals("type")) {
1052        this.type = new CodeableConcept();
1053        return this.type;
1054      } else if (name.equals("party")) {
1055        this.party = new Reference();
1056        return this.party;
1057      } else
1058        return super.addChild(name);
1059    }
1060
1061    public PayeeComponent copy() {
1062      PayeeComponent dst = new PayeeComponent();
1063      copyValues(dst);
1064      return dst;
1065    }
1066
1067    public void copyValues(PayeeComponent dst) {
1068      super.copyValues(dst);
1069      dst.type = type == null ? null : type.copy();
1070      dst.party = party == null ? null : party.copy();
1071    }
1072
1073    @Override
1074    public boolean equalsDeep(Base other_) {
1075      if (!super.equalsDeep(other_))
1076        return false;
1077      if (!(other_ instanceof PayeeComponent))
1078        return false;
1079      PayeeComponent o = (PayeeComponent) other_;
1080      return compareDeep(type, o.type, true) && compareDeep(party, o.party, true);
1081    }
1082
1083    @Override
1084    public boolean equalsShallow(Base other_) {
1085      if (!super.equalsShallow(other_))
1086        return false;
1087      if (!(other_ instanceof PayeeComponent))
1088        return false;
1089      PayeeComponent o = (PayeeComponent) other_;
1090      return true;
1091    }
1092
1093    public boolean isEmpty() {
1094      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party);
1095    }
1096
1097    public String fhirType() {
1098      return "ExplanationOfBenefit.payee";
1099
1100    }
1101
1102  }
1103
1104  @Block()
1105  public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
1106    /**
1107     * A number to uniquely identify care team entries.
1108     */
1109    @Child(name = "sequence", type = {
1110        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
1111    @Description(shortDefinition = "Order of care team", formalDefinition = "A number to uniquely identify care team entries.")
1112    protected PositiveIntType sequence;
1113
1114    /**
1115     * Member of the team who provided the product or service.
1116     */
1117    @Child(name = "provider", type = { Practitioner.class, PractitionerRole.class,
1118        Organization.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
1119    @Description(shortDefinition = "Practitioner or organization", formalDefinition = "Member of the team who provided the product or service.")
1120    protected Reference provider;
1121
1122    /**
1123     * The actual object that is the target of the reference (Member of the team who
1124     * provided the product or service.)
1125     */
1126    protected Resource providerTarget;
1127
1128    /**
1129     * The party who is billing and/or responsible for the claimed products or
1130     * services.
1131     */
1132    @Child(name = "responsible", type = {
1133        BooleanType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
1134    @Description(shortDefinition = "Indicator of the lead practitioner", formalDefinition = "The party who is billing and/or responsible for the claimed products or services.")
1135    protected BooleanType responsible;
1136
1137    /**
1138     * The lead, assisting or supervising practitioner and their discipline if a
1139     * multidisciplinary team.
1140     */
1141    @Child(name = "role", type = {
1142        CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
1143    @Description(shortDefinition = "Function within the team", formalDefinition = "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.")
1144    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-careteamrole")
1145    protected CodeableConcept role;
1146
1147    /**
1148     * The qualification of the practitioner which is applicable for this service.
1149     */
1150    @Child(name = "qualification", type = {
1151        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
1152    @Description(shortDefinition = "Practitioner credential or specialization", formalDefinition = "The qualification of the practitioner which is applicable for this service.")
1153    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/provider-qualification")
1154    protected CodeableConcept qualification;
1155
1156    private static final long serialVersionUID = 1758966968L;
1157
1158    /**
1159     * Constructor
1160     */
1161    public CareTeamComponent() {
1162      super();
1163    }
1164
1165    /**
1166     * Constructor
1167     */
1168    public CareTeamComponent(PositiveIntType sequence, Reference provider) {
1169      super();
1170      this.sequence = sequence;
1171      this.provider = provider;
1172    }
1173
1174    /**
1175     * @return {@link #sequence} (A number to uniquely identify care team entries.).
1176     *         This is the underlying object with id, value and extensions. The
1177     *         accessor "getSequence" gives direct access to the value
1178     */
1179    public PositiveIntType getSequenceElement() {
1180      if (this.sequence == null)
1181        if (Configuration.errorOnAutoCreate())
1182          throw new Error("Attempt to auto-create CareTeamComponent.sequence");
1183        else if (Configuration.doAutoCreate())
1184          this.sequence = new PositiveIntType(); // bb
1185      return this.sequence;
1186    }
1187
1188    public boolean hasSequenceElement() {
1189      return this.sequence != null && !this.sequence.isEmpty();
1190    }
1191
1192    public boolean hasSequence() {
1193      return this.sequence != null && !this.sequence.isEmpty();
1194    }
1195
1196    /**
1197     * @param value {@link #sequence} (A number to uniquely identify care team
1198     *              entries.). This is the underlying object with id, value and
1199     *              extensions. The accessor "getSequence" gives direct access to
1200     *              the value
1201     */
1202    public CareTeamComponent setSequenceElement(PositiveIntType value) {
1203      this.sequence = value;
1204      return this;
1205    }
1206
1207    /**
1208     * @return A number to uniquely identify care team entries.
1209     */
1210    public int getSequence() {
1211      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1212    }
1213
1214    /**
1215     * @param value A number to uniquely identify care team entries.
1216     */
1217    public CareTeamComponent setSequence(int value) {
1218      if (this.sequence == null)
1219        this.sequence = new PositiveIntType();
1220      this.sequence.setValue(value);
1221      return this;
1222    }
1223
1224    /**
1225     * @return {@link #provider} (Member of the team who provided the product or
1226     *         service.)
1227     */
1228    public Reference getProvider() {
1229      if (this.provider == null)
1230        if (Configuration.errorOnAutoCreate())
1231          throw new Error("Attempt to auto-create CareTeamComponent.provider");
1232        else if (Configuration.doAutoCreate())
1233          this.provider = new Reference(); // cc
1234      return this.provider;
1235    }
1236
1237    public boolean hasProvider() {
1238      return this.provider != null && !this.provider.isEmpty();
1239    }
1240
1241    /**
1242     * @param value {@link #provider} (Member of the team who provided the product
1243     *              or service.)
1244     */
1245    public CareTeamComponent setProvider(Reference value) {
1246      this.provider = value;
1247      return this;
1248    }
1249
1250    /**
1251     * @return {@link #provider} The actual object that is the target of the
1252     *         reference. The reference library doesn't populate this, but you can
1253     *         use it to hold the resource if you resolve it. (Member of the team
1254     *         who provided the product or service.)
1255     */
1256    public Resource getProviderTarget() {
1257      return this.providerTarget;
1258    }
1259
1260    /**
1261     * @param value {@link #provider} The actual object that is the target of the
1262     *              reference. The reference library doesn't use these, but you can
1263     *              use it to hold the resource if you resolve it. (Member of the
1264     *              team who provided the product or service.)
1265     */
1266    public CareTeamComponent setProviderTarget(Resource value) {
1267      this.providerTarget = value;
1268      return this;
1269    }
1270
1271    /**
1272     * @return {@link #responsible} (The party who is billing and/or responsible for
1273     *         the claimed products or services.). This is the underlying object
1274     *         with id, value and extensions. The accessor "getResponsible" gives
1275     *         direct access to the value
1276     */
1277    public BooleanType getResponsibleElement() {
1278      if (this.responsible == null)
1279        if (Configuration.errorOnAutoCreate())
1280          throw new Error("Attempt to auto-create CareTeamComponent.responsible");
1281        else if (Configuration.doAutoCreate())
1282          this.responsible = new BooleanType(); // bb
1283      return this.responsible;
1284    }
1285
1286    public boolean hasResponsibleElement() {
1287      return this.responsible != null && !this.responsible.isEmpty();
1288    }
1289
1290    public boolean hasResponsible() {
1291      return this.responsible != null && !this.responsible.isEmpty();
1292    }
1293
1294    /**
1295     * @param value {@link #responsible} (The party who is billing and/or
1296     *              responsible for the claimed products or services.). This is the
1297     *              underlying object with id, value and extensions. The accessor
1298     *              "getResponsible" gives direct access to the value
1299     */
1300    public CareTeamComponent setResponsibleElement(BooleanType value) {
1301      this.responsible = value;
1302      return this;
1303    }
1304
1305    /**
1306     * @return The party who is billing and/or responsible for the claimed products
1307     *         or services.
1308     */
1309    public boolean getResponsible() {
1310      return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
1311    }
1312
1313    /**
1314     * @param value The party who is billing and/or responsible for the claimed
1315     *              products or services.
1316     */
1317    public CareTeamComponent setResponsible(boolean value) {
1318      if (this.responsible == null)
1319        this.responsible = new BooleanType();
1320      this.responsible.setValue(value);
1321      return this;
1322    }
1323
1324    /**
1325     * @return {@link #role} (The lead, assisting or supervising practitioner and
1326     *         their discipline if a multidisciplinary team.)
1327     */
1328    public CodeableConcept getRole() {
1329      if (this.role == null)
1330        if (Configuration.errorOnAutoCreate())
1331          throw new Error("Attempt to auto-create CareTeamComponent.role");
1332        else if (Configuration.doAutoCreate())
1333          this.role = new CodeableConcept(); // cc
1334      return this.role;
1335    }
1336
1337    public boolean hasRole() {
1338      return this.role != null && !this.role.isEmpty();
1339    }
1340
1341    /**
1342     * @param value {@link #role} (The lead, assisting or supervising practitioner
1343     *              and their discipline if a multidisciplinary team.)
1344     */
1345    public CareTeamComponent setRole(CodeableConcept value) {
1346      this.role = value;
1347      return this;
1348    }
1349
1350    /**
1351     * @return {@link #qualification} (The qualification of the practitioner which
1352     *         is applicable for this service.)
1353     */
1354    public CodeableConcept getQualification() {
1355      if (this.qualification == null)
1356        if (Configuration.errorOnAutoCreate())
1357          throw new Error("Attempt to auto-create CareTeamComponent.qualification");
1358        else if (Configuration.doAutoCreate())
1359          this.qualification = new CodeableConcept(); // cc
1360      return this.qualification;
1361    }
1362
1363    public boolean hasQualification() {
1364      return this.qualification != null && !this.qualification.isEmpty();
1365    }
1366
1367    /**
1368     * @param value {@link #qualification} (The qualification of the practitioner
1369     *              which is applicable for this service.)
1370     */
1371    public CareTeamComponent setQualification(CodeableConcept value) {
1372      this.qualification = value;
1373      return this;
1374    }
1375
1376    protected void listChildren(List<Property> children) {
1377      super.listChildren(children);
1378      children.add(
1379          new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence));
1380      children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
1381          "Member of the team who provided the product or service.", 0, 1, provider));
1382      children.add(new Property("responsible", "boolean",
1383          "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible));
1384      children.add(new Property("role", "CodeableConcept",
1385          "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1,
1386          role));
1387      children.add(new Property("qualification", "CodeableConcept",
1388          "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification));
1389    }
1390
1391    @Override
1392    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1393      switch (_hash) {
1394      case 1349547969:
1395        /* sequence */ return new Property("sequence", "positiveInt",
1396            "A number to uniquely identify care team entries.", 0, 1, sequence);
1397      case -987494927:
1398        /* provider */ return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
1399            "Member of the team who provided the product or service.", 0, 1, provider);
1400      case 1847674614:
1401        /* responsible */ return new Property("responsible", "boolean",
1402            "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible);
1403      case 3506294:
1404        /* role */ return new Property("role", "CodeableConcept",
1405            "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1,
1406            role);
1407      case -631333393:
1408        /* qualification */ return new Property("qualification", "CodeableConcept",
1409            "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification);
1410      default:
1411        return super.getNamedProperty(_hash, _name, _checkValid);
1412      }
1413
1414    }
1415
1416    @Override
1417    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1418      switch (hash) {
1419      case 1349547969:
1420        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
1421      case -987494927:
1422        /* provider */ return this.provider == null ? new Base[0] : new Base[] { this.provider }; // Reference
1423      case 1847674614:
1424        /* responsible */ return this.responsible == null ? new Base[0] : new Base[] { this.responsible }; // BooleanType
1425      case 3506294:
1426        /* role */ return this.role == null ? new Base[0] : new Base[] { this.role }; // CodeableConcept
1427      case -631333393:
1428        /* qualification */ return this.qualification == null ? new Base[0] : new Base[] { this.qualification }; // CodeableConcept
1429      default:
1430        return super.getProperty(hash, name, checkValid);
1431      }
1432
1433    }
1434
1435    @Override
1436    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1437      switch (hash) {
1438      case 1349547969: // sequence
1439        this.sequence = castToPositiveInt(value); // PositiveIntType
1440        return value;
1441      case -987494927: // provider
1442        this.provider = castToReference(value); // Reference
1443        return value;
1444      case 1847674614: // responsible
1445        this.responsible = castToBoolean(value); // BooleanType
1446        return value;
1447      case 3506294: // role
1448        this.role = castToCodeableConcept(value); // CodeableConcept
1449        return value;
1450      case -631333393: // qualification
1451        this.qualification = castToCodeableConcept(value); // CodeableConcept
1452        return value;
1453      default:
1454        return super.setProperty(hash, name, value);
1455      }
1456
1457    }
1458
1459    @Override
1460    public Base setProperty(String name, Base value) throws FHIRException {
1461      if (name.equals("sequence")) {
1462        this.sequence = castToPositiveInt(value); // PositiveIntType
1463      } else if (name.equals("provider")) {
1464        this.provider = castToReference(value); // Reference
1465      } else if (name.equals("responsible")) {
1466        this.responsible = castToBoolean(value); // BooleanType
1467      } else if (name.equals("role")) {
1468        this.role = castToCodeableConcept(value); // CodeableConcept
1469      } else if (name.equals("qualification")) {
1470        this.qualification = castToCodeableConcept(value); // CodeableConcept
1471      } else
1472        return super.setProperty(name, value);
1473      return value;
1474    }
1475
1476  @Override
1477  public void removeChild(String name, Base value) throws FHIRException {
1478      if (name.equals("sequence")) {
1479        this.sequence = null;
1480      } else if (name.equals("provider")) {
1481        this.provider = null;
1482      } else if (name.equals("responsible")) {
1483        this.responsible = null;
1484      } else if (name.equals("role")) {
1485        this.role = null;
1486      } else if (name.equals("qualification")) {
1487        this.qualification = null;
1488      } else
1489        super.removeChild(name, value);
1490      
1491    }
1492
1493    @Override
1494    public Base makeProperty(int hash, String name) throws FHIRException {
1495      switch (hash) {
1496      case 1349547969:
1497        return getSequenceElement();
1498      case -987494927:
1499        return getProvider();
1500      case 1847674614:
1501        return getResponsibleElement();
1502      case 3506294:
1503        return getRole();
1504      case -631333393:
1505        return getQualification();
1506      default:
1507        return super.makeProperty(hash, name);
1508      }
1509
1510    }
1511
1512    @Override
1513    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1514      switch (hash) {
1515      case 1349547969:
1516        /* sequence */ return new String[] { "positiveInt" };
1517      case -987494927:
1518        /* provider */ return new String[] { "Reference" };
1519      case 1847674614:
1520        /* responsible */ return new String[] { "boolean" };
1521      case 3506294:
1522        /* role */ return new String[] { "CodeableConcept" };
1523      case -631333393:
1524        /* qualification */ return new String[] { "CodeableConcept" };
1525      default:
1526        return super.getTypesForProperty(hash, name);
1527      }
1528
1529    }
1530
1531    @Override
1532    public Base addChild(String name) throws FHIRException {
1533      if (name.equals("sequence")) {
1534        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
1535      } else if (name.equals("provider")) {
1536        this.provider = new Reference();
1537        return this.provider;
1538      } else if (name.equals("responsible")) {
1539        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.responsible");
1540      } else if (name.equals("role")) {
1541        this.role = new CodeableConcept();
1542        return this.role;
1543      } else if (name.equals("qualification")) {
1544        this.qualification = new CodeableConcept();
1545        return this.qualification;
1546      } else
1547        return super.addChild(name);
1548    }
1549
1550    public CareTeamComponent copy() {
1551      CareTeamComponent dst = new CareTeamComponent();
1552      copyValues(dst);
1553      return dst;
1554    }
1555
1556    public void copyValues(CareTeamComponent dst) {
1557      super.copyValues(dst);
1558      dst.sequence = sequence == null ? null : sequence.copy();
1559      dst.provider = provider == null ? null : provider.copy();
1560      dst.responsible = responsible == null ? null : responsible.copy();
1561      dst.role = role == null ? null : role.copy();
1562      dst.qualification = qualification == null ? null : qualification.copy();
1563    }
1564
1565    @Override
1566    public boolean equalsDeep(Base other_) {
1567      if (!super.equalsDeep(other_))
1568        return false;
1569      if (!(other_ instanceof CareTeamComponent))
1570        return false;
1571      CareTeamComponent o = (CareTeamComponent) other_;
1572      return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true)
1573          && compareDeep(responsible, o.responsible, true) && compareDeep(role, o.role, true)
1574          && compareDeep(qualification, o.qualification, true);
1575    }
1576
1577    @Override
1578    public boolean equalsShallow(Base other_) {
1579      if (!super.equalsShallow(other_))
1580        return false;
1581      if (!(other_ instanceof CareTeamComponent))
1582        return false;
1583      CareTeamComponent o = (CareTeamComponent) other_;
1584      return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true);
1585    }
1586
1587    public boolean isEmpty() {
1588      return super.isEmpty()
1589          && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible, role, qualification);
1590    }
1591
1592    public String fhirType() {
1593      return "ExplanationOfBenefit.careTeam";
1594
1595    }
1596
1597  }
1598
1599  @Block()
1600  public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
1601    /**
1602     * A number to uniquely identify supporting information entries.
1603     */
1604    @Child(name = "sequence", type = {
1605        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
1606    @Description(shortDefinition = "Information instance identifier", formalDefinition = "A number to uniquely identify supporting information entries.")
1607    protected PositiveIntType sequence;
1608
1609    /**
1610     * The general class of the information supplied: information; exception;
1611     * accident, employment; onset, etc.
1612     */
1613    @Child(name = "category", type = {
1614        CodeableConcept.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
1615    @Description(shortDefinition = "Classification of the supplied information", formalDefinition = "The general class of the information supplied: information; exception; accident, employment; onset, etc.")
1616    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-informationcategory")
1617    protected CodeableConcept category;
1618
1619    /**
1620     * System and code pertaining to the specific information regarding special
1621     * conditions relating to the setting, treatment or patient for which care is
1622     * sought.
1623     */
1624    @Child(name = "code", type = {
1625        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
1626    @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.")
1627    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-exception")
1628    protected CodeableConcept code;
1629
1630    /**
1631     * The date when or period to which this information refers.
1632     */
1633    @Child(name = "timing", type = { DateType.class,
1634        Period.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
1635    @Description(shortDefinition = "When it occurred", formalDefinition = "The date when or period to which this information refers.")
1636    protected Type timing;
1637
1638    /**
1639     * Additional data or information such as resources, documents, images etc.
1640     * including references to the data or the actual inclusion of the data.
1641     */
1642    @Child(name = "value", type = { BooleanType.class, StringType.class, Quantity.class, Attachment.class,
1643        Reference.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
1644    @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.")
1645    protected Type value;
1646
1647    /**
1648     * Provides the reason in the situation where a reason code is required in
1649     * addition to the content.
1650     */
1651    @Child(name = "reason", type = { Coding.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
1652    @Description(shortDefinition = "Explanation for the information", formalDefinition = "Provides the reason in the situation where a reason code is required in addition to the content.")
1653    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/missing-tooth-reason")
1654    protected Coding reason;
1655
1656    private static final long serialVersionUID = -410136661L;
1657
1658    /**
1659     * Constructor
1660     */
1661    public SupportingInformationComponent() {
1662      super();
1663    }
1664
1665    /**
1666     * Constructor
1667     */
1668    public SupportingInformationComponent(PositiveIntType sequence, CodeableConcept category) {
1669      super();
1670      this.sequence = sequence;
1671      this.category = category;
1672    }
1673
1674    /**
1675     * @return {@link #sequence} (A number to uniquely identify supporting
1676     *         information entries.). This is the underlying object with id, value
1677     *         and extensions. The accessor "getSequence" gives direct access to the
1678     *         value
1679     */
1680    public PositiveIntType getSequenceElement() {
1681      if (this.sequence == null)
1682        if (Configuration.errorOnAutoCreate())
1683          throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
1684        else if (Configuration.doAutoCreate())
1685          this.sequence = new PositiveIntType(); // bb
1686      return this.sequence;
1687    }
1688
1689    public boolean hasSequenceElement() {
1690      return this.sequence != null && !this.sequence.isEmpty();
1691    }
1692
1693    public boolean hasSequence() {
1694      return this.sequence != null && !this.sequence.isEmpty();
1695    }
1696
1697    /**
1698     * @param value {@link #sequence} (A number to uniquely identify supporting
1699     *              information entries.). This is the underlying object with id,
1700     *              value and extensions. The accessor "getSequence" gives direct
1701     *              access to the value
1702     */
1703    public SupportingInformationComponent setSequenceElement(PositiveIntType value) {
1704      this.sequence = value;
1705      return this;
1706    }
1707
1708    /**
1709     * @return A number to uniquely identify supporting information entries.
1710     */
1711    public int getSequence() {
1712      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1713    }
1714
1715    /**
1716     * @param value A number to uniquely identify supporting information entries.
1717     */
1718    public SupportingInformationComponent setSequence(int value) {
1719      if (this.sequence == null)
1720        this.sequence = new PositiveIntType();
1721      this.sequence.setValue(value);
1722      return this;
1723    }
1724
1725    /**
1726     * @return {@link #category} (The general class of the information supplied:
1727     *         information; exception; accident, employment; onset, etc.)
1728     */
1729    public CodeableConcept getCategory() {
1730      if (this.category == null)
1731        if (Configuration.errorOnAutoCreate())
1732          throw new Error("Attempt to auto-create SupportingInformationComponent.category");
1733        else if (Configuration.doAutoCreate())
1734          this.category = new CodeableConcept(); // cc
1735      return this.category;
1736    }
1737
1738    public boolean hasCategory() {
1739      return this.category != null && !this.category.isEmpty();
1740    }
1741
1742    /**
1743     * @param value {@link #category} (The general class of the information
1744     *              supplied: information; exception; accident, employment; onset,
1745     *              etc.)
1746     */
1747    public SupportingInformationComponent setCategory(CodeableConcept value) {
1748      this.category = value;
1749      return this;
1750    }
1751
1752    /**
1753     * @return {@link #code} (System and code pertaining to the specific information
1754     *         regarding special conditions relating to the setting, treatment or
1755     *         patient for which care is sought.)
1756     */
1757    public CodeableConcept getCode() {
1758      if (this.code == null)
1759        if (Configuration.errorOnAutoCreate())
1760          throw new Error("Attempt to auto-create SupportingInformationComponent.code");
1761        else if (Configuration.doAutoCreate())
1762          this.code = new CodeableConcept(); // cc
1763      return this.code;
1764    }
1765
1766    public boolean hasCode() {
1767      return this.code != null && !this.code.isEmpty();
1768    }
1769
1770    /**
1771     * @param value {@link #code} (System and code pertaining to the specific
1772     *              information regarding special conditions relating to the
1773     *              setting, treatment or patient for which care is sought.)
1774     */
1775    public SupportingInformationComponent setCode(CodeableConcept value) {
1776      this.code = value;
1777      return this;
1778    }
1779
1780    /**
1781     * @return {@link #timing} (The date when or period to which this information
1782     *         refers.)
1783     */
1784    public Type getTiming() {
1785      return this.timing;
1786    }
1787
1788    /**
1789     * @return {@link #timing} (The date when or period to which this information
1790     *         refers.)
1791     */
1792    public DateType getTimingDateType() throws FHIRException {
1793      if (this.timing == null)
1794        this.timing = new DateType();
1795      if (!(this.timing instanceof DateType))
1796        throw new FHIRException("Type mismatch: the type DateType was expected, but " + this.timing.getClass().getName()
1797            + " was encountered");
1798      return (DateType) this.timing;
1799    }
1800
1801    public boolean hasTimingDateType() {
1802      return this != null && this.timing instanceof DateType;
1803    }
1804
1805    /**
1806     * @return {@link #timing} (The date when or period to which this information
1807     *         refers.)
1808     */
1809    public Period getTimingPeriod() throws FHIRException {
1810      if (this.timing == null)
1811        this.timing = new Period();
1812      if (!(this.timing instanceof Period))
1813        throw new FHIRException("Type mismatch: the type Period was expected, but " + this.timing.getClass().getName()
1814            + " was encountered");
1815      return (Period) this.timing;
1816    }
1817
1818    public boolean hasTimingPeriod() {
1819      return this != null && this.timing instanceof Period;
1820    }
1821
1822    public boolean hasTiming() {
1823      return this.timing != null && !this.timing.isEmpty();
1824    }
1825
1826    /**
1827     * @param value {@link #timing} (The date when or period to which this
1828     *              information refers.)
1829     */
1830    public SupportingInformationComponent setTiming(Type value) {
1831      if (value != null && !(value instanceof DateType || value instanceof Period))
1832        throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.timing[x]: " + value.fhirType());
1833      this.timing = value;
1834      return this;
1835    }
1836
1837    /**
1838     * @return {@link #value} (Additional data or information such as resources,
1839     *         documents, images etc. including references to the data or the actual
1840     *         inclusion of the data.)
1841     */
1842    public Type getValue() {
1843      return this.value;
1844    }
1845
1846    /**
1847     * @return {@link #value} (Additional data or information such as resources,
1848     *         documents, images etc. including references to the data or the actual
1849     *         inclusion of the data.)
1850     */
1851    public BooleanType getValueBooleanType() throws FHIRException {
1852      if (this.value == null)
1853        this.value = new BooleanType();
1854      if (!(this.value instanceof BooleanType))
1855        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "
1856            + this.value.getClass().getName() + " was encountered");
1857      return (BooleanType) this.value;
1858    }
1859
1860    public boolean hasValueBooleanType() {
1861      return this != null && this.value instanceof BooleanType;
1862    }
1863
1864    /**
1865     * @return {@link #value} (Additional data or information such as resources,
1866     *         documents, images etc. including references to the data or the actual
1867     *         inclusion of the data.)
1868     */
1869    public StringType getValueStringType() throws FHIRException {
1870      if (this.value == null)
1871        this.value = new StringType();
1872      if (!(this.value instanceof StringType))
1873        throw new FHIRException("Type mismatch: the type StringType was expected, but "
1874            + this.value.getClass().getName() + " was encountered");
1875      return (StringType) this.value;
1876    }
1877
1878    public boolean hasValueStringType() {
1879      return this != null && this.value instanceof StringType;
1880    }
1881
1882    /**
1883     * @return {@link #value} (Additional data or information such as resources,
1884     *         documents, images etc. including references to the data or the actual
1885     *         inclusion of the data.)
1886     */
1887    public Quantity getValueQuantity() throws FHIRException {
1888      if (this.value == null)
1889        this.value = new Quantity();
1890      if (!(this.value instanceof Quantity))
1891        throw new FHIRException("Type mismatch: the type Quantity was expected, but " + this.value.getClass().getName()
1892            + " was encountered");
1893      return (Quantity) this.value;
1894    }
1895
1896    public boolean hasValueQuantity() {
1897      return this != null && this.value instanceof Quantity;
1898    }
1899
1900    /**
1901     * @return {@link #value} (Additional data or information such as resources,
1902     *         documents, images etc. including references to the data or the actual
1903     *         inclusion of the data.)
1904     */
1905    public Attachment getValueAttachment() throws FHIRException {
1906      if (this.value == null)
1907        this.value = new Attachment();
1908      if (!(this.value instanceof Attachment))
1909        throw new FHIRException("Type mismatch: the type Attachment was expected, but "
1910            + this.value.getClass().getName() + " was encountered");
1911      return (Attachment) this.value;
1912    }
1913
1914    public boolean hasValueAttachment() {
1915      return this != null && this.value instanceof Attachment;
1916    }
1917
1918    /**
1919     * @return {@link #value} (Additional data or information such as resources,
1920     *         documents, images etc. including references to the data or the actual
1921     *         inclusion of the data.)
1922     */
1923    public Reference getValueReference() throws FHIRException {
1924      if (this.value == null)
1925        this.value = new Reference();
1926      if (!(this.value instanceof Reference))
1927        throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.value.getClass().getName()
1928            + " was encountered");
1929      return (Reference) this.value;
1930    }
1931
1932    public boolean hasValueReference() {
1933      return this != null && this.value instanceof Reference;
1934    }
1935
1936    public boolean hasValue() {
1937      return this.value != null && !this.value.isEmpty();
1938    }
1939
1940    /**
1941     * @param value {@link #value} (Additional data or information such as
1942     *              resources, documents, images etc. including references to the
1943     *              data or the actual inclusion of the data.)
1944     */
1945    public SupportingInformationComponent setValue(Type value) {
1946      if (value != null && !(value instanceof BooleanType || value instanceof StringType || value instanceof Quantity
1947          || value instanceof Attachment || value instanceof Reference))
1948        throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.value[x]: " + value.fhirType());
1949      this.value = value;
1950      return this;
1951    }
1952
1953    /**
1954     * @return {@link #reason} (Provides the reason in the situation where a reason
1955     *         code is required in addition to the content.)
1956     */
1957    public Coding getReason() {
1958      if (this.reason == null)
1959        if (Configuration.errorOnAutoCreate())
1960          throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1961        else if (Configuration.doAutoCreate())
1962          this.reason = new Coding(); // cc
1963      return this.reason;
1964    }
1965
1966    public boolean hasReason() {
1967      return this.reason != null && !this.reason.isEmpty();
1968    }
1969
1970    /**
1971     * @param value {@link #reason} (Provides the reason in the situation where a
1972     *              reason code is required in addition to the content.)
1973     */
1974    public SupportingInformationComponent setReason(Coding value) {
1975      this.reason = value;
1976      return this;
1977    }
1978
1979    protected void listChildren(List<Property> children) {
1980      super.listChildren(children);
1981      children.add(new Property("sequence", "positiveInt",
1982          "A number to uniquely identify supporting information entries.", 0, 1, sequence));
1983      children.add(new Property("category", "CodeableConcept",
1984          "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0,
1985          1, category));
1986      children.add(new Property("code", "CodeableConcept",
1987          "System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.",
1988          0, 1, code));
1989      children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.",
1990          0, 1, timing));
1991      children.add(new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1992          "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1993          0, 1, value));
1994      children.add(new Property("reason", "Coding",
1995          "Provides the reason in the situation where a reason code is required in addition to the content.", 0, 1,
1996          reason));
1997    }
1998
1999    @Override
2000    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2001      switch (_hash) {
2002      case 1349547969:
2003        /* sequence */ return new Property("sequence", "positiveInt",
2004            "A number to uniquely identify supporting information entries.", 0, 1, sequence);
2005      case 50511102:
2006        /* category */ return new Property("category", "CodeableConcept",
2007            "The general class of the information supplied: information; exception; accident, employment; onset, etc.",
2008            0, 1, category);
2009      case 3059181:
2010        /* code */ return new Property("code", "CodeableConcept",
2011            "System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.",
2012            0, 1, code);
2013      case 164632566:
2014        /* timing[x] */ return new Property("timing[x]", "date|Period",
2015            "The date when or period to which this information refers.", 0, 1, timing);
2016      case -873664438:
2017        /* timing */ return new Property("timing[x]", "date|Period",
2018            "The date when or period to which this information refers.", 0, 1, timing);
2019      case 807935768:
2020        /* timingDate */ return new Property("timing[x]", "date|Period",
2021            "The date when or period to which this information refers.", 0, 1, timing);
2022      case -615615829:
2023        /* timingPeriod */ return new Property("timing[x]", "date|Period",
2024            "The date when or period to which this information refers.", 0, 1, timing);
2025      case -1410166417:
2026        /* value[x] */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
2027            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
2028            0, 1, value);
2029      case 111972721:
2030        /* value */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
2031            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
2032            0, 1, value);
2033      case 733421943:
2034        /* valueBoolean */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
2035            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
2036            0, 1, value);
2037      case -1424603934:
2038        /* valueString */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
2039            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
2040            0, 1, value);
2041      case -2029823716:
2042        /* valueQuantity */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
2043            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
2044            0, 1, value);
2045      case -475566732:
2046        /* valueAttachment */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
2047            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
2048            0, 1, value);
2049      case 1755241690:
2050        /* valueReference */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
2051            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
2052            0, 1, value);
2053      case -934964668:
2054        /* reason */ return new Property("reason", "Coding",
2055            "Provides the reason in the situation where a reason code is required in addition to the content.", 0, 1,
2056            reason);
2057      default:
2058        return super.getNamedProperty(_hash, _name, _checkValid);
2059      }
2060
2061    }
2062
2063    @Override
2064    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2065      switch (hash) {
2066      case 1349547969:
2067        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
2068      case 50511102:
2069        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
2070      case 3059181:
2071        /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
2072      case -873664438:
2073        /* timing */ return this.timing == null ? new Base[0] : new Base[] { this.timing }; // Type
2074      case 111972721:
2075        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // Type
2076      case -934964668:
2077        /* reason */ return this.reason == null ? new Base[0] : new Base[] { this.reason }; // Coding
2078      default:
2079        return super.getProperty(hash, name, checkValid);
2080      }
2081
2082    }
2083
2084    @Override
2085    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2086      switch (hash) {
2087      case 1349547969: // sequence
2088        this.sequence = castToPositiveInt(value); // PositiveIntType
2089        return value;
2090      case 50511102: // category
2091        this.category = castToCodeableConcept(value); // CodeableConcept
2092        return value;
2093      case 3059181: // code
2094        this.code = castToCodeableConcept(value); // CodeableConcept
2095        return value;
2096      case -873664438: // timing
2097        this.timing = castToType(value); // Type
2098        return value;
2099      case 111972721: // value
2100        this.value = castToType(value); // Type
2101        return value;
2102      case -934964668: // reason
2103        this.reason = castToCoding(value); // Coding
2104        return value;
2105      default:
2106        return super.setProperty(hash, name, value);
2107      }
2108
2109    }
2110
2111    @Override
2112    public Base setProperty(String name, Base value) throws FHIRException {
2113      if (name.equals("sequence")) {
2114        this.sequence = castToPositiveInt(value); // PositiveIntType
2115      } else if (name.equals("category")) {
2116        this.category = castToCodeableConcept(value); // CodeableConcept
2117      } else if (name.equals("code")) {
2118        this.code = castToCodeableConcept(value); // CodeableConcept
2119      } else if (name.equals("timing[x]")) {
2120        this.timing = castToType(value); // Type
2121      } else if (name.equals("value[x]")) {
2122        this.value = castToType(value); // Type
2123      } else if (name.equals("reason")) {
2124        this.reason = castToCoding(value); // Coding
2125      } else
2126        return super.setProperty(name, value);
2127      return value;
2128    }
2129
2130  @Override
2131  public void removeChild(String name, Base value) throws FHIRException {
2132      if (name.equals("sequence")) {
2133        this.sequence = null;
2134      } else if (name.equals("category")) {
2135        this.category = null;
2136      } else if (name.equals("code")) {
2137        this.code = null;
2138      } else if (name.equals("timing[x]")) {
2139        this.timing = null;
2140      } else if (name.equals("value[x]")) {
2141        this.value = null;
2142      } else if (name.equals("reason")) {
2143        this.reason = null;
2144      } else
2145        super.removeChild(name, value);
2146      
2147    }
2148
2149    @Override
2150    public Base makeProperty(int hash, String name) throws FHIRException {
2151      switch (hash) {
2152      case 1349547969:
2153        return getSequenceElement();
2154      case 50511102:
2155        return getCategory();
2156      case 3059181:
2157        return getCode();
2158      case 164632566:
2159        return getTiming();
2160      case -873664438:
2161        return getTiming();
2162      case -1410166417:
2163        return getValue();
2164      case 111972721:
2165        return getValue();
2166      case -934964668:
2167        return getReason();
2168      default:
2169        return super.makeProperty(hash, name);
2170      }
2171
2172    }
2173
2174    @Override
2175    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2176      switch (hash) {
2177      case 1349547969:
2178        /* sequence */ return new String[] { "positiveInt" };
2179      case 50511102:
2180        /* category */ return new String[] { "CodeableConcept" };
2181      case 3059181:
2182        /* code */ return new String[] { "CodeableConcept" };
2183      case -873664438:
2184        /* timing */ return new String[] { "date", "Period" };
2185      case 111972721:
2186        /* value */ return new String[] { "boolean", "string", "Quantity", "Attachment", "Reference" };
2187      case -934964668:
2188        /* reason */ return new String[] { "Coding" };
2189      default:
2190        return super.getTypesForProperty(hash, name);
2191      }
2192
2193    }
2194
2195    @Override
2196    public Base addChild(String name) throws FHIRException {
2197      if (name.equals("sequence")) {
2198        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
2199      } else if (name.equals("category")) {
2200        this.category = new CodeableConcept();
2201        return this.category;
2202      } else if (name.equals("code")) {
2203        this.code = new CodeableConcept();
2204        return this.code;
2205      } else if (name.equals("timingDate")) {
2206        this.timing = new DateType();
2207        return this.timing;
2208      } else if (name.equals("timingPeriod")) {
2209        this.timing = new Period();
2210        return this.timing;
2211      } else if (name.equals("valueBoolean")) {
2212        this.value = new BooleanType();
2213        return this.value;
2214      } else if (name.equals("valueString")) {
2215        this.value = new StringType();
2216        return this.value;
2217      } else if (name.equals("valueQuantity")) {
2218        this.value = new Quantity();
2219        return this.value;
2220      } else if (name.equals("valueAttachment")) {
2221        this.value = new Attachment();
2222        return this.value;
2223      } else if (name.equals("valueReference")) {
2224        this.value = new Reference();
2225        return this.value;
2226      } else if (name.equals("reason")) {
2227        this.reason = new Coding();
2228        return this.reason;
2229      } else
2230        return super.addChild(name);
2231    }
2232
2233    public SupportingInformationComponent copy() {
2234      SupportingInformationComponent dst = new SupportingInformationComponent();
2235      copyValues(dst);
2236      return dst;
2237    }
2238
2239    public void copyValues(SupportingInformationComponent dst) {
2240      super.copyValues(dst);
2241      dst.sequence = sequence == null ? null : sequence.copy();
2242      dst.category = category == null ? null : category.copy();
2243      dst.code = code == null ? null : code.copy();
2244      dst.timing = timing == null ? null : timing.copy();
2245      dst.value = value == null ? null : value.copy();
2246      dst.reason = reason == null ? null : reason.copy();
2247    }
2248
2249    @Override
2250    public boolean equalsDeep(Base other_) {
2251      if (!super.equalsDeep(other_))
2252        return false;
2253      if (!(other_ instanceof SupportingInformationComponent))
2254        return false;
2255      SupportingInformationComponent o = (SupportingInformationComponent) other_;
2256      return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true)
2257          && compareDeep(code, o.code, true) && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true)
2258          && compareDeep(reason, o.reason, true);
2259    }
2260
2261    @Override
2262    public boolean equalsShallow(Base other_) {
2263      if (!super.equalsShallow(other_))
2264        return false;
2265      if (!(other_ instanceof SupportingInformationComponent))
2266        return false;
2267      SupportingInformationComponent o = (SupportingInformationComponent) other_;
2268      return compareValues(sequence, o.sequence, true);
2269    }
2270
2271    public boolean isEmpty() {
2272      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code, timing, value, reason);
2273    }
2274
2275    public String fhirType() {
2276      return "ExplanationOfBenefit.supportingInfo";
2277
2278    }
2279
2280  }
2281
2282  @Block()
2283  public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
2284    /**
2285     * A number to uniquely identify diagnosis entries.
2286     */
2287    @Child(name = "sequence", type = {
2288        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
2289    @Description(shortDefinition = "Diagnosis instance identifier", formalDefinition = "A number to uniquely identify diagnosis entries.")
2290    protected PositiveIntType sequence;
2291
2292    /**
2293     * The nature of illness or problem in a coded form or as a reference to an
2294     * external defined Condition.
2295     */
2296    @Child(name = "diagnosis", type = { CodeableConcept.class,
2297        Condition.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
2298    @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.")
2299    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/icd-10")
2300    protected Type diagnosis;
2301
2302    /**
2303     * When the condition was observed or the relative ranking.
2304     */
2305    @Child(name = "type", type = {
2306        CodeableConcept.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2307    @Description(shortDefinition = "Timing or nature of the diagnosis", formalDefinition = "When the condition was observed or the relative ranking.")
2308    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-diagnosistype")
2309    protected List<CodeableConcept> type;
2310
2311    /**
2312     * Indication of whether the diagnosis was present on admission to a facility.
2313     */
2314    @Child(name = "onAdmission", type = {
2315        CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
2316    @Description(shortDefinition = "Present on admission", formalDefinition = "Indication of whether the diagnosis was present on admission to a facility.")
2317    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-diagnosis-on-admission")
2318    protected CodeableConcept onAdmission;
2319
2320    /**
2321     * A package billing code or bundle code used to group products and services to
2322     * a particular health condition (such as heart attack) which is based on a
2323     * predetermined grouping code system.
2324     */
2325    @Child(name = "packageCode", type = {
2326        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
2327    @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.")
2328    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
2329    protected CodeableConcept packageCode;
2330
2331    private static final long serialVersionUID = 2120593974L;
2332
2333    /**
2334     * Constructor
2335     */
2336    public DiagnosisComponent() {
2337      super();
2338    }
2339
2340    /**
2341     * Constructor
2342     */
2343    public DiagnosisComponent(PositiveIntType sequence, Type diagnosis) {
2344      super();
2345      this.sequence = sequence;
2346      this.diagnosis = diagnosis;
2347    }
2348
2349    /**
2350     * @return {@link #sequence} (A number to uniquely identify diagnosis entries.).
2351     *         This is the underlying object with id, value and extensions. The
2352     *         accessor "getSequence" gives direct access to the value
2353     */
2354    public PositiveIntType getSequenceElement() {
2355      if (this.sequence == null)
2356        if (Configuration.errorOnAutoCreate())
2357          throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
2358        else if (Configuration.doAutoCreate())
2359          this.sequence = new PositiveIntType(); // bb
2360      return this.sequence;
2361    }
2362
2363    public boolean hasSequenceElement() {
2364      return this.sequence != null && !this.sequence.isEmpty();
2365    }
2366
2367    public boolean hasSequence() {
2368      return this.sequence != null && !this.sequence.isEmpty();
2369    }
2370
2371    /**
2372     * @param value {@link #sequence} (A number to uniquely identify diagnosis
2373     *              entries.). This is the underlying object with id, value and
2374     *              extensions. The accessor "getSequence" gives direct access to
2375     *              the value
2376     */
2377    public DiagnosisComponent setSequenceElement(PositiveIntType value) {
2378      this.sequence = value;
2379      return this;
2380    }
2381
2382    /**
2383     * @return A number to uniquely identify diagnosis entries.
2384     */
2385    public int getSequence() {
2386      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2387    }
2388
2389    /**
2390     * @param value A number to uniquely identify diagnosis entries.
2391     */
2392    public DiagnosisComponent setSequence(int value) {
2393      if (this.sequence == null)
2394        this.sequence = new PositiveIntType();
2395      this.sequence.setValue(value);
2396      return this;
2397    }
2398
2399    /**
2400     * @return {@link #diagnosis} (The nature of illness or problem in a coded form
2401     *         or as a reference to an external defined Condition.)
2402     */
2403    public Type getDiagnosis() {
2404      return this.diagnosis;
2405    }
2406
2407    /**
2408     * @return {@link #diagnosis} (The nature of illness or problem in a coded form
2409     *         or as a reference to an external defined Condition.)
2410     */
2411    public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException {
2412      if (this.diagnosis == null)
2413        this.diagnosis = new CodeableConcept();
2414      if (!(this.diagnosis instanceof CodeableConcept))
2415        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
2416            + this.diagnosis.getClass().getName() + " was encountered");
2417      return (CodeableConcept) this.diagnosis;
2418    }
2419
2420    public boolean hasDiagnosisCodeableConcept() {
2421      return this != null && this.diagnosis instanceof CodeableConcept;
2422    }
2423
2424    /**
2425     * @return {@link #diagnosis} (The nature of illness or problem in a coded form
2426     *         or as a reference to an external defined Condition.)
2427     */
2428    public Reference getDiagnosisReference() throws FHIRException {
2429      if (this.diagnosis == null)
2430        this.diagnosis = new Reference();
2431      if (!(this.diagnosis instanceof Reference))
2432        throw new FHIRException("Type mismatch: the type Reference was expected, but "
2433            + this.diagnosis.getClass().getName() + " was encountered");
2434      return (Reference) this.diagnosis;
2435    }
2436
2437    public boolean hasDiagnosisReference() {
2438      return this != null && this.diagnosis instanceof Reference;
2439    }
2440
2441    public boolean hasDiagnosis() {
2442      return this.diagnosis != null && !this.diagnosis.isEmpty();
2443    }
2444
2445    /**
2446     * @param value {@link #diagnosis} (The nature of illness or problem in a coded
2447     *              form or as a reference to an external defined Condition.)
2448     */
2449    public DiagnosisComponent setDiagnosis(Type value) {
2450      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2451        throw new Error("Not the right type for ExplanationOfBenefit.diagnosis.diagnosis[x]: " + value.fhirType());
2452      this.diagnosis = value;
2453      return this;
2454    }
2455
2456    /**
2457     * @return {@link #type} (When the condition was observed or the relative
2458     *         ranking.)
2459     */
2460    public List<CodeableConcept> getType() {
2461      if (this.type == null)
2462        this.type = new ArrayList<CodeableConcept>();
2463      return this.type;
2464    }
2465
2466    /**
2467     * @return Returns a reference to <code>this</code> for easy method chaining
2468     */
2469    public DiagnosisComponent setType(List<CodeableConcept> theType) {
2470      this.type = theType;
2471      return this;
2472    }
2473
2474    public boolean hasType() {
2475      if (this.type == null)
2476        return false;
2477      for (CodeableConcept item : this.type)
2478        if (!item.isEmpty())
2479          return true;
2480      return false;
2481    }
2482
2483    public CodeableConcept addType() { // 3
2484      CodeableConcept t = new CodeableConcept();
2485      if (this.type == null)
2486        this.type = new ArrayList<CodeableConcept>();
2487      this.type.add(t);
2488      return t;
2489    }
2490
2491    public DiagnosisComponent addType(CodeableConcept t) { // 3
2492      if (t == null)
2493        return this;
2494      if (this.type == null)
2495        this.type = new ArrayList<CodeableConcept>();
2496      this.type.add(t);
2497      return this;
2498    }
2499
2500    /**
2501     * @return The first repetition of repeating field {@link #type}, creating it if
2502     *         it does not already exist
2503     */
2504    public CodeableConcept getTypeFirstRep() {
2505      if (getType().isEmpty()) {
2506        addType();
2507      }
2508      return getType().get(0);
2509    }
2510
2511    /**
2512     * @return {@link #onAdmission} (Indication of whether the diagnosis was present
2513     *         on admission to a facility.)
2514     */
2515    public CodeableConcept getOnAdmission() {
2516      if (this.onAdmission == null)
2517        if (Configuration.errorOnAutoCreate())
2518          throw new Error("Attempt to auto-create DiagnosisComponent.onAdmission");
2519        else if (Configuration.doAutoCreate())
2520          this.onAdmission = new CodeableConcept(); // cc
2521      return this.onAdmission;
2522    }
2523
2524    public boolean hasOnAdmission() {
2525      return this.onAdmission != null && !this.onAdmission.isEmpty();
2526    }
2527
2528    /**
2529     * @param value {@link #onAdmission} (Indication of whether the diagnosis was
2530     *              present on admission to a facility.)
2531     */
2532    public DiagnosisComponent setOnAdmission(CodeableConcept value) {
2533      this.onAdmission = value;
2534      return this;
2535    }
2536
2537    /**
2538     * @return {@link #packageCode} (A package billing code or bundle code used to
2539     *         group products and services to a particular health condition (such as
2540     *         heart attack) which is based on a predetermined grouping code
2541     *         system.)
2542     */
2543    public CodeableConcept getPackageCode() {
2544      if (this.packageCode == null)
2545        if (Configuration.errorOnAutoCreate())
2546          throw new Error("Attempt to auto-create DiagnosisComponent.packageCode");
2547        else if (Configuration.doAutoCreate())
2548          this.packageCode = new CodeableConcept(); // cc
2549      return this.packageCode;
2550    }
2551
2552    public boolean hasPackageCode() {
2553      return this.packageCode != null && !this.packageCode.isEmpty();
2554    }
2555
2556    /**
2557     * @param value {@link #packageCode} (A package billing code or bundle code used
2558     *              to group products and services to a particular health condition
2559     *              (such as heart attack) which is based on a predetermined
2560     *              grouping code system.)
2561     */
2562    public DiagnosisComponent setPackageCode(CodeableConcept value) {
2563      this.packageCode = value;
2564      return this;
2565    }
2566
2567    protected void listChildren(List<Property> children) {
2568      super.listChildren(children);
2569      children.add(
2570          new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence));
2571      children.add(new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2572          "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1,
2573          diagnosis));
2574      children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.",
2575          0, java.lang.Integer.MAX_VALUE, type));
2576      children.add(new Property("onAdmission", "CodeableConcept",
2577          "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission));
2578      children.add(new Property("packageCode", "CodeableConcept",
2579          "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.",
2580          0, 1, packageCode));
2581    }
2582
2583    @Override
2584    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2585      switch (_hash) {
2586      case 1349547969:
2587        /* sequence */ return new Property("sequence", "positiveInt",
2588            "A number to uniquely identify diagnosis entries.", 0, 1, sequence);
2589      case -1487009809:
2590        /* diagnosis[x] */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2591            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2592            1, diagnosis);
2593      case 1196993265:
2594        /* diagnosis */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2595            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2596            1, diagnosis);
2597      case 277781616:
2598        /* diagnosisCodeableConcept */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2599            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2600            1, diagnosis);
2601      case 2050454362:
2602        /* diagnosisReference */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2603            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2604            1, diagnosis);
2605      case 3575610:
2606        /* type */ return new Property("type", "CodeableConcept",
2607            "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2608      case -3386134:
2609        /* onAdmission */ return new Property("onAdmission", "CodeableConcept",
2610            "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission);
2611      case 908444499:
2612        /* packageCode */ return new Property("packageCode", "CodeableConcept",
2613            "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.",
2614            0, 1, packageCode);
2615      default:
2616        return super.getNamedProperty(_hash, _name, _checkValid);
2617      }
2618
2619    }
2620
2621    @Override
2622    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2623      switch (hash) {
2624      case 1349547969:
2625        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
2626      case 1196993265:
2627        /* diagnosis */ return this.diagnosis == null ? new Base[0] : new Base[] { this.diagnosis }; // Type
2628      case 3575610:
2629        /* type */ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2630      case -3386134:
2631        /* onAdmission */ return this.onAdmission == null ? new Base[0] : new Base[] { this.onAdmission }; // CodeableConcept
2632      case 908444499:
2633        /* packageCode */ return this.packageCode == null ? new Base[0] : new Base[] { this.packageCode }; // CodeableConcept
2634      default:
2635        return super.getProperty(hash, name, checkValid);
2636      }
2637
2638    }
2639
2640    @Override
2641    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2642      switch (hash) {
2643      case 1349547969: // sequence
2644        this.sequence = castToPositiveInt(value); // PositiveIntType
2645        return value;
2646      case 1196993265: // diagnosis
2647        this.diagnosis = castToType(value); // Type
2648        return value;
2649      case 3575610: // type
2650        this.getType().add(castToCodeableConcept(value)); // CodeableConcept
2651        return value;
2652      case -3386134: // onAdmission
2653        this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2654        return value;
2655      case 908444499: // packageCode
2656        this.packageCode = castToCodeableConcept(value); // CodeableConcept
2657        return value;
2658      default:
2659        return super.setProperty(hash, name, value);
2660      }
2661
2662    }
2663
2664    @Override
2665    public Base setProperty(String name, Base value) throws FHIRException {
2666      if (name.equals("sequence")) {
2667        this.sequence = castToPositiveInt(value); // PositiveIntType
2668      } else if (name.equals("diagnosis[x]")) {
2669        this.diagnosis = castToType(value); // Type
2670      } else if (name.equals("type")) {
2671        this.getType().add(castToCodeableConcept(value));
2672      } else if (name.equals("onAdmission")) {
2673        this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2674      } else if (name.equals("packageCode")) {
2675        this.packageCode = castToCodeableConcept(value); // CodeableConcept
2676      } else
2677        return super.setProperty(name, value);
2678      return value;
2679    }
2680
2681  @Override
2682  public void removeChild(String name, Base value) throws FHIRException {
2683      if (name.equals("sequence")) {
2684        this.sequence = null;
2685      } else if (name.equals("diagnosis[x]")) {
2686        this.diagnosis = null;
2687      } else if (name.equals("type")) {
2688        this.getType().remove(castToCodeableConcept(value));
2689      } else if (name.equals("onAdmission")) {
2690        this.onAdmission = null;
2691      } else if (name.equals("packageCode")) {
2692        this.packageCode = null;
2693      } else
2694        super.removeChild(name, value);
2695      
2696    }
2697
2698    @Override
2699    public Base makeProperty(int hash, String name) throws FHIRException {
2700      switch (hash) {
2701      case 1349547969:
2702        return getSequenceElement();
2703      case -1487009809:
2704        return getDiagnosis();
2705      case 1196993265:
2706        return getDiagnosis();
2707      case 3575610:
2708        return addType();
2709      case -3386134:
2710        return getOnAdmission();
2711      case 908444499:
2712        return getPackageCode();
2713      default:
2714        return super.makeProperty(hash, name);
2715      }
2716
2717    }
2718
2719    @Override
2720    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2721      switch (hash) {
2722      case 1349547969:
2723        /* sequence */ return new String[] { "positiveInt" };
2724      case 1196993265:
2725        /* diagnosis */ return new String[] { "CodeableConcept", "Reference" };
2726      case 3575610:
2727        /* type */ return new String[] { "CodeableConcept" };
2728      case -3386134:
2729        /* onAdmission */ return new String[] { "CodeableConcept" };
2730      case 908444499:
2731        /* packageCode */ return new String[] { "CodeableConcept" };
2732      default:
2733        return super.getTypesForProperty(hash, name);
2734      }
2735
2736    }
2737
2738    @Override
2739    public Base addChild(String name) throws FHIRException {
2740      if (name.equals("sequence")) {
2741        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
2742      } else if (name.equals("diagnosisCodeableConcept")) {
2743        this.diagnosis = new CodeableConcept();
2744        return this.diagnosis;
2745      } else if (name.equals("diagnosisReference")) {
2746        this.diagnosis = new Reference();
2747        return this.diagnosis;
2748      } else if (name.equals("type")) {
2749        return addType();
2750      } else if (name.equals("onAdmission")) {
2751        this.onAdmission = new CodeableConcept();
2752        return this.onAdmission;
2753      } else if (name.equals("packageCode")) {
2754        this.packageCode = new CodeableConcept();
2755        return this.packageCode;
2756      } else
2757        return super.addChild(name);
2758    }
2759
2760    public DiagnosisComponent copy() {
2761      DiagnosisComponent dst = new DiagnosisComponent();
2762      copyValues(dst);
2763      return dst;
2764    }
2765
2766    public void copyValues(DiagnosisComponent dst) {
2767      super.copyValues(dst);
2768      dst.sequence = sequence == null ? null : sequence.copy();
2769      dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
2770      if (type != null) {
2771        dst.type = new ArrayList<CodeableConcept>();
2772        for (CodeableConcept i : type)
2773          dst.type.add(i.copy());
2774      }
2775      ;
2776      dst.onAdmission = onAdmission == null ? null : onAdmission.copy();
2777      dst.packageCode = packageCode == null ? null : packageCode.copy();
2778    }
2779
2780    @Override
2781    public boolean equalsDeep(Base other_) {
2782      if (!super.equalsDeep(other_))
2783        return false;
2784      if (!(other_ instanceof DiagnosisComponent))
2785        return false;
2786      DiagnosisComponent o = (DiagnosisComponent) other_;
2787      return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true)
2788          && compareDeep(type, o.type, true) && compareDeep(onAdmission, o.onAdmission, true)
2789          && compareDeep(packageCode, o.packageCode, true);
2790    }
2791
2792    @Override
2793    public boolean equalsShallow(Base other_) {
2794      if (!super.equalsShallow(other_))
2795        return false;
2796      if (!(other_ instanceof DiagnosisComponent))
2797        return false;
2798      DiagnosisComponent o = (DiagnosisComponent) other_;
2799      return compareValues(sequence, o.sequence, true);
2800    }
2801
2802    public boolean isEmpty() {
2803      return super.isEmpty()
2804          && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type, onAdmission, packageCode);
2805    }
2806
2807    public String fhirType() {
2808      return "ExplanationOfBenefit.diagnosis";
2809
2810    }
2811
2812  }
2813
2814  @Block()
2815  public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
2816    /**
2817     * A number to uniquely identify procedure entries.
2818     */
2819    @Child(name = "sequence", type = {
2820        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
2821    @Description(shortDefinition = "Procedure instance identifier", formalDefinition = "A number to uniquely identify procedure entries.")
2822    protected PositiveIntType sequence;
2823
2824    /**
2825     * When the condition was observed or the relative ranking.
2826     */
2827    @Child(name = "type", type = {
2828        CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2829    @Description(shortDefinition = "Category of Procedure", formalDefinition = "When the condition was observed or the relative ranking.")
2830    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-procedure-type")
2831    protected List<CodeableConcept> type;
2832
2833    /**
2834     * Date and optionally time the procedure was performed.
2835     */
2836    @Child(name = "date", type = { DateTimeType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
2837    @Description(shortDefinition = "When the procedure was performed", formalDefinition = "Date and optionally time the procedure was performed.")
2838    protected DateTimeType date;
2839
2840    /**
2841     * The code or reference to a Procedure resource which identifies the clinical
2842     * intervention performed.
2843     */
2844    @Child(name = "procedure", type = { CodeableConcept.class,
2845        Procedure.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
2846    @Description(shortDefinition = "Specific clinical procedure", formalDefinition = "The code or reference to a Procedure resource which identifies the clinical intervention performed.")
2847    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/icd-10-procedures")
2848    protected Type procedure;
2849
2850    /**
2851     * Unique Device Identifiers associated with this line item.
2852     */
2853    @Child(name = "udi", type = {
2854        Device.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2855    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
2856    protected List<Reference> udi;
2857    /**
2858     * The actual objects that are the target of the reference (Unique Device
2859     * Identifiers associated with this line item.)
2860     */
2861    protected List<Device> udiTarget;
2862
2863    private static final long serialVersionUID = 935341852L;
2864
2865    /**
2866     * Constructor
2867     */
2868    public ProcedureComponent() {
2869      super();
2870    }
2871
2872    /**
2873     * Constructor
2874     */
2875    public ProcedureComponent(PositiveIntType sequence, Type procedure) {
2876      super();
2877      this.sequence = sequence;
2878      this.procedure = procedure;
2879    }
2880
2881    /**
2882     * @return {@link #sequence} (A number to uniquely identify procedure entries.).
2883     *         This is the underlying object with id, value and extensions. The
2884     *         accessor "getSequence" gives direct access to the value
2885     */
2886    public PositiveIntType getSequenceElement() {
2887      if (this.sequence == null)
2888        if (Configuration.errorOnAutoCreate())
2889          throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2890        else if (Configuration.doAutoCreate())
2891          this.sequence = new PositiveIntType(); // bb
2892      return this.sequence;
2893    }
2894
2895    public boolean hasSequenceElement() {
2896      return this.sequence != null && !this.sequence.isEmpty();
2897    }
2898
2899    public boolean hasSequence() {
2900      return this.sequence != null && !this.sequence.isEmpty();
2901    }
2902
2903    /**
2904     * @param value {@link #sequence} (A number to uniquely identify procedure
2905     *              entries.). This is the underlying object with id, value and
2906     *              extensions. The accessor "getSequence" gives direct access to
2907     *              the value
2908     */
2909    public ProcedureComponent setSequenceElement(PositiveIntType value) {
2910      this.sequence = value;
2911      return this;
2912    }
2913
2914    /**
2915     * @return A number to uniquely identify procedure entries.
2916     */
2917    public int getSequence() {
2918      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2919    }
2920
2921    /**
2922     * @param value A number to uniquely identify procedure entries.
2923     */
2924    public ProcedureComponent setSequence(int value) {
2925      if (this.sequence == null)
2926        this.sequence = new PositiveIntType();
2927      this.sequence.setValue(value);
2928      return this;
2929    }
2930
2931    /**
2932     * @return {@link #type} (When the condition was observed or the relative
2933     *         ranking.)
2934     */
2935    public List<CodeableConcept> getType() {
2936      if (this.type == null)
2937        this.type = new ArrayList<CodeableConcept>();
2938      return this.type;
2939    }
2940
2941    /**
2942     * @return Returns a reference to <code>this</code> for easy method chaining
2943     */
2944    public ProcedureComponent setType(List<CodeableConcept> theType) {
2945      this.type = theType;
2946      return this;
2947    }
2948
2949    public boolean hasType() {
2950      if (this.type == null)
2951        return false;
2952      for (CodeableConcept item : this.type)
2953        if (!item.isEmpty())
2954          return true;
2955      return false;
2956    }
2957
2958    public CodeableConcept addType() { // 3
2959      CodeableConcept t = new CodeableConcept();
2960      if (this.type == null)
2961        this.type = new ArrayList<CodeableConcept>();
2962      this.type.add(t);
2963      return t;
2964    }
2965
2966    public ProcedureComponent addType(CodeableConcept t) { // 3
2967      if (t == null)
2968        return this;
2969      if (this.type == null)
2970        this.type = new ArrayList<CodeableConcept>();
2971      this.type.add(t);
2972      return this;
2973    }
2974
2975    /**
2976     * @return The first repetition of repeating field {@link #type}, creating it if
2977     *         it does not already exist
2978     */
2979    public CodeableConcept getTypeFirstRep() {
2980      if (getType().isEmpty()) {
2981        addType();
2982      }
2983      return getType().get(0);
2984    }
2985
2986    /**
2987     * @return {@link #date} (Date and optionally time the procedure was
2988     *         performed.). This is the underlying object with id, value and
2989     *         extensions. The accessor "getDate" gives direct access to the value
2990     */
2991    public DateTimeType getDateElement() {
2992      if (this.date == null)
2993        if (Configuration.errorOnAutoCreate())
2994          throw new Error("Attempt to auto-create ProcedureComponent.date");
2995        else if (Configuration.doAutoCreate())
2996          this.date = new DateTimeType(); // bb
2997      return this.date;
2998    }
2999
3000    public boolean hasDateElement() {
3001      return this.date != null && !this.date.isEmpty();
3002    }
3003
3004    public boolean hasDate() {
3005      return this.date != null && !this.date.isEmpty();
3006    }
3007
3008    /**
3009     * @param value {@link #date} (Date and optionally time the procedure was
3010     *              performed.). This is the underlying object with id, value and
3011     *              extensions. The accessor "getDate" gives direct access to the
3012     *              value
3013     */
3014    public ProcedureComponent setDateElement(DateTimeType value) {
3015      this.date = value;
3016      return this;
3017    }
3018
3019    /**
3020     * @return Date and optionally time the procedure was performed.
3021     */
3022    public Date getDate() {
3023      return this.date == null ? null : this.date.getValue();
3024    }
3025
3026    /**
3027     * @param value Date and optionally time the procedure was performed.
3028     */
3029    public ProcedureComponent setDate(Date value) {
3030      if (value == null)
3031        this.date = null;
3032      else {
3033        if (this.date == null)
3034          this.date = new DateTimeType();
3035        this.date.setValue(value);
3036      }
3037      return this;
3038    }
3039
3040    /**
3041     * @return {@link #procedure} (The code or reference to a Procedure resource
3042     *         which identifies the clinical intervention performed.)
3043     */
3044    public Type getProcedure() {
3045      return this.procedure;
3046    }
3047
3048    /**
3049     * @return {@link #procedure} (The code or reference to a Procedure resource
3050     *         which identifies the clinical intervention performed.)
3051     */
3052    public CodeableConcept getProcedureCodeableConcept() throws FHIRException {
3053      if (this.procedure == null)
3054        this.procedure = new CodeableConcept();
3055      if (!(this.procedure instanceof CodeableConcept))
3056        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
3057            + this.procedure.getClass().getName() + " was encountered");
3058      return (CodeableConcept) this.procedure;
3059    }
3060
3061    public boolean hasProcedureCodeableConcept() {
3062      return this != null && this.procedure instanceof CodeableConcept;
3063    }
3064
3065    /**
3066     * @return {@link #procedure} (The code or reference to a Procedure resource
3067     *         which identifies the clinical intervention performed.)
3068     */
3069    public Reference getProcedureReference() throws FHIRException {
3070      if (this.procedure == null)
3071        this.procedure = new Reference();
3072      if (!(this.procedure instanceof Reference))
3073        throw new FHIRException("Type mismatch: the type Reference was expected, but "
3074            + this.procedure.getClass().getName() + " was encountered");
3075      return (Reference) this.procedure;
3076    }
3077
3078    public boolean hasProcedureReference() {
3079      return this != null && this.procedure instanceof Reference;
3080    }
3081
3082    public boolean hasProcedure() {
3083      return this.procedure != null && !this.procedure.isEmpty();
3084    }
3085
3086    /**
3087     * @param value {@link #procedure} (The code or reference to a Procedure
3088     *              resource which identifies the clinical intervention performed.)
3089     */
3090    public ProcedureComponent setProcedure(Type value) {
3091      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
3092        throw new Error("Not the right type for ExplanationOfBenefit.procedure.procedure[x]: " + value.fhirType());
3093      this.procedure = value;
3094      return this;
3095    }
3096
3097    /**
3098     * @return {@link #udi} (Unique Device Identifiers associated with this line
3099     *         item.)
3100     */
3101    public List<Reference> getUdi() {
3102      if (this.udi == null)
3103        this.udi = new ArrayList<Reference>();
3104      return this.udi;
3105    }
3106
3107    /**
3108     * @return Returns a reference to <code>this</code> for easy method chaining
3109     */
3110    public ProcedureComponent setUdi(List<Reference> theUdi) {
3111      this.udi = theUdi;
3112      return this;
3113    }
3114
3115    public boolean hasUdi() {
3116      if (this.udi == null)
3117        return false;
3118      for (Reference item : this.udi)
3119        if (!item.isEmpty())
3120          return true;
3121      return false;
3122    }
3123
3124    public Reference addUdi() { // 3
3125      Reference t = new Reference();
3126      if (this.udi == null)
3127        this.udi = new ArrayList<Reference>();
3128      this.udi.add(t);
3129      return t;
3130    }
3131
3132    public ProcedureComponent addUdi(Reference t) { // 3
3133      if (t == null)
3134        return this;
3135      if (this.udi == null)
3136        this.udi = new ArrayList<Reference>();
3137      this.udi.add(t);
3138      return this;
3139    }
3140
3141    /**
3142     * @return The first repetition of repeating field {@link #udi}, creating it if
3143     *         it does not already exist
3144     */
3145    public Reference getUdiFirstRep() {
3146      if (getUdi().isEmpty()) {
3147        addUdi();
3148      }
3149      return getUdi().get(0);
3150    }
3151
3152    /**
3153     * @deprecated Use Reference#setResource(IBaseResource) instead
3154     */
3155    @Deprecated
3156    public List<Device> getUdiTarget() {
3157      if (this.udiTarget == null)
3158        this.udiTarget = new ArrayList<Device>();
3159      return this.udiTarget;
3160    }
3161
3162    /**
3163     * @deprecated Use Reference#setResource(IBaseResource) instead
3164     */
3165    @Deprecated
3166    public Device addUdiTarget() {
3167      Device r = new Device();
3168      if (this.udiTarget == null)
3169        this.udiTarget = new ArrayList<Device>();
3170      this.udiTarget.add(r);
3171      return r;
3172    }
3173
3174    protected void listChildren(List<Property> children) {
3175      super.listChildren(children);
3176      children.add(
3177          new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence));
3178      children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.",
3179          0, java.lang.Integer.MAX_VALUE, type));
3180      children
3181          .add(new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date));
3182      children.add(new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3183          "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3184          procedure));
3185      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
3186          0, java.lang.Integer.MAX_VALUE, udi));
3187    }
3188
3189    @Override
3190    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3191      switch (_hash) {
3192      case 1349547969:
3193        /* sequence */ return new Property("sequence", "positiveInt",
3194            "A number to uniquely identify procedure entries.", 0, 1, sequence);
3195      case 3575610:
3196        /* type */ return new Property("type", "CodeableConcept",
3197            "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
3198      case 3076014:
3199        /* date */ return new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0,
3200            1, date);
3201      case 1640074445:
3202        /* procedure[x] */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3203            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3204            procedure);
3205      case -1095204141:
3206        /* procedure */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3207            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3208            procedure);
3209      case -1284783026:
3210        /* procedureCodeableConcept */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3211            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3212            procedure);
3213      case 881809848:
3214        /* procedureReference */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3215            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3216            procedure);
3217      case 115642:
3218        /* udi */ return new Property("udi", "Reference(Device)",
3219            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
3220      default:
3221        return super.getNamedProperty(_hash, _name, _checkValid);
3222      }
3223
3224    }
3225
3226    @Override
3227    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3228      switch (hash) {
3229      case 1349547969:
3230        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
3231      case 3575610:
3232        /* type */ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
3233      case 3076014:
3234        /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateTimeType
3235      case -1095204141:
3236        /* procedure */ return this.procedure == null ? new Base[0] : new Base[] { this.procedure }; // Type
3237      case 115642:
3238        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
3239      default:
3240        return super.getProperty(hash, name, checkValid);
3241      }
3242
3243    }
3244
3245    @Override
3246    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3247      switch (hash) {
3248      case 1349547969: // sequence
3249        this.sequence = castToPositiveInt(value); // PositiveIntType
3250        return value;
3251      case 3575610: // type
3252        this.getType().add(castToCodeableConcept(value)); // CodeableConcept
3253        return value;
3254      case 3076014: // date
3255        this.date = castToDateTime(value); // DateTimeType
3256        return value;
3257      case -1095204141: // procedure
3258        this.procedure = castToType(value); // Type
3259        return value;
3260      case 115642: // udi
3261        this.getUdi().add(castToReference(value)); // Reference
3262        return value;
3263      default:
3264        return super.setProperty(hash, name, value);
3265      }
3266
3267    }
3268
3269    @Override
3270    public Base setProperty(String name, Base value) throws FHIRException {
3271      if (name.equals("sequence")) {
3272        this.sequence = castToPositiveInt(value); // PositiveIntType
3273      } else if (name.equals("type")) {
3274        this.getType().add(castToCodeableConcept(value));
3275      } else if (name.equals("date")) {
3276        this.date = castToDateTime(value); // DateTimeType
3277      } else if (name.equals("procedure[x]")) {
3278        this.procedure = castToType(value); // Type
3279      } else if (name.equals("udi")) {
3280        this.getUdi().add(castToReference(value));
3281      } else
3282        return super.setProperty(name, value);
3283      return value;
3284    }
3285
3286  @Override
3287  public void removeChild(String name, Base value) throws FHIRException {
3288      if (name.equals("sequence")) {
3289        this.sequence = null;
3290      } else if (name.equals("type")) {
3291        this.getType().remove(castToCodeableConcept(value));
3292      } else if (name.equals("date")) {
3293        this.date = null;
3294      } else if (name.equals("procedure[x]")) {
3295        this.procedure = null;
3296      } else if (name.equals("udi")) {
3297        this.getUdi().remove(castToReference(value));
3298      } else
3299        super.removeChild(name, value);
3300      
3301    }
3302
3303    @Override
3304    public Base makeProperty(int hash, String name) throws FHIRException {
3305      switch (hash) {
3306      case 1349547969:
3307        return getSequenceElement();
3308      case 3575610:
3309        return addType();
3310      case 3076014:
3311        return getDateElement();
3312      case 1640074445:
3313        return getProcedure();
3314      case -1095204141:
3315        return getProcedure();
3316      case 115642:
3317        return addUdi();
3318      default:
3319        return super.makeProperty(hash, name);
3320      }
3321
3322    }
3323
3324    @Override
3325    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3326      switch (hash) {
3327      case 1349547969:
3328        /* sequence */ return new String[] { "positiveInt" };
3329      case 3575610:
3330        /* type */ return new String[] { "CodeableConcept" };
3331      case 3076014:
3332        /* date */ return new String[] { "dateTime" };
3333      case -1095204141:
3334        /* procedure */ return new String[] { "CodeableConcept", "Reference" };
3335      case 115642:
3336        /* udi */ return new String[] { "Reference" };
3337      default:
3338        return super.getTypesForProperty(hash, name);
3339      }
3340
3341    }
3342
3343    @Override
3344    public Base addChild(String name) throws FHIRException {
3345      if (name.equals("sequence")) {
3346        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
3347      } else if (name.equals("type")) {
3348        return addType();
3349      } else if (name.equals("date")) {
3350        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.date");
3351      } else if (name.equals("procedureCodeableConcept")) {
3352        this.procedure = new CodeableConcept();
3353        return this.procedure;
3354      } else if (name.equals("procedureReference")) {
3355        this.procedure = new Reference();
3356        return this.procedure;
3357      } else if (name.equals("udi")) {
3358        return addUdi();
3359      } else
3360        return super.addChild(name);
3361    }
3362
3363    public ProcedureComponent copy() {
3364      ProcedureComponent dst = new ProcedureComponent();
3365      copyValues(dst);
3366      return dst;
3367    }
3368
3369    public void copyValues(ProcedureComponent dst) {
3370      super.copyValues(dst);
3371      dst.sequence = sequence == null ? null : sequence.copy();
3372      if (type != null) {
3373        dst.type = new ArrayList<CodeableConcept>();
3374        for (CodeableConcept i : type)
3375          dst.type.add(i.copy());
3376      }
3377      ;
3378      dst.date = date == null ? null : date.copy();
3379      dst.procedure = procedure == null ? null : procedure.copy();
3380      if (udi != null) {
3381        dst.udi = new ArrayList<Reference>();
3382        for (Reference i : udi)
3383          dst.udi.add(i.copy());
3384      }
3385      ;
3386    }
3387
3388    @Override
3389    public boolean equalsDeep(Base other_) {
3390      if (!super.equalsDeep(other_))
3391        return false;
3392      if (!(other_ instanceof ProcedureComponent))
3393        return false;
3394      ProcedureComponent o = (ProcedureComponent) other_;
3395      return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true)
3396          && compareDeep(date, o.date, true) && compareDeep(procedure, o.procedure, true)
3397          && compareDeep(udi, o.udi, true);
3398    }
3399
3400    @Override
3401    public boolean equalsShallow(Base other_) {
3402      if (!super.equalsShallow(other_))
3403        return false;
3404      if (!(other_ instanceof ProcedureComponent))
3405        return false;
3406      ProcedureComponent o = (ProcedureComponent) other_;
3407      return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
3408    }
3409
3410    public boolean isEmpty() {
3411      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, date, procedure, udi);
3412    }
3413
3414    public String fhirType() {
3415      return "ExplanationOfBenefit.procedure";
3416
3417    }
3418
3419  }
3420
3421  @Block()
3422  public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
3423    /**
3424     * A flag to indicate that this Coverage is to be used for adjudication of this
3425     * claim when set to true.
3426     */
3427    @Child(name = "focal", type = { BooleanType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
3428    @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.")
3429    protected BooleanType focal;
3430
3431    /**
3432     * Reference to the insurance card level information contained in the Coverage
3433     * resource. The coverage issuing insurer will use these details to locate the
3434     * patient's actual coverage within the insurer's information system.
3435     */
3436    @Child(name = "coverage", type = { Coverage.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
3437    @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.")
3438    protected Reference coverage;
3439
3440    /**
3441     * The actual object that is the target of the reference (Reference to the
3442     * insurance card level information contained in the Coverage resource. The
3443     * coverage issuing insurer will use these details to locate the patient's
3444     * actual coverage within the insurer's information system.)
3445     */
3446    protected Coverage coverageTarget;
3447
3448    /**
3449     * Reference numbers previously provided by the insurer to the provider to be
3450     * quoted on subsequent claims containing services or products related to the
3451     * prior authorization.
3452     */
3453    @Child(name = "preAuthRef", type = {
3454        StringType.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3455    @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.")
3456    protected List<StringType> preAuthRef;
3457
3458    private static final long serialVersionUID = -606383626L;
3459
3460    /**
3461     * Constructor
3462     */
3463    public InsuranceComponent() {
3464      super();
3465    }
3466
3467    /**
3468     * Constructor
3469     */
3470    public InsuranceComponent(BooleanType focal, Reference coverage) {
3471      super();
3472      this.focal = focal;
3473      this.coverage = coverage;
3474    }
3475
3476    /**
3477     * @return {@link #focal} (A flag to indicate that this Coverage is to be used
3478     *         for adjudication of this claim when set to true.). This is the
3479     *         underlying object with id, value and extensions. The accessor
3480     *         "getFocal" gives direct access to the value
3481     */
3482    public BooleanType getFocalElement() {
3483      if (this.focal == null)
3484        if (Configuration.errorOnAutoCreate())
3485          throw new Error("Attempt to auto-create InsuranceComponent.focal");
3486        else if (Configuration.doAutoCreate())
3487          this.focal = new BooleanType(); // bb
3488      return this.focal;
3489    }
3490
3491    public boolean hasFocalElement() {
3492      return this.focal != null && !this.focal.isEmpty();
3493    }
3494
3495    public boolean hasFocal() {
3496      return this.focal != null && !this.focal.isEmpty();
3497    }
3498
3499    /**
3500     * @param value {@link #focal} (A flag to indicate that this Coverage is to be
3501     *              used for adjudication of this claim when set to true.). This is
3502     *              the underlying object with id, value and extensions. The
3503     *              accessor "getFocal" gives direct access to the value
3504     */
3505    public InsuranceComponent setFocalElement(BooleanType value) {
3506      this.focal = value;
3507      return this;
3508    }
3509
3510    /**
3511     * @return A flag to indicate that this Coverage is to be used for adjudication
3512     *         of this claim when set to true.
3513     */
3514    public boolean getFocal() {
3515      return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
3516    }
3517
3518    /**
3519     * @param value A flag to indicate that this Coverage is to be used for
3520     *              adjudication of this claim when set to true.
3521     */
3522    public InsuranceComponent setFocal(boolean value) {
3523      if (this.focal == null)
3524        this.focal = new BooleanType();
3525      this.focal.setValue(value);
3526      return this;
3527    }
3528
3529    /**
3530     * @return {@link #coverage} (Reference to the insurance card level information
3531     *         contained in the Coverage resource. The coverage issuing insurer will
3532     *         use these details to locate the patient's actual coverage within the
3533     *         insurer's information system.)
3534     */
3535    public Reference getCoverage() {
3536      if (this.coverage == null)
3537        if (Configuration.errorOnAutoCreate())
3538          throw new Error("Attempt to auto-create InsuranceComponent.coverage");
3539        else if (Configuration.doAutoCreate())
3540          this.coverage = new Reference(); // cc
3541      return this.coverage;
3542    }
3543
3544    public boolean hasCoverage() {
3545      return this.coverage != null && !this.coverage.isEmpty();
3546    }
3547
3548    /**
3549     * @param value {@link #coverage} (Reference to the insurance card level
3550     *              information contained in the Coverage resource. The coverage
3551     *              issuing insurer will use these details to locate the patient's
3552     *              actual coverage within the insurer's information system.)
3553     */
3554    public InsuranceComponent setCoverage(Reference value) {
3555      this.coverage = value;
3556      return this;
3557    }
3558
3559    /**
3560     * @return {@link #coverage} The actual object that is the target of the
3561     *         reference. The reference library doesn't populate this, but you can
3562     *         use it to hold the resource if you resolve it. (Reference to the
3563     *         insurance card level information contained in the Coverage resource.
3564     *         The coverage issuing insurer will use these details to locate the
3565     *         patient's actual coverage within the insurer's information system.)
3566     */
3567    public Coverage getCoverageTarget() {
3568      if (this.coverageTarget == null)
3569        if (Configuration.errorOnAutoCreate())
3570          throw new Error("Attempt to auto-create InsuranceComponent.coverage");
3571        else if (Configuration.doAutoCreate())
3572          this.coverageTarget = new Coverage(); // aa
3573      return this.coverageTarget;
3574    }
3575
3576    /**
3577     * @param value {@link #coverage} The actual object that is the target of the
3578     *              reference. The reference library doesn't use these, but you can
3579     *              use it to hold the resource if you resolve it. (Reference to the
3580     *              insurance card level information contained in the Coverage
3581     *              resource. The coverage issuing insurer will use these details to
3582     *              locate the patient's actual coverage within the insurer's
3583     *              information system.)
3584     */
3585    public InsuranceComponent setCoverageTarget(Coverage value) {
3586      this.coverageTarget = value;
3587      return this;
3588    }
3589
3590    /**
3591     * @return {@link #preAuthRef} (Reference numbers previously provided by the
3592     *         insurer to the provider to be quoted on subsequent claims containing
3593     *         services or products related to the prior authorization.)
3594     */
3595    public List<StringType> getPreAuthRef() {
3596      if (this.preAuthRef == null)
3597        this.preAuthRef = new ArrayList<StringType>();
3598      return this.preAuthRef;
3599    }
3600
3601    /**
3602     * @return Returns a reference to <code>this</code> for easy method chaining
3603     */
3604    public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) {
3605      this.preAuthRef = thePreAuthRef;
3606      return this;
3607    }
3608
3609    public boolean hasPreAuthRef() {
3610      if (this.preAuthRef == null)
3611        return false;
3612      for (StringType item : this.preAuthRef)
3613        if (!item.isEmpty())
3614          return true;
3615      return false;
3616    }
3617
3618    /**
3619     * @return {@link #preAuthRef} (Reference numbers previously provided by the
3620     *         insurer to the provider to be quoted on subsequent claims containing
3621     *         services or products related to the prior authorization.)
3622     */
3623    public StringType addPreAuthRefElement() {// 2
3624      StringType t = new StringType();
3625      if (this.preAuthRef == null)
3626        this.preAuthRef = new ArrayList<StringType>();
3627      this.preAuthRef.add(t);
3628      return t;
3629    }
3630
3631    /**
3632     * @param value {@link #preAuthRef} (Reference numbers previously provided by
3633     *              the insurer to the provider to be quoted on subsequent claims
3634     *              containing services or products related to the prior
3635     *              authorization.)
3636     */
3637    public InsuranceComponent addPreAuthRef(String value) { // 1
3638      StringType t = new StringType();
3639      t.setValue(value);
3640      if (this.preAuthRef == null)
3641        this.preAuthRef = new ArrayList<StringType>();
3642      this.preAuthRef.add(t);
3643      return this;
3644    }
3645
3646    /**
3647     * @param value {@link #preAuthRef} (Reference numbers previously provided by
3648     *              the insurer to the provider to be quoted on subsequent claims
3649     *              containing services or products related to the prior
3650     *              authorization.)
3651     */
3652    public boolean hasPreAuthRef(String value) {
3653      if (this.preAuthRef == null)
3654        return false;
3655      for (StringType v : this.preAuthRef)
3656        if (v.getValue().equals(value)) // string
3657          return true;
3658      return false;
3659    }
3660
3661    protected void listChildren(List<Property> children) {
3662      super.listChildren(children);
3663      children.add(new Property("focal", "boolean",
3664          "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.", 0, 1,
3665          focal));
3666      children.add(new Property("coverage", "Reference(Coverage)",
3667          "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.",
3668          0, 1, coverage));
3669      children.add(new Property("preAuthRef", "string",
3670          "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.",
3671          0, java.lang.Integer.MAX_VALUE, preAuthRef));
3672    }
3673
3674    @Override
3675    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3676      switch (_hash) {
3677      case 97604197:
3678        /* focal */ return new Property("focal", "boolean",
3679            "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.", 0,
3680            1, focal);
3681      case -351767064:
3682        /* coverage */ return new Property("coverage", "Reference(Coverage)",
3683            "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.",
3684            0, 1, coverage);
3685      case 522246568:
3686        /* preAuthRef */ return new Property("preAuthRef", "string",
3687            "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.",
3688            0, java.lang.Integer.MAX_VALUE, preAuthRef);
3689      default:
3690        return super.getNamedProperty(_hash, _name, _checkValid);
3691      }
3692
3693    }
3694
3695    @Override
3696    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3697      switch (hash) {
3698      case 97604197:
3699        /* focal */ return this.focal == null ? new Base[0] : new Base[] { this.focal }; // BooleanType
3700      case -351767064:
3701        /* coverage */ return this.coverage == null ? new Base[0] : new Base[] { this.coverage }; // Reference
3702      case 522246568:
3703        /* preAuthRef */ return this.preAuthRef == null ? new Base[0]
3704            : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
3705      default:
3706        return super.getProperty(hash, name, checkValid);
3707      }
3708
3709    }
3710
3711    @Override
3712    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3713      switch (hash) {
3714      case 97604197: // focal
3715        this.focal = castToBoolean(value); // BooleanType
3716        return value;
3717      case -351767064: // coverage
3718        this.coverage = castToReference(value); // Reference
3719        return value;
3720      case 522246568: // preAuthRef
3721        this.getPreAuthRef().add(castToString(value)); // StringType
3722        return value;
3723      default:
3724        return super.setProperty(hash, name, value);
3725      }
3726
3727    }
3728
3729    @Override
3730    public Base setProperty(String name, Base value) throws FHIRException {
3731      if (name.equals("focal")) {
3732        this.focal = castToBoolean(value); // BooleanType
3733      } else if (name.equals("coverage")) {
3734        this.coverage = castToReference(value); // Reference
3735      } else if (name.equals("preAuthRef")) {
3736        this.getPreAuthRef().add(castToString(value));
3737      } else
3738        return super.setProperty(name, value);
3739      return value;
3740    }
3741
3742  @Override
3743  public void removeChild(String name, Base value) throws FHIRException {
3744      if (name.equals("focal")) {
3745        this.focal = null;
3746      } else if (name.equals("coverage")) {
3747        this.coverage = null;
3748      } else if (name.equals("preAuthRef")) {
3749        this.getPreAuthRef().remove(castToString(value));
3750      } else
3751        super.removeChild(name, value);
3752      
3753    }
3754
3755    @Override
3756    public Base makeProperty(int hash, String name) throws FHIRException {
3757      switch (hash) {
3758      case 97604197:
3759        return getFocalElement();
3760      case -351767064:
3761        return getCoverage();
3762      case 522246568:
3763        return addPreAuthRefElement();
3764      default:
3765        return super.makeProperty(hash, name);
3766      }
3767
3768    }
3769
3770    @Override
3771    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3772      switch (hash) {
3773      case 97604197:
3774        /* focal */ return new String[] { "boolean" };
3775      case -351767064:
3776        /* coverage */ return new String[] { "Reference" };
3777      case 522246568:
3778        /* preAuthRef */ return new String[] { "string" };
3779      default:
3780        return super.getTypesForProperty(hash, name);
3781      }
3782
3783    }
3784
3785    @Override
3786    public Base addChild(String name) throws FHIRException {
3787      if (name.equals("focal")) {
3788        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.focal");
3789      } else if (name.equals("coverage")) {
3790        this.coverage = new Reference();
3791        return this.coverage;
3792      } else if (name.equals("preAuthRef")) {
3793        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.preAuthRef");
3794      } else
3795        return super.addChild(name);
3796    }
3797
3798    public InsuranceComponent copy() {
3799      InsuranceComponent dst = new InsuranceComponent();
3800      copyValues(dst);
3801      return dst;
3802    }
3803
3804    public void copyValues(InsuranceComponent dst) {
3805      super.copyValues(dst);
3806      dst.focal = focal == null ? null : focal.copy();
3807      dst.coverage = coverage == null ? null : coverage.copy();
3808      if (preAuthRef != null) {
3809        dst.preAuthRef = new ArrayList<StringType>();
3810        for (StringType i : preAuthRef)
3811          dst.preAuthRef.add(i.copy());
3812      }
3813      ;
3814    }
3815
3816    @Override
3817    public boolean equalsDeep(Base other_) {
3818      if (!super.equalsDeep(other_))
3819        return false;
3820      if (!(other_ instanceof InsuranceComponent))
3821        return false;
3822      InsuranceComponent o = (InsuranceComponent) other_;
3823      return compareDeep(focal, o.focal, true) && compareDeep(coverage, o.coverage, true)
3824          && compareDeep(preAuthRef, o.preAuthRef, true);
3825    }
3826
3827    @Override
3828    public boolean equalsShallow(Base other_) {
3829      if (!super.equalsShallow(other_))
3830        return false;
3831      if (!(other_ instanceof InsuranceComponent))
3832        return false;
3833      InsuranceComponent o = (InsuranceComponent) other_;
3834      return compareValues(focal, o.focal, true) && compareValues(preAuthRef, o.preAuthRef, true);
3835    }
3836
3837    public boolean isEmpty() {
3838      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(focal, coverage, preAuthRef);
3839    }
3840
3841    public String fhirType() {
3842      return "ExplanationOfBenefit.insurance";
3843
3844    }
3845
3846  }
3847
3848  @Block()
3849  public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
3850    /**
3851     * Date of an accident event related to the products and services contained in
3852     * the claim.
3853     */
3854    @Child(name = "date", type = { DateType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
3855    @Description(shortDefinition = "When the incident occurred", formalDefinition = "Date of an accident event  related to the products and services contained in the claim.")
3856    protected DateType date;
3857
3858    /**
3859     * The type or context of the accident event for the purposes of selection of
3860     * potential insurance coverages and determination of coordination between
3861     * insurers.
3862     */
3863    @Child(name = "type", type = {
3864        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
3865    @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.")
3866    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://terminology.hl7.org/ValueSet/v3-ActIncidentCode")
3867    protected CodeableConcept type;
3868
3869    /**
3870     * The physical location of the accident event.
3871     */
3872    @Child(name = "location", type = { Address.class,
3873        Location.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
3874    @Description(shortDefinition = "Where the event occurred", formalDefinition = "The physical location of the accident event.")
3875    protected Type location;
3876
3877    private static final long serialVersionUID = 622904984L;
3878
3879    /**
3880     * Constructor
3881     */
3882    public AccidentComponent() {
3883      super();
3884    }
3885
3886    /**
3887     * @return {@link #date} (Date of an accident event related to the products and
3888     *         services contained in the claim.). This is the underlying object with
3889     *         id, value and extensions. The accessor "getDate" gives direct access
3890     *         to the value
3891     */
3892    public DateType getDateElement() {
3893      if (this.date == null)
3894        if (Configuration.errorOnAutoCreate())
3895          throw new Error("Attempt to auto-create AccidentComponent.date");
3896        else if (Configuration.doAutoCreate())
3897          this.date = new DateType(); // bb
3898      return this.date;
3899    }
3900
3901    public boolean hasDateElement() {
3902      return this.date != null && !this.date.isEmpty();
3903    }
3904
3905    public boolean hasDate() {
3906      return this.date != null && !this.date.isEmpty();
3907    }
3908
3909    /**
3910     * @param value {@link #date} (Date of an accident event related to the products
3911     *              and services contained in the claim.). This is the underlying
3912     *              object with id, value and extensions. The accessor "getDate"
3913     *              gives direct access to the value
3914     */
3915    public AccidentComponent setDateElement(DateType value) {
3916      this.date = value;
3917      return this;
3918    }
3919
3920    /**
3921     * @return Date of an accident event related to the products and services
3922     *         contained in the claim.
3923     */
3924    public Date getDate() {
3925      return this.date == null ? null : this.date.getValue();
3926    }
3927
3928    /**
3929     * @param value Date of an accident event related to the products and services
3930     *              contained in the claim.
3931     */
3932    public AccidentComponent setDate(Date value) {
3933      if (value == null)
3934        this.date = null;
3935      else {
3936        if (this.date == null)
3937          this.date = new DateType();
3938        this.date.setValue(value);
3939      }
3940      return this;
3941    }
3942
3943    /**
3944     * @return {@link #type} (The type or context of the accident event for the
3945     *         purposes of selection of potential insurance coverages and
3946     *         determination of coordination between insurers.)
3947     */
3948    public CodeableConcept getType() {
3949      if (this.type == null)
3950        if (Configuration.errorOnAutoCreate())
3951          throw new Error("Attempt to auto-create AccidentComponent.type");
3952        else if (Configuration.doAutoCreate())
3953          this.type = new CodeableConcept(); // cc
3954      return this.type;
3955    }
3956
3957    public boolean hasType() {
3958      return this.type != null && !this.type.isEmpty();
3959    }
3960
3961    /**
3962     * @param value {@link #type} (The type or context of the accident event for the
3963     *              purposes of selection of potential insurance coverages and
3964     *              determination of coordination between insurers.)
3965     */
3966    public AccidentComponent setType(CodeableConcept value) {
3967      this.type = value;
3968      return this;
3969    }
3970
3971    /**
3972     * @return {@link #location} (The physical location of the accident event.)
3973     */
3974    public Type getLocation() {
3975      return this.location;
3976    }
3977
3978    /**
3979     * @return {@link #location} (The physical location of the accident event.)
3980     */
3981    public Address getLocationAddress() throws FHIRException {
3982      if (this.location == null)
3983        this.location = new Address();
3984      if (!(this.location instanceof Address))
3985        throw new FHIRException("Type mismatch: the type Address was expected, but "
3986            + this.location.getClass().getName() + " was encountered");
3987      return (Address) this.location;
3988    }
3989
3990    public boolean hasLocationAddress() {
3991      return this != null && this.location instanceof Address;
3992    }
3993
3994    /**
3995     * @return {@link #location} (The physical location of the accident event.)
3996     */
3997    public Reference getLocationReference() throws FHIRException {
3998      if (this.location == null)
3999        this.location = new Reference();
4000      if (!(this.location instanceof Reference))
4001        throw new FHIRException("Type mismatch: the type Reference was expected, but "
4002            + this.location.getClass().getName() + " was encountered");
4003      return (Reference) this.location;
4004    }
4005
4006    public boolean hasLocationReference() {
4007      return this != null && this.location instanceof Reference;
4008    }
4009
4010    public boolean hasLocation() {
4011      return this.location != null && !this.location.isEmpty();
4012    }
4013
4014    /**
4015     * @param value {@link #location} (The physical location of the accident event.)
4016     */
4017    public AccidentComponent setLocation(Type value) {
4018      if (value != null && !(value instanceof Address || value instanceof Reference))
4019        throw new Error("Not the right type for ExplanationOfBenefit.accident.location[x]: " + value.fhirType());
4020      this.location = value;
4021      return this;
4022    }
4023
4024    protected void listChildren(List<Property> children) {
4025      super.listChildren(children);
4026      children.add(new Property("date", "date",
4027          "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date));
4028      children.add(new Property("type", "CodeableConcept",
4029          "The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.",
4030          0, 1, type));
4031      children.add(new Property("location[x]", "Address|Reference(Location)",
4032          "The physical location of the accident event.", 0, 1, location));
4033    }
4034
4035    @Override
4036    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4037      switch (_hash) {
4038      case 3076014:
4039        /* date */ return new Property("date", "date",
4040            "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date);
4041      case 3575610:
4042        /* type */ return new Property("type", "CodeableConcept",
4043            "The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.",
4044            0, 1, type);
4045      case 552316075:
4046        /* location[x] */ return new Property("location[x]", "Address|Reference(Location)",
4047            "The physical location of the accident event.", 0, 1, location);
4048      case 1901043637:
4049        /* location */ return new Property("location[x]", "Address|Reference(Location)",
4050            "The physical location of the accident event.", 0, 1, location);
4051      case -1280020865:
4052        /* locationAddress */ return new Property("location[x]", "Address|Reference(Location)",
4053            "The physical location of the accident event.", 0, 1, location);
4054      case 755866390:
4055        /* locationReference */ return new Property("location[x]", "Address|Reference(Location)",
4056            "The physical location of the accident event.", 0, 1, location);
4057      default:
4058        return super.getNamedProperty(_hash, _name, _checkValid);
4059      }
4060
4061    }
4062
4063    @Override
4064    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4065      switch (hash) {
4066      case 3076014:
4067        /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateType
4068      case 3575610:
4069        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
4070      case 1901043637:
4071        /* location */ return this.location == null ? new Base[0] : new Base[] { this.location }; // Type
4072      default:
4073        return super.getProperty(hash, name, checkValid);
4074      }
4075
4076    }
4077
4078    @Override
4079    public Base setProperty(int hash, String name, Base value) throws FHIRException {
4080      switch (hash) {
4081      case 3076014: // date
4082        this.date = castToDate(value); // DateType
4083        return value;
4084      case 3575610: // type
4085        this.type = castToCodeableConcept(value); // CodeableConcept
4086        return value;
4087      case 1901043637: // location
4088        this.location = castToType(value); // Type
4089        return value;
4090      default:
4091        return super.setProperty(hash, name, value);
4092      }
4093
4094    }
4095
4096    @Override
4097    public Base setProperty(String name, Base value) throws FHIRException {
4098      if (name.equals("date")) {
4099        this.date = castToDate(value); // DateType
4100      } else if (name.equals("type")) {
4101        this.type = castToCodeableConcept(value); // CodeableConcept
4102      } else if (name.equals("location[x]")) {
4103        this.location = castToType(value); // Type
4104      } else
4105        return super.setProperty(name, value);
4106      return value;
4107    }
4108
4109  @Override
4110  public void removeChild(String name, Base value) throws FHIRException {
4111      if (name.equals("date")) {
4112        this.date = null;
4113      } else if (name.equals("type")) {
4114        this.type = null;
4115      } else if (name.equals("location[x]")) {
4116        this.location = null;
4117      } else
4118        super.removeChild(name, value);
4119      
4120    }
4121
4122    @Override
4123    public Base makeProperty(int hash, String name) throws FHIRException {
4124      switch (hash) {
4125      case 3076014:
4126        return getDateElement();
4127      case 3575610:
4128        return getType();
4129      case 552316075:
4130        return getLocation();
4131      case 1901043637:
4132        return getLocation();
4133      default:
4134        return super.makeProperty(hash, name);
4135      }
4136
4137    }
4138
4139    @Override
4140    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4141      switch (hash) {
4142      case 3076014:
4143        /* date */ return new String[] { "date" };
4144      case 3575610:
4145        /* type */ return new String[] { "CodeableConcept" };
4146      case 1901043637:
4147        /* location */ return new String[] { "Address", "Reference" };
4148      default:
4149        return super.getTypesForProperty(hash, name);
4150      }
4151
4152    }
4153
4154    @Override
4155    public Base addChild(String name) throws FHIRException {
4156      if (name.equals("date")) {
4157        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.date");
4158      } else if (name.equals("type")) {
4159        this.type = new CodeableConcept();
4160        return this.type;
4161      } else if (name.equals("locationAddress")) {
4162        this.location = new Address();
4163        return this.location;
4164      } else if (name.equals("locationReference")) {
4165        this.location = new Reference();
4166        return this.location;
4167      } else
4168        return super.addChild(name);
4169    }
4170
4171    public AccidentComponent copy() {
4172      AccidentComponent dst = new AccidentComponent();
4173      copyValues(dst);
4174      return dst;
4175    }
4176
4177    public void copyValues(AccidentComponent dst) {
4178      super.copyValues(dst);
4179      dst.date = date == null ? null : date.copy();
4180      dst.type = type == null ? null : type.copy();
4181      dst.location = location == null ? null : location.copy();
4182    }
4183
4184    @Override
4185    public boolean equalsDeep(Base other_) {
4186      if (!super.equalsDeep(other_))
4187        return false;
4188      if (!(other_ instanceof AccidentComponent))
4189        return false;
4190      AccidentComponent o = (AccidentComponent) other_;
4191      return compareDeep(date, o.date, true) && compareDeep(type, o.type, true)
4192          && compareDeep(location, o.location, true);
4193    }
4194
4195    @Override
4196    public boolean equalsShallow(Base other_) {
4197      if (!super.equalsShallow(other_))
4198        return false;
4199      if (!(other_ instanceof AccidentComponent))
4200        return false;
4201      AccidentComponent o = (AccidentComponent) other_;
4202      return compareValues(date, o.date, true);
4203    }
4204
4205    public boolean isEmpty() {
4206      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
4207    }
4208
4209    public String fhirType() {
4210      return "ExplanationOfBenefit.accident";
4211
4212    }
4213
4214  }
4215
4216  @Block()
4217  public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
4218    /**
4219     * A number to uniquely identify item entries.
4220     */
4221    @Child(name = "sequence", type = {
4222        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
4223    @Description(shortDefinition = "Item instance identifier", formalDefinition = "A number to uniquely identify item entries.")
4224    protected PositiveIntType sequence;
4225
4226    /**
4227     * Care team members related to this service or product.
4228     */
4229    @Child(name = "careTeamSequence", type = {
4230        PositiveIntType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4231    @Description(shortDefinition = "Applicable care team members", formalDefinition = "Care team members related to this service or product.")
4232    protected List<PositiveIntType> careTeamSequence;
4233
4234    /**
4235     * Diagnoses applicable for this service or product.
4236     */
4237    @Child(name = "diagnosisSequence", type = {
4238        PositiveIntType.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4239    @Description(shortDefinition = "Applicable diagnoses", formalDefinition = "Diagnoses applicable for this service or product.")
4240    protected List<PositiveIntType> diagnosisSequence;
4241
4242    /**
4243     * Procedures applicable for this service or product.
4244     */
4245    @Child(name = "procedureSequence", type = {
4246        PositiveIntType.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4247    @Description(shortDefinition = "Applicable procedures", formalDefinition = "Procedures applicable for this service or product.")
4248    protected List<PositiveIntType> procedureSequence;
4249
4250    /**
4251     * Exceptions, special conditions and supporting information applicable for this
4252     * service or product.
4253     */
4254    @Child(name = "informationSequence", type = {
4255        PositiveIntType.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4256    @Description(shortDefinition = "Applicable exception and supporting information", formalDefinition = "Exceptions, special conditions and supporting information applicable for this service or product.")
4257    protected List<PositiveIntType> informationSequence;
4258
4259    /**
4260     * The type of revenue or cost center providing the product and/or service.
4261     */
4262    @Child(name = "revenue", type = {
4263        CodeableConcept.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
4264    @Description(shortDefinition = "Revenue or cost center code", formalDefinition = "The type of revenue or cost center providing the product and/or service.")
4265    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-revenue-center")
4266    protected CodeableConcept revenue;
4267
4268    /**
4269     * Code to identify the general type of benefits under which products and
4270     * services are provided.
4271     */
4272    @Child(name = "category", type = {
4273        CodeableConcept.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
4274    @Description(shortDefinition = "Benefit classification", formalDefinition = "Code to identify the general type of benefits under which products and services are provided.")
4275    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-benefitcategory")
4276    protected CodeableConcept category;
4277
4278    /**
4279     * When the value is a group code then this item collects a set of related claim
4280     * details, otherwise this contains the product, service, drug or other billing
4281     * code for the item.
4282     */
4283    @Child(name = "productOrService", type = {
4284        CodeableConcept.class }, order = 8, min = 1, max = 1, modifier = false, summary = false)
4285    @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.")
4286    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
4287    protected CodeableConcept productOrService;
4288
4289    /**
4290     * Item typification or modifiers codes to convey additional context for the
4291     * product or service.
4292     */
4293    @Child(name = "modifier", type = {
4294        CodeableConcept.class }, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4295    @Description(shortDefinition = "Product or service billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
4296    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
4297    protected List<CodeableConcept> modifier;
4298
4299    /**
4300     * Identifies the program under which this may be recovered.
4301     */
4302    @Child(name = "programCode", type = {
4303        CodeableConcept.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4304    @Description(shortDefinition = "Program the product or service is provided under", formalDefinition = "Identifies the program under which this may be recovered.")
4305    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-program-code")
4306    protected List<CodeableConcept> programCode;
4307
4308    /**
4309     * The date or dates when the service or product was supplied, performed or
4310     * completed.
4311     */
4312    @Child(name = "serviced", type = { DateType.class,
4313        Period.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
4314    @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.")
4315    protected Type serviced;
4316
4317    /**
4318     * Where the product or service was provided.
4319     */
4320    @Child(name = "location", type = { CodeableConcept.class, Address.class,
4321        Location.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
4322    @Description(shortDefinition = "Place of service or where product was supplied", formalDefinition = "Where the product or service was provided.")
4323    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-place")
4324    protected Type location;
4325
4326    /**
4327     * The number of repetitions of a service or product.
4328     */
4329    @Child(name = "quantity", type = {
4330        Quantity.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
4331    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
4332    protected Quantity quantity;
4333
4334    /**
4335     * If the item is not a group then this is the fee for the product or service,
4336     * otherwise this is the total of the fees for the details of the group.
4337     */
4338    @Child(name = "unitPrice", type = { Money.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
4339    @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.")
4340    protected Money unitPrice;
4341
4342    /**
4343     * A real number that represents a multiplier used in determining the overall
4344     * value of services delivered and/or goods received. The concept of a Factor
4345     * allows for a discount or surcharge multiplier to be applied to a monetary
4346     * amount.
4347     */
4348    @Child(name = "factor", type = {
4349        DecimalType.class }, order = 15, min = 0, max = 1, modifier = false, summary = false)
4350    @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.")
4351    protected DecimalType factor;
4352
4353    /**
4354     * The quantity times the unit price for an additional service or product or
4355     * charge.
4356     */
4357    @Child(name = "net", type = { Money.class }, order = 16, min = 0, max = 1, modifier = false, summary = false)
4358    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
4359    protected Money net;
4360
4361    /**
4362     * Unique Device Identifiers associated with this line item.
4363     */
4364    @Child(name = "udi", type = {
4365        Device.class }, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4366    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
4367    protected List<Reference> udi;
4368    /**
4369     * The actual objects that are the target of the reference (Unique Device
4370     * Identifiers associated with this line item.)
4371     */
4372    protected List<Device> udiTarget;
4373
4374    /**
4375     * Physical service site on the patient (limb, tooth, etc.).
4376     */
4377    @Child(name = "bodySite", type = {
4378        CodeableConcept.class }, order = 18, min = 0, max = 1, modifier = false, summary = false)
4379    @Description(shortDefinition = "Anatomical location", formalDefinition = "Physical service site on the patient (limb, tooth, etc.).")
4380    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/tooth")
4381    protected CodeableConcept bodySite;
4382
4383    /**
4384     * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
4385     */
4386    @Child(name = "subSite", type = {
4387        CodeableConcept.class }, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4388    @Description(shortDefinition = "Anatomical sub-location", formalDefinition = "A region or surface of the bodySite, e.g. limb region or tooth surface(s).")
4389    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/surface")
4390    protected List<CodeableConcept> subSite;
4391
4392    /**
4393     * A billed item may include goods or services provided in multiple encounters.
4394     */
4395    @Child(name = "encounter", type = {
4396        Encounter.class }, order = 20, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4397    @Description(shortDefinition = "Encounters related to this billed item", formalDefinition = "A billed item may include goods or services provided in multiple encounters.")
4398    protected List<Reference> encounter;
4399    /**
4400     * The actual objects that are the target of the reference (A billed item may
4401     * include goods or services provided in multiple encounters.)
4402     */
4403    protected List<Encounter> encounterTarget;
4404
4405    /**
4406     * The numbers associated with notes below which apply to the adjudication of
4407     * this item.
4408     */
4409    @Child(name = "noteNumber", type = {
4410        PositiveIntType.class }, order = 21, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4411    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
4412    protected List<PositiveIntType> noteNumber;
4413
4414    /**
4415     * If this item is a group then the values here are a summary of the
4416     * adjudication of the detail items. If this item is a simple product or service
4417     * then this is the result of the adjudication of this item.
4418     */
4419    @Child(name = "adjudication", type = {}, order = 22, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4420    @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.")
4421    protected List<AdjudicationComponent> adjudication;
4422
4423    /**
4424     * Second-tier of goods and services.
4425     */
4426    @Child(name = "detail", type = {}, order = 23, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4427    @Description(shortDefinition = "Additional items", formalDefinition = "Second-tier of goods and services.")
4428    protected List<DetailComponent> detail;
4429
4430    private static final long serialVersionUID = 67419471L;
4431
4432    /**
4433     * Constructor
4434     */
4435    public ItemComponent() {
4436      super();
4437    }
4438
4439    /**
4440     * Constructor
4441     */
4442    public ItemComponent(PositiveIntType sequence, CodeableConcept productOrService) {
4443      super();
4444      this.sequence = sequence;
4445      this.productOrService = productOrService;
4446    }
4447
4448    /**
4449     * @return {@link #sequence} (A number to uniquely identify item entries.). This
4450     *         is the underlying object with id, value and extensions. The accessor
4451     *         "getSequence" gives direct access to the value
4452     */
4453    public PositiveIntType getSequenceElement() {
4454      if (this.sequence == null)
4455        if (Configuration.errorOnAutoCreate())
4456          throw new Error("Attempt to auto-create ItemComponent.sequence");
4457        else if (Configuration.doAutoCreate())
4458          this.sequence = new PositiveIntType(); // bb
4459      return this.sequence;
4460    }
4461
4462    public boolean hasSequenceElement() {
4463      return this.sequence != null && !this.sequence.isEmpty();
4464    }
4465
4466    public boolean hasSequence() {
4467      return this.sequence != null && !this.sequence.isEmpty();
4468    }
4469
4470    /**
4471     * @param value {@link #sequence} (A number to uniquely identify item entries.).
4472     *              This is the underlying object with id, value and extensions. The
4473     *              accessor "getSequence" gives direct access to the value
4474     */
4475    public ItemComponent setSequenceElement(PositiveIntType value) {
4476      this.sequence = value;
4477      return this;
4478    }
4479
4480    /**
4481     * @return A number to uniquely identify item entries.
4482     */
4483    public int getSequence() {
4484      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
4485    }
4486
4487    /**
4488     * @param value A number to uniquely identify item entries.
4489     */
4490    public ItemComponent setSequence(int value) {
4491      if (this.sequence == null)
4492        this.sequence = new PositiveIntType();
4493      this.sequence.setValue(value);
4494      return this;
4495    }
4496
4497    /**
4498     * @return {@link #careTeamSequence} (Care team members related to this service
4499     *         or product.)
4500     */
4501    public List<PositiveIntType> getCareTeamSequence() {
4502      if (this.careTeamSequence == null)
4503        this.careTeamSequence = new ArrayList<PositiveIntType>();
4504      return this.careTeamSequence;
4505    }
4506
4507    /**
4508     * @return Returns a reference to <code>this</code> for easy method chaining
4509     */
4510    public ItemComponent setCareTeamSequence(List<PositiveIntType> theCareTeamSequence) {
4511      this.careTeamSequence = theCareTeamSequence;
4512      return this;
4513    }
4514
4515    public boolean hasCareTeamSequence() {
4516      if (this.careTeamSequence == null)
4517        return false;
4518      for (PositiveIntType item : this.careTeamSequence)
4519        if (!item.isEmpty())
4520          return true;
4521      return false;
4522    }
4523
4524    /**
4525     * @return {@link #careTeamSequence} (Care team members related to this service
4526     *         or product.)
4527     */
4528    public PositiveIntType addCareTeamSequenceElement() {// 2
4529      PositiveIntType t = new PositiveIntType();
4530      if (this.careTeamSequence == null)
4531        this.careTeamSequence = new ArrayList<PositiveIntType>();
4532      this.careTeamSequence.add(t);
4533      return t;
4534    }
4535
4536    /**
4537     * @param value {@link #careTeamSequence} (Care team members related to this
4538     *              service or product.)
4539     */
4540    public ItemComponent addCareTeamSequence(int value) { // 1
4541      PositiveIntType t = new PositiveIntType();
4542      t.setValue(value);
4543      if (this.careTeamSequence == null)
4544        this.careTeamSequence = new ArrayList<PositiveIntType>();
4545      this.careTeamSequence.add(t);
4546      return this;
4547    }
4548
4549    /**
4550     * @param value {@link #careTeamSequence} (Care team members related to this
4551     *              service or product.)
4552     */
4553    public boolean hasCareTeamSequence(int value) {
4554      if (this.careTeamSequence == null)
4555        return false;
4556      for (PositiveIntType v : this.careTeamSequence)
4557        if (v.getValue().equals(value)) // positiveInt
4558          return true;
4559      return false;
4560    }
4561
4562    /**
4563     * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or
4564     *         product.)
4565     */
4566    public List<PositiveIntType> getDiagnosisSequence() {
4567      if (this.diagnosisSequence == null)
4568        this.diagnosisSequence = new ArrayList<PositiveIntType>();
4569      return this.diagnosisSequence;
4570    }
4571
4572    /**
4573     * @return Returns a reference to <code>this</code> for easy method chaining
4574     */
4575    public ItemComponent setDiagnosisSequence(List<PositiveIntType> theDiagnosisSequence) {
4576      this.diagnosisSequence = theDiagnosisSequence;
4577      return this;
4578    }
4579
4580    public boolean hasDiagnosisSequence() {
4581      if (this.diagnosisSequence == null)
4582        return false;
4583      for (PositiveIntType item : this.diagnosisSequence)
4584        if (!item.isEmpty())
4585          return true;
4586      return false;
4587    }
4588
4589    /**
4590     * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or
4591     *         product.)
4592     */
4593    public PositiveIntType addDiagnosisSequenceElement() {// 2
4594      PositiveIntType t = new PositiveIntType();
4595      if (this.diagnosisSequence == null)
4596        this.diagnosisSequence = new ArrayList<PositiveIntType>();
4597      this.diagnosisSequence.add(t);
4598      return t;
4599    }
4600
4601    /**
4602     * @param value {@link #diagnosisSequence} (Diagnoses applicable for this
4603     *              service or product.)
4604     */
4605    public ItemComponent addDiagnosisSequence(int value) { // 1
4606      PositiveIntType t = new PositiveIntType();
4607      t.setValue(value);
4608      if (this.diagnosisSequence == null)
4609        this.diagnosisSequence = new ArrayList<PositiveIntType>();
4610      this.diagnosisSequence.add(t);
4611      return this;
4612    }
4613
4614    /**
4615     * @param value {@link #diagnosisSequence} (Diagnoses applicable for this
4616     *              service or product.)
4617     */
4618    public boolean hasDiagnosisSequence(int value) {
4619      if (this.diagnosisSequence == null)
4620        return false;
4621      for (PositiveIntType v : this.diagnosisSequence)
4622        if (v.getValue().equals(value)) // positiveInt
4623          return true;
4624      return false;
4625    }
4626
4627    /**
4628     * @return {@link #procedureSequence} (Procedures applicable for this service or
4629     *         product.)
4630     */
4631    public List<PositiveIntType> getProcedureSequence() {
4632      if (this.procedureSequence == null)
4633        this.procedureSequence = new ArrayList<PositiveIntType>();
4634      return this.procedureSequence;
4635    }
4636
4637    /**
4638     * @return Returns a reference to <code>this</code> for easy method chaining
4639     */
4640    public ItemComponent setProcedureSequence(List<PositiveIntType> theProcedureSequence) {
4641      this.procedureSequence = theProcedureSequence;
4642      return this;
4643    }
4644
4645    public boolean hasProcedureSequence() {
4646      if (this.procedureSequence == null)
4647        return false;
4648      for (PositiveIntType item : this.procedureSequence)
4649        if (!item.isEmpty())
4650          return true;
4651      return false;
4652    }
4653
4654    /**
4655     * @return {@link #procedureSequence} (Procedures applicable for this service or
4656     *         product.)
4657     */
4658    public PositiveIntType addProcedureSequenceElement() {// 2
4659      PositiveIntType t = new PositiveIntType();
4660      if (this.procedureSequence == null)
4661        this.procedureSequence = new ArrayList<PositiveIntType>();
4662      this.procedureSequence.add(t);
4663      return t;
4664    }
4665
4666    /**
4667     * @param value {@link #procedureSequence} (Procedures applicable for this
4668     *              service or product.)
4669     */
4670    public ItemComponent addProcedureSequence(int value) { // 1
4671      PositiveIntType t = new PositiveIntType();
4672      t.setValue(value);
4673      if (this.procedureSequence == null)
4674        this.procedureSequence = new ArrayList<PositiveIntType>();
4675      this.procedureSequence.add(t);
4676      return this;
4677    }
4678
4679    /**
4680     * @param value {@link #procedureSequence} (Procedures applicable for this
4681     *              service or product.)
4682     */
4683    public boolean hasProcedureSequence(int value) {
4684      if (this.procedureSequence == null)
4685        return false;
4686      for (PositiveIntType v : this.procedureSequence)
4687        if (v.getValue().equals(value)) // positiveInt
4688          return true;
4689      return false;
4690    }
4691
4692    /**
4693     * @return {@link #informationSequence} (Exceptions, special conditions and
4694     *         supporting information applicable for this service or product.)
4695     */
4696    public List<PositiveIntType> getInformationSequence() {
4697      if (this.informationSequence == null)
4698        this.informationSequence = new ArrayList<PositiveIntType>();
4699      return this.informationSequence;
4700    }
4701
4702    /**
4703     * @return Returns a reference to <code>this</code> for easy method chaining
4704     */
4705    public ItemComponent setInformationSequence(List<PositiveIntType> theInformationSequence) {
4706      this.informationSequence = theInformationSequence;
4707      return this;
4708    }
4709
4710    public boolean hasInformationSequence() {
4711      if (this.informationSequence == null)
4712        return false;
4713      for (PositiveIntType item : this.informationSequence)
4714        if (!item.isEmpty())
4715          return true;
4716      return false;
4717    }
4718
4719    /**
4720     * @return {@link #informationSequence} (Exceptions, special conditions and
4721     *         supporting information applicable for this service or product.)
4722     */
4723    public PositiveIntType addInformationSequenceElement() {// 2
4724      PositiveIntType t = new PositiveIntType();
4725      if (this.informationSequence == null)
4726        this.informationSequence = new ArrayList<PositiveIntType>();
4727      this.informationSequence.add(t);
4728      return t;
4729    }
4730
4731    /**
4732     * @param value {@link #informationSequence} (Exceptions, special conditions and
4733     *              supporting information applicable for this service or product.)
4734     */
4735    public ItemComponent addInformationSequence(int value) { // 1
4736      PositiveIntType t = new PositiveIntType();
4737      t.setValue(value);
4738      if (this.informationSequence == null)
4739        this.informationSequence = new ArrayList<PositiveIntType>();
4740      this.informationSequence.add(t);
4741      return this;
4742    }
4743
4744    /**
4745     * @param value {@link #informationSequence} (Exceptions, special conditions and
4746     *              supporting information applicable for this service or product.)
4747     */
4748    public boolean hasInformationSequence(int value) {
4749      if (this.informationSequence == null)
4750        return false;
4751      for (PositiveIntType v : this.informationSequence)
4752        if (v.getValue().equals(value)) // positiveInt
4753          return true;
4754      return false;
4755    }
4756
4757    /**
4758     * @return {@link #revenue} (The type of revenue or cost center providing the
4759     *         product and/or service.)
4760     */
4761    public CodeableConcept getRevenue() {
4762      if (this.revenue == null)
4763        if (Configuration.errorOnAutoCreate())
4764          throw new Error("Attempt to auto-create ItemComponent.revenue");
4765        else if (Configuration.doAutoCreate())
4766          this.revenue = new CodeableConcept(); // cc
4767      return this.revenue;
4768    }
4769
4770    public boolean hasRevenue() {
4771      return this.revenue != null && !this.revenue.isEmpty();
4772    }
4773
4774    /**
4775     * @param value {@link #revenue} (The type of revenue or cost center providing
4776     *              the product and/or service.)
4777     */
4778    public ItemComponent setRevenue(CodeableConcept value) {
4779      this.revenue = value;
4780      return this;
4781    }
4782
4783    /**
4784     * @return {@link #category} (Code to identify the general type of benefits
4785     *         under which products and services are provided.)
4786     */
4787    public CodeableConcept getCategory() {
4788      if (this.category == null)
4789        if (Configuration.errorOnAutoCreate())
4790          throw new Error("Attempt to auto-create ItemComponent.category");
4791        else if (Configuration.doAutoCreate())
4792          this.category = new CodeableConcept(); // cc
4793      return this.category;
4794    }
4795
4796    public boolean hasCategory() {
4797      return this.category != null && !this.category.isEmpty();
4798    }
4799
4800    /**
4801     * @param value {@link #category} (Code to identify the general type of benefits
4802     *              under which products and services are provided.)
4803     */
4804    public ItemComponent setCategory(CodeableConcept value) {
4805      this.category = value;
4806      return this;
4807    }
4808
4809    /**
4810     * @return {@link #productOrService} (When the value is a group code then this
4811     *         item collects a set of related claim details, otherwise this contains
4812     *         the product, service, drug or other billing code for the item.)
4813     */
4814    public CodeableConcept getProductOrService() {
4815      if (this.productOrService == null)
4816        if (Configuration.errorOnAutoCreate())
4817          throw new Error("Attempt to auto-create ItemComponent.productOrService");
4818        else if (Configuration.doAutoCreate())
4819          this.productOrService = new CodeableConcept(); // cc
4820      return this.productOrService;
4821    }
4822
4823    public boolean hasProductOrService() {
4824      return this.productOrService != null && !this.productOrService.isEmpty();
4825    }
4826
4827    /**
4828     * @param value {@link #productOrService} (When the value is a group code then
4829     *              this item collects a set of related claim details, otherwise
4830     *              this contains the product, service, drug or other billing code
4831     *              for the item.)
4832     */
4833    public ItemComponent setProductOrService(CodeableConcept value) {
4834      this.productOrService = value;
4835      return this;
4836    }
4837
4838    /**
4839     * @return {@link #modifier} (Item typification or modifiers codes to convey
4840     *         additional context for the product or service.)
4841     */
4842    public List<CodeableConcept> getModifier() {
4843      if (this.modifier == null)
4844        this.modifier = new ArrayList<CodeableConcept>();
4845      return this.modifier;
4846    }
4847
4848    /**
4849     * @return Returns a reference to <code>this</code> for easy method chaining
4850     */
4851    public ItemComponent setModifier(List<CodeableConcept> theModifier) {
4852      this.modifier = theModifier;
4853      return this;
4854    }
4855
4856    public boolean hasModifier() {
4857      if (this.modifier == null)
4858        return false;
4859      for (CodeableConcept item : this.modifier)
4860        if (!item.isEmpty())
4861          return true;
4862      return false;
4863    }
4864
4865    public CodeableConcept addModifier() { // 3
4866      CodeableConcept t = new CodeableConcept();
4867      if (this.modifier == null)
4868        this.modifier = new ArrayList<CodeableConcept>();
4869      this.modifier.add(t);
4870      return t;
4871    }
4872
4873    public ItemComponent addModifier(CodeableConcept t) { // 3
4874      if (t == null)
4875        return this;
4876      if (this.modifier == null)
4877        this.modifier = new ArrayList<CodeableConcept>();
4878      this.modifier.add(t);
4879      return this;
4880    }
4881
4882    /**
4883     * @return The first repetition of repeating field {@link #modifier}, creating
4884     *         it if it does not already exist
4885     */
4886    public CodeableConcept getModifierFirstRep() {
4887      if (getModifier().isEmpty()) {
4888        addModifier();
4889      }
4890      return getModifier().get(0);
4891    }
4892
4893    /**
4894     * @return {@link #programCode} (Identifies the program under which this may be
4895     *         recovered.)
4896     */
4897    public List<CodeableConcept> getProgramCode() {
4898      if (this.programCode == null)
4899        this.programCode = new ArrayList<CodeableConcept>();
4900      return this.programCode;
4901    }
4902
4903    /**
4904     * @return Returns a reference to <code>this</code> for easy method chaining
4905     */
4906    public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) {
4907      this.programCode = theProgramCode;
4908      return this;
4909    }
4910
4911    public boolean hasProgramCode() {
4912      if (this.programCode == null)
4913        return false;
4914      for (CodeableConcept item : this.programCode)
4915        if (!item.isEmpty())
4916          return true;
4917      return false;
4918    }
4919
4920    public CodeableConcept addProgramCode() { // 3
4921      CodeableConcept t = new CodeableConcept();
4922      if (this.programCode == null)
4923        this.programCode = new ArrayList<CodeableConcept>();
4924      this.programCode.add(t);
4925      return t;
4926    }
4927
4928    public ItemComponent addProgramCode(CodeableConcept t) { // 3
4929      if (t == null)
4930        return this;
4931      if (this.programCode == null)
4932        this.programCode = new ArrayList<CodeableConcept>();
4933      this.programCode.add(t);
4934      return this;
4935    }
4936
4937    /**
4938     * @return The first repetition of repeating field {@link #programCode},
4939     *         creating it if it does not already exist
4940     */
4941    public CodeableConcept getProgramCodeFirstRep() {
4942      if (getProgramCode().isEmpty()) {
4943        addProgramCode();
4944      }
4945      return getProgramCode().get(0);
4946    }
4947
4948    /**
4949     * @return {@link #serviced} (The date or dates when the service or product was
4950     *         supplied, performed or completed.)
4951     */
4952    public Type getServiced() {
4953      return this.serviced;
4954    }
4955
4956    /**
4957     * @return {@link #serviced} (The date or dates when the service or product was
4958     *         supplied, performed or completed.)
4959     */
4960    public DateType getServicedDateType() throws FHIRException {
4961      if (this.serviced == null)
4962        this.serviced = new DateType();
4963      if (!(this.serviced instanceof DateType))
4964        throw new FHIRException("Type mismatch: the type DateType was expected, but "
4965            + this.serviced.getClass().getName() + " was encountered");
4966      return (DateType) this.serviced;
4967    }
4968
4969    public boolean hasServicedDateType() {
4970      return this != null && this.serviced instanceof DateType;
4971    }
4972
4973    /**
4974     * @return {@link #serviced} (The date or dates when the service or product was
4975     *         supplied, performed or completed.)
4976     */
4977    public Period getServicedPeriod() throws FHIRException {
4978      if (this.serviced == null)
4979        this.serviced = new Period();
4980      if (!(this.serviced instanceof Period))
4981        throw new FHIRException("Type mismatch: the type Period was expected, but " + this.serviced.getClass().getName()
4982            + " was encountered");
4983      return (Period) this.serviced;
4984    }
4985
4986    public boolean hasServicedPeriod() {
4987      return this != null && this.serviced instanceof Period;
4988    }
4989
4990    public boolean hasServiced() {
4991      return this.serviced != null && !this.serviced.isEmpty();
4992    }
4993
4994    /**
4995     * @param value {@link #serviced} (The date or dates when the service or product
4996     *              was supplied, performed or completed.)
4997     */
4998    public ItemComponent setServiced(Type value) {
4999      if (value != null && !(value instanceof DateType || value instanceof Period))
5000        throw new Error("Not the right type for ExplanationOfBenefit.item.serviced[x]: " + value.fhirType());
5001      this.serviced = value;
5002      return this;
5003    }
5004
5005    /**
5006     * @return {@link #location} (Where the product or service was provided.)
5007     */
5008    public Type getLocation() {
5009      return this.location;
5010    }
5011
5012    /**
5013     * @return {@link #location} (Where the product or service was provided.)
5014     */
5015    public CodeableConcept getLocationCodeableConcept() throws FHIRException {
5016      if (this.location == null)
5017        this.location = new CodeableConcept();
5018      if (!(this.location instanceof CodeableConcept))
5019        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
5020            + this.location.getClass().getName() + " was encountered");
5021      return (CodeableConcept) this.location;
5022    }
5023
5024    public boolean hasLocationCodeableConcept() {
5025      return this != null && this.location instanceof CodeableConcept;
5026    }
5027
5028    /**
5029     * @return {@link #location} (Where the product or service was provided.)
5030     */
5031    public Address getLocationAddress() throws FHIRException {
5032      if (this.location == null)
5033        this.location = new Address();
5034      if (!(this.location instanceof Address))
5035        throw new FHIRException("Type mismatch: the type Address was expected, but "
5036            + this.location.getClass().getName() + " was encountered");
5037      return (Address) this.location;
5038    }
5039
5040    public boolean hasLocationAddress() {
5041      return this != null && this.location instanceof Address;
5042    }
5043
5044    /**
5045     * @return {@link #location} (Where the product or service was provided.)
5046     */
5047    public Reference getLocationReference() throws FHIRException {
5048      if (this.location == null)
5049        this.location = new Reference();
5050      if (!(this.location instanceof Reference))
5051        throw new FHIRException("Type mismatch: the type Reference was expected, but "
5052            + this.location.getClass().getName() + " was encountered");
5053      return (Reference) this.location;
5054    }
5055
5056    public boolean hasLocationReference() {
5057      return this != null && this.location instanceof Reference;
5058    }
5059
5060    public boolean hasLocation() {
5061      return this.location != null && !this.location.isEmpty();
5062    }
5063
5064    /**
5065     * @param value {@link #location} (Where the product or service was provided.)
5066     */
5067    public ItemComponent setLocation(Type value) {
5068      if (value != null
5069          && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
5070        throw new Error("Not the right type for ExplanationOfBenefit.item.location[x]: " + value.fhirType());
5071      this.location = value;
5072      return this;
5073    }
5074
5075    /**
5076     * @return {@link #quantity} (The number of repetitions of a service or
5077     *         product.)
5078     */
5079    public Quantity getQuantity() {
5080      if (this.quantity == null)
5081        if (Configuration.errorOnAutoCreate())
5082          throw new Error("Attempt to auto-create ItemComponent.quantity");
5083        else if (Configuration.doAutoCreate())
5084          this.quantity = new Quantity(); // cc
5085      return this.quantity;
5086    }
5087
5088    public boolean hasQuantity() {
5089      return this.quantity != null && !this.quantity.isEmpty();
5090    }
5091
5092    /**
5093     * @param value {@link #quantity} (The number of repetitions of a service or
5094     *              product.)
5095     */
5096    public ItemComponent setQuantity(Quantity value) {
5097      this.quantity = value;
5098      return this;
5099    }
5100
5101    /**
5102     * @return {@link #unitPrice} (If the item is not a group then this is the fee
5103     *         for the product or service, otherwise this is the total of the fees
5104     *         for the details of the group.)
5105     */
5106    public Money getUnitPrice() {
5107      if (this.unitPrice == null)
5108        if (Configuration.errorOnAutoCreate())
5109          throw new Error("Attempt to auto-create ItemComponent.unitPrice");
5110        else if (Configuration.doAutoCreate())
5111          this.unitPrice = new Money(); // cc
5112      return this.unitPrice;
5113    }
5114
5115    public boolean hasUnitPrice() {
5116      return this.unitPrice != null && !this.unitPrice.isEmpty();
5117    }
5118
5119    /**
5120     * @param value {@link #unitPrice} (If the item is not a group then this is the
5121     *              fee for the product or service, otherwise this is the total of
5122     *              the fees for the details of the group.)
5123     */
5124    public ItemComponent setUnitPrice(Money value) {
5125      this.unitPrice = value;
5126      return this;
5127    }
5128
5129    /**
5130     * @return {@link #factor} (A real number that represents a multiplier used in
5131     *         determining the overall value of services delivered and/or goods
5132     *         received. The concept of a Factor allows for a discount or surcharge
5133     *         multiplier to be applied to a monetary amount.). This is the
5134     *         underlying object with id, value and extensions. The accessor
5135     *         "getFactor" gives direct access to the value
5136     */
5137    public DecimalType getFactorElement() {
5138      if (this.factor == null)
5139        if (Configuration.errorOnAutoCreate())
5140          throw new Error("Attempt to auto-create ItemComponent.factor");
5141        else if (Configuration.doAutoCreate())
5142          this.factor = new DecimalType(); // bb
5143      return this.factor;
5144    }
5145
5146    public boolean hasFactorElement() {
5147      return this.factor != null && !this.factor.isEmpty();
5148    }
5149
5150    public boolean hasFactor() {
5151      return this.factor != null && !this.factor.isEmpty();
5152    }
5153
5154    /**
5155     * @param value {@link #factor} (A real number that represents a multiplier used
5156     *              in determining the overall value of services delivered and/or
5157     *              goods received. The concept of a Factor allows for a discount or
5158     *              surcharge multiplier to be applied to a monetary amount.). This
5159     *              is the underlying object with id, value and extensions. The
5160     *              accessor "getFactor" gives direct access to the value
5161     */
5162    public ItemComponent setFactorElement(DecimalType value) {
5163      this.factor = value;
5164      return this;
5165    }
5166
5167    /**
5168     * @return A real number that represents a multiplier used in determining the
5169     *         overall value of services delivered and/or goods received. The
5170     *         concept of a Factor allows for a discount or surcharge multiplier to
5171     *         be applied to a monetary amount.
5172     */
5173    public BigDecimal getFactor() {
5174      return this.factor == null ? null : this.factor.getValue();
5175    }
5176
5177    /**
5178     * @param value A real number that represents a multiplier used in determining
5179     *              the overall value of services delivered and/or goods received.
5180     *              The concept of a Factor allows for a discount or surcharge
5181     *              multiplier to be applied to a monetary amount.
5182     */
5183    public ItemComponent setFactor(BigDecimal value) {
5184      if (value == null)
5185        this.factor = null;
5186      else {
5187        if (this.factor == null)
5188          this.factor = new DecimalType();
5189        this.factor.setValue(value);
5190      }
5191      return this;
5192    }
5193
5194    /**
5195     * @param value A real number that represents a multiplier used in determining
5196     *              the overall value of services delivered and/or goods received.
5197     *              The concept of a Factor allows for a discount or surcharge
5198     *              multiplier to be applied to a monetary amount.
5199     */
5200    public ItemComponent setFactor(long value) {
5201      this.factor = new DecimalType();
5202      this.factor.setValue(value);
5203      return this;
5204    }
5205
5206    /**
5207     * @param value A real number that represents a multiplier used in determining
5208     *              the overall value of services delivered and/or goods received.
5209     *              The concept of a Factor allows for a discount or surcharge
5210     *              multiplier to be applied to a monetary amount.
5211     */
5212    public ItemComponent setFactor(double value) {
5213      this.factor = new DecimalType();
5214      this.factor.setValue(value);
5215      return this;
5216    }
5217
5218    /**
5219     * @return {@link #net} (The quantity times the unit price for an additional
5220     *         service or product or charge.)
5221     */
5222    public Money getNet() {
5223      if (this.net == null)
5224        if (Configuration.errorOnAutoCreate())
5225          throw new Error("Attempt to auto-create ItemComponent.net");
5226        else if (Configuration.doAutoCreate())
5227          this.net = new Money(); // cc
5228      return this.net;
5229    }
5230
5231    public boolean hasNet() {
5232      return this.net != null && !this.net.isEmpty();
5233    }
5234
5235    /**
5236     * @param value {@link #net} (The quantity times the unit price for an
5237     *              additional service or product or charge.)
5238     */
5239    public ItemComponent setNet(Money value) {
5240      this.net = value;
5241      return this;
5242    }
5243
5244    /**
5245     * @return {@link #udi} (Unique Device Identifiers associated with this line
5246     *         item.)
5247     */
5248    public List<Reference> getUdi() {
5249      if (this.udi == null)
5250        this.udi = new ArrayList<Reference>();
5251      return this.udi;
5252    }
5253
5254    /**
5255     * @return Returns a reference to <code>this</code> for easy method chaining
5256     */
5257    public ItemComponent setUdi(List<Reference> theUdi) {
5258      this.udi = theUdi;
5259      return this;
5260    }
5261
5262    public boolean hasUdi() {
5263      if (this.udi == null)
5264        return false;
5265      for (Reference item : this.udi)
5266        if (!item.isEmpty())
5267          return true;
5268      return false;
5269    }
5270
5271    public Reference addUdi() { // 3
5272      Reference t = new Reference();
5273      if (this.udi == null)
5274        this.udi = new ArrayList<Reference>();
5275      this.udi.add(t);
5276      return t;
5277    }
5278
5279    public ItemComponent addUdi(Reference t) { // 3
5280      if (t == null)
5281        return this;
5282      if (this.udi == null)
5283        this.udi = new ArrayList<Reference>();
5284      this.udi.add(t);
5285      return this;
5286    }
5287
5288    /**
5289     * @return The first repetition of repeating field {@link #udi}, creating it if
5290     *         it does not already exist
5291     */
5292    public Reference getUdiFirstRep() {
5293      if (getUdi().isEmpty()) {
5294        addUdi();
5295      }
5296      return getUdi().get(0);
5297    }
5298
5299    /**
5300     * @deprecated Use Reference#setResource(IBaseResource) instead
5301     */
5302    @Deprecated
5303    public List<Device> getUdiTarget() {
5304      if (this.udiTarget == null)
5305        this.udiTarget = new ArrayList<Device>();
5306      return this.udiTarget;
5307    }
5308
5309    /**
5310     * @deprecated Use Reference#setResource(IBaseResource) instead
5311     */
5312    @Deprecated
5313    public Device addUdiTarget() {
5314      Device r = new Device();
5315      if (this.udiTarget == null)
5316        this.udiTarget = new ArrayList<Device>();
5317      this.udiTarget.add(r);
5318      return r;
5319    }
5320
5321    /**
5322     * @return {@link #bodySite} (Physical service site on the patient (limb, tooth,
5323     *         etc.).)
5324     */
5325    public CodeableConcept getBodySite() {
5326      if (this.bodySite == null)
5327        if (Configuration.errorOnAutoCreate())
5328          throw new Error("Attempt to auto-create ItemComponent.bodySite");
5329        else if (Configuration.doAutoCreate())
5330          this.bodySite = new CodeableConcept(); // cc
5331      return this.bodySite;
5332    }
5333
5334    public boolean hasBodySite() {
5335      return this.bodySite != null && !this.bodySite.isEmpty();
5336    }
5337
5338    /**
5339     * @param value {@link #bodySite} (Physical service site on the patient (limb,
5340     *              tooth, etc.).)
5341     */
5342    public ItemComponent setBodySite(CodeableConcept value) {
5343      this.bodySite = value;
5344      return this;
5345    }
5346
5347    /**
5348     * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb
5349     *         region or tooth surface(s).)
5350     */
5351    public List<CodeableConcept> getSubSite() {
5352      if (this.subSite == null)
5353        this.subSite = new ArrayList<CodeableConcept>();
5354      return this.subSite;
5355    }
5356
5357    /**
5358     * @return Returns a reference to <code>this</code> for easy method chaining
5359     */
5360    public ItemComponent setSubSite(List<CodeableConcept> theSubSite) {
5361      this.subSite = theSubSite;
5362      return this;
5363    }
5364
5365    public boolean hasSubSite() {
5366      if (this.subSite == null)
5367        return false;
5368      for (CodeableConcept item : this.subSite)
5369        if (!item.isEmpty())
5370          return true;
5371      return false;
5372    }
5373
5374    public CodeableConcept addSubSite() { // 3
5375      CodeableConcept t = new CodeableConcept();
5376      if (this.subSite == null)
5377        this.subSite = new ArrayList<CodeableConcept>();
5378      this.subSite.add(t);
5379      return t;
5380    }
5381
5382    public ItemComponent addSubSite(CodeableConcept t) { // 3
5383      if (t == null)
5384        return this;
5385      if (this.subSite == null)
5386        this.subSite = new ArrayList<CodeableConcept>();
5387      this.subSite.add(t);
5388      return this;
5389    }
5390
5391    /**
5392     * @return The first repetition of repeating field {@link #subSite}, creating it
5393     *         if it does not already exist
5394     */
5395    public CodeableConcept getSubSiteFirstRep() {
5396      if (getSubSite().isEmpty()) {
5397        addSubSite();
5398      }
5399      return getSubSite().get(0);
5400    }
5401
5402    /**
5403     * @return {@link #encounter} (A billed item may include goods or services
5404     *         provided in multiple encounters.)
5405     */
5406    public List<Reference> getEncounter() {
5407      if (this.encounter == null)
5408        this.encounter = new ArrayList<Reference>();
5409      return this.encounter;
5410    }
5411
5412    /**
5413     * @return Returns a reference to <code>this</code> for easy method chaining
5414     */
5415    public ItemComponent setEncounter(List<Reference> theEncounter) {
5416      this.encounter = theEncounter;
5417      return this;
5418    }
5419
5420    public boolean hasEncounter() {
5421      if (this.encounter == null)
5422        return false;
5423      for (Reference item : this.encounter)
5424        if (!item.isEmpty())
5425          return true;
5426      return false;
5427    }
5428
5429    public Reference addEncounter() { // 3
5430      Reference t = new Reference();
5431      if (this.encounter == null)
5432        this.encounter = new ArrayList<Reference>();
5433      this.encounter.add(t);
5434      return t;
5435    }
5436
5437    public ItemComponent addEncounter(Reference t) { // 3
5438      if (t == null)
5439        return this;
5440      if (this.encounter == null)
5441        this.encounter = new ArrayList<Reference>();
5442      this.encounter.add(t);
5443      return this;
5444    }
5445
5446    /**
5447     * @return The first repetition of repeating field {@link #encounter}, creating
5448     *         it if it does not already exist
5449     */
5450    public Reference getEncounterFirstRep() {
5451      if (getEncounter().isEmpty()) {
5452        addEncounter();
5453      }
5454      return getEncounter().get(0);
5455    }
5456
5457    /**
5458     * @deprecated Use Reference#setResource(IBaseResource) instead
5459     */
5460    @Deprecated
5461    public List<Encounter> getEncounterTarget() {
5462      if (this.encounterTarget == null)
5463        this.encounterTarget = new ArrayList<Encounter>();
5464      return this.encounterTarget;
5465    }
5466
5467    /**
5468     * @deprecated Use Reference#setResource(IBaseResource) instead
5469     */
5470    @Deprecated
5471    public Encounter addEncounterTarget() {
5472      Encounter r = new Encounter();
5473      if (this.encounterTarget == null)
5474        this.encounterTarget = new ArrayList<Encounter>();
5475      this.encounterTarget.add(r);
5476      return r;
5477    }
5478
5479    /**
5480     * @return {@link #noteNumber} (The numbers associated with notes below which
5481     *         apply to the adjudication of this item.)
5482     */
5483    public List<PositiveIntType> getNoteNumber() {
5484      if (this.noteNumber == null)
5485        this.noteNumber = new ArrayList<PositiveIntType>();
5486      return this.noteNumber;
5487    }
5488
5489    /**
5490     * @return Returns a reference to <code>this</code> for easy method chaining
5491     */
5492    public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
5493      this.noteNumber = theNoteNumber;
5494      return this;
5495    }
5496
5497    public boolean hasNoteNumber() {
5498      if (this.noteNumber == null)
5499        return false;
5500      for (PositiveIntType item : this.noteNumber)
5501        if (!item.isEmpty())
5502          return true;
5503      return false;
5504    }
5505
5506    /**
5507     * @return {@link #noteNumber} (The numbers associated with notes below which
5508     *         apply to the adjudication of this item.)
5509     */
5510    public PositiveIntType addNoteNumberElement() {// 2
5511      PositiveIntType t = new PositiveIntType();
5512      if (this.noteNumber == null)
5513        this.noteNumber = new ArrayList<PositiveIntType>();
5514      this.noteNumber.add(t);
5515      return t;
5516    }
5517
5518    /**
5519     * @param value {@link #noteNumber} (The numbers associated with notes below
5520     *              which apply to the adjudication of this item.)
5521     */
5522    public ItemComponent addNoteNumber(int value) { // 1
5523      PositiveIntType t = new PositiveIntType();
5524      t.setValue(value);
5525      if (this.noteNumber == null)
5526        this.noteNumber = new ArrayList<PositiveIntType>();
5527      this.noteNumber.add(t);
5528      return this;
5529    }
5530
5531    /**
5532     * @param value {@link #noteNumber} (The numbers associated with notes below
5533     *              which apply to the adjudication of this item.)
5534     */
5535    public boolean hasNoteNumber(int value) {
5536      if (this.noteNumber == null)
5537        return false;
5538      for (PositiveIntType v : this.noteNumber)
5539        if (v.getValue().equals(value)) // positiveInt
5540          return true;
5541      return false;
5542    }
5543
5544    /**
5545     * @return {@link #adjudication} (If this item is a group then the values here
5546     *         are a summary of the adjudication of the detail items. If this item
5547     *         is a simple product or service then this is the result of the
5548     *         adjudication of this item.)
5549     */
5550    public List<AdjudicationComponent> getAdjudication() {
5551      if (this.adjudication == null)
5552        this.adjudication = new ArrayList<AdjudicationComponent>();
5553      return this.adjudication;
5554    }
5555
5556    /**
5557     * @return Returns a reference to <code>this</code> for easy method chaining
5558     */
5559    public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
5560      this.adjudication = theAdjudication;
5561      return this;
5562    }
5563
5564    public boolean hasAdjudication() {
5565      if (this.adjudication == null)
5566        return false;
5567      for (AdjudicationComponent item : this.adjudication)
5568        if (!item.isEmpty())
5569          return true;
5570      return false;
5571    }
5572
5573    public AdjudicationComponent addAdjudication() { // 3
5574      AdjudicationComponent t = new AdjudicationComponent();
5575      if (this.adjudication == null)
5576        this.adjudication = new ArrayList<AdjudicationComponent>();
5577      this.adjudication.add(t);
5578      return t;
5579    }
5580
5581    public ItemComponent addAdjudication(AdjudicationComponent t) { // 3
5582      if (t == null)
5583        return this;
5584      if (this.adjudication == null)
5585        this.adjudication = new ArrayList<AdjudicationComponent>();
5586      this.adjudication.add(t);
5587      return this;
5588    }
5589
5590    /**
5591     * @return The first repetition of repeating field {@link #adjudication},
5592     *         creating it if it does not already exist
5593     */
5594    public AdjudicationComponent getAdjudicationFirstRep() {
5595      if (getAdjudication().isEmpty()) {
5596        addAdjudication();
5597      }
5598      return getAdjudication().get(0);
5599    }
5600
5601    /**
5602     * @return {@link #detail} (Second-tier of goods and services.)
5603     */
5604    public List<DetailComponent> getDetail() {
5605      if (this.detail == null)
5606        this.detail = new ArrayList<DetailComponent>();
5607      return this.detail;
5608    }
5609
5610    /**
5611     * @return Returns a reference to <code>this</code> for easy method chaining
5612     */
5613    public ItemComponent setDetail(List<DetailComponent> theDetail) {
5614      this.detail = theDetail;
5615      return this;
5616    }
5617
5618    public boolean hasDetail() {
5619      if (this.detail == null)
5620        return false;
5621      for (DetailComponent item : this.detail)
5622        if (!item.isEmpty())
5623          return true;
5624      return false;
5625    }
5626
5627    public DetailComponent addDetail() { // 3
5628      DetailComponent t = new DetailComponent();
5629      if (this.detail == null)
5630        this.detail = new ArrayList<DetailComponent>();
5631      this.detail.add(t);
5632      return t;
5633    }
5634
5635    public ItemComponent addDetail(DetailComponent t) { // 3
5636      if (t == null)
5637        return this;
5638      if (this.detail == null)
5639        this.detail = new ArrayList<DetailComponent>();
5640      this.detail.add(t);
5641      return this;
5642    }
5643
5644    /**
5645     * @return The first repetition of repeating field {@link #detail}, creating it
5646     *         if it does not already exist
5647     */
5648    public DetailComponent getDetailFirstRep() {
5649      if (getDetail().isEmpty()) {
5650        addDetail();
5651      }
5652      return getDetail().get(0);
5653    }
5654
5655    protected void listChildren(List<Property> children) {
5656      super.listChildren(children);
5657      children
5658          .add(new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence));
5659      children.add(new Property("careTeamSequence", "positiveInt",
5660          "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence));
5661      children.add(new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.",
5662          0, java.lang.Integer.MAX_VALUE, diagnosisSequence));
5663      children.add(new Property("procedureSequence", "positiveInt",
5664          "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence));
5665      children.add(new Property("informationSequence", "positiveInt",
5666          "Exceptions, special conditions and supporting information applicable for this service or product.", 0,
5667          java.lang.Integer.MAX_VALUE, informationSequence));
5668      children.add(new Property("revenue", "CodeableConcept",
5669          "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
5670      children.add(new Property("category", "CodeableConcept",
5671          "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
5672          category));
5673      children.add(new Property("productOrService", "CodeableConcept",
5674          "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.",
5675          0, 1, productOrService));
5676      children.add(new Property("modifier", "CodeableConcept",
5677          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
5678          java.lang.Integer.MAX_VALUE, modifier));
5679      children.add(new Property("programCode", "CodeableConcept",
5680          "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
5681      children.add(new Property("serviced[x]", "date|Period",
5682          "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced));
5683      children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5684          "Where the product or service was provided.", 0, 1, location));
5685      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
5686          1, quantity));
5687      children.add(new Property("unitPrice", "Money",
5688          "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.",
5689          0, 1, unitPrice));
5690      children.add(new Property("factor", "decimal",
5691          "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.",
5692          0, 1, factor));
5693      children.add(new Property("net", "Money",
5694          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
5695      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
5696          0, java.lang.Integer.MAX_VALUE, udi));
5697      children.add(new Property("bodySite", "CodeableConcept",
5698          "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
5699      children.add(new Property("subSite", "CodeableConcept",
5700          "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE,
5701          subSite));
5702      children.add(new Property("encounter", "Reference(Encounter)",
5703          "A billed item may include goods or services provided in multiple encounters.", 0,
5704          java.lang.Integer.MAX_VALUE, encounter));
5705      children.add(new Property("noteNumber", "positiveInt",
5706          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
5707          java.lang.Integer.MAX_VALUE, noteNumber));
5708      children.add(new Property("adjudication", "",
5709          "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.",
5710          0, java.lang.Integer.MAX_VALUE, adjudication));
5711      children.add(
5712          new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
5713    }
5714
5715    @Override
5716    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5717      switch (_hash) {
5718      case 1349547969:
5719        /* sequence */ return new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0,
5720            1, sequence);
5721      case 1070083823:
5722        /* careTeamSequence */ return new Property("careTeamSequence", "positiveInt",
5723            "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence);
5724      case -909769262:
5725        /* diagnosisSequence */ return new Property("diagnosisSequence", "positiveInt",
5726            "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence);
5727      case -808920140:
5728        /* procedureSequence */ return new Property("procedureSequence", "positiveInt",
5729            "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence);
5730      case -702585587:
5731        /* informationSequence */ return new Property("informationSequence", "positiveInt",
5732            "Exceptions, special conditions and supporting information applicable for this service or product.", 0,
5733            java.lang.Integer.MAX_VALUE, informationSequence);
5734      case 1099842588:
5735        /* revenue */ return new Property("revenue", "CodeableConcept",
5736            "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
5737      case 50511102:
5738        /* category */ return new Property("category", "CodeableConcept",
5739            "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
5740            category);
5741      case 1957227299:
5742        /* productOrService */ return new Property("productOrService", "CodeableConcept",
5743            "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.",
5744            0, 1, productOrService);
5745      case -615513385:
5746        /* modifier */ return new Property("modifier", "CodeableConcept",
5747            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
5748            java.lang.Integer.MAX_VALUE, modifier);
5749      case 1010065041:
5750        /* programCode */ return new Property("programCode", "CodeableConcept",
5751            "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
5752      case -1927922223:
5753        /* serviced[x] */ return new Property("serviced[x]", "date|Period",
5754            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5755      case 1379209295:
5756        /* serviced */ return new Property("serviced[x]", "date|Period",
5757            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5758      case 363246749:
5759        /* servicedDate */ return new Property("serviced[x]", "date|Period",
5760            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5761      case 1534966512:
5762        /* servicedPeriod */ return new Property("serviced[x]", "date|Period",
5763            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5764      case 552316075:
5765        /* location[x] */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5766            "Where the product or service was provided.", 0, 1, location);
5767      case 1901043637:
5768        /* location */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5769            "Where the product or service was provided.", 0, 1, location);
5770      case -1224800468:
5771        /* locationCodeableConcept */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5772            "Where the product or service was provided.", 0, 1, location);
5773      case -1280020865:
5774        /* locationAddress */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5775            "Where the product or service was provided.", 0, 1, location);
5776      case 755866390:
5777        /* locationReference */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5778            "Where the product or service was provided.", 0, 1, location);
5779      case -1285004149:
5780        /* quantity */ return new Property("quantity", "SimpleQuantity",
5781            "The number of repetitions of a service or product.", 0, 1, quantity);
5782      case -486196699:
5783        /* unitPrice */ return new Property("unitPrice", "Money",
5784            "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.",
5785            0, 1, unitPrice);
5786      case -1282148017:
5787        /* factor */ return new Property("factor", "decimal",
5788            "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.",
5789            0, 1, factor);
5790      case 108957:
5791        /* net */ return new Property("net", "Money",
5792            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
5793      case 115642:
5794        /* udi */ return new Property("udi", "Reference(Device)",
5795            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
5796      case 1702620169:
5797        /* bodySite */ return new Property("bodySite", "CodeableConcept",
5798            "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
5799      case -1868566105:
5800        /* subSite */ return new Property("subSite", "CodeableConcept",
5801            "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0,
5802            java.lang.Integer.MAX_VALUE, subSite);
5803      case 1524132147:
5804        /* encounter */ return new Property("encounter", "Reference(Encounter)",
5805            "A billed item may include goods or services provided in multiple encounters.", 0,
5806            java.lang.Integer.MAX_VALUE, encounter);
5807      case -1110033957:
5808        /* noteNumber */ return new Property("noteNumber", "positiveInt",
5809            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
5810            java.lang.Integer.MAX_VALUE, noteNumber);
5811      case -231349275:
5812        /* adjudication */ return new Property("adjudication", "",
5813            "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.",
5814            0, java.lang.Integer.MAX_VALUE, adjudication);
5815      case -1335224239:
5816        /* detail */ return new Property("detail", "", "Second-tier of goods and services.", 0,
5817            java.lang.Integer.MAX_VALUE, detail);
5818      default:
5819        return super.getNamedProperty(_hash, _name, _checkValid);
5820      }
5821
5822    }
5823
5824    @Override
5825    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5826      switch (hash) {
5827      case 1349547969:
5828        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
5829      case 1070083823:
5830        /* careTeamSequence */ return this.careTeamSequence == null ? new Base[0]
5831            : this.careTeamSequence.toArray(new Base[this.careTeamSequence.size()]); // PositiveIntType
5832      case -909769262:
5833        /* diagnosisSequence */ return this.diagnosisSequence == null ? new Base[0]
5834            : this.diagnosisSequence.toArray(new Base[this.diagnosisSequence.size()]); // PositiveIntType
5835      case -808920140:
5836        /* procedureSequence */ return this.procedureSequence == null ? new Base[0]
5837            : this.procedureSequence.toArray(new Base[this.procedureSequence.size()]); // PositiveIntType
5838      case -702585587:
5839        /* informationSequence */ return this.informationSequence == null ? new Base[0]
5840            : this.informationSequence.toArray(new Base[this.informationSequence.size()]); // PositiveIntType
5841      case 1099842588:
5842        /* revenue */ return this.revenue == null ? new Base[0] : new Base[] { this.revenue }; // CodeableConcept
5843      case 50511102:
5844        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
5845      case 1957227299:
5846        /* productOrService */ return this.productOrService == null ? new Base[0]
5847            : new Base[] { this.productOrService }; // CodeableConcept
5848      case -615513385:
5849        /* modifier */ return this.modifier == null ? new Base[0]
5850            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
5851      case 1010065041:
5852        /* programCode */ return this.programCode == null ? new Base[0]
5853            : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
5854      case 1379209295:
5855        /* serviced */ return this.serviced == null ? new Base[0] : new Base[] { this.serviced }; // Type
5856      case 1901043637:
5857        /* location */ return this.location == null ? new Base[0] : new Base[] { this.location }; // Type
5858      case -1285004149:
5859        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
5860      case -486196699:
5861        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
5862      case -1282148017:
5863        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
5864      case 108957:
5865        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
5866      case 115642:
5867        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
5868      case 1702620169:
5869        /* bodySite */ return this.bodySite == null ? new Base[0] : new Base[] { this.bodySite }; // CodeableConcept
5870      case -1868566105:
5871        /* subSite */ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
5872      case 1524132147:
5873        /* encounter */ return this.encounter == null ? new Base[0]
5874            : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
5875      case -1110033957:
5876        /* noteNumber */ return this.noteNumber == null ? new Base[0]
5877            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
5878      case -231349275:
5879        /* adjudication */ return this.adjudication == null ? new Base[0]
5880            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
5881      case -1335224239:
5882        /* detail */ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
5883      default:
5884        return super.getProperty(hash, name, checkValid);
5885      }
5886
5887    }
5888
5889    @Override
5890    public Base setProperty(int hash, String name, Base value) throws FHIRException {
5891      switch (hash) {
5892      case 1349547969: // sequence
5893        this.sequence = castToPositiveInt(value); // PositiveIntType
5894        return value;
5895      case 1070083823: // careTeamSequence
5896        this.getCareTeamSequence().add(castToPositiveInt(value)); // PositiveIntType
5897        return value;
5898      case -909769262: // diagnosisSequence
5899        this.getDiagnosisSequence().add(castToPositiveInt(value)); // PositiveIntType
5900        return value;
5901      case -808920140: // procedureSequence
5902        this.getProcedureSequence().add(castToPositiveInt(value)); // PositiveIntType
5903        return value;
5904      case -702585587: // informationSequence
5905        this.getInformationSequence().add(castToPositiveInt(value)); // PositiveIntType
5906        return value;
5907      case 1099842588: // revenue
5908        this.revenue = castToCodeableConcept(value); // CodeableConcept
5909        return value;
5910      case 50511102: // category
5911        this.category = castToCodeableConcept(value); // CodeableConcept
5912        return value;
5913      case 1957227299: // productOrService
5914        this.productOrService = castToCodeableConcept(value); // CodeableConcept
5915        return value;
5916      case -615513385: // modifier
5917        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
5918        return value;
5919      case 1010065041: // programCode
5920        this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
5921        return value;
5922      case 1379209295: // serviced
5923        this.serviced = castToType(value); // Type
5924        return value;
5925      case 1901043637: // location
5926        this.location = castToType(value); // Type
5927        return value;
5928      case -1285004149: // quantity
5929        this.quantity = castToQuantity(value); // Quantity
5930        return value;
5931      case -486196699: // unitPrice
5932        this.unitPrice = castToMoney(value); // Money
5933        return value;
5934      case -1282148017: // factor
5935        this.factor = castToDecimal(value); // DecimalType
5936        return value;
5937      case 108957: // net
5938        this.net = castToMoney(value); // Money
5939        return value;
5940      case 115642: // udi
5941        this.getUdi().add(castToReference(value)); // Reference
5942        return value;
5943      case 1702620169: // bodySite
5944        this.bodySite = castToCodeableConcept(value); // CodeableConcept
5945        return value;
5946      case -1868566105: // subSite
5947        this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
5948        return value;
5949      case 1524132147: // encounter
5950        this.getEncounter().add(castToReference(value)); // Reference
5951        return value;
5952      case -1110033957: // noteNumber
5953        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
5954        return value;
5955      case -231349275: // adjudication
5956        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
5957        return value;
5958      case -1335224239: // detail
5959        this.getDetail().add((DetailComponent) value); // DetailComponent
5960        return value;
5961      default:
5962        return super.setProperty(hash, name, value);
5963      }
5964
5965    }
5966
5967    @Override
5968    public Base setProperty(String name, Base value) throws FHIRException {
5969      if (name.equals("sequence")) {
5970        this.sequence = castToPositiveInt(value); // PositiveIntType
5971      } else if (name.equals("careTeamSequence")) {
5972        this.getCareTeamSequence().add(castToPositiveInt(value));
5973      } else if (name.equals("diagnosisSequence")) {
5974        this.getDiagnosisSequence().add(castToPositiveInt(value));
5975      } else if (name.equals("procedureSequence")) {
5976        this.getProcedureSequence().add(castToPositiveInt(value));
5977      } else if (name.equals("informationSequence")) {
5978        this.getInformationSequence().add(castToPositiveInt(value));
5979      } else if (name.equals("revenue")) {
5980        this.revenue = castToCodeableConcept(value); // CodeableConcept
5981      } else if (name.equals("category")) {
5982        this.category = castToCodeableConcept(value); // CodeableConcept
5983      } else if (name.equals("productOrService")) {
5984        this.productOrService = castToCodeableConcept(value); // CodeableConcept
5985      } else if (name.equals("modifier")) {
5986        this.getModifier().add(castToCodeableConcept(value));
5987      } else if (name.equals("programCode")) {
5988        this.getProgramCode().add(castToCodeableConcept(value));
5989      } else if (name.equals("serviced[x]")) {
5990        this.serviced = castToType(value); // Type
5991      } else if (name.equals("location[x]")) {
5992        this.location = castToType(value); // Type
5993      } else if (name.equals("quantity")) {
5994        this.quantity = castToQuantity(value); // Quantity
5995      } else if (name.equals("unitPrice")) {
5996        this.unitPrice = castToMoney(value); // Money
5997      } else if (name.equals("factor")) {
5998        this.factor = castToDecimal(value); // DecimalType
5999      } else if (name.equals("net")) {
6000        this.net = castToMoney(value); // Money
6001      } else if (name.equals("udi")) {
6002        this.getUdi().add(castToReference(value));
6003      } else if (name.equals("bodySite")) {
6004        this.bodySite = castToCodeableConcept(value); // CodeableConcept
6005      } else if (name.equals("subSite")) {
6006        this.getSubSite().add(castToCodeableConcept(value));
6007      } else if (name.equals("encounter")) {
6008        this.getEncounter().add(castToReference(value));
6009      } else if (name.equals("noteNumber")) {
6010        this.getNoteNumber().add(castToPositiveInt(value));
6011      } else if (name.equals("adjudication")) {
6012        this.getAdjudication().add((AdjudicationComponent) value);
6013      } else if (name.equals("detail")) {
6014        this.getDetail().add((DetailComponent) value);
6015      } else
6016        return super.setProperty(name, value);
6017      return value;
6018    }
6019
6020  @Override
6021  public void removeChild(String name, Base value) throws FHIRException {
6022      if (name.equals("sequence")) {
6023        this.sequence = null;
6024      } else if (name.equals("careTeamSequence")) {
6025        this.getCareTeamSequence().remove(castToPositiveInt(value));
6026      } else if (name.equals("diagnosisSequence")) {
6027        this.getDiagnosisSequence().remove(castToPositiveInt(value));
6028      } else if (name.equals("procedureSequence")) {
6029        this.getProcedureSequence().remove(castToPositiveInt(value));
6030      } else if (name.equals("informationSequence")) {
6031        this.getInformationSequence().remove(castToPositiveInt(value));
6032      } else if (name.equals("revenue")) {
6033        this.revenue = null;
6034      } else if (name.equals("category")) {
6035        this.category = null;
6036      } else if (name.equals("productOrService")) {
6037        this.productOrService = null;
6038      } else if (name.equals("modifier")) {
6039        this.getModifier().remove(castToCodeableConcept(value));
6040      } else if (name.equals("programCode")) {
6041        this.getProgramCode().remove(castToCodeableConcept(value));
6042      } else if (name.equals("serviced[x]")) {
6043        this.serviced = null;
6044      } else if (name.equals("location[x]")) {
6045        this.location = null;
6046      } else if (name.equals("quantity")) {
6047        this.quantity = null;
6048      } else if (name.equals("unitPrice")) {
6049        this.unitPrice = null;
6050      } else if (name.equals("factor")) {
6051        this.factor = null;
6052      } else if (name.equals("net")) {
6053        this.net = null;
6054      } else if (name.equals("udi")) {
6055        this.getUdi().remove(castToReference(value));
6056      } else if (name.equals("bodySite")) {
6057        this.bodySite = null;
6058      } else if (name.equals("subSite")) {
6059        this.getSubSite().remove(castToCodeableConcept(value));
6060      } else if (name.equals("encounter")) {
6061        this.getEncounter().remove(castToReference(value));
6062      } else if (name.equals("noteNumber")) {
6063        this.getNoteNumber().remove(castToPositiveInt(value));
6064      } else if (name.equals("adjudication")) {
6065        this.getAdjudication().remove((AdjudicationComponent) value);
6066      } else if (name.equals("detail")) {
6067        this.getDetail().remove((DetailComponent) value);
6068      } else
6069        super.removeChild(name, value);
6070      
6071    }
6072
6073    @Override
6074    public Base makeProperty(int hash, String name) throws FHIRException {
6075      switch (hash) {
6076      case 1349547969:
6077        return getSequenceElement();
6078      case 1070083823:
6079        return addCareTeamSequenceElement();
6080      case -909769262:
6081        return addDiagnosisSequenceElement();
6082      case -808920140:
6083        return addProcedureSequenceElement();
6084      case -702585587:
6085        return addInformationSequenceElement();
6086      case 1099842588:
6087        return getRevenue();
6088      case 50511102:
6089        return getCategory();
6090      case 1957227299:
6091        return getProductOrService();
6092      case -615513385:
6093        return addModifier();
6094      case 1010065041:
6095        return addProgramCode();
6096      case -1927922223:
6097        return getServiced();
6098      case 1379209295:
6099        return getServiced();
6100      case 552316075:
6101        return getLocation();
6102      case 1901043637:
6103        return getLocation();
6104      case -1285004149:
6105        return getQuantity();
6106      case -486196699:
6107        return getUnitPrice();
6108      case -1282148017:
6109        return getFactorElement();
6110      case 108957:
6111        return getNet();
6112      case 115642:
6113        return addUdi();
6114      case 1702620169:
6115        return getBodySite();
6116      case -1868566105:
6117        return addSubSite();
6118      case 1524132147:
6119        return addEncounter();
6120      case -1110033957:
6121        return addNoteNumberElement();
6122      case -231349275:
6123        return addAdjudication();
6124      case -1335224239:
6125        return addDetail();
6126      default:
6127        return super.makeProperty(hash, name);
6128      }
6129
6130    }
6131
6132    @Override
6133    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6134      switch (hash) {
6135      case 1349547969:
6136        /* sequence */ return new String[] { "positiveInt" };
6137      case 1070083823:
6138        /* careTeamSequence */ return new String[] { "positiveInt" };
6139      case -909769262:
6140        /* diagnosisSequence */ return new String[] { "positiveInt" };
6141      case -808920140:
6142        /* procedureSequence */ return new String[] { "positiveInt" };
6143      case -702585587:
6144        /* informationSequence */ return new String[] { "positiveInt" };
6145      case 1099842588:
6146        /* revenue */ return new String[] { "CodeableConcept" };
6147      case 50511102:
6148        /* category */ return new String[] { "CodeableConcept" };
6149      case 1957227299:
6150        /* productOrService */ return new String[] { "CodeableConcept" };
6151      case -615513385:
6152        /* modifier */ return new String[] { "CodeableConcept" };
6153      case 1010065041:
6154        /* programCode */ return new String[] { "CodeableConcept" };
6155      case 1379209295:
6156        /* serviced */ return new String[] { "date", "Period" };
6157      case 1901043637:
6158        /* location */ return new String[] { "CodeableConcept", "Address", "Reference" };
6159      case -1285004149:
6160        /* quantity */ return new String[] { "SimpleQuantity" };
6161      case -486196699:
6162        /* unitPrice */ return new String[] { "Money" };
6163      case -1282148017:
6164        /* factor */ return new String[] { "decimal" };
6165      case 108957:
6166        /* net */ return new String[] { "Money" };
6167      case 115642:
6168        /* udi */ return new String[] { "Reference" };
6169      case 1702620169:
6170        /* bodySite */ return new String[] { "CodeableConcept" };
6171      case -1868566105:
6172        /* subSite */ return new String[] { "CodeableConcept" };
6173      case 1524132147:
6174        /* encounter */ return new String[] { "Reference" };
6175      case -1110033957:
6176        /* noteNumber */ return new String[] { "positiveInt" };
6177      case -231349275:
6178        /* adjudication */ return new String[] {};
6179      case -1335224239:
6180        /* detail */ return new String[] {};
6181      default:
6182        return super.getTypesForProperty(hash, name);
6183      }
6184
6185    }
6186
6187    @Override
6188    public Base addChild(String name) throws FHIRException {
6189      if (name.equals("sequence")) {
6190        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
6191      } else if (name.equals("careTeamSequence")) {
6192        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.careTeamSequence");
6193      } else if (name.equals("diagnosisSequence")) {
6194        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.diagnosisSequence");
6195      } else if (name.equals("procedureSequence")) {
6196        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.procedureSequence");
6197      } else if (name.equals("informationSequence")) {
6198        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.informationSequence");
6199      } else if (name.equals("revenue")) {
6200        this.revenue = new CodeableConcept();
6201        return this.revenue;
6202      } else if (name.equals("category")) {
6203        this.category = new CodeableConcept();
6204        return this.category;
6205      } else if (name.equals("productOrService")) {
6206        this.productOrService = new CodeableConcept();
6207        return this.productOrService;
6208      } else if (name.equals("modifier")) {
6209        return addModifier();
6210      } else if (name.equals("programCode")) {
6211        return addProgramCode();
6212      } else if (name.equals("servicedDate")) {
6213        this.serviced = new DateType();
6214        return this.serviced;
6215      } else if (name.equals("servicedPeriod")) {
6216        this.serviced = new Period();
6217        return this.serviced;
6218      } else if (name.equals("locationCodeableConcept")) {
6219        this.location = new CodeableConcept();
6220        return this.location;
6221      } else if (name.equals("locationAddress")) {
6222        this.location = new Address();
6223        return this.location;
6224      } else if (name.equals("locationReference")) {
6225        this.location = new Reference();
6226        return this.location;
6227      } else if (name.equals("quantity")) {
6228        this.quantity = new Quantity();
6229        return this.quantity;
6230      } else if (name.equals("unitPrice")) {
6231        this.unitPrice = new Money();
6232        return this.unitPrice;
6233      } else if (name.equals("factor")) {
6234        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
6235      } else if (name.equals("net")) {
6236        this.net = new Money();
6237        return this.net;
6238      } else if (name.equals("udi")) {
6239        return addUdi();
6240      } else if (name.equals("bodySite")) {
6241        this.bodySite = new CodeableConcept();
6242        return this.bodySite;
6243      } else if (name.equals("subSite")) {
6244        return addSubSite();
6245      } else if (name.equals("encounter")) {
6246        return addEncounter();
6247      } else if (name.equals("noteNumber")) {
6248        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
6249      } else if (name.equals("adjudication")) {
6250        return addAdjudication();
6251      } else if (name.equals("detail")) {
6252        return addDetail();
6253      } else
6254        return super.addChild(name);
6255    }
6256
6257    public ItemComponent copy() {
6258      ItemComponent dst = new ItemComponent();
6259      copyValues(dst);
6260      return dst;
6261    }
6262
6263    public void copyValues(ItemComponent dst) {
6264      super.copyValues(dst);
6265      dst.sequence = sequence == null ? null : sequence.copy();
6266      if (careTeamSequence != null) {
6267        dst.careTeamSequence = new ArrayList<PositiveIntType>();
6268        for (PositiveIntType i : careTeamSequence)
6269          dst.careTeamSequence.add(i.copy());
6270      }
6271      ;
6272      if (diagnosisSequence != null) {
6273        dst.diagnosisSequence = new ArrayList<PositiveIntType>();
6274        for (PositiveIntType i : diagnosisSequence)
6275          dst.diagnosisSequence.add(i.copy());
6276      }
6277      ;
6278      if (procedureSequence != null) {
6279        dst.procedureSequence = new ArrayList<PositiveIntType>();
6280        for (PositiveIntType i : procedureSequence)
6281          dst.procedureSequence.add(i.copy());
6282      }
6283      ;
6284      if (informationSequence != null) {
6285        dst.informationSequence = new ArrayList<PositiveIntType>();
6286        for (PositiveIntType i : informationSequence)
6287          dst.informationSequence.add(i.copy());
6288      }
6289      ;
6290      dst.revenue = revenue == null ? null : revenue.copy();
6291      dst.category = category == null ? null : category.copy();
6292      dst.productOrService = productOrService == null ? null : productOrService.copy();
6293      if (modifier != null) {
6294        dst.modifier = new ArrayList<CodeableConcept>();
6295        for (CodeableConcept i : modifier)
6296          dst.modifier.add(i.copy());
6297      }
6298      ;
6299      if (programCode != null) {
6300        dst.programCode = new ArrayList<CodeableConcept>();
6301        for (CodeableConcept i : programCode)
6302          dst.programCode.add(i.copy());
6303      }
6304      ;
6305      dst.serviced = serviced == null ? null : serviced.copy();
6306      dst.location = location == null ? null : location.copy();
6307      dst.quantity = quantity == null ? null : quantity.copy();
6308      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6309      dst.factor = factor == null ? null : factor.copy();
6310      dst.net = net == null ? null : net.copy();
6311      if (udi != null) {
6312        dst.udi = new ArrayList<Reference>();
6313        for (Reference i : udi)
6314          dst.udi.add(i.copy());
6315      }
6316      ;
6317      dst.bodySite = bodySite == null ? null : bodySite.copy();
6318      if (subSite != null) {
6319        dst.subSite = new ArrayList<CodeableConcept>();
6320        for (CodeableConcept i : subSite)
6321          dst.subSite.add(i.copy());
6322      }
6323      ;
6324      if (encounter != null) {
6325        dst.encounter = new ArrayList<Reference>();
6326        for (Reference i : encounter)
6327          dst.encounter.add(i.copy());
6328      }
6329      ;
6330      if (noteNumber != null) {
6331        dst.noteNumber = new ArrayList<PositiveIntType>();
6332        for (PositiveIntType i : noteNumber)
6333          dst.noteNumber.add(i.copy());
6334      }
6335      ;
6336      if (adjudication != null) {
6337        dst.adjudication = new ArrayList<AdjudicationComponent>();
6338        for (AdjudicationComponent i : adjudication)
6339          dst.adjudication.add(i.copy());
6340      }
6341      ;
6342      if (detail != null) {
6343        dst.detail = new ArrayList<DetailComponent>();
6344        for (DetailComponent i : detail)
6345          dst.detail.add(i.copy());
6346      }
6347      ;
6348    }
6349
6350    @Override
6351    public boolean equalsDeep(Base other_) {
6352      if (!super.equalsDeep(other_))
6353        return false;
6354      if (!(other_ instanceof ItemComponent))
6355        return false;
6356      ItemComponent o = (ItemComponent) other_;
6357      return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamSequence, o.careTeamSequence, true)
6358          && compareDeep(diagnosisSequence, o.diagnosisSequence, true)
6359          && compareDeep(procedureSequence, o.procedureSequence, true)
6360          && compareDeep(informationSequence, o.informationSequence, true) && compareDeep(revenue, o.revenue, true)
6361          && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
6362          && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
6363          && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
6364          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
6365          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
6366          && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true)
6367          && compareDeep(encounter, o.encounter, true) && compareDeep(noteNumber, o.noteNumber, true)
6368          && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true);
6369    }
6370
6371    @Override
6372    public boolean equalsShallow(Base other_) {
6373      if (!super.equalsShallow(other_))
6374        return false;
6375      if (!(other_ instanceof ItemComponent))
6376        return false;
6377      ItemComponent o = (ItemComponent) other_;
6378      return compareValues(sequence, o.sequence, true) && compareValues(careTeamSequence, o.careTeamSequence, true)
6379          && compareValues(diagnosisSequence, o.diagnosisSequence, true)
6380          && compareValues(procedureSequence, o.procedureSequence, true)
6381          && compareValues(informationSequence, o.informationSequence, true) && compareValues(factor, o.factor, true)
6382          && compareValues(noteNumber, o.noteNumber, true);
6383    }
6384
6385    public boolean isEmpty() {
6386      return super.isEmpty()
6387          && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamSequence, diagnosisSequence, procedureSequence,
6388              informationSequence, revenue, category, productOrService, modifier, programCode, serviced, location,
6389              quantity, unitPrice, factor, net, udi, bodySite, subSite, encounter, noteNumber, adjudication, detail);
6390    }
6391
6392    public String fhirType() {
6393      return "ExplanationOfBenefit.item";
6394
6395    }
6396
6397  }
6398
6399  @Block()
6400  public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
6401    /**
6402     * A code to indicate the information type of this adjudication record.
6403     * Information types may include: the value submitted, maximum values or
6404     * percentages allowed or payable under the plan, amounts that the patient is
6405     * responsible for in-aggregate or pertaining to this item, amounts paid by
6406     * other coverages, and the benefit payable for this item.
6407     */
6408    @Child(name = "category", type = {
6409        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
6410    @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.")
6411    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/adjudication")
6412    protected CodeableConcept category;
6413
6414    /**
6415     * A code supporting the understanding of the adjudication result and explaining
6416     * variance from expected amount.
6417     */
6418    @Child(name = "reason", type = {
6419        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
6420    @Description(shortDefinition = "Explanation of adjudication outcome", formalDefinition = "A code supporting the understanding of the adjudication result and explaining variance from expected amount.")
6421    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/adjudication-reason")
6422    protected CodeableConcept reason;
6423
6424    /**
6425     * Monetary amount associated with the category.
6426     */
6427    @Child(name = "amount", type = { Money.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
6428    @Description(shortDefinition = "Monetary amount", formalDefinition = "Monetary amount associated with the category.")
6429    protected Money amount;
6430
6431    /**
6432     * A non-monetary value associated with the category. Mutually exclusive to the
6433     * amount element above.
6434     */
6435    @Child(name = "value", type = { DecimalType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
6436    @Description(shortDefinition = "Non-monitary value", formalDefinition = "A non-monetary value associated with the category. Mutually exclusive to the amount element above.")
6437    protected DecimalType value;
6438
6439    private static final long serialVersionUID = 1559898786L;
6440
6441    /**
6442     * Constructor
6443     */
6444    public AdjudicationComponent() {
6445      super();
6446    }
6447
6448    /**
6449     * Constructor
6450     */
6451    public AdjudicationComponent(CodeableConcept category) {
6452      super();
6453      this.category = category;
6454    }
6455
6456    /**
6457     * @return {@link #category} (A code to indicate the information type of this
6458     *         adjudication record. Information types may include: the value
6459     *         submitted, maximum values or percentages allowed or payable under the
6460     *         plan, amounts that the patient is responsible for in-aggregate or
6461     *         pertaining to this item, amounts paid by other coverages, and the
6462     *         benefit payable for this item.)
6463     */
6464    public CodeableConcept getCategory() {
6465      if (this.category == null)
6466        if (Configuration.errorOnAutoCreate())
6467          throw new Error("Attempt to auto-create AdjudicationComponent.category");
6468        else if (Configuration.doAutoCreate())
6469          this.category = new CodeableConcept(); // cc
6470      return this.category;
6471    }
6472
6473    public boolean hasCategory() {
6474      return this.category != null && !this.category.isEmpty();
6475    }
6476
6477    /**
6478     * @param value {@link #category} (A code to indicate the information type of
6479     *              this adjudication record. Information types may include: the
6480     *              value submitted, maximum values or percentages allowed or
6481     *              payable under the plan, amounts that the patient is responsible
6482     *              for in-aggregate or pertaining to this item, amounts paid by
6483     *              other coverages, and the benefit payable for this item.)
6484     */
6485    public AdjudicationComponent setCategory(CodeableConcept value) {
6486      this.category = value;
6487      return this;
6488    }
6489
6490    /**
6491     * @return {@link #reason} (A code supporting the understanding of the
6492     *         adjudication result and explaining variance from expected amount.)
6493     */
6494    public CodeableConcept getReason() {
6495      if (this.reason == null)
6496        if (Configuration.errorOnAutoCreate())
6497          throw new Error("Attempt to auto-create AdjudicationComponent.reason");
6498        else if (Configuration.doAutoCreate())
6499          this.reason = new CodeableConcept(); // cc
6500      return this.reason;
6501    }
6502
6503    public boolean hasReason() {
6504      return this.reason != null && !this.reason.isEmpty();
6505    }
6506
6507    /**
6508     * @param value {@link #reason} (A code supporting the understanding of the
6509     *              adjudication result and explaining variance from expected
6510     *              amount.)
6511     */
6512    public AdjudicationComponent setReason(CodeableConcept value) {
6513      this.reason = value;
6514      return this;
6515    }
6516
6517    /**
6518     * @return {@link #amount} (Monetary amount associated with the category.)
6519     */
6520    public Money getAmount() {
6521      if (this.amount == null)
6522        if (Configuration.errorOnAutoCreate())
6523          throw new Error("Attempt to auto-create AdjudicationComponent.amount");
6524        else if (Configuration.doAutoCreate())
6525          this.amount = new Money(); // cc
6526      return this.amount;
6527    }
6528
6529    public boolean hasAmount() {
6530      return this.amount != null && !this.amount.isEmpty();
6531    }
6532
6533    /**
6534     * @param value {@link #amount} (Monetary amount associated with the category.)
6535     */
6536    public AdjudicationComponent setAmount(Money value) {
6537      this.amount = value;
6538      return this;
6539    }
6540
6541    /**
6542     * @return {@link #value} (A non-monetary value associated with the category.
6543     *         Mutually exclusive to the amount element above.). This is the
6544     *         underlying object with id, value and extensions. The accessor
6545     *         "getValue" gives direct access to the value
6546     */
6547    public DecimalType getValueElement() {
6548      if (this.value == null)
6549        if (Configuration.errorOnAutoCreate())
6550          throw new Error("Attempt to auto-create AdjudicationComponent.value");
6551        else if (Configuration.doAutoCreate())
6552          this.value = new DecimalType(); // bb
6553      return this.value;
6554    }
6555
6556    public boolean hasValueElement() {
6557      return this.value != null && !this.value.isEmpty();
6558    }
6559
6560    public boolean hasValue() {
6561      return this.value != null && !this.value.isEmpty();
6562    }
6563
6564    /**
6565     * @param value {@link #value} (A non-monetary value associated with the
6566     *              category. Mutually exclusive to the amount element above.). This
6567     *              is the underlying object with id, value and extensions. The
6568     *              accessor "getValue" gives direct access to the value
6569     */
6570    public AdjudicationComponent setValueElement(DecimalType value) {
6571      this.value = value;
6572      return this;
6573    }
6574
6575    /**
6576     * @return A non-monetary value associated with the category. Mutually exclusive
6577     *         to the amount element above.
6578     */
6579    public BigDecimal getValue() {
6580      return this.value == null ? null : this.value.getValue();
6581    }
6582
6583    /**
6584     * @param value A non-monetary value associated with the category. Mutually
6585     *              exclusive to the amount element above.
6586     */
6587    public AdjudicationComponent setValue(BigDecimal value) {
6588      if (value == null)
6589        this.value = null;
6590      else {
6591        if (this.value == null)
6592          this.value = new DecimalType();
6593        this.value.setValue(value);
6594      }
6595      return this;
6596    }
6597
6598    /**
6599     * @param value A non-monetary value associated with the category. Mutually
6600     *              exclusive to the amount element above.
6601     */
6602    public AdjudicationComponent setValue(long value) {
6603      this.value = new DecimalType();
6604      this.value.setValue(value);
6605      return this;
6606    }
6607
6608    /**
6609     * @param value A non-monetary value associated with the category. Mutually
6610     *              exclusive to the amount element above.
6611     */
6612    public AdjudicationComponent setValue(double value) {
6613      this.value = new DecimalType();
6614      this.value.setValue(value);
6615      return this;
6616    }
6617
6618    protected void listChildren(List<Property> children) {
6619      super.listChildren(children);
6620      children.add(new Property("category", "CodeableConcept",
6621          "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.",
6622          0, 1, category));
6623      children.add(new Property("reason", "CodeableConcept",
6624          "A code supporting the understanding of the adjudication result and explaining variance from expected amount.",
6625          0, 1, reason));
6626      children.add(new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount));
6627      children.add(new Property("value", "decimal",
6628          "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1,
6629          value));
6630    }
6631
6632    @Override
6633    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6634      switch (_hash) {
6635      case 50511102:
6636        /* category */ return new Property("category", "CodeableConcept",
6637            "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.",
6638            0, 1, category);
6639      case -934964668:
6640        /* reason */ return new Property("reason", "CodeableConcept",
6641            "A code supporting the understanding of the adjudication result and explaining variance from expected amount.",
6642            0, 1, reason);
6643      case -1413853096:
6644        /* amount */ return new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1,
6645            amount);
6646      case 111972721:
6647        /* value */ return new Property("value", "decimal",
6648            "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1,
6649            value);
6650      default:
6651        return super.getNamedProperty(_hash, _name, _checkValid);
6652      }
6653
6654    }
6655
6656    @Override
6657    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6658      switch (hash) {
6659      case 50511102:
6660        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
6661      case -934964668:
6662        /* reason */ return this.reason == null ? new Base[0] : new Base[] { this.reason }; // CodeableConcept
6663      case -1413853096:
6664        /* amount */ return this.amount == null ? new Base[0] : new Base[] { this.amount }; // Money
6665      case 111972721:
6666        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // DecimalType
6667      default:
6668        return super.getProperty(hash, name, checkValid);
6669      }
6670
6671    }
6672
6673    @Override
6674    public Base setProperty(int hash, String name, Base value) throws FHIRException {
6675      switch (hash) {
6676      case 50511102: // category
6677        this.category = castToCodeableConcept(value); // CodeableConcept
6678        return value;
6679      case -934964668: // reason
6680        this.reason = castToCodeableConcept(value); // CodeableConcept
6681        return value;
6682      case -1413853096: // amount
6683        this.amount = castToMoney(value); // Money
6684        return value;
6685      case 111972721: // value
6686        this.value = castToDecimal(value); // DecimalType
6687        return value;
6688      default:
6689        return super.setProperty(hash, name, value);
6690      }
6691
6692    }
6693
6694    @Override
6695    public Base setProperty(String name, Base value) throws FHIRException {
6696      if (name.equals("category")) {
6697        this.category = castToCodeableConcept(value); // CodeableConcept
6698      } else if (name.equals("reason")) {
6699        this.reason = castToCodeableConcept(value); // CodeableConcept
6700      } else if (name.equals("amount")) {
6701        this.amount = castToMoney(value); // Money
6702      } else if (name.equals("value")) {
6703        this.value = castToDecimal(value); // DecimalType
6704      } else
6705        return super.setProperty(name, value);
6706      return value;
6707    }
6708
6709  @Override
6710  public void removeChild(String name, Base value) throws FHIRException {
6711      if (name.equals("category")) {
6712        this.category = null;
6713      } else if (name.equals("reason")) {
6714        this.reason = null;
6715      } else if (name.equals("amount")) {
6716        this.amount = null;
6717      } else if (name.equals("value")) {
6718        this.value = null;
6719      } else
6720        super.removeChild(name, value);
6721      
6722    }
6723
6724    @Override
6725    public Base makeProperty(int hash, String name) throws FHIRException {
6726      switch (hash) {
6727      case 50511102:
6728        return getCategory();
6729      case -934964668:
6730        return getReason();
6731      case -1413853096:
6732        return getAmount();
6733      case 111972721:
6734        return getValueElement();
6735      default:
6736        return super.makeProperty(hash, name);
6737      }
6738
6739    }
6740
6741    @Override
6742    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6743      switch (hash) {
6744      case 50511102:
6745        /* category */ return new String[] { "CodeableConcept" };
6746      case -934964668:
6747        /* reason */ return new String[] { "CodeableConcept" };
6748      case -1413853096:
6749        /* amount */ return new String[] { "Money" };
6750      case 111972721:
6751        /* value */ return new String[] { "decimal" };
6752      default:
6753        return super.getTypesForProperty(hash, name);
6754      }
6755
6756    }
6757
6758    @Override
6759    public Base addChild(String name) throws FHIRException {
6760      if (name.equals("category")) {
6761        this.category = new CodeableConcept();
6762        return this.category;
6763      } else if (name.equals("reason")) {
6764        this.reason = new CodeableConcept();
6765        return this.reason;
6766      } else if (name.equals("amount")) {
6767        this.amount = new Money();
6768        return this.amount;
6769      } else if (name.equals("value")) {
6770        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.value");
6771      } else
6772        return super.addChild(name);
6773    }
6774
6775    public AdjudicationComponent copy() {
6776      AdjudicationComponent dst = new AdjudicationComponent();
6777      copyValues(dst);
6778      return dst;
6779    }
6780
6781    public void copyValues(AdjudicationComponent dst) {
6782      super.copyValues(dst);
6783      dst.category = category == null ? null : category.copy();
6784      dst.reason = reason == null ? null : reason.copy();
6785      dst.amount = amount == null ? null : amount.copy();
6786      dst.value = value == null ? null : value.copy();
6787    }
6788
6789    @Override
6790    public boolean equalsDeep(Base other_) {
6791      if (!super.equalsDeep(other_))
6792        return false;
6793      if (!(other_ instanceof AdjudicationComponent))
6794        return false;
6795      AdjudicationComponent o = (AdjudicationComponent) other_;
6796      return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true)
6797          && compareDeep(amount, o.amount, true) && compareDeep(value, o.value, true);
6798    }
6799
6800    @Override
6801    public boolean equalsShallow(Base other_) {
6802      if (!super.equalsShallow(other_))
6803        return false;
6804      if (!(other_ instanceof AdjudicationComponent))
6805        return false;
6806      AdjudicationComponent o = (AdjudicationComponent) other_;
6807      return compareValues(value, o.value, true);
6808    }
6809
6810    public boolean isEmpty() {
6811      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount, value);
6812    }
6813
6814    public String fhirType() {
6815      return "ExplanationOfBenefit.item.adjudication";
6816
6817    }
6818
6819  }
6820
6821  @Block()
6822  public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
6823    /**
6824     * A claim detail line. Either a simple (a product or service) or a 'group' of
6825     * sub-details which are simple items.
6826     */
6827    @Child(name = "sequence", type = {
6828        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
6829    @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.")
6830    protected PositiveIntType sequence;
6831
6832    /**
6833     * The type of revenue or cost center providing the product and/or service.
6834     */
6835    @Child(name = "revenue", type = {
6836        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
6837    @Description(shortDefinition = "Revenue or cost center code", formalDefinition = "The type of revenue or cost center providing the product and/or service.")
6838    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-revenue-center")
6839    protected CodeableConcept revenue;
6840
6841    /**
6842     * Code to identify the general type of benefits under which products and
6843     * services are provided.
6844     */
6845    @Child(name = "category", type = {
6846        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
6847    @Description(shortDefinition = "Benefit classification", formalDefinition = "Code to identify the general type of benefits under which products and services are provided.")
6848    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-benefitcategory")
6849    protected CodeableConcept category;
6850
6851    /**
6852     * When the value is a group code then this item collects a set of related claim
6853     * details, otherwise this contains the product, service, drug or other billing
6854     * code for the item.
6855     */
6856    @Child(name = "productOrService", type = {
6857        CodeableConcept.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
6858    @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.")
6859    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
6860    protected CodeableConcept productOrService;
6861
6862    /**
6863     * Item typification or modifiers codes to convey additional context for the
6864     * product or service.
6865     */
6866    @Child(name = "modifier", type = {
6867        CodeableConcept.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6868    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
6869    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
6870    protected List<CodeableConcept> modifier;
6871
6872    /**
6873     * Identifies the program under which this may be recovered.
6874     */
6875    @Child(name = "programCode", type = {
6876        CodeableConcept.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6877    @Description(shortDefinition = "Program the product or service is provided under", formalDefinition = "Identifies the program under which this may be recovered.")
6878    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-program-code")
6879    protected List<CodeableConcept> programCode;
6880
6881    /**
6882     * The number of repetitions of a service or product.
6883     */
6884    @Child(name = "quantity", type = { Quantity.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
6885    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
6886    protected Quantity quantity;
6887
6888    /**
6889     * If the item is not a group then this is the fee for the product or service,
6890     * otherwise this is the total of the fees for the details of the group.
6891     */
6892    @Child(name = "unitPrice", type = { Money.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
6893    @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.")
6894    protected Money unitPrice;
6895
6896    /**
6897     * A real number that represents a multiplier used in determining the overall
6898     * value of services delivered and/or goods received. The concept of a Factor
6899     * allows for a discount or surcharge multiplier to be applied to a monetary
6900     * amount.
6901     */
6902    @Child(name = "factor", type = {
6903        DecimalType.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
6904    @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.")
6905    protected DecimalType factor;
6906
6907    /**
6908     * The quantity times the unit price for an additional service or product or
6909     * charge.
6910     */
6911    @Child(name = "net", type = { Money.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
6912    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
6913    protected Money net;
6914
6915    /**
6916     * Unique Device Identifiers associated with this line item.
6917     */
6918    @Child(name = "udi", type = {
6919        Device.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6920    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
6921    protected List<Reference> udi;
6922    /**
6923     * The actual objects that are the target of the reference (Unique Device
6924     * Identifiers associated with this line item.)
6925     */
6926    protected List<Device> udiTarget;
6927
6928    /**
6929     * The numbers associated with notes below which apply to the adjudication of
6930     * this item.
6931     */
6932    @Child(name = "noteNumber", type = {
6933        PositiveIntType.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6934    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
6935    protected List<PositiveIntType> noteNumber;
6936
6937    /**
6938     * The adjudication results.
6939     */
6940    @Child(name = "adjudication", type = {
6941        AdjudicationComponent.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6942    @Description(shortDefinition = "Detail level adjudication details", formalDefinition = "The adjudication results.")
6943    protected List<AdjudicationComponent> adjudication;
6944
6945    /**
6946     * Third-tier of goods and services.
6947     */
6948    @Child(name = "subDetail", type = {}, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6949    @Description(shortDefinition = "Additional items", formalDefinition = "Third-tier of goods and services.")
6950    protected List<SubDetailComponent> subDetail;
6951
6952    private static final long serialVersionUID = 225639798L;
6953
6954    /**
6955     * Constructor
6956     */
6957    public DetailComponent() {
6958      super();
6959    }
6960
6961    /**
6962     * Constructor
6963     */
6964    public DetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
6965      super();
6966      this.sequence = sequence;
6967      this.productOrService = productOrService;
6968    }
6969
6970    /**
6971     * @return {@link #sequence} (A claim detail line. Either a simple (a product or
6972     *         service) or a 'group' of sub-details which are simple items.). This
6973     *         is the underlying object with id, value and extensions. The accessor
6974     *         "getSequence" gives direct access to the value
6975     */
6976    public PositiveIntType getSequenceElement() {
6977      if (this.sequence == null)
6978        if (Configuration.errorOnAutoCreate())
6979          throw new Error("Attempt to auto-create DetailComponent.sequence");
6980        else if (Configuration.doAutoCreate())
6981          this.sequence = new PositiveIntType(); // bb
6982      return this.sequence;
6983    }
6984
6985    public boolean hasSequenceElement() {
6986      return this.sequence != null && !this.sequence.isEmpty();
6987    }
6988
6989    public boolean hasSequence() {
6990      return this.sequence != null && !this.sequence.isEmpty();
6991    }
6992
6993    /**
6994     * @param value {@link #sequence} (A claim detail line. Either a simple (a
6995     *              product or service) or a 'group' of sub-details which are simple
6996     *              items.). This is the underlying object with id, value and
6997     *              extensions. The accessor "getSequence" gives direct access to
6998     *              the value
6999     */
7000    public DetailComponent setSequenceElement(PositiveIntType value) {
7001      this.sequence = value;
7002      return this;
7003    }
7004
7005    /**
7006     * @return A claim detail line. Either a simple (a product or service) or a
7007     *         'group' of sub-details which are simple items.
7008     */
7009    public int getSequence() {
7010      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
7011    }
7012
7013    /**
7014     * @param value A claim detail line. Either a simple (a product or service) or a
7015     *              'group' of sub-details which are simple items.
7016     */
7017    public DetailComponent setSequence(int value) {
7018      if (this.sequence == null)
7019        this.sequence = new PositiveIntType();
7020      this.sequence.setValue(value);
7021      return this;
7022    }
7023
7024    /**
7025     * @return {@link #revenue} (The type of revenue or cost center providing the
7026     *         product and/or service.)
7027     */
7028    public CodeableConcept getRevenue() {
7029      if (this.revenue == null)
7030        if (Configuration.errorOnAutoCreate())
7031          throw new Error("Attempt to auto-create DetailComponent.revenue");
7032        else if (Configuration.doAutoCreate())
7033          this.revenue = new CodeableConcept(); // cc
7034      return this.revenue;
7035    }
7036
7037    public boolean hasRevenue() {
7038      return this.revenue != null && !this.revenue.isEmpty();
7039    }
7040
7041    /**
7042     * @param value {@link #revenue} (The type of revenue or cost center providing
7043     *              the product and/or service.)
7044     */
7045    public DetailComponent setRevenue(CodeableConcept value) {
7046      this.revenue = value;
7047      return this;
7048    }
7049
7050    /**
7051     * @return {@link #category} (Code to identify the general type of benefits
7052     *         under which products and services are provided.)
7053     */
7054    public CodeableConcept getCategory() {
7055      if (this.category == null)
7056        if (Configuration.errorOnAutoCreate())
7057          throw new Error("Attempt to auto-create DetailComponent.category");
7058        else if (Configuration.doAutoCreate())
7059          this.category = new CodeableConcept(); // cc
7060      return this.category;
7061    }
7062
7063    public boolean hasCategory() {
7064      return this.category != null && !this.category.isEmpty();
7065    }
7066
7067    /**
7068     * @param value {@link #category} (Code to identify the general type of benefits
7069     *              under which products and services are provided.)
7070     */
7071    public DetailComponent setCategory(CodeableConcept value) {
7072      this.category = value;
7073      return this;
7074    }
7075
7076    /**
7077     * @return {@link #productOrService} (When the value is a group code then this
7078     *         item collects a set of related claim details, otherwise this contains
7079     *         the product, service, drug or other billing code for the item.)
7080     */
7081    public CodeableConcept getProductOrService() {
7082      if (this.productOrService == null)
7083        if (Configuration.errorOnAutoCreate())
7084          throw new Error("Attempt to auto-create DetailComponent.productOrService");
7085        else if (Configuration.doAutoCreate())
7086          this.productOrService = new CodeableConcept(); // cc
7087      return this.productOrService;
7088    }
7089
7090    public boolean hasProductOrService() {
7091      return this.productOrService != null && !this.productOrService.isEmpty();
7092    }
7093
7094    /**
7095     * @param value {@link #productOrService} (When the value is a group code then
7096     *              this item collects a set of related claim details, otherwise
7097     *              this contains the product, service, drug or other billing code
7098     *              for the item.)
7099     */
7100    public DetailComponent setProductOrService(CodeableConcept value) {
7101      this.productOrService = value;
7102      return this;
7103    }
7104
7105    /**
7106     * @return {@link #modifier} (Item typification or modifiers codes to convey
7107     *         additional context for the product or service.)
7108     */
7109    public List<CodeableConcept> getModifier() {
7110      if (this.modifier == null)
7111        this.modifier = new ArrayList<CodeableConcept>();
7112      return this.modifier;
7113    }
7114
7115    /**
7116     * @return Returns a reference to <code>this</code> for easy method chaining
7117     */
7118    public DetailComponent setModifier(List<CodeableConcept> theModifier) {
7119      this.modifier = theModifier;
7120      return this;
7121    }
7122
7123    public boolean hasModifier() {
7124      if (this.modifier == null)
7125        return false;
7126      for (CodeableConcept item : this.modifier)
7127        if (!item.isEmpty())
7128          return true;
7129      return false;
7130    }
7131
7132    public CodeableConcept addModifier() { // 3
7133      CodeableConcept t = new CodeableConcept();
7134      if (this.modifier == null)
7135        this.modifier = new ArrayList<CodeableConcept>();
7136      this.modifier.add(t);
7137      return t;
7138    }
7139
7140    public DetailComponent addModifier(CodeableConcept t) { // 3
7141      if (t == null)
7142        return this;
7143      if (this.modifier == null)
7144        this.modifier = new ArrayList<CodeableConcept>();
7145      this.modifier.add(t);
7146      return this;
7147    }
7148
7149    /**
7150     * @return The first repetition of repeating field {@link #modifier}, creating
7151     *         it if it does not already exist
7152     */
7153    public CodeableConcept getModifierFirstRep() {
7154      if (getModifier().isEmpty()) {
7155        addModifier();
7156      }
7157      return getModifier().get(0);
7158    }
7159
7160    /**
7161     * @return {@link #programCode} (Identifies the program under which this may be
7162     *         recovered.)
7163     */
7164    public List<CodeableConcept> getProgramCode() {
7165      if (this.programCode == null)
7166        this.programCode = new ArrayList<CodeableConcept>();
7167      return this.programCode;
7168    }
7169
7170    /**
7171     * @return Returns a reference to <code>this</code> for easy method chaining
7172     */
7173    public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) {
7174      this.programCode = theProgramCode;
7175      return this;
7176    }
7177
7178    public boolean hasProgramCode() {
7179      if (this.programCode == null)
7180        return false;
7181      for (CodeableConcept item : this.programCode)
7182        if (!item.isEmpty())
7183          return true;
7184      return false;
7185    }
7186
7187    public CodeableConcept addProgramCode() { // 3
7188      CodeableConcept t = new CodeableConcept();
7189      if (this.programCode == null)
7190        this.programCode = new ArrayList<CodeableConcept>();
7191      this.programCode.add(t);
7192      return t;
7193    }
7194
7195    public DetailComponent addProgramCode(CodeableConcept t) { // 3
7196      if (t == null)
7197        return this;
7198      if (this.programCode == null)
7199        this.programCode = new ArrayList<CodeableConcept>();
7200      this.programCode.add(t);
7201      return this;
7202    }
7203
7204    /**
7205     * @return The first repetition of repeating field {@link #programCode},
7206     *         creating it if it does not already exist
7207     */
7208    public CodeableConcept getProgramCodeFirstRep() {
7209      if (getProgramCode().isEmpty()) {
7210        addProgramCode();
7211      }
7212      return getProgramCode().get(0);
7213    }
7214
7215    /**
7216     * @return {@link #quantity} (The number of repetitions of a service or
7217     *         product.)
7218     */
7219    public Quantity getQuantity() {
7220      if (this.quantity == null)
7221        if (Configuration.errorOnAutoCreate())
7222          throw new Error("Attempt to auto-create DetailComponent.quantity");
7223        else if (Configuration.doAutoCreate())
7224          this.quantity = new Quantity(); // cc
7225      return this.quantity;
7226    }
7227
7228    public boolean hasQuantity() {
7229      return this.quantity != null && !this.quantity.isEmpty();
7230    }
7231
7232    /**
7233     * @param value {@link #quantity} (The number of repetitions of a service or
7234     *              product.)
7235     */
7236    public DetailComponent setQuantity(Quantity value) {
7237      this.quantity = value;
7238      return this;
7239    }
7240
7241    /**
7242     * @return {@link #unitPrice} (If the item is not a group then this is the fee
7243     *         for the product or service, otherwise this is the total of the fees
7244     *         for the details of the group.)
7245     */
7246    public Money getUnitPrice() {
7247      if (this.unitPrice == null)
7248        if (Configuration.errorOnAutoCreate())
7249          throw new Error("Attempt to auto-create DetailComponent.unitPrice");
7250        else if (Configuration.doAutoCreate())
7251          this.unitPrice = new Money(); // cc
7252      return this.unitPrice;
7253    }
7254
7255    public boolean hasUnitPrice() {
7256      return this.unitPrice != null && !this.unitPrice.isEmpty();
7257    }
7258
7259    /**
7260     * @param value {@link #unitPrice} (If the item is not a group then this is the
7261     *              fee for the product or service, otherwise this is the total of
7262     *              the fees for the details of the group.)
7263     */
7264    public DetailComponent setUnitPrice(Money value) {
7265      this.unitPrice = value;
7266      return this;
7267    }
7268
7269    /**
7270     * @return {@link #factor} (A real number that represents a multiplier used in
7271     *         determining the overall value of services delivered and/or goods
7272     *         received. The concept of a Factor allows for a discount or surcharge
7273     *         multiplier to be applied to a monetary amount.). This is the
7274     *         underlying object with id, value and extensions. The accessor
7275     *         "getFactor" gives direct access to the value
7276     */
7277    public DecimalType getFactorElement() {
7278      if (this.factor == null)
7279        if (Configuration.errorOnAutoCreate())
7280          throw new Error("Attempt to auto-create DetailComponent.factor");
7281        else if (Configuration.doAutoCreate())
7282          this.factor = new DecimalType(); // bb
7283      return this.factor;
7284    }
7285
7286    public boolean hasFactorElement() {
7287      return this.factor != null && !this.factor.isEmpty();
7288    }
7289
7290    public boolean hasFactor() {
7291      return this.factor != null && !this.factor.isEmpty();
7292    }
7293
7294    /**
7295     * @param value {@link #factor} (A real number that represents a multiplier used
7296     *              in determining the overall value of services delivered and/or
7297     *              goods received. The concept of a Factor allows for a discount or
7298     *              surcharge multiplier to be applied to a monetary amount.). This
7299     *              is the underlying object with id, value and extensions. The
7300     *              accessor "getFactor" gives direct access to the value
7301     */
7302    public DetailComponent setFactorElement(DecimalType value) {
7303      this.factor = value;
7304      return this;
7305    }
7306
7307    /**
7308     * @return A real number that represents a multiplier used in determining the
7309     *         overall value of services delivered and/or goods received. The
7310     *         concept of a Factor allows for a discount or surcharge multiplier to
7311     *         be applied to a monetary amount.
7312     */
7313    public BigDecimal getFactor() {
7314      return this.factor == null ? null : this.factor.getValue();
7315    }
7316
7317    /**
7318     * @param value A real number that represents a multiplier used in determining
7319     *              the overall value of services delivered and/or goods received.
7320     *              The concept of a Factor allows for a discount or surcharge
7321     *              multiplier to be applied to a monetary amount.
7322     */
7323    public DetailComponent setFactor(BigDecimal value) {
7324      if (value == null)
7325        this.factor = null;
7326      else {
7327        if (this.factor == null)
7328          this.factor = new DecimalType();
7329        this.factor.setValue(value);
7330      }
7331      return this;
7332    }
7333
7334    /**
7335     * @param value A real number that represents a multiplier used in determining
7336     *              the overall value of services delivered and/or goods received.
7337     *              The concept of a Factor allows for a discount or surcharge
7338     *              multiplier to be applied to a monetary amount.
7339     */
7340    public DetailComponent setFactor(long value) {
7341      this.factor = new DecimalType();
7342      this.factor.setValue(value);
7343      return this;
7344    }
7345
7346    /**
7347     * @param value A real number that represents a multiplier used in determining
7348     *              the overall value of services delivered and/or goods received.
7349     *              The concept of a Factor allows for a discount or surcharge
7350     *              multiplier to be applied to a monetary amount.
7351     */
7352    public DetailComponent setFactor(double value) {
7353      this.factor = new DecimalType();
7354      this.factor.setValue(value);
7355      return this;
7356    }
7357
7358    /**
7359     * @return {@link #net} (The quantity times the unit price for an additional
7360     *         service or product or charge.)
7361     */
7362    public Money getNet() {
7363      if (this.net == null)
7364        if (Configuration.errorOnAutoCreate())
7365          throw new Error("Attempt to auto-create DetailComponent.net");
7366        else if (Configuration.doAutoCreate())
7367          this.net = new Money(); // cc
7368      return this.net;
7369    }
7370
7371    public boolean hasNet() {
7372      return this.net != null && !this.net.isEmpty();
7373    }
7374
7375    /**
7376     * @param value {@link #net} (The quantity times the unit price for an
7377     *              additional service or product or charge.)
7378     */
7379    public DetailComponent setNet(Money value) {
7380      this.net = value;
7381      return this;
7382    }
7383
7384    /**
7385     * @return {@link #udi} (Unique Device Identifiers associated with this line
7386     *         item.)
7387     */
7388    public List<Reference> getUdi() {
7389      if (this.udi == null)
7390        this.udi = new ArrayList<Reference>();
7391      return this.udi;
7392    }
7393
7394    /**
7395     * @return Returns a reference to <code>this</code> for easy method chaining
7396     */
7397    public DetailComponent setUdi(List<Reference> theUdi) {
7398      this.udi = theUdi;
7399      return this;
7400    }
7401
7402    public boolean hasUdi() {
7403      if (this.udi == null)
7404        return false;
7405      for (Reference item : this.udi)
7406        if (!item.isEmpty())
7407          return true;
7408      return false;
7409    }
7410
7411    public Reference addUdi() { // 3
7412      Reference t = new Reference();
7413      if (this.udi == null)
7414        this.udi = new ArrayList<Reference>();
7415      this.udi.add(t);
7416      return t;
7417    }
7418
7419    public DetailComponent addUdi(Reference t) { // 3
7420      if (t == null)
7421        return this;
7422      if (this.udi == null)
7423        this.udi = new ArrayList<Reference>();
7424      this.udi.add(t);
7425      return this;
7426    }
7427
7428    /**
7429     * @return The first repetition of repeating field {@link #udi}, creating it if
7430     *         it does not already exist
7431     */
7432    public Reference getUdiFirstRep() {
7433      if (getUdi().isEmpty()) {
7434        addUdi();
7435      }
7436      return getUdi().get(0);
7437    }
7438
7439    /**
7440     * @deprecated Use Reference#setResource(IBaseResource) instead
7441     */
7442    @Deprecated
7443    public List<Device> getUdiTarget() {
7444      if (this.udiTarget == null)
7445        this.udiTarget = new ArrayList<Device>();
7446      return this.udiTarget;
7447    }
7448
7449    /**
7450     * @deprecated Use Reference#setResource(IBaseResource) instead
7451     */
7452    @Deprecated
7453    public Device addUdiTarget() {
7454      Device r = new Device();
7455      if (this.udiTarget == null)
7456        this.udiTarget = new ArrayList<Device>();
7457      this.udiTarget.add(r);
7458      return r;
7459    }
7460
7461    /**
7462     * @return {@link #noteNumber} (The numbers associated with notes below which
7463     *         apply to the adjudication of this item.)
7464     */
7465    public List<PositiveIntType> getNoteNumber() {
7466      if (this.noteNumber == null)
7467        this.noteNumber = new ArrayList<PositiveIntType>();
7468      return this.noteNumber;
7469    }
7470
7471    /**
7472     * @return Returns a reference to <code>this</code> for easy method chaining
7473     */
7474    public DetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
7475      this.noteNumber = theNoteNumber;
7476      return this;
7477    }
7478
7479    public boolean hasNoteNumber() {
7480      if (this.noteNumber == null)
7481        return false;
7482      for (PositiveIntType item : this.noteNumber)
7483        if (!item.isEmpty())
7484          return true;
7485      return false;
7486    }
7487
7488    /**
7489     * @return {@link #noteNumber} (The numbers associated with notes below which
7490     *         apply to the adjudication of this item.)
7491     */
7492    public PositiveIntType addNoteNumberElement() {// 2
7493      PositiveIntType t = new PositiveIntType();
7494      if (this.noteNumber == null)
7495        this.noteNumber = new ArrayList<PositiveIntType>();
7496      this.noteNumber.add(t);
7497      return t;
7498    }
7499
7500    /**
7501     * @param value {@link #noteNumber} (The numbers associated with notes below
7502     *              which apply to the adjudication of this item.)
7503     */
7504    public DetailComponent addNoteNumber(int value) { // 1
7505      PositiveIntType t = new PositiveIntType();
7506      t.setValue(value);
7507      if (this.noteNumber == null)
7508        this.noteNumber = new ArrayList<PositiveIntType>();
7509      this.noteNumber.add(t);
7510      return this;
7511    }
7512
7513    /**
7514     * @param value {@link #noteNumber} (The numbers associated with notes below
7515     *              which apply to the adjudication of this item.)
7516     */
7517    public boolean hasNoteNumber(int value) {
7518      if (this.noteNumber == null)
7519        return false;
7520      for (PositiveIntType v : this.noteNumber)
7521        if (v.getValue().equals(value)) // positiveInt
7522          return true;
7523      return false;
7524    }
7525
7526    /**
7527     * @return {@link #adjudication} (The adjudication results.)
7528     */
7529    public List<AdjudicationComponent> getAdjudication() {
7530      if (this.adjudication == null)
7531        this.adjudication = new ArrayList<AdjudicationComponent>();
7532      return this.adjudication;
7533    }
7534
7535    /**
7536     * @return Returns a reference to <code>this</code> for easy method chaining
7537     */
7538    public DetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
7539      this.adjudication = theAdjudication;
7540      return this;
7541    }
7542
7543    public boolean hasAdjudication() {
7544      if (this.adjudication == null)
7545        return false;
7546      for (AdjudicationComponent item : this.adjudication)
7547        if (!item.isEmpty())
7548          return true;
7549      return false;
7550    }
7551
7552    public AdjudicationComponent addAdjudication() { // 3
7553      AdjudicationComponent t = new AdjudicationComponent();
7554      if (this.adjudication == null)
7555        this.adjudication = new ArrayList<AdjudicationComponent>();
7556      this.adjudication.add(t);
7557      return t;
7558    }
7559
7560    public DetailComponent addAdjudication(AdjudicationComponent t) { // 3
7561      if (t == null)
7562        return this;
7563      if (this.adjudication == null)
7564        this.adjudication = new ArrayList<AdjudicationComponent>();
7565      this.adjudication.add(t);
7566      return this;
7567    }
7568
7569    /**
7570     * @return The first repetition of repeating field {@link #adjudication},
7571     *         creating it if it does not already exist
7572     */
7573    public AdjudicationComponent getAdjudicationFirstRep() {
7574      if (getAdjudication().isEmpty()) {
7575        addAdjudication();
7576      }
7577      return getAdjudication().get(0);
7578    }
7579
7580    /**
7581     * @return {@link #subDetail} (Third-tier of goods and services.)
7582     */
7583    public List<SubDetailComponent> getSubDetail() {
7584      if (this.subDetail == null)
7585        this.subDetail = new ArrayList<SubDetailComponent>();
7586      return this.subDetail;
7587    }
7588
7589    /**
7590     * @return Returns a reference to <code>this</code> for easy method chaining
7591     */
7592    public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) {
7593      this.subDetail = theSubDetail;
7594      return this;
7595    }
7596
7597    public boolean hasSubDetail() {
7598      if (this.subDetail == null)
7599        return false;
7600      for (SubDetailComponent item : this.subDetail)
7601        if (!item.isEmpty())
7602          return true;
7603      return false;
7604    }
7605
7606    public SubDetailComponent addSubDetail() { // 3
7607      SubDetailComponent t = new SubDetailComponent();
7608      if (this.subDetail == null)
7609        this.subDetail = new ArrayList<SubDetailComponent>();
7610      this.subDetail.add(t);
7611      return t;
7612    }
7613
7614    public DetailComponent addSubDetail(SubDetailComponent t) { // 3
7615      if (t == null)
7616        return this;
7617      if (this.subDetail == null)
7618        this.subDetail = new ArrayList<SubDetailComponent>();
7619      this.subDetail.add(t);
7620      return this;
7621    }
7622
7623    /**
7624     * @return The first repetition of repeating field {@link #subDetail}, creating
7625     *         it if it does not already exist
7626     */
7627    public SubDetailComponent getSubDetailFirstRep() {
7628      if (getSubDetail().isEmpty()) {
7629        addSubDetail();
7630      }
7631      return getSubDetail().get(0);
7632    }
7633
7634    protected void listChildren(List<Property> children) {
7635      super.listChildren(children);
7636      children.add(new Property("sequence", "positiveInt",
7637          "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
7638          0, 1, sequence));
7639      children.add(new Property("revenue", "CodeableConcept",
7640          "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
7641      children.add(new Property("category", "CodeableConcept",
7642          "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
7643          category));
7644      children.add(new Property("productOrService", "CodeableConcept",
7645          "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.",
7646          0, 1, productOrService));
7647      children.add(new Property("modifier", "CodeableConcept",
7648          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
7649          java.lang.Integer.MAX_VALUE, modifier));
7650      children.add(new Property("programCode", "CodeableConcept",
7651          "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
7652      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
7653          1, quantity));
7654      children.add(new Property("unitPrice", "Money",
7655          "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.",
7656          0, 1, unitPrice));
7657      children.add(new Property("factor", "decimal",
7658          "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.",
7659          0, 1, factor));
7660      children.add(new Property("net", "Money",
7661          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
7662      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
7663          0, java.lang.Integer.MAX_VALUE, udi));
7664      children.add(new Property("noteNumber", "positiveInt",
7665          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
7666          java.lang.Integer.MAX_VALUE, noteNumber));
7667      children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.",
7668          0, java.lang.Integer.MAX_VALUE, adjudication));
7669      children.add(new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE,
7670          subDetail));
7671    }
7672
7673    @Override
7674    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7675      switch (_hash) {
7676      case 1349547969:
7677        /* sequence */ return new Property("sequence", "positiveInt",
7678            "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
7679            0, 1, sequence);
7680      case 1099842588:
7681        /* revenue */ return new Property("revenue", "CodeableConcept",
7682            "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
7683      case 50511102:
7684        /* category */ return new Property("category", "CodeableConcept",
7685            "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
7686            category);
7687      case 1957227299:
7688        /* productOrService */ return new Property("productOrService", "CodeableConcept",
7689            "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.",
7690            0, 1, productOrService);
7691      case -615513385:
7692        /* modifier */ return new Property("modifier", "CodeableConcept",
7693            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
7694            java.lang.Integer.MAX_VALUE, modifier);
7695      case 1010065041:
7696        /* programCode */ return new Property("programCode", "CodeableConcept",
7697            "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
7698      case -1285004149:
7699        /* quantity */ return new Property("quantity", "SimpleQuantity",
7700            "The number of repetitions of a service or product.", 0, 1, quantity);
7701      case -486196699:
7702        /* unitPrice */ return new Property("unitPrice", "Money",
7703            "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.",
7704            0, 1, unitPrice);
7705      case -1282148017:
7706        /* factor */ return new Property("factor", "decimal",
7707            "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.",
7708            0, 1, factor);
7709      case 108957:
7710        /* net */ return new Property("net", "Money",
7711            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
7712      case 115642:
7713        /* udi */ return new Property("udi", "Reference(Device)",
7714            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
7715      case -1110033957:
7716        /* noteNumber */ return new Property("noteNumber", "positiveInt",
7717            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
7718            java.lang.Integer.MAX_VALUE, noteNumber);
7719      case -231349275:
7720        /* adjudication */ return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
7721            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
7722      case -828829007:
7723        /* subDetail */ return new Property("subDetail", "", "Third-tier of goods and services.", 0,
7724            java.lang.Integer.MAX_VALUE, subDetail);
7725      default:
7726        return super.getNamedProperty(_hash, _name, _checkValid);
7727      }
7728
7729    }
7730
7731    @Override
7732    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7733      switch (hash) {
7734      case 1349547969:
7735        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
7736      case 1099842588:
7737        /* revenue */ return this.revenue == null ? new Base[0] : new Base[] { this.revenue }; // CodeableConcept
7738      case 50511102:
7739        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
7740      case 1957227299:
7741        /* productOrService */ return this.productOrService == null ? new Base[0]
7742            : new Base[] { this.productOrService }; // CodeableConcept
7743      case -615513385:
7744        /* modifier */ return this.modifier == null ? new Base[0]
7745            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7746      case 1010065041:
7747        /* programCode */ return this.programCode == null ? new Base[0]
7748            : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
7749      case -1285004149:
7750        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
7751      case -486196699:
7752        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
7753      case -1282148017:
7754        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
7755      case 108957:
7756        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
7757      case 115642:
7758        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
7759      case -1110033957:
7760        /* noteNumber */ return this.noteNumber == null ? new Base[0]
7761            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
7762      case -231349275:
7763        /* adjudication */ return this.adjudication == null ? new Base[0]
7764            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
7765      case -828829007:
7766        /* subDetail */ return this.subDetail == null ? new Base[0]
7767            : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
7768      default:
7769        return super.getProperty(hash, name, checkValid);
7770      }
7771
7772    }
7773
7774    @Override
7775    public Base setProperty(int hash, String name, Base value) throws FHIRException {
7776      switch (hash) {
7777      case 1349547969: // sequence
7778        this.sequence = castToPositiveInt(value); // PositiveIntType
7779        return value;
7780      case 1099842588: // revenue
7781        this.revenue = castToCodeableConcept(value); // CodeableConcept
7782        return value;
7783      case 50511102: // category
7784        this.category = castToCodeableConcept(value); // CodeableConcept
7785        return value;
7786      case 1957227299: // productOrService
7787        this.productOrService = castToCodeableConcept(value); // CodeableConcept
7788        return value;
7789      case -615513385: // modifier
7790        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
7791        return value;
7792      case 1010065041: // programCode
7793        this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
7794        return value;
7795      case -1285004149: // quantity
7796        this.quantity = castToQuantity(value); // Quantity
7797        return value;
7798      case -486196699: // unitPrice
7799        this.unitPrice = castToMoney(value); // Money
7800        return value;
7801      case -1282148017: // factor
7802        this.factor = castToDecimal(value); // DecimalType
7803        return value;
7804      case 108957: // net
7805        this.net = castToMoney(value); // Money
7806        return value;
7807      case 115642: // udi
7808        this.getUdi().add(castToReference(value)); // Reference
7809        return value;
7810      case -1110033957: // noteNumber
7811        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
7812        return value;
7813      case -231349275: // adjudication
7814        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7815        return value;
7816      case -828829007: // subDetail
7817        this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
7818        return value;
7819      default:
7820        return super.setProperty(hash, name, value);
7821      }
7822
7823    }
7824
7825    @Override
7826    public Base setProperty(String name, Base value) throws FHIRException {
7827      if (name.equals("sequence")) {
7828        this.sequence = castToPositiveInt(value); // PositiveIntType
7829      } else if (name.equals("revenue")) {
7830        this.revenue = castToCodeableConcept(value); // CodeableConcept
7831      } else if (name.equals("category")) {
7832        this.category = castToCodeableConcept(value); // CodeableConcept
7833      } else if (name.equals("productOrService")) {
7834        this.productOrService = castToCodeableConcept(value); // CodeableConcept
7835      } else if (name.equals("modifier")) {
7836        this.getModifier().add(castToCodeableConcept(value));
7837      } else if (name.equals("programCode")) {
7838        this.getProgramCode().add(castToCodeableConcept(value));
7839      } else if (name.equals("quantity")) {
7840        this.quantity = castToQuantity(value); // Quantity
7841      } else if (name.equals("unitPrice")) {
7842        this.unitPrice = castToMoney(value); // Money
7843      } else if (name.equals("factor")) {
7844        this.factor = castToDecimal(value); // DecimalType
7845      } else if (name.equals("net")) {
7846        this.net = castToMoney(value); // Money
7847      } else if (name.equals("udi")) {
7848        this.getUdi().add(castToReference(value));
7849      } else if (name.equals("noteNumber")) {
7850        this.getNoteNumber().add(castToPositiveInt(value));
7851      } else if (name.equals("adjudication")) {
7852        this.getAdjudication().add((AdjudicationComponent) value);
7853      } else if (name.equals("subDetail")) {
7854        this.getSubDetail().add((SubDetailComponent) value);
7855      } else
7856        return super.setProperty(name, value);
7857      return value;
7858    }
7859
7860  @Override
7861  public void removeChild(String name, Base value) throws FHIRException {
7862      if (name.equals("sequence")) {
7863        this.sequence = null;
7864      } else if (name.equals("revenue")) {
7865        this.revenue = null;
7866      } else if (name.equals("category")) {
7867        this.category = null;
7868      } else if (name.equals("productOrService")) {
7869        this.productOrService = null;
7870      } else if (name.equals("modifier")) {
7871        this.getModifier().remove(castToCodeableConcept(value));
7872      } else if (name.equals("programCode")) {
7873        this.getProgramCode().remove(castToCodeableConcept(value));
7874      } else if (name.equals("quantity")) {
7875        this.quantity = null;
7876      } else if (name.equals("unitPrice")) {
7877        this.unitPrice = null;
7878      } else if (name.equals("factor")) {
7879        this.factor = null;
7880      } else if (name.equals("net")) {
7881        this.net = null;
7882      } else if (name.equals("udi")) {
7883        this.getUdi().remove(castToReference(value));
7884      } else if (name.equals("noteNumber")) {
7885        this.getNoteNumber().remove(castToPositiveInt(value));
7886      } else if (name.equals("adjudication")) {
7887        this.getAdjudication().remove((AdjudicationComponent) value);
7888      } else if (name.equals("subDetail")) {
7889        this.getSubDetail().remove((SubDetailComponent) value);
7890      } else
7891        super.removeChild(name, value);
7892      
7893    }
7894
7895    @Override
7896    public Base makeProperty(int hash, String name) throws FHIRException {
7897      switch (hash) {
7898      case 1349547969:
7899        return getSequenceElement();
7900      case 1099842588:
7901        return getRevenue();
7902      case 50511102:
7903        return getCategory();
7904      case 1957227299:
7905        return getProductOrService();
7906      case -615513385:
7907        return addModifier();
7908      case 1010065041:
7909        return addProgramCode();
7910      case -1285004149:
7911        return getQuantity();
7912      case -486196699:
7913        return getUnitPrice();
7914      case -1282148017:
7915        return getFactorElement();
7916      case 108957:
7917        return getNet();
7918      case 115642:
7919        return addUdi();
7920      case -1110033957:
7921        return addNoteNumberElement();
7922      case -231349275:
7923        return addAdjudication();
7924      case -828829007:
7925        return addSubDetail();
7926      default:
7927        return super.makeProperty(hash, name);
7928      }
7929
7930    }
7931
7932    @Override
7933    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7934      switch (hash) {
7935      case 1349547969:
7936        /* sequence */ return new String[] { "positiveInt" };
7937      case 1099842588:
7938        /* revenue */ return new String[] { "CodeableConcept" };
7939      case 50511102:
7940        /* category */ return new String[] { "CodeableConcept" };
7941      case 1957227299:
7942        /* productOrService */ return new String[] { "CodeableConcept" };
7943      case -615513385:
7944        /* modifier */ return new String[] { "CodeableConcept" };
7945      case 1010065041:
7946        /* programCode */ return new String[] { "CodeableConcept" };
7947      case -1285004149:
7948        /* quantity */ return new String[] { "SimpleQuantity" };
7949      case -486196699:
7950        /* unitPrice */ return new String[] { "Money" };
7951      case -1282148017:
7952        /* factor */ return new String[] { "decimal" };
7953      case 108957:
7954        /* net */ return new String[] { "Money" };
7955      case 115642:
7956        /* udi */ return new String[] { "Reference" };
7957      case -1110033957:
7958        /* noteNumber */ return new String[] { "positiveInt" };
7959      case -231349275:
7960        /* adjudication */ return new String[] { "@ExplanationOfBenefit.item.adjudication" };
7961      case -828829007:
7962        /* subDetail */ return new String[] {};
7963      default:
7964        return super.getTypesForProperty(hash, name);
7965      }
7966
7967    }
7968
7969    @Override
7970    public Base addChild(String name) throws FHIRException {
7971      if (name.equals("sequence")) {
7972        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
7973      } else if (name.equals("revenue")) {
7974        this.revenue = new CodeableConcept();
7975        return this.revenue;
7976      } else if (name.equals("category")) {
7977        this.category = new CodeableConcept();
7978        return this.category;
7979      } else if (name.equals("productOrService")) {
7980        this.productOrService = new CodeableConcept();
7981        return this.productOrService;
7982      } else if (name.equals("modifier")) {
7983        return addModifier();
7984      } else if (name.equals("programCode")) {
7985        return addProgramCode();
7986      } else if (name.equals("quantity")) {
7987        this.quantity = new Quantity();
7988        return this.quantity;
7989      } else if (name.equals("unitPrice")) {
7990        this.unitPrice = new Money();
7991        return this.unitPrice;
7992      } else if (name.equals("factor")) {
7993        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
7994      } else if (name.equals("net")) {
7995        this.net = new Money();
7996        return this.net;
7997      } else if (name.equals("udi")) {
7998        return addUdi();
7999      } else if (name.equals("noteNumber")) {
8000        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
8001      } else if (name.equals("adjudication")) {
8002        return addAdjudication();
8003      } else if (name.equals("subDetail")) {
8004        return addSubDetail();
8005      } else
8006        return super.addChild(name);
8007    }
8008
8009    public DetailComponent copy() {
8010      DetailComponent dst = new DetailComponent();
8011      copyValues(dst);
8012      return dst;
8013    }
8014
8015    public void copyValues(DetailComponent dst) {
8016      super.copyValues(dst);
8017      dst.sequence = sequence == null ? null : sequence.copy();
8018      dst.revenue = revenue == null ? null : revenue.copy();
8019      dst.category = category == null ? null : category.copy();
8020      dst.productOrService = productOrService == null ? null : productOrService.copy();
8021      if (modifier != null) {
8022        dst.modifier = new ArrayList<CodeableConcept>();
8023        for (CodeableConcept i : modifier)
8024          dst.modifier.add(i.copy());
8025      }
8026      ;
8027      if (programCode != null) {
8028        dst.programCode = new ArrayList<CodeableConcept>();
8029        for (CodeableConcept i : programCode)
8030          dst.programCode.add(i.copy());
8031      }
8032      ;
8033      dst.quantity = quantity == null ? null : quantity.copy();
8034      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
8035      dst.factor = factor == null ? null : factor.copy();
8036      dst.net = net == null ? null : net.copy();
8037      if (udi != null) {
8038        dst.udi = new ArrayList<Reference>();
8039        for (Reference i : udi)
8040          dst.udi.add(i.copy());
8041      }
8042      ;
8043      if (noteNumber != null) {
8044        dst.noteNumber = new ArrayList<PositiveIntType>();
8045        for (PositiveIntType i : noteNumber)
8046          dst.noteNumber.add(i.copy());
8047      }
8048      ;
8049      if (adjudication != null) {
8050        dst.adjudication = new ArrayList<AdjudicationComponent>();
8051        for (AdjudicationComponent i : adjudication)
8052          dst.adjudication.add(i.copy());
8053      }
8054      ;
8055      if (subDetail != null) {
8056        dst.subDetail = new ArrayList<SubDetailComponent>();
8057        for (SubDetailComponent i : subDetail)
8058          dst.subDetail.add(i.copy());
8059      }
8060      ;
8061    }
8062
8063    @Override
8064    public boolean equalsDeep(Base other_) {
8065      if (!super.equalsDeep(other_))
8066        return false;
8067      if (!(other_ instanceof DetailComponent))
8068        return false;
8069      DetailComponent o = (DetailComponent) other_;
8070      return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true)
8071          && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
8072          && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
8073          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
8074          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
8075          && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
8076          && compareDeep(subDetail, o.subDetail, true);
8077    }
8078
8079    @Override
8080    public boolean equalsShallow(Base other_) {
8081      if (!super.equalsShallow(other_))
8082        return false;
8083      if (!(other_ instanceof DetailComponent))
8084        return false;
8085      DetailComponent o = (DetailComponent) other_;
8086      return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true)
8087          && compareValues(noteNumber, o.noteNumber, true);
8088    }
8089
8090    public boolean isEmpty() {
8091      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category, productOrService,
8092          modifier, programCode, quantity, unitPrice, factor, net, udi, noteNumber, adjudication, subDetail);
8093    }
8094
8095    public String fhirType() {
8096      return "ExplanationOfBenefit.item.detail";
8097
8098    }
8099
8100  }
8101
8102  @Block()
8103  public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
8104    /**
8105     * A claim detail line. Either a simple (a product or service) or a 'group' of
8106     * sub-details which are simple items.
8107     */
8108    @Child(name = "sequence", type = {
8109        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
8110    @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.")
8111    protected PositiveIntType sequence;
8112
8113    /**
8114     * The type of revenue or cost center providing the product and/or service.
8115     */
8116    @Child(name = "revenue", type = {
8117        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
8118    @Description(shortDefinition = "Revenue or cost center code", formalDefinition = "The type of revenue or cost center providing the product and/or service.")
8119    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-revenue-center")
8120    protected CodeableConcept revenue;
8121
8122    /**
8123     * Code to identify the general type of benefits under which products and
8124     * services are provided.
8125     */
8126    @Child(name = "category", type = {
8127        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
8128    @Description(shortDefinition = "Benefit classification", formalDefinition = "Code to identify the general type of benefits under which products and services are provided.")
8129    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-benefitcategory")
8130    protected CodeableConcept category;
8131
8132    /**
8133     * When the value is a group code then this item collects a set of related claim
8134     * details, otherwise this contains the product, service, drug or other billing
8135     * code for the item.
8136     */
8137    @Child(name = "productOrService", type = {
8138        CodeableConcept.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
8139    @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.")
8140    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
8141    protected CodeableConcept productOrService;
8142
8143    /**
8144     * Item typification or modifiers codes to convey additional context for the
8145     * product or service.
8146     */
8147    @Child(name = "modifier", type = {
8148        CodeableConcept.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8149    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
8150    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
8151    protected List<CodeableConcept> modifier;
8152
8153    /**
8154     * Identifies the program under which this may be recovered.
8155     */
8156    @Child(name = "programCode", type = {
8157        CodeableConcept.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8158    @Description(shortDefinition = "Program the product or service is provided under", formalDefinition = "Identifies the program under which this may be recovered.")
8159    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-program-code")
8160    protected List<CodeableConcept> programCode;
8161
8162    /**
8163     * The number of repetitions of a service or product.
8164     */
8165    @Child(name = "quantity", type = { Quantity.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
8166    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
8167    protected Quantity quantity;
8168
8169    /**
8170     * If the item is not a group then this is the fee for the product or service,
8171     * otherwise this is the total of the fees for the details of the group.
8172     */
8173    @Child(name = "unitPrice", type = { Money.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
8174    @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.")
8175    protected Money unitPrice;
8176
8177    /**
8178     * A real number that represents a multiplier used in determining the overall
8179     * value of services delivered and/or goods received. The concept of a Factor
8180     * allows for a discount or surcharge multiplier to be applied to a monetary
8181     * amount.
8182     */
8183    @Child(name = "factor", type = {
8184        DecimalType.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
8185    @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.")
8186    protected DecimalType factor;
8187
8188    /**
8189     * The quantity times the unit price for an additional service or product or
8190     * charge.
8191     */
8192    @Child(name = "net", type = { Money.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
8193    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
8194    protected Money net;
8195
8196    /**
8197     * Unique Device Identifiers associated with this line item.
8198     */
8199    @Child(name = "udi", type = {
8200        Device.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8201    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
8202    protected List<Reference> udi;
8203    /**
8204     * The actual objects that are the target of the reference (Unique Device
8205     * Identifiers associated with this line item.)
8206     */
8207    protected List<Device> udiTarget;
8208
8209    /**
8210     * The numbers associated with notes below which apply to the adjudication of
8211     * this item.
8212     */
8213    @Child(name = "noteNumber", type = {
8214        PositiveIntType.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8215    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
8216    protected List<PositiveIntType> noteNumber;
8217
8218    /**
8219     * The adjudication results.
8220     */
8221    @Child(name = "adjudication", type = {
8222        AdjudicationComponent.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8223    @Description(shortDefinition = "Subdetail level adjudication details", formalDefinition = "The adjudication results.")
8224    protected List<AdjudicationComponent> adjudication;
8225
8226    private static final long serialVersionUID = -996156853L;
8227
8228    /**
8229     * Constructor
8230     */
8231    public SubDetailComponent() {
8232      super();
8233    }
8234
8235    /**
8236     * Constructor
8237     */
8238    public SubDetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
8239      super();
8240      this.sequence = sequence;
8241      this.productOrService = productOrService;
8242    }
8243
8244    /**
8245     * @return {@link #sequence} (A claim detail line. Either a simple (a product or
8246     *         service) or a 'group' of sub-details which are simple items.). This
8247     *         is the underlying object with id, value and extensions. The accessor
8248     *         "getSequence" gives direct access to the value
8249     */
8250    public PositiveIntType getSequenceElement() {
8251      if (this.sequence == null)
8252        if (Configuration.errorOnAutoCreate())
8253          throw new Error("Attempt to auto-create SubDetailComponent.sequence");
8254        else if (Configuration.doAutoCreate())
8255          this.sequence = new PositiveIntType(); // bb
8256      return this.sequence;
8257    }
8258
8259    public boolean hasSequenceElement() {
8260      return this.sequence != null && !this.sequence.isEmpty();
8261    }
8262
8263    public boolean hasSequence() {
8264      return this.sequence != null && !this.sequence.isEmpty();
8265    }
8266
8267    /**
8268     * @param value {@link #sequence} (A claim detail line. Either a simple (a
8269     *              product or service) or a 'group' of sub-details which are simple
8270     *              items.). This is the underlying object with id, value and
8271     *              extensions. The accessor "getSequence" gives direct access to
8272     *              the value
8273     */
8274    public SubDetailComponent setSequenceElement(PositiveIntType value) {
8275      this.sequence = value;
8276      return this;
8277    }
8278
8279    /**
8280     * @return A claim detail line. Either a simple (a product or service) or a
8281     *         'group' of sub-details which are simple items.
8282     */
8283    public int getSequence() {
8284      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
8285    }
8286
8287    /**
8288     * @param value A claim detail line. Either a simple (a product or service) or a
8289     *              'group' of sub-details which are simple items.
8290     */
8291    public SubDetailComponent setSequence(int value) {
8292      if (this.sequence == null)
8293        this.sequence = new PositiveIntType();
8294      this.sequence.setValue(value);
8295      return this;
8296    }
8297
8298    /**
8299     * @return {@link #revenue} (The type of revenue or cost center providing the
8300     *         product and/or service.)
8301     */
8302    public CodeableConcept getRevenue() {
8303      if (this.revenue == null)
8304        if (Configuration.errorOnAutoCreate())
8305          throw new Error("Attempt to auto-create SubDetailComponent.revenue");
8306        else if (Configuration.doAutoCreate())
8307          this.revenue = new CodeableConcept(); // cc
8308      return this.revenue;
8309    }
8310
8311    public boolean hasRevenue() {
8312      return this.revenue != null && !this.revenue.isEmpty();
8313    }
8314
8315    /**
8316     * @param value {@link #revenue} (The type of revenue or cost center providing
8317     *              the product and/or service.)
8318     */
8319    public SubDetailComponent setRevenue(CodeableConcept value) {
8320      this.revenue = value;
8321      return this;
8322    }
8323
8324    /**
8325     * @return {@link #category} (Code to identify the general type of benefits
8326     *         under which products and services are provided.)
8327     */
8328    public CodeableConcept getCategory() {
8329      if (this.category == null)
8330        if (Configuration.errorOnAutoCreate())
8331          throw new Error("Attempt to auto-create SubDetailComponent.category");
8332        else if (Configuration.doAutoCreate())
8333          this.category = new CodeableConcept(); // cc
8334      return this.category;
8335    }
8336
8337    public boolean hasCategory() {
8338      return this.category != null && !this.category.isEmpty();
8339    }
8340
8341    /**
8342     * @param value {@link #category} (Code to identify the general type of benefits
8343     *              under which products and services are provided.)
8344     */
8345    public SubDetailComponent setCategory(CodeableConcept value) {
8346      this.category = value;
8347      return this;
8348    }
8349
8350    /**
8351     * @return {@link #productOrService} (When the value is a group code then this
8352     *         item collects a set of related claim details, otherwise this contains
8353     *         the product, service, drug or other billing code for the item.)
8354     */
8355    public CodeableConcept getProductOrService() {
8356      if (this.productOrService == null)
8357        if (Configuration.errorOnAutoCreate())
8358          throw new Error("Attempt to auto-create SubDetailComponent.productOrService");
8359        else if (Configuration.doAutoCreate())
8360          this.productOrService = new CodeableConcept(); // cc
8361      return this.productOrService;
8362    }
8363
8364    public boolean hasProductOrService() {
8365      return this.productOrService != null && !this.productOrService.isEmpty();
8366    }
8367
8368    /**
8369     * @param value {@link #productOrService} (When the value is a group code then
8370     *              this item collects a set of related claim details, otherwise
8371     *              this contains the product, service, drug or other billing code
8372     *              for the item.)
8373     */
8374    public SubDetailComponent setProductOrService(CodeableConcept value) {
8375      this.productOrService = value;
8376      return this;
8377    }
8378
8379    /**
8380     * @return {@link #modifier} (Item typification or modifiers codes to convey
8381     *         additional context for the product or service.)
8382     */
8383    public List<CodeableConcept> getModifier() {
8384      if (this.modifier == null)
8385        this.modifier = new ArrayList<CodeableConcept>();
8386      return this.modifier;
8387    }
8388
8389    /**
8390     * @return Returns a reference to <code>this</code> for easy method chaining
8391     */
8392    public SubDetailComponent setModifier(List<CodeableConcept> theModifier) {
8393      this.modifier = theModifier;
8394      return this;
8395    }
8396
8397    public boolean hasModifier() {
8398      if (this.modifier == null)
8399        return false;
8400      for (CodeableConcept item : this.modifier)
8401        if (!item.isEmpty())
8402          return true;
8403      return false;
8404    }
8405
8406    public CodeableConcept addModifier() { // 3
8407      CodeableConcept t = new CodeableConcept();
8408      if (this.modifier == null)
8409        this.modifier = new ArrayList<CodeableConcept>();
8410      this.modifier.add(t);
8411      return t;
8412    }
8413
8414    public SubDetailComponent addModifier(CodeableConcept t) { // 3
8415      if (t == null)
8416        return this;
8417      if (this.modifier == null)
8418        this.modifier = new ArrayList<CodeableConcept>();
8419      this.modifier.add(t);
8420      return this;
8421    }
8422
8423    /**
8424     * @return The first repetition of repeating field {@link #modifier}, creating
8425     *         it if it does not already exist
8426     */
8427    public CodeableConcept getModifierFirstRep() {
8428      if (getModifier().isEmpty()) {
8429        addModifier();
8430      }
8431      return getModifier().get(0);
8432    }
8433
8434    /**
8435     * @return {@link #programCode} (Identifies the program under which this may be
8436     *         recovered.)
8437     */
8438    public List<CodeableConcept> getProgramCode() {
8439      if (this.programCode == null)
8440        this.programCode = new ArrayList<CodeableConcept>();
8441      return this.programCode;
8442    }
8443
8444    /**
8445     * @return Returns a reference to <code>this</code> for easy method chaining
8446     */
8447    public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) {
8448      this.programCode = theProgramCode;
8449      return this;
8450    }
8451
8452    public boolean hasProgramCode() {
8453      if (this.programCode == null)
8454        return false;
8455      for (CodeableConcept item : this.programCode)
8456        if (!item.isEmpty())
8457          return true;
8458      return false;
8459    }
8460
8461    public CodeableConcept addProgramCode() { // 3
8462      CodeableConcept t = new CodeableConcept();
8463      if (this.programCode == null)
8464        this.programCode = new ArrayList<CodeableConcept>();
8465      this.programCode.add(t);
8466      return t;
8467    }
8468
8469    public SubDetailComponent addProgramCode(CodeableConcept t) { // 3
8470      if (t == null)
8471        return this;
8472      if (this.programCode == null)
8473        this.programCode = new ArrayList<CodeableConcept>();
8474      this.programCode.add(t);
8475      return this;
8476    }
8477
8478    /**
8479     * @return The first repetition of repeating field {@link #programCode},
8480     *         creating it if it does not already exist
8481     */
8482    public CodeableConcept getProgramCodeFirstRep() {
8483      if (getProgramCode().isEmpty()) {
8484        addProgramCode();
8485      }
8486      return getProgramCode().get(0);
8487    }
8488
8489    /**
8490     * @return {@link #quantity} (The number of repetitions of a service or
8491     *         product.)
8492     */
8493    public Quantity getQuantity() {
8494      if (this.quantity == null)
8495        if (Configuration.errorOnAutoCreate())
8496          throw new Error("Attempt to auto-create SubDetailComponent.quantity");
8497        else if (Configuration.doAutoCreate())
8498          this.quantity = new Quantity(); // cc
8499      return this.quantity;
8500    }
8501
8502    public boolean hasQuantity() {
8503      return this.quantity != null && !this.quantity.isEmpty();
8504    }
8505
8506    /**
8507     * @param value {@link #quantity} (The number of repetitions of a service or
8508     *              product.)
8509     */
8510    public SubDetailComponent setQuantity(Quantity value) {
8511      this.quantity = value;
8512      return this;
8513    }
8514
8515    /**
8516     * @return {@link #unitPrice} (If the item is not a group then this is the fee
8517     *         for the product or service, otherwise this is the total of the fees
8518     *         for the details of the group.)
8519     */
8520    public Money getUnitPrice() {
8521      if (this.unitPrice == null)
8522        if (Configuration.errorOnAutoCreate())
8523          throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
8524        else if (Configuration.doAutoCreate())
8525          this.unitPrice = new Money(); // cc
8526      return this.unitPrice;
8527    }
8528
8529    public boolean hasUnitPrice() {
8530      return this.unitPrice != null && !this.unitPrice.isEmpty();
8531    }
8532
8533    /**
8534     * @param value {@link #unitPrice} (If the item is not a group then this is the
8535     *              fee for the product or service, otherwise this is the total of
8536     *              the fees for the details of the group.)
8537     */
8538    public SubDetailComponent setUnitPrice(Money value) {
8539      this.unitPrice = value;
8540      return this;
8541    }
8542
8543    /**
8544     * @return {@link #factor} (A real number that represents a multiplier used in
8545     *         determining the overall value of services delivered and/or goods
8546     *         received. The concept of a Factor allows for a discount or surcharge
8547     *         multiplier to be applied to a monetary amount.). This is the
8548     *         underlying object with id, value and extensions. The accessor
8549     *         "getFactor" gives direct access to the value
8550     */
8551    public DecimalType getFactorElement() {
8552      if (this.factor == null)
8553        if (Configuration.errorOnAutoCreate())
8554          throw new Error("Attempt to auto-create SubDetailComponent.factor");
8555        else if (Configuration.doAutoCreate())
8556          this.factor = new DecimalType(); // bb
8557      return this.factor;
8558    }
8559
8560    public boolean hasFactorElement() {
8561      return this.factor != null && !this.factor.isEmpty();
8562    }
8563
8564    public boolean hasFactor() {
8565      return this.factor != null && !this.factor.isEmpty();
8566    }
8567
8568    /**
8569     * @param value {@link #factor} (A real number that represents a multiplier used
8570     *              in determining the overall value of services delivered and/or
8571     *              goods received. The concept of a Factor allows for a discount or
8572     *              surcharge multiplier to be applied to a monetary amount.). This
8573     *              is the underlying object with id, value and extensions. The
8574     *              accessor "getFactor" gives direct access to the value
8575     */
8576    public SubDetailComponent setFactorElement(DecimalType value) {
8577      this.factor = value;
8578      return this;
8579    }
8580
8581    /**
8582     * @return A real number that represents a multiplier used in determining the
8583     *         overall value of services delivered and/or goods received. The
8584     *         concept of a Factor allows for a discount or surcharge multiplier to
8585     *         be applied to a monetary amount.
8586     */
8587    public BigDecimal getFactor() {
8588      return this.factor == null ? null : this.factor.getValue();
8589    }
8590
8591    /**
8592     * @param value A real number that represents a multiplier used in determining
8593     *              the overall value of services delivered and/or goods received.
8594     *              The concept of a Factor allows for a discount or surcharge
8595     *              multiplier to be applied to a monetary amount.
8596     */
8597    public SubDetailComponent setFactor(BigDecimal value) {
8598      if (value == null)
8599        this.factor = null;
8600      else {
8601        if (this.factor == null)
8602          this.factor = new DecimalType();
8603        this.factor.setValue(value);
8604      }
8605      return this;
8606    }
8607
8608    /**
8609     * @param value A real number that represents a multiplier used in determining
8610     *              the overall value of services delivered and/or goods received.
8611     *              The concept of a Factor allows for a discount or surcharge
8612     *              multiplier to be applied to a monetary amount.
8613     */
8614    public SubDetailComponent setFactor(long value) {
8615      this.factor = new DecimalType();
8616      this.factor.setValue(value);
8617      return this;
8618    }
8619
8620    /**
8621     * @param value A real number that represents a multiplier used in determining
8622     *              the overall value of services delivered and/or goods received.
8623     *              The concept of a Factor allows for a discount or surcharge
8624     *              multiplier to be applied to a monetary amount.
8625     */
8626    public SubDetailComponent setFactor(double value) {
8627      this.factor = new DecimalType();
8628      this.factor.setValue(value);
8629      return this;
8630    }
8631
8632    /**
8633     * @return {@link #net} (The quantity times the unit price for an additional
8634     *         service or product or charge.)
8635     */
8636    public Money getNet() {
8637      if (this.net == null)
8638        if (Configuration.errorOnAutoCreate())
8639          throw new Error("Attempt to auto-create SubDetailComponent.net");
8640        else if (Configuration.doAutoCreate())
8641          this.net = new Money(); // cc
8642      return this.net;
8643    }
8644
8645    public boolean hasNet() {
8646      return this.net != null && !this.net.isEmpty();
8647    }
8648
8649    /**
8650     * @param value {@link #net} (The quantity times the unit price for an
8651     *              additional service or product or charge.)
8652     */
8653    public SubDetailComponent setNet(Money value) {
8654      this.net = value;
8655      return this;
8656    }
8657
8658    /**
8659     * @return {@link #udi} (Unique Device Identifiers associated with this line
8660     *         item.)
8661     */
8662    public List<Reference> getUdi() {
8663      if (this.udi == null)
8664        this.udi = new ArrayList<Reference>();
8665      return this.udi;
8666    }
8667
8668    /**
8669     * @return Returns a reference to <code>this</code> for easy method chaining
8670     */
8671    public SubDetailComponent setUdi(List<Reference> theUdi) {
8672      this.udi = theUdi;
8673      return this;
8674    }
8675
8676    public boolean hasUdi() {
8677      if (this.udi == null)
8678        return false;
8679      for (Reference item : this.udi)
8680        if (!item.isEmpty())
8681          return true;
8682      return false;
8683    }
8684
8685    public Reference addUdi() { // 3
8686      Reference t = new Reference();
8687      if (this.udi == null)
8688        this.udi = new ArrayList<Reference>();
8689      this.udi.add(t);
8690      return t;
8691    }
8692
8693    public SubDetailComponent addUdi(Reference t) { // 3
8694      if (t == null)
8695        return this;
8696      if (this.udi == null)
8697        this.udi = new ArrayList<Reference>();
8698      this.udi.add(t);
8699      return this;
8700    }
8701
8702    /**
8703     * @return The first repetition of repeating field {@link #udi}, creating it if
8704     *         it does not already exist
8705     */
8706    public Reference getUdiFirstRep() {
8707      if (getUdi().isEmpty()) {
8708        addUdi();
8709      }
8710      return getUdi().get(0);
8711    }
8712
8713    /**
8714     * @deprecated Use Reference#setResource(IBaseResource) instead
8715     */
8716    @Deprecated
8717    public List<Device> getUdiTarget() {
8718      if (this.udiTarget == null)
8719        this.udiTarget = new ArrayList<Device>();
8720      return this.udiTarget;
8721    }
8722
8723    /**
8724     * @deprecated Use Reference#setResource(IBaseResource) instead
8725     */
8726    @Deprecated
8727    public Device addUdiTarget() {
8728      Device r = new Device();
8729      if (this.udiTarget == null)
8730        this.udiTarget = new ArrayList<Device>();
8731      this.udiTarget.add(r);
8732      return r;
8733    }
8734
8735    /**
8736     * @return {@link #noteNumber} (The numbers associated with notes below which
8737     *         apply to the adjudication of this item.)
8738     */
8739    public List<PositiveIntType> getNoteNumber() {
8740      if (this.noteNumber == null)
8741        this.noteNumber = new ArrayList<PositiveIntType>();
8742      return this.noteNumber;
8743    }
8744
8745    /**
8746     * @return Returns a reference to <code>this</code> for easy method chaining
8747     */
8748    public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
8749      this.noteNumber = theNoteNumber;
8750      return this;
8751    }
8752
8753    public boolean hasNoteNumber() {
8754      if (this.noteNumber == null)
8755        return false;
8756      for (PositiveIntType item : this.noteNumber)
8757        if (!item.isEmpty())
8758          return true;
8759      return false;
8760    }
8761
8762    /**
8763     * @return {@link #noteNumber} (The numbers associated with notes below which
8764     *         apply to the adjudication of this item.)
8765     */
8766    public PositiveIntType addNoteNumberElement() {// 2
8767      PositiveIntType t = new PositiveIntType();
8768      if (this.noteNumber == null)
8769        this.noteNumber = new ArrayList<PositiveIntType>();
8770      this.noteNumber.add(t);
8771      return t;
8772    }
8773
8774    /**
8775     * @param value {@link #noteNumber} (The numbers associated with notes below
8776     *              which apply to the adjudication of this item.)
8777     */
8778    public SubDetailComponent addNoteNumber(int value) { // 1
8779      PositiveIntType t = new PositiveIntType();
8780      t.setValue(value);
8781      if (this.noteNumber == null)
8782        this.noteNumber = new ArrayList<PositiveIntType>();
8783      this.noteNumber.add(t);
8784      return this;
8785    }
8786
8787    /**
8788     * @param value {@link #noteNumber} (The numbers associated with notes below
8789     *              which apply to the adjudication of this item.)
8790     */
8791    public boolean hasNoteNumber(int value) {
8792      if (this.noteNumber == null)
8793        return false;
8794      for (PositiveIntType v : this.noteNumber)
8795        if (v.getValue().equals(value)) // positiveInt
8796          return true;
8797      return false;
8798    }
8799
8800    /**
8801     * @return {@link #adjudication} (The adjudication results.)
8802     */
8803    public List<AdjudicationComponent> getAdjudication() {
8804      if (this.adjudication == null)
8805        this.adjudication = new ArrayList<AdjudicationComponent>();
8806      return this.adjudication;
8807    }
8808
8809    /**
8810     * @return Returns a reference to <code>this</code> for easy method chaining
8811     */
8812    public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
8813      this.adjudication = theAdjudication;
8814      return this;
8815    }
8816
8817    public boolean hasAdjudication() {
8818      if (this.adjudication == null)
8819        return false;
8820      for (AdjudicationComponent item : this.adjudication)
8821        if (!item.isEmpty())
8822          return true;
8823      return false;
8824    }
8825
8826    public AdjudicationComponent addAdjudication() { // 3
8827      AdjudicationComponent t = new AdjudicationComponent();
8828      if (this.adjudication == null)
8829        this.adjudication = new ArrayList<AdjudicationComponent>();
8830      this.adjudication.add(t);
8831      return t;
8832    }
8833
8834    public SubDetailComponent addAdjudication(AdjudicationComponent t) { // 3
8835      if (t == null)
8836        return this;
8837      if (this.adjudication == null)
8838        this.adjudication = new ArrayList<AdjudicationComponent>();
8839      this.adjudication.add(t);
8840      return this;
8841    }
8842
8843    /**
8844     * @return The first repetition of repeating field {@link #adjudication},
8845     *         creating it if it does not already exist
8846     */
8847    public AdjudicationComponent getAdjudicationFirstRep() {
8848      if (getAdjudication().isEmpty()) {
8849        addAdjudication();
8850      }
8851      return getAdjudication().get(0);
8852    }
8853
8854    protected void listChildren(List<Property> children) {
8855      super.listChildren(children);
8856      children.add(new Property("sequence", "positiveInt",
8857          "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
8858          0, 1, sequence));
8859      children.add(new Property("revenue", "CodeableConcept",
8860          "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
8861      children.add(new Property("category", "CodeableConcept",
8862          "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
8863          category));
8864      children.add(new Property("productOrService", "CodeableConcept",
8865          "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.",
8866          0, 1, productOrService));
8867      children.add(new Property("modifier", "CodeableConcept",
8868          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
8869          java.lang.Integer.MAX_VALUE, modifier));
8870      children.add(new Property("programCode", "CodeableConcept",
8871          "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
8872      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
8873          1, quantity));
8874      children.add(new Property("unitPrice", "Money",
8875          "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.",
8876          0, 1, unitPrice));
8877      children.add(new Property("factor", "decimal",
8878          "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.",
8879          0, 1, factor));
8880      children.add(new Property("net", "Money",
8881          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
8882      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
8883          0, java.lang.Integer.MAX_VALUE, udi));
8884      children.add(new Property("noteNumber", "positiveInt",
8885          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
8886          java.lang.Integer.MAX_VALUE, noteNumber));
8887      children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.",
8888          0, java.lang.Integer.MAX_VALUE, adjudication));
8889    }
8890
8891    @Override
8892    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8893      switch (_hash) {
8894      case 1349547969:
8895        /* sequence */ return new Property("sequence", "positiveInt",
8896            "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
8897            0, 1, sequence);
8898      case 1099842588:
8899        /* revenue */ return new Property("revenue", "CodeableConcept",
8900            "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
8901      case 50511102:
8902        /* category */ return new Property("category", "CodeableConcept",
8903            "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
8904            category);
8905      case 1957227299:
8906        /* productOrService */ return new Property("productOrService", "CodeableConcept",
8907            "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.",
8908            0, 1, productOrService);
8909      case -615513385:
8910        /* modifier */ return new Property("modifier", "CodeableConcept",
8911            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
8912            java.lang.Integer.MAX_VALUE, modifier);
8913      case 1010065041:
8914        /* programCode */ return new Property("programCode", "CodeableConcept",
8915            "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
8916      case -1285004149:
8917        /* quantity */ return new Property("quantity", "SimpleQuantity",
8918            "The number of repetitions of a service or product.", 0, 1, quantity);
8919      case -486196699:
8920        /* unitPrice */ return new Property("unitPrice", "Money",
8921            "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.",
8922            0, 1, unitPrice);
8923      case -1282148017:
8924        /* factor */ return new Property("factor", "decimal",
8925            "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.",
8926            0, 1, factor);
8927      case 108957:
8928        /* net */ return new Property("net", "Money",
8929            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
8930      case 115642:
8931        /* udi */ return new Property("udi", "Reference(Device)",
8932            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
8933      case -1110033957:
8934        /* noteNumber */ return new Property("noteNumber", "positiveInt",
8935            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
8936            java.lang.Integer.MAX_VALUE, noteNumber);
8937      case -231349275:
8938        /* adjudication */ return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
8939            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
8940      default:
8941        return super.getNamedProperty(_hash, _name, _checkValid);
8942      }
8943
8944    }
8945
8946    @Override
8947    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8948      switch (hash) {
8949      case 1349547969:
8950        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
8951      case 1099842588:
8952        /* revenue */ return this.revenue == null ? new Base[0] : new Base[] { this.revenue }; // CodeableConcept
8953      case 50511102:
8954        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
8955      case 1957227299:
8956        /* productOrService */ return this.productOrService == null ? new Base[0]
8957            : new Base[] { this.productOrService }; // CodeableConcept
8958      case -615513385:
8959        /* modifier */ return this.modifier == null ? new Base[0]
8960            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
8961      case 1010065041:
8962        /* programCode */ return this.programCode == null ? new Base[0]
8963            : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
8964      case -1285004149:
8965        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
8966      case -486196699:
8967        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
8968      case -1282148017:
8969        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
8970      case 108957:
8971        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
8972      case 115642:
8973        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
8974      case -1110033957:
8975        /* noteNumber */ return this.noteNumber == null ? new Base[0]
8976            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
8977      case -231349275:
8978        /* adjudication */ return this.adjudication == null ? new Base[0]
8979            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
8980      default:
8981        return super.getProperty(hash, name, checkValid);
8982      }
8983
8984    }
8985
8986    @Override
8987    public Base setProperty(int hash, String name, Base value) throws FHIRException {
8988      switch (hash) {
8989      case 1349547969: // sequence
8990        this.sequence = castToPositiveInt(value); // PositiveIntType
8991        return value;
8992      case 1099842588: // revenue
8993        this.revenue = castToCodeableConcept(value); // CodeableConcept
8994        return value;
8995      case 50511102: // category
8996        this.category = castToCodeableConcept(value); // CodeableConcept
8997        return value;
8998      case 1957227299: // productOrService
8999        this.productOrService = castToCodeableConcept(value); // CodeableConcept
9000        return value;
9001      case -615513385: // modifier
9002        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
9003        return value;
9004      case 1010065041: // programCode
9005        this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
9006        return value;
9007      case -1285004149: // quantity
9008        this.quantity = castToQuantity(value); // Quantity
9009        return value;
9010      case -486196699: // unitPrice
9011        this.unitPrice = castToMoney(value); // Money
9012        return value;
9013      case -1282148017: // factor
9014        this.factor = castToDecimal(value); // DecimalType
9015        return value;
9016      case 108957: // net
9017        this.net = castToMoney(value); // Money
9018        return value;
9019      case 115642: // udi
9020        this.getUdi().add(castToReference(value)); // Reference
9021        return value;
9022      case -1110033957: // noteNumber
9023        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
9024        return value;
9025      case -231349275: // adjudication
9026        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
9027        return value;
9028      default:
9029        return super.setProperty(hash, name, value);
9030      }
9031
9032    }
9033
9034    @Override
9035    public Base setProperty(String name, Base value) throws FHIRException {
9036      if (name.equals("sequence")) {
9037        this.sequence = castToPositiveInt(value); // PositiveIntType
9038      } else if (name.equals("revenue")) {
9039        this.revenue = castToCodeableConcept(value); // CodeableConcept
9040      } else if (name.equals("category")) {
9041        this.category = castToCodeableConcept(value); // CodeableConcept
9042      } else if (name.equals("productOrService")) {
9043        this.productOrService = castToCodeableConcept(value); // CodeableConcept
9044      } else if (name.equals("modifier")) {
9045        this.getModifier().add(castToCodeableConcept(value));
9046      } else if (name.equals("programCode")) {
9047        this.getProgramCode().add(castToCodeableConcept(value));
9048      } else if (name.equals("quantity")) {
9049        this.quantity = castToQuantity(value); // Quantity
9050      } else if (name.equals("unitPrice")) {
9051        this.unitPrice = castToMoney(value); // Money
9052      } else if (name.equals("factor")) {
9053        this.factor = castToDecimal(value); // DecimalType
9054      } else if (name.equals("net")) {
9055        this.net = castToMoney(value); // Money
9056      } else if (name.equals("udi")) {
9057        this.getUdi().add(castToReference(value));
9058      } else if (name.equals("noteNumber")) {
9059        this.getNoteNumber().add(castToPositiveInt(value));
9060      } else if (name.equals("adjudication")) {
9061        this.getAdjudication().add((AdjudicationComponent) value);
9062      } else
9063        return super.setProperty(name, value);
9064      return value;
9065    }
9066
9067  @Override
9068  public void removeChild(String name, Base value) throws FHIRException {
9069      if (name.equals("sequence")) {
9070        this.sequence = null;
9071      } else if (name.equals("revenue")) {
9072        this.revenue = null;
9073      } else if (name.equals("category")) {
9074        this.category = null;
9075      } else if (name.equals("productOrService")) {
9076        this.productOrService = null;
9077      } else if (name.equals("modifier")) {
9078        this.getModifier().remove(castToCodeableConcept(value));
9079      } else if (name.equals("programCode")) {
9080        this.getProgramCode().remove(castToCodeableConcept(value));
9081      } else if (name.equals("quantity")) {
9082        this.quantity = null;
9083      } else if (name.equals("unitPrice")) {
9084        this.unitPrice = null;
9085      } else if (name.equals("factor")) {
9086        this.factor = null;
9087      } else if (name.equals("net")) {
9088        this.net = null;
9089      } else if (name.equals("udi")) {
9090        this.getUdi().remove(castToReference(value));
9091      } else if (name.equals("noteNumber")) {
9092        this.getNoteNumber().remove(castToPositiveInt(value));
9093      } else if (name.equals("adjudication")) {
9094        this.getAdjudication().remove((AdjudicationComponent) value);
9095      } else
9096        super.removeChild(name, value);
9097      
9098    }
9099
9100    @Override
9101    public Base makeProperty(int hash, String name) throws FHIRException {
9102      switch (hash) {
9103      case 1349547969:
9104        return getSequenceElement();
9105      case 1099842588:
9106        return getRevenue();
9107      case 50511102:
9108        return getCategory();
9109      case 1957227299:
9110        return getProductOrService();
9111      case -615513385:
9112        return addModifier();
9113      case 1010065041:
9114        return addProgramCode();
9115      case -1285004149:
9116        return getQuantity();
9117      case -486196699:
9118        return getUnitPrice();
9119      case -1282148017:
9120        return getFactorElement();
9121      case 108957:
9122        return getNet();
9123      case 115642:
9124        return addUdi();
9125      case -1110033957:
9126        return addNoteNumberElement();
9127      case -231349275:
9128        return addAdjudication();
9129      default:
9130        return super.makeProperty(hash, name);
9131      }
9132
9133    }
9134
9135    @Override
9136    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9137      switch (hash) {
9138      case 1349547969:
9139        /* sequence */ return new String[] { "positiveInt" };
9140      case 1099842588:
9141        /* revenue */ return new String[] { "CodeableConcept" };
9142      case 50511102:
9143        /* category */ return new String[] { "CodeableConcept" };
9144      case 1957227299:
9145        /* productOrService */ return new String[] { "CodeableConcept" };
9146      case -615513385:
9147        /* modifier */ return new String[] { "CodeableConcept" };
9148      case 1010065041:
9149        /* programCode */ return new String[] { "CodeableConcept" };
9150      case -1285004149:
9151        /* quantity */ return new String[] { "SimpleQuantity" };
9152      case -486196699:
9153        /* unitPrice */ return new String[] { "Money" };
9154      case -1282148017:
9155        /* factor */ return new String[] { "decimal" };
9156      case 108957:
9157        /* net */ return new String[] { "Money" };
9158      case 115642:
9159        /* udi */ return new String[] { "Reference" };
9160      case -1110033957:
9161        /* noteNumber */ return new String[] { "positiveInt" };
9162      case -231349275:
9163        /* adjudication */ return new String[] { "@ExplanationOfBenefit.item.adjudication" };
9164      default:
9165        return super.getTypesForProperty(hash, name);
9166      }
9167
9168    }
9169
9170    @Override
9171    public Base addChild(String name) throws FHIRException {
9172      if (name.equals("sequence")) {
9173        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
9174      } else if (name.equals("revenue")) {
9175        this.revenue = new CodeableConcept();
9176        return this.revenue;
9177      } else if (name.equals("category")) {
9178        this.category = new CodeableConcept();
9179        return this.category;
9180      } else if (name.equals("productOrService")) {
9181        this.productOrService = new CodeableConcept();
9182        return this.productOrService;
9183      } else if (name.equals("modifier")) {
9184        return addModifier();
9185      } else if (name.equals("programCode")) {
9186        return addProgramCode();
9187      } else if (name.equals("quantity")) {
9188        this.quantity = new Quantity();
9189        return this.quantity;
9190      } else if (name.equals("unitPrice")) {
9191        this.unitPrice = new Money();
9192        return this.unitPrice;
9193      } else if (name.equals("factor")) {
9194        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
9195      } else if (name.equals("net")) {
9196        this.net = new Money();
9197        return this.net;
9198      } else if (name.equals("udi")) {
9199        return addUdi();
9200      } else if (name.equals("noteNumber")) {
9201        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
9202      } else if (name.equals("adjudication")) {
9203        return addAdjudication();
9204      } else
9205        return super.addChild(name);
9206    }
9207
9208    public SubDetailComponent copy() {
9209      SubDetailComponent dst = new SubDetailComponent();
9210      copyValues(dst);
9211      return dst;
9212    }
9213
9214    public void copyValues(SubDetailComponent dst) {
9215      super.copyValues(dst);
9216      dst.sequence = sequence == null ? null : sequence.copy();
9217      dst.revenue = revenue == null ? null : revenue.copy();
9218      dst.category = category == null ? null : category.copy();
9219      dst.productOrService = productOrService == null ? null : productOrService.copy();
9220      if (modifier != null) {
9221        dst.modifier = new ArrayList<CodeableConcept>();
9222        for (CodeableConcept i : modifier)
9223          dst.modifier.add(i.copy());
9224      }
9225      ;
9226      if (programCode != null) {
9227        dst.programCode = new ArrayList<CodeableConcept>();
9228        for (CodeableConcept i : programCode)
9229          dst.programCode.add(i.copy());
9230      }
9231      ;
9232      dst.quantity = quantity == null ? null : quantity.copy();
9233      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
9234      dst.factor = factor == null ? null : factor.copy();
9235      dst.net = net == null ? null : net.copy();
9236      if (udi != null) {
9237        dst.udi = new ArrayList<Reference>();
9238        for (Reference i : udi)
9239          dst.udi.add(i.copy());
9240      }
9241      ;
9242      if (noteNumber != null) {
9243        dst.noteNumber = new ArrayList<PositiveIntType>();
9244        for (PositiveIntType i : noteNumber)
9245          dst.noteNumber.add(i.copy());
9246      }
9247      ;
9248      if (adjudication != null) {
9249        dst.adjudication = new ArrayList<AdjudicationComponent>();
9250        for (AdjudicationComponent i : adjudication)
9251          dst.adjudication.add(i.copy());
9252      }
9253      ;
9254    }
9255
9256    @Override
9257    public boolean equalsDeep(Base other_) {
9258      if (!super.equalsDeep(other_))
9259        return false;
9260      if (!(other_ instanceof SubDetailComponent))
9261        return false;
9262      SubDetailComponent o = (SubDetailComponent) other_;
9263      return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true)
9264          && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
9265          && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
9266          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
9267          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
9268          && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true);
9269    }
9270
9271    @Override
9272    public boolean equalsShallow(Base other_) {
9273      if (!super.equalsShallow(other_))
9274        return false;
9275      if (!(other_ instanceof SubDetailComponent))
9276        return false;
9277      SubDetailComponent o = (SubDetailComponent) other_;
9278      return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true)
9279          && compareValues(noteNumber, o.noteNumber, true);
9280    }
9281
9282    public boolean isEmpty() {
9283      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category, productOrService,
9284          modifier, programCode, quantity, unitPrice, factor, net, udi, noteNumber, adjudication);
9285    }
9286
9287    public String fhirType() {
9288      return "ExplanationOfBenefit.item.detail.subDetail";
9289
9290    }
9291
9292  }
9293
9294  @Block()
9295  public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
9296    /**
9297     * Claim items which this service line is intended to replace.
9298     */
9299    @Child(name = "itemSequence", type = {
9300        PositiveIntType.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9301    @Description(shortDefinition = "Item sequence number", formalDefinition = "Claim items which this service line is intended to replace.")
9302    protected List<PositiveIntType> itemSequence;
9303
9304    /**
9305     * The sequence number of the details within the claim item which this line is
9306     * intended to replace.
9307     */
9308    @Child(name = "detailSequence", type = {
9309        PositiveIntType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9310    @Description(shortDefinition = "Detail sequence number", formalDefinition = "The sequence number of the details within the claim item which this line is intended to replace.")
9311    protected List<PositiveIntType> detailSequence;
9312
9313    /**
9314     * The sequence number of the sub-details woithin the details within the claim
9315     * item which this line is intended to replace.
9316     */
9317    @Child(name = "subDetailSequence", type = {
9318        PositiveIntType.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9319    @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.")
9320    protected List<PositiveIntType> subDetailSequence;
9321
9322    /**
9323     * The providers who are authorized for the services rendered to the patient.
9324     */
9325    @Child(name = "provider", type = { Practitioner.class, PractitionerRole.class,
9326        Organization.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9327    @Description(shortDefinition = "Authorized providers", formalDefinition = "The providers who are authorized for the services rendered to the patient.")
9328    protected List<Reference> provider;
9329    /**
9330     * The actual objects that are the target of the reference (The providers who
9331     * are authorized for the services rendered to the patient.)
9332     */
9333    protected List<Resource> providerTarget;
9334
9335    /**
9336     * When the value is a group code then this item collects a set of related claim
9337     * details, otherwise this contains the product, service, drug or other billing
9338     * code for the item.
9339     */
9340    @Child(name = "productOrService", type = {
9341        CodeableConcept.class }, order = 5, min = 1, max = 1, modifier = false, summary = false)
9342    @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.")
9343    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
9344    protected CodeableConcept productOrService;
9345
9346    /**
9347     * Item typification or modifiers codes to convey additional context for the
9348     * product or service.
9349     */
9350    @Child(name = "modifier", type = {
9351        CodeableConcept.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9352    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
9353    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
9354    protected List<CodeableConcept> modifier;
9355
9356    /**
9357     * Identifies the program under which this may be recovered.
9358     */
9359    @Child(name = "programCode", type = {
9360        CodeableConcept.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9361    @Description(shortDefinition = "Program the product or service is provided under", formalDefinition = "Identifies the program under which this may be recovered.")
9362    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-program-code")
9363    protected List<CodeableConcept> programCode;
9364
9365    /**
9366     * The date or dates when the service or product was supplied, performed or
9367     * completed.
9368     */
9369    @Child(name = "serviced", type = { DateType.class,
9370        Period.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
9371    @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.")
9372    protected Type serviced;
9373
9374    /**
9375     * Where the product or service was provided.
9376     */
9377    @Child(name = "location", type = { CodeableConcept.class, Address.class,
9378        Location.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
9379    @Description(shortDefinition = "Place of service or where product was supplied", formalDefinition = "Where the product or service was provided.")
9380    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-place")
9381    protected Type location;
9382
9383    /**
9384     * The number of repetitions of a service or product.
9385     */
9386    @Child(name = "quantity", type = {
9387        Quantity.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
9388    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
9389    protected Quantity quantity;
9390
9391    /**
9392     * If the item is not a group then this is the fee for the product or service,
9393     * otherwise this is the total of the fees for the details of the group.
9394     */
9395    @Child(name = "unitPrice", type = { Money.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
9396    @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.")
9397    protected Money unitPrice;
9398
9399    /**
9400     * A real number that represents a multiplier used in determining the overall
9401     * value of services delivered and/or goods received. The concept of a Factor
9402     * allows for a discount or surcharge multiplier to be applied to a monetary
9403     * amount.
9404     */
9405    @Child(name = "factor", type = {
9406        DecimalType.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
9407    @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.")
9408    protected DecimalType factor;
9409
9410    /**
9411     * The quantity times the unit price for an additional service or product or
9412     * charge.
9413     */
9414    @Child(name = "net", type = { Money.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
9415    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
9416    protected Money net;
9417
9418    /**
9419     * Physical service site on the patient (limb, tooth, etc.).
9420     */
9421    @Child(name = "bodySite", type = {
9422        CodeableConcept.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
9423    @Description(shortDefinition = "Anatomical location", formalDefinition = "Physical service site on the patient (limb, tooth, etc.).")
9424    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/tooth")
9425    protected CodeableConcept bodySite;
9426
9427    /**
9428     * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
9429     */
9430    @Child(name = "subSite", type = {
9431        CodeableConcept.class }, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9432    @Description(shortDefinition = "Anatomical sub-location", formalDefinition = "A region or surface of the bodySite, e.g. limb region or tooth surface(s).")
9433    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/surface")
9434    protected List<CodeableConcept> subSite;
9435
9436    /**
9437     * The numbers associated with notes below which apply to the adjudication of
9438     * this item.
9439     */
9440    @Child(name = "noteNumber", type = {
9441        PositiveIntType.class }, order = 16, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9442    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
9443    protected List<PositiveIntType> noteNumber;
9444
9445    /**
9446     * The adjudication results.
9447     */
9448    @Child(name = "adjudication", type = {
9449        AdjudicationComponent.class }, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9450    @Description(shortDefinition = "Added items adjudication", formalDefinition = "The adjudication results.")
9451    protected List<AdjudicationComponent> adjudication;
9452
9453    /**
9454     * The second-tier service adjudications for payor added services.
9455     */
9456    @Child(name = "detail", type = {}, order = 18, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9457    @Description(shortDefinition = "Insurer added line items", formalDefinition = "The second-tier service adjudications for payor added services.")
9458    protected List<AddedItemDetailComponent> detail;
9459
9460    private static final long serialVersionUID = -206524210L;
9461
9462    /**
9463     * Constructor
9464     */
9465    public AddedItemComponent() {
9466      super();
9467    }
9468
9469    /**
9470     * Constructor
9471     */
9472    public AddedItemComponent(CodeableConcept productOrService) {
9473      super();
9474      this.productOrService = productOrService;
9475    }
9476
9477    /**
9478     * @return {@link #itemSequence} (Claim items which this service line is
9479     *         intended to replace.)
9480     */
9481    public List<PositiveIntType> getItemSequence() {
9482      if (this.itemSequence == null)
9483        this.itemSequence = new ArrayList<PositiveIntType>();
9484      return this.itemSequence;
9485    }
9486
9487    /**
9488     * @return Returns a reference to <code>this</code> for easy method chaining
9489     */
9490    public AddedItemComponent setItemSequence(List<PositiveIntType> theItemSequence) {
9491      this.itemSequence = theItemSequence;
9492      return this;
9493    }
9494
9495    public boolean hasItemSequence() {
9496      if (this.itemSequence == null)
9497        return false;
9498      for (PositiveIntType item : this.itemSequence)
9499        if (!item.isEmpty())
9500          return true;
9501      return false;
9502    }
9503
9504    /**
9505     * @return {@link #itemSequence} (Claim items which this service line is
9506     *         intended to replace.)
9507     */
9508    public PositiveIntType addItemSequenceElement() {// 2
9509      PositiveIntType t = new PositiveIntType();
9510      if (this.itemSequence == null)
9511        this.itemSequence = new ArrayList<PositiveIntType>();
9512      this.itemSequence.add(t);
9513      return t;
9514    }
9515
9516    /**
9517     * @param value {@link #itemSequence} (Claim items which this service line is
9518     *              intended to replace.)
9519     */
9520    public AddedItemComponent addItemSequence(int value) { // 1
9521      PositiveIntType t = new PositiveIntType();
9522      t.setValue(value);
9523      if (this.itemSequence == null)
9524        this.itemSequence = new ArrayList<PositiveIntType>();
9525      this.itemSequence.add(t);
9526      return this;
9527    }
9528
9529    /**
9530     * @param value {@link #itemSequence} (Claim items which this service line is
9531     *              intended to replace.)
9532     */
9533    public boolean hasItemSequence(int value) {
9534      if (this.itemSequence == null)
9535        return false;
9536      for (PositiveIntType v : this.itemSequence)
9537        if (v.getValue().equals(value)) // positiveInt
9538          return true;
9539      return false;
9540    }
9541
9542    /**
9543     * @return {@link #detailSequence} (The sequence number of the details within
9544     *         the claim item which this line is intended to replace.)
9545     */
9546    public List<PositiveIntType> getDetailSequence() {
9547      if (this.detailSequence == null)
9548        this.detailSequence = new ArrayList<PositiveIntType>();
9549      return this.detailSequence;
9550    }
9551
9552    /**
9553     * @return Returns a reference to <code>this</code> for easy method chaining
9554     */
9555    public AddedItemComponent setDetailSequence(List<PositiveIntType> theDetailSequence) {
9556      this.detailSequence = theDetailSequence;
9557      return this;
9558    }
9559
9560    public boolean hasDetailSequence() {
9561      if (this.detailSequence == null)
9562        return false;
9563      for (PositiveIntType item : this.detailSequence)
9564        if (!item.isEmpty())
9565          return true;
9566      return false;
9567    }
9568
9569    /**
9570     * @return {@link #detailSequence} (The sequence number of the details within
9571     *         the claim item which this line is intended to replace.)
9572     */
9573    public PositiveIntType addDetailSequenceElement() {// 2
9574      PositiveIntType t = new PositiveIntType();
9575      if (this.detailSequence == null)
9576        this.detailSequence = new ArrayList<PositiveIntType>();
9577      this.detailSequence.add(t);
9578      return t;
9579    }
9580
9581    /**
9582     * @param value {@link #detailSequence} (The sequence number of the details
9583     *              within the claim item which this line is intended to replace.)
9584     */
9585    public AddedItemComponent addDetailSequence(int value) { // 1
9586      PositiveIntType t = new PositiveIntType();
9587      t.setValue(value);
9588      if (this.detailSequence == null)
9589        this.detailSequence = new ArrayList<PositiveIntType>();
9590      this.detailSequence.add(t);
9591      return this;
9592    }
9593
9594    /**
9595     * @param value {@link #detailSequence} (The sequence number of the details
9596     *              within the claim item which this line is intended to replace.)
9597     */
9598    public boolean hasDetailSequence(int value) {
9599      if (this.detailSequence == null)
9600        return false;
9601      for (PositiveIntType v : this.detailSequence)
9602        if (v.getValue().equals(value)) // positiveInt
9603          return true;
9604      return false;
9605    }
9606
9607    /**
9608     * @return {@link #subDetailSequence} (The sequence number of the sub-details
9609     *         woithin the details within the claim item which this line is intended
9610     *         to replace.)
9611     */
9612    public List<PositiveIntType> getSubDetailSequence() {
9613      if (this.subDetailSequence == null)
9614        this.subDetailSequence = new ArrayList<PositiveIntType>();
9615      return this.subDetailSequence;
9616    }
9617
9618    /**
9619     * @return Returns a reference to <code>this</code> for easy method chaining
9620     */
9621    public AddedItemComponent setSubDetailSequence(List<PositiveIntType> theSubDetailSequence) {
9622      this.subDetailSequence = theSubDetailSequence;
9623      return this;
9624    }
9625
9626    public boolean hasSubDetailSequence() {
9627      if (this.subDetailSequence == null)
9628        return false;
9629      for (PositiveIntType item : this.subDetailSequence)
9630        if (!item.isEmpty())
9631          return true;
9632      return false;
9633    }
9634
9635    /**
9636     * @return {@link #subDetailSequence} (The sequence number of the sub-details
9637     *         woithin the details within the claim item which this line is intended
9638     *         to replace.)
9639     */
9640    public PositiveIntType addSubDetailSequenceElement() {// 2
9641      PositiveIntType t = new PositiveIntType();
9642      if (this.subDetailSequence == null)
9643        this.subDetailSequence = new ArrayList<PositiveIntType>();
9644      this.subDetailSequence.add(t);
9645      return t;
9646    }
9647
9648    /**
9649     * @param value {@link #subDetailSequence} (The sequence number of the
9650     *              sub-details woithin the details within the claim item which this
9651     *              line is intended to replace.)
9652     */
9653    public AddedItemComponent addSubDetailSequence(int value) { // 1
9654      PositiveIntType t = new PositiveIntType();
9655      t.setValue(value);
9656      if (this.subDetailSequence == null)
9657        this.subDetailSequence = new ArrayList<PositiveIntType>();
9658      this.subDetailSequence.add(t);
9659      return this;
9660    }
9661
9662    /**
9663     * @param value {@link #subDetailSequence} (The sequence number of the
9664     *              sub-details woithin the details within the claim item which this
9665     *              line is intended to replace.)
9666     */
9667    public boolean hasSubDetailSequence(int value) {
9668      if (this.subDetailSequence == null)
9669        return false;
9670      for (PositiveIntType v : this.subDetailSequence)
9671        if (v.getValue().equals(value)) // positiveInt
9672          return true;
9673      return false;
9674    }
9675
9676    /**
9677     * @return {@link #provider} (The providers who are authorized for the services
9678     *         rendered to the patient.)
9679     */
9680    public List<Reference> getProvider() {
9681      if (this.provider == null)
9682        this.provider = new ArrayList<Reference>();
9683      return this.provider;
9684    }
9685
9686    /**
9687     * @return Returns a reference to <code>this</code> for easy method chaining
9688     */
9689    public AddedItemComponent setProvider(List<Reference> theProvider) {
9690      this.provider = theProvider;
9691      return this;
9692    }
9693
9694    public boolean hasProvider() {
9695      if (this.provider == null)
9696        return false;
9697      for (Reference item : this.provider)
9698        if (!item.isEmpty())
9699          return true;
9700      return false;
9701    }
9702
9703    public Reference addProvider() { // 3
9704      Reference t = new Reference();
9705      if (this.provider == null)
9706        this.provider = new ArrayList<Reference>();
9707      this.provider.add(t);
9708      return t;
9709    }
9710
9711    public AddedItemComponent addProvider(Reference t) { // 3
9712      if (t == null)
9713        return this;
9714      if (this.provider == null)
9715        this.provider = new ArrayList<Reference>();
9716      this.provider.add(t);
9717      return this;
9718    }
9719
9720    /**
9721     * @return The first repetition of repeating field {@link #provider}, creating
9722     *         it if it does not already exist
9723     */
9724    public Reference getProviderFirstRep() {
9725      if (getProvider().isEmpty()) {
9726        addProvider();
9727      }
9728      return getProvider().get(0);
9729    }
9730
9731    /**
9732     * @deprecated Use Reference#setResource(IBaseResource) instead
9733     */
9734    @Deprecated
9735    public List<Resource> getProviderTarget() {
9736      if (this.providerTarget == null)
9737        this.providerTarget = new ArrayList<Resource>();
9738      return this.providerTarget;
9739    }
9740
9741    /**
9742     * @return {@link #productOrService} (When the value is a group code then this
9743     *         item collects a set of related claim details, otherwise this contains
9744     *         the product, service, drug or other billing code for the item.)
9745     */
9746    public CodeableConcept getProductOrService() {
9747      if (this.productOrService == null)
9748        if (Configuration.errorOnAutoCreate())
9749          throw new Error("Attempt to auto-create AddedItemComponent.productOrService");
9750        else if (Configuration.doAutoCreate())
9751          this.productOrService = new CodeableConcept(); // cc
9752      return this.productOrService;
9753    }
9754
9755    public boolean hasProductOrService() {
9756      return this.productOrService != null && !this.productOrService.isEmpty();
9757    }
9758
9759    /**
9760     * @param value {@link #productOrService} (When the value is a group code then
9761     *              this item collects a set of related claim details, otherwise
9762     *              this contains the product, service, drug or other billing code
9763     *              for the item.)
9764     */
9765    public AddedItemComponent setProductOrService(CodeableConcept value) {
9766      this.productOrService = value;
9767      return this;
9768    }
9769
9770    /**
9771     * @return {@link #modifier} (Item typification or modifiers codes to convey
9772     *         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 AddedItemComponent 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 AddedItemComponent 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
9816     *         it if it does not already exist
9817     */
9818    public CodeableConcept getModifierFirstRep() {
9819      if (getModifier().isEmpty()) {
9820        addModifier();
9821      }
9822      return getModifier().get(0);
9823    }
9824
9825    /**
9826     * @return {@link #programCode} (Identifies the program under which this may be
9827     *         recovered.)
9828     */
9829    public List<CodeableConcept> getProgramCode() {
9830      if (this.programCode == null)
9831        this.programCode = new ArrayList<CodeableConcept>();
9832      return this.programCode;
9833    }
9834
9835    /**
9836     * @return Returns a reference to <code>this</code> for easy method chaining
9837     */
9838    public AddedItemComponent setProgramCode(List<CodeableConcept> theProgramCode) {
9839      this.programCode = theProgramCode;
9840      return this;
9841    }
9842
9843    public boolean hasProgramCode() {
9844      if (this.programCode == null)
9845        return false;
9846      for (CodeableConcept item : this.programCode)
9847        if (!item.isEmpty())
9848          return true;
9849      return false;
9850    }
9851
9852    public CodeableConcept addProgramCode() { // 3
9853      CodeableConcept t = new CodeableConcept();
9854      if (this.programCode == null)
9855        this.programCode = new ArrayList<CodeableConcept>();
9856      this.programCode.add(t);
9857      return t;
9858    }
9859
9860    public AddedItemComponent addProgramCode(CodeableConcept t) { // 3
9861      if (t == null)
9862        return this;
9863      if (this.programCode == null)
9864        this.programCode = new ArrayList<CodeableConcept>();
9865      this.programCode.add(t);
9866      return this;
9867    }
9868
9869    /**
9870     * @return The first repetition of repeating field {@link #programCode},
9871     *         creating it if it does not already exist
9872     */
9873    public CodeableConcept getProgramCodeFirstRep() {
9874      if (getProgramCode().isEmpty()) {
9875        addProgramCode();
9876      }
9877      return getProgramCode().get(0);
9878    }
9879
9880    /**
9881     * @return {@link #serviced} (The date or dates when the service or product was
9882     *         supplied, performed or completed.)
9883     */
9884    public Type getServiced() {
9885      return this.serviced;
9886    }
9887
9888    /**
9889     * @return {@link #serviced} (The date or dates when the service or product was
9890     *         supplied, performed or completed.)
9891     */
9892    public DateType getServicedDateType() throws FHIRException {
9893      if (this.serviced == null)
9894        this.serviced = new DateType();
9895      if (!(this.serviced instanceof DateType))
9896        throw new FHIRException("Type mismatch: the type DateType was expected, but "
9897            + this.serviced.getClass().getName() + " was encountered");
9898      return (DateType) this.serviced;
9899    }
9900
9901    public boolean hasServicedDateType() {
9902      return this != null && this.serviced instanceof DateType;
9903    }
9904
9905    /**
9906     * @return {@link #serviced} (The date or dates when the service or product was
9907     *         supplied, performed or completed.)
9908     */
9909    public Period getServicedPeriod() throws FHIRException {
9910      if (this.serviced == null)
9911        this.serviced = new Period();
9912      if (!(this.serviced instanceof Period))
9913        throw new FHIRException("Type mismatch: the type Period was expected, but " + this.serviced.getClass().getName()
9914            + " was encountered");
9915      return (Period) this.serviced;
9916    }
9917
9918    public boolean hasServicedPeriod() {
9919      return this != null && this.serviced instanceof Period;
9920    }
9921
9922    public boolean hasServiced() {
9923      return this.serviced != null && !this.serviced.isEmpty();
9924    }
9925
9926    /**
9927     * @param value {@link #serviced} (The date or dates when the service or product
9928     *              was supplied, performed or completed.)
9929     */
9930    public AddedItemComponent setServiced(Type value) {
9931      if (value != null && !(value instanceof DateType || value instanceof Period))
9932        throw new Error("Not the right type for ExplanationOfBenefit.addItem.serviced[x]: " + value.fhirType());
9933      this.serviced = value;
9934      return this;
9935    }
9936
9937    /**
9938     * @return {@link #location} (Where the product or service was provided.)
9939     */
9940    public Type getLocation() {
9941      return this.location;
9942    }
9943
9944    /**
9945     * @return {@link #location} (Where the product or service was provided.)
9946     */
9947    public CodeableConcept getLocationCodeableConcept() throws FHIRException {
9948      if (this.location == null)
9949        this.location = new CodeableConcept();
9950      if (!(this.location instanceof CodeableConcept))
9951        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
9952            + this.location.getClass().getName() + " was encountered");
9953      return (CodeableConcept) this.location;
9954    }
9955
9956    public boolean hasLocationCodeableConcept() {
9957      return this != null && this.location instanceof CodeableConcept;
9958    }
9959
9960    /**
9961     * @return {@link #location} (Where the product or service was provided.)
9962     */
9963    public Address getLocationAddress() throws FHIRException {
9964      if (this.location == null)
9965        this.location = new Address();
9966      if (!(this.location instanceof Address))
9967        throw new FHIRException("Type mismatch: the type Address was expected, but "
9968            + this.location.getClass().getName() + " was encountered");
9969      return (Address) this.location;
9970    }
9971
9972    public boolean hasLocationAddress() {
9973      return this != null && this.location instanceof Address;
9974    }
9975
9976    /**
9977     * @return {@link #location} (Where the product or service was provided.)
9978     */
9979    public Reference getLocationReference() throws FHIRException {
9980      if (this.location == null)
9981        this.location = new Reference();
9982      if (!(this.location instanceof Reference))
9983        throw new FHIRException("Type mismatch: the type Reference was expected, but "
9984            + this.location.getClass().getName() + " was encountered");
9985      return (Reference) this.location;
9986    }
9987
9988    public boolean hasLocationReference() {
9989      return this != null && this.location instanceof Reference;
9990    }
9991
9992    public boolean hasLocation() {
9993      return this.location != null && !this.location.isEmpty();
9994    }
9995
9996    /**
9997     * @param value {@link #location} (Where the product or service was provided.)
9998     */
9999    public AddedItemComponent setLocation(Type value) {
10000      if (value != null
10001          && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
10002        throw new Error("Not the right type for ExplanationOfBenefit.addItem.location[x]: " + value.fhirType());
10003      this.location = value;
10004      return this;
10005    }
10006
10007    /**
10008     * @return {@link #quantity} (The number of repetitions of a service or
10009     *         product.)
10010     */
10011    public Quantity getQuantity() {
10012      if (this.quantity == null)
10013        if (Configuration.errorOnAutoCreate())
10014          throw new Error("Attempt to auto-create AddedItemComponent.quantity");
10015        else if (Configuration.doAutoCreate())
10016          this.quantity = new Quantity(); // cc
10017      return this.quantity;
10018    }
10019
10020    public boolean hasQuantity() {
10021      return this.quantity != null && !this.quantity.isEmpty();
10022    }
10023
10024    /**
10025     * @param value {@link #quantity} (The number of repetitions of a service or
10026     *              product.)
10027     */
10028    public AddedItemComponent setQuantity(Quantity value) {
10029      this.quantity = value;
10030      return this;
10031    }
10032
10033    /**
10034     * @return {@link #unitPrice} (If the item is not a group then this is the fee
10035     *         for the product or service, otherwise this is the total of the fees
10036     *         for the details of the group.)
10037     */
10038    public Money getUnitPrice() {
10039      if (this.unitPrice == null)
10040        if (Configuration.errorOnAutoCreate())
10041          throw new Error("Attempt to auto-create AddedItemComponent.unitPrice");
10042        else if (Configuration.doAutoCreate())
10043          this.unitPrice = new Money(); // cc
10044      return this.unitPrice;
10045    }
10046
10047    public boolean hasUnitPrice() {
10048      return this.unitPrice != null && !this.unitPrice.isEmpty();
10049    }
10050
10051    /**
10052     * @param value {@link #unitPrice} (If the item is not a group then this is the
10053     *              fee for the product or service, otherwise this is the total of
10054     *              the fees for the details of the group.)
10055     */
10056    public AddedItemComponent setUnitPrice(Money value) {
10057      this.unitPrice = value;
10058      return this;
10059    }
10060
10061    /**
10062     * @return {@link #factor} (A real number that represents a multiplier used in
10063     *         determining the overall value of services delivered and/or goods
10064     *         received. The concept of a Factor allows for a discount or surcharge
10065     *         multiplier to be applied to a monetary amount.). This is the
10066     *         underlying object with id, value and extensions. The accessor
10067     *         "getFactor" gives direct access to the value
10068     */
10069    public DecimalType getFactorElement() {
10070      if (this.factor == null)
10071        if (Configuration.errorOnAutoCreate())
10072          throw new Error("Attempt to auto-create AddedItemComponent.factor");
10073        else if (Configuration.doAutoCreate())
10074          this.factor = new DecimalType(); // bb
10075      return this.factor;
10076    }
10077
10078    public boolean hasFactorElement() {
10079      return this.factor != null && !this.factor.isEmpty();
10080    }
10081
10082    public boolean hasFactor() {
10083      return this.factor != null && !this.factor.isEmpty();
10084    }
10085
10086    /**
10087     * @param value {@link #factor} (A real number that represents a multiplier used
10088     *              in determining the overall value of services delivered and/or
10089     *              goods received. The concept of a Factor allows for a discount or
10090     *              surcharge multiplier to be applied to a monetary amount.). This
10091     *              is the underlying object with id, value and extensions. The
10092     *              accessor "getFactor" gives direct access to the value
10093     */
10094    public AddedItemComponent setFactorElement(DecimalType value) {
10095      this.factor = value;
10096      return this;
10097    }
10098
10099    /**
10100     * @return A real number that represents a multiplier used in determining the
10101     *         overall value of services delivered and/or goods received. The
10102     *         concept of a Factor allows for a discount or surcharge multiplier to
10103     *         be applied to a monetary amount.
10104     */
10105    public BigDecimal getFactor() {
10106      return this.factor == null ? null : this.factor.getValue();
10107    }
10108
10109    /**
10110     * @param value A real number that represents a multiplier used in determining
10111     *              the overall value of services delivered and/or goods received.
10112     *              The concept of a Factor allows for a discount or surcharge
10113     *              multiplier to be applied to a monetary amount.
10114     */
10115    public AddedItemComponent setFactor(BigDecimal value) {
10116      if (value == null)
10117        this.factor = null;
10118      else {
10119        if (this.factor == null)
10120          this.factor = new DecimalType();
10121        this.factor.setValue(value);
10122      }
10123      return this;
10124    }
10125
10126    /**
10127     * @param value A real number that represents a multiplier used in determining
10128     *              the overall value of services delivered and/or goods received.
10129     *              The concept of a Factor allows for a discount or surcharge
10130     *              multiplier to be applied to a monetary amount.
10131     */
10132    public AddedItemComponent setFactor(long value) {
10133      this.factor = new DecimalType();
10134      this.factor.setValue(value);
10135      return this;
10136    }
10137
10138    /**
10139     * @param value A real number that represents a multiplier used in determining
10140     *              the overall value of services delivered and/or goods received.
10141     *              The concept of a Factor allows for a discount or surcharge
10142     *              multiplier to be applied to a monetary amount.
10143     */
10144    public AddedItemComponent setFactor(double value) {
10145      this.factor = new DecimalType();
10146      this.factor.setValue(value);
10147      return this;
10148    }
10149
10150    /**
10151     * @return {@link #net} (The quantity times the unit price for an additional
10152     *         service or product or charge.)
10153     */
10154    public Money getNet() {
10155      if (this.net == null)
10156        if (Configuration.errorOnAutoCreate())
10157          throw new Error("Attempt to auto-create AddedItemComponent.net");
10158        else if (Configuration.doAutoCreate())
10159          this.net = new Money(); // cc
10160      return this.net;
10161    }
10162
10163    public boolean hasNet() {
10164      return this.net != null && !this.net.isEmpty();
10165    }
10166
10167    /**
10168     * @param value {@link #net} (The quantity times the unit price for an
10169     *              additional service or product or charge.)
10170     */
10171    public AddedItemComponent setNet(Money value) {
10172      this.net = value;
10173      return this;
10174    }
10175
10176    /**
10177     * @return {@link #bodySite} (Physical service site on the patient (limb, tooth,
10178     *         etc.).)
10179     */
10180    public CodeableConcept getBodySite() {
10181      if (this.bodySite == null)
10182        if (Configuration.errorOnAutoCreate())
10183          throw new Error("Attempt to auto-create AddedItemComponent.bodySite");
10184        else if (Configuration.doAutoCreate())
10185          this.bodySite = new CodeableConcept(); // cc
10186      return this.bodySite;
10187    }
10188
10189    public boolean hasBodySite() {
10190      return this.bodySite != null && !this.bodySite.isEmpty();
10191    }
10192
10193    /**
10194     * @param value {@link #bodySite} (Physical service site on the patient (limb,
10195     *              tooth, etc.).)
10196     */
10197    public AddedItemComponent setBodySite(CodeableConcept value) {
10198      this.bodySite = value;
10199      return this;
10200    }
10201
10202    /**
10203     * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb
10204     *         region or tooth surface(s).)
10205     */
10206    public List<CodeableConcept> getSubSite() {
10207      if (this.subSite == null)
10208        this.subSite = new ArrayList<CodeableConcept>();
10209      return this.subSite;
10210    }
10211
10212    /**
10213     * @return Returns a reference to <code>this</code> for easy method chaining
10214     */
10215    public AddedItemComponent setSubSite(List<CodeableConcept> theSubSite) {
10216      this.subSite = theSubSite;
10217      return this;
10218    }
10219
10220    public boolean hasSubSite() {
10221      if (this.subSite == null)
10222        return false;
10223      for (CodeableConcept item : this.subSite)
10224        if (!item.isEmpty())
10225          return true;
10226      return false;
10227    }
10228
10229    public CodeableConcept addSubSite() { // 3
10230      CodeableConcept t = new CodeableConcept();
10231      if (this.subSite == null)
10232        this.subSite = new ArrayList<CodeableConcept>();
10233      this.subSite.add(t);
10234      return t;
10235    }
10236
10237    public AddedItemComponent addSubSite(CodeableConcept t) { // 3
10238      if (t == null)
10239        return this;
10240      if (this.subSite == null)
10241        this.subSite = new ArrayList<CodeableConcept>();
10242      this.subSite.add(t);
10243      return this;
10244    }
10245
10246    /**
10247     * @return The first repetition of repeating field {@link #subSite}, creating it
10248     *         if it does not already exist
10249     */
10250    public CodeableConcept getSubSiteFirstRep() {
10251      if (getSubSite().isEmpty()) {
10252        addSubSite();
10253      }
10254      return getSubSite().get(0);
10255    }
10256
10257    /**
10258     * @return {@link #noteNumber} (The numbers associated with notes below which
10259     *         apply to the adjudication of this item.)
10260     */
10261    public List<PositiveIntType> getNoteNumber() {
10262      if (this.noteNumber == null)
10263        this.noteNumber = new ArrayList<PositiveIntType>();
10264      return this.noteNumber;
10265    }
10266
10267    /**
10268     * @return Returns a reference to <code>this</code> for easy method chaining
10269     */
10270    public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
10271      this.noteNumber = theNoteNumber;
10272      return this;
10273    }
10274
10275    public boolean hasNoteNumber() {
10276      if (this.noteNumber == null)
10277        return false;
10278      for (PositiveIntType item : this.noteNumber)
10279        if (!item.isEmpty())
10280          return true;
10281      return false;
10282    }
10283
10284    /**
10285     * @return {@link #noteNumber} (The numbers associated with notes below which
10286     *         apply to the adjudication of this item.)
10287     */
10288    public PositiveIntType addNoteNumberElement() {// 2
10289      PositiveIntType t = new PositiveIntType();
10290      if (this.noteNumber == null)
10291        this.noteNumber = new ArrayList<PositiveIntType>();
10292      this.noteNumber.add(t);
10293      return t;
10294    }
10295
10296    /**
10297     * @param value {@link #noteNumber} (The numbers associated with notes below
10298     *              which apply to the adjudication of this item.)
10299     */
10300    public AddedItemComponent addNoteNumber(int value) { // 1
10301      PositiveIntType t = new PositiveIntType();
10302      t.setValue(value);
10303      if (this.noteNumber == null)
10304        this.noteNumber = new ArrayList<PositiveIntType>();
10305      this.noteNumber.add(t);
10306      return this;
10307    }
10308
10309    /**
10310     * @param value {@link #noteNumber} (The numbers associated with notes below
10311     *              which apply to the adjudication of this item.)
10312     */
10313    public boolean hasNoteNumber(int value) {
10314      if (this.noteNumber == null)
10315        return false;
10316      for (PositiveIntType v : this.noteNumber)
10317        if (v.getValue().equals(value)) // positiveInt
10318          return true;
10319      return false;
10320    }
10321
10322    /**
10323     * @return {@link #adjudication} (The adjudication results.)
10324     */
10325    public List<AdjudicationComponent> getAdjudication() {
10326      if (this.adjudication == null)
10327        this.adjudication = new ArrayList<AdjudicationComponent>();
10328      return this.adjudication;
10329    }
10330
10331    /**
10332     * @return Returns a reference to <code>this</code> for easy method chaining
10333     */
10334    public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
10335      this.adjudication = theAdjudication;
10336      return this;
10337    }
10338
10339    public boolean hasAdjudication() {
10340      if (this.adjudication == null)
10341        return false;
10342      for (AdjudicationComponent item : this.adjudication)
10343        if (!item.isEmpty())
10344          return true;
10345      return false;
10346    }
10347
10348    public AdjudicationComponent addAdjudication() { // 3
10349      AdjudicationComponent t = new AdjudicationComponent();
10350      if (this.adjudication == null)
10351        this.adjudication = new ArrayList<AdjudicationComponent>();
10352      this.adjudication.add(t);
10353      return t;
10354    }
10355
10356    public AddedItemComponent addAdjudication(AdjudicationComponent t) { // 3
10357      if (t == null)
10358        return this;
10359      if (this.adjudication == null)
10360        this.adjudication = new ArrayList<AdjudicationComponent>();
10361      this.adjudication.add(t);
10362      return this;
10363    }
10364
10365    /**
10366     * @return The first repetition of repeating field {@link #adjudication},
10367     *         creating it if it does not already exist
10368     */
10369    public AdjudicationComponent getAdjudicationFirstRep() {
10370      if (getAdjudication().isEmpty()) {
10371        addAdjudication();
10372      }
10373      return getAdjudication().get(0);
10374    }
10375
10376    /**
10377     * @return {@link #detail} (The second-tier service adjudications for payor
10378     *         added services.)
10379     */
10380    public List<AddedItemDetailComponent> getDetail() {
10381      if (this.detail == null)
10382        this.detail = new ArrayList<AddedItemDetailComponent>();
10383      return this.detail;
10384    }
10385
10386    /**
10387     * @return Returns a reference to <code>this</code> for easy method chaining
10388     */
10389    public AddedItemComponent setDetail(List<AddedItemDetailComponent> theDetail) {
10390      this.detail = theDetail;
10391      return this;
10392    }
10393
10394    public boolean hasDetail() {
10395      if (this.detail == null)
10396        return false;
10397      for (AddedItemDetailComponent item : this.detail)
10398        if (!item.isEmpty())
10399          return true;
10400      return false;
10401    }
10402
10403    public AddedItemDetailComponent addDetail() { // 3
10404      AddedItemDetailComponent t = new AddedItemDetailComponent();
10405      if (this.detail == null)
10406        this.detail = new ArrayList<AddedItemDetailComponent>();
10407      this.detail.add(t);
10408      return t;
10409    }
10410
10411    public AddedItemComponent addDetail(AddedItemDetailComponent t) { // 3
10412      if (t == null)
10413        return this;
10414      if (this.detail == null)
10415        this.detail = new ArrayList<AddedItemDetailComponent>();
10416      this.detail.add(t);
10417      return this;
10418    }
10419
10420    /**
10421     * @return The first repetition of repeating field {@link #detail}, creating it
10422     *         if it does not already exist
10423     */
10424    public AddedItemDetailComponent getDetailFirstRep() {
10425      if (getDetail().isEmpty()) {
10426        addDetail();
10427      }
10428      return getDetail().get(0);
10429    }
10430
10431    protected void listChildren(List<Property> children) {
10432      super.listChildren(children);
10433      children.add(new Property("itemSequence", "positiveInt",
10434          "Claim items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, itemSequence));
10435      children.add(new Property("detailSequence", "positiveInt",
10436          "The sequence number of the details within the claim item which this line is intended to replace.", 0,
10437          java.lang.Integer.MAX_VALUE, detailSequence));
10438      children.add(new Property("subDetailSequence", "positiveInt",
10439          "The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.",
10440          0, java.lang.Integer.MAX_VALUE, subDetailSequence));
10441      children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
10442          "The providers who are authorized for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE,
10443          provider));
10444      children.add(new Property("productOrService", "CodeableConcept",
10445          "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.",
10446          0, 1, productOrService));
10447      children.add(new Property("modifier", "CodeableConcept",
10448          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
10449          java.lang.Integer.MAX_VALUE, modifier));
10450      children.add(new Property("programCode", "CodeableConcept",
10451          "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
10452      children.add(new Property("serviced[x]", "date|Period",
10453          "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced));
10454      children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
10455          "Where the product or service was provided.", 0, 1, location));
10456      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
10457          1, quantity));
10458      children.add(new Property("unitPrice", "Money",
10459          "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.",
10460          0, 1, unitPrice));
10461      children.add(new Property("factor", "decimal",
10462          "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.",
10463          0, 1, factor));
10464      children.add(new Property("net", "Money",
10465          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
10466      children.add(new Property("bodySite", "CodeableConcept",
10467          "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
10468      children.add(new Property("subSite", "CodeableConcept",
10469          "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE,
10470          subSite));
10471      children.add(new Property("noteNumber", "positiveInt",
10472          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
10473          java.lang.Integer.MAX_VALUE, noteNumber));
10474      children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.",
10475          0, java.lang.Integer.MAX_VALUE, adjudication));
10476      children.add(new Property("detail", "", "The second-tier service adjudications for payor added services.", 0,
10477          java.lang.Integer.MAX_VALUE, detail));
10478    }
10479
10480    @Override
10481    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10482      switch (_hash) {
10483      case 1977979892:
10484        /* itemSequence */ return new Property("itemSequence", "positiveInt",
10485            "Claim items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE,
10486            itemSequence);
10487      case 1321472818:
10488        /* detailSequence */ return new Property("detailSequence", "positiveInt",
10489            "The sequence number of the details within the claim item which this line is intended to replace.", 0,
10490            java.lang.Integer.MAX_VALUE, detailSequence);
10491      case -855462510:
10492        /* subDetailSequence */ return new Property("subDetailSequence", "positiveInt",
10493            "The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.",
10494            0, java.lang.Integer.MAX_VALUE, subDetailSequence);
10495      case -987494927:
10496        /* provider */ return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
10497            "The providers who are authorized for the services rendered to the patient.", 0,
10498            java.lang.Integer.MAX_VALUE, provider);
10499      case 1957227299:
10500        /* productOrService */ return new Property("productOrService", "CodeableConcept",
10501            "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.",
10502            0, 1, productOrService);
10503      case -615513385:
10504        /* modifier */ return new Property("modifier", "CodeableConcept",
10505            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
10506            java.lang.Integer.MAX_VALUE, modifier);
10507      case 1010065041:
10508        /* programCode */ return new Property("programCode", "CodeableConcept",
10509            "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
10510      case -1927922223:
10511        /* serviced[x] */ return new Property("serviced[x]", "date|Period",
10512            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
10513      case 1379209295:
10514        /* serviced */ return new Property("serviced[x]", "date|Period",
10515            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
10516      case 363246749:
10517        /* servicedDate */ return new Property("serviced[x]", "date|Period",
10518            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
10519      case 1534966512:
10520        /* servicedPeriod */ return new Property("serviced[x]", "date|Period",
10521            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
10522      case 552316075:
10523        /* location[x] */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
10524            "Where the product or service was provided.", 0, 1, location);
10525      case 1901043637:
10526        /* location */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
10527            "Where the product or service was provided.", 0, 1, location);
10528      case -1224800468:
10529        /* locationCodeableConcept */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
10530            "Where the product or service was provided.", 0, 1, location);
10531      case -1280020865:
10532        /* locationAddress */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
10533            "Where the product or service was provided.", 0, 1, location);
10534      case 755866390:
10535        /* locationReference */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
10536            "Where the product or service was provided.", 0, 1, location);
10537      case -1285004149:
10538        /* quantity */ return new Property("quantity", "SimpleQuantity",
10539            "The number of repetitions of a service or product.", 0, 1, quantity);
10540      case -486196699:
10541        /* unitPrice */ return new Property("unitPrice", "Money",
10542            "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.",
10543            0, 1, unitPrice);
10544      case -1282148017:
10545        /* factor */ return new Property("factor", "decimal",
10546            "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.",
10547            0, 1, factor);
10548      case 108957:
10549        /* net */ return new Property("net", "Money",
10550            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
10551      case 1702620169:
10552        /* bodySite */ return new Property("bodySite", "CodeableConcept",
10553            "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
10554      case -1868566105:
10555        /* subSite */ return new Property("subSite", "CodeableConcept",
10556            "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0,
10557            java.lang.Integer.MAX_VALUE, subSite);
10558      case -1110033957:
10559        /* noteNumber */ return new Property("noteNumber", "positiveInt",
10560            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
10561            java.lang.Integer.MAX_VALUE, noteNumber);
10562      case -231349275:
10563        /* adjudication */ return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
10564            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
10565      case -1335224239:
10566        /* detail */ return new Property("detail", "",
10567            "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail);
10568      default:
10569        return super.getNamedProperty(_hash, _name, _checkValid);
10570      }
10571
10572    }
10573
10574    @Override
10575    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10576      switch (hash) {
10577      case 1977979892:
10578        /* itemSequence */ return this.itemSequence == null ? new Base[0]
10579            : this.itemSequence.toArray(new Base[this.itemSequence.size()]); // PositiveIntType
10580      case 1321472818:
10581        /* detailSequence */ return this.detailSequence == null ? new Base[0]
10582            : this.detailSequence.toArray(new Base[this.detailSequence.size()]); // PositiveIntType
10583      case -855462510:
10584        /* subDetailSequence */ return this.subDetailSequence == null ? new Base[0]
10585            : this.subDetailSequence.toArray(new Base[this.subDetailSequence.size()]); // PositiveIntType
10586      case -987494927:
10587        /* provider */ return this.provider == null ? new Base[0]
10588            : this.provider.toArray(new Base[this.provider.size()]); // Reference
10589      case 1957227299:
10590        /* productOrService */ return this.productOrService == null ? new Base[0]
10591            : new Base[] { this.productOrService }; // CodeableConcept
10592      case -615513385:
10593        /* modifier */ return this.modifier == null ? new Base[0]
10594            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
10595      case 1010065041:
10596        /* programCode */ return this.programCode == null ? new Base[0]
10597            : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
10598      case 1379209295:
10599        /* serviced */ return this.serviced == null ? new Base[0] : new Base[] { this.serviced }; // Type
10600      case 1901043637:
10601        /* location */ return this.location == null ? new Base[0] : new Base[] { this.location }; // Type
10602      case -1285004149:
10603        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
10604      case -486196699:
10605        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
10606      case -1282148017:
10607        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
10608      case 108957:
10609        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
10610      case 1702620169:
10611        /* bodySite */ return this.bodySite == null ? new Base[0] : new Base[] { this.bodySite }; // CodeableConcept
10612      case -1868566105:
10613        /* subSite */ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
10614      case -1110033957:
10615        /* noteNumber */ return this.noteNumber == null ? new Base[0]
10616            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
10617      case -231349275:
10618        /* adjudication */ return this.adjudication == null ? new Base[0]
10619            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
10620      case -1335224239:
10621        /* detail */ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemDetailComponent
10622      default:
10623        return super.getProperty(hash, name, checkValid);
10624      }
10625
10626    }
10627
10628    @Override
10629    public Base setProperty(int hash, String name, Base value) throws FHIRException {
10630      switch (hash) {
10631      case 1977979892: // itemSequence
10632        this.getItemSequence().add(castToPositiveInt(value)); // PositiveIntType
10633        return value;
10634      case 1321472818: // detailSequence
10635        this.getDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
10636        return value;
10637      case -855462510: // subDetailSequence
10638        this.getSubDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
10639        return value;
10640      case -987494927: // provider
10641        this.getProvider().add(castToReference(value)); // Reference
10642        return value;
10643      case 1957227299: // productOrService
10644        this.productOrService = castToCodeableConcept(value); // CodeableConcept
10645        return value;
10646      case -615513385: // modifier
10647        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
10648        return value;
10649      case 1010065041: // programCode
10650        this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
10651        return value;
10652      case 1379209295: // serviced
10653        this.serviced = castToType(value); // Type
10654        return value;
10655      case 1901043637: // location
10656        this.location = castToType(value); // Type
10657        return value;
10658      case -1285004149: // quantity
10659        this.quantity = castToQuantity(value); // Quantity
10660        return value;
10661      case -486196699: // unitPrice
10662        this.unitPrice = castToMoney(value); // Money
10663        return value;
10664      case -1282148017: // factor
10665        this.factor = castToDecimal(value); // DecimalType
10666        return value;
10667      case 108957: // net
10668        this.net = castToMoney(value); // Money
10669        return value;
10670      case 1702620169: // bodySite
10671        this.bodySite = castToCodeableConcept(value); // CodeableConcept
10672        return value;
10673      case -1868566105: // subSite
10674        this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
10675        return value;
10676      case -1110033957: // noteNumber
10677        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
10678        return value;
10679      case -231349275: // adjudication
10680        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
10681        return value;
10682      case -1335224239: // detail
10683        this.getDetail().add((AddedItemDetailComponent) value); // AddedItemDetailComponent
10684        return value;
10685      default:
10686        return super.setProperty(hash, name, value);
10687      }
10688
10689    }
10690
10691    @Override
10692    public Base setProperty(String name, Base value) throws FHIRException {
10693      if (name.equals("itemSequence")) {
10694        this.getItemSequence().add(castToPositiveInt(value));
10695      } else if (name.equals("detailSequence")) {
10696        this.getDetailSequence().add(castToPositiveInt(value));
10697      } else if (name.equals("subDetailSequence")) {
10698        this.getSubDetailSequence().add(castToPositiveInt(value));
10699      } else if (name.equals("provider")) {
10700        this.getProvider().add(castToReference(value));
10701      } else if (name.equals("productOrService")) {
10702        this.productOrService = castToCodeableConcept(value); // CodeableConcept
10703      } else if (name.equals("modifier")) {
10704        this.getModifier().add(castToCodeableConcept(value));
10705      } else if (name.equals("programCode")) {
10706        this.getProgramCode().add(castToCodeableConcept(value));
10707      } else if (name.equals("serviced[x]")) {
10708        this.serviced = castToType(value); // Type
10709      } else if (name.equals("location[x]")) {
10710        this.location = castToType(value); // Type
10711      } else if (name.equals("quantity")) {
10712        this.quantity = castToQuantity(value); // Quantity
10713      } else if (name.equals("unitPrice")) {
10714        this.unitPrice = castToMoney(value); // Money
10715      } else if (name.equals("factor")) {
10716        this.factor = castToDecimal(value); // DecimalType
10717      } else if (name.equals("net")) {
10718        this.net = castToMoney(value); // Money
10719      } else if (name.equals("bodySite")) {
10720        this.bodySite = castToCodeableConcept(value); // CodeableConcept
10721      } else if (name.equals("subSite")) {
10722        this.getSubSite().add(castToCodeableConcept(value));
10723      } else if (name.equals("noteNumber")) {
10724        this.getNoteNumber().add(castToPositiveInt(value));
10725      } else if (name.equals("adjudication")) {
10726        this.getAdjudication().add((AdjudicationComponent) value);
10727      } else if (name.equals("detail")) {
10728        this.getDetail().add((AddedItemDetailComponent) value);
10729      } else
10730        return super.setProperty(name, value);
10731      return value;
10732    }
10733
10734  @Override
10735  public void removeChild(String name, Base value) throws FHIRException {
10736      if (name.equals("itemSequence")) {
10737        this.getItemSequence().remove(castToPositiveInt(value));
10738      } else if (name.equals("detailSequence")) {
10739        this.getDetailSequence().remove(castToPositiveInt(value));
10740      } else if (name.equals("subDetailSequence")) {
10741        this.getSubDetailSequence().remove(castToPositiveInt(value));
10742      } else if (name.equals("provider")) {
10743        this.getProvider().remove(castToReference(value));
10744      } else if (name.equals("productOrService")) {
10745        this.productOrService = null;
10746      } else if (name.equals("modifier")) {
10747        this.getModifier().remove(castToCodeableConcept(value));
10748      } else if (name.equals("programCode")) {
10749        this.getProgramCode().remove(castToCodeableConcept(value));
10750      } else if (name.equals("serviced[x]")) {
10751        this.serviced = null;
10752      } else if (name.equals("location[x]")) {
10753        this.location = null;
10754      } else if (name.equals("quantity")) {
10755        this.quantity = null;
10756      } else if (name.equals("unitPrice")) {
10757        this.unitPrice = null;
10758      } else if (name.equals("factor")) {
10759        this.factor = null;
10760      } else if (name.equals("net")) {
10761        this.net = null;
10762      } else if (name.equals("bodySite")) {
10763        this.bodySite = null;
10764      } else if (name.equals("subSite")) {
10765        this.getSubSite().remove(castToCodeableConcept(value));
10766      } else if (name.equals("noteNumber")) {
10767        this.getNoteNumber().remove(castToPositiveInt(value));
10768      } else if (name.equals("adjudication")) {
10769        this.getAdjudication().remove((AdjudicationComponent) value);
10770      } else if (name.equals("detail")) {
10771        this.getDetail().remove((AddedItemDetailComponent) value);
10772      } else
10773        super.removeChild(name, value);
10774      
10775    }
10776
10777    @Override
10778    public Base makeProperty(int hash, String name) throws FHIRException {
10779      switch (hash) {
10780      case 1977979892:
10781        return addItemSequenceElement();
10782      case 1321472818:
10783        return addDetailSequenceElement();
10784      case -855462510:
10785        return addSubDetailSequenceElement();
10786      case -987494927:
10787        return addProvider();
10788      case 1957227299:
10789        return getProductOrService();
10790      case -615513385:
10791        return addModifier();
10792      case 1010065041:
10793        return addProgramCode();
10794      case -1927922223:
10795        return getServiced();
10796      case 1379209295:
10797        return getServiced();
10798      case 552316075:
10799        return getLocation();
10800      case 1901043637:
10801        return getLocation();
10802      case -1285004149:
10803        return getQuantity();
10804      case -486196699:
10805        return getUnitPrice();
10806      case -1282148017:
10807        return getFactorElement();
10808      case 108957:
10809        return getNet();
10810      case 1702620169:
10811        return getBodySite();
10812      case -1868566105:
10813        return addSubSite();
10814      case -1110033957:
10815        return addNoteNumberElement();
10816      case -231349275:
10817        return addAdjudication();
10818      case -1335224239:
10819        return addDetail();
10820      default:
10821        return super.makeProperty(hash, name);
10822      }
10823
10824    }
10825
10826    @Override
10827    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10828      switch (hash) {
10829      case 1977979892:
10830        /* itemSequence */ return new String[] { "positiveInt" };
10831      case 1321472818:
10832        /* detailSequence */ return new String[] { "positiveInt" };
10833      case -855462510:
10834        /* subDetailSequence */ return new String[] { "positiveInt" };
10835      case -987494927:
10836        /* provider */ return new String[] { "Reference" };
10837      case 1957227299:
10838        /* productOrService */ return new String[] { "CodeableConcept" };
10839      case -615513385:
10840        /* modifier */ return new String[] { "CodeableConcept" };
10841      case 1010065041:
10842        /* programCode */ return new String[] { "CodeableConcept" };
10843      case 1379209295:
10844        /* serviced */ return new String[] { "date", "Period" };
10845      case 1901043637:
10846        /* location */ return new String[] { "CodeableConcept", "Address", "Reference" };
10847      case -1285004149:
10848        /* quantity */ return new String[] { "SimpleQuantity" };
10849      case -486196699:
10850        /* unitPrice */ return new String[] { "Money" };
10851      case -1282148017:
10852        /* factor */ return new String[] { "decimal" };
10853      case 108957:
10854        /* net */ return new String[] { "Money" };
10855      case 1702620169:
10856        /* bodySite */ return new String[] { "CodeableConcept" };
10857      case -1868566105:
10858        /* subSite */ return new String[] { "CodeableConcept" };
10859      case -1110033957:
10860        /* noteNumber */ return new String[] { "positiveInt" };
10861      case -231349275:
10862        /* adjudication */ return new String[] { "@ExplanationOfBenefit.item.adjudication" };
10863      case -1335224239:
10864        /* detail */ return new String[] {};
10865      default:
10866        return super.getTypesForProperty(hash, name);
10867      }
10868
10869    }
10870
10871    @Override
10872    public Base addChild(String name) throws FHIRException {
10873      if (name.equals("itemSequence")) {
10874        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.itemSequence");
10875      } else if (name.equals("detailSequence")) {
10876        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.detailSequence");
10877      } else if (name.equals("subDetailSequence")) {
10878        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.subDetailSequence");
10879      } else if (name.equals("provider")) {
10880        return addProvider();
10881      } else if (name.equals("productOrService")) {
10882        this.productOrService = new CodeableConcept();
10883        return this.productOrService;
10884      } else if (name.equals("modifier")) {
10885        return addModifier();
10886      } else if (name.equals("programCode")) {
10887        return addProgramCode();
10888      } else if (name.equals("servicedDate")) {
10889        this.serviced = new DateType();
10890        return this.serviced;
10891      } else if (name.equals("servicedPeriod")) {
10892        this.serviced = new Period();
10893        return this.serviced;
10894      } else if (name.equals("locationCodeableConcept")) {
10895        this.location = new CodeableConcept();
10896        return this.location;
10897      } else if (name.equals("locationAddress")) {
10898        this.location = new Address();
10899        return this.location;
10900      } else if (name.equals("locationReference")) {
10901        this.location = new Reference();
10902        return this.location;
10903      } else if (name.equals("quantity")) {
10904        this.quantity = new Quantity();
10905        return this.quantity;
10906      } else if (name.equals("unitPrice")) {
10907        this.unitPrice = new Money();
10908        return this.unitPrice;
10909      } else if (name.equals("factor")) {
10910        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
10911      } else if (name.equals("net")) {
10912        this.net = new Money();
10913        return this.net;
10914      } else if (name.equals("bodySite")) {
10915        this.bodySite = new CodeableConcept();
10916        return this.bodySite;
10917      } else if (name.equals("subSite")) {
10918        return addSubSite();
10919      } else if (name.equals("noteNumber")) {
10920        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
10921      } else if (name.equals("adjudication")) {
10922        return addAdjudication();
10923      } else if (name.equals("detail")) {
10924        return addDetail();
10925      } else
10926        return super.addChild(name);
10927    }
10928
10929    public AddedItemComponent copy() {
10930      AddedItemComponent dst = new AddedItemComponent();
10931      copyValues(dst);
10932      return dst;
10933    }
10934
10935    public void copyValues(AddedItemComponent dst) {
10936      super.copyValues(dst);
10937      if (itemSequence != null) {
10938        dst.itemSequence = new ArrayList<PositiveIntType>();
10939        for (PositiveIntType i : itemSequence)
10940          dst.itemSequence.add(i.copy());
10941      }
10942      ;
10943      if (detailSequence != null) {
10944        dst.detailSequence = new ArrayList<PositiveIntType>();
10945        for (PositiveIntType i : detailSequence)
10946          dst.detailSequence.add(i.copy());
10947      }
10948      ;
10949      if (subDetailSequence != null) {
10950        dst.subDetailSequence = new ArrayList<PositiveIntType>();
10951        for (PositiveIntType i : subDetailSequence)
10952          dst.subDetailSequence.add(i.copy());
10953      }
10954      ;
10955      if (provider != null) {
10956        dst.provider = new ArrayList<Reference>();
10957        for (Reference i : provider)
10958          dst.provider.add(i.copy());
10959      }
10960      ;
10961      dst.productOrService = productOrService == null ? null : productOrService.copy();
10962      if (modifier != null) {
10963        dst.modifier = new ArrayList<CodeableConcept>();
10964        for (CodeableConcept i : modifier)
10965          dst.modifier.add(i.copy());
10966      }
10967      ;
10968      if (programCode != null) {
10969        dst.programCode = new ArrayList<CodeableConcept>();
10970        for (CodeableConcept i : programCode)
10971          dst.programCode.add(i.copy());
10972      }
10973      ;
10974      dst.serviced = serviced == null ? null : serviced.copy();
10975      dst.location = location == null ? null : location.copy();
10976      dst.quantity = quantity == null ? null : quantity.copy();
10977      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
10978      dst.factor = factor == null ? null : factor.copy();
10979      dst.net = net == null ? null : net.copy();
10980      dst.bodySite = bodySite == null ? null : bodySite.copy();
10981      if (subSite != null) {
10982        dst.subSite = new ArrayList<CodeableConcept>();
10983        for (CodeableConcept i : subSite)
10984          dst.subSite.add(i.copy());
10985      }
10986      ;
10987      if (noteNumber != null) {
10988        dst.noteNumber = new ArrayList<PositiveIntType>();
10989        for (PositiveIntType i : noteNumber)
10990          dst.noteNumber.add(i.copy());
10991      }
10992      ;
10993      if (adjudication != null) {
10994        dst.adjudication = new ArrayList<AdjudicationComponent>();
10995        for (AdjudicationComponent i : adjudication)
10996          dst.adjudication.add(i.copy());
10997      }
10998      ;
10999      if (detail != null) {
11000        dst.detail = new ArrayList<AddedItemDetailComponent>();
11001        for (AddedItemDetailComponent i : detail)
11002          dst.detail.add(i.copy());
11003      }
11004      ;
11005    }
11006
11007    @Override
11008    public boolean equalsDeep(Base other_) {
11009      if (!super.equalsDeep(other_))
11010        return false;
11011      if (!(other_ instanceof AddedItemComponent))
11012        return false;
11013      AddedItemComponent o = (AddedItemComponent) other_;
11014      return compareDeep(itemSequence, o.itemSequence, true) && compareDeep(detailSequence, o.detailSequence, true)
11015          && compareDeep(subDetailSequence, o.subDetailSequence, true) && compareDeep(provider, o.provider, true)
11016          && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
11017          && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true)
11018          && compareDeep(location, o.location, true) && compareDeep(quantity, o.quantity, true)
11019          && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
11020          && compareDeep(net, o.net, true) && compareDeep(bodySite, o.bodySite, true)
11021          && compareDeep(subSite, o.subSite, true) && compareDeep(noteNumber, o.noteNumber, true)
11022          && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true);
11023    }
11024
11025    @Override
11026    public boolean equalsShallow(Base other_) {
11027      if (!super.equalsShallow(other_))
11028        return false;
11029      if (!(other_ instanceof AddedItemComponent))
11030        return false;
11031      AddedItemComponent o = (AddedItemComponent) other_;
11032      return compareValues(itemSequence, o.itemSequence, true) && compareValues(detailSequence, o.detailSequence, true)
11033          && compareValues(subDetailSequence, o.subDetailSequence, true) && compareValues(factor, o.factor, true)
11034          && compareValues(noteNumber, o.noteNumber, true);
11035    }
11036
11037    public boolean isEmpty() {
11038      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(itemSequence, detailSequence, subDetailSequence,
11039          provider, productOrService, modifier, programCode, serviced, location, quantity, unitPrice, factor, net,
11040          bodySite, subSite, noteNumber, adjudication, detail);
11041    }
11042
11043    public String fhirType() {
11044      return "ExplanationOfBenefit.addItem";
11045
11046    }
11047
11048  }
11049
11050  @Block()
11051  public static class AddedItemDetailComponent extends BackboneElement implements IBaseBackboneElement {
11052    /**
11053     * When the value is a group code then this item collects a set of related claim
11054     * details, otherwise this contains the product, service, drug or other billing
11055     * code for the item.
11056     */
11057    @Child(name = "productOrService", type = {
11058        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
11059    @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.")
11060    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
11061    protected CodeableConcept productOrService;
11062
11063    /**
11064     * Item typification or modifiers codes to convey additional context for the
11065     * product or service.
11066     */
11067    @Child(name = "modifier", type = {
11068        CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11069    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
11070    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
11071    protected List<CodeableConcept> modifier;
11072
11073    /**
11074     * The number of repetitions of a service or product.
11075     */
11076    @Child(name = "quantity", type = { Quantity.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
11077    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
11078    protected Quantity quantity;
11079
11080    /**
11081     * If the item is not a group then this is the fee for the product or service,
11082     * otherwise this is the total of the fees for the details of the group.
11083     */
11084    @Child(name = "unitPrice", type = { Money.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
11085    @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.")
11086    protected Money unitPrice;
11087
11088    /**
11089     * A real number that represents a multiplier used in determining the overall
11090     * value of services delivered and/or goods received. The concept of a Factor
11091     * allows for a discount or surcharge multiplier to be applied to a monetary
11092     * amount.
11093     */
11094    @Child(name = "factor", type = {
11095        DecimalType.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
11096    @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.")
11097    protected DecimalType factor;
11098
11099    /**
11100     * The quantity times the unit price for an additional service or product or
11101     * charge.
11102     */
11103    @Child(name = "net", type = { Money.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
11104    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
11105    protected Money net;
11106
11107    /**
11108     * The numbers associated with notes below which apply to the adjudication of
11109     * this item.
11110     */
11111    @Child(name = "noteNumber", type = {
11112        PositiveIntType.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11113    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
11114    protected List<PositiveIntType> noteNumber;
11115
11116    /**
11117     * The adjudication results.
11118     */
11119    @Child(name = "adjudication", type = {
11120        AdjudicationComponent.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11121    @Description(shortDefinition = "Added items adjudication", formalDefinition = "The adjudication results.")
11122    protected List<AdjudicationComponent> adjudication;
11123
11124    /**
11125     * The third-tier service adjudications for payor added services.
11126     */
11127    @Child(name = "subDetail", type = {}, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11128    @Description(shortDefinition = "Insurer added line items", formalDefinition = "The third-tier service adjudications for payor added services.")
11129    protected List<AddedItemDetailSubDetailComponent> subDetail;
11130
11131    private static final long serialVersionUID = 295910869L;
11132
11133    /**
11134     * Constructor
11135     */
11136    public AddedItemDetailComponent() {
11137      super();
11138    }
11139
11140    /**
11141     * Constructor
11142     */
11143    public AddedItemDetailComponent(CodeableConcept productOrService) {
11144      super();
11145      this.productOrService = productOrService;
11146    }
11147
11148    /**
11149     * @return {@link #productOrService} (When the value is a group code then this
11150     *         item collects a set of related claim details, otherwise this contains
11151     *         the product, service, drug or other billing code for the item.)
11152     */
11153    public CodeableConcept getProductOrService() {
11154      if (this.productOrService == null)
11155        if (Configuration.errorOnAutoCreate())
11156          throw new Error("Attempt to auto-create AddedItemDetailComponent.productOrService");
11157        else if (Configuration.doAutoCreate())
11158          this.productOrService = new CodeableConcept(); // cc
11159      return this.productOrService;
11160    }
11161
11162    public boolean hasProductOrService() {
11163      return this.productOrService != null && !this.productOrService.isEmpty();
11164    }
11165
11166    /**
11167     * @param value {@link #productOrService} (When the value is a group code then
11168     *              this item collects a set of related claim details, otherwise
11169     *              this contains the product, service, drug or other billing code
11170     *              for the item.)
11171     */
11172    public AddedItemDetailComponent setProductOrService(CodeableConcept value) {
11173      this.productOrService = value;
11174      return this;
11175    }
11176
11177    /**
11178     * @return {@link #modifier} (Item typification or modifiers codes to convey
11179     *         additional context for the product or service.)
11180     */
11181    public List<CodeableConcept> getModifier() {
11182      if (this.modifier == null)
11183        this.modifier = new ArrayList<CodeableConcept>();
11184      return this.modifier;
11185    }
11186
11187    /**
11188     * @return Returns a reference to <code>this</code> for easy method chaining
11189     */
11190    public AddedItemDetailComponent setModifier(List<CodeableConcept> theModifier) {
11191      this.modifier = theModifier;
11192      return this;
11193    }
11194
11195    public boolean hasModifier() {
11196      if (this.modifier == null)
11197        return false;
11198      for (CodeableConcept item : this.modifier)
11199        if (!item.isEmpty())
11200          return true;
11201      return false;
11202    }
11203
11204    public CodeableConcept addModifier() { // 3
11205      CodeableConcept t = new CodeableConcept();
11206      if (this.modifier == null)
11207        this.modifier = new ArrayList<CodeableConcept>();
11208      this.modifier.add(t);
11209      return t;
11210    }
11211
11212    public AddedItemDetailComponent addModifier(CodeableConcept t) { // 3
11213      if (t == null)
11214        return this;
11215      if (this.modifier == null)
11216        this.modifier = new ArrayList<CodeableConcept>();
11217      this.modifier.add(t);
11218      return this;
11219    }
11220
11221    /**
11222     * @return The first repetition of repeating field {@link #modifier}, creating
11223     *         it if it does not already exist
11224     */
11225    public CodeableConcept getModifierFirstRep() {
11226      if (getModifier().isEmpty()) {
11227        addModifier();
11228      }
11229      return getModifier().get(0);
11230    }
11231
11232    /**
11233     * @return {@link #quantity} (The number of repetitions of a service or
11234     *         product.)
11235     */
11236    public Quantity getQuantity() {
11237      if (this.quantity == null)
11238        if (Configuration.errorOnAutoCreate())
11239          throw new Error("Attempt to auto-create AddedItemDetailComponent.quantity");
11240        else if (Configuration.doAutoCreate())
11241          this.quantity = new Quantity(); // cc
11242      return this.quantity;
11243    }
11244
11245    public boolean hasQuantity() {
11246      return this.quantity != null && !this.quantity.isEmpty();
11247    }
11248
11249    /**
11250     * @param value {@link #quantity} (The number of repetitions of a service or
11251     *              product.)
11252     */
11253    public AddedItemDetailComponent setQuantity(Quantity value) {
11254      this.quantity = value;
11255      return this;
11256    }
11257
11258    /**
11259     * @return {@link #unitPrice} (If the item is not a group then this is the fee
11260     *         for the product or service, otherwise this is the total of the fees
11261     *         for the details of the group.)
11262     */
11263    public Money getUnitPrice() {
11264      if (this.unitPrice == null)
11265        if (Configuration.errorOnAutoCreate())
11266          throw new Error("Attempt to auto-create AddedItemDetailComponent.unitPrice");
11267        else if (Configuration.doAutoCreate())
11268          this.unitPrice = new Money(); // cc
11269      return this.unitPrice;
11270    }
11271
11272    public boolean hasUnitPrice() {
11273      return this.unitPrice != null && !this.unitPrice.isEmpty();
11274    }
11275
11276    /**
11277     * @param value {@link #unitPrice} (If the item is not a group then this is the
11278     *              fee for the product or service, otherwise this is the total of
11279     *              the fees for the details of the group.)
11280     */
11281    public AddedItemDetailComponent setUnitPrice(Money value) {
11282      this.unitPrice = value;
11283      return this;
11284    }
11285
11286    /**
11287     * @return {@link #factor} (A real number that represents a multiplier used in
11288     *         determining the overall value of services delivered and/or goods
11289     *         received. The concept of a Factor allows for a discount or surcharge
11290     *         multiplier to be applied to a monetary amount.). This is the
11291     *         underlying object with id, value and extensions. The accessor
11292     *         "getFactor" gives direct access to the value
11293     */
11294    public DecimalType getFactorElement() {
11295      if (this.factor == null)
11296        if (Configuration.errorOnAutoCreate())
11297          throw new Error("Attempt to auto-create AddedItemDetailComponent.factor");
11298        else if (Configuration.doAutoCreate())
11299          this.factor = new DecimalType(); // bb
11300      return this.factor;
11301    }
11302
11303    public boolean hasFactorElement() {
11304      return this.factor != null && !this.factor.isEmpty();
11305    }
11306
11307    public boolean hasFactor() {
11308      return this.factor != null && !this.factor.isEmpty();
11309    }
11310
11311    /**
11312     * @param value {@link #factor} (A real number that represents a multiplier used
11313     *              in determining the overall value of services delivered and/or
11314     *              goods received. The concept of a Factor allows for a discount or
11315     *              surcharge multiplier to be applied to a monetary amount.). This
11316     *              is the underlying object with id, value and extensions. The
11317     *              accessor "getFactor" gives direct access to the value
11318     */
11319    public AddedItemDetailComponent setFactorElement(DecimalType value) {
11320      this.factor = value;
11321      return this;
11322    }
11323
11324    /**
11325     * @return A real number that represents a multiplier used in determining the
11326     *         overall value of services delivered and/or goods received. The
11327     *         concept of a Factor allows for a discount or surcharge multiplier to
11328     *         be applied to a monetary amount.
11329     */
11330    public BigDecimal getFactor() {
11331      return this.factor == null ? null : this.factor.getValue();
11332    }
11333
11334    /**
11335     * @param value A real number that represents a multiplier used in determining
11336     *              the overall value of services delivered and/or goods received.
11337     *              The concept of a Factor allows for a discount or surcharge
11338     *              multiplier to be applied to a monetary amount.
11339     */
11340    public AddedItemDetailComponent setFactor(BigDecimal value) {
11341      if (value == null)
11342        this.factor = null;
11343      else {
11344        if (this.factor == null)
11345          this.factor = new DecimalType();
11346        this.factor.setValue(value);
11347      }
11348      return this;
11349    }
11350
11351    /**
11352     * @param value A real number that represents a multiplier used in determining
11353     *              the overall value of services delivered and/or goods received.
11354     *              The concept of a Factor allows for a discount or surcharge
11355     *              multiplier to be applied to a monetary amount.
11356     */
11357    public AddedItemDetailComponent setFactor(long value) {
11358      this.factor = new DecimalType();
11359      this.factor.setValue(value);
11360      return this;
11361    }
11362
11363    /**
11364     * @param value A real number that represents a multiplier used in determining
11365     *              the overall value of services delivered and/or goods received.
11366     *              The concept of a Factor allows for a discount or surcharge
11367     *              multiplier to be applied to a monetary amount.
11368     */
11369    public AddedItemDetailComponent setFactor(double value) {
11370      this.factor = new DecimalType();
11371      this.factor.setValue(value);
11372      return this;
11373    }
11374
11375    /**
11376     * @return {@link #net} (The quantity times the unit price for an additional
11377     *         service or product or charge.)
11378     */
11379    public Money getNet() {
11380      if (this.net == null)
11381        if (Configuration.errorOnAutoCreate())
11382          throw new Error("Attempt to auto-create AddedItemDetailComponent.net");
11383        else if (Configuration.doAutoCreate())
11384          this.net = new Money(); // cc
11385      return this.net;
11386    }
11387
11388    public boolean hasNet() {
11389      return this.net != null && !this.net.isEmpty();
11390    }
11391
11392    /**
11393     * @param value {@link #net} (The quantity times the unit price for an
11394     *              additional service or product or charge.)
11395     */
11396    public AddedItemDetailComponent setNet(Money value) {
11397      this.net = value;
11398      return this;
11399    }
11400
11401    /**
11402     * @return {@link #noteNumber} (The numbers associated with notes below which
11403     *         apply to the adjudication of this item.)
11404     */
11405    public List<PositiveIntType> getNoteNumber() {
11406      if (this.noteNumber == null)
11407        this.noteNumber = new ArrayList<PositiveIntType>();
11408      return this.noteNumber;
11409    }
11410
11411    /**
11412     * @return Returns a reference to <code>this</code> for easy method chaining
11413     */
11414    public AddedItemDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
11415      this.noteNumber = theNoteNumber;
11416      return this;
11417    }
11418
11419    public boolean hasNoteNumber() {
11420      if (this.noteNumber == null)
11421        return false;
11422      for (PositiveIntType item : this.noteNumber)
11423        if (!item.isEmpty())
11424          return true;
11425      return false;
11426    }
11427
11428    /**
11429     * @return {@link #noteNumber} (The numbers associated with notes below which
11430     *         apply to the adjudication of this item.)
11431     */
11432    public PositiveIntType addNoteNumberElement() {// 2
11433      PositiveIntType t = new PositiveIntType();
11434      if (this.noteNumber == null)
11435        this.noteNumber = new ArrayList<PositiveIntType>();
11436      this.noteNumber.add(t);
11437      return t;
11438    }
11439
11440    /**
11441     * @param value {@link #noteNumber} (The numbers associated with notes below
11442     *              which apply to the adjudication of this item.)
11443     */
11444    public AddedItemDetailComponent addNoteNumber(int value) { // 1
11445      PositiveIntType t = new PositiveIntType();
11446      t.setValue(value);
11447      if (this.noteNumber == null)
11448        this.noteNumber = new ArrayList<PositiveIntType>();
11449      this.noteNumber.add(t);
11450      return this;
11451    }
11452
11453    /**
11454     * @param value {@link #noteNumber} (The numbers associated with notes below
11455     *              which apply to the adjudication of this item.)
11456     */
11457    public boolean hasNoteNumber(int value) {
11458      if (this.noteNumber == null)
11459        return false;
11460      for (PositiveIntType v : this.noteNumber)
11461        if (v.getValue().equals(value)) // positiveInt
11462          return true;
11463      return false;
11464    }
11465
11466    /**
11467     * @return {@link #adjudication} (The adjudication results.)
11468     */
11469    public List<AdjudicationComponent> getAdjudication() {
11470      if (this.adjudication == null)
11471        this.adjudication = new ArrayList<AdjudicationComponent>();
11472      return this.adjudication;
11473    }
11474
11475    /**
11476     * @return Returns a reference to <code>this</code> for easy method chaining
11477     */
11478    public AddedItemDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
11479      this.adjudication = theAdjudication;
11480      return this;
11481    }
11482
11483    public boolean hasAdjudication() {
11484      if (this.adjudication == null)
11485        return false;
11486      for (AdjudicationComponent item : this.adjudication)
11487        if (!item.isEmpty())
11488          return true;
11489      return false;
11490    }
11491
11492    public AdjudicationComponent addAdjudication() { // 3
11493      AdjudicationComponent t = new AdjudicationComponent();
11494      if (this.adjudication == null)
11495        this.adjudication = new ArrayList<AdjudicationComponent>();
11496      this.adjudication.add(t);
11497      return t;
11498    }
11499
11500    public AddedItemDetailComponent addAdjudication(AdjudicationComponent t) { // 3
11501      if (t == null)
11502        return this;
11503      if (this.adjudication == null)
11504        this.adjudication = new ArrayList<AdjudicationComponent>();
11505      this.adjudication.add(t);
11506      return this;
11507    }
11508
11509    /**
11510     * @return The first repetition of repeating field {@link #adjudication},
11511     *         creating it if it does not already exist
11512     */
11513    public AdjudicationComponent getAdjudicationFirstRep() {
11514      if (getAdjudication().isEmpty()) {
11515        addAdjudication();
11516      }
11517      return getAdjudication().get(0);
11518    }
11519
11520    /**
11521     * @return {@link #subDetail} (The third-tier service adjudications for payor
11522     *         added services.)
11523     */
11524    public List<AddedItemDetailSubDetailComponent> getSubDetail() {
11525      if (this.subDetail == null)
11526        this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
11527      return this.subDetail;
11528    }
11529
11530    /**
11531     * @return Returns a reference to <code>this</code> for easy method chaining
11532     */
11533    public AddedItemDetailComponent setSubDetail(List<AddedItemDetailSubDetailComponent> theSubDetail) {
11534      this.subDetail = theSubDetail;
11535      return this;
11536    }
11537
11538    public boolean hasSubDetail() {
11539      if (this.subDetail == null)
11540        return false;
11541      for (AddedItemDetailSubDetailComponent item : this.subDetail)
11542        if (!item.isEmpty())
11543          return true;
11544      return false;
11545    }
11546
11547    public AddedItemDetailSubDetailComponent addSubDetail() { // 3
11548      AddedItemDetailSubDetailComponent t = new AddedItemDetailSubDetailComponent();
11549      if (this.subDetail == null)
11550        this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
11551      this.subDetail.add(t);
11552      return t;
11553    }
11554
11555    public AddedItemDetailComponent addSubDetail(AddedItemDetailSubDetailComponent t) { // 3
11556      if (t == null)
11557        return this;
11558      if (this.subDetail == null)
11559        this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
11560      this.subDetail.add(t);
11561      return this;
11562    }
11563
11564    /**
11565     * @return The first repetition of repeating field {@link #subDetail}, creating
11566     *         it if it does not already exist
11567     */
11568    public AddedItemDetailSubDetailComponent getSubDetailFirstRep() {
11569      if (getSubDetail().isEmpty()) {
11570        addSubDetail();
11571      }
11572      return getSubDetail().get(0);
11573    }
11574
11575    protected void listChildren(List<Property> children) {
11576      super.listChildren(children);
11577      children.add(new Property("productOrService", "CodeableConcept",
11578          "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.",
11579          0, 1, productOrService));
11580      children.add(new Property("modifier", "CodeableConcept",
11581          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
11582          java.lang.Integer.MAX_VALUE, modifier));
11583      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
11584          1, quantity));
11585      children.add(new Property("unitPrice", "Money",
11586          "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.",
11587          0, 1, unitPrice));
11588      children.add(new Property("factor", "decimal",
11589          "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.",
11590          0, 1, factor));
11591      children.add(new Property("net", "Money",
11592          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
11593      children.add(new Property("noteNumber", "positiveInt",
11594          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
11595          java.lang.Integer.MAX_VALUE, noteNumber));
11596      children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.",
11597          0, java.lang.Integer.MAX_VALUE, adjudication));
11598      children.add(new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0,
11599          java.lang.Integer.MAX_VALUE, subDetail));
11600    }
11601
11602    @Override
11603    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11604      switch (_hash) {
11605      case 1957227299:
11606        /* productOrService */ return new Property("productOrService", "CodeableConcept",
11607            "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.",
11608            0, 1, productOrService);
11609      case -615513385:
11610        /* modifier */ return new Property("modifier", "CodeableConcept",
11611            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
11612            java.lang.Integer.MAX_VALUE, modifier);
11613      case -1285004149:
11614        /* quantity */ return new Property("quantity", "SimpleQuantity",
11615            "The number of repetitions of a service or product.", 0, 1, quantity);
11616      case -486196699:
11617        /* unitPrice */ return new Property("unitPrice", "Money",
11618            "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.",
11619            0, 1, unitPrice);
11620      case -1282148017:
11621        /* factor */ return new Property("factor", "decimal",
11622            "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.",
11623            0, 1, factor);
11624      case 108957:
11625        /* net */ return new Property("net", "Money",
11626            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
11627      case -1110033957:
11628        /* noteNumber */ return new Property("noteNumber", "positiveInt",
11629            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
11630            java.lang.Integer.MAX_VALUE, noteNumber);
11631      case -231349275:
11632        /* adjudication */ return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
11633            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
11634      case -828829007:
11635        /* subDetail */ return new Property("subDetail", "",
11636            "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE,
11637            subDetail);
11638      default:
11639        return super.getNamedProperty(_hash, _name, _checkValid);
11640      }
11641
11642    }
11643
11644    @Override
11645    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11646      switch (hash) {
11647      case 1957227299:
11648        /* productOrService */ return this.productOrService == null ? new Base[0]
11649            : new Base[] { this.productOrService }; // CodeableConcept
11650      case -615513385:
11651        /* modifier */ return this.modifier == null ? new Base[0]
11652            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
11653      case -1285004149:
11654        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
11655      case -486196699:
11656        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
11657      case -1282148017:
11658        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
11659      case 108957:
11660        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
11661      case -1110033957:
11662        /* noteNumber */ return this.noteNumber == null ? new Base[0]
11663            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
11664      case -231349275:
11665        /* adjudication */ return this.adjudication == null ? new Base[0]
11666            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
11667      case -828829007:
11668        /* subDetail */ return this.subDetail == null ? new Base[0]
11669            : this.subDetail.toArray(new Base[this.subDetail.size()]); // AddedItemDetailSubDetailComponent
11670      default:
11671        return super.getProperty(hash, name, checkValid);
11672      }
11673
11674    }
11675
11676    @Override
11677    public Base setProperty(int hash, String name, Base value) throws FHIRException {
11678      switch (hash) {
11679      case 1957227299: // productOrService
11680        this.productOrService = castToCodeableConcept(value); // CodeableConcept
11681        return value;
11682      case -615513385: // modifier
11683        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
11684        return value;
11685      case -1285004149: // quantity
11686        this.quantity = castToQuantity(value); // Quantity
11687        return value;
11688      case -486196699: // unitPrice
11689        this.unitPrice = castToMoney(value); // Money
11690        return value;
11691      case -1282148017: // factor
11692        this.factor = castToDecimal(value); // DecimalType
11693        return value;
11694      case 108957: // net
11695        this.net = castToMoney(value); // Money
11696        return value;
11697      case -1110033957: // noteNumber
11698        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
11699        return value;
11700      case -231349275: // adjudication
11701        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
11702        return value;
11703      case -828829007: // subDetail
11704        this.getSubDetail().add((AddedItemDetailSubDetailComponent) value); // AddedItemDetailSubDetailComponent
11705        return value;
11706      default:
11707        return super.setProperty(hash, name, value);
11708      }
11709
11710    }
11711
11712    @Override
11713    public Base setProperty(String name, Base value) throws FHIRException {
11714      if (name.equals("productOrService")) {
11715        this.productOrService = castToCodeableConcept(value); // CodeableConcept
11716      } else if (name.equals("modifier")) {
11717        this.getModifier().add(castToCodeableConcept(value));
11718      } else if (name.equals("quantity")) {
11719        this.quantity = castToQuantity(value); // Quantity
11720      } else if (name.equals("unitPrice")) {
11721        this.unitPrice = castToMoney(value); // Money
11722      } else if (name.equals("factor")) {
11723        this.factor = castToDecimal(value); // DecimalType
11724      } else if (name.equals("net")) {
11725        this.net = castToMoney(value); // Money
11726      } else if (name.equals("noteNumber")) {
11727        this.getNoteNumber().add(castToPositiveInt(value));
11728      } else if (name.equals("adjudication")) {
11729        this.getAdjudication().add((AdjudicationComponent) value);
11730      } else if (name.equals("subDetail")) {
11731        this.getSubDetail().add((AddedItemDetailSubDetailComponent) value);
11732      } else
11733        return super.setProperty(name, value);
11734      return value;
11735    }
11736
11737  @Override
11738  public void removeChild(String name, Base value) throws FHIRException {
11739      if (name.equals("productOrService")) {
11740        this.productOrService = null;
11741      } else if (name.equals("modifier")) {
11742        this.getModifier().remove(castToCodeableConcept(value));
11743      } else if (name.equals("quantity")) {
11744        this.quantity = null;
11745      } else if (name.equals("unitPrice")) {
11746        this.unitPrice = null;
11747      } else if (name.equals("factor")) {
11748        this.factor = null;
11749      } else if (name.equals("net")) {
11750        this.net = null;
11751      } else if (name.equals("noteNumber")) {
11752        this.getNoteNumber().remove(castToPositiveInt(value));
11753      } else if (name.equals("adjudication")) {
11754        this.getAdjudication().remove((AdjudicationComponent) value);
11755      } else if (name.equals("subDetail")) {
11756        this.getSubDetail().remove((AddedItemDetailSubDetailComponent) value);
11757      } else
11758        super.removeChild(name, value);
11759      
11760    }
11761
11762    @Override
11763    public Base makeProperty(int hash, String name) throws FHIRException {
11764      switch (hash) {
11765      case 1957227299:
11766        return getProductOrService();
11767      case -615513385:
11768        return addModifier();
11769      case -1285004149:
11770        return getQuantity();
11771      case -486196699:
11772        return getUnitPrice();
11773      case -1282148017:
11774        return getFactorElement();
11775      case 108957:
11776        return getNet();
11777      case -1110033957:
11778        return addNoteNumberElement();
11779      case -231349275:
11780        return addAdjudication();
11781      case -828829007:
11782        return addSubDetail();
11783      default:
11784        return super.makeProperty(hash, name);
11785      }
11786
11787    }
11788
11789    @Override
11790    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11791      switch (hash) {
11792      case 1957227299:
11793        /* productOrService */ return new String[] { "CodeableConcept" };
11794      case -615513385:
11795        /* modifier */ return new String[] { "CodeableConcept" };
11796      case -1285004149:
11797        /* quantity */ return new String[] { "SimpleQuantity" };
11798      case -486196699:
11799        /* unitPrice */ return new String[] { "Money" };
11800      case -1282148017:
11801        /* factor */ return new String[] { "decimal" };
11802      case 108957:
11803        /* net */ return new String[] { "Money" };
11804      case -1110033957:
11805        /* noteNumber */ return new String[] { "positiveInt" };
11806      case -231349275:
11807        /* adjudication */ return new String[] { "@ExplanationOfBenefit.item.adjudication" };
11808      case -828829007:
11809        /* subDetail */ return new String[] {};
11810      default:
11811        return super.getTypesForProperty(hash, name);
11812      }
11813
11814    }
11815
11816    @Override
11817    public Base addChild(String name) throws FHIRException {
11818      if (name.equals("productOrService")) {
11819        this.productOrService = new CodeableConcept();
11820        return this.productOrService;
11821      } else if (name.equals("modifier")) {
11822        return addModifier();
11823      } else if (name.equals("quantity")) {
11824        this.quantity = new Quantity();
11825        return this.quantity;
11826      } else if (name.equals("unitPrice")) {
11827        this.unitPrice = new Money();
11828        return this.unitPrice;
11829      } else if (name.equals("factor")) {
11830        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
11831      } else if (name.equals("net")) {
11832        this.net = new Money();
11833        return this.net;
11834      } else if (name.equals("noteNumber")) {
11835        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
11836      } else if (name.equals("adjudication")) {
11837        return addAdjudication();
11838      } else if (name.equals("subDetail")) {
11839        return addSubDetail();
11840      } else
11841        return super.addChild(name);
11842    }
11843
11844    public AddedItemDetailComponent copy() {
11845      AddedItemDetailComponent dst = new AddedItemDetailComponent();
11846      copyValues(dst);
11847      return dst;
11848    }
11849
11850    public void copyValues(AddedItemDetailComponent dst) {
11851      super.copyValues(dst);
11852      dst.productOrService = productOrService == null ? null : productOrService.copy();
11853      if (modifier != null) {
11854        dst.modifier = new ArrayList<CodeableConcept>();
11855        for (CodeableConcept i : modifier)
11856          dst.modifier.add(i.copy());
11857      }
11858      ;
11859      dst.quantity = quantity == null ? null : quantity.copy();
11860      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
11861      dst.factor = factor == null ? null : factor.copy();
11862      dst.net = net == null ? null : net.copy();
11863      if (noteNumber != null) {
11864        dst.noteNumber = new ArrayList<PositiveIntType>();
11865        for (PositiveIntType i : noteNumber)
11866          dst.noteNumber.add(i.copy());
11867      }
11868      ;
11869      if (adjudication != null) {
11870        dst.adjudication = new ArrayList<AdjudicationComponent>();
11871        for (AdjudicationComponent i : adjudication)
11872          dst.adjudication.add(i.copy());
11873      }
11874      ;
11875      if (subDetail != null) {
11876        dst.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
11877        for (AddedItemDetailSubDetailComponent i : subDetail)
11878          dst.subDetail.add(i.copy());
11879      }
11880      ;
11881    }
11882
11883    @Override
11884    public boolean equalsDeep(Base other_) {
11885      if (!super.equalsDeep(other_))
11886        return false;
11887      if (!(other_ instanceof AddedItemDetailComponent))
11888        return false;
11889      AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
11890      return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
11891          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
11892          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true)
11893          && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
11894          && compareDeep(subDetail, o.subDetail, true);
11895    }
11896
11897    @Override
11898    public boolean equalsShallow(Base other_) {
11899      if (!super.equalsShallow(other_))
11900        return false;
11901      if (!(other_ instanceof AddedItemDetailComponent))
11902        return false;
11903      AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
11904      return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
11905    }
11906
11907    public boolean isEmpty() {
11908      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier, quantity, unitPrice,
11909          factor, net, noteNumber, adjudication, subDetail);
11910    }
11911
11912    public String fhirType() {
11913      return "ExplanationOfBenefit.addItem.detail";
11914
11915    }
11916
11917  }
11918
11919  @Block()
11920  public static class AddedItemDetailSubDetailComponent extends BackboneElement implements IBaseBackboneElement {
11921    /**
11922     * When the value is a group code then this item collects a set of related claim
11923     * details, otherwise this contains the product, service, drug or other billing
11924     * code for the item.
11925     */
11926    @Child(name = "productOrService", type = {
11927        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
11928    @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.")
11929    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
11930    protected CodeableConcept productOrService;
11931
11932    /**
11933     * Item typification or modifiers codes to convey additional context for the
11934     * product or service.
11935     */
11936    @Child(name = "modifier", type = {
11937        CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11938    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
11939    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
11940    protected List<CodeableConcept> modifier;
11941
11942    /**
11943     * The number of repetitions of a service or product.
11944     */
11945    @Child(name = "quantity", type = { Quantity.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
11946    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
11947    protected Quantity quantity;
11948
11949    /**
11950     * If the item is not a group then this is the fee for the product or service,
11951     * otherwise this is the total of the fees for the details of the group.
11952     */
11953    @Child(name = "unitPrice", type = { Money.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
11954    @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.")
11955    protected Money unitPrice;
11956
11957    /**
11958     * A real number that represents a multiplier used in determining the overall
11959     * value of services delivered and/or goods received. The concept of a Factor
11960     * allows for a discount or surcharge multiplier to be applied to a monetary
11961     * amount.
11962     */
11963    @Child(name = "factor", type = {
11964        DecimalType.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
11965    @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.")
11966    protected DecimalType factor;
11967
11968    /**
11969     * The quantity times the unit price for an additional service or product or
11970     * charge.
11971     */
11972    @Child(name = "net", type = { Money.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
11973    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
11974    protected Money net;
11975
11976    /**
11977     * The numbers associated with notes below which apply to the adjudication of
11978     * this item.
11979     */
11980    @Child(name = "noteNumber", type = {
11981        PositiveIntType.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11982    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
11983    protected List<PositiveIntType> noteNumber;
11984
11985    /**
11986     * The adjudication results.
11987     */
11988    @Child(name = "adjudication", type = {
11989        AdjudicationComponent.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11990    @Description(shortDefinition = "Added items adjudication", formalDefinition = "The adjudication results.")
11991    protected List<AdjudicationComponent> adjudication;
11992
11993    private static final long serialVersionUID = 1301363592L;
11994
11995    /**
11996     * Constructor
11997     */
11998    public AddedItemDetailSubDetailComponent() {
11999      super();
12000    }
12001
12002    /**
12003     * Constructor
12004     */
12005    public AddedItemDetailSubDetailComponent(CodeableConcept productOrService) {
12006      super();
12007      this.productOrService = productOrService;
12008    }
12009
12010    /**
12011     * @return {@link #productOrService} (When the value is a group code then this
12012     *         item collects a set of related claim details, otherwise this contains
12013     *         the product, service, drug or other billing code for the item.)
12014     */
12015    public CodeableConcept getProductOrService() {
12016      if (this.productOrService == null)
12017        if (Configuration.errorOnAutoCreate())
12018          throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.productOrService");
12019        else if (Configuration.doAutoCreate())
12020          this.productOrService = new CodeableConcept(); // cc
12021      return this.productOrService;
12022    }
12023
12024    public boolean hasProductOrService() {
12025      return this.productOrService != null && !this.productOrService.isEmpty();
12026    }
12027
12028    /**
12029     * @param value {@link #productOrService} (When the value is a group code then
12030     *              this item collects a set of related claim details, otherwise
12031     *              this contains the product, service, drug or other billing code
12032     *              for the item.)
12033     */
12034    public AddedItemDetailSubDetailComponent setProductOrService(CodeableConcept value) {
12035      this.productOrService = value;
12036      return this;
12037    }
12038
12039    /**
12040     * @return {@link #modifier} (Item typification or modifiers codes to convey
12041     *         additional context for the product or service.)
12042     */
12043    public List<CodeableConcept> getModifier() {
12044      if (this.modifier == null)
12045        this.modifier = new ArrayList<CodeableConcept>();
12046      return this.modifier;
12047    }
12048
12049    /**
12050     * @return Returns a reference to <code>this</code> for easy method chaining
12051     */
12052    public AddedItemDetailSubDetailComponent setModifier(List<CodeableConcept> theModifier) {
12053      this.modifier = theModifier;
12054      return this;
12055    }
12056
12057    public boolean hasModifier() {
12058      if (this.modifier == null)
12059        return false;
12060      for (CodeableConcept item : this.modifier)
12061        if (!item.isEmpty())
12062          return true;
12063      return false;
12064    }
12065
12066    public CodeableConcept addModifier() { // 3
12067      CodeableConcept t = new CodeableConcept();
12068      if (this.modifier == null)
12069        this.modifier = new ArrayList<CodeableConcept>();
12070      this.modifier.add(t);
12071      return t;
12072    }
12073
12074    public AddedItemDetailSubDetailComponent addModifier(CodeableConcept t) { // 3
12075      if (t == null)
12076        return this;
12077      if (this.modifier == null)
12078        this.modifier = new ArrayList<CodeableConcept>();
12079      this.modifier.add(t);
12080      return this;
12081    }
12082
12083    /**
12084     * @return The first repetition of repeating field {@link #modifier}, creating
12085     *         it if it does not already exist
12086     */
12087    public CodeableConcept getModifierFirstRep() {
12088      if (getModifier().isEmpty()) {
12089        addModifier();
12090      }
12091      return getModifier().get(0);
12092    }
12093
12094    /**
12095     * @return {@link #quantity} (The number of repetitions of a service or
12096     *         product.)
12097     */
12098    public Quantity getQuantity() {
12099      if (this.quantity == null)
12100        if (Configuration.errorOnAutoCreate())
12101          throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.quantity");
12102        else if (Configuration.doAutoCreate())
12103          this.quantity = new Quantity(); // cc
12104      return this.quantity;
12105    }
12106
12107    public boolean hasQuantity() {
12108      return this.quantity != null && !this.quantity.isEmpty();
12109    }
12110
12111    /**
12112     * @param value {@link #quantity} (The number of repetitions of a service or
12113     *              product.)
12114     */
12115    public AddedItemDetailSubDetailComponent setQuantity(Quantity value) {
12116      this.quantity = value;
12117      return this;
12118    }
12119
12120    /**
12121     * @return {@link #unitPrice} (If the item is not a group then this is the fee
12122     *         for the product or service, otherwise this is the total of the fees
12123     *         for the details of the group.)
12124     */
12125    public Money getUnitPrice() {
12126      if (this.unitPrice == null)
12127        if (Configuration.errorOnAutoCreate())
12128          throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.unitPrice");
12129        else if (Configuration.doAutoCreate())
12130          this.unitPrice = new Money(); // cc
12131      return this.unitPrice;
12132    }
12133
12134    public boolean hasUnitPrice() {
12135      return this.unitPrice != null && !this.unitPrice.isEmpty();
12136    }
12137
12138    /**
12139     * @param value {@link #unitPrice} (If the item is not a group then this is the
12140     *              fee for the product or service, otherwise this is the total of
12141     *              the fees for the details of the group.)
12142     */
12143    public AddedItemDetailSubDetailComponent setUnitPrice(Money value) {
12144      this.unitPrice = value;
12145      return this;
12146    }
12147
12148    /**
12149     * @return {@link #factor} (A real number that represents a multiplier used in
12150     *         determining the overall value of services delivered and/or goods
12151     *         received. The concept of a Factor allows for a discount or surcharge
12152     *         multiplier to be applied to a monetary amount.). This is the
12153     *         underlying object with id, value and extensions. The accessor
12154     *         "getFactor" gives direct access to the value
12155     */
12156    public DecimalType getFactorElement() {
12157      if (this.factor == null)
12158        if (Configuration.errorOnAutoCreate())
12159          throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.factor");
12160        else if (Configuration.doAutoCreate())
12161          this.factor = new DecimalType(); // bb
12162      return this.factor;
12163    }
12164
12165    public boolean hasFactorElement() {
12166      return this.factor != null && !this.factor.isEmpty();
12167    }
12168
12169    public boolean hasFactor() {
12170      return this.factor != null && !this.factor.isEmpty();
12171    }
12172
12173    /**
12174     * @param value {@link #factor} (A real number that represents a multiplier used
12175     *              in determining the overall value of services delivered and/or
12176     *              goods received. The concept of a Factor allows for a discount or
12177     *              surcharge multiplier to be applied to a monetary amount.). This
12178     *              is the underlying object with id, value and extensions. The
12179     *              accessor "getFactor" gives direct access to the value
12180     */
12181    public AddedItemDetailSubDetailComponent setFactorElement(DecimalType value) {
12182      this.factor = value;
12183      return this;
12184    }
12185
12186    /**
12187     * @return A real number that represents a multiplier used in determining the
12188     *         overall value of services delivered and/or goods received. The
12189     *         concept of a Factor allows for a discount or surcharge multiplier to
12190     *         be applied to a monetary amount.
12191     */
12192    public BigDecimal getFactor() {
12193      return this.factor == null ? null : this.factor.getValue();
12194    }
12195
12196    /**
12197     * @param value A real number that represents a multiplier used in determining
12198     *              the overall value of services delivered and/or goods received.
12199     *              The concept of a Factor allows for a discount or surcharge
12200     *              multiplier to be applied to a monetary amount.
12201     */
12202    public AddedItemDetailSubDetailComponent setFactor(BigDecimal value) {
12203      if (value == null)
12204        this.factor = null;
12205      else {
12206        if (this.factor == null)
12207          this.factor = new DecimalType();
12208        this.factor.setValue(value);
12209      }
12210      return this;
12211    }
12212
12213    /**
12214     * @param value A real number that represents a multiplier used in determining
12215     *              the overall value of services delivered and/or goods received.
12216     *              The concept of a Factor allows for a discount or surcharge
12217     *              multiplier to be applied to a monetary amount.
12218     */
12219    public AddedItemDetailSubDetailComponent setFactor(long value) {
12220      this.factor = new DecimalType();
12221      this.factor.setValue(value);
12222      return this;
12223    }
12224
12225    /**
12226     * @param value A real number that represents a multiplier used in determining
12227     *              the overall value of services delivered and/or goods received.
12228     *              The concept of a Factor allows for a discount or surcharge
12229     *              multiplier to be applied to a monetary amount.
12230     */
12231    public AddedItemDetailSubDetailComponent setFactor(double value) {
12232      this.factor = new DecimalType();
12233      this.factor.setValue(value);
12234      return this;
12235    }
12236
12237    /**
12238     * @return {@link #net} (The quantity times the unit price for an additional
12239     *         service or product or charge.)
12240     */
12241    public Money getNet() {
12242      if (this.net == null)
12243        if (Configuration.errorOnAutoCreate())
12244          throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.net");
12245        else if (Configuration.doAutoCreate())
12246          this.net = new Money(); // cc
12247      return this.net;
12248    }
12249
12250    public boolean hasNet() {
12251      return this.net != null && !this.net.isEmpty();
12252    }
12253
12254    /**
12255     * @param value {@link #net} (The quantity times the unit price for an
12256     *              additional service or product or charge.)
12257     */
12258    public AddedItemDetailSubDetailComponent setNet(Money value) {
12259      this.net = value;
12260      return this;
12261    }
12262
12263    /**
12264     * @return {@link #noteNumber} (The numbers associated with notes below which
12265     *         apply to the adjudication of this item.)
12266     */
12267    public List<PositiveIntType> getNoteNumber() {
12268      if (this.noteNumber == null)
12269        this.noteNumber = new ArrayList<PositiveIntType>();
12270      return this.noteNumber;
12271    }
12272
12273    /**
12274     * @return Returns a reference to <code>this</code> for easy method chaining
12275     */
12276    public AddedItemDetailSubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
12277      this.noteNumber = theNoteNumber;
12278      return this;
12279    }
12280
12281    public boolean hasNoteNumber() {
12282      if (this.noteNumber == null)
12283        return false;
12284      for (PositiveIntType item : this.noteNumber)
12285        if (!item.isEmpty())
12286          return true;
12287      return false;
12288    }
12289
12290    /**
12291     * @return {@link #noteNumber} (The numbers associated with notes below which
12292     *         apply to the adjudication of this item.)
12293     */
12294    public PositiveIntType addNoteNumberElement() {// 2
12295      PositiveIntType t = new PositiveIntType();
12296      if (this.noteNumber == null)
12297        this.noteNumber = new ArrayList<PositiveIntType>();
12298      this.noteNumber.add(t);
12299      return t;
12300    }
12301
12302    /**
12303     * @param value {@link #noteNumber} (The numbers associated with notes below
12304     *              which apply to the adjudication of this item.)
12305     */
12306    public AddedItemDetailSubDetailComponent addNoteNumber(int value) { // 1
12307      PositiveIntType t = new PositiveIntType();
12308      t.setValue(value);
12309      if (this.noteNumber == null)
12310        this.noteNumber = new ArrayList<PositiveIntType>();
12311      this.noteNumber.add(t);
12312      return this;
12313    }
12314
12315    /**
12316     * @param value {@link #noteNumber} (The numbers associated with notes below
12317     *              which apply to the adjudication of this item.)
12318     */
12319    public boolean hasNoteNumber(int value) {
12320      if (this.noteNumber == null)
12321        return false;
12322      for (PositiveIntType v : this.noteNumber)
12323        if (v.getValue().equals(value)) // positiveInt
12324          return true;
12325      return false;
12326    }
12327
12328    /**
12329     * @return {@link #adjudication} (The adjudication results.)
12330     */
12331    public List<AdjudicationComponent> getAdjudication() {
12332      if (this.adjudication == null)
12333        this.adjudication = new ArrayList<AdjudicationComponent>();
12334      return this.adjudication;
12335    }
12336
12337    /**
12338     * @return Returns a reference to <code>this</code> for easy method chaining
12339     */
12340    public AddedItemDetailSubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
12341      this.adjudication = theAdjudication;
12342      return this;
12343    }
12344
12345    public boolean hasAdjudication() {
12346      if (this.adjudication == null)
12347        return false;
12348      for (AdjudicationComponent item : this.adjudication)
12349        if (!item.isEmpty())
12350          return true;
12351      return false;
12352    }
12353
12354    public AdjudicationComponent addAdjudication() { // 3
12355      AdjudicationComponent t = new AdjudicationComponent();
12356      if (this.adjudication == null)
12357        this.adjudication = new ArrayList<AdjudicationComponent>();
12358      this.adjudication.add(t);
12359      return t;
12360    }
12361
12362    public AddedItemDetailSubDetailComponent addAdjudication(AdjudicationComponent t) { // 3
12363      if (t == null)
12364        return this;
12365      if (this.adjudication == null)
12366        this.adjudication = new ArrayList<AdjudicationComponent>();
12367      this.adjudication.add(t);
12368      return this;
12369    }
12370
12371    /**
12372     * @return The first repetition of repeating field {@link #adjudication},
12373     *         creating it if it does not already exist
12374     */
12375    public AdjudicationComponent getAdjudicationFirstRep() {
12376      if (getAdjudication().isEmpty()) {
12377        addAdjudication();
12378      }
12379      return getAdjudication().get(0);
12380    }
12381
12382    protected void listChildren(List<Property> children) {
12383      super.listChildren(children);
12384      children.add(new Property("productOrService", "CodeableConcept",
12385          "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.",
12386          0, 1, productOrService));
12387      children.add(new Property("modifier", "CodeableConcept",
12388          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
12389          java.lang.Integer.MAX_VALUE, modifier));
12390      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
12391          1, quantity));
12392      children.add(new Property("unitPrice", "Money",
12393          "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.",
12394          0, 1, unitPrice));
12395      children.add(new Property("factor", "decimal",
12396          "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.",
12397          0, 1, factor));
12398      children.add(new Property("net", "Money",
12399          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
12400      children.add(new Property("noteNumber", "positiveInt",
12401          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
12402          java.lang.Integer.MAX_VALUE, noteNumber));
12403      children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.",
12404          0, java.lang.Integer.MAX_VALUE, adjudication));
12405    }
12406
12407    @Override
12408    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
12409      switch (_hash) {
12410      case 1957227299:
12411        /* productOrService */ return new Property("productOrService", "CodeableConcept",
12412            "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.",
12413            0, 1, productOrService);
12414      case -615513385:
12415        /* modifier */ return new Property("modifier", "CodeableConcept",
12416            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
12417            java.lang.Integer.MAX_VALUE, modifier);
12418      case -1285004149:
12419        /* quantity */ return new Property("quantity", "SimpleQuantity",
12420            "The number of repetitions of a service or product.", 0, 1, quantity);
12421      case -486196699:
12422        /* unitPrice */ return new Property("unitPrice", "Money",
12423            "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.",
12424            0, 1, unitPrice);
12425      case -1282148017:
12426        /* factor */ return new Property("factor", "decimal",
12427            "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.",
12428            0, 1, factor);
12429      case 108957:
12430        /* net */ return new Property("net", "Money",
12431            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
12432      case -1110033957:
12433        /* noteNumber */ return new Property("noteNumber", "positiveInt",
12434            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
12435            java.lang.Integer.MAX_VALUE, noteNumber);
12436      case -231349275:
12437        /* adjudication */ return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
12438            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
12439      default:
12440        return super.getNamedProperty(_hash, _name, _checkValid);
12441      }
12442
12443    }
12444
12445    @Override
12446    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
12447      switch (hash) {
12448      case 1957227299:
12449        /* productOrService */ return this.productOrService == null ? new Base[0]
12450            : new Base[] { this.productOrService }; // CodeableConcept
12451      case -615513385:
12452        /* modifier */ return this.modifier == null ? new Base[0]
12453            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
12454      case -1285004149:
12455        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
12456      case -486196699:
12457        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
12458      case -1282148017:
12459        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
12460      case 108957:
12461        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
12462      case -1110033957:
12463        /* noteNumber */ return this.noteNumber == null ? new Base[0]
12464            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
12465      case -231349275:
12466        /* adjudication */ return this.adjudication == null ? new Base[0]
12467            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
12468      default:
12469        return super.getProperty(hash, name, checkValid);
12470      }
12471
12472    }
12473
12474    @Override
12475    public Base setProperty(int hash, String name, Base value) throws FHIRException {
12476      switch (hash) {
12477      case 1957227299: // productOrService
12478        this.productOrService = castToCodeableConcept(value); // CodeableConcept
12479        return value;
12480      case -615513385: // modifier
12481        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
12482        return value;
12483      case -1285004149: // quantity
12484        this.quantity = castToQuantity(value); // Quantity
12485        return value;
12486      case -486196699: // unitPrice
12487        this.unitPrice = castToMoney(value); // Money
12488        return value;
12489      case -1282148017: // factor
12490        this.factor = castToDecimal(value); // DecimalType
12491        return value;
12492      case 108957: // net
12493        this.net = castToMoney(value); // Money
12494        return value;
12495      case -1110033957: // noteNumber
12496        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
12497        return value;
12498      case -231349275: // adjudication
12499        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
12500        return value;
12501      default:
12502        return super.setProperty(hash, name, value);
12503      }
12504
12505    }
12506
12507    @Override
12508    public Base setProperty(String name, Base value) throws FHIRException {
12509      if (name.equals("productOrService")) {
12510        this.productOrService = castToCodeableConcept(value); // CodeableConcept
12511      } else if (name.equals("modifier")) {
12512        this.getModifier().add(castToCodeableConcept(value));
12513      } else if (name.equals("quantity")) {
12514        this.quantity = castToQuantity(value); // Quantity
12515      } else if (name.equals("unitPrice")) {
12516        this.unitPrice = castToMoney(value); // Money
12517      } else if (name.equals("factor")) {
12518        this.factor = castToDecimal(value); // DecimalType
12519      } else if (name.equals("net")) {
12520        this.net = castToMoney(value); // Money
12521      } else if (name.equals("noteNumber")) {
12522        this.getNoteNumber().add(castToPositiveInt(value));
12523      } else if (name.equals("adjudication")) {
12524        this.getAdjudication().add((AdjudicationComponent) value);
12525      } else
12526        return super.setProperty(name, value);
12527      return value;
12528    }
12529
12530  @Override
12531  public void removeChild(String name, Base value) throws FHIRException {
12532      if (name.equals("productOrService")) {
12533        this.productOrService = null;
12534      } else if (name.equals("modifier")) {
12535        this.getModifier().remove(castToCodeableConcept(value));
12536      } else if (name.equals("quantity")) {
12537        this.quantity = null;
12538      } else if (name.equals("unitPrice")) {
12539        this.unitPrice = null;
12540      } else if (name.equals("factor")) {
12541        this.factor = null;
12542      } else if (name.equals("net")) {
12543        this.net = null;
12544      } else if (name.equals("noteNumber")) {
12545        this.getNoteNumber().remove(castToPositiveInt(value));
12546      } else if (name.equals("adjudication")) {
12547        this.getAdjudication().remove((AdjudicationComponent) value);
12548      } else
12549        super.removeChild(name, value);
12550      
12551    }
12552
12553    @Override
12554    public Base makeProperty(int hash, String name) throws FHIRException {
12555      switch (hash) {
12556      case 1957227299:
12557        return getProductOrService();
12558      case -615513385:
12559        return addModifier();
12560      case -1285004149:
12561        return getQuantity();
12562      case -486196699:
12563        return getUnitPrice();
12564      case -1282148017:
12565        return getFactorElement();
12566      case 108957:
12567        return getNet();
12568      case -1110033957:
12569        return addNoteNumberElement();
12570      case -231349275:
12571        return addAdjudication();
12572      default:
12573        return super.makeProperty(hash, name);
12574      }
12575
12576    }
12577
12578    @Override
12579    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12580      switch (hash) {
12581      case 1957227299:
12582        /* productOrService */ return new String[] { "CodeableConcept" };
12583      case -615513385:
12584        /* modifier */ return new String[] { "CodeableConcept" };
12585      case -1285004149:
12586        /* quantity */ return new String[] { "SimpleQuantity" };
12587      case -486196699:
12588        /* unitPrice */ return new String[] { "Money" };
12589      case -1282148017:
12590        /* factor */ return new String[] { "decimal" };
12591      case 108957:
12592        /* net */ return new String[] { "Money" };
12593      case -1110033957:
12594        /* noteNumber */ return new String[] { "positiveInt" };
12595      case -231349275:
12596        /* adjudication */ return new String[] { "@ExplanationOfBenefit.item.adjudication" };
12597      default:
12598        return super.getTypesForProperty(hash, name);
12599      }
12600
12601    }
12602
12603    @Override
12604    public Base addChild(String name) throws FHIRException {
12605      if (name.equals("productOrService")) {
12606        this.productOrService = new CodeableConcept();
12607        return this.productOrService;
12608      } else if (name.equals("modifier")) {
12609        return addModifier();
12610      } else if (name.equals("quantity")) {
12611        this.quantity = new Quantity();
12612        return this.quantity;
12613      } else if (name.equals("unitPrice")) {
12614        this.unitPrice = new Money();
12615        return this.unitPrice;
12616      } else if (name.equals("factor")) {
12617        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
12618      } else if (name.equals("net")) {
12619        this.net = new Money();
12620        return this.net;
12621      } else if (name.equals("noteNumber")) {
12622        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
12623      } else if (name.equals("adjudication")) {
12624        return addAdjudication();
12625      } else
12626        return super.addChild(name);
12627    }
12628
12629    public AddedItemDetailSubDetailComponent copy() {
12630      AddedItemDetailSubDetailComponent dst = new AddedItemDetailSubDetailComponent();
12631      copyValues(dst);
12632      return dst;
12633    }
12634
12635    public void copyValues(AddedItemDetailSubDetailComponent dst) {
12636      super.copyValues(dst);
12637      dst.productOrService = productOrService == null ? null : productOrService.copy();
12638      if (modifier != null) {
12639        dst.modifier = new ArrayList<CodeableConcept>();
12640        for (CodeableConcept i : modifier)
12641          dst.modifier.add(i.copy());
12642      }
12643      ;
12644      dst.quantity = quantity == null ? null : quantity.copy();
12645      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
12646      dst.factor = factor == null ? null : factor.copy();
12647      dst.net = net == null ? null : net.copy();
12648      if (noteNumber != null) {
12649        dst.noteNumber = new ArrayList<PositiveIntType>();
12650        for (PositiveIntType i : noteNumber)
12651          dst.noteNumber.add(i.copy());
12652      }
12653      ;
12654      if (adjudication != null) {
12655        dst.adjudication = new ArrayList<AdjudicationComponent>();
12656        for (AdjudicationComponent i : adjudication)
12657          dst.adjudication.add(i.copy());
12658      }
12659      ;
12660    }
12661
12662    @Override
12663    public boolean equalsDeep(Base other_) {
12664      if (!super.equalsDeep(other_))
12665        return false;
12666      if (!(other_ instanceof AddedItemDetailSubDetailComponent))
12667        return false;
12668      AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
12669      return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
12670          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
12671          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true)
12672          && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true);
12673    }
12674
12675    @Override
12676    public boolean equalsShallow(Base other_) {
12677      if (!super.equalsShallow(other_))
12678        return false;
12679      if (!(other_ instanceof AddedItemDetailSubDetailComponent))
12680        return false;
12681      AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
12682      return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
12683    }
12684
12685    public boolean isEmpty() {
12686      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier, quantity, unitPrice,
12687          factor, net, noteNumber, adjudication);
12688    }
12689
12690    public String fhirType() {
12691      return "ExplanationOfBenefit.addItem.detail.subDetail";
12692
12693    }
12694
12695  }
12696
12697  @Block()
12698  public static class TotalComponent extends BackboneElement implements IBaseBackboneElement {
12699    /**
12700     * A code to indicate the information type of this adjudication record.
12701     * Information types may include: the value submitted, maximum values or
12702     * percentages allowed or payable under the plan, amounts that the patient is
12703     * responsible for in aggregate or pertaining to this item, amounts paid by
12704     * other coverages, and the benefit payable for this item.
12705     */
12706    @Child(name = "category", type = {
12707        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
12708    @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.")
12709    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/adjudication")
12710    protected CodeableConcept category;
12711
12712    /**
12713     * Monetary total amount associated with the category.
12714     */
12715    @Child(name = "amount", type = { Money.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
12716    @Description(shortDefinition = "Financial total for the category", formalDefinition = "Monetary total amount associated with the category.")
12717    protected Money amount;
12718
12719    private static final long serialVersionUID = 2012310309L;
12720
12721    /**
12722     * Constructor
12723     */
12724    public TotalComponent() {
12725      super();
12726    }
12727
12728    /**
12729     * Constructor
12730     */
12731    public TotalComponent(CodeableConcept category, Money amount) {
12732      super();
12733      this.category = category;
12734      this.amount = amount;
12735    }
12736
12737    /**
12738     * @return {@link #category} (A code to indicate the information type of this
12739     *         adjudication record. Information types may include: the value
12740     *         submitted, maximum values or percentages allowed or payable under the
12741     *         plan, amounts that the patient is responsible for in aggregate or
12742     *         pertaining to this item, amounts paid by other coverages, and the
12743     *         benefit payable for this item.)
12744     */
12745    public CodeableConcept getCategory() {
12746      if (this.category == null)
12747        if (Configuration.errorOnAutoCreate())
12748          throw new Error("Attempt to auto-create TotalComponent.category");
12749        else if (Configuration.doAutoCreate())
12750          this.category = new CodeableConcept(); // cc
12751      return this.category;
12752    }
12753
12754    public boolean hasCategory() {
12755      return this.category != null && !this.category.isEmpty();
12756    }
12757
12758    /**
12759     * @param value {@link #category} (A code to indicate the information type of
12760     *              this adjudication record. Information types may include: the
12761     *              value submitted, maximum values or percentages allowed or
12762     *              payable under the plan, amounts that the patient is responsible
12763     *              for in aggregate or pertaining to this item, amounts paid by
12764     *              other coverages, and the benefit payable for this item.)
12765     */
12766    public TotalComponent setCategory(CodeableConcept value) {
12767      this.category = value;
12768      return this;
12769    }
12770
12771    /**
12772     * @return {@link #amount} (Monetary total amount associated with the category.)
12773     */
12774    public Money getAmount() {
12775      if (this.amount == null)
12776        if (Configuration.errorOnAutoCreate())
12777          throw new Error("Attempt to auto-create TotalComponent.amount");
12778        else if (Configuration.doAutoCreate())
12779          this.amount = new Money(); // cc
12780      return this.amount;
12781    }
12782
12783    public boolean hasAmount() {
12784      return this.amount != null && !this.amount.isEmpty();
12785    }
12786
12787    /**
12788     * @param value {@link #amount} (Monetary total amount associated with the
12789     *              category.)
12790     */
12791    public TotalComponent setAmount(Money value) {
12792      this.amount = value;
12793      return this;
12794    }
12795
12796    protected void listChildren(List<Property> children) {
12797      super.listChildren(children);
12798      children.add(new Property("category", "CodeableConcept",
12799          "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.",
12800          0, 1, category));
12801      children
12802          .add(new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount));
12803    }
12804
12805    @Override
12806    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
12807      switch (_hash) {
12808      case 50511102:
12809        /* category */ return new Property("category", "CodeableConcept",
12810            "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.",
12811            0, 1, category);
12812      case -1413853096:
12813        /* amount */ return new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1,
12814            amount);
12815      default:
12816        return super.getNamedProperty(_hash, _name, _checkValid);
12817      }
12818
12819    }
12820
12821    @Override
12822    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
12823      switch (hash) {
12824      case 50511102:
12825        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
12826      case -1413853096:
12827        /* amount */ return this.amount == null ? new Base[0] : new Base[] { this.amount }; // Money
12828      default:
12829        return super.getProperty(hash, name, checkValid);
12830      }
12831
12832    }
12833
12834    @Override
12835    public Base setProperty(int hash, String name, Base value) throws FHIRException {
12836      switch (hash) {
12837      case 50511102: // category
12838        this.category = castToCodeableConcept(value); // CodeableConcept
12839        return value;
12840      case -1413853096: // amount
12841        this.amount = castToMoney(value); // Money
12842        return value;
12843      default:
12844        return super.setProperty(hash, name, value);
12845      }
12846
12847    }
12848
12849    @Override
12850    public Base setProperty(String name, Base value) throws FHIRException {
12851      if (name.equals("category")) {
12852        this.category = castToCodeableConcept(value); // CodeableConcept
12853      } else if (name.equals("amount")) {
12854        this.amount = castToMoney(value); // Money
12855      } else
12856        return super.setProperty(name, value);
12857      return value;
12858    }
12859
12860  @Override
12861  public void removeChild(String name, Base value) throws FHIRException {
12862      if (name.equals("category")) {
12863        this.category = null;
12864      } else if (name.equals("amount")) {
12865        this.amount = null;
12866      } else
12867        super.removeChild(name, value);
12868      
12869    }
12870
12871    @Override
12872    public Base makeProperty(int hash, String name) throws FHIRException {
12873      switch (hash) {
12874      case 50511102:
12875        return getCategory();
12876      case -1413853096:
12877        return getAmount();
12878      default:
12879        return super.makeProperty(hash, name);
12880      }
12881
12882    }
12883
12884    @Override
12885    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12886      switch (hash) {
12887      case 50511102:
12888        /* category */ return new String[] { "CodeableConcept" };
12889      case -1413853096:
12890        /* amount */ return new String[] { "Money" };
12891      default:
12892        return super.getTypesForProperty(hash, name);
12893      }
12894
12895    }
12896
12897    @Override
12898    public Base addChild(String name) throws FHIRException {
12899      if (name.equals("category")) {
12900        this.category = new CodeableConcept();
12901        return this.category;
12902      } else if (name.equals("amount")) {
12903        this.amount = new Money();
12904        return this.amount;
12905      } else
12906        return super.addChild(name);
12907    }
12908
12909    public TotalComponent copy() {
12910      TotalComponent dst = new TotalComponent();
12911      copyValues(dst);
12912      return dst;
12913    }
12914
12915    public void copyValues(TotalComponent dst) {
12916      super.copyValues(dst);
12917      dst.category = category == null ? null : category.copy();
12918      dst.amount = amount == null ? null : amount.copy();
12919    }
12920
12921    @Override
12922    public boolean equalsDeep(Base other_) {
12923      if (!super.equalsDeep(other_))
12924        return false;
12925      if (!(other_ instanceof TotalComponent))
12926        return false;
12927      TotalComponent o = (TotalComponent) other_;
12928      return compareDeep(category, o.category, true) && compareDeep(amount, o.amount, true);
12929    }
12930
12931    @Override
12932    public boolean equalsShallow(Base other_) {
12933      if (!super.equalsShallow(other_))
12934        return false;
12935      if (!(other_ instanceof TotalComponent))
12936        return false;
12937      TotalComponent o = (TotalComponent) other_;
12938      return true;
12939    }
12940
12941    public boolean isEmpty() {
12942      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, amount);
12943    }
12944
12945    public String fhirType() {
12946      return "ExplanationOfBenefit.total";
12947
12948    }
12949
12950  }
12951
12952  @Block()
12953  public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
12954    /**
12955     * Whether this represents partial or complete payment of the benefits payable.
12956     */
12957    @Child(name = "type", type = {
12958        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
12959    @Description(shortDefinition = "Partial or complete payment", formalDefinition = "Whether this represents partial or complete payment of the benefits payable.")
12960    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-paymenttype")
12961    protected CodeableConcept type;
12962
12963    /**
12964     * Total amount of all adjustments to this payment included in this transaction
12965     * which are not related to this claim's adjudication.
12966     */
12967    @Child(name = "adjustment", type = { Money.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
12968    @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.")
12969    protected Money adjustment;
12970
12971    /**
12972     * Reason for the payment adjustment.
12973     */
12974    @Child(name = "adjustmentReason", type = {
12975        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
12976    @Description(shortDefinition = "Explanation for the variance", formalDefinition = "Reason for the payment adjustment.")
12977    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
12978    protected CodeableConcept adjustmentReason;
12979
12980    /**
12981     * Estimated date the payment will be issued or the actual issue date of
12982     * payment.
12983     */
12984    @Child(name = "date", type = { DateType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
12985    @Description(shortDefinition = "Expected date of payment", formalDefinition = "Estimated date the payment will be issued or the actual issue date of payment.")
12986    protected DateType date;
12987
12988    /**
12989     * Benefits payable less any payment adjustment.
12990     */
12991    @Child(name = "amount", type = { Money.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
12992    @Description(shortDefinition = "Payable amount after adjustment", formalDefinition = "Benefits payable less any payment adjustment.")
12993    protected Money amount;
12994
12995    /**
12996     * Issuer's unique identifier for the payment instrument.
12997     */
12998    @Child(name = "identifier", type = {
12999        Identifier.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
13000    @Description(shortDefinition = "Business identifier for the payment", formalDefinition = "Issuer's unique identifier for the payment instrument.")
13001    protected Identifier identifier;
13002
13003    private static final long serialVersionUID = 1539906026L;
13004
13005    /**
13006     * Constructor
13007     */
13008    public PaymentComponent() {
13009      super();
13010    }
13011
13012    /**
13013     * @return {@link #type} (Whether this represents partial or complete payment of
13014     *         the benefits payable.)
13015     */
13016    public CodeableConcept getType() {
13017      if (this.type == null)
13018        if (Configuration.errorOnAutoCreate())
13019          throw new Error("Attempt to auto-create PaymentComponent.type");
13020        else if (Configuration.doAutoCreate())
13021          this.type = new CodeableConcept(); // cc
13022      return this.type;
13023    }
13024
13025    public boolean hasType() {
13026      return this.type != null && !this.type.isEmpty();
13027    }
13028
13029    /**
13030     * @param value {@link #type} (Whether this represents partial or complete
13031     *              payment of the benefits payable.)
13032     */
13033    public PaymentComponent setType(CodeableConcept value) {
13034      this.type = value;
13035      return this;
13036    }
13037
13038    /**
13039     * @return {@link #adjustment} (Total amount of all adjustments to this payment
13040     *         included in this transaction which are not related to this claim's
13041     *         adjudication.)
13042     */
13043    public Money getAdjustment() {
13044      if (this.adjustment == null)
13045        if (Configuration.errorOnAutoCreate())
13046          throw new Error("Attempt to auto-create PaymentComponent.adjustment");
13047        else if (Configuration.doAutoCreate())
13048          this.adjustment = new Money(); // cc
13049      return this.adjustment;
13050    }
13051
13052    public boolean hasAdjustment() {
13053      return this.adjustment != null && !this.adjustment.isEmpty();
13054    }
13055
13056    /**
13057     * @param value {@link #adjustment} (Total amount of all adjustments to this
13058     *              payment included in this transaction which are not related to
13059     *              this claim's adjudication.)
13060     */
13061    public PaymentComponent setAdjustment(Money value) {
13062      this.adjustment = value;
13063      return this;
13064    }
13065
13066    /**
13067     * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
13068     */
13069    public CodeableConcept getAdjustmentReason() {
13070      if (this.adjustmentReason == null)
13071        if (Configuration.errorOnAutoCreate())
13072          throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
13073        else if (Configuration.doAutoCreate())
13074          this.adjustmentReason = new CodeableConcept(); // cc
13075      return this.adjustmentReason;
13076    }
13077
13078    public boolean hasAdjustmentReason() {
13079      return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
13080    }
13081
13082    /**
13083     * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
13084     */
13085    public PaymentComponent setAdjustmentReason(CodeableConcept value) {
13086      this.adjustmentReason = value;
13087      return this;
13088    }
13089
13090    /**
13091     * @return {@link #date} (Estimated date the payment will be issued or the
13092     *         actual issue date of payment.). This is the underlying object with
13093     *         id, value and extensions. The accessor "getDate" gives direct access
13094     *         to the value
13095     */
13096    public DateType getDateElement() {
13097      if (this.date == null)
13098        if (Configuration.errorOnAutoCreate())
13099          throw new Error("Attempt to auto-create PaymentComponent.date");
13100        else if (Configuration.doAutoCreate())
13101          this.date = new DateType(); // bb
13102      return this.date;
13103    }
13104
13105    public boolean hasDateElement() {
13106      return this.date != null && !this.date.isEmpty();
13107    }
13108
13109    public boolean hasDate() {
13110      return this.date != null && !this.date.isEmpty();
13111    }
13112
13113    /**
13114     * @param value {@link #date} (Estimated date the payment will be issued or the
13115     *              actual issue date of payment.). This is the underlying object
13116     *              with id, value and extensions. The accessor "getDate" gives
13117     *              direct access to the value
13118     */
13119    public PaymentComponent setDateElement(DateType value) {
13120      this.date = value;
13121      return this;
13122    }
13123
13124    /**
13125     * @return Estimated date the payment will be issued or the actual issue date of
13126     *         payment.
13127     */
13128    public Date getDate() {
13129      return this.date == null ? null : this.date.getValue();
13130    }
13131
13132    /**
13133     * @param value Estimated date the payment will be issued or the actual issue
13134     *              date of payment.
13135     */
13136    public PaymentComponent setDate(Date value) {
13137      if (value == null)
13138        this.date = null;
13139      else {
13140        if (this.date == null)
13141          this.date = new DateType();
13142        this.date.setValue(value);
13143      }
13144      return this;
13145    }
13146
13147    /**
13148     * @return {@link #amount} (Benefits payable less any payment adjustment.)
13149     */
13150    public Money getAmount() {
13151      if (this.amount == null)
13152        if (Configuration.errorOnAutoCreate())
13153          throw new Error("Attempt to auto-create PaymentComponent.amount");
13154        else if (Configuration.doAutoCreate())
13155          this.amount = new Money(); // cc
13156      return this.amount;
13157    }
13158
13159    public boolean hasAmount() {
13160      return this.amount != null && !this.amount.isEmpty();
13161    }
13162
13163    /**
13164     * @param value {@link #amount} (Benefits payable less any payment adjustment.)
13165     */
13166    public PaymentComponent setAmount(Money value) {
13167      this.amount = value;
13168      return this;
13169    }
13170
13171    /**
13172     * @return {@link #identifier} (Issuer's unique identifier for the payment
13173     *         instrument.)
13174     */
13175    public Identifier getIdentifier() {
13176      if (this.identifier == null)
13177        if (Configuration.errorOnAutoCreate())
13178          throw new Error("Attempt to auto-create PaymentComponent.identifier");
13179        else if (Configuration.doAutoCreate())
13180          this.identifier = new Identifier(); // cc
13181      return this.identifier;
13182    }
13183
13184    public boolean hasIdentifier() {
13185      return this.identifier != null && !this.identifier.isEmpty();
13186    }
13187
13188    /**
13189     * @param value {@link #identifier} (Issuer's unique identifier for the payment
13190     *              instrument.)
13191     */
13192    public PaymentComponent setIdentifier(Identifier value) {
13193      this.identifier = value;
13194      return this;
13195    }
13196
13197    protected void listChildren(List<Property> children) {
13198      super.listChildren(children);
13199      children.add(new Property("type", "CodeableConcept",
13200          "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type));
13201      children.add(new Property("adjustment", "Money",
13202          "Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.",
13203          0, 1, adjustment));
13204      children.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1,
13205          adjustmentReason));
13206      children.add(new Property("date", "date",
13207          "Estimated date the payment will be issued or the actual issue date of payment.", 0, 1, date));
13208      children.add(new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount));
13209      children.add(new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0,
13210          1, identifier));
13211    }
13212
13213    @Override
13214    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
13215      switch (_hash) {
13216      case 3575610:
13217        /* type */ return new Property("type", "CodeableConcept",
13218            "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type);
13219      case 1977085293:
13220        /* adjustment */ return new Property("adjustment", "Money",
13221            "Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.",
13222            0, 1, adjustment);
13223      case -1255938543:
13224        /* adjustmentReason */ return new Property("adjustmentReason", "CodeableConcept",
13225            "Reason for the payment adjustment.", 0, 1, adjustmentReason);
13226      case 3076014:
13227        /* date */ return new Property("date", "date",
13228            "Estimated date the payment will be issued or the actual issue date of payment.", 0, 1, date);
13229      case -1413853096:
13230        /* amount */ return new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1,
13231            amount);
13232      case -1618432855:
13233        /* identifier */ return new Property("identifier", "Identifier",
13234            "Issuer's unique identifier for the payment instrument.", 0, 1, identifier);
13235      default:
13236        return super.getNamedProperty(_hash, _name, _checkValid);
13237      }
13238
13239    }
13240
13241    @Override
13242    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
13243      switch (hash) {
13244      case 3575610:
13245        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
13246      case 1977085293:
13247        /* adjustment */ return this.adjustment == null ? new Base[0] : new Base[] { this.adjustment }; // Money
13248      case -1255938543:
13249        /* adjustmentReason */ return this.adjustmentReason == null ? new Base[0]
13250            : new Base[] { this.adjustmentReason }; // CodeableConcept
13251      case 3076014:
13252        /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateType
13253      case -1413853096:
13254        /* amount */ return this.amount == null ? new Base[0] : new Base[] { this.amount }; // Money
13255      case -1618432855:
13256        /* identifier */ return this.identifier == null ? new Base[0] : new Base[] { this.identifier }; // Identifier
13257      default:
13258        return super.getProperty(hash, name, checkValid);
13259      }
13260
13261    }
13262
13263    @Override
13264    public Base setProperty(int hash, String name, Base value) throws FHIRException {
13265      switch (hash) {
13266      case 3575610: // type
13267        this.type = castToCodeableConcept(value); // CodeableConcept
13268        return value;
13269      case 1977085293: // adjustment
13270        this.adjustment = castToMoney(value); // Money
13271        return value;
13272      case -1255938543: // adjustmentReason
13273        this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
13274        return value;
13275      case 3076014: // date
13276        this.date = castToDate(value); // DateType
13277        return value;
13278      case -1413853096: // amount
13279        this.amount = castToMoney(value); // Money
13280        return value;
13281      case -1618432855: // identifier
13282        this.identifier = castToIdentifier(value); // Identifier
13283        return value;
13284      default:
13285        return super.setProperty(hash, name, value);
13286      }
13287
13288    }
13289
13290    @Override
13291    public Base setProperty(String name, Base value) throws FHIRException {
13292      if (name.equals("type")) {
13293        this.type = castToCodeableConcept(value); // CodeableConcept
13294      } else if (name.equals("adjustment")) {
13295        this.adjustment = castToMoney(value); // Money
13296      } else if (name.equals("adjustmentReason")) {
13297        this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
13298      } else if (name.equals("date")) {
13299        this.date = castToDate(value); // DateType
13300      } else if (name.equals("amount")) {
13301        this.amount = castToMoney(value); // Money
13302      } else if (name.equals("identifier")) {
13303        this.identifier = castToIdentifier(value); // Identifier
13304      } else
13305        return super.setProperty(name, value);
13306      return value;
13307    }
13308
13309  @Override
13310  public void removeChild(String name, Base value) throws FHIRException {
13311      if (name.equals("type")) {
13312        this.type = null;
13313      } else if (name.equals("adjustment")) {
13314        this.adjustment = null;
13315      } else if (name.equals("adjustmentReason")) {
13316        this.adjustmentReason = null;
13317      } else if (name.equals("date")) {
13318        this.date = null;
13319      } else if (name.equals("amount")) {
13320        this.amount = null;
13321      } else if (name.equals("identifier")) {
13322        this.identifier = null;
13323      } else
13324        super.removeChild(name, value);
13325      
13326    }
13327
13328    @Override
13329    public Base makeProperty(int hash, String name) throws FHIRException {
13330      switch (hash) {
13331      case 3575610:
13332        return getType();
13333      case 1977085293:
13334        return getAdjustment();
13335      case -1255938543:
13336        return getAdjustmentReason();
13337      case 3076014:
13338        return getDateElement();
13339      case -1413853096:
13340        return getAmount();
13341      case -1618432855:
13342        return getIdentifier();
13343      default:
13344        return super.makeProperty(hash, name);
13345      }
13346
13347    }
13348
13349    @Override
13350    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
13351      switch (hash) {
13352      case 3575610:
13353        /* type */ return new String[] { "CodeableConcept" };
13354      case 1977085293:
13355        /* adjustment */ return new String[] { "Money" };
13356      case -1255938543:
13357        /* adjustmentReason */ return new String[] { "CodeableConcept" };
13358      case 3076014:
13359        /* date */ return new String[] { "date" };
13360      case -1413853096:
13361        /* amount */ return new String[] { "Money" };
13362      case -1618432855:
13363        /* identifier */ return new String[] { "Identifier" };
13364      default:
13365        return super.getTypesForProperty(hash, name);
13366      }
13367
13368    }
13369
13370    @Override
13371    public Base addChild(String name) throws FHIRException {
13372      if (name.equals("type")) {
13373        this.type = new CodeableConcept();
13374        return this.type;
13375      } else if (name.equals("adjustment")) {
13376        this.adjustment = new Money();
13377        return this.adjustment;
13378      } else if (name.equals("adjustmentReason")) {
13379        this.adjustmentReason = new CodeableConcept();
13380        return this.adjustmentReason;
13381      } else if (name.equals("date")) {
13382        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.date");
13383      } else if (name.equals("amount")) {
13384        this.amount = new Money();
13385        return this.amount;
13386      } else if (name.equals("identifier")) {
13387        this.identifier = new Identifier();
13388        return this.identifier;
13389      } else
13390        return super.addChild(name);
13391    }
13392
13393    public PaymentComponent copy() {
13394      PaymentComponent dst = new PaymentComponent();
13395      copyValues(dst);
13396      return dst;
13397    }
13398
13399    public void copyValues(PaymentComponent dst) {
13400      super.copyValues(dst);
13401      dst.type = type == null ? null : type.copy();
13402      dst.adjustment = adjustment == null ? null : adjustment.copy();
13403      dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
13404      dst.date = date == null ? null : date.copy();
13405      dst.amount = amount == null ? null : amount.copy();
13406      dst.identifier = identifier == null ? null : identifier.copy();
13407    }
13408
13409    @Override
13410    public boolean equalsDeep(Base other_) {
13411      if (!super.equalsDeep(other_))
13412        return false;
13413      if (!(other_ instanceof PaymentComponent))
13414        return false;
13415      PaymentComponent o = (PaymentComponent) other_;
13416      return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true)
13417          && compareDeep(adjustmentReason, o.adjustmentReason, true) && compareDeep(date, o.date, true)
13418          && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true);
13419    }
13420
13421    @Override
13422    public boolean equalsShallow(Base other_) {
13423      if (!super.equalsShallow(other_))
13424        return false;
13425      if (!(other_ instanceof PaymentComponent))
13426        return false;
13427      PaymentComponent o = (PaymentComponent) other_;
13428      return compareValues(date, o.date, true);
13429    }
13430
13431    public boolean isEmpty() {
13432      return super.isEmpty()
13433          && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason, date, amount, identifier);
13434    }
13435
13436    public String fhirType() {
13437      return "ExplanationOfBenefit.payment";
13438
13439    }
13440
13441  }
13442
13443  @Block()
13444  public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
13445    /**
13446     * A number to uniquely identify a note entry.
13447     */
13448    @Child(name = "number", type = {
13449        PositiveIntType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
13450    @Description(shortDefinition = "Note instance identifier", formalDefinition = "A number to uniquely identify a note entry.")
13451    protected PositiveIntType number;
13452
13453    /**
13454     * The business purpose of the note text.
13455     */
13456    @Child(name = "type", type = { CodeType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
13457    @Description(shortDefinition = "display | print | printoper", formalDefinition = "The business purpose of the note text.")
13458    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/note-type")
13459    protected Enumeration<NoteType> type;
13460
13461    /**
13462     * The explanation or description associated with the processing.
13463     */
13464    @Child(name = "text", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
13465    @Description(shortDefinition = "Note explanatory text", formalDefinition = "The explanation or description associated with the processing.")
13466    protected StringType text;
13467
13468    /**
13469     * A code to define the language used in the text of the note.
13470     */
13471    @Child(name = "language", type = {
13472        CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
13473    @Description(shortDefinition = "Language of the text", formalDefinition = "A code to define the language used in the text of the note.")
13474    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/languages")
13475    protected CodeableConcept language;
13476
13477    private static final long serialVersionUID = -385184277L;
13478
13479    /**
13480     * Constructor
13481     */
13482    public NoteComponent() {
13483      super();
13484    }
13485
13486    /**
13487     * @return {@link #number} (A number to uniquely identify a note entry.). This
13488     *         is the underlying object with id, value and extensions. The accessor
13489     *         "getNumber" gives direct access to the value
13490     */
13491    public PositiveIntType getNumberElement() {
13492      if (this.number == null)
13493        if (Configuration.errorOnAutoCreate())
13494          throw new Error("Attempt to auto-create NoteComponent.number");
13495        else if (Configuration.doAutoCreate())
13496          this.number = new PositiveIntType(); // bb
13497      return this.number;
13498    }
13499
13500    public boolean hasNumberElement() {
13501      return this.number != null && !this.number.isEmpty();
13502    }
13503
13504    public boolean hasNumber() {
13505      return this.number != null && !this.number.isEmpty();
13506    }
13507
13508    /**
13509     * @param value {@link #number} (A number to uniquely identify a note entry.).
13510     *              This is the underlying object with id, value and extensions. The
13511     *              accessor "getNumber" gives direct access to the value
13512     */
13513    public NoteComponent setNumberElement(PositiveIntType value) {
13514      this.number = value;
13515      return this;
13516    }
13517
13518    /**
13519     * @return A number to uniquely identify a note entry.
13520     */
13521    public int getNumber() {
13522      return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
13523    }
13524
13525    /**
13526     * @param value A number to uniquely identify a note entry.
13527     */
13528    public NoteComponent setNumber(int value) {
13529      if (this.number == null)
13530        this.number = new PositiveIntType();
13531      this.number.setValue(value);
13532      return this;
13533    }
13534
13535    /**
13536     * @return {@link #type} (The business purpose of the note text.). This is the
13537     *         underlying object with id, value and extensions. The accessor
13538     *         "getType" gives direct access to the value
13539     */
13540    public Enumeration<NoteType> getTypeElement() {
13541      if (this.type == null)
13542        if (Configuration.errorOnAutoCreate())
13543          throw new Error("Attempt to auto-create NoteComponent.type");
13544        else if (Configuration.doAutoCreate())
13545          this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory()); // bb
13546      return this.type;
13547    }
13548
13549    public boolean hasTypeElement() {
13550      return this.type != null && !this.type.isEmpty();
13551    }
13552
13553    public boolean hasType() {
13554      return this.type != null && !this.type.isEmpty();
13555    }
13556
13557    /**
13558     * @param value {@link #type} (The business purpose of the note text.). This is
13559     *              the underlying object with id, value and extensions. The
13560     *              accessor "getType" gives direct access to the value
13561     */
13562    public NoteComponent setTypeElement(Enumeration<NoteType> value) {
13563      this.type = value;
13564      return this;
13565    }
13566
13567    /**
13568     * @return The business purpose of the note text.
13569     */
13570    public NoteType getType() {
13571      return this.type == null ? null : this.type.getValue();
13572    }
13573
13574    /**
13575     * @param value The business purpose of the note text.
13576     */
13577    public NoteComponent setType(NoteType value) {
13578      if (value == null)
13579        this.type = null;
13580      else {
13581        if (this.type == null)
13582          this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory());
13583        this.type.setValue(value);
13584      }
13585      return this;
13586    }
13587
13588    /**
13589     * @return {@link #text} (The explanation or description associated with the
13590     *         processing.). This is the underlying object with id, value and
13591     *         extensions. The accessor "getText" gives direct access to the value
13592     */
13593    public StringType getTextElement() {
13594      if (this.text == null)
13595        if (Configuration.errorOnAutoCreate())
13596          throw new Error("Attempt to auto-create NoteComponent.text");
13597        else if (Configuration.doAutoCreate())
13598          this.text = new StringType(); // bb
13599      return this.text;
13600    }
13601
13602    public boolean hasTextElement() {
13603      return this.text != null && !this.text.isEmpty();
13604    }
13605
13606    public boolean hasText() {
13607      return this.text != null && !this.text.isEmpty();
13608    }
13609
13610    /**
13611     * @param value {@link #text} (The explanation or description associated with
13612     *              the processing.). This is the underlying object with id, value
13613     *              and extensions. The accessor "getText" gives direct access to
13614     *              the value
13615     */
13616    public NoteComponent setTextElement(StringType value) {
13617      this.text = value;
13618      return this;
13619    }
13620
13621    /**
13622     * @return The explanation or description associated with the processing.
13623     */
13624    public String getText() {
13625      return this.text == null ? null : this.text.getValue();
13626    }
13627
13628    /**
13629     * @param value The explanation or description associated with the processing.
13630     */
13631    public NoteComponent setText(String value) {
13632      if (Utilities.noString(value))
13633        this.text = null;
13634      else {
13635        if (this.text == null)
13636          this.text = new StringType();
13637        this.text.setValue(value);
13638      }
13639      return this;
13640    }
13641
13642    /**
13643     * @return {@link #language} (A code to define the language used in the text of
13644     *         the note.)
13645     */
13646    public CodeableConcept getLanguage() {
13647      if (this.language == null)
13648        if (Configuration.errorOnAutoCreate())
13649          throw new Error("Attempt to auto-create NoteComponent.language");
13650        else if (Configuration.doAutoCreate())
13651          this.language = new CodeableConcept(); // cc
13652      return this.language;
13653    }
13654
13655    public boolean hasLanguage() {
13656      return this.language != null && !this.language.isEmpty();
13657    }
13658
13659    /**
13660     * @param value {@link #language} (A code to define the language used in the
13661     *              text of the note.)
13662     */
13663    public NoteComponent setLanguage(CodeableConcept value) {
13664      this.language = value;
13665      return this;
13666    }
13667
13668    protected void listChildren(List<Property> children) {
13669      super.listChildren(children);
13670      children.add(new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number));
13671      children.add(new Property("type", "code", "The business purpose of the note text.", 0, 1, type));
13672      children.add(
13673          new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text));
13674      children.add(new Property("language", "CodeableConcept",
13675          "A code to define the language used in the text of the note.", 0, 1, language));
13676    }
13677
13678    @Override
13679    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
13680      switch (_hash) {
13681      case -1034364087:
13682        /* number */ return new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1,
13683            number);
13684      case 3575610:
13685        /* type */ return new Property("type", "code", "The business purpose of the note text.", 0, 1, type);
13686      case 3556653:
13687        /* text */ return new Property("text", "string",
13688            "The explanation or description associated with the processing.", 0, 1, text);
13689      case -1613589672:
13690        /* language */ return new Property("language", "CodeableConcept",
13691            "A code to define the language used in the text of the note.", 0, 1, language);
13692      default:
13693        return super.getNamedProperty(_hash, _name, _checkValid);
13694      }
13695
13696    }
13697
13698    @Override
13699    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
13700      switch (hash) {
13701      case -1034364087:
13702        /* number */ return this.number == null ? new Base[0] : new Base[] { this.number }; // PositiveIntType
13703      case 3575610:
13704        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // Enumeration<NoteType>
13705      case 3556653:
13706        /* text */ return this.text == null ? new Base[0] : new Base[] { this.text }; // StringType
13707      case -1613589672:
13708        /* language */ return this.language == null ? new Base[0] : new Base[] { this.language }; // CodeableConcept
13709      default:
13710        return super.getProperty(hash, name, checkValid);
13711      }
13712
13713    }
13714
13715    @Override
13716    public Base setProperty(int hash, String name, Base value) throws FHIRException {
13717      switch (hash) {
13718      case -1034364087: // number
13719        this.number = castToPositiveInt(value); // PositiveIntType
13720        return value;
13721      case 3575610: // type
13722        value = new NoteTypeEnumFactory().fromType(castToCode(value));
13723        this.type = (Enumeration) value; // Enumeration<NoteType>
13724        return value;
13725      case 3556653: // text
13726        this.text = castToString(value); // StringType
13727        return value;
13728      case -1613589672: // language
13729        this.language = castToCodeableConcept(value); // CodeableConcept
13730        return value;
13731      default:
13732        return super.setProperty(hash, name, value);
13733      }
13734
13735    }
13736
13737    @Override
13738    public Base setProperty(String name, Base value) throws FHIRException {
13739      if (name.equals("number")) {
13740        this.number = castToPositiveInt(value); // PositiveIntType
13741      } else if (name.equals("type")) {
13742        value = new NoteTypeEnumFactory().fromType(castToCode(value));
13743        this.type = (Enumeration) value; // Enumeration<NoteType>
13744      } else if (name.equals("text")) {
13745        this.text = castToString(value); // StringType
13746      } else if (name.equals("language")) {
13747        this.language = castToCodeableConcept(value); // CodeableConcept
13748      } else
13749        return super.setProperty(name, value);
13750      return value;
13751    }
13752
13753  @Override
13754  public void removeChild(String name, Base value) throws FHIRException {
13755      if (name.equals("number")) {
13756        this.number = null;
13757      } else if (name.equals("type")) {
13758        this.type = null;
13759      } else if (name.equals("text")) {
13760        this.text = null;
13761      } else if (name.equals("language")) {
13762        this.language = null;
13763      } else
13764        super.removeChild(name, value);
13765      
13766    }
13767
13768    @Override
13769    public Base makeProperty(int hash, String name) throws FHIRException {
13770      switch (hash) {
13771      case -1034364087:
13772        return getNumberElement();
13773      case 3575610:
13774        return getTypeElement();
13775      case 3556653:
13776        return getTextElement();
13777      case -1613589672:
13778        return getLanguage();
13779      default:
13780        return super.makeProperty(hash, name);
13781      }
13782
13783    }
13784
13785    @Override
13786    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
13787      switch (hash) {
13788      case -1034364087:
13789        /* number */ return new String[] { "positiveInt" };
13790      case 3575610:
13791        /* type */ return new String[] { "code" };
13792      case 3556653:
13793        /* text */ return new String[] { "string" };
13794      case -1613589672:
13795        /* language */ return new String[] { "CodeableConcept" };
13796      default:
13797        return super.getTypesForProperty(hash, name);
13798      }
13799
13800    }
13801
13802    @Override
13803    public Base addChild(String name) throws FHIRException {
13804      if (name.equals("number")) {
13805        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.number");
13806      } else if (name.equals("type")) {
13807        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.type");
13808      } else if (name.equals("text")) {
13809        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.text");
13810      } else if (name.equals("language")) {
13811        this.language = new CodeableConcept();
13812        return this.language;
13813      } else
13814        return super.addChild(name);
13815    }
13816
13817    public NoteComponent copy() {
13818      NoteComponent dst = new NoteComponent();
13819      copyValues(dst);
13820      return dst;
13821    }
13822
13823    public void copyValues(NoteComponent dst) {
13824      super.copyValues(dst);
13825      dst.number = number == null ? null : number.copy();
13826      dst.type = type == null ? null : type.copy();
13827      dst.text = text == null ? null : text.copy();
13828      dst.language = language == null ? null : language.copy();
13829    }
13830
13831    @Override
13832    public boolean equalsDeep(Base other_) {
13833      if (!super.equalsDeep(other_))
13834        return false;
13835      if (!(other_ instanceof NoteComponent))
13836        return false;
13837      NoteComponent o = (NoteComponent) other_;
13838      return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
13839          && compareDeep(language, o.language, true);
13840    }
13841
13842    @Override
13843    public boolean equalsShallow(Base other_) {
13844      if (!super.equalsShallow(other_))
13845        return false;
13846      if (!(other_ instanceof NoteComponent))
13847        return false;
13848      NoteComponent o = (NoteComponent) other_;
13849      return compareValues(number, o.number, true) && compareValues(type, o.type, true)
13850          && compareValues(text, o.text, true);
13851    }
13852
13853    public boolean isEmpty() {
13854      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language);
13855    }
13856
13857    public String fhirType() {
13858      return "ExplanationOfBenefit.processNote";
13859
13860    }
13861
13862  }
13863
13864  @Block()
13865  public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
13866    /**
13867     * Code to identify the general type of benefits under which products and
13868     * services are provided.
13869     */
13870    @Child(name = "category", type = {
13871        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
13872    @Description(shortDefinition = "Benefit classification", formalDefinition = "Code to identify the general type of benefits under which products and services are provided.")
13873    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-benefitcategory")
13874    protected CodeableConcept category;
13875
13876    /**
13877     * True if the indicated class of service is excluded from the plan, missing or
13878     * False indicates the product or service is included in the coverage.
13879     */
13880    @Child(name = "excluded", type = {
13881        BooleanType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
13882    @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.")
13883    protected BooleanType excluded;
13884
13885    /**
13886     * A short name or tag for the benefit.
13887     */
13888    @Child(name = "name", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
13889    @Description(shortDefinition = "Short name for the benefit", formalDefinition = "A short name or tag for the benefit.")
13890    protected StringType name;
13891
13892    /**
13893     * A richer description of the benefit or services covered.
13894     */
13895    @Child(name = "description", type = {
13896        StringType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
13897    @Description(shortDefinition = "Description of the benefit or services covered", formalDefinition = "A richer description of the benefit or services covered.")
13898    protected StringType description;
13899
13900    /**
13901     * Is a flag to indicate whether the benefits refer to in-network providers or
13902     * out-of-network providers.
13903     */
13904    @Child(name = "network", type = {
13905        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
13906    @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.")
13907    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/benefit-network")
13908    protected CodeableConcept network;
13909
13910    /**
13911     * Indicates if the benefits apply to an individual or to the family.
13912     */
13913    @Child(name = "unit", type = {
13914        CodeableConcept.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
13915    @Description(shortDefinition = "Individual or family", formalDefinition = "Indicates if the benefits apply to an individual or to the family.")
13916    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/benefit-unit")
13917    protected CodeableConcept unit;
13918
13919    /**
13920     * The term or period of the values such as 'maximum lifetime benefit' or
13921     * 'maximum annual visits'.
13922     */
13923    @Child(name = "term", type = {
13924        CodeableConcept.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
13925    @Description(shortDefinition = "Annual or lifetime", formalDefinition = "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.")
13926    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/benefit-term")
13927    protected CodeableConcept term;
13928
13929    /**
13930     * Benefits Used to date.
13931     */
13932    @Child(name = "financial", type = {}, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
13933    @Description(shortDefinition = "Benefit Summary", formalDefinition = "Benefits Used to date.")
13934    protected List<BenefitComponent> financial;
13935
13936    private static final long serialVersionUID = -1889655824L;
13937
13938    /**
13939     * Constructor
13940     */
13941    public BenefitBalanceComponent() {
13942      super();
13943    }
13944
13945    /**
13946     * Constructor
13947     */
13948    public BenefitBalanceComponent(CodeableConcept category) {
13949      super();
13950      this.category = category;
13951    }
13952
13953    /**
13954     * @return {@link #category} (Code to identify the general type of benefits
13955     *         under which products and services are provided.)
13956     */
13957    public CodeableConcept getCategory() {
13958      if (this.category == null)
13959        if (Configuration.errorOnAutoCreate())
13960          throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
13961        else if (Configuration.doAutoCreate())
13962          this.category = new CodeableConcept(); // cc
13963      return this.category;
13964    }
13965
13966    public boolean hasCategory() {
13967      return this.category != null && !this.category.isEmpty();
13968    }
13969
13970    /**
13971     * @param value {@link #category} (Code to identify the general type of benefits
13972     *              under which products and services are provided.)
13973     */
13974    public BenefitBalanceComponent setCategory(CodeableConcept value) {
13975      this.category = value;
13976      return this;
13977    }
13978
13979    /**
13980     * @return {@link #excluded} (True if the indicated class of service is excluded
13981     *         from the plan, missing or False indicates the product or service is
13982     *         included in the coverage.). This is the underlying object with id,
13983     *         value and extensions. The accessor "getExcluded" gives direct access
13984     *         to the value
13985     */
13986    public BooleanType getExcludedElement() {
13987      if (this.excluded == null)
13988        if (Configuration.errorOnAutoCreate())
13989          throw new Error("Attempt to auto-create BenefitBalanceComponent.excluded");
13990        else if (Configuration.doAutoCreate())
13991          this.excluded = new BooleanType(); // bb
13992      return this.excluded;
13993    }
13994
13995    public boolean hasExcludedElement() {
13996      return this.excluded != null && !this.excluded.isEmpty();
13997    }
13998
13999    public boolean hasExcluded() {
14000      return this.excluded != null && !this.excluded.isEmpty();
14001    }
14002
14003    /**
14004     * @param value {@link #excluded} (True if the indicated class of service is
14005     *              excluded from the plan, missing or False indicates the product
14006     *              or service is included in the coverage.). This is the underlying
14007     *              object with id, value and extensions. The accessor "getExcluded"
14008     *              gives direct access to the value
14009     */
14010    public BenefitBalanceComponent setExcludedElement(BooleanType value) {
14011      this.excluded = value;
14012      return this;
14013    }
14014
14015    /**
14016     * @return True if the indicated class of service is excluded from the plan,
14017     *         missing or False indicates the product or service is included in the
14018     *         coverage.
14019     */
14020    public boolean getExcluded() {
14021      return this.excluded == null || this.excluded.isEmpty() ? false : this.excluded.getValue();
14022    }
14023
14024    /**
14025     * @param value True if the indicated class of service is excluded from the
14026     *              plan, missing or False indicates the product or service is
14027     *              included in the coverage.
14028     */
14029    public BenefitBalanceComponent setExcluded(boolean value) {
14030      if (this.excluded == null)
14031        this.excluded = new BooleanType();
14032      this.excluded.setValue(value);
14033      return this;
14034    }
14035
14036    /**
14037     * @return {@link #name} (A short name or tag for the benefit.). This is the
14038     *         underlying object with id, value and extensions. The accessor
14039     *         "getName" gives direct access to the value
14040     */
14041    public StringType getNameElement() {
14042      if (this.name == null)
14043        if (Configuration.errorOnAutoCreate())
14044          throw new Error("Attempt to auto-create BenefitBalanceComponent.name");
14045        else if (Configuration.doAutoCreate())
14046          this.name = new StringType(); // bb
14047      return this.name;
14048    }
14049
14050    public boolean hasNameElement() {
14051      return this.name != null && !this.name.isEmpty();
14052    }
14053
14054    public boolean hasName() {
14055      return this.name != null && !this.name.isEmpty();
14056    }
14057
14058    /**
14059     * @param value {@link #name} (A short name or tag for the benefit.). This is
14060     *              the underlying object with id, value and extensions. The
14061     *              accessor "getName" gives direct access to the value
14062     */
14063    public BenefitBalanceComponent setNameElement(StringType value) {
14064      this.name = value;
14065      return this;
14066    }
14067
14068    /**
14069     * @return A short name or tag for the benefit.
14070     */
14071    public String getName() {
14072      return this.name == null ? null : this.name.getValue();
14073    }
14074
14075    /**
14076     * @param value A short name or tag for the benefit.
14077     */
14078    public BenefitBalanceComponent setName(String value) {
14079      if (Utilities.noString(value))
14080        this.name = null;
14081      else {
14082        if (this.name == null)
14083          this.name = new StringType();
14084        this.name.setValue(value);
14085      }
14086      return this;
14087    }
14088
14089    /**
14090     * @return {@link #description} (A richer description of the benefit or services
14091     *         covered.). This is the underlying object with id, value and
14092     *         extensions. The accessor "getDescription" gives direct access to the
14093     *         value
14094     */
14095    public StringType getDescriptionElement() {
14096      if (this.description == null)
14097        if (Configuration.errorOnAutoCreate())
14098          throw new Error("Attempt to auto-create BenefitBalanceComponent.description");
14099        else if (Configuration.doAutoCreate())
14100          this.description = new StringType(); // bb
14101      return this.description;
14102    }
14103
14104    public boolean hasDescriptionElement() {
14105      return this.description != null && !this.description.isEmpty();
14106    }
14107
14108    public boolean hasDescription() {
14109      return this.description != null && !this.description.isEmpty();
14110    }
14111
14112    /**
14113     * @param value {@link #description} (A richer description of the benefit or
14114     *              services covered.). This is the underlying object with id, value
14115     *              and extensions. The accessor "getDescription" gives direct
14116     *              access to the value
14117     */
14118    public BenefitBalanceComponent setDescriptionElement(StringType value) {
14119      this.description = value;
14120      return this;
14121    }
14122
14123    /**
14124     * @return A richer description of the benefit or services covered.
14125     */
14126    public String getDescription() {
14127      return this.description == null ? null : this.description.getValue();
14128    }
14129
14130    /**
14131     * @param value A richer description of the benefit or services covered.
14132     */
14133    public BenefitBalanceComponent setDescription(String value) {
14134      if (Utilities.noString(value))
14135        this.description = null;
14136      else {
14137        if (this.description == null)
14138          this.description = new StringType();
14139        this.description.setValue(value);
14140      }
14141      return this;
14142    }
14143
14144    /**
14145     * @return {@link #network} (Is a flag to indicate whether the benefits refer to
14146     *         in-network providers or out-of-network providers.)
14147     */
14148    public CodeableConcept getNetwork() {
14149      if (this.network == null)
14150        if (Configuration.errorOnAutoCreate())
14151          throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
14152        else if (Configuration.doAutoCreate())
14153          this.network = new CodeableConcept(); // cc
14154      return this.network;
14155    }
14156
14157    public boolean hasNetwork() {
14158      return this.network != null && !this.network.isEmpty();
14159    }
14160
14161    /**
14162     * @param value {@link #network} (Is a flag to indicate whether the benefits
14163     *              refer to in-network providers or out-of-network providers.)
14164     */
14165    public BenefitBalanceComponent setNetwork(CodeableConcept value) {
14166      this.network = value;
14167      return this;
14168    }
14169
14170    /**
14171     * @return {@link #unit} (Indicates if the benefits apply to an individual or to
14172     *         the family.)
14173     */
14174    public CodeableConcept getUnit() {
14175      if (this.unit == null)
14176        if (Configuration.errorOnAutoCreate())
14177          throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
14178        else if (Configuration.doAutoCreate())
14179          this.unit = new CodeableConcept(); // cc
14180      return this.unit;
14181    }
14182
14183    public boolean hasUnit() {
14184      return this.unit != null && !this.unit.isEmpty();
14185    }
14186
14187    /**
14188     * @param value {@link #unit} (Indicates if the benefits apply to an individual
14189     *              or to the family.)
14190     */
14191    public BenefitBalanceComponent setUnit(CodeableConcept value) {
14192      this.unit = value;
14193      return this;
14194    }
14195
14196    /**
14197     * @return {@link #term} (The term or period of the values such as 'maximum
14198     *         lifetime benefit' or 'maximum annual visits'.)
14199     */
14200    public CodeableConcept getTerm() {
14201      if (this.term == null)
14202        if (Configuration.errorOnAutoCreate())
14203          throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
14204        else if (Configuration.doAutoCreate())
14205          this.term = new CodeableConcept(); // cc
14206      return this.term;
14207    }
14208
14209    public boolean hasTerm() {
14210      return this.term != null && !this.term.isEmpty();
14211    }
14212
14213    /**
14214     * @param value {@link #term} (The term or period of the values such as 'maximum
14215     *              lifetime benefit' or 'maximum annual visits'.)
14216     */
14217    public BenefitBalanceComponent setTerm(CodeableConcept value) {
14218      this.term = value;
14219      return this;
14220    }
14221
14222    /**
14223     * @return {@link #financial} (Benefits Used to date.)
14224     */
14225    public List<BenefitComponent> getFinancial() {
14226      if (this.financial == null)
14227        this.financial = new ArrayList<BenefitComponent>();
14228      return this.financial;
14229    }
14230
14231    /**
14232     * @return Returns a reference to <code>this</code> for easy method chaining
14233     */
14234    public BenefitBalanceComponent setFinancial(List<BenefitComponent> theFinancial) {
14235      this.financial = theFinancial;
14236      return this;
14237    }
14238
14239    public boolean hasFinancial() {
14240      if (this.financial == null)
14241        return false;
14242      for (BenefitComponent item : this.financial)
14243        if (!item.isEmpty())
14244          return true;
14245      return false;
14246    }
14247
14248    public BenefitComponent addFinancial() { // 3
14249      BenefitComponent t = new BenefitComponent();
14250      if (this.financial == null)
14251        this.financial = new ArrayList<BenefitComponent>();
14252      this.financial.add(t);
14253      return t;
14254    }
14255
14256    public BenefitBalanceComponent addFinancial(BenefitComponent t) { // 3
14257      if (t == null)
14258        return this;
14259      if (this.financial == null)
14260        this.financial = new ArrayList<BenefitComponent>();
14261      this.financial.add(t);
14262      return this;
14263    }
14264
14265    /**
14266     * @return The first repetition of repeating field {@link #financial}, creating
14267     *         it if it does not already exist
14268     */
14269    public BenefitComponent getFinancialFirstRep() {
14270      if (getFinancial().isEmpty()) {
14271        addFinancial();
14272      }
14273      return getFinancial().get(0);
14274    }
14275
14276    protected void listChildren(List<Property> children) {
14277      super.listChildren(children);
14278      children.add(new Property("category", "CodeableConcept",
14279          "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
14280          category));
14281      children.add(new Property("excluded", "boolean",
14282          "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.",
14283          0, 1, excluded));
14284      children.add(new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name));
14285      children.add(new Property("description", "string", "A richer description of the benefit or services covered.", 0,
14286          1, description));
14287      children.add(new Property("network", "CodeableConcept",
14288          "Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.", 0, 1,
14289          network));
14290      children.add(new Property("unit", "CodeableConcept",
14291          "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit));
14292      children.add(new Property("term", "CodeableConcept",
14293          "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.", 0, 1,
14294          term));
14295      children.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
14296    }
14297
14298    @Override
14299    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
14300      switch (_hash) {
14301      case 50511102:
14302        /* category */ return new Property("category", "CodeableConcept",
14303            "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
14304            category);
14305      case 1994055114:
14306        /* excluded */ return new Property("excluded", "boolean",
14307            "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.",
14308            0, 1, excluded);
14309      case 3373707:
14310        /* name */ return new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name);
14311      case -1724546052:
14312        /* description */ return new Property("description", "string",
14313            "A richer description of the benefit or services covered.", 0, 1, description);
14314      case 1843485230:
14315        /* network */ return new Property("network", "CodeableConcept",
14316            "Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.", 0,
14317            1, network);
14318      case 3594628:
14319        /* unit */ return new Property("unit", "CodeableConcept",
14320            "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit);
14321      case 3556460:
14322        /* term */ return new Property("term", "CodeableConcept",
14323            "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.", 0, 1,
14324            term);
14325      case 357555337:
14326        /* financial */ return new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE,
14327            financial);
14328      default:
14329        return super.getNamedProperty(_hash, _name, _checkValid);
14330      }
14331
14332    }
14333
14334    @Override
14335    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
14336      switch (hash) {
14337      case 50511102:
14338        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
14339      case 1994055114:
14340        /* excluded */ return this.excluded == null ? new Base[0] : new Base[] { this.excluded }; // BooleanType
14341      case 3373707:
14342        /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // StringType
14343      case -1724546052:
14344        /* description */ return this.description == null ? new Base[0] : new Base[] { this.description }; // StringType
14345      case 1843485230:
14346        /* network */ return this.network == null ? new Base[0] : new Base[] { this.network }; // CodeableConcept
14347      case 3594628:
14348        /* unit */ return this.unit == null ? new Base[0] : new Base[] { this.unit }; // CodeableConcept
14349      case 3556460:
14350        /* term */ return this.term == null ? new Base[0] : new Base[] { this.term }; // CodeableConcept
14351      case 357555337:
14352        /* financial */ return this.financial == null ? new Base[0]
14353            : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
14354      default:
14355        return super.getProperty(hash, name, checkValid);
14356      }
14357
14358    }
14359
14360    @Override
14361    public Base setProperty(int hash, String name, Base value) throws FHIRException {
14362      switch (hash) {
14363      case 50511102: // category
14364        this.category = castToCodeableConcept(value); // CodeableConcept
14365        return value;
14366      case 1994055114: // excluded
14367        this.excluded = castToBoolean(value); // BooleanType
14368        return value;
14369      case 3373707: // name
14370        this.name = castToString(value); // StringType
14371        return value;
14372      case -1724546052: // description
14373        this.description = castToString(value); // StringType
14374        return value;
14375      case 1843485230: // network
14376        this.network = castToCodeableConcept(value); // CodeableConcept
14377        return value;
14378      case 3594628: // unit
14379        this.unit = castToCodeableConcept(value); // CodeableConcept
14380        return value;
14381      case 3556460: // term
14382        this.term = castToCodeableConcept(value); // CodeableConcept
14383        return value;
14384      case 357555337: // financial
14385        this.getFinancial().add((BenefitComponent) value); // BenefitComponent
14386        return value;
14387      default:
14388        return super.setProperty(hash, name, value);
14389      }
14390
14391    }
14392
14393    @Override
14394    public Base setProperty(String name, Base value) throws FHIRException {
14395      if (name.equals("category")) {
14396        this.category = castToCodeableConcept(value); // CodeableConcept
14397      } else if (name.equals("excluded")) {
14398        this.excluded = castToBoolean(value); // BooleanType
14399      } else if (name.equals("name")) {
14400        this.name = castToString(value); // StringType
14401      } else if (name.equals("description")) {
14402        this.description = castToString(value); // StringType
14403      } else if (name.equals("network")) {
14404        this.network = castToCodeableConcept(value); // CodeableConcept
14405      } else if (name.equals("unit")) {
14406        this.unit = castToCodeableConcept(value); // CodeableConcept
14407      } else if (name.equals("term")) {
14408        this.term = castToCodeableConcept(value); // CodeableConcept
14409      } else if (name.equals("financial")) {
14410        this.getFinancial().add((BenefitComponent) value);
14411      } else
14412        return super.setProperty(name, value);
14413      return value;
14414    }
14415
14416  @Override
14417  public void removeChild(String name, Base value) throws FHIRException {
14418      if (name.equals("category")) {
14419        this.category = null;
14420      } else if (name.equals("excluded")) {
14421        this.excluded = null;
14422      } else if (name.equals("name")) {
14423        this.name = null;
14424      } else if (name.equals("description")) {
14425        this.description = null;
14426      } else if (name.equals("network")) {
14427        this.network = null;
14428      } else if (name.equals("unit")) {
14429        this.unit = null;
14430      } else if (name.equals("term")) {
14431        this.term = null;
14432      } else if (name.equals("financial")) {
14433        this.getFinancial().remove((BenefitComponent) value);
14434      } else
14435        super.removeChild(name, value);
14436      
14437    }
14438
14439    @Override
14440    public Base makeProperty(int hash, String name) throws FHIRException {
14441      switch (hash) {
14442      case 50511102:
14443        return getCategory();
14444      case 1994055114:
14445        return getExcludedElement();
14446      case 3373707:
14447        return getNameElement();
14448      case -1724546052:
14449        return getDescriptionElement();
14450      case 1843485230:
14451        return getNetwork();
14452      case 3594628:
14453        return getUnit();
14454      case 3556460:
14455        return getTerm();
14456      case 357555337:
14457        return addFinancial();
14458      default:
14459        return super.makeProperty(hash, name);
14460      }
14461
14462    }
14463
14464    @Override
14465    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
14466      switch (hash) {
14467      case 50511102:
14468        /* category */ return new String[] { "CodeableConcept" };
14469      case 1994055114:
14470        /* excluded */ return new String[] { "boolean" };
14471      case 3373707:
14472        /* name */ return new String[] { "string" };
14473      case -1724546052:
14474        /* description */ return new String[] { "string" };
14475      case 1843485230:
14476        /* network */ return new String[] { "CodeableConcept" };
14477      case 3594628:
14478        /* unit */ return new String[] { "CodeableConcept" };
14479      case 3556460:
14480        /* term */ return new String[] { "CodeableConcept" };
14481      case 357555337:
14482        /* financial */ return new String[] {};
14483      default:
14484        return super.getTypesForProperty(hash, name);
14485      }
14486
14487    }
14488
14489    @Override
14490    public Base addChild(String name) throws FHIRException {
14491      if (name.equals("category")) {
14492        this.category = new CodeableConcept();
14493        return this.category;
14494      } else if (name.equals("excluded")) {
14495        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.excluded");
14496      } else if (name.equals("name")) {
14497        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.name");
14498      } else if (name.equals("description")) {
14499        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.description");
14500      } else if (name.equals("network")) {
14501        this.network = new CodeableConcept();
14502        return this.network;
14503      } else if (name.equals("unit")) {
14504        this.unit = new CodeableConcept();
14505        return this.unit;
14506      } else if (name.equals("term")) {
14507        this.term = new CodeableConcept();
14508        return this.term;
14509      } else if (name.equals("financial")) {
14510        return addFinancial();
14511      } else
14512        return super.addChild(name);
14513    }
14514
14515    public BenefitBalanceComponent copy() {
14516      BenefitBalanceComponent dst = new BenefitBalanceComponent();
14517      copyValues(dst);
14518      return dst;
14519    }
14520
14521    public void copyValues(BenefitBalanceComponent dst) {
14522      super.copyValues(dst);
14523      dst.category = category == null ? null : category.copy();
14524      dst.excluded = excluded == null ? null : excluded.copy();
14525      dst.name = name == null ? null : name.copy();
14526      dst.description = description == null ? null : description.copy();
14527      dst.network = network == null ? null : network.copy();
14528      dst.unit = unit == null ? null : unit.copy();
14529      dst.term = term == null ? null : term.copy();
14530      if (financial != null) {
14531        dst.financial = new ArrayList<BenefitComponent>();
14532        for (BenefitComponent i : financial)
14533          dst.financial.add(i.copy());
14534      }
14535      ;
14536    }
14537
14538    @Override
14539    public boolean equalsDeep(Base other_) {
14540      if (!super.equalsDeep(other_))
14541        return false;
14542      if (!(other_ instanceof BenefitBalanceComponent))
14543        return false;
14544      BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
14545      return compareDeep(category, o.category, true) && compareDeep(excluded, o.excluded, true)
14546          && compareDeep(name, o.name, true) && compareDeep(description, o.description, true)
14547          && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true) && compareDeep(term, o.term, true)
14548          && compareDeep(financial, o.financial, true);
14549    }
14550
14551    @Override
14552    public boolean equalsShallow(Base other_) {
14553      if (!super.equalsShallow(other_))
14554        return false;
14555      if (!(other_ instanceof BenefitBalanceComponent))
14556        return false;
14557      BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
14558      return compareValues(excluded, o.excluded, true) && compareValues(name, o.name, true)
14559          && compareValues(description, o.description, true);
14560    }
14561
14562    public boolean isEmpty() {
14563      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, excluded, name, description, network,
14564          unit, term, financial);
14565    }
14566
14567    public String fhirType() {
14568      return "ExplanationOfBenefit.benefitBalance";
14569
14570    }
14571
14572  }
14573
14574  @Block()
14575  public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
14576    /**
14577     * Classification of benefit being provided.
14578     */
14579    @Child(name = "type", type = {
14580        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
14581    @Description(shortDefinition = "Benefit classification", formalDefinition = "Classification of benefit being provided.")
14582    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/benefit-type")
14583    protected CodeableConcept type;
14584
14585    /**
14586     * The quantity of the benefit which is permitted under the coverage.
14587     */
14588    @Child(name = "allowed", type = { UnsignedIntType.class, StringType.class,
14589        Money.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
14590    @Description(shortDefinition = "Benefits allowed", formalDefinition = "The quantity of the benefit which is permitted under the coverage.")
14591    protected Type allowed;
14592
14593    /**
14594     * The quantity of the benefit which have been consumed to date.
14595     */
14596    @Child(name = "used", type = { UnsignedIntType.class,
14597        Money.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
14598    @Description(shortDefinition = "Benefits used", formalDefinition = "The quantity of the benefit which have been consumed to date.")
14599    protected Type used;
14600
14601    private static final long serialVersionUID = -1506285314L;
14602
14603    /**
14604     * Constructor
14605     */
14606    public BenefitComponent() {
14607      super();
14608    }
14609
14610    /**
14611     * Constructor
14612     */
14613    public BenefitComponent(CodeableConcept type) {
14614      super();
14615      this.type = type;
14616    }
14617
14618    /**
14619     * @return {@link #type} (Classification of benefit being provided.)
14620     */
14621    public CodeableConcept getType() {
14622      if (this.type == null)
14623        if (Configuration.errorOnAutoCreate())
14624          throw new Error("Attempt to auto-create BenefitComponent.type");
14625        else if (Configuration.doAutoCreate())
14626          this.type = new CodeableConcept(); // cc
14627      return this.type;
14628    }
14629
14630    public boolean hasType() {
14631      return this.type != null && !this.type.isEmpty();
14632    }
14633
14634    /**
14635     * @param value {@link #type} (Classification of benefit being provided.)
14636     */
14637    public BenefitComponent setType(CodeableConcept value) {
14638      this.type = value;
14639      return this;
14640    }
14641
14642    /**
14643     * @return {@link #allowed} (The quantity of the benefit which is permitted
14644     *         under the coverage.)
14645     */
14646    public Type getAllowed() {
14647      return this.allowed;
14648    }
14649
14650    /**
14651     * @return {@link #allowed} (The quantity of the benefit which is permitted
14652     *         under the coverage.)
14653     */
14654    public UnsignedIntType getAllowedUnsignedIntType() throws FHIRException {
14655      if (this.allowed == null)
14656        this.allowed = new UnsignedIntType();
14657      if (!(this.allowed instanceof UnsignedIntType))
14658        throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "
14659            + this.allowed.getClass().getName() + " was encountered");
14660      return (UnsignedIntType) this.allowed;
14661    }
14662
14663    public boolean hasAllowedUnsignedIntType() {
14664      return this != null && this.allowed instanceof UnsignedIntType;
14665    }
14666
14667    /**
14668     * @return {@link #allowed} (The quantity of the benefit which is permitted
14669     *         under the coverage.)
14670     */
14671    public StringType getAllowedStringType() throws FHIRException {
14672      if (this.allowed == null)
14673        this.allowed = new StringType();
14674      if (!(this.allowed instanceof StringType))
14675        throw new FHIRException("Type mismatch: the type StringType was expected, but "
14676            + this.allowed.getClass().getName() + " was encountered");
14677      return (StringType) this.allowed;
14678    }
14679
14680    public boolean hasAllowedStringType() {
14681      return this != null && this.allowed instanceof StringType;
14682    }
14683
14684    /**
14685     * @return {@link #allowed} (The quantity of the benefit which is permitted
14686     *         under the coverage.)
14687     */
14688    public Money getAllowedMoney() throws FHIRException {
14689      if (this.allowed == null)
14690        this.allowed = new Money();
14691      if (!(this.allowed instanceof Money))
14692        throw new FHIRException("Type mismatch: the type Money was expected, but " + this.allowed.getClass().getName()
14693            + " was encountered");
14694      return (Money) this.allowed;
14695    }
14696
14697    public boolean hasAllowedMoney() {
14698      return this != null && this.allowed instanceof Money;
14699    }
14700
14701    public boolean hasAllowed() {
14702      return this.allowed != null && !this.allowed.isEmpty();
14703    }
14704
14705    /**
14706     * @param value {@link #allowed} (The quantity of the benefit which is permitted
14707     *              under the coverage.)
14708     */
14709    public BenefitComponent setAllowed(Type value) {
14710      if (value != null && !(value instanceof UnsignedIntType || value instanceof StringType || value instanceof Money))
14711        throw new Error(
14712            "Not the right type for ExplanationOfBenefit.benefitBalance.financial.allowed[x]: " + value.fhirType());
14713      this.allowed = value;
14714      return this;
14715    }
14716
14717    /**
14718     * @return {@link #used} (The quantity of the benefit which have been consumed
14719     *         to date.)
14720     */
14721    public Type getUsed() {
14722      return this.used;
14723    }
14724
14725    /**
14726     * @return {@link #used} (The quantity of the benefit which have been consumed
14727     *         to date.)
14728     */
14729    public UnsignedIntType getUsedUnsignedIntType() throws FHIRException {
14730      if (this.used == null)
14731        this.used = new UnsignedIntType();
14732      if (!(this.used instanceof UnsignedIntType))
14733        throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "
14734            + this.used.getClass().getName() + " was encountered");
14735      return (UnsignedIntType) this.used;
14736    }
14737
14738    public boolean hasUsedUnsignedIntType() {
14739      return this != null && this.used instanceof UnsignedIntType;
14740    }
14741
14742    /**
14743     * @return {@link #used} (The quantity of the benefit which have been consumed
14744     *         to date.)
14745     */
14746    public Money getUsedMoney() throws FHIRException {
14747      if (this.used == null)
14748        this.used = new Money();
14749      if (!(this.used instanceof Money))
14750        throw new FHIRException(
14751            "Type mismatch: the type Money was expected, but " + this.used.getClass().getName() + " was encountered");
14752      return (Money) this.used;
14753    }
14754
14755    public boolean hasUsedMoney() {
14756      return this != null && this.used instanceof Money;
14757    }
14758
14759    public boolean hasUsed() {
14760      return this.used != null && !this.used.isEmpty();
14761    }
14762
14763    /**
14764     * @param value {@link #used} (The quantity of the benefit which have been
14765     *              consumed to date.)
14766     */
14767    public BenefitComponent setUsed(Type value) {
14768      if (value != null && !(value instanceof UnsignedIntType || value instanceof Money))
14769        throw new Error(
14770            "Not the right type for ExplanationOfBenefit.benefitBalance.financial.used[x]: " + value.fhirType());
14771      this.used = value;
14772      return this;
14773    }
14774
14775    protected void listChildren(List<Property> children) {
14776      super.listChildren(children);
14777      children.add(new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type));
14778      children.add(new Property("allowed[x]", "unsignedInt|string|Money",
14779          "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed));
14780      children.add(new Property("used[x]", "unsignedInt|Money",
14781          "The quantity of the benefit which have been consumed to date.", 0, 1, used));
14782    }
14783
14784    @Override
14785    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
14786      switch (_hash) {
14787      case 3575610:
14788        /* type */ return new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1,
14789            type);
14790      case -1336663592:
14791        /* allowed[x] */ return new Property("allowed[x]", "unsignedInt|string|Money",
14792            "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
14793      case -911343192:
14794        /* allowed */ return new Property("allowed[x]", "unsignedInt|string|Money",
14795            "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
14796      case 1668802034:
14797        /* allowedUnsignedInt */ return new Property("allowed[x]", "unsignedInt|string|Money",
14798            "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
14799      case -2135265319:
14800        /* allowedString */ return new Property("allowed[x]", "unsignedInt|string|Money",
14801            "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
14802      case -351668232:
14803        /* allowedMoney */ return new Property("allowed[x]", "unsignedInt|string|Money",
14804            "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
14805      case -147553373:
14806        /* used[x] */ return new Property("used[x]", "unsignedInt|Money",
14807            "The quantity of the benefit which have been consumed to date.", 0, 1, used);
14808      case 3599293:
14809        /* used */ return new Property("used[x]", "unsignedInt|Money",
14810            "The quantity of the benefit which have been consumed to date.", 0, 1, used);
14811      case 1252740285:
14812        /* usedUnsignedInt */ return new Property("used[x]", "unsignedInt|Money",
14813            "The quantity of the benefit which have been consumed to date.", 0, 1, used);
14814      case -78048509:
14815        /* usedMoney */ return new Property("used[x]", "unsignedInt|Money",
14816            "The quantity of the benefit which have been consumed to date.", 0, 1, used);
14817      default:
14818        return super.getNamedProperty(_hash, _name, _checkValid);
14819      }
14820
14821    }
14822
14823    @Override
14824    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
14825      switch (hash) {
14826      case 3575610:
14827        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
14828      case -911343192:
14829        /* allowed */ return this.allowed == null ? new Base[0] : new Base[] { this.allowed }; // Type
14830      case 3599293:
14831        /* used */ return this.used == null ? new Base[0] : new Base[] { this.used }; // Type
14832      default:
14833        return super.getProperty(hash, name, checkValid);
14834      }
14835
14836    }
14837
14838    @Override
14839    public Base setProperty(int hash, String name, Base value) throws FHIRException {
14840      switch (hash) {
14841      case 3575610: // type
14842        this.type = castToCodeableConcept(value); // CodeableConcept
14843        return value;
14844      case -911343192: // allowed
14845        this.allowed = castToType(value); // Type
14846        return value;
14847      case 3599293: // used
14848        this.used = castToType(value); // Type
14849        return value;
14850      default:
14851        return super.setProperty(hash, name, value);
14852      }
14853
14854    }
14855
14856    @Override
14857    public Base setProperty(String name, Base value) throws FHIRException {
14858      if (name.equals("type")) {
14859        this.type = castToCodeableConcept(value); // CodeableConcept
14860      } else if (name.equals("allowed[x]")) {
14861        this.allowed = castToType(value); // Type
14862      } else if (name.equals("used[x]")) {
14863        this.used = castToType(value); // Type
14864      } else
14865        return super.setProperty(name, value);
14866      return value;
14867    }
14868
14869  @Override
14870  public void removeChild(String name, Base value) throws FHIRException {
14871      if (name.equals("type")) {
14872        this.type = null;
14873      } else if (name.equals("allowed[x]")) {
14874        this.allowed = null;
14875      } else if (name.equals("used[x]")) {
14876        this.used = null;
14877      } else
14878        super.removeChild(name, value);
14879      
14880    }
14881
14882    @Override
14883    public Base makeProperty(int hash, String name) throws FHIRException {
14884      switch (hash) {
14885      case 3575610:
14886        return getType();
14887      case -1336663592:
14888        return getAllowed();
14889      case -911343192:
14890        return getAllowed();
14891      case -147553373:
14892        return getUsed();
14893      case 3599293:
14894        return getUsed();
14895      default:
14896        return super.makeProperty(hash, name);
14897      }
14898
14899    }
14900
14901    @Override
14902    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
14903      switch (hash) {
14904      case 3575610:
14905        /* type */ return new String[] { "CodeableConcept" };
14906      case -911343192:
14907        /* allowed */ return new String[] { "unsignedInt", "string", "Money" };
14908      case 3599293:
14909        /* used */ return new String[] { "unsignedInt", "Money" };
14910      default:
14911        return super.getTypesForProperty(hash, name);
14912      }
14913
14914    }
14915
14916    @Override
14917    public Base addChild(String name) throws FHIRException {
14918      if (name.equals("type")) {
14919        this.type = new CodeableConcept();
14920        return this.type;
14921      } else if (name.equals("allowedUnsignedInt")) {
14922        this.allowed = new UnsignedIntType();
14923        return this.allowed;
14924      } else if (name.equals("allowedString")) {
14925        this.allowed = new StringType();
14926        return this.allowed;
14927      } else if (name.equals("allowedMoney")) {
14928        this.allowed = new Money();
14929        return this.allowed;
14930      } else if (name.equals("usedUnsignedInt")) {
14931        this.used = new UnsignedIntType();
14932        return this.used;
14933      } else if (name.equals("usedMoney")) {
14934        this.used = new Money();
14935        return this.used;
14936      } else
14937        return super.addChild(name);
14938    }
14939
14940    public BenefitComponent copy() {
14941      BenefitComponent dst = new BenefitComponent();
14942      copyValues(dst);
14943      return dst;
14944    }
14945
14946    public void copyValues(BenefitComponent dst) {
14947      super.copyValues(dst);
14948      dst.type = type == null ? null : type.copy();
14949      dst.allowed = allowed == null ? null : allowed.copy();
14950      dst.used = used == null ? null : used.copy();
14951    }
14952
14953    @Override
14954    public boolean equalsDeep(Base other_) {
14955      if (!super.equalsDeep(other_))
14956        return false;
14957      if (!(other_ instanceof BenefitComponent))
14958        return false;
14959      BenefitComponent o = (BenefitComponent) other_;
14960      return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true)
14961          && compareDeep(used, o.used, true);
14962    }
14963
14964    @Override
14965    public boolean equalsShallow(Base other_) {
14966      if (!super.equalsShallow(other_))
14967        return false;
14968      if (!(other_ instanceof BenefitComponent))
14969        return false;
14970      BenefitComponent o = (BenefitComponent) other_;
14971      return true;
14972    }
14973
14974    public boolean isEmpty() {
14975      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed, used);
14976    }
14977
14978    public String fhirType() {
14979      return "ExplanationOfBenefit.benefitBalance.financial";
14980
14981    }
14982
14983  }
14984
14985  /**
14986   * A unique identifier assigned to this explanation of benefit.
14987   */
14988  @Child(name = "identifier", type = {
14989      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
14990  @Description(shortDefinition = "Business Identifier for the resource", formalDefinition = "A unique identifier assigned to this explanation of benefit.")
14991  protected List<Identifier> identifier;
14992
14993  /**
14994   * The status of the resource instance.
14995   */
14996  @Child(name = "status", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = true, summary = true)
14997  @Description(shortDefinition = "active | cancelled | draft | entered-in-error", formalDefinition = "The status of the resource instance.")
14998  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/explanationofbenefit-status")
14999  protected Enumeration<ExplanationOfBenefitStatus> status;
15000
15001  /**
15002   * The category of claim, e.g. oral, pharmacy, vision, institutional,
15003   * professional.
15004   */
15005  @Child(name = "type", type = { CodeableConcept.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
15006  @Description(shortDefinition = "Category or discipline", formalDefinition = "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.")
15007  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-type")
15008  protected CodeableConcept type;
15009
15010  /**
15011   * A finer grained suite of claim type codes which may convey additional
15012   * information such as Inpatient vs Outpatient and/or a specialty service.
15013   */
15014  @Child(name = "subType", type = {
15015      CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
15016  @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.")
15017  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-subtype")
15018  protected CodeableConcept subType;
15019
15020  /**
15021   * A code to indicate whether the nature of the request is: to request
15022   * adjudication of products and services previously rendered; or requesting
15023   * authorization and adjudication for provision in the future; or requesting the
15024   * non-binding adjudication of the listed products and services which could be
15025   * provided in the future.
15026   */
15027  @Child(name = "use", type = { CodeType.class }, order = 4, min = 1, max = 1, modifier = false, summary = true)
15028  @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.")
15029  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-use")
15030  protected Enumeration<Use> use;
15031
15032  /**
15033   * The party to whom the professional services and/or products have been
15034   * supplied or are being considered and for whom actual for forecast
15035   * reimbursement is sought.
15036   */
15037  @Child(name = "patient", type = { Patient.class }, order = 5, min = 1, max = 1, modifier = false, summary = true)
15038  @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.")
15039  protected Reference patient;
15040
15041  /**
15042   * The actual object that is the target of the reference (The party to whom the
15043   * professional services and/or products have been supplied or are being
15044   * considered and for whom actual for forecast reimbursement is sought.)
15045   */
15046  protected Patient patientTarget;
15047
15048  /**
15049   * The period for which charges are being submitted.
15050   */
15051  @Child(name = "billablePeriod", type = {
15052      Period.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
15053  @Description(shortDefinition = "Relevant time frame for the claim", formalDefinition = "The period for which charges are being submitted.")
15054  protected Period billablePeriod;
15055
15056  /**
15057   * The date this resource was created.
15058   */
15059  @Child(name = "created", type = { DateTimeType.class }, order = 7, min = 1, max = 1, modifier = false, summary = true)
15060  @Description(shortDefinition = "Response creation date", formalDefinition = "The date this resource was created.")
15061  protected DateTimeType created;
15062
15063  /**
15064   * Individual who created the claim, predetermination or preauthorization.
15065   */
15066  @Child(name = "enterer", type = { Practitioner.class,
15067      PractitionerRole.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
15068  @Description(shortDefinition = "Author of the claim", formalDefinition = "Individual who created the claim, predetermination or preauthorization.")
15069  protected Reference enterer;
15070
15071  /**
15072   * The actual object that is the target of the reference (Individual who created
15073   * the claim, predetermination or preauthorization.)
15074   */
15075  protected Resource entererTarget;
15076
15077  /**
15078   * The party responsible for authorization, adjudication and reimbursement.
15079   */
15080  @Child(name = "insurer", type = { Organization.class }, order = 9, min = 1, max = 1, modifier = false, summary = true)
15081  @Description(shortDefinition = "Party responsible for reimbursement", formalDefinition = "The party responsible for authorization, adjudication and reimbursement.")
15082  protected Reference insurer;
15083
15084  /**
15085   * The actual object that is the target of the reference (The party responsible
15086   * for authorization, adjudication and reimbursement.)
15087   */
15088  protected Organization insurerTarget;
15089
15090  /**
15091   * The provider which is responsible for the claim, predetermination or
15092   * preauthorization.
15093   */
15094  @Child(name = "provider", type = { Practitioner.class, PractitionerRole.class,
15095      Organization.class }, order = 10, min = 1, max = 1, modifier = false, summary = true)
15096  @Description(shortDefinition = "Party responsible for the claim", formalDefinition = "The provider which is responsible for the claim, predetermination or preauthorization.")
15097  protected Reference provider;
15098
15099  /**
15100   * The actual object that is the target of the reference (The provider which is
15101   * responsible for the claim, predetermination or preauthorization.)
15102   */
15103  protected Resource providerTarget;
15104
15105  /**
15106   * The provider-required urgency of processing the request. Typical values
15107   * include: stat, routine deferred.
15108   */
15109  @Child(name = "priority", type = {
15110      CodeableConcept.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
15111  @Description(shortDefinition = "Desired processing urgency", formalDefinition = "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.")
15112  protected CodeableConcept priority;
15113
15114  /**
15115   * A code to indicate whether and for whom funds are to be reserved for future
15116   * claims.
15117   */
15118  @Child(name = "fundsReserveRequested", type = {
15119      CodeableConcept.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
15120  @Description(shortDefinition = "For whom to reserve funds", formalDefinition = "A code to indicate whether and for whom funds are to be reserved for future claims.")
15121  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/fundsreserve")
15122  protected CodeableConcept fundsReserveRequested;
15123
15124  /**
15125   * A code, used only on a response to a preauthorization, to indicate whether
15126   * the benefits payable have been reserved and for whom.
15127   */
15128  @Child(name = "fundsReserve", type = {
15129      CodeableConcept.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
15130  @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.")
15131  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/fundsreserve")
15132  protected CodeableConcept fundsReserve;
15133
15134  /**
15135   * Other claims which are related to this claim such as prior submissions or
15136   * claims for related services or for the same event.
15137   */
15138  @Child(name = "related", type = {}, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15139  @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.")
15140  protected List<RelatedClaimComponent> related;
15141
15142  /**
15143   * Prescription to support the dispensing of pharmacy, device or vision
15144   * products.
15145   */
15146  @Child(name = "prescription", type = { MedicationRequest.class,
15147      VisionPrescription.class }, order = 15, min = 0, max = 1, modifier = false, summary = false)
15148  @Description(shortDefinition = "Prescription authorizing services or products", formalDefinition = "Prescription to support the dispensing of pharmacy, device or vision products.")
15149  protected Reference prescription;
15150
15151  /**
15152   * The actual object that is the target of the reference (Prescription to
15153   * support the dispensing of pharmacy, device or vision products.)
15154   */
15155  protected Resource prescriptionTarget;
15156
15157  /**
15158   * Original prescription which has been superseded by this prescription to
15159   * support the dispensing of pharmacy services, medications or products.
15160   */
15161  @Child(name = "originalPrescription", type = {
15162      MedicationRequest.class }, order = 16, min = 0, max = 1, modifier = false, summary = false)
15163  @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.")
15164  protected Reference originalPrescription;
15165
15166  /**
15167   * The actual object that is the target of the reference (Original prescription
15168   * which has been superseded by this prescription to support the dispensing of
15169   * pharmacy services, medications or products.)
15170   */
15171  protected MedicationRequest originalPrescriptionTarget;
15172
15173  /**
15174   * The party to be reimbursed for cost of the products and services according to
15175   * the terms of the policy.
15176   */
15177  @Child(name = "payee", type = {}, order = 17, min = 0, max = 1, modifier = false, summary = false)
15178  @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.")
15179  protected PayeeComponent payee;
15180
15181  /**
15182   * A reference to a referral resource.
15183   */
15184  @Child(name = "referral", type = {
15185      ServiceRequest.class }, order = 18, min = 0, max = 1, modifier = false, summary = false)
15186  @Description(shortDefinition = "Treatment Referral", formalDefinition = "A reference to a referral resource.")
15187  protected Reference referral;
15188
15189  /**
15190   * The actual object that is the target of the reference (A reference to a
15191   * referral resource.)
15192   */
15193  protected ServiceRequest referralTarget;
15194
15195  /**
15196   * Facility where the services were provided.
15197   */
15198  @Child(name = "facility", type = { Location.class }, order = 19, min = 0, max = 1, modifier = false, summary = false)
15199  @Description(shortDefinition = "Servicing Facility", formalDefinition = "Facility where the services were provided.")
15200  protected Reference facility;
15201
15202  /**
15203   * The actual object that is the target of the reference (Facility where the
15204   * services were provided.)
15205   */
15206  protected Location facilityTarget;
15207
15208  /**
15209   * The business identifier for the instance of the adjudication request: claim
15210   * predetermination or preauthorization.
15211   */
15212  @Child(name = "claim", type = { Claim.class }, order = 20, min = 0, max = 1, modifier = false, summary = false)
15213  @Description(shortDefinition = "Claim reference", formalDefinition = "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.")
15214  protected Reference claim;
15215
15216  /**
15217   * The actual object that is the target of the reference (The business
15218   * identifier for the instance of the adjudication request: claim
15219   * predetermination or preauthorization.)
15220   */
15221  protected Claim claimTarget;
15222
15223  /**
15224   * The business identifier for the instance of the adjudication response: claim,
15225   * predetermination or preauthorization response.
15226   */
15227  @Child(name = "claimResponse", type = {
15228      ClaimResponse.class }, order = 21, min = 0, max = 1, modifier = false, summary = false)
15229  @Description(shortDefinition = "Claim response reference", formalDefinition = "The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.")
15230  protected Reference claimResponse;
15231
15232  /**
15233   * The actual object that is the target of the reference (The business
15234   * identifier for the instance of the adjudication response: claim,
15235   * predetermination or preauthorization response.)
15236   */
15237  protected ClaimResponse claimResponseTarget;
15238
15239  /**
15240   * The outcome of the claim, predetermination, or preauthorization processing.
15241   */
15242  @Child(name = "outcome", type = { CodeType.class }, order = 22, min = 1, max = 1, modifier = false, summary = true)
15243  @Description(shortDefinition = "queued | complete | error | partial", formalDefinition = "The outcome of the claim, predetermination, or preauthorization processing.")
15244  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/remittance-outcome")
15245  protected Enumeration<RemittanceOutcome> outcome;
15246
15247  /**
15248   * A human readable description of the status of the adjudication.
15249   */
15250  @Child(name = "disposition", type = {
15251      StringType.class }, order = 23, min = 0, max = 1, modifier = false, summary = false)
15252  @Description(shortDefinition = "Disposition Message", formalDefinition = "A human readable description of the status of the adjudication.")
15253  protected StringType disposition;
15254
15255  /**
15256   * Reference from the Insurer which is used in later communications which refers
15257   * to this adjudication.
15258   */
15259  @Child(name = "preAuthRef", type = {
15260      StringType.class }, order = 24, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15261  @Description(shortDefinition = "Preauthorization reference", formalDefinition = "Reference from the Insurer which is used in later communications which refers to this adjudication.")
15262  protected List<StringType> preAuthRef;
15263
15264  /**
15265   * The timeframe during which the supplied preauthorization reference may be
15266   * quoted on claims to obtain the adjudication as provided.
15267   */
15268  @Child(name = "preAuthRefPeriod", type = {
15269      Period.class }, order = 25, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15270  @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.")
15271  protected List<Period> preAuthRefPeriod;
15272
15273  /**
15274   * The members of the team who provided the products and services.
15275   */
15276  @Child(name = "careTeam", type = {}, order = 26, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15277  @Description(shortDefinition = "Care Team members", formalDefinition = "The members of the team who provided the products and services.")
15278  protected List<CareTeamComponent> careTeam;
15279
15280  /**
15281   * Additional information codes regarding exceptions, special considerations,
15282   * the condition, situation, prior or concurrent issues.
15283   */
15284  @Child(name = "supportingInfo", type = {}, order = 27, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15285  @Description(shortDefinition = "Supporting information", formalDefinition = "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.")
15286  protected List<SupportingInformationComponent> supportingInfo;
15287
15288  /**
15289   * Information about diagnoses relevant to the claim items.
15290   */
15291  @Child(name = "diagnosis", type = {}, order = 28, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15292  @Description(shortDefinition = "Pertinent diagnosis information", formalDefinition = "Information about diagnoses relevant to the claim items.")
15293  protected List<DiagnosisComponent> diagnosis;
15294
15295  /**
15296   * Procedures performed on the patient relevant to the billing items with the
15297   * claim.
15298   */
15299  @Child(name = "procedure", type = {}, order = 29, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15300  @Description(shortDefinition = "Clinical procedures performed", formalDefinition = "Procedures performed on the patient relevant to the billing items with the claim.")
15301  protected List<ProcedureComponent> procedure;
15302
15303  /**
15304   * This indicates the relative order of a series of EOBs related to different
15305   * coverages for the same suite of services.
15306   */
15307  @Child(name = "precedence", type = {
15308      PositiveIntType.class }, order = 30, min = 0, max = 1, modifier = false, summary = false)
15309  @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.")
15310  protected PositiveIntType precedence;
15311
15312  /**
15313   * Financial instruments for reimbursement for the health care products and
15314   * services specified on the claim.
15315   */
15316  @Child(name = "insurance", type = {}, order = 31, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
15317  @Description(shortDefinition = "Patient insurance information", formalDefinition = "Financial instruments for reimbursement for the health care products and services specified on the claim.")
15318  protected List<InsuranceComponent> insurance;
15319
15320  /**
15321   * Details of a accident which resulted in injuries which required the products
15322   * and services listed in the claim.
15323   */
15324  @Child(name = "accident", type = {}, order = 32, min = 0, max = 1, modifier = false, summary = false)
15325  @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.")
15326  protected AccidentComponent accident;
15327
15328  /**
15329   * A claim line. Either a simple (a product or service) or a 'group' of details
15330   * which can also be a simple items or groups of sub-details.
15331   */
15332  @Child(name = "item", type = {}, order = 33, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15333  @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.")
15334  protected List<ItemComponent> item;
15335
15336  /**
15337   * The first-tier service adjudications for payor added product or service
15338   * lines.
15339   */
15340  @Child(name = "addItem", type = {}, order = 34, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15341  @Description(shortDefinition = "Insurer added line items", formalDefinition = "The first-tier service adjudications for payor added product or service lines.")
15342  protected List<AddedItemComponent> addItem;
15343
15344  /**
15345   * The adjudication results which are presented at the header level rather than
15346   * at the line-item or add-item levels.
15347   */
15348  @Child(name = "adjudication", type = {
15349      AdjudicationComponent.class }, order = 35, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15350  @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.")
15351  protected List<AdjudicationComponent> adjudication;
15352
15353  /**
15354   * Categorized monetary totals for the adjudication.
15355   */
15356  @Child(name = "total", type = {}, order = 36, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
15357  @Description(shortDefinition = "Adjudication totals", formalDefinition = "Categorized monetary totals for the adjudication.")
15358  protected List<TotalComponent> total;
15359
15360  /**
15361   * Payment details for the adjudication of the claim.
15362   */
15363  @Child(name = "payment", type = {}, order = 37, min = 0, max = 1, modifier = false, summary = false)
15364  @Description(shortDefinition = "Payment Details", formalDefinition = "Payment details for the adjudication of the claim.")
15365  protected PaymentComponent payment;
15366
15367  /**
15368   * A code for the form to be used for printing the content.
15369   */
15370  @Child(name = "formCode", type = {
15371      CodeableConcept.class }, order = 38, min = 0, max = 1, modifier = false, summary = false)
15372  @Description(shortDefinition = "Printed form identifier", formalDefinition = "A code for the form to be used for printing the content.")
15373  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/forms")
15374  protected CodeableConcept formCode;
15375
15376  /**
15377   * The actual form, by reference or inclusion, for printing the content or an
15378   * EOB.
15379   */
15380  @Child(name = "form", type = { Attachment.class }, order = 39, min = 0, max = 1, modifier = false, summary = false)
15381  @Description(shortDefinition = "Printed reference or actual form", formalDefinition = "The actual form, by reference or inclusion, for printing the content or an EOB.")
15382  protected Attachment form;
15383
15384  /**
15385   * A note that describes or explains adjudication results in a human readable
15386   * form.
15387   */
15388  @Child(name = "processNote", type = {}, order = 40, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15389  @Description(shortDefinition = "Note concerning adjudication", formalDefinition = "A note that describes or explains adjudication results in a human readable form.")
15390  protected List<NoteComponent> processNote;
15391
15392  /**
15393   * The term of the benefits documented in this response.
15394   */
15395  @Child(name = "benefitPeriod", type = {
15396      Period.class }, order = 41, min = 0, max = 1, modifier = false, summary = false)
15397  @Description(shortDefinition = "When the benefits are applicable", formalDefinition = "The term of the benefits documented in this response.")
15398  protected Period benefitPeriod;
15399
15400  /**
15401   * Balance by Benefit Category.
15402   */
15403  @Child(name = "benefitBalance", type = {}, order = 42, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15404  @Description(shortDefinition = "Balance by Benefit Category", formalDefinition = "Balance by Benefit Category.")
15405  protected List<BenefitBalanceComponent> benefitBalance;
15406
15407  private static final long serialVersionUID = -1515422099L;
15408
15409  /**
15410   * Constructor
15411   */
15412  public ExplanationOfBenefit() {
15413    super();
15414  }
15415
15416  /**
15417   * Constructor
15418   */
15419  public ExplanationOfBenefit(Enumeration<ExplanationOfBenefitStatus> status, CodeableConcept type,
15420      Enumeration<Use> use, Reference patient, DateTimeType created, Reference insurer, Reference provider,
15421      Enumeration<RemittanceOutcome> outcome) {
15422    super();
15423    this.status = status;
15424    this.type = type;
15425    this.use = use;
15426    this.patient = patient;
15427    this.created = created;
15428    this.insurer = insurer;
15429    this.provider = provider;
15430    this.outcome = outcome;
15431  }
15432
15433  /**
15434   * @return {@link #identifier} (A unique identifier assigned to this explanation
15435   *         of benefit.)
15436   */
15437  public List<Identifier> getIdentifier() {
15438    if (this.identifier == null)
15439      this.identifier = new ArrayList<Identifier>();
15440    return this.identifier;
15441  }
15442
15443  /**
15444   * @return Returns a reference to <code>this</code> for easy method chaining
15445   */
15446  public ExplanationOfBenefit setIdentifier(List<Identifier> theIdentifier) {
15447    this.identifier = theIdentifier;
15448    return this;
15449  }
15450
15451  public boolean hasIdentifier() {
15452    if (this.identifier == null)
15453      return false;
15454    for (Identifier item : this.identifier)
15455      if (!item.isEmpty())
15456        return true;
15457    return false;
15458  }
15459
15460  public Identifier addIdentifier() { // 3
15461    Identifier t = new Identifier();
15462    if (this.identifier == null)
15463      this.identifier = new ArrayList<Identifier>();
15464    this.identifier.add(t);
15465    return t;
15466  }
15467
15468  public ExplanationOfBenefit addIdentifier(Identifier t) { // 3
15469    if (t == null)
15470      return this;
15471    if (this.identifier == null)
15472      this.identifier = new ArrayList<Identifier>();
15473    this.identifier.add(t);
15474    return this;
15475  }
15476
15477  /**
15478   * @return The first repetition of repeating field {@link #identifier}, creating
15479   *         it if it does not already exist
15480   */
15481  public Identifier getIdentifierFirstRep() {
15482    if (getIdentifier().isEmpty()) {
15483      addIdentifier();
15484    }
15485    return getIdentifier().get(0);
15486  }
15487
15488  /**
15489   * @return {@link #status} (The status of the resource instance.). This is the
15490   *         underlying object with id, value and extensions. The accessor
15491   *         "getStatus" gives direct access to the value
15492   */
15493  public Enumeration<ExplanationOfBenefitStatus> getStatusElement() {
15494    if (this.status == null)
15495      if (Configuration.errorOnAutoCreate())
15496        throw new Error("Attempt to auto-create ExplanationOfBenefit.status");
15497      else if (Configuration.doAutoCreate())
15498        this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory()); // bb
15499    return this.status;
15500  }
15501
15502  public boolean hasStatusElement() {
15503    return this.status != null && !this.status.isEmpty();
15504  }
15505
15506  public boolean hasStatus() {
15507    return this.status != null && !this.status.isEmpty();
15508  }
15509
15510  /**
15511   * @param value {@link #status} (The status of the resource instance.). This is
15512   *              the underlying object with id, value and extensions. The
15513   *              accessor "getStatus" gives direct access to the value
15514   */
15515  public ExplanationOfBenefit setStatusElement(Enumeration<ExplanationOfBenefitStatus> value) {
15516    this.status = value;
15517    return this;
15518  }
15519
15520  /**
15521   * @return The status of the resource instance.
15522   */
15523  public ExplanationOfBenefitStatus getStatus() {
15524    return this.status == null ? null : this.status.getValue();
15525  }
15526
15527  /**
15528   * @param value The status of the resource instance.
15529   */
15530  public ExplanationOfBenefit setStatus(ExplanationOfBenefitStatus value) {
15531    if (this.status == null)
15532      this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory());
15533    this.status.setValue(value);
15534    return this;
15535  }
15536
15537  /**
15538   * @return {@link #type} (The category of claim, e.g. oral, pharmacy, vision,
15539   *         institutional, professional.)
15540   */
15541  public CodeableConcept getType() {
15542    if (this.type == null)
15543      if (Configuration.errorOnAutoCreate())
15544        throw new Error("Attempt to auto-create ExplanationOfBenefit.type");
15545      else if (Configuration.doAutoCreate())
15546        this.type = new CodeableConcept(); // cc
15547    return this.type;
15548  }
15549
15550  public boolean hasType() {
15551    return this.type != null && !this.type.isEmpty();
15552  }
15553
15554  /**
15555   * @param value {@link #type} (The category of claim, e.g. oral, pharmacy,
15556   *              vision, institutional, professional.)
15557   */
15558  public ExplanationOfBenefit setType(CodeableConcept value) {
15559    this.type = value;
15560    return this;
15561  }
15562
15563  /**
15564   * @return {@link #subType} (A finer grained suite of claim type codes which may
15565   *         convey additional information such as Inpatient vs Outpatient and/or
15566   *         a specialty service.)
15567   */
15568  public CodeableConcept getSubType() {
15569    if (this.subType == null)
15570      if (Configuration.errorOnAutoCreate())
15571        throw new Error("Attempt to auto-create ExplanationOfBenefit.subType");
15572      else if (Configuration.doAutoCreate())
15573        this.subType = new CodeableConcept(); // cc
15574    return this.subType;
15575  }
15576
15577  public boolean hasSubType() {
15578    return this.subType != null && !this.subType.isEmpty();
15579  }
15580
15581  /**
15582   * @param value {@link #subType} (A finer grained suite of claim type codes
15583   *              which may convey additional information such as Inpatient vs
15584   *              Outpatient and/or a specialty service.)
15585   */
15586  public ExplanationOfBenefit setSubType(CodeableConcept value) {
15587    this.subType = value;
15588    return this;
15589  }
15590
15591  /**
15592   * @return {@link #use} (A code to indicate whether the nature of the request
15593   *         is: to request adjudication of products and services previously
15594   *         rendered; or requesting authorization and adjudication for provision
15595   *         in the future; or requesting the non-binding adjudication of the
15596   *         listed products and services which could be provided in the future.).
15597   *         This is the underlying object with id, value and extensions. The
15598   *         accessor "getUse" gives direct access to the value
15599   */
15600  public Enumeration<Use> getUseElement() {
15601    if (this.use == null)
15602      if (Configuration.errorOnAutoCreate())
15603        throw new Error("Attempt to auto-create ExplanationOfBenefit.use");
15604      else if (Configuration.doAutoCreate())
15605        this.use = new Enumeration<Use>(new UseEnumFactory()); // bb
15606    return this.use;
15607  }
15608
15609  public boolean hasUseElement() {
15610    return this.use != null && !this.use.isEmpty();
15611  }
15612
15613  public boolean hasUse() {
15614    return this.use != null && !this.use.isEmpty();
15615  }
15616
15617  /**
15618   * @param value {@link #use} (A code to indicate whether the nature of the
15619   *              request is: to request adjudication of products and services
15620   *              previously rendered; or requesting authorization and
15621   *              adjudication for provision in the future; or requesting the
15622   *              non-binding adjudication of the listed products and services
15623   *              which could be provided in the future.). This is the underlying
15624   *              object with id, value and extensions. The accessor "getUse"
15625   *              gives direct access to the value
15626   */
15627  public ExplanationOfBenefit setUseElement(Enumeration<Use> value) {
15628    this.use = value;
15629    return this;
15630  }
15631
15632  /**
15633   * @return A code to indicate whether the nature of the request is: to request
15634   *         adjudication of products and services previously rendered; or
15635   *         requesting authorization and adjudication for provision in the
15636   *         future; or requesting the non-binding adjudication of the listed
15637   *         products and services which could be provided in the future.
15638   */
15639  public Use getUse() {
15640    return this.use == null ? null : this.use.getValue();
15641  }
15642
15643  /**
15644   * @param value A code to indicate whether the nature of the request is: to
15645   *              request adjudication of products and services previously
15646   *              rendered; or requesting authorization and adjudication for
15647   *              provision in the future; or requesting the non-binding
15648   *              adjudication of the listed products and services which could be
15649   *              provided in the future.
15650   */
15651  public ExplanationOfBenefit setUse(Use value) {
15652    if (this.use == null)
15653      this.use = new Enumeration<Use>(new UseEnumFactory());
15654    this.use.setValue(value);
15655    return this;
15656  }
15657
15658  /**
15659   * @return {@link #patient} (The party to whom the professional services and/or
15660   *         products have been supplied or are being considered and for whom
15661   *         actual for forecast reimbursement is sought.)
15662   */
15663  public Reference getPatient() {
15664    if (this.patient == null)
15665      if (Configuration.errorOnAutoCreate())
15666        throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
15667      else if (Configuration.doAutoCreate())
15668        this.patient = new Reference(); // cc
15669    return this.patient;
15670  }
15671
15672  public boolean hasPatient() {
15673    return this.patient != null && !this.patient.isEmpty();
15674  }
15675
15676  /**
15677   * @param value {@link #patient} (The party to whom the professional services
15678   *              and/or products have been supplied or are being considered and
15679   *              for whom actual for forecast reimbursement is sought.)
15680   */
15681  public ExplanationOfBenefit setPatient(Reference value) {
15682    this.patient = value;
15683    return this;
15684  }
15685
15686  /**
15687   * @return {@link #patient} The actual object that is the target of the
15688   *         reference. The reference library doesn't populate this, but you can
15689   *         use it to hold the resource if you resolve it. (The party to whom the
15690   *         professional services and/or products have been supplied or are being
15691   *         considered and for whom actual for forecast reimbursement is sought.)
15692   */
15693  public Patient getPatientTarget() {
15694    if (this.patientTarget == null)
15695      if (Configuration.errorOnAutoCreate())
15696        throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
15697      else if (Configuration.doAutoCreate())
15698        this.patientTarget = new Patient(); // aa
15699    return this.patientTarget;
15700  }
15701
15702  /**
15703   * @param value {@link #patient} The actual object that is the target of the
15704   *              reference. The reference library doesn't use these, but you can
15705   *              use it to hold the resource if you resolve it. (The party to
15706   *              whom the professional services and/or products have been
15707   *              supplied or are being considered and for whom actual for
15708   *              forecast reimbursement is sought.)
15709   */
15710  public ExplanationOfBenefit setPatientTarget(Patient value) {
15711    this.patientTarget = value;
15712    return this;
15713  }
15714
15715  /**
15716   * @return {@link #billablePeriod} (The period for which charges are being
15717   *         submitted.)
15718   */
15719  public Period getBillablePeriod() {
15720    if (this.billablePeriod == null)
15721      if (Configuration.errorOnAutoCreate())
15722        throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
15723      else if (Configuration.doAutoCreate())
15724        this.billablePeriod = new Period(); // cc
15725    return this.billablePeriod;
15726  }
15727
15728  public boolean hasBillablePeriod() {
15729    return this.billablePeriod != null && !this.billablePeriod.isEmpty();
15730  }
15731
15732  /**
15733   * @param value {@link #billablePeriod} (The period for which charges are being
15734   *              submitted.)
15735   */
15736  public ExplanationOfBenefit setBillablePeriod(Period value) {
15737    this.billablePeriod = value;
15738    return this;
15739  }
15740
15741  /**
15742   * @return {@link #created} (The date this resource was created.). This is the
15743   *         underlying object with id, value and extensions. The accessor
15744   *         "getCreated" gives direct access to the value
15745   */
15746  public DateTimeType getCreatedElement() {
15747    if (this.created == null)
15748      if (Configuration.errorOnAutoCreate())
15749        throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
15750      else if (Configuration.doAutoCreate())
15751        this.created = new DateTimeType(); // bb
15752    return this.created;
15753  }
15754
15755  public boolean hasCreatedElement() {
15756    return this.created != null && !this.created.isEmpty();
15757  }
15758
15759  public boolean hasCreated() {
15760    return this.created != null && !this.created.isEmpty();
15761  }
15762
15763  /**
15764   * @param value {@link #created} (The date this resource was created.). This is
15765   *              the underlying object with id, value and extensions. The
15766   *              accessor "getCreated" gives direct access to the value
15767   */
15768  public ExplanationOfBenefit setCreatedElement(DateTimeType value) {
15769    this.created = value;
15770    return this;
15771  }
15772
15773  /**
15774   * @return The date this resource was created.
15775   */
15776  public Date getCreated() {
15777    return this.created == null ? null : this.created.getValue();
15778  }
15779
15780  /**
15781   * @param value The date this resource was created.
15782   */
15783  public ExplanationOfBenefit setCreated(Date value) {
15784    if (this.created == null)
15785      this.created = new DateTimeType();
15786    this.created.setValue(value);
15787    return this;
15788  }
15789
15790  /**
15791   * @return {@link #enterer} (Individual who created the claim, predetermination
15792   *         or preauthorization.)
15793   */
15794  public Reference getEnterer() {
15795    if (this.enterer == null)
15796      if (Configuration.errorOnAutoCreate())
15797        throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
15798      else if (Configuration.doAutoCreate())
15799        this.enterer = new Reference(); // cc
15800    return this.enterer;
15801  }
15802
15803  public boolean hasEnterer() {
15804    return this.enterer != null && !this.enterer.isEmpty();
15805  }
15806
15807  /**
15808   * @param value {@link #enterer} (Individual who created the claim,
15809   *              predetermination or preauthorization.)
15810   */
15811  public ExplanationOfBenefit setEnterer(Reference value) {
15812    this.enterer = value;
15813    return this;
15814  }
15815
15816  /**
15817   * @return {@link #enterer} The actual object that is the target of the
15818   *         reference. The reference library doesn't populate this, but you can
15819   *         use it to hold the resource if you resolve it. (Individual who
15820   *         created the claim, predetermination or preauthorization.)
15821   */
15822  public Resource getEntererTarget() {
15823    return this.entererTarget;
15824  }
15825
15826  /**
15827   * @param value {@link #enterer} The actual object that is the target of the
15828   *              reference. The reference library doesn't use these, but you can
15829   *              use it to hold the resource if you resolve it. (Individual who
15830   *              created the claim, predetermination or preauthorization.)
15831   */
15832  public ExplanationOfBenefit setEntererTarget(Resource value) {
15833    this.entererTarget = value;
15834    return this;
15835  }
15836
15837  /**
15838   * @return {@link #insurer} (The party responsible for authorization,
15839   *         adjudication and reimbursement.)
15840   */
15841  public Reference getInsurer() {
15842    if (this.insurer == null)
15843      if (Configuration.errorOnAutoCreate())
15844        throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
15845      else if (Configuration.doAutoCreate())
15846        this.insurer = new Reference(); // cc
15847    return this.insurer;
15848  }
15849
15850  public boolean hasInsurer() {
15851    return this.insurer != null && !this.insurer.isEmpty();
15852  }
15853
15854  /**
15855   * @param value {@link #insurer} (The party responsible for authorization,
15856   *              adjudication and reimbursement.)
15857   */
15858  public ExplanationOfBenefit setInsurer(Reference value) {
15859    this.insurer = value;
15860    return this;
15861  }
15862
15863  /**
15864   * @return {@link #insurer} The actual object that is the target of the
15865   *         reference. The reference library doesn't populate this, but you can
15866   *         use it to hold the resource if you resolve it. (The party responsible
15867   *         for authorization, adjudication and reimbursement.)
15868   */
15869  public Organization getInsurerTarget() {
15870    if (this.insurerTarget == null)
15871      if (Configuration.errorOnAutoCreate())
15872        throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
15873      else if (Configuration.doAutoCreate())
15874        this.insurerTarget = new Organization(); // aa
15875    return this.insurerTarget;
15876  }
15877
15878  /**
15879   * @param value {@link #insurer} The actual object that is the target of the
15880   *              reference. The reference library doesn't use these, but you can
15881   *              use it to hold the resource if you resolve it. (The party
15882   *              responsible for authorization, adjudication and reimbursement.)
15883   */
15884  public ExplanationOfBenefit setInsurerTarget(Organization value) {
15885    this.insurerTarget = value;
15886    return this;
15887  }
15888
15889  /**
15890   * @return {@link #provider} (The provider which is responsible for the claim,
15891   *         predetermination or preauthorization.)
15892   */
15893  public Reference getProvider() {
15894    if (this.provider == null)
15895      if (Configuration.errorOnAutoCreate())
15896        throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
15897      else if (Configuration.doAutoCreate())
15898        this.provider = new Reference(); // cc
15899    return this.provider;
15900  }
15901
15902  public boolean hasProvider() {
15903    return this.provider != null && !this.provider.isEmpty();
15904  }
15905
15906  /**
15907   * @param value {@link #provider} (The provider which is responsible for the
15908   *              claim, predetermination or preauthorization.)
15909   */
15910  public ExplanationOfBenefit setProvider(Reference value) {
15911    this.provider = value;
15912    return this;
15913  }
15914
15915  /**
15916   * @return {@link #provider} The actual object that is the target of the
15917   *         reference. The reference library doesn't populate this, but you can
15918   *         use it to hold the resource if you resolve it. (The provider which is
15919   *         responsible for the claim, predetermination or preauthorization.)
15920   */
15921  public Resource getProviderTarget() {
15922    return this.providerTarget;
15923  }
15924
15925  /**
15926   * @param value {@link #provider} The actual object that is the target of the
15927   *              reference. The reference library doesn't use these, but you can
15928   *              use it to hold the resource if you resolve it. (The provider
15929   *              which is responsible for the claim, predetermination or
15930   *              preauthorization.)
15931   */
15932  public ExplanationOfBenefit setProviderTarget(Resource value) {
15933    this.providerTarget = value;
15934    return this;
15935  }
15936
15937  /**
15938   * @return {@link #priority} (The provider-required urgency of processing the
15939   *         request. Typical values include: stat, routine deferred.)
15940   */
15941  public CodeableConcept getPriority() {
15942    if (this.priority == null)
15943      if (Configuration.errorOnAutoCreate())
15944        throw new Error("Attempt to auto-create ExplanationOfBenefit.priority");
15945      else if (Configuration.doAutoCreate())
15946        this.priority = new CodeableConcept(); // cc
15947    return this.priority;
15948  }
15949
15950  public boolean hasPriority() {
15951    return this.priority != null && !this.priority.isEmpty();
15952  }
15953
15954  /**
15955   * @param value {@link #priority} (The provider-required urgency of processing
15956   *              the request. Typical values include: stat, routine deferred.)
15957   */
15958  public ExplanationOfBenefit setPriority(CodeableConcept value) {
15959    this.priority = value;
15960    return this;
15961  }
15962
15963  /**
15964   * @return {@link #fundsReserveRequested} (A code to indicate whether and for
15965   *         whom funds are to be reserved for future claims.)
15966   */
15967  public CodeableConcept getFundsReserveRequested() {
15968    if (this.fundsReserveRequested == null)
15969      if (Configuration.errorOnAutoCreate())
15970        throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserveRequested");
15971      else if (Configuration.doAutoCreate())
15972        this.fundsReserveRequested = new CodeableConcept(); // cc
15973    return this.fundsReserveRequested;
15974  }
15975
15976  public boolean hasFundsReserveRequested() {
15977    return this.fundsReserveRequested != null && !this.fundsReserveRequested.isEmpty();
15978  }
15979
15980  /**
15981   * @param value {@link #fundsReserveRequested} (A code to indicate whether and
15982   *              for whom funds are to be reserved for future claims.)
15983   */
15984  public ExplanationOfBenefit setFundsReserveRequested(CodeableConcept value) {
15985    this.fundsReserveRequested = value;
15986    return this;
15987  }
15988
15989  /**
15990   * @return {@link #fundsReserve} (A code, used only on a response to a
15991   *         preauthorization, to indicate whether the benefits payable have been
15992   *         reserved and for whom.)
15993   */
15994  public CodeableConcept getFundsReserve() {
15995    if (this.fundsReserve == null)
15996      if (Configuration.errorOnAutoCreate())
15997        throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserve");
15998      else if (Configuration.doAutoCreate())
15999        this.fundsReserve = new CodeableConcept(); // cc
16000    return this.fundsReserve;
16001  }
16002
16003  public boolean hasFundsReserve() {
16004    return this.fundsReserve != null && !this.fundsReserve.isEmpty();
16005  }
16006
16007  /**
16008   * @param value {@link #fundsReserve} (A code, used only on a response to a
16009   *              preauthorization, to indicate whether the benefits payable have
16010   *              been reserved and for whom.)
16011   */
16012  public ExplanationOfBenefit setFundsReserve(CodeableConcept value) {
16013    this.fundsReserve = value;
16014    return this;
16015  }
16016
16017  /**
16018   * @return {@link #related} (Other claims which are related to this claim such
16019   *         as prior submissions or claims for related services or for the same
16020   *         event.)
16021   */
16022  public List<RelatedClaimComponent> getRelated() {
16023    if (this.related == null)
16024      this.related = new ArrayList<RelatedClaimComponent>();
16025    return this.related;
16026  }
16027
16028  /**
16029   * @return Returns a reference to <code>this</code> for easy method chaining
16030   */
16031  public ExplanationOfBenefit setRelated(List<RelatedClaimComponent> theRelated) {
16032    this.related = theRelated;
16033    return this;
16034  }
16035
16036  public boolean hasRelated() {
16037    if (this.related == null)
16038      return false;
16039    for (RelatedClaimComponent item : this.related)
16040      if (!item.isEmpty())
16041        return true;
16042    return false;
16043  }
16044
16045  public RelatedClaimComponent addRelated() { // 3
16046    RelatedClaimComponent t = new RelatedClaimComponent();
16047    if (this.related == null)
16048      this.related = new ArrayList<RelatedClaimComponent>();
16049    this.related.add(t);
16050    return t;
16051  }
16052
16053  public ExplanationOfBenefit addRelated(RelatedClaimComponent t) { // 3
16054    if (t == null)
16055      return this;
16056    if (this.related == null)
16057      this.related = new ArrayList<RelatedClaimComponent>();
16058    this.related.add(t);
16059    return this;
16060  }
16061
16062  /**
16063   * @return The first repetition of repeating field {@link #related}, creating it
16064   *         if it does not already exist
16065   */
16066  public RelatedClaimComponent getRelatedFirstRep() {
16067    if (getRelated().isEmpty()) {
16068      addRelated();
16069    }
16070    return getRelated().get(0);
16071  }
16072
16073  /**
16074   * @return {@link #prescription} (Prescription to support the dispensing of
16075   *         pharmacy, device or vision products.)
16076   */
16077  public Reference getPrescription() {
16078    if (this.prescription == null)
16079      if (Configuration.errorOnAutoCreate())
16080        throw new Error("Attempt to auto-create ExplanationOfBenefit.prescription");
16081      else if (Configuration.doAutoCreate())
16082        this.prescription = new Reference(); // cc
16083    return this.prescription;
16084  }
16085
16086  public boolean hasPrescription() {
16087    return this.prescription != null && !this.prescription.isEmpty();
16088  }
16089
16090  /**
16091   * @param value {@link #prescription} (Prescription to support the dispensing of
16092   *              pharmacy, device or vision products.)
16093   */
16094  public ExplanationOfBenefit setPrescription(Reference value) {
16095    this.prescription = value;
16096    return this;
16097  }
16098
16099  /**
16100   * @return {@link #prescription} The actual object that is the target of the
16101   *         reference. The reference library doesn't populate this, but you can
16102   *         use it to hold the resource if you resolve it. (Prescription to
16103   *         support the dispensing of pharmacy, device or vision products.)
16104   */
16105  public Resource getPrescriptionTarget() {
16106    return this.prescriptionTarget;
16107  }
16108
16109  /**
16110   * @param value {@link #prescription} The actual object that is the target of
16111   *              the reference. The reference library doesn't use these, but you
16112   *              can use it to hold the resource if you resolve it. (Prescription
16113   *              to support the dispensing of pharmacy, device or vision
16114   *              products.)
16115   */
16116  public ExplanationOfBenefit setPrescriptionTarget(Resource value) {
16117    this.prescriptionTarget = value;
16118    return this;
16119  }
16120
16121  /**
16122   * @return {@link #originalPrescription} (Original prescription which has been
16123   *         superseded by this prescription to support the dispensing of pharmacy
16124   *         services, medications or products.)
16125   */
16126  public Reference getOriginalPrescription() {
16127    if (this.originalPrescription == null)
16128      if (Configuration.errorOnAutoCreate())
16129        throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
16130      else if (Configuration.doAutoCreate())
16131        this.originalPrescription = new Reference(); // cc
16132    return this.originalPrescription;
16133  }
16134
16135  public boolean hasOriginalPrescription() {
16136    return this.originalPrescription != null && !this.originalPrescription.isEmpty();
16137  }
16138
16139  /**
16140   * @param value {@link #originalPrescription} (Original prescription which has
16141   *              been superseded by this prescription to support the dispensing
16142   *              of pharmacy services, medications or products.)
16143   */
16144  public ExplanationOfBenefit setOriginalPrescription(Reference value) {
16145    this.originalPrescription = value;
16146    return this;
16147  }
16148
16149  /**
16150   * @return {@link #originalPrescription} The actual object that is the target of
16151   *         the reference. The reference library doesn't populate this, but you
16152   *         can use it to hold the resource if you resolve it. (Original
16153   *         prescription which has been superseded by this prescription to
16154   *         support the dispensing of pharmacy services, medications or
16155   *         products.)
16156   */
16157  public MedicationRequest getOriginalPrescriptionTarget() {
16158    if (this.originalPrescriptionTarget == null)
16159      if (Configuration.errorOnAutoCreate())
16160        throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
16161      else if (Configuration.doAutoCreate())
16162        this.originalPrescriptionTarget = new MedicationRequest(); // aa
16163    return this.originalPrescriptionTarget;
16164  }
16165
16166  /**
16167   * @param value {@link #originalPrescription} The actual object that is the
16168   *              target of the reference. The reference library doesn't use
16169   *              these, but you can use it to hold the resource if you resolve
16170   *              it. (Original prescription which has been superseded by this
16171   *              prescription to support the dispensing of pharmacy services,
16172   *              medications or products.)
16173   */
16174  public ExplanationOfBenefit setOriginalPrescriptionTarget(MedicationRequest value) {
16175    this.originalPrescriptionTarget = value;
16176    return this;
16177  }
16178
16179  /**
16180   * @return {@link #payee} (The party to be reimbursed for cost of the products
16181   *         and services according to the terms of the policy.)
16182   */
16183  public PayeeComponent getPayee() {
16184    if (this.payee == null)
16185      if (Configuration.errorOnAutoCreate())
16186        throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
16187      else if (Configuration.doAutoCreate())
16188        this.payee = new PayeeComponent(); // cc
16189    return this.payee;
16190  }
16191
16192  public boolean hasPayee() {
16193    return this.payee != null && !this.payee.isEmpty();
16194  }
16195
16196  /**
16197   * @param value {@link #payee} (The party to be reimbursed for cost of the
16198   *              products and services according to the terms of the policy.)
16199   */
16200  public ExplanationOfBenefit setPayee(PayeeComponent value) {
16201    this.payee = value;
16202    return this;
16203  }
16204
16205  /**
16206   * @return {@link #referral} (A reference to a referral resource.)
16207   */
16208  public Reference getReferral() {
16209    if (this.referral == null)
16210      if (Configuration.errorOnAutoCreate())
16211        throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
16212      else if (Configuration.doAutoCreate())
16213        this.referral = new Reference(); // cc
16214    return this.referral;
16215  }
16216
16217  public boolean hasReferral() {
16218    return this.referral != null && !this.referral.isEmpty();
16219  }
16220
16221  /**
16222   * @param value {@link #referral} (A reference to a referral resource.)
16223   */
16224  public ExplanationOfBenefit setReferral(Reference value) {
16225    this.referral = value;
16226    return this;
16227  }
16228
16229  /**
16230   * @return {@link #referral} The actual object that is the target of the
16231   *         reference. The reference library doesn't populate this, but you can
16232   *         use it to hold the resource if you resolve it. (A reference to a
16233   *         referral resource.)
16234   */
16235  public ServiceRequest getReferralTarget() {
16236    if (this.referralTarget == null)
16237      if (Configuration.errorOnAutoCreate())
16238        throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
16239      else if (Configuration.doAutoCreate())
16240        this.referralTarget = new ServiceRequest(); // aa
16241    return this.referralTarget;
16242  }
16243
16244  /**
16245   * @param value {@link #referral} The actual object that is the target of the
16246   *              reference. The reference library doesn't use these, but you can
16247   *              use it to hold the resource if you resolve it. (A reference to a
16248   *              referral resource.)
16249   */
16250  public ExplanationOfBenefit setReferralTarget(ServiceRequest value) {
16251    this.referralTarget = value;
16252    return this;
16253  }
16254
16255  /**
16256   * @return {@link #facility} (Facility where the services were provided.)
16257   */
16258  public Reference getFacility() {
16259    if (this.facility == null)
16260      if (Configuration.errorOnAutoCreate())
16261        throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
16262      else if (Configuration.doAutoCreate())
16263        this.facility = new Reference(); // cc
16264    return this.facility;
16265  }
16266
16267  public boolean hasFacility() {
16268    return this.facility != null && !this.facility.isEmpty();
16269  }
16270
16271  /**
16272   * @param value {@link #facility} (Facility where the services were provided.)
16273   */
16274  public ExplanationOfBenefit setFacility(Reference value) {
16275    this.facility = value;
16276    return this;
16277  }
16278
16279  /**
16280   * @return {@link #facility} The actual object that is the target of the
16281   *         reference. The reference library doesn't populate this, but you can
16282   *         use it to hold the resource if you resolve it. (Facility where the
16283   *         services were provided.)
16284   */
16285  public Location getFacilityTarget() {
16286    if (this.facilityTarget == null)
16287      if (Configuration.errorOnAutoCreate())
16288        throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
16289      else if (Configuration.doAutoCreate())
16290        this.facilityTarget = new Location(); // aa
16291    return this.facilityTarget;
16292  }
16293
16294  /**
16295   * @param value {@link #facility} The actual object that is the target of the
16296   *              reference. The reference library doesn't use these, but you can
16297   *              use it to hold the resource if you resolve it. (Facility where
16298   *              the services were provided.)
16299   */
16300  public ExplanationOfBenefit setFacilityTarget(Location value) {
16301    this.facilityTarget = value;
16302    return this;
16303  }
16304
16305  /**
16306   * @return {@link #claim} (The business identifier for the instance of the
16307   *         adjudication request: claim predetermination or preauthorization.)
16308   */
16309  public Reference getClaim() {
16310    if (this.claim == null)
16311      if (Configuration.errorOnAutoCreate())
16312        throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
16313      else if (Configuration.doAutoCreate())
16314        this.claim = new Reference(); // cc
16315    return this.claim;
16316  }
16317
16318  public boolean hasClaim() {
16319    return this.claim != null && !this.claim.isEmpty();
16320  }
16321
16322  /**
16323   * @param value {@link #claim} (The business identifier for the instance of the
16324   *              adjudication request: claim predetermination or
16325   *              preauthorization.)
16326   */
16327  public ExplanationOfBenefit setClaim(Reference value) {
16328    this.claim = value;
16329    return this;
16330  }
16331
16332  /**
16333   * @return {@link #claim} The actual object that is the target of the reference.
16334   *         The reference library doesn't populate this, but you can use it to
16335   *         hold the resource if you resolve it. (The business identifier for the
16336   *         instance of the adjudication request: claim predetermination or
16337   *         preauthorization.)
16338   */
16339  public Claim getClaimTarget() {
16340    if (this.claimTarget == null)
16341      if (Configuration.errorOnAutoCreate())
16342        throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
16343      else if (Configuration.doAutoCreate())
16344        this.claimTarget = new Claim(); // aa
16345    return this.claimTarget;
16346  }
16347
16348  /**
16349   * @param value {@link #claim} The actual object that is the target of the
16350   *              reference. The reference library doesn't use these, but you can
16351   *              use it to hold the resource if you resolve it. (The business
16352   *              identifier for the instance of the adjudication request: claim
16353   *              predetermination or preauthorization.)
16354   */
16355  public ExplanationOfBenefit setClaimTarget(Claim value) {
16356    this.claimTarget = value;
16357    return this;
16358  }
16359
16360  /**
16361   * @return {@link #claimResponse} (The business identifier for the instance of
16362   *         the adjudication response: claim, predetermination or
16363   *         preauthorization response.)
16364   */
16365  public Reference getClaimResponse() {
16366    if (this.claimResponse == null)
16367      if (Configuration.errorOnAutoCreate())
16368        throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
16369      else if (Configuration.doAutoCreate())
16370        this.claimResponse = new Reference(); // cc
16371    return this.claimResponse;
16372  }
16373
16374  public boolean hasClaimResponse() {
16375    return this.claimResponse != null && !this.claimResponse.isEmpty();
16376  }
16377
16378  /**
16379   * @param value {@link #claimResponse} (The business identifier for the instance
16380   *              of the adjudication response: claim, predetermination or
16381   *              preauthorization response.)
16382   */
16383  public ExplanationOfBenefit setClaimResponse(Reference value) {
16384    this.claimResponse = value;
16385    return this;
16386  }
16387
16388  /**
16389   * @return {@link #claimResponse} The actual object that is the target of the
16390   *         reference. The reference library doesn't populate this, but you can
16391   *         use it to hold the resource if you resolve it. (The business
16392   *         identifier for the instance of the adjudication response: claim,
16393   *         predetermination or preauthorization response.)
16394   */
16395  public ClaimResponse getClaimResponseTarget() {
16396    if (this.claimResponseTarget == null)
16397      if (Configuration.errorOnAutoCreate())
16398        throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
16399      else if (Configuration.doAutoCreate())
16400        this.claimResponseTarget = new ClaimResponse(); // aa
16401    return this.claimResponseTarget;
16402  }
16403
16404  /**
16405   * @param value {@link #claimResponse} The actual object that is the target of
16406   *              the reference. The reference library doesn't use these, but you
16407   *              can use it to hold the resource if you resolve it. (The business
16408   *              identifier for the instance of the adjudication response: claim,
16409   *              predetermination or preauthorization response.)
16410   */
16411  public ExplanationOfBenefit setClaimResponseTarget(ClaimResponse value) {
16412    this.claimResponseTarget = value;
16413    return this;
16414  }
16415
16416  /**
16417   * @return {@link #outcome} (The outcome of the claim, predetermination, or
16418   *         preauthorization processing.). This is the underlying object with id,
16419   *         value and extensions. The accessor "getOutcome" gives direct access
16420   *         to the value
16421   */
16422  public Enumeration<RemittanceOutcome> getOutcomeElement() {
16423    if (this.outcome == null)
16424      if (Configuration.errorOnAutoCreate())
16425        throw new Error("Attempt to auto-create ExplanationOfBenefit.outcome");
16426      else if (Configuration.doAutoCreate())
16427        this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory()); // bb
16428    return this.outcome;
16429  }
16430
16431  public boolean hasOutcomeElement() {
16432    return this.outcome != null && !this.outcome.isEmpty();
16433  }
16434
16435  public boolean hasOutcome() {
16436    return this.outcome != null && !this.outcome.isEmpty();
16437  }
16438
16439  /**
16440   * @param value {@link #outcome} (The outcome of the claim, predetermination, or
16441   *              preauthorization processing.). This is the underlying object
16442   *              with id, value and extensions. The accessor "getOutcome" gives
16443   *              direct access to the value
16444   */
16445  public ExplanationOfBenefit setOutcomeElement(Enumeration<RemittanceOutcome> value) {
16446    this.outcome = value;
16447    return this;
16448  }
16449
16450  /**
16451   * @return The outcome of the claim, predetermination, or preauthorization
16452   *         processing.
16453   */
16454  public RemittanceOutcome getOutcome() {
16455    return this.outcome == null ? null : this.outcome.getValue();
16456  }
16457
16458  /**
16459   * @param value The outcome of the claim, predetermination, or preauthorization
16460   *              processing.
16461   */
16462  public ExplanationOfBenefit setOutcome(RemittanceOutcome value) {
16463    if (this.outcome == null)
16464      this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory());
16465    this.outcome.setValue(value);
16466    return this;
16467  }
16468
16469  /**
16470   * @return {@link #disposition} (A human readable description of the status of
16471   *         the adjudication.). This is the underlying object with id, value and
16472   *         extensions. The accessor "getDisposition" gives direct access to the
16473   *         value
16474   */
16475  public StringType getDispositionElement() {
16476    if (this.disposition == null)
16477      if (Configuration.errorOnAutoCreate())
16478        throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
16479      else if (Configuration.doAutoCreate())
16480        this.disposition = new StringType(); // bb
16481    return this.disposition;
16482  }
16483
16484  public boolean hasDispositionElement() {
16485    return this.disposition != null && !this.disposition.isEmpty();
16486  }
16487
16488  public boolean hasDisposition() {
16489    return this.disposition != null && !this.disposition.isEmpty();
16490  }
16491
16492  /**
16493   * @param value {@link #disposition} (A human readable description of the status
16494   *              of the adjudication.). This is the underlying object with id,
16495   *              value and extensions. The accessor "getDisposition" gives direct
16496   *              access to the value
16497   */
16498  public ExplanationOfBenefit setDispositionElement(StringType value) {
16499    this.disposition = value;
16500    return this;
16501  }
16502
16503  /**
16504   * @return A human readable description of the status of the adjudication.
16505   */
16506  public String getDisposition() {
16507    return this.disposition == null ? null : this.disposition.getValue();
16508  }
16509
16510  /**
16511   * @param value A human readable description of the status of the adjudication.
16512   */
16513  public ExplanationOfBenefit setDisposition(String value) {
16514    if (Utilities.noString(value))
16515      this.disposition = null;
16516    else {
16517      if (this.disposition == null)
16518        this.disposition = new StringType();
16519      this.disposition.setValue(value);
16520    }
16521    return this;
16522  }
16523
16524  /**
16525   * @return {@link #preAuthRef} (Reference from the Insurer which is used in
16526   *         later communications which refers to this adjudication.)
16527   */
16528  public List<StringType> getPreAuthRef() {
16529    if (this.preAuthRef == null)
16530      this.preAuthRef = new ArrayList<StringType>();
16531    return this.preAuthRef;
16532  }
16533
16534  /**
16535   * @return Returns a reference to <code>this</code> for easy method chaining
16536   */
16537  public ExplanationOfBenefit setPreAuthRef(List<StringType> thePreAuthRef) {
16538    this.preAuthRef = thePreAuthRef;
16539    return this;
16540  }
16541
16542  public boolean hasPreAuthRef() {
16543    if (this.preAuthRef == null)
16544      return false;
16545    for (StringType item : this.preAuthRef)
16546      if (!item.isEmpty())
16547        return true;
16548    return false;
16549  }
16550
16551  /**
16552   * @return {@link #preAuthRef} (Reference from the Insurer which is used in
16553   *         later communications which refers to this adjudication.)
16554   */
16555  public StringType addPreAuthRefElement() {// 2
16556    StringType t = new StringType();
16557    if (this.preAuthRef == null)
16558      this.preAuthRef = new ArrayList<StringType>();
16559    this.preAuthRef.add(t);
16560    return t;
16561  }
16562
16563  /**
16564   * @param value {@link #preAuthRef} (Reference from the Insurer which is used in
16565   *              later communications which refers to this adjudication.)
16566   */
16567  public ExplanationOfBenefit addPreAuthRef(String value) { // 1
16568    StringType t = new StringType();
16569    t.setValue(value);
16570    if (this.preAuthRef == null)
16571      this.preAuthRef = new ArrayList<StringType>();
16572    this.preAuthRef.add(t);
16573    return this;
16574  }
16575
16576  /**
16577   * @param value {@link #preAuthRef} (Reference from the Insurer which is used in
16578   *              later communications which refers to this adjudication.)
16579   */
16580  public boolean hasPreAuthRef(String value) {
16581    if (this.preAuthRef == null)
16582      return false;
16583    for (StringType v : this.preAuthRef)
16584      if (v.getValue().equals(value)) // string
16585        return true;
16586    return false;
16587  }
16588
16589  /**
16590   * @return {@link #preAuthRefPeriod} (The timeframe during which the supplied
16591   *         preauthorization reference may be quoted on claims to obtain the
16592   *         adjudication as provided.)
16593   */
16594  public List<Period> getPreAuthRefPeriod() {
16595    if (this.preAuthRefPeriod == null)
16596      this.preAuthRefPeriod = new ArrayList<Period>();
16597    return this.preAuthRefPeriod;
16598  }
16599
16600  /**
16601   * @return Returns a reference to <code>this</code> for easy method chaining
16602   */
16603  public ExplanationOfBenefit setPreAuthRefPeriod(List<Period> thePreAuthRefPeriod) {
16604    this.preAuthRefPeriod = thePreAuthRefPeriod;
16605    return this;
16606  }
16607
16608  public boolean hasPreAuthRefPeriod() {
16609    if (this.preAuthRefPeriod == null)
16610      return false;
16611    for (Period item : this.preAuthRefPeriod)
16612      if (!item.isEmpty())
16613        return true;
16614    return false;
16615  }
16616
16617  public Period addPreAuthRefPeriod() { // 3
16618    Period t = new Period();
16619    if (this.preAuthRefPeriod == null)
16620      this.preAuthRefPeriod = new ArrayList<Period>();
16621    this.preAuthRefPeriod.add(t);
16622    return t;
16623  }
16624
16625  public ExplanationOfBenefit addPreAuthRefPeriod(Period t) { // 3
16626    if (t == null)
16627      return this;
16628    if (this.preAuthRefPeriod == null)
16629      this.preAuthRefPeriod = new ArrayList<Period>();
16630    this.preAuthRefPeriod.add(t);
16631    return this;
16632  }
16633
16634  /**
16635   * @return The first repetition of repeating field {@link #preAuthRefPeriod},
16636   *         creating it if it does not already exist
16637   */
16638  public Period getPreAuthRefPeriodFirstRep() {
16639    if (getPreAuthRefPeriod().isEmpty()) {
16640      addPreAuthRefPeriod();
16641    }
16642    return getPreAuthRefPeriod().get(0);
16643  }
16644
16645  /**
16646   * @return {@link #careTeam} (The members of the team who provided the products
16647   *         and services.)
16648   */
16649  public List<CareTeamComponent> getCareTeam() {
16650    if (this.careTeam == null)
16651      this.careTeam = new ArrayList<CareTeamComponent>();
16652    return this.careTeam;
16653  }
16654
16655  /**
16656   * @return Returns a reference to <code>this</code> for easy method chaining
16657   */
16658  public ExplanationOfBenefit setCareTeam(List<CareTeamComponent> theCareTeam) {
16659    this.careTeam = theCareTeam;
16660    return this;
16661  }
16662
16663  public boolean hasCareTeam() {
16664    if (this.careTeam == null)
16665      return false;
16666    for (CareTeamComponent item : this.careTeam)
16667      if (!item.isEmpty())
16668        return true;
16669    return false;
16670  }
16671
16672  public CareTeamComponent addCareTeam() { // 3
16673    CareTeamComponent t = new CareTeamComponent();
16674    if (this.careTeam == null)
16675      this.careTeam = new ArrayList<CareTeamComponent>();
16676    this.careTeam.add(t);
16677    return t;
16678  }
16679
16680  public ExplanationOfBenefit addCareTeam(CareTeamComponent t) { // 3
16681    if (t == null)
16682      return this;
16683    if (this.careTeam == null)
16684      this.careTeam = new ArrayList<CareTeamComponent>();
16685    this.careTeam.add(t);
16686    return this;
16687  }
16688
16689  /**
16690   * @return The first repetition of repeating field {@link #careTeam}, creating
16691   *         it if it does not already exist
16692   */
16693  public CareTeamComponent getCareTeamFirstRep() {
16694    if (getCareTeam().isEmpty()) {
16695      addCareTeam();
16696    }
16697    return getCareTeam().get(0);
16698  }
16699
16700  /**
16701   * @return {@link #supportingInfo} (Additional information codes regarding
16702   *         exceptions, special considerations, the condition, situation, prior
16703   *         or concurrent issues.)
16704   */
16705  public List<SupportingInformationComponent> getSupportingInfo() {
16706    if (this.supportingInfo == null)
16707      this.supportingInfo = new ArrayList<SupportingInformationComponent>();
16708    return this.supportingInfo;
16709  }
16710
16711  /**
16712   * @return Returns a reference to <code>this</code> for easy method chaining
16713   */
16714  public ExplanationOfBenefit setSupportingInfo(List<SupportingInformationComponent> theSupportingInfo) {
16715    this.supportingInfo = theSupportingInfo;
16716    return this;
16717  }
16718
16719  public boolean hasSupportingInfo() {
16720    if (this.supportingInfo == null)
16721      return false;
16722    for (SupportingInformationComponent item : this.supportingInfo)
16723      if (!item.isEmpty())
16724        return true;
16725    return false;
16726  }
16727
16728  public SupportingInformationComponent addSupportingInfo() { // 3
16729    SupportingInformationComponent t = new SupportingInformationComponent();
16730    if (this.supportingInfo == null)
16731      this.supportingInfo = new ArrayList<SupportingInformationComponent>();
16732    this.supportingInfo.add(t);
16733    return t;
16734  }
16735
16736  public ExplanationOfBenefit addSupportingInfo(SupportingInformationComponent t) { // 3
16737    if (t == null)
16738      return this;
16739    if (this.supportingInfo == null)
16740      this.supportingInfo = new ArrayList<SupportingInformationComponent>();
16741    this.supportingInfo.add(t);
16742    return this;
16743  }
16744
16745  /**
16746   * @return The first repetition of repeating field {@link #supportingInfo},
16747   *         creating it if it does not already exist
16748   */
16749  public SupportingInformationComponent getSupportingInfoFirstRep() {
16750    if (getSupportingInfo().isEmpty()) {
16751      addSupportingInfo();
16752    }
16753    return getSupportingInfo().get(0);
16754  }
16755
16756  /**
16757   * @return {@link #diagnosis} (Information about diagnoses relevant to the claim
16758   *         items.)
16759   */
16760  public List<DiagnosisComponent> getDiagnosis() {
16761    if (this.diagnosis == null)
16762      this.diagnosis = new ArrayList<DiagnosisComponent>();
16763    return this.diagnosis;
16764  }
16765
16766  /**
16767   * @return Returns a reference to <code>this</code> for easy method chaining
16768   */
16769  public ExplanationOfBenefit setDiagnosis(List<DiagnosisComponent> theDiagnosis) {
16770    this.diagnosis = theDiagnosis;
16771    return this;
16772  }
16773
16774  public boolean hasDiagnosis() {
16775    if (this.diagnosis == null)
16776      return false;
16777    for (DiagnosisComponent item : this.diagnosis)
16778      if (!item.isEmpty())
16779        return true;
16780    return false;
16781  }
16782
16783  public DiagnosisComponent addDiagnosis() { // 3
16784    DiagnosisComponent t = new DiagnosisComponent();
16785    if (this.diagnosis == null)
16786      this.diagnosis = new ArrayList<DiagnosisComponent>();
16787    this.diagnosis.add(t);
16788    return t;
16789  }
16790
16791  public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { // 3
16792    if (t == null)
16793      return this;
16794    if (this.diagnosis == null)
16795      this.diagnosis = new ArrayList<DiagnosisComponent>();
16796    this.diagnosis.add(t);
16797    return this;
16798  }
16799
16800  /**
16801   * @return The first repetition of repeating field {@link #diagnosis}, creating
16802   *         it if it does not already exist
16803   */
16804  public DiagnosisComponent getDiagnosisFirstRep() {
16805    if (getDiagnosis().isEmpty()) {
16806      addDiagnosis();
16807    }
16808    return getDiagnosis().get(0);
16809  }
16810
16811  /**
16812   * @return {@link #procedure} (Procedures performed on the patient relevant to
16813   *         the billing items with the claim.)
16814   */
16815  public List<ProcedureComponent> getProcedure() {
16816    if (this.procedure == null)
16817      this.procedure = new ArrayList<ProcedureComponent>();
16818    return this.procedure;
16819  }
16820
16821  /**
16822   * @return Returns a reference to <code>this</code> for easy method chaining
16823   */
16824  public ExplanationOfBenefit setProcedure(List<ProcedureComponent> theProcedure) {
16825    this.procedure = theProcedure;
16826    return this;
16827  }
16828
16829  public boolean hasProcedure() {
16830    if (this.procedure == null)
16831      return false;
16832    for (ProcedureComponent item : this.procedure)
16833      if (!item.isEmpty())
16834        return true;
16835    return false;
16836  }
16837
16838  public ProcedureComponent addProcedure() { // 3
16839    ProcedureComponent t = new ProcedureComponent();
16840    if (this.procedure == null)
16841      this.procedure = new ArrayList<ProcedureComponent>();
16842    this.procedure.add(t);
16843    return t;
16844  }
16845
16846  public ExplanationOfBenefit addProcedure(ProcedureComponent t) { // 3
16847    if (t == null)
16848      return this;
16849    if (this.procedure == null)
16850      this.procedure = new ArrayList<ProcedureComponent>();
16851    this.procedure.add(t);
16852    return this;
16853  }
16854
16855  /**
16856   * @return The first repetition of repeating field {@link #procedure}, creating
16857   *         it if it does not already exist
16858   */
16859  public ProcedureComponent getProcedureFirstRep() {
16860    if (getProcedure().isEmpty()) {
16861      addProcedure();
16862    }
16863    return getProcedure().get(0);
16864  }
16865
16866  /**
16867   * @return {@link #precedence} (This indicates the relative order of a series of
16868   *         EOBs related to different coverages for the same suite of services.).
16869   *         This is the underlying object with id, value and extensions. The
16870   *         accessor "getPrecedence" gives direct access to the value
16871   */
16872  public PositiveIntType getPrecedenceElement() {
16873    if (this.precedence == null)
16874      if (Configuration.errorOnAutoCreate())
16875        throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
16876      else if (Configuration.doAutoCreate())
16877        this.precedence = new PositiveIntType(); // bb
16878    return this.precedence;
16879  }
16880
16881  public boolean hasPrecedenceElement() {
16882    return this.precedence != null && !this.precedence.isEmpty();
16883  }
16884
16885  public boolean hasPrecedence() {
16886    return this.precedence != null && !this.precedence.isEmpty();
16887  }
16888
16889  /**
16890   * @param value {@link #precedence} (This indicates the relative order of a
16891   *              series of EOBs related to different coverages for the same suite
16892   *              of services.). This is the underlying object with id, value and
16893   *              extensions. The accessor "getPrecedence" gives direct access to
16894   *              the value
16895   */
16896  public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) {
16897    this.precedence = value;
16898    return this;
16899  }
16900
16901  /**
16902   * @return This indicates the relative order of a series of EOBs related to
16903   *         different coverages for the same suite of services.
16904   */
16905  public int getPrecedence() {
16906    return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
16907  }
16908
16909  /**
16910   * @param value This indicates the relative order of a series of EOBs related to
16911   *              different coverages for the same suite of services.
16912   */
16913  public ExplanationOfBenefit setPrecedence(int value) {
16914    if (this.precedence == null)
16915      this.precedence = new PositiveIntType();
16916    this.precedence.setValue(value);
16917    return this;
16918  }
16919
16920  /**
16921   * @return {@link #insurance} (Financial instruments for reimbursement for the
16922   *         health care products and services specified on the claim.)
16923   */
16924  public List<InsuranceComponent> getInsurance() {
16925    if (this.insurance == null)
16926      this.insurance = new ArrayList<InsuranceComponent>();
16927    return this.insurance;
16928  }
16929
16930  /**
16931   * @return Returns a reference to <code>this</code> for easy method chaining
16932   */
16933  public ExplanationOfBenefit setInsurance(List<InsuranceComponent> theInsurance) {
16934    this.insurance = theInsurance;
16935    return this;
16936  }
16937
16938  public boolean hasInsurance() {
16939    if (this.insurance == null)
16940      return false;
16941    for (InsuranceComponent item : this.insurance)
16942      if (!item.isEmpty())
16943        return true;
16944    return false;
16945  }
16946
16947  public InsuranceComponent addInsurance() { // 3
16948    InsuranceComponent t = new InsuranceComponent();
16949    if (this.insurance == null)
16950      this.insurance = new ArrayList<InsuranceComponent>();
16951    this.insurance.add(t);
16952    return t;
16953  }
16954
16955  public ExplanationOfBenefit addInsurance(InsuranceComponent t) { // 3
16956    if (t == null)
16957      return this;
16958    if (this.insurance == null)
16959      this.insurance = new ArrayList<InsuranceComponent>();
16960    this.insurance.add(t);
16961    return this;
16962  }
16963
16964  /**
16965   * @return The first repetition of repeating field {@link #insurance}, creating
16966   *         it if it does not already exist
16967   */
16968  public InsuranceComponent getInsuranceFirstRep() {
16969    if (getInsurance().isEmpty()) {
16970      addInsurance();
16971    }
16972    return getInsurance().get(0);
16973  }
16974
16975  /**
16976   * @return {@link #accident} (Details of a accident which resulted in injuries
16977   *         which required the products and services listed in the claim.)
16978   */
16979  public AccidentComponent getAccident() {
16980    if (this.accident == null)
16981      if (Configuration.errorOnAutoCreate())
16982        throw new Error("Attempt to auto-create ExplanationOfBenefit.accident");
16983      else if (Configuration.doAutoCreate())
16984        this.accident = new AccidentComponent(); // cc
16985    return this.accident;
16986  }
16987
16988  public boolean hasAccident() {
16989    return this.accident != null && !this.accident.isEmpty();
16990  }
16991
16992  /**
16993   * @param value {@link #accident} (Details of a accident which resulted in
16994   *              injuries which required the products and services listed in the
16995   *              claim.)
16996   */
16997  public ExplanationOfBenefit setAccident(AccidentComponent value) {
16998    this.accident = value;
16999    return this;
17000  }
17001
17002  /**
17003   * @return {@link #item} (A claim line. Either a simple (a product or service)
17004   *         or a 'group' of details which can also be a simple items or groups of
17005   *         sub-details.)
17006   */
17007  public List<ItemComponent> getItem() {
17008    if (this.item == null)
17009      this.item = new ArrayList<ItemComponent>();
17010    return this.item;
17011  }
17012
17013  /**
17014   * @return Returns a reference to <code>this</code> for easy method chaining
17015   */
17016  public ExplanationOfBenefit setItem(List<ItemComponent> theItem) {
17017    this.item = theItem;
17018    return this;
17019  }
17020
17021  public boolean hasItem() {
17022    if (this.item == null)
17023      return false;
17024    for (ItemComponent item : this.item)
17025      if (!item.isEmpty())
17026        return true;
17027    return false;
17028  }
17029
17030  public ItemComponent addItem() { // 3
17031    ItemComponent t = new ItemComponent();
17032    if (this.item == null)
17033      this.item = new ArrayList<ItemComponent>();
17034    this.item.add(t);
17035    return t;
17036  }
17037
17038  public ExplanationOfBenefit addItem(ItemComponent t) { // 3
17039    if (t == null)
17040      return this;
17041    if (this.item == null)
17042      this.item = new ArrayList<ItemComponent>();
17043    this.item.add(t);
17044    return this;
17045  }
17046
17047  /**
17048   * @return The first repetition of repeating field {@link #item}, creating it if
17049   *         it does not already exist
17050   */
17051  public ItemComponent getItemFirstRep() {
17052    if (getItem().isEmpty()) {
17053      addItem();
17054    }
17055    return getItem().get(0);
17056  }
17057
17058  /**
17059   * @return {@link #addItem} (The first-tier service adjudications for payor
17060   *         added product or service lines.)
17061   */
17062  public List<AddedItemComponent> getAddItem() {
17063    if (this.addItem == null)
17064      this.addItem = new ArrayList<AddedItemComponent>();
17065    return this.addItem;
17066  }
17067
17068  /**
17069   * @return Returns a reference to <code>this</code> for easy method chaining
17070   */
17071  public ExplanationOfBenefit setAddItem(List<AddedItemComponent> theAddItem) {
17072    this.addItem = theAddItem;
17073    return this;
17074  }
17075
17076  public boolean hasAddItem() {
17077    if (this.addItem == null)
17078      return false;
17079    for (AddedItemComponent item : this.addItem)
17080      if (!item.isEmpty())
17081        return true;
17082    return false;
17083  }
17084
17085  public AddedItemComponent addAddItem() { // 3
17086    AddedItemComponent t = new AddedItemComponent();
17087    if (this.addItem == null)
17088      this.addItem = new ArrayList<AddedItemComponent>();
17089    this.addItem.add(t);
17090    return t;
17091  }
17092
17093  public ExplanationOfBenefit addAddItem(AddedItemComponent t) { // 3
17094    if (t == null)
17095      return this;
17096    if (this.addItem == null)
17097      this.addItem = new ArrayList<AddedItemComponent>();
17098    this.addItem.add(t);
17099    return this;
17100  }
17101
17102  /**
17103   * @return The first repetition of repeating field {@link #addItem}, creating it
17104   *         if it does not already exist
17105   */
17106  public AddedItemComponent getAddItemFirstRep() {
17107    if (getAddItem().isEmpty()) {
17108      addAddItem();
17109    }
17110    return getAddItem().get(0);
17111  }
17112
17113  /**
17114   * @return {@link #adjudication} (The adjudication results which are presented
17115   *         at the header level rather than at the line-item or add-item levels.)
17116   */
17117  public List<AdjudicationComponent> getAdjudication() {
17118    if (this.adjudication == null)
17119      this.adjudication = new ArrayList<AdjudicationComponent>();
17120    return this.adjudication;
17121  }
17122
17123  /**
17124   * @return Returns a reference to <code>this</code> for easy method chaining
17125   */
17126  public ExplanationOfBenefit setAdjudication(List<AdjudicationComponent> theAdjudication) {
17127    this.adjudication = theAdjudication;
17128    return this;
17129  }
17130
17131  public boolean hasAdjudication() {
17132    if (this.adjudication == null)
17133      return false;
17134    for (AdjudicationComponent item : this.adjudication)
17135      if (!item.isEmpty())
17136        return true;
17137    return false;
17138  }
17139
17140  public AdjudicationComponent addAdjudication() { // 3
17141    AdjudicationComponent t = new AdjudicationComponent();
17142    if (this.adjudication == null)
17143      this.adjudication = new ArrayList<AdjudicationComponent>();
17144    this.adjudication.add(t);
17145    return t;
17146  }
17147
17148  public ExplanationOfBenefit addAdjudication(AdjudicationComponent t) { // 3
17149    if (t == null)
17150      return this;
17151    if (this.adjudication == null)
17152      this.adjudication = new ArrayList<AdjudicationComponent>();
17153    this.adjudication.add(t);
17154    return this;
17155  }
17156
17157  /**
17158   * @return The first repetition of repeating field {@link #adjudication},
17159   *         creating it if it does not already exist
17160   */
17161  public AdjudicationComponent getAdjudicationFirstRep() {
17162    if (getAdjudication().isEmpty()) {
17163      addAdjudication();
17164    }
17165    return getAdjudication().get(0);
17166  }
17167
17168  /**
17169   * @return {@link #total} (Categorized monetary totals for the adjudication.)
17170   */
17171  public List<TotalComponent> getTotal() {
17172    if (this.total == null)
17173      this.total = new ArrayList<TotalComponent>();
17174    return this.total;
17175  }
17176
17177  /**
17178   * @return Returns a reference to <code>this</code> for easy method chaining
17179   */
17180  public ExplanationOfBenefit setTotal(List<TotalComponent> theTotal) {
17181    this.total = theTotal;
17182    return this;
17183  }
17184
17185  public boolean hasTotal() {
17186    if (this.total == null)
17187      return false;
17188    for (TotalComponent item : this.total)
17189      if (!item.isEmpty())
17190        return true;
17191    return false;
17192  }
17193
17194  public TotalComponent addTotal() { // 3
17195    TotalComponent t = new TotalComponent();
17196    if (this.total == null)
17197      this.total = new ArrayList<TotalComponent>();
17198    this.total.add(t);
17199    return t;
17200  }
17201
17202  public ExplanationOfBenefit addTotal(TotalComponent t) { // 3
17203    if (t == null)
17204      return this;
17205    if (this.total == null)
17206      this.total = new ArrayList<TotalComponent>();
17207    this.total.add(t);
17208    return this;
17209  }
17210
17211  /**
17212   * @return The first repetition of repeating field {@link #total}, creating it
17213   *         if it does not already exist
17214   */
17215  public TotalComponent getTotalFirstRep() {
17216    if (getTotal().isEmpty()) {
17217      addTotal();
17218    }
17219    return getTotal().get(0);
17220  }
17221
17222  /**
17223   * @return {@link #payment} (Payment details for the adjudication of the claim.)
17224   */
17225  public PaymentComponent getPayment() {
17226    if (this.payment == null)
17227      if (Configuration.errorOnAutoCreate())
17228        throw new Error("Attempt to auto-create ExplanationOfBenefit.payment");
17229      else if (Configuration.doAutoCreate())
17230        this.payment = new PaymentComponent(); // cc
17231    return this.payment;
17232  }
17233
17234  public boolean hasPayment() {
17235    return this.payment != null && !this.payment.isEmpty();
17236  }
17237
17238  /**
17239   * @param value {@link #payment} (Payment details for the adjudication of the
17240   *              claim.)
17241   */
17242  public ExplanationOfBenefit setPayment(PaymentComponent value) {
17243    this.payment = value;
17244    return this;
17245  }
17246
17247  /**
17248   * @return {@link #formCode} (A code for the form to be used for printing the
17249   *         content.)
17250   */
17251  public CodeableConcept getFormCode() {
17252    if (this.formCode == null)
17253      if (Configuration.errorOnAutoCreate())
17254        throw new Error("Attempt to auto-create ExplanationOfBenefit.formCode");
17255      else if (Configuration.doAutoCreate())
17256        this.formCode = new CodeableConcept(); // cc
17257    return this.formCode;
17258  }
17259
17260  public boolean hasFormCode() {
17261    return this.formCode != null && !this.formCode.isEmpty();
17262  }
17263
17264  /**
17265   * @param value {@link #formCode} (A code for the form to be used for printing
17266   *              the content.)
17267   */
17268  public ExplanationOfBenefit setFormCode(CodeableConcept value) {
17269    this.formCode = value;
17270    return this;
17271  }
17272
17273  /**
17274   * @return {@link #form} (The actual form, by reference or inclusion, for
17275   *         printing the content or an EOB.)
17276   */
17277  public Attachment getForm() {
17278    if (this.form == null)
17279      if (Configuration.errorOnAutoCreate())
17280        throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
17281      else if (Configuration.doAutoCreate())
17282        this.form = new Attachment(); // cc
17283    return this.form;
17284  }
17285
17286  public boolean hasForm() {
17287    return this.form != null && !this.form.isEmpty();
17288  }
17289
17290  /**
17291   * @param value {@link #form} (The actual form, by reference or inclusion, for
17292   *              printing the content or an EOB.)
17293   */
17294  public ExplanationOfBenefit setForm(Attachment value) {
17295    this.form = value;
17296    return this;
17297  }
17298
17299  /**
17300   * @return {@link #processNote} (A note that describes or explains adjudication
17301   *         results in a human readable form.)
17302   */
17303  public List<NoteComponent> getProcessNote() {
17304    if (this.processNote == null)
17305      this.processNote = new ArrayList<NoteComponent>();
17306    return this.processNote;
17307  }
17308
17309  /**
17310   * @return Returns a reference to <code>this</code> for easy method chaining
17311   */
17312  public ExplanationOfBenefit setProcessNote(List<NoteComponent> theProcessNote) {
17313    this.processNote = theProcessNote;
17314    return this;
17315  }
17316
17317  public boolean hasProcessNote() {
17318    if (this.processNote == null)
17319      return false;
17320    for (NoteComponent item : this.processNote)
17321      if (!item.isEmpty())
17322        return true;
17323    return false;
17324  }
17325
17326  public NoteComponent addProcessNote() { // 3
17327    NoteComponent t = new NoteComponent();
17328    if (this.processNote == null)
17329      this.processNote = new ArrayList<NoteComponent>();
17330    this.processNote.add(t);
17331    return t;
17332  }
17333
17334  public ExplanationOfBenefit addProcessNote(NoteComponent t) { // 3
17335    if (t == null)
17336      return this;
17337    if (this.processNote == null)
17338      this.processNote = new ArrayList<NoteComponent>();
17339    this.processNote.add(t);
17340    return this;
17341  }
17342
17343  /**
17344   * @return The first repetition of repeating field {@link #processNote},
17345   *         creating it if it does not already exist
17346   */
17347  public NoteComponent getProcessNoteFirstRep() {
17348    if (getProcessNote().isEmpty()) {
17349      addProcessNote();
17350    }
17351    return getProcessNote().get(0);
17352  }
17353
17354  /**
17355   * @return {@link #benefitPeriod} (The term of the benefits documented in this
17356   *         response.)
17357   */
17358  public Period getBenefitPeriod() {
17359    if (this.benefitPeriod == null)
17360      if (Configuration.errorOnAutoCreate())
17361        throw new Error("Attempt to auto-create ExplanationOfBenefit.benefitPeriod");
17362      else if (Configuration.doAutoCreate())
17363        this.benefitPeriod = new Period(); // cc
17364    return this.benefitPeriod;
17365  }
17366
17367  public boolean hasBenefitPeriod() {
17368    return this.benefitPeriod != null && !this.benefitPeriod.isEmpty();
17369  }
17370
17371  /**
17372   * @param value {@link #benefitPeriod} (The term of the benefits documented in
17373   *              this response.)
17374   */
17375  public ExplanationOfBenefit setBenefitPeriod(Period value) {
17376    this.benefitPeriod = value;
17377    return this;
17378  }
17379
17380  /**
17381   * @return {@link #benefitBalance} (Balance by Benefit Category.)
17382   */
17383  public List<BenefitBalanceComponent> getBenefitBalance() {
17384    if (this.benefitBalance == null)
17385      this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
17386    return this.benefitBalance;
17387  }
17388
17389  /**
17390   * @return Returns a reference to <code>this</code> for easy method chaining
17391   */
17392  public ExplanationOfBenefit setBenefitBalance(List<BenefitBalanceComponent> theBenefitBalance) {
17393    this.benefitBalance = theBenefitBalance;
17394    return this;
17395  }
17396
17397  public boolean hasBenefitBalance() {
17398    if (this.benefitBalance == null)
17399      return false;
17400    for (BenefitBalanceComponent item : this.benefitBalance)
17401      if (!item.isEmpty())
17402        return true;
17403    return false;
17404  }
17405
17406  public BenefitBalanceComponent addBenefitBalance() { // 3
17407    BenefitBalanceComponent t = new BenefitBalanceComponent();
17408    if (this.benefitBalance == null)
17409      this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
17410    this.benefitBalance.add(t);
17411    return t;
17412  }
17413
17414  public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { // 3
17415    if (t == null)
17416      return this;
17417    if (this.benefitBalance == null)
17418      this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
17419    this.benefitBalance.add(t);
17420    return this;
17421  }
17422
17423  /**
17424   * @return The first repetition of repeating field {@link #benefitBalance},
17425   *         creating it if it does not already exist
17426   */
17427  public BenefitBalanceComponent getBenefitBalanceFirstRep() {
17428    if (getBenefitBalance().isEmpty()) {
17429      addBenefitBalance();
17430    }
17431    return getBenefitBalance().get(0);
17432  }
17433
17434  protected void listChildren(List<Property> children) {
17435    super.listChildren(children);
17436    children.add(new Property("identifier", "Identifier",
17437        "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier));
17438    children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
17439    children.add(new Property("type", "CodeableConcept",
17440        "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type));
17441    children.add(new Property("subType", "CodeableConcept",
17442        "A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.",
17443        0, 1, subType));
17444    children.add(new Property("use", "code",
17445        "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.",
17446        0, 1, use));
17447    children.add(new Property("patient", "Reference(Patient)",
17448        "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.",
17449        0, 1, patient));
17450    children.add(new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1,
17451        billablePeriod));
17452    children.add(new Property("created", "dateTime", "The date this resource was created.", 0, 1, created));
17453    children.add(new Property("enterer", "Reference(Practitioner|PractitionerRole)",
17454        "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer));
17455    children.add(new Property("insurer", "Reference(Organization)",
17456        "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer));
17457    children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
17458        "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider));
17459    children.add(new Property("priority", "CodeableConcept",
17460        "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.", 0,
17461        1, priority));
17462    children.add(new Property("fundsReserveRequested", "CodeableConcept",
17463        "A code to indicate whether and for whom funds are to be reserved for future claims.", 0, 1,
17464        fundsReserveRequested));
17465    children.add(new Property("fundsReserve", "CodeableConcept",
17466        "A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.",
17467        0, 1, fundsReserve));
17468    children.add(new Property("related", "",
17469        "Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.",
17470        0, java.lang.Integer.MAX_VALUE, related));
17471    children.add(new Property("prescription", "Reference(MedicationRequest|VisionPrescription)",
17472        "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription));
17473    children.add(new Property("originalPrescription", "Reference(MedicationRequest)",
17474        "Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.",
17475        0, 1, originalPrescription));
17476    children.add(new Property("payee", "",
17477        "The party to be reimbursed for cost of the products and services according to the terms of the policy.", 0, 1,
17478        payee));
17479    children.add(
17480        new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral));
17481    children.add(
17482        new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility));
17483    children.add(new Property("claim", "Reference(Claim)",
17484        "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.",
17485        0, 1, claim));
17486    children.add(new Property("claimResponse", "Reference(ClaimResponse)",
17487        "The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.",
17488        0, 1, claimResponse));
17489    children.add(new Property("outcome", "code",
17490        "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome));
17491    children.add(new Property("disposition", "string",
17492        "A human readable description of the status of the adjudication.", 0, 1, disposition));
17493    children.add(new Property("preAuthRef", "string",
17494        "Reference from the Insurer which is used in later communications which refers to this adjudication.", 0,
17495        java.lang.Integer.MAX_VALUE, preAuthRef));
17496    children.add(new Property("preAuthRefPeriod", "Period",
17497        "The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.",
17498        0, java.lang.Integer.MAX_VALUE, preAuthRefPeriod));
17499    children.add(new Property("careTeam", "", "The members of the team who provided the products and services.", 0,
17500        java.lang.Integer.MAX_VALUE, careTeam));
17501    children.add(new Property("supportingInfo", "",
17502        "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.",
17503        0, java.lang.Integer.MAX_VALUE, supportingInfo));
17504    children.add(new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0,
17505        java.lang.Integer.MAX_VALUE, diagnosis));
17506    children.add(new Property("procedure", "",
17507        "Procedures performed on the patient relevant to the billing items with the claim.", 0,
17508        java.lang.Integer.MAX_VALUE, procedure));
17509    children.add(new Property("precedence", "positiveInt",
17510        "This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.",
17511        0, 1, precedence));
17512    children.add(new Property("insurance", "",
17513        "Financial instruments for reimbursement for the health care products and services specified on the claim.", 0,
17514        java.lang.Integer.MAX_VALUE, insurance));
17515    children.add(new Property("accident", "",
17516        "Details of a accident which resulted in injuries which required the products and services listed in the claim.",
17517        0, 1, accident));
17518    children.add(new Property("item", "",
17519        "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.",
17520        0, java.lang.Integer.MAX_VALUE, item));
17521    children.add(
17522        new Property("addItem", "", "The first-tier service adjudications for payor added product or service lines.", 0,
17523            java.lang.Integer.MAX_VALUE, addItem));
17524    children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
17525        "The adjudication results which are presented at the header level rather than at the line-item or add-item levels.",
17526        0, java.lang.Integer.MAX_VALUE, adjudication));
17527    children.add(new Property("total", "", "Categorized monetary totals for the adjudication.", 0,
17528        java.lang.Integer.MAX_VALUE, total));
17529    children.add(new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment));
17530    children.add(new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.",
17531        0, 1, formCode));
17532    children.add(new Property("form", "Attachment",
17533        "The actual form, by reference or inclusion, for printing the content or an EOB.", 0, 1, form));
17534    children.add(new Property("processNote", "",
17535        "A note that describes or explains adjudication results in a human readable form.", 0,
17536        java.lang.Integer.MAX_VALUE, processNote));
17537    children.add(new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1,
17538        benefitPeriod));
17539    children.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE,
17540        benefitBalance));
17541  }
17542
17543  @Override
17544  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
17545    switch (_hash) {
17546    case -1618432855:
17547      /* identifier */ return new Property("identifier", "Identifier",
17548          "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier);
17549    case -892481550:
17550      /* status */ return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
17551    case 3575610:
17552      /* type */ return new Property("type", "CodeableConcept",
17553          "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type);
17554    case -1868521062:
17555      /* subType */ return new Property("subType", "CodeableConcept",
17556          "A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.",
17557          0, 1, subType);
17558    case 116103:
17559      /* use */ return new Property("use", "code",
17560          "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.",
17561          0, 1, use);
17562    case -791418107:
17563      /* patient */ return new Property("patient", "Reference(Patient)",
17564          "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.",
17565          0, 1, patient);
17566    case -332066046:
17567      /* billablePeriod */ return new Property("billablePeriod", "Period",
17568          "The period for which charges are being submitted.", 0, 1, billablePeriod);
17569    case 1028554472:
17570      /* created */ return new Property("created", "dateTime", "The date this resource was created.", 0, 1, created);
17571    case -1591951995:
17572      /* enterer */ return new Property("enterer", "Reference(Practitioner|PractitionerRole)",
17573          "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer);
17574    case 1957615864:
17575      /* insurer */ return new Property("insurer", "Reference(Organization)",
17576          "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer);
17577    case -987494927:
17578      /* provider */ return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
17579          "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider);
17580    case -1165461084:
17581      /* priority */ return new Property("priority", "CodeableConcept",
17582          "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.", 0,
17583          1, priority);
17584    case -1688904576:
17585      /* fundsReserveRequested */ return new Property("fundsReserveRequested", "CodeableConcept",
17586          "A code to indicate whether and for whom funds are to be reserved for future claims.", 0, 1,
17587          fundsReserveRequested);
17588    case 1314609806:
17589      /* fundsReserve */ return new Property("fundsReserve", "CodeableConcept",
17590          "A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.",
17591          0, 1, fundsReserve);
17592    case 1090493483:
17593      /* related */ return new Property("related", "",
17594          "Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.",
17595          0, java.lang.Integer.MAX_VALUE, related);
17596    case 460301338:
17597      /* prescription */ return new Property("prescription", "Reference(MedicationRequest|VisionPrescription)",
17598          "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription);
17599    case -1814015861:
17600      /* originalPrescription */ return new Property("originalPrescription", "Reference(MedicationRequest)",
17601          "Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.",
17602          0, 1, originalPrescription);
17603    case 106443592:
17604      /* payee */ return new Property("payee", "",
17605          "The party to be reimbursed for cost of the products and services according to the terms of the policy.", 0,
17606          1, payee);
17607    case -722568291:
17608      /* referral */ return new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.",
17609          0, 1, referral);
17610    case 501116579:
17611      /* facility */ return new Property("facility", "Reference(Location)",
17612          "Facility where the services were provided.", 0, 1, facility);
17613    case 94742588:
17614      /* claim */ return new Property("claim", "Reference(Claim)",
17615          "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.",
17616          0, 1, claim);
17617    case 689513629:
17618      /* claimResponse */ return new Property("claimResponse", "Reference(ClaimResponse)",
17619          "The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.",
17620          0, 1, claimResponse);
17621    case -1106507950:
17622      /* outcome */ return new Property("outcome", "code",
17623          "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome);
17624    case 583380919:
17625      /* disposition */ return new Property("disposition", "string",
17626          "A human readable description of the status of the adjudication.", 0, 1, disposition);
17627    case 522246568:
17628      /* preAuthRef */ return new Property("preAuthRef", "string",
17629          "Reference from the Insurer which is used in later communications which refers to this adjudication.", 0,
17630          java.lang.Integer.MAX_VALUE, preAuthRef);
17631    case -1262920311:
17632      /* preAuthRefPeriod */ return new Property("preAuthRefPeriod", "Period",
17633          "The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.",
17634          0, java.lang.Integer.MAX_VALUE, preAuthRefPeriod);
17635    case -7323378:
17636      /* careTeam */ return new Property("careTeam", "",
17637          "The members of the team who provided the products and services.", 0, java.lang.Integer.MAX_VALUE, careTeam);
17638    case 1922406657:
17639      /* supportingInfo */ return new Property("supportingInfo", "",
17640          "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.",
17641          0, java.lang.Integer.MAX_VALUE, supportingInfo);
17642    case 1196993265:
17643      /* diagnosis */ return new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.",
17644          0, java.lang.Integer.MAX_VALUE, diagnosis);
17645    case -1095204141:
17646      /* procedure */ return new Property("procedure", "",
17647          "Procedures performed on the patient relevant to the billing items with the claim.", 0,
17648          java.lang.Integer.MAX_VALUE, procedure);
17649    case 159695370:
17650      /* precedence */ return new Property("precedence", "positiveInt",
17651          "This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.",
17652          0, 1, precedence);
17653    case 73049818:
17654      /* insurance */ return new Property("insurance", "",
17655          "Financial instruments for reimbursement for the health care products and services specified on the claim.",
17656          0, java.lang.Integer.MAX_VALUE, insurance);
17657    case -2143202801:
17658      /* accident */ return new Property("accident", "",
17659          "Details of a accident which resulted in injuries which required the products and services listed in the claim.",
17660          0, 1, accident);
17661    case 3242771:
17662      /* item */ return new Property("item", "",
17663          "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.",
17664          0, java.lang.Integer.MAX_VALUE, item);
17665    case -1148899500:
17666      /* addItem */ return new Property("addItem", "",
17667          "The first-tier service adjudications for payor added product or service lines.", 0,
17668          java.lang.Integer.MAX_VALUE, addItem);
17669    case -231349275:
17670      /* adjudication */ return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
17671          "The adjudication results which are presented at the header level rather than at the line-item or add-item levels.",
17672          0, java.lang.Integer.MAX_VALUE, adjudication);
17673    case 110549828:
17674      /* total */ return new Property("total", "", "Categorized monetary totals for the adjudication.", 0,
17675          java.lang.Integer.MAX_VALUE, total);
17676    case -786681338:
17677      /* payment */ return new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1,
17678          payment);
17679    case 473181393:
17680      /* formCode */ return new Property("formCode", "CodeableConcept",
17681          "A code for the form to be used for printing the content.", 0, 1, formCode);
17682    case 3148996:
17683      /* form */ return new Property("form", "Attachment",
17684          "The actual form, by reference or inclusion, for printing the content or an EOB.", 0, 1, form);
17685    case 202339073:
17686      /* processNote */ return new Property("processNote", "",
17687          "A note that describes or explains adjudication results in a human readable form.", 0,
17688          java.lang.Integer.MAX_VALUE, processNote);
17689    case -407369416:
17690      /* benefitPeriod */ return new Property("benefitPeriod", "Period",
17691          "The term of the benefits documented in this response.", 0, 1, benefitPeriod);
17692    case 596003397:
17693      /* benefitBalance */ return new Property("benefitBalance", "", "Balance by Benefit Category.", 0,
17694          java.lang.Integer.MAX_VALUE, benefitBalance);
17695    default:
17696      return super.getNamedProperty(_hash, _name, _checkValid);
17697    }
17698
17699  }
17700
17701  @Override
17702  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
17703    switch (hash) {
17704    case -1618432855:
17705      /* identifier */ return this.identifier == null ? new Base[0]
17706          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
17707    case -892481550:
17708      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<ExplanationOfBenefitStatus>
17709    case 3575610:
17710      /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
17711    case -1868521062:
17712      /* subType */ return this.subType == null ? new Base[0] : new Base[] { this.subType }; // CodeableConcept
17713    case 116103:
17714      /* use */ return this.use == null ? new Base[0] : new Base[] { this.use }; // Enumeration<Use>
17715    case -791418107:
17716      /* patient */ return this.patient == null ? new Base[0] : new Base[] { this.patient }; // Reference
17717    case -332066046:
17718      /* billablePeriod */ return this.billablePeriod == null ? new Base[0] : new Base[] { this.billablePeriod }; // Period
17719    case 1028554472:
17720      /* created */ return this.created == null ? new Base[0] : new Base[] { this.created }; // DateTimeType
17721    case -1591951995:
17722      /* enterer */ return this.enterer == null ? new Base[0] : new Base[] { this.enterer }; // Reference
17723    case 1957615864:
17724      /* insurer */ return this.insurer == null ? new Base[0] : new Base[] { this.insurer }; // Reference
17725    case -987494927:
17726      /* provider */ return this.provider == null ? new Base[0] : new Base[] { this.provider }; // Reference
17727    case -1165461084:
17728      /* priority */ return this.priority == null ? new Base[0] : new Base[] { this.priority }; // CodeableConcept
17729    case -1688904576:
17730      /* fundsReserveRequested */ return this.fundsReserveRequested == null ? new Base[0]
17731          : new Base[] { this.fundsReserveRequested }; // CodeableConcept
17732    case 1314609806:
17733      /* fundsReserve */ return this.fundsReserve == null ? new Base[0] : new Base[] { this.fundsReserve }; // CodeableConcept
17734    case 1090493483:
17735      /* related */ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimComponent
17736    case 460301338:
17737      /* prescription */ return this.prescription == null ? new Base[0] : new Base[] { this.prescription }; // Reference
17738    case -1814015861:
17739      /* originalPrescription */ return this.originalPrescription == null ? new Base[0]
17740          : new Base[] { this.originalPrescription }; // Reference
17741    case 106443592:
17742      /* payee */ return this.payee == null ? new Base[0] : new Base[] { this.payee }; // PayeeComponent
17743    case -722568291:
17744      /* referral */ return this.referral == null ? new Base[0] : new Base[] { this.referral }; // Reference
17745    case 501116579:
17746      /* facility */ return this.facility == null ? new Base[0] : new Base[] { this.facility }; // Reference
17747    case 94742588:
17748      /* claim */ return this.claim == null ? new Base[0] : new Base[] { this.claim }; // Reference
17749    case 689513629:
17750      /* claimResponse */ return this.claimResponse == null ? new Base[0] : new Base[] { this.claimResponse }; // Reference
17751    case -1106507950:
17752      /* outcome */ return this.outcome == null ? new Base[0] : new Base[] { this.outcome }; // Enumeration<RemittanceOutcome>
17753    case 583380919:
17754      /* disposition */ return this.disposition == null ? new Base[0] : new Base[] { this.disposition }; // StringType
17755    case 522246568:
17756      /* preAuthRef */ return this.preAuthRef == null ? new Base[0]
17757          : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
17758    case -1262920311:
17759      /* preAuthRefPeriod */ return this.preAuthRefPeriod == null ? new Base[0]
17760          : this.preAuthRefPeriod.toArray(new Base[this.preAuthRefPeriod.size()]); // Period
17761    case -7323378:
17762      /* careTeam */ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // CareTeamComponent
17763    case 1922406657:
17764      /* supportingInfo */ return this.supportingInfo == null ? new Base[0]
17765          : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // SupportingInformationComponent
17766    case 1196993265:
17767      /* diagnosis */ return this.diagnosis == null ? new Base[0]
17768          : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
17769    case -1095204141:
17770      /* procedure */ return this.procedure == null ? new Base[0]
17771          : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
17772    case 159695370:
17773      /* precedence */ return this.precedence == null ? new Base[0] : new Base[] { this.precedence }; // PositiveIntType
17774    case 73049818:
17775      /* insurance */ return this.insurance == null ? new Base[0]
17776          : this.insurance.toArray(new Base[this.insurance.size()]); // InsuranceComponent
17777    case -2143202801:
17778      /* accident */ return this.accident == null ? new Base[0] : new Base[] { this.accident }; // AccidentComponent
17779    case 3242771:
17780      /* item */ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
17781    case -1148899500:
17782      /* addItem */ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
17783    case -231349275:
17784      /* adjudication */ return this.adjudication == null ? new Base[0]
17785          : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
17786    case 110549828:
17787      /* total */ return this.total == null ? new Base[0] : this.total.toArray(new Base[this.total.size()]); // TotalComponent
17788    case -786681338:
17789      /* payment */ return this.payment == null ? new Base[0] : new Base[] { this.payment }; // PaymentComponent
17790    case 473181393:
17791      /* formCode */ return this.formCode == null ? new Base[0] : new Base[] { this.formCode }; // CodeableConcept
17792    case 3148996:
17793      /* form */ return this.form == null ? new Base[0] : new Base[] { this.form }; // Attachment
17794    case 202339073:
17795      /* processNote */ return this.processNote == null ? new Base[0]
17796          : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
17797    case -407369416:
17798      /* benefitPeriod */ return this.benefitPeriod == null ? new Base[0] : new Base[] { this.benefitPeriod }; // Period
17799    case 596003397:
17800      /* benefitBalance */ return this.benefitBalance == null ? new Base[0]
17801          : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
17802    default:
17803      return super.getProperty(hash, name, checkValid);
17804    }
17805
17806  }
17807
17808  @Override
17809  public Base setProperty(int hash, String name, Base value) throws FHIRException {
17810    switch (hash) {
17811    case -1618432855: // identifier
17812      this.getIdentifier().add(castToIdentifier(value)); // Identifier
17813      return value;
17814    case -892481550: // status
17815      value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
17816      this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
17817      return value;
17818    case 3575610: // type
17819      this.type = castToCodeableConcept(value); // CodeableConcept
17820      return value;
17821    case -1868521062: // subType
17822      this.subType = castToCodeableConcept(value); // CodeableConcept
17823      return value;
17824    case 116103: // use
17825      value = new UseEnumFactory().fromType(castToCode(value));
17826      this.use = (Enumeration) value; // Enumeration<Use>
17827      return value;
17828    case -791418107: // patient
17829      this.patient = castToReference(value); // Reference
17830      return value;
17831    case -332066046: // billablePeriod
17832      this.billablePeriod = castToPeriod(value); // Period
17833      return value;
17834    case 1028554472: // created
17835      this.created = castToDateTime(value); // DateTimeType
17836      return value;
17837    case -1591951995: // enterer
17838      this.enterer = castToReference(value); // Reference
17839      return value;
17840    case 1957615864: // insurer
17841      this.insurer = castToReference(value); // Reference
17842      return value;
17843    case -987494927: // provider
17844      this.provider = castToReference(value); // Reference
17845      return value;
17846    case -1165461084: // priority
17847      this.priority = castToCodeableConcept(value); // CodeableConcept
17848      return value;
17849    case -1688904576: // fundsReserveRequested
17850      this.fundsReserveRequested = castToCodeableConcept(value); // CodeableConcept
17851      return value;
17852    case 1314609806: // fundsReserve
17853      this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
17854      return value;
17855    case 1090493483: // related
17856      this.getRelated().add((RelatedClaimComponent) value); // RelatedClaimComponent
17857      return value;
17858    case 460301338: // prescription
17859      this.prescription = castToReference(value); // Reference
17860      return value;
17861    case -1814015861: // originalPrescription
17862      this.originalPrescription = castToReference(value); // Reference
17863      return value;
17864    case 106443592: // payee
17865      this.payee = (PayeeComponent) value; // PayeeComponent
17866      return value;
17867    case -722568291: // referral
17868      this.referral = castToReference(value); // Reference
17869      return value;
17870    case 501116579: // facility
17871      this.facility = castToReference(value); // Reference
17872      return value;
17873    case 94742588: // claim
17874      this.claim = castToReference(value); // Reference
17875      return value;
17876    case 689513629: // claimResponse
17877      this.claimResponse = castToReference(value); // Reference
17878      return value;
17879    case -1106507950: // outcome
17880      value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
17881      this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
17882      return value;
17883    case 583380919: // disposition
17884      this.disposition = castToString(value); // StringType
17885      return value;
17886    case 522246568: // preAuthRef
17887      this.getPreAuthRef().add(castToString(value)); // StringType
17888      return value;
17889    case -1262920311: // preAuthRefPeriod
17890      this.getPreAuthRefPeriod().add(castToPeriod(value)); // Period
17891      return value;
17892    case -7323378: // careTeam
17893      this.getCareTeam().add((CareTeamComponent) value); // CareTeamComponent
17894      return value;
17895    case 1922406657: // supportingInfo
17896      this.getSupportingInfo().add((SupportingInformationComponent) value); // SupportingInformationComponent
17897      return value;
17898    case 1196993265: // diagnosis
17899      this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
17900      return value;
17901    case -1095204141: // procedure
17902      this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
17903      return value;
17904    case 159695370: // precedence
17905      this.precedence = castToPositiveInt(value); // PositiveIntType
17906      return value;
17907    case 73049818: // insurance
17908      this.getInsurance().add((InsuranceComponent) value); // InsuranceComponent
17909      return value;
17910    case -2143202801: // accident
17911      this.accident = (AccidentComponent) value; // AccidentComponent
17912      return value;
17913    case 3242771: // item
17914      this.getItem().add((ItemComponent) value); // ItemComponent
17915      return value;
17916    case -1148899500: // addItem
17917      this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
17918      return value;
17919    case -231349275: // adjudication
17920      this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
17921      return value;
17922    case 110549828: // total
17923      this.getTotal().add((TotalComponent) value); // TotalComponent
17924      return value;
17925    case -786681338: // payment
17926      this.payment = (PaymentComponent) value; // PaymentComponent
17927      return value;
17928    case 473181393: // formCode
17929      this.formCode = castToCodeableConcept(value); // CodeableConcept
17930      return value;
17931    case 3148996: // form
17932      this.form = castToAttachment(value); // Attachment
17933      return value;
17934    case 202339073: // processNote
17935      this.getProcessNote().add((NoteComponent) value); // NoteComponent
17936      return value;
17937    case -407369416: // benefitPeriod
17938      this.benefitPeriod = castToPeriod(value); // Period
17939      return value;
17940    case 596003397: // benefitBalance
17941      this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
17942      return value;
17943    default:
17944      return super.setProperty(hash, name, value);
17945    }
17946
17947  }
17948
17949  @Override
17950  public Base setProperty(String name, Base value) throws FHIRException {
17951    if (name.equals("identifier")) {
17952      this.getIdentifier().add(castToIdentifier(value));
17953    } else if (name.equals("status")) {
17954      value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
17955      this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
17956    } else if (name.equals("type")) {
17957      this.type = castToCodeableConcept(value); // CodeableConcept
17958    } else if (name.equals("subType")) {
17959      this.subType = castToCodeableConcept(value); // CodeableConcept
17960    } else if (name.equals("use")) {
17961      value = new UseEnumFactory().fromType(castToCode(value));
17962      this.use = (Enumeration) value; // Enumeration<Use>
17963    } else if (name.equals("patient")) {
17964      this.patient = castToReference(value); // Reference
17965    } else if (name.equals("billablePeriod")) {
17966      this.billablePeriod = castToPeriod(value); // Period
17967    } else if (name.equals("created")) {
17968      this.created = castToDateTime(value); // DateTimeType
17969    } else if (name.equals("enterer")) {
17970      this.enterer = castToReference(value); // Reference
17971    } else if (name.equals("insurer")) {
17972      this.insurer = castToReference(value); // Reference
17973    } else if (name.equals("provider")) {
17974      this.provider = castToReference(value); // Reference
17975    } else if (name.equals("priority")) {
17976      this.priority = castToCodeableConcept(value); // CodeableConcept
17977    } else if (name.equals("fundsReserveRequested")) {
17978      this.fundsReserveRequested = castToCodeableConcept(value); // CodeableConcept
17979    } else if (name.equals("fundsReserve")) {
17980      this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
17981    } else if (name.equals("related")) {
17982      this.getRelated().add((RelatedClaimComponent) value);
17983    } else if (name.equals("prescription")) {
17984      this.prescription = castToReference(value); // Reference
17985    } else if (name.equals("originalPrescription")) {
17986      this.originalPrescription = castToReference(value); // Reference
17987    } else if (name.equals("payee")) {
17988      this.payee = (PayeeComponent) value; // PayeeComponent
17989    } else if (name.equals("referral")) {
17990      this.referral = castToReference(value); // Reference
17991    } else if (name.equals("facility")) {
17992      this.facility = castToReference(value); // Reference
17993    } else if (name.equals("claim")) {
17994      this.claim = castToReference(value); // Reference
17995    } else if (name.equals("claimResponse")) {
17996      this.claimResponse = castToReference(value); // Reference
17997    } else if (name.equals("outcome")) {
17998      value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
17999      this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
18000    } else if (name.equals("disposition")) {
18001      this.disposition = castToString(value); // StringType
18002    } else if (name.equals("preAuthRef")) {
18003      this.getPreAuthRef().add(castToString(value));
18004    } else if (name.equals("preAuthRefPeriod")) {
18005      this.getPreAuthRefPeriod().add(castToPeriod(value));
18006    } else if (name.equals("careTeam")) {
18007      this.getCareTeam().add((CareTeamComponent) value);
18008    } else if (name.equals("supportingInfo")) {
18009      this.getSupportingInfo().add((SupportingInformationComponent) value);
18010    } else if (name.equals("diagnosis")) {
18011      this.getDiagnosis().add((DiagnosisComponent) value);
18012    } else if (name.equals("procedure")) {
18013      this.getProcedure().add((ProcedureComponent) value);
18014    } else if (name.equals("precedence")) {
18015      this.precedence = castToPositiveInt(value); // PositiveIntType
18016    } else if (name.equals("insurance")) {
18017      this.getInsurance().add((InsuranceComponent) value);
18018    } else if (name.equals("accident")) {
18019      this.accident = (AccidentComponent) value; // AccidentComponent
18020    } else if (name.equals("item")) {
18021      this.getItem().add((ItemComponent) value);
18022    } else if (name.equals("addItem")) {
18023      this.getAddItem().add((AddedItemComponent) value);
18024    } else if (name.equals("adjudication")) {
18025      this.getAdjudication().add((AdjudicationComponent) value);
18026    } else if (name.equals("total")) {
18027      this.getTotal().add((TotalComponent) value);
18028    } else if (name.equals("payment")) {
18029      this.payment = (PaymentComponent) value; // PaymentComponent
18030    } else if (name.equals("formCode")) {
18031      this.formCode = castToCodeableConcept(value); // CodeableConcept
18032    } else if (name.equals("form")) {
18033      this.form = castToAttachment(value); // Attachment
18034    } else if (name.equals("processNote")) {
18035      this.getProcessNote().add((NoteComponent) value);
18036    } else if (name.equals("benefitPeriod")) {
18037      this.benefitPeriod = castToPeriod(value); // Period
18038    } else if (name.equals("benefitBalance")) {
18039      this.getBenefitBalance().add((BenefitBalanceComponent) value);
18040    } else
18041      return super.setProperty(name, value);
18042    return value;
18043  }
18044
18045  @Override
18046  public void removeChild(String name, Base value) throws FHIRException {
18047    if (name.equals("identifier")) {
18048      this.getIdentifier().remove(castToIdentifier(value));
18049    } else if (name.equals("status")) {
18050      this.status = null;
18051    } else if (name.equals("type")) {
18052      this.type = null;
18053    } else if (name.equals("subType")) {
18054      this.subType = null;
18055    } else if (name.equals("use")) {
18056      this.use = null;
18057    } else if (name.equals("patient")) {
18058      this.patient = null;
18059    } else if (name.equals("billablePeriod")) {
18060      this.billablePeriod = null;
18061    } else if (name.equals("created")) {
18062      this.created = null;
18063    } else if (name.equals("enterer")) {
18064      this.enterer = null;
18065    } else if (name.equals("insurer")) {
18066      this.insurer = null;
18067    } else if (name.equals("provider")) {
18068      this.provider = null;
18069    } else if (name.equals("priority")) {
18070      this.priority = null;
18071    } else if (name.equals("fundsReserveRequested")) {
18072      this.fundsReserveRequested = null;
18073    } else if (name.equals("fundsReserve")) {
18074      this.fundsReserve = null;
18075    } else if (name.equals("related")) {
18076      this.getRelated().remove((RelatedClaimComponent) value);
18077    } else if (name.equals("prescription")) {
18078      this.prescription = null;
18079    } else if (name.equals("originalPrescription")) {
18080      this.originalPrescription = null;
18081    } else if (name.equals("payee")) {
18082      this.payee = (PayeeComponent) value; // PayeeComponent
18083    } else if (name.equals("referral")) {
18084      this.referral = null;
18085    } else if (name.equals("facility")) {
18086      this.facility = null;
18087    } else if (name.equals("claim")) {
18088      this.claim = null;
18089    } else if (name.equals("claimResponse")) {
18090      this.claimResponse = null;
18091    } else if (name.equals("outcome")) {
18092      this.outcome = null;
18093    } else if (name.equals("disposition")) {
18094      this.disposition = null;
18095    } else if (name.equals("preAuthRef")) {
18096      this.getPreAuthRef().remove(castToString(value));
18097    } else if (name.equals("preAuthRefPeriod")) {
18098      this.getPreAuthRefPeriod().remove(castToPeriod(value));
18099    } else if (name.equals("careTeam")) {
18100      this.getCareTeam().remove((CareTeamComponent) value);
18101    } else if (name.equals("supportingInfo")) {
18102      this.getSupportingInfo().remove((SupportingInformationComponent) value);
18103    } else if (name.equals("diagnosis")) {
18104      this.getDiagnosis().remove((DiagnosisComponent) value);
18105    } else if (name.equals("procedure")) {
18106      this.getProcedure().remove((ProcedureComponent) value);
18107    } else if (name.equals("precedence")) {
18108      this.precedence = null;
18109    } else if (name.equals("insurance")) {
18110      this.getInsurance().remove((InsuranceComponent) value);
18111    } else if (name.equals("accident")) {
18112      this.accident = (AccidentComponent) value; // AccidentComponent
18113    } else if (name.equals("item")) {
18114      this.getItem().remove((ItemComponent) value);
18115    } else if (name.equals("addItem")) {
18116      this.getAddItem().remove((AddedItemComponent) value);
18117    } else if (name.equals("adjudication")) {
18118      this.getAdjudication().remove((AdjudicationComponent) value);
18119    } else if (name.equals("total")) {
18120      this.getTotal().remove((TotalComponent) value);
18121    } else if (name.equals("payment")) {
18122      this.payment = (PaymentComponent) value; // PaymentComponent
18123    } else if (name.equals("formCode")) {
18124      this.formCode = null;
18125    } else if (name.equals("form")) {
18126      this.form = null;
18127    } else if (name.equals("processNote")) {
18128      this.getProcessNote().remove((NoteComponent) value);
18129    } else if (name.equals("benefitPeriod")) {
18130      this.benefitPeriod = null;
18131    } else if (name.equals("benefitBalance")) {
18132      this.getBenefitBalance().remove((BenefitBalanceComponent) value);
18133    } else
18134      super.removeChild(name, value);
18135    
18136  }
18137
18138  @Override
18139  public Base makeProperty(int hash, String name) throws FHIRException {
18140    switch (hash) {
18141    case -1618432855:
18142      return addIdentifier();
18143    case -892481550:
18144      return getStatusElement();
18145    case 3575610:
18146      return getType();
18147    case -1868521062:
18148      return getSubType();
18149    case 116103:
18150      return getUseElement();
18151    case -791418107:
18152      return getPatient();
18153    case -332066046:
18154      return getBillablePeriod();
18155    case 1028554472:
18156      return getCreatedElement();
18157    case -1591951995:
18158      return getEnterer();
18159    case 1957615864:
18160      return getInsurer();
18161    case -987494927:
18162      return getProvider();
18163    case -1165461084:
18164      return getPriority();
18165    case -1688904576:
18166      return getFundsReserveRequested();
18167    case 1314609806:
18168      return getFundsReserve();
18169    case 1090493483:
18170      return addRelated();
18171    case 460301338:
18172      return getPrescription();
18173    case -1814015861:
18174      return getOriginalPrescription();
18175    case 106443592:
18176      return getPayee();
18177    case -722568291:
18178      return getReferral();
18179    case 501116579:
18180      return getFacility();
18181    case 94742588:
18182      return getClaim();
18183    case 689513629:
18184      return getClaimResponse();
18185    case -1106507950:
18186      return getOutcomeElement();
18187    case 583380919:
18188      return getDispositionElement();
18189    case 522246568:
18190      return addPreAuthRefElement();
18191    case -1262920311:
18192      return addPreAuthRefPeriod();
18193    case -7323378:
18194      return addCareTeam();
18195    case 1922406657:
18196      return addSupportingInfo();
18197    case 1196993265:
18198      return addDiagnosis();
18199    case -1095204141:
18200      return addProcedure();
18201    case 159695370:
18202      return getPrecedenceElement();
18203    case 73049818:
18204      return addInsurance();
18205    case -2143202801:
18206      return getAccident();
18207    case 3242771:
18208      return addItem();
18209    case -1148899500:
18210      return addAddItem();
18211    case -231349275:
18212      return addAdjudication();
18213    case 110549828:
18214      return addTotal();
18215    case -786681338:
18216      return getPayment();
18217    case 473181393:
18218      return getFormCode();
18219    case 3148996:
18220      return getForm();
18221    case 202339073:
18222      return addProcessNote();
18223    case -407369416:
18224      return getBenefitPeriod();
18225    case 596003397:
18226      return addBenefitBalance();
18227    default:
18228      return super.makeProperty(hash, name);
18229    }
18230
18231  }
18232
18233  @Override
18234  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
18235    switch (hash) {
18236    case -1618432855:
18237      /* identifier */ return new String[] { "Identifier" };
18238    case -892481550:
18239      /* status */ return new String[] { "code" };
18240    case 3575610:
18241      /* type */ return new String[] { "CodeableConcept" };
18242    case -1868521062:
18243      /* subType */ return new String[] { "CodeableConcept" };
18244    case 116103:
18245      /* use */ return new String[] { "code" };
18246    case -791418107:
18247      /* patient */ return new String[] { "Reference" };
18248    case -332066046:
18249      /* billablePeriod */ return new String[] { "Period" };
18250    case 1028554472:
18251      /* created */ return new String[] { "dateTime" };
18252    case -1591951995:
18253      /* enterer */ return new String[] { "Reference" };
18254    case 1957615864:
18255      /* insurer */ return new String[] { "Reference" };
18256    case -987494927:
18257      /* provider */ return new String[] { "Reference" };
18258    case -1165461084:
18259      /* priority */ return new String[] { "CodeableConcept" };
18260    case -1688904576:
18261      /* fundsReserveRequested */ return new String[] { "CodeableConcept" };
18262    case 1314609806:
18263      /* fundsReserve */ return new String[] { "CodeableConcept" };
18264    case 1090493483:
18265      /* related */ return new String[] {};
18266    case 460301338:
18267      /* prescription */ return new String[] { "Reference" };
18268    case -1814015861:
18269      /* originalPrescription */ return new String[] { "Reference" };
18270    case 106443592:
18271      /* payee */ return new String[] {};
18272    case -722568291:
18273      /* referral */ return new String[] { "Reference" };
18274    case 501116579:
18275      /* facility */ return new String[] { "Reference" };
18276    case 94742588:
18277      /* claim */ return new String[] { "Reference" };
18278    case 689513629:
18279      /* claimResponse */ return new String[] { "Reference" };
18280    case -1106507950:
18281      /* outcome */ return new String[] { "code" };
18282    case 583380919:
18283      /* disposition */ return new String[] { "string" };
18284    case 522246568:
18285      /* preAuthRef */ return new String[] { "string" };
18286    case -1262920311:
18287      /* preAuthRefPeriod */ return new String[] { "Period" };
18288    case -7323378:
18289      /* careTeam */ return new String[] {};
18290    case 1922406657:
18291      /* supportingInfo */ return new String[] {};
18292    case 1196993265:
18293      /* diagnosis */ return new String[] {};
18294    case -1095204141:
18295      /* procedure */ return new String[] {};
18296    case 159695370:
18297      /* precedence */ return new String[] { "positiveInt" };
18298    case 73049818:
18299      /* insurance */ return new String[] {};
18300    case -2143202801:
18301      /* accident */ return new String[] {};
18302    case 3242771:
18303      /* item */ return new String[] {};
18304    case -1148899500:
18305      /* addItem */ return new String[] {};
18306    case -231349275:
18307      /* adjudication */ return new String[] { "@ExplanationOfBenefit.item.adjudication" };
18308    case 110549828:
18309      /* total */ return new String[] {};
18310    case -786681338:
18311      /* payment */ return new String[] {};
18312    case 473181393:
18313      /* formCode */ return new String[] { "CodeableConcept" };
18314    case 3148996:
18315      /* form */ return new String[] { "Attachment" };
18316    case 202339073:
18317      /* processNote */ return new String[] {};
18318    case -407369416:
18319      /* benefitPeriod */ return new String[] { "Period" };
18320    case 596003397:
18321      /* benefitBalance */ return new String[] {};
18322    default:
18323      return super.getTypesForProperty(hash, name);
18324    }
18325
18326  }
18327
18328  @Override
18329  public Base addChild(String name) throws FHIRException {
18330    if (name.equals("identifier")) {
18331      return addIdentifier();
18332    } else if (name.equals("status")) {
18333      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.status");
18334    } else if (name.equals("type")) {
18335      this.type = new CodeableConcept();
18336      return this.type;
18337    } else if (name.equals("subType")) {
18338      this.subType = new CodeableConcept();
18339      return this.subType;
18340    } else if (name.equals("use")) {
18341      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.use");
18342    } else if (name.equals("patient")) {
18343      this.patient = new Reference();
18344      return this.patient;
18345    } else if (name.equals("billablePeriod")) {
18346      this.billablePeriod = new Period();
18347      return this.billablePeriod;
18348    } else if (name.equals("created")) {
18349      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.created");
18350    } else if (name.equals("enterer")) {
18351      this.enterer = new Reference();
18352      return this.enterer;
18353    } else if (name.equals("insurer")) {
18354      this.insurer = new Reference();
18355      return this.insurer;
18356    } else if (name.equals("provider")) {
18357      this.provider = new Reference();
18358      return this.provider;
18359    } else if (name.equals("priority")) {
18360      this.priority = new CodeableConcept();
18361      return this.priority;
18362    } else if (name.equals("fundsReserveRequested")) {
18363      this.fundsReserveRequested = new CodeableConcept();
18364      return this.fundsReserveRequested;
18365    } else if (name.equals("fundsReserve")) {
18366      this.fundsReserve = new CodeableConcept();
18367      return this.fundsReserve;
18368    } else if (name.equals("related")) {
18369      return addRelated();
18370    } else if (name.equals("prescription")) {
18371      this.prescription = new Reference();
18372      return this.prescription;
18373    } else if (name.equals("originalPrescription")) {
18374      this.originalPrescription = new Reference();
18375      return this.originalPrescription;
18376    } else if (name.equals("payee")) {
18377      this.payee = new PayeeComponent();
18378      return this.payee;
18379    } else if (name.equals("referral")) {
18380      this.referral = new Reference();
18381      return this.referral;
18382    } else if (name.equals("facility")) {
18383      this.facility = new Reference();
18384      return this.facility;
18385    } else if (name.equals("claim")) {
18386      this.claim = new Reference();
18387      return this.claim;
18388    } else if (name.equals("claimResponse")) {
18389      this.claimResponse = new Reference();
18390      return this.claimResponse;
18391    } else if (name.equals("outcome")) {
18392      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.outcome");
18393    } else if (name.equals("disposition")) {
18394      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.disposition");
18395    } else if (name.equals("preAuthRef")) {
18396      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.preAuthRef");
18397    } else if (name.equals("preAuthRefPeriod")) {
18398      return addPreAuthRefPeriod();
18399    } else if (name.equals("careTeam")) {
18400      return addCareTeam();
18401    } else if (name.equals("supportingInfo")) {
18402      return addSupportingInfo();
18403    } else if (name.equals("diagnosis")) {
18404      return addDiagnosis();
18405    } else if (name.equals("procedure")) {
18406      return addProcedure();
18407    } else if (name.equals("precedence")) {
18408      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.precedence");
18409    } else if (name.equals("insurance")) {
18410      return addInsurance();
18411    } else if (name.equals("accident")) {
18412      this.accident = new AccidentComponent();
18413      return this.accident;
18414    } else if (name.equals("item")) {
18415      return addItem();
18416    } else if (name.equals("addItem")) {
18417      return addAddItem();
18418    } else if (name.equals("adjudication")) {
18419      return addAdjudication();
18420    } else if (name.equals("total")) {
18421      return addTotal();
18422    } else if (name.equals("payment")) {
18423      this.payment = new PaymentComponent();
18424      return this.payment;
18425    } else if (name.equals("formCode")) {
18426      this.formCode = new CodeableConcept();
18427      return this.formCode;
18428    } else if (name.equals("form")) {
18429      this.form = new Attachment();
18430      return this.form;
18431    } else if (name.equals("processNote")) {
18432      return addProcessNote();
18433    } else if (name.equals("benefitPeriod")) {
18434      this.benefitPeriod = new Period();
18435      return this.benefitPeriod;
18436    } else if (name.equals("benefitBalance")) {
18437      return addBenefitBalance();
18438    } else
18439      return super.addChild(name);
18440  }
18441
18442  public String fhirType() {
18443    return "ExplanationOfBenefit";
18444
18445  }
18446
18447  public ExplanationOfBenefit copy() {
18448    ExplanationOfBenefit dst = new ExplanationOfBenefit();
18449    copyValues(dst);
18450    return dst;
18451  }
18452
18453  public void copyValues(ExplanationOfBenefit dst) {
18454    super.copyValues(dst);
18455    if (identifier != null) {
18456      dst.identifier = new ArrayList<Identifier>();
18457      for (Identifier i : identifier)
18458        dst.identifier.add(i.copy());
18459    }
18460    ;
18461    dst.status = status == null ? null : status.copy();
18462    dst.type = type == null ? null : type.copy();
18463    dst.subType = subType == null ? null : subType.copy();
18464    dst.use = use == null ? null : use.copy();
18465    dst.patient = patient == null ? null : patient.copy();
18466    dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
18467    dst.created = created == null ? null : created.copy();
18468    dst.enterer = enterer == null ? null : enterer.copy();
18469    dst.insurer = insurer == null ? null : insurer.copy();
18470    dst.provider = provider == null ? null : provider.copy();
18471    dst.priority = priority == null ? null : priority.copy();
18472    dst.fundsReserveRequested = fundsReserveRequested == null ? null : fundsReserveRequested.copy();
18473    dst.fundsReserve = fundsReserve == null ? null : fundsReserve.copy();
18474    if (related != null) {
18475      dst.related = new ArrayList<RelatedClaimComponent>();
18476      for (RelatedClaimComponent i : related)
18477        dst.related.add(i.copy());
18478    }
18479    ;
18480    dst.prescription = prescription == null ? null : prescription.copy();
18481    dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
18482    dst.payee = payee == null ? null : payee.copy();
18483    dst.referral = referral == null ? null : referral.copy();
18484    dst.facility = facility == null ? null : facility.copy();
18485    dst.claim = claim == null ? null : claim.copy();
18486    dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
18487    dst.outcome = outcome == null ? null : outcome.copy();
18488    dst.disposition = disposition == null ? null : disposition.copy();
18489    if (preAuthRef != null) {
18490      dst.preAuthRef = new ArrayList<StringType>();
18491      for (StringType i : preAuthRef)
18492        dst.preAuthRef.add(i.copy());
18493    }
18494    ;
18495    if (preAuthRefPeriod != null) {
18496      dst.preAuthRefPeriod = new ArrayList<Period>();
18497      for (Period i : preAuthRefPeriod)
18498        dst.preAuthRefPeriod.add(i.copy());
18499    }
18500    ;
18501    if (careTeam != null) {
18502      dst.careTeam = new ArrayList<CareTeamComponent>();
18503      for (CareTeamComponent i : careTeam)
18504        dst.careTeam.add(i.copy());
18505    }
18506    ;
18507    if (supportingInfo != null) {
18508      dst.supportingInfo = new ArrayList<SupportingInformationComponent>();
18509      for (SupportingInformationComponent i : supportingInfo)
18510        dst.supportingInfo.add(i.copy());
18511    }
18512    ;
18513    if (diagnosis != null) {
18514      dst.diagnosis = new ArrayList<DiagnosisComponent>();
18515      for (DiagnosisComponent i : diagnosis)
18516        dst.diagnosis.add(i.copy());
18517    }
18518    ;
18519    if (procedure != null) {
18520      dst.procedure = new ArrayList<ProcedureComponent>();
18521      for (ProcedureComponent i : procedure)
18522        dst.procedure.add(i.copy());
18523    }
18524    ;
18525    dst.precedence = precedence == null ? null : precedence.copy();
18526    if (insurance != null) {
18527      dst.insurance = new ArrayList<InsuranceComponent>();
18528      for (InsuranceComponent i : insurance)
18529        dst.insurance.add(i.copy());
18530    }
18531    ;
18532    dst.accident = accident == null ? null : accident.copy();
18533    if (item != null) {
18534      dst.item = new ArrayList<ItemComponent>();
18535      for (ItemComponent i : item)
18536        dst.item.add(i.copy());
18537    }
18538    ;
18539    if (addItem != null) {
18540      dst.addItem = new ArrayList<AddedItemComponent>();
18541      for (AddedItemComponent i : addItem)
18542        dst.addItem.add(i.copy());
18543    }
18544    ;
18545    if (adjudication != null) {
18546      dst.adjudication = new ArrayList<AdjudicationComponent>();
18547      for (AdjudicationComponent i : adjudication)
18548        dst.adjudication.add(i.copy());
18549    }
18550    ;
18551    if (total != null) {
18552      dst.total = new ArrayList<TotalComponent>();
18553      for (TotalComponent i : total)
18554        dst.total.add(i.copy());
18555    }
18556    ;
18557    dst.payment = payment == null ? null : payment.copy();
18558    dst.formCode = formCode == null ? null : formCode.copy();
18559    dst.form = form == null ? null : form.copy();
18560    if (processNote != null) {
18561      dst.processNote = new ArrayList<NoteComponent>();
18562      for (NoteComponent i : processNote)
18563        dst.processNote.add(i.copy());
18564    }
18565    ;
18566    dst.benefitPeriod = benefitPeriod == null ? null : benefitPeriod.copy();
18567    if (benefitBalance != null) {
18568      dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
18569      for (BenefitBalanceComponent i : benefitBalance)
18570        dst.benefitBalance.add(i.copy());
18571    }
18572    ;
18573  }
18574
18575  protected ExplanationOfBenefit typedCopy() {
18576    return copy();
18577  }
18578
18579  @Override
18580  public boolean equalsDeep(Base other_) {
18581    if (!super.equalsDeep(other_))
18582      return false;
18583    if (!(other_ instanceof ExplanationOfBenefit))
18584      return false;
18585    ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
18586    return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true)
18587        && compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true) && compareDeep(use, o.use, true)
18588        && compareDeep(patient, o.patient, true) && compareDeep(billablePeriod, o.billablePeriod, true)
18589        && compareDeep(created, o.created, true) && compareDeep(enterer, o.enterer, true)
18590        && compareDeep(insurer, o.insurer, true) && compareDeep(provider, o.provider, true)
18591        && compareDeep(priority, o.priority, true) && compareDeep(fundsReserveRequested, o.fundsReserveRequested, true)
18592        && compareDeep(fundsReserve, o.fundsReserve, true) && compareDeep(related, o.related, true)
18593        && compareDeep(prescription, o.prescription, true)
18594        && compareDeep(originalPrescription, o.originalPrescription, true) && compareDeep(payee, o.payee, true)
18595        && compareDeep(referral, o.referral, true) && compareDeep(facility, o.facility, true)
18596        && compareDeep(claim, o.claim, true) && compareDeep(claimResponse, o.claimResponse, true)
18597        && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true)
18598        && compareDeep(preAuthRef, o.preAuthRef, true) && compareDeep(preAuthRefPeriod, o.preAuthRefPeriod, true)
18599        && compareDeep(careTeam, o.careTeam, true) && compareDeep(supportingInfo, o.supportingInfo, true)
18600        && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true)
18601        && compareDeep(precedence, o.precedence, true) && compareDeep(insurance, o.insurance, true)
18602        && compareDeep(accident, o.accident, true) && compareDeep(item, o.item, true)
18603        && compareDeep(addItem, o.addItem, true) && compareDeep(adjudication, o.adjudication, true)
18604        && compareDeep(total, o.total, true) && compareDeep(payment, o.payment, true)
18605        && compareDeep(formCode, o.formCode, true) && compareDeep(form, o.form, true)
18606        && compareDeep(processNote, o.processNote, true) && compareDeep(benefitPeriod, o.benefitPeriod, true)
18607        && compareDeep(benefitBalance, o.benefitBalance, true);
18608  }
18609
18610  @Override
18611  public boolean equalsShallow(Base other_) {
18612    if (!super.equalsShallow(other_))
18613      return false;
18614    if (!(other_ instanceof ExplanationOfBenefit))
18615      return false;
18616    ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
18617    return compareValues(status, o.status, true) && compareValues(use, o.use, true)
18618        && compareValues(created, o.created, true) && compareValues(outcome, o.outcome, true)
18619        && compareValues(disposition, o.disposition, true) && compareValues(preAuthRef, o.preAuthRef, true)
18620        && compareValues(precedence, o.precedence, true);
18621  }
18622
18623  public boolean isEmpty() {
18624    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type, subType, use, patient,
18625        billablePeriod, created, enterer, insurer, provider, priority, fundsReserveRequested, fundsReserve, related,
18626        prescription, originalPrescription, payee, referral, facility, claim, claimResponse, outcome, disposition,
18627        preAuthRef, preAuthRefPeriod, careTeam, supportingInfo, diagnosis, procedure, precedence, insurance, accident,
18628        item, addItem, adjudication, total, payment, formCode, form, processNote, benefitPeriod, benefitBalance);
18629  }
18630
18631  @Override
18632  public ResourceType getResourceType() {
18633    return ResourceType.ExplanationOfBenefit;
18634  }
18635
18636  /**
18637   * Search parameter: <b>coverage</b>
18638   * <p>
18639   * Description: <b>The plan under which the claim was adjudicated</b><br>
18640   * Type: <b>reference</b><br>
18641   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
18642   * </p>
18643   */
18644  @SearchParamDefinition(name = "coverage", path = "ExplanationOfBenefit.insurance.coverage", description = "The plan under which the claim was adjudicated", type = "reference", target = {
18645      Coverage.class })
18646  public static final String SP_COVERAGE = "coverage";
18647  /**
18648   * <b>Fluent Client</b> search parameter constant for <b>coverage</b>
18649   * <p>
18650   * Description: <b>The plan under which the claim was adjudicated</b><br>
18651   * Type: <b>reference</b><br>
18652   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
18653   * </p>
18654   */
18655  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18656      SP_COVERAGE);
18657
18658  /**
18659   * Constant for fluent queries to be used to add include statements. Specifies
18660   * the path value of "<b>ExplanationOfBenefit:coverage</b>".
18661   */
18662  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE = new ca.uhn.fhir.model.api.Include(
18663      "ExplanationOfBenefit:coverage").toLocked();
18664
18665  /**
18666   * Search parameter: <b>care-team</b>
18667   * <p>
18668   * Description: <b>Member of the CareTeam</b><br>
18669   * Type: <b>reference</b><br>
18670   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
18671   * </p>
18672   */
18673  @SearchParamDefinition(name = "care-team", path = "ExplanationOfBenefit.careTeam.provider", description = "Member of the CareTeam", type = "reference", providesMembershipIn = {
18674      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Organization.class,
18675          Practitioner.class, PractitionerRole.class })
18676  public static final String SP_CARE_TEAM = "care-team";
18677  /**
18678   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
18679   * <p>
18680   * Description: <b>Member of the CareTeam</b><br>
18681   * Type: <b>reference</b><br>
18682   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
18683   * </p>
18684   */
18685  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18686      SP_CARE_TEAM);
18687
18688  /**
18689   * Constant for fluent queries to be used to add include statements. Specifies
18690   * the path value of "<b>ExplanationOfBenefit:care-team</b>".
18691   */
18692  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include(
18693      "ExplanationOfBenefit:care-team").toLocked();
18694
18695  /**
18696   * Search parameter: <b>identifier</b>
18697   * <p>
18698   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
18699   * Type: <b>token</b><br>
18700   * Path: <b>ExplanationOfBenefit.identifier</b><br>
18701   * </p>
18702   */
18703  @SearchParamDefinition(name = "identifier", path = "ExplanationOfBenefit.identifier", description = "The business identifier of the Explanation of Benefit", type = "token")
18704  public static final String SP_IDENTIFIER = "identifier";
18705  /**
18706   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
18707   * <p>
18708   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
18709   * Type: <b>token</b><br>
18710   * Path: <b>ExplanationOfBenefit.identifier</b><br>
18711   * </p>
18712   */
18713  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
18714      SP_IDENTIFIER);
18715
18716  /**
18717   * Search parameter: <b>created</b>
18718   * <p>
18719   * Description: <b>The creation date for the EOB</b><br>
18720   * Type: <b>date</b><br>
18721   * Path: <b>ExplanationOfBenefit.created</b><br>
18722   * </p>
18723   */
18724  @SearchParamDefinition(name = "created", path = "ExplanationOfBenefit.created", description = "The creation date for the EOB", type = "date")
18725  public static final String SP_CREATED = "created";
18726  /**
18727   * <b>Fluent Client</b> search parameter constant for <b>created</b>
18728   * <p>
18729   * Description: <b>The creation date for the EOB</b><br>
18730   * Type: <b>date</b><br>
18731   * Path: <b>ExplanationOfBenefit.created</b><br>
18732   * </p>
18733   */
18734  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(
18735      SP_CREATED);
18736
18737  /**
18738   * Search parameter: <b>encounter</b>
18739   * <p>
18740   * Description: <b>Encounters associated with a billed line item</b><br>
18741   * Type: <b>reference</b><br>
18742   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
18743   * </p>
18744   */
18745  @SearchParamDefinition(name = "encounter", path = "ExplanationOfBenefit.item.encounter", description = "Encounters associated with a billed line item", type = "reference", providesMembershipIn = {
18746      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Encounter") }, target = { Encounter.class })
18747  public static final String SP_ENCOUNTER = "encounter";
18748  /**
18749   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
18750   * <p>
18751   * Description: <b>Encounters associated with a billed line item</b><br>
18752   * Type: <b>reference</b><br>
18753   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
18754   * </p>
18755   */
18756  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18757      SP_ENCOUNTER);
18758
18759  /**
18760   * Constant for fluent queries to be used to add include statements. Specifies
18761   * the path value of "<b>ExplanationOfBenefit:encounter</b>".
18762   */
18763  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include(
18764      "ExplanationOfBenefit:encounter").toLocked();
18765
18766  /**
18767   * Search parameter: <b>payee</b>
18768   * <p>
18769   * Description: <b>The party receiving any payment for the Claim</b><br>
18770   * Type: <b>reference</b><br>
18771   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
18772   * </p>
18773   */
18774  @SearchParamDefinition(name = "payee", path = "ExplanationOfBenefit.payee.party", description = "The party receiving any payment for the Claim", type = "reference", providesMembershipIn = {
18775      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient"),
18776      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner"),
18777      @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { Organization.class,
18778          Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class })
18779  public static final String SP_PAYEE = "payee";
18780  /**
18781   * <b>Fluent Client</b> search parameter constant for <b>payee</b>
18782   * <p>
18783   * Description: <b>The party receiving any payment for the Claim</b><br>
18784   * Type: <b>reference</b><br>
18785   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
18786   * </p>
18787   */
18788  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18789      SP_PAYEE);
18790
18791  /**
18792   * Constant for fluent queries to be used to add include statements. Specifies
18793   * the path value of "<b>ExplanationOfBenefit:payee</b>".
18794   */
18795  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYEE = new ca.uhn.fhir.model.api.Include(
18796      "ExplanationOfBenefit:payee").toLocked();
18797
18798  /**
18799   * Search parameter: <b>disposition</b>
18800   * <p>
18801   * Description: <b>The contents of the disposition message</b><br>
18802   * Type: <b>string</b><br>
18803   * Path: <b>ExplanationOfBenefit.disposition</b><br>
18804   * </p>
18805   */
18806  @SearchParamDefinition(name = "disposition", path = "ExplanationOfBenefit.disposition", description = "The contents of the disposition message", type = "string")
18807  public static final String SP_DISPOSITION = "disposition";
18808  /**
18809   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
18810   * <p>
18811   * Description: <b>The contents of the disposition message</b><br>
18812   * Type: <b>string</b><br>
18813   * Path: <b>ExplanationOfBenefit.disposition</b><br>
18814   * </p>
18815   */
18816  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(
18817      SP_DISPOSITION);
18818
18819  /**
18820   * Search parameter: <b>provider</b>
18821   * <p>
18822   * Description: <b>The reference to the provider</b><br>
18823   * Type: <b>reference</b><br>
18824   * Path: <b>ExplanationOfBenefit.provider</b><br>
18825   * </p>
18826   */
18827  @SearchParamDefinition(name = "provider", path = "ExplanationOfBenefit.provider", description = "The reference to the provider", type = "reference", providesMembershipIn = {
18828      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Organization.class,
18829          Practitioner.class, PractitionerRole.class })
18830  public static final String SP_PROVIDER = "provider";
18831  /**
18832   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
18833   * <p>
18834   * Description: <b>The reference to the provider</b><br>
18835   * Type: <b>reference</b><br>
18836   * Path: <b>ExplanationOfBenefit.provider</b><br>
18837   * </p>
18838   */
18839  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18840      SP_PROVIDER);
18841
18842  /**
18843   * Constant for fluent queries to be used to add include statements. Specifies
18844   * the path value of "<b>ExplanationOfBenefit:provider</b>".
18845   */
18846  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include(
18847      "ExplanationOfBenefit:provider").toLocked();
18848
18849  /**
18850   * Search parameter: <b>patient</b>
18851   * <p>
18852   * Description: <b>The reference to the patient</b><br>
18853   * Type: <b>reference</b><br>
18854   * Path: <b>ExplanationOfBenefit.patient</b><br>
18855   * </p>
18856   */
18857  @SearchParamDefinition(name = "patient", path = "ExplanationOfBenefit.patient", description = "The reference to the patient", type = "reference", providesMembershipIn = {
18858      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Patient.class })
18859  public static final String SP_PATIENT = "patient";
18860  /**
18861   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
18862   * <p>
18863   * Description: <b>The reference to the patient</b><br>
18864   * Type: <b>reference</b><br>
18865   * Path: <b>ExplanationOfBenefit.patient</b><br>
18866   * </p>
18867   */
18868  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18869      SP_PATIENT);
18870
18871  /**
18872   * Constant for fluent queries to be used to add include statements. Specifies
18873   * the path value of "<b>ExplanationOfBenefit:patient</b>".
18874   */
18875  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
18876      "ExplanationOfBenefit:patient").toLocked();
18877
18878  /**
18879   * Search parameter: <b>detail-udi</b>
18880   * <p>
18881   * Description: <b>UDI associated with a line item detail product or
18882   * service</b><br>
18883   * Type: <b>reference</b><br>
18884   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
18885   * </p>
18886   */
18887  @SearchParamDefinition(name = "detail-udi", path = "ExplanationOfBenefit.item.detail.udi", description = "UDI associated with a line item detail product or service", type = "reference", providesMembershipIn = {
18888      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device") }, target = { Device.class })
18889  public static final String SP_DETAIL_UDI = "detail-udi";
18890  /**
18891   * <b>Fluent Client</b> search parameter constant for <b>detail-udi</b>
18892   * <p>
18893   * Description: <b>UDI associated with a line item detail product or
18894   * service</b><br>
18895   * Type: <b>reference</b><br>
18896   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
18897   * </p>
18898   */
18899  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18900      SP_DETAIL_UDI);
18901
18902  /**
18903   * Constant for fluent queries to be used to add include statements. Specifies
18904   * the path value of "<b>ExplanationOfBenefit:detail-udi</b>".
18905   */
18906  public static final ca.uhn.fhir.model.api.Include INCLUDE_DETAIL_UDI = new ca.uhn.fhir.model.api.Include(
18907      "ExplanationOfBenefit:detail-udi").toLocked();
18908
18909  /**
18910   * Search parameter: <b>claim</b>
18911   * <p>
18912   * Description: <b>The reference to the claim</b><br>
18913   * Type: <b>reference</b><br>
18914   * Path: <b>ExplanationOfBenefit.claim</b><br>
18915   * </p>
18916   */
18917  @SearchParamDefinition(name = "claim", path = "ExplanationOfBenefit.claim", description = "The reference to the claim", type = "reference", target = {
18918      Claim.class })
18919  public static final String SP_CLAIM = "claim";
18920  /**
18921   * <b>Fluent Client</b> search parameter constant for <b>claim</b>
18922   * <p>
18923   * Description: <b>The reference to the claim</b><br>
18924   * Type: <b>reference</b><br>
18925   * Path: <b>ExplanationOfBenefit.claim</b><br>
18926   * </p>
18927   */
18928  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18929      SP_CLAIM);
18930
18931  /**
18932   * Constant for fluent queries to be used to add include statements. Specifies
18933   * the path value of "<b>ExplanationOfBenefit:claim</b>".
18934   */
18935  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIM = new ca.uhn.fhir.model.api.Include(
18936      "ExplanationOfBenefit:claim").toLocked();
18937
18938  /**
18939   * Search parameter: <b>enterer</b>
18940   * <p>
18941   * Description: <b>The party responsible for the entry of the Claim</b><br>
18942   * Type: <b>reference</b><br>
18943   * Path: <b>ExplanationOfBenefit.enterer</b><br>
18944   * </p>
18945   */
18946  @SearchParamDefinition(name = "enterer", path = "ExplanationOfBenefit.enterer", description = "The party responsible for the entry of the Claim", type = "reference", providesMembershipIn = {
18947      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Practitioner.class,
18948          PractitionerRole.class })
18949  public static final String SP_ENTERER = "enterer";
18950  /**
18951   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
18952   * <p>
18953   * Description: <b>The party responsible for the entry of the Claim</b><br>
18954   * Type: <b>reference</b><br>
18955   * Path: <b>ExplanationOfBenefit.enterer</b><br>
18956   * </p>
18957   */
18958  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18959      SP_ENTERER);
18960
18961  /**
18962   * Constant for fluent queries to be used to add include statements. Specifies
18963   * the path value of "<b>ExplanationOfBenefit:enterer</b>".
18964   */
18965  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include(
18966      "ExplanationOfBenefit:enterer").toLocked();
18967
18968  /**
18969   * Search parameter: <b>procedure-udi</b>
18970   * <p>
18971   * Description: <b>UDI associated with a procedure</b><br>
18972   * Type: <b>reference</b><br>
18973   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
18974   * </p>
18975   */
18976  @SearchParamDefinition(name = "procedure-udi", path = "ExplanationOfBenefit.procedure.udi", description = "UDI associated with a procedure", type = "reference", providesMembershipIn = {
18977      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device") }, target = { Device.class })
18978  public static final String SP_PROCEDURE_UDI = "procedure-udi";
18979  /**
18980   * <b>Fluent Client</b> search parameter constant for <b>procedure-udi</b>
18981   * <p>
18982   * Description: <b>UDI associated with a procedure</b><br>
18983   * Type: <b>reference</b><br>
18984   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
18985   * </p>
18986   */
18987  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROCEDURE_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18988      SP_PROCEDURE_UDI);
18989
18990  /**
18991   * Constant for fluent queries to be used to add include statements. Specifies
18992   * the path value of "<b>ExplanationOfBenefit:procedure-udi</b>".
18993   */
18994  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROCEDURE_UDI = new ca.uhn.fhir.model.api.Include(
18995      "ExplanationOfBenefit:procedure-udi").toLocked();
18996
18997  /**
18998   * Search parameter: <b>subdetail-udi</b>
18999   * <p>
19000   * Description: <b>UDI associated with a line item detail subdetail product or
19001   * service</b><br>
19002   * Type: <b>reference</b><br>
19003   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
19004   * </p>
19005   */
19006  @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 = {
19007      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device") }, target = { Device.class })
19008  public static final String SP_SUBDETAIL_UDI = "subdetail-udi";
19009  /**
19010   * <b>Fluent Client</b> search parameter constant for <b>subdetail-udi</b>
19011   * <p>
19012   * Description: <b>UDI associated with a line item detail subdetail product or
19013   * service</b><br>
19014   * Type: <b>reference</b><br>
19015   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
19016   * </p>
19017   */
19018  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBDETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
19019      SP_SUBDETAIL_UDI);
19020
19021  /**
19022   * Constant for fluent queries to be used to add include statements. Specifies
19023   * the path value of "<b>ExplanationOfBenefit:subdetail-udi</b>".
19024   */
19025  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBDETAIL_UDI = new ca.uhn.fhir.model.api.Include(
19026      "ExplanationOfBenefit:subdetail-udi").toLocked();
19027
19028  /**
19029   * Search parameter: <b>facility</b>
19030   * <p>
19031   * Description: <b>Facility responsible for the goods and services</b><br>
19032   * Type: <b>reference</b><br>
19033   * Path: <b>ExplanationOfBenefit.facility</b><br>
19034   * </p>
19035   */
19036  @SearchParamDefinition(name = "facility", path = "ExplanationOfBenefit.facility", description = "Facility responsible for the goods and services", type = "reference", target = {
19037      Location.class })
19038  public static final String SP_FACILITY = "facility";
19039  /**
19040   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
19041   * <p>
19042   * Description: <b>Facility responsible for the goods and services</b><br>
19043   * Type: <b>reference</b><br>
19044   * Path: <b>ExplanationOfBenefit.facility</b><br>
19045   * </p>
19046   */
19047  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
19048      SP_FACILITY);
19049
19050  /**
19051   * Constant for fluent queries to be used to add include statements. Specifies
19052   * the path value of "<b>ExplanationOfBenefit:facility</b>".
19053   */
19054  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include(
19055      "ExplanationOfBenefit:facility").toLocked();
19056
19057  /**
19058   * Search parameter: <b>item-udi</b>
19059   * <p>
19060   * Description: <b>UDI associated with a line item product or service</b><br>
19061   * Type: <b>reference</b><br>
19062   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
19063   * </p>
19064   */
19065  @SearchParamDefinition(name = "item-udi", path = "ExplanationOfBenefit.item.udi", description = "UDI associated with a line item product or service", type = "reference", providesMembershipIn = {
19066      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device") }, target = { Device.class })
19067  public static final String SP_ITEM_UDI = "item-udi";
19068  /**
19069   * <b>Fluent Client</b> search parameter constant for <b>item-udi</b>
19070   * <p>
19071   * Description: <b>UDI associated with a line item product or service</b><br>
19072   * Type: <b>reference</b><br>
19073   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
19074   * </p>
19075   */
19076  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
19077      SP_ITEM_UDI);
19078
19079  /**
19080   * Constant for fluent queries to be used to add include statements. Specifies
19081   * the path value of "<b>ExplanationOfBenefit:item-udi</b>".
19082   */
19083  public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM_UDI = new ca.uhn.fhir.model.api.Include(
19084      "ExplanationOfBenefit:item-udi").toLocked();
19085
19086  /**
19087   * Search parameter: <b>status</b>
19088   * <p>
19089   * Description: <b>Status of the instance</b><br>
19090   * Type: <b>token</b><br>
19091   * Path: <b>ExplanationOfBenefit.status</b><br>
19092   * </p>
19093   */
19094  @SearchParamDefinition(name = "status", path = "ExplanationOfBenefit.status", description = "Status of the instance", type = "token")
19095  public static final String SP_STATUS = "status";
19096  /**
19097   * <b>Fluent Client</b> search parameter constant for <b>status</b>
19098   * <p>
19099   * Description: <b>Status of the instance</b><br>
19100   * Type: <b>token</b><br>
19101   * Path: <b>ExplanationOfBenefit.status</b><br>
19102   * </p>
19103   */
19104  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
19105      SP_STATUS);
19106
19107}