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 Base makeProperty(int hash, String name) throws FHIRException {
741      switch (hash) {
742      case 94742588:
743        return getClaim();
744      case -261851592:
745        return getRelationship();
746      case -925155509:
747        return getReference();
748      default:
749        return super.makeProperty(hash, name);
750      }
751
752    }
753
754    @Override
755    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
756      switch (hash) {
757      case 94742588:
758        /* claim */ return new String[] { "Reference" };
759      case -261851592:
760        /* relationship */ return new String[] { "CodeableConcept" };
761      case -925155509:
762        /* reference */ return new String[] { "Identifier" };
763      default:
764        return super.getTypesForProperty(hash, name);
765      }
766
767    }
768
769    @Override
770    public Base addChild(String name) throws FHIRException {
771      if (name.equals("claim")) {
772        this.claim = new Reference();
773        return this.claim;
774      } else if (name.equals("relationship")) {
775        this.relationship = new CodeableConcept();
776        return this.relationship;
777      } else if (name.equals("reference")) {
778        this.reference = new Identifier();
779        return this.reference;
780      } else
781        return super.addChild(name);
782    }
783
784    public RelatedClaimComponent copy() {
785      RelatedClaimComponent dst = new RelatedClaimComponent();
786      copyValues(dst);
787      return dst;
788    }
789
790    public void copyValues(RelatedClaimComponent dst) {
791      super.copyValues(dst);
792      dst.claim = claim == null ? null : claim.copy();
793      dst.relationship = relationship == null ? null : relationship.copy();
794      dst.reference = reference == null ? null : reference.copy();
795    }
796
797    @Override
798    public boolean equalsDeep(Base other_) {
799      if (!super.equalsDeep(other_))
800        return false;
801      if (!(other_ instanceof RelatedClaimComponent))
802        return false;
803      RelatedClaimComponent o = (RelatedClaimComponent) other_;
804      return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true)
805          && compareDeep(reference, o.reference, true);
806    }
807
808    @Override
809    public boolean equalsShallow(Base other_) {
810      if (!super.equalsShallow(other_))
811        return false;
812      if (!(other_ instanceof RelatedClaimComponent))
813        return false;
814      RelatedClaimComponent o = (RelatedClaimComponent) other_;
815      return true;
816    }
817
818    public boolean isEmpty() {
819      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference);
820    }
821
822    public String fhirType() {
823      return "ExplanationOfBenefit.related";
824
825    }
826
827  }
828
829  @Block()
830  public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
831    /**
832     * Type of Party to be reimbursed: Subscriber, provider, other.
833     */
834    @Child(name = "type", type = {
835        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
836    @Description(shortDefinition = "Category of recipient", formalDefinition = "Type of Party to be reimbursed: Subscriber, provider, other.")
837    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/payeetype")
838    protected CodeableConcept type;
839
840    /**
841     * Reference to the individual or organization to whom any payment will be made.
842     */
843    @Child(name = "party", type = { Practitioner.class, PractitionerRole.class, Organization.class, Patient.class,
844        RelatedPerson.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
845    @Description(shortDefinition = "Recipient reference", formalDefinition = "Reference to the individual or organization to whom any payment will be made.")
846    protected Reference party;
847
848    /**
849     * The actual object that is the target of the reference (Reference to the
850     * individual or organization to whom any payment will be made.)
851     */
852    protected Resource partyTarget;
853
854    private static final long serialVersionUID = 1609484699L;
855
856    /**
857     * Constructor
858     */
859    public PayeeComponent() {
860      super();
861    }
862
863    /**
864     * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider,
865     *         other.)
866     */
867    public CodeableConcept getType() {
868      if (this.type == null)
869        if (Configuration.errorOnAutoCreate())
870          throw new Error("Attempt to auto-create PayeeComponent.type");
871        else if (Configuration.doAutoCreate())
872          this.type = new CodeableConcept(); // cc
873      return this.type;
874    }
875
876    public boolean hasType() {
877      return this.type != null && !this.type.isEmpty();
878    }
879
880    /**
881     * @param value {@link #type} (Type of Party to be reimbursed: Subscriber,
882     *              provider, other.)
883     */
884    public PayeeComponent setType(CodeableConcept value) {
885      this.type = value;
886      return this;
887    }
888
889    /**
890     * @return {@link #party} (Reference to the individual or organization to whom
891     *         any payment will be made.)
892     */
893    public Reference getParty() {
894      if (this.party == null)
895        if (Configuration.errorOnAutoCreate())
896          throw new Error("Attempt to auto-create PayeeComponent.party");
897        else if (Configuration.doAutoCreate())
898          this.party = new Reference(); // cc
899      return this.party;
900    }
901
902    public boolean hasParty() {
903      return this.party != null && !this.party.isEmpty();
904    }
905
906    /**
907     * @param value {@link #party} (Reference to the individual or organization to
908     *              whom any payment will be made.)
909     */
910    public PayeeComponent setParty(Reference value) {
911      this.party = value;
912      return this;
913    }
914
915    /**
916     * @return {@link #party} The actual object that is the target of the reference.
917     *         The reference library doesn't populate this, but you can use it to
918     *         hold the resource if you resolve it. (Reference to the individual or
919     *         organization to whom any payment will be made.)
920     */
921    public Resource getPartyTarget() {
922      return this.partyTarget;
923    }
924
925    /**
926     * @param value {@link #party} The actual object that is the target of the
927     *              reference. The reference library doesn't use these, but you can
928     *              use it to hold the resource if you resolve it. (Reference to the
929     *              individual or organization to whom any payment will be made.)
930     */
931    public PayeeComponent setPartyTarget(Resource value) {
932      this.partyTarget = value;
933      return this;
934    }
935
936    protected void listChildren(List<Property> children) {
937      super.listChildren(children);
938      children.add(new Property("type", "CodeableConcept",
939          "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type));
940      children.add(new Property("party", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)",
941          "Reference to the individual or organization to whom any payment will be made.", 0, 1, party));
942    }
943
944    @Override
945    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
946      switch (_hash) {
947      case 3575610:
948        /* type */ return new Property("type", "CodeableConcept",
949            "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type);
950      case 106437350:
951        /* party */ return new Property("party",
952            "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)",
953            "Reference to the individual or organization to whom any payment will be made.", 0, 1, party);
954      default:
955        return super.getNamedProperty(_hash, _name, _checkValid);
956      }
957
958    }
959
960    @Override
961    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
962      switch (hash) {
963      case 3575610:
964        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
965      case 106437350:
966        /* party */ return this.party == null ? new Base[0] : new Base[] { this.party }; // Reference
967      default:
968        return super.getProperty(hash, name, checkValid);
969      }
970
971    }
972
973    @Override
974    public Base setProperty(int hash, String name, Base value) throws FHIRException {
975      switch (hash) {
976      case 3575610: // type
977        this.type = castToCodeableConcept(value); // CodeableConcept
978        return value;
979      case 106437350: // party
980        this.party = castToReference(value); // Reference
981        return value;
982      default:
983        return super.setProperty(hash, name, value);
984      }
985
986    }
987
988    @Override
989    public Base setProperty(String name, Base value) throws FHIRException {
990      if (name.equals("type")) {
991        this.type = castToCodeableConcept(value); // CodeableConcept
992      } else if (name.equals("party")) {
993        this.party = castToReference(value); // Reference
994      } else
995        return super.setProperty(name, value);
996      return value;
997    }
998
999    @Override
1000    public Base makeProperty(int hash, String name) throws FHIRException {
1001      switch (hash) {
1002      case 3575610:
1003        return getType();
1004      case 106437350:
1005        return getParty();
1006      default:
1007        return super.makeProperty(hash, name);
1008      }
1009
1010    }
1011
1012    @Override
1013    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1014      switch (hash) {
1015      case 3575610:
1016        /* type */ return new String[] { "CodeableConcept" };
1017      case 106437350:
1018        /* party */ return new String[] { "Reference" };
1019      default:
1020        return super.getTypesForProperty(hash, name);
1021      }
1022
1023    }
1024
1025    @Override
1026    public Base addChild(String name) throws FHIRException {
1027      if (name.equals("type")) {
1028        this.type = new CodeableConcept();
1029        return this.type;
1030      } else if (name.equals("party")) {
1031        this.party = new Reference();
1032        return this.party;
1033      } else
1034        return super.addChild(name);
1035    }
1036
1037    public PayeeComponent copy() {
1038      PayeeComponent dst = new PayeeComponent();
1039      copyValues(dst);
1040      return dst;
1041    }
1042
1043    public void copyValues(PayeeComponent dst) {
1044      super.copyValues(dst);
1045      dst.type = type == null ? null : type.copy();
1046      dst.party = party == null ? null : party.copy();
1047    }
1048
1049    @Override
1050    public boolean equalsDeep(Base other_) {
1051      if (!super.equalsDeep(other_))
1052        return false;
1053      if (!(other_ instanceof PayeeComponent))
1054        return false;
1055      PayeeComponent o = (PayeeComponent) other_;
1056      return compareDeep(type, o.type, true) && compareDeep(party, o.party, true);
1057    }
1058
1059    @Override
1060    public boolean equalsShallow(Base other_) {
1061      if (!super.equalsShallow(other_))
1062        return false;
1063      if (!(other_ instanceof PayeeComponent))
1064        return false;
1065      PayeeComponent o = (PayeeComponent) other_;
1066      return true;
1067    }
1068
1069    public boolean isEmpty() {
1070      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party);
1071    }
1072
1073    public String fhirType() {
1074      return "ExplanationOfBenefit.payee";
1075
1076    }
1077
1078  }
1079
1080  @Block()
1081  public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
1082    /**
1083     * A number to uniquely identify care team entries.
1084     */
1085    @Child(name = "sequence", type = {
1086        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
1087    @Description(shortDefinition = "Order of care team", formalDefinition = "A number to uniquely identify care team entries.")
1088    protected PositiveIntType sequence;
1089
1090    /**
1091     * Member of the team who provided the product or service.
1092     */
1093    @Child(name = "provider", type = { Practitioner.class, PractitionerRole.class,
1094        Organization.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
1095    @Description(shortDefinition = "Practitioner or organization", formalDefinition = "Member of the team who provided the product or service.")
1096    protected Reference provider;
1097
1098    /**
1099     * The actual object that is the target of the reference (Member of the team who
1100     * provided the product or service.)
1101     */
1102    protected Resource providerTarget;
1103
1104    /**
1105     * The party who is billing and/or responsible for the claimed products or
1106     * services.
1107     */
1108    @Child(name = "responsible", type = {
1109        BooleanType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
1110    @Description(shortDefinition = "Indicator of the lead practitioner", formalDefinition = "The party who is billing and/or responsible for the claimed products or services.")
1111    protected BooleanType responsible;
1112
1113    /**
1114     * The lead, assisting or supervising practitioner and their discipline if a
1115     * multidisciplinary team.
1116     */
1117    @Child(name = "role", type = {
1118        CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
1119    @Description(shortDefinition = "Function within the team", formalDefinition = "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.")
1120    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-careteamrole")
1121    protected CodeableConcept role;
1122
1123    /**
1124     * The qualification of the practitioner which is applicable for this service.
1125     */
1126    @Child(name = "qualification", type = {
1127        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
1128    @Description(shortDefinition = "Practitioner credential or specialization", formalDefinition = "The qualification of the practitioner which is applicable for this service.")
1129    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/provider-qualification")
1130    protected CodeableConcept qualification;
1131
1132    private static final long serialVersionUID = 1758966968L;
1133
1134    /**
1135     * Constructor
1136     */
1137    public CareTeamComponent() {
1138      super();
1139    }
1140
1141    /**
1142     * Constructor
1143     */
1144    public CareTeamComponent(PositiveIntType sequence, Reference provider) {
1145      super();
1146      this.sequence = sequence;
1147      this.provider = provider;
1148    }
1149
1150    /**
1151     * @return {@link #sequence} (A number to uniquely identify care team entries.).
1152     *         This is the underlying object with id, value and extensions. The
1153     *         accessor "getSequence" gives direct access to the value
1154     */
1155    public PositiveIntType getSequenceElement() {
1156      if (this.sequence == null)
1157        if (Configuration.errorOnAutoCreate())
1158          throw new Error("Attempt to auto-create CareTeamComponent.sequence");
1159        else if (Configuration.doAutoCreate())
1160          this.sequence = new PositiveIntType(); // bb
1161      return this.sequence;
1162    }
1163
1164    public boolean hasSequenceElement() {
1165      return this.sequence != null && !this.sequence.isEmpty();
1166    }
1167
1168    public boolean hasSequence() {
1169      return this.sequence != null && !this.sequence.isEmpty();
1170    }
1171
1172    /**
1173     * @param value {@link #sequence} (A number to uniquely identify care team
1174     *              entries.). This is the underlying object with id, value and
1175     *              extensions. The accessor "getSequence" gives direct access to
1176     *              the value
1177     */
1178    public CareTeamComponent setSequenceElement(PositiveIntType value) {
1179      this.sequence = value;
1180      return this;
1181    }
1182
1183    /**
1184     * @return A number to uniquely identify care team entries.
1185     */
1186    public int getSequence() {
1187      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1188    }
1189
1190    /**
1191     * @param value A number to uniquely identify care team entries.
1192     */
1193    public CareTeamComponent setSequence(int value) {
1194      if (this.sequence == null)
1195        this.sequence = new PositiveIntType();
1196      this.sequence.setValue(value);
1197      return this;
1198    }
1199
1200    /**
1201     * @return {@link #provider} (Member of the team who provided the product or
1202     *         service.)
1203     */
1204    public Reference getProvider() {
1205      if (this.provider == null)
1206        if (Configuration.errorOnAutoCreate())
1207          throw new Error("Attempt to auto-create CareTeamComponent.provider");
1208        else if (Configuration.doAutoCreate())
1209          this.provider = new Reference(); // cc
1210      return this.provider;
1211    }
1212
1213    public boolean hasProvider() {
1214      return this.provider != null && !this.provider.isEmpty();
1215    }
1216
1217    /**
1218     * @param value {@link #provider} (Member of the team who provided the product
1219     *              or service.)
1220     */
1221    public CareTeamComponent setProvider(Reference value) {
1222      this.provider = value;
1223      return this;
1224    }
1225
1226    /**
1227     * @return {@link #provider} The actual object that is the target of the
1228     *         reference. The reference library doesn't populate this, but you can
1229     *         use it to hold the resource if you resolve it. (Member of the team
1230     *         who provided the product or service.)
1231     */
1232    public Resource getProviderTarget() {
1233      return this.providerTarget;
1234    }
1235
1236    /**
1237     * @param value {@link #provider} The actual object that is the target of the
1238     *              reference. The reference library doesn't use these, but you can
1239     *              use it to hold the resource if you resolve it. (Member of the
1240     *              team who provided the product or service.)
1241     */
1242    public CareTeamComponent setProviderTarget(Resource value) {
1243      this.providerTarget = value;
1244      return this;
1245    }
1246
1247    /**
1248     * @return {@link #responsible} (The party who is billing and/or responsible for
1249     *         the claimed products or services.). This is the underlying object
1250     *         with id, value and extensions. The accessor "getResponsible" gives
1251     *         direct access to the value
1252     */
1253    public BooleanType getResponsibleElement() {
1254      if (this.responsible == null)
1255        if (Configuration.errorOnAutoCreate())
1256          throw new Error("Attempt to auto-create CareTeamComponent.responsible");
1257        else if (Configuration.doAutoCreate())
1258          this.responsible = new BooleanType(); // bb
1259      return this.responsible;
1260    }
1261
1262    public boolean hasResponsibleElement() {
1263      return this.responsible != null && !this.responsible.isEmpty();
1264    }
1265
1266    public boolean hasResponsible() {
1267      return this.responsible != null && !this.responsible.isEmpty();
1268    }
1269
1270    /**
1271     * @param value {@link #responsible} (The party who is billing and/or
1272     *              responsible for the claimed products or services.). This is the
1273     *              underlying object with id, value and extensions. The accessor
1274     *              "getResponsible" gives direct access to the value
1275     */
1276    public CareTeamComponent setResponsibleElement(BooleanType value) {
1277      this.responsible = value;
1278      return this;
1279    }
1280
1281    /**
1282     * @return The party who is billing and/or responsible for the claimed products
1283     *         or services.
1284     */
1285    public boolean getResponsible() {
1286      return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
1287    }
1288
1289    /**
1290     * @param value The party who is billing and/or responsible for the claimed
1291     *              products or services.
1292     */
1293    public CareTeamComponent setResponsible(boolean value) {
1294      if (this.responsible == null)
1295        this.responsible = new BooleanType();
1296      this.responsible.setValue(value);
1297      return this;
1298    }
1299
1300    /**
1301     * @return {@link #role} (The lead, assisting or supervising practitioner and
1302     *         their discipline if a multidisciplinary team.)
1303     */
1304    public CodeableConcept getRole() {
1305      if (this.role == null)
1306        if (Configuration.errorOnAutoCreate())
1307          throw new Error("Attempt to auto-create CareTeamComponent.role");
1308        else if (Configuration.doAutoCreate())
1309          this.role = new CodeableConcept(); // cc
1310      return this.role;
1311    }
1312
1313    public boolean hasRole() {
1314      return this.role != null && !this.role.isEmpty();
1315    }
1316
1317    /**
1318     * @param value {@link #role} (The lead, assisting or supervising practitioner
1319     *              and their discipline if a multidisciplinary team.)
1320     */
1321    public CareTeamComponent setRole(CodeableConcept value) {
1322      this.role = value;
1323      return this;
1324    }
1325
1326    /**
1327     * @return {@link #qualification} (The qualification of the practitioner which
1328     *         is applicable for this service.)
1329     */
1330    public CodeableConcept getQualification() {
1331      if (this.qualification == null)
1332        if (Configuration.errorOnAutoCreate())
1333          throw new Error("Attempt to auto-create CareTeamComponent.qualification");
1334        else if (Configuration.doAutoCreate())
1335          this.qualification = new CodeableConcept(); // cc
1336      return this.qualification;
1337    }
1338
1339    public boolean hasQualification() {
1340      return this.qualification != null && !this.qualification.isEmpty();
1341    }
1342
1343    /**
1344     * @param value {@link #qualification} (The qualification of the practitioner
1345     *              which is applicable for this service.)
1346     */
1347    public CareTeamComponent setQualification(CodeableConcept value) {
1348      this.qualification = value;
1349      return this;
1350    }
1351
1352    protected void listChildren(List<Property> children) {
1353      super.listChildren(children);
1354      children.add(
1355          new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence));
1356      children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
1357          "Member of the team who provided the product or service.", 0, 1, provider));
1358      children.add(new Property("responsible", "boolean",
1359          "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible));
1360      children.add(new Property("role", "CodeableConcept",
1361          "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1,
1362          role));
1363      children.add(new Property("qualification", "CodeableConcept",
1364          "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification));
1365    }
1366
1367    @Override
1368    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1369      switch (_hash) {
1370      case 1349547969:
1371        /* sequence */ return new Property("sequence", "positiveInt",
1372            "A number to uniquely identify care team entries.", 0, 1, sequence);
1373      case -987494927:
1374        /* provider */ return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
1375            "Member of the team who provided the product or service.", 0, 1, provider);
1376      case 1847674614:
1377        /* responsible */ return new Property("responsible", "boolean",
1378            "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible);
1379      case 3506294:
1380        /* role */ return new Property("role", "CodeableConcept",
1381            "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1,
1382            role);
1383      case -631333393:
1384        /* qualification */ return new Property("qualification", "CodeableConcept",
1385            "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification);
1386      default:
1387        return super.getNamedProperty(_hash, _name, _checkValid);
1388      }
1389
1390    }
1391
1392    @Override
1393    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1394      switch (hash) {
1395      case 1349547969:
1396        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
1397      case -987494927:
1398        /* provider */ return this.provider == null ? new Base[0] : new Base[] { this.provider }; // Reference
1399      case 1847674614:
1400        /* responsible */ return this.responsible == null ? new Base[0] : new Base[] { this.responsible }; // BooleanType
1401      case 3506294:
1402        /* role */ return this.role == null ? new Base[0] : new Base[] { this.role }; // CodeableConcept
1403      case -631333393:
1404        /* qualification */ return this.qualification == null ? new Base[0] : new Base[] { this.qualification }; // CodeableConcept
1405      default:
1406        return super.getProperty(hash, name, checkValid);
1407      }
1408
1409    }
1410
1411    @Override
1412    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1413      switch (hash) {
1414      case 1349547969: // sequence
1415        this.sequence = castToPositiveInt(value); // PositiveIntType
1416        return value;
1417      case -987494927: // provider
1418        this.provider = castToReference(value); // Reference
1419        return value;
1420      case 1847674614: // responsible
1421        this.responsible = castToBoolean(value); // BooleanType
1422        return value;
1423      case 3506294: // role
1424        this.role = castToCodeableConcept(value); // CodeableConcept
1425        return value;
1426      case -631333393: // qualification
1427        this.qualification = castToCodeableConcept(value); // CodeableConcept
1428        return value;
1429      default:
1430        return super.setProperty(hash, name, value);
1431      }
1432
1433    }
1434
1435    @Override
1436    public Base setProperty(String name, Base value) throws FHIRException {
1437      if (name.equals("sequence")) {
1438        this.sequence = castToPositiveInt(value); // PositiveIntType
1439      } else if (name.equals("provider")) {
1440        this.provider = castToReference(value); // Reference
1441      } else if (name.equals("responsible")) {
1442        this.responsible = castToBoolean(value); // BooleanType
1443      } else if (name.equals("role")) {
1444        this.role = castToCodeableConcept(value); // CodeableConcept
1445      } else if (name.equals("qualification")) {
1446        this.qualification = castToCodeableConcept(value); // CodeableConcept
1447      } else
1448        return super.setProperty(name, value);
1449      return value;
1450    }
1451
1452    @Override
1453    public Base makeProperty(int hash, String name) throws FHIRException {
1454      switch (hash) {
1455      case 1349547969:
1456        return getSequenceElement();
1457      case -987494927:
1458        return getProvider();
1459      case 1847674614:
1460        return getResponsibleElement();
1461      case 3506294:
1462        return getRole();
1463      case -631333393:
1464        return getQualification();
1465      default:
1466        return super.makeProperty(hash, name);
1467      }
1468
1469    }
1470
1471    @Override
1472    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1473      switch (hash) {
1474      case 1349547969:
1475        /* sequence */ return new String[] { "positiveInt" };
1476      case -987494927:
1477        /* provider */ return new String[] { "Reference" };
1478      case 1847674614:
1479        /* responsible */ return new String[] { "boolean" };
1480      case 3506294:
1481        /* role */ return new String[] { "CodeableConcept" };
1482      case -631333393:
1483        /* qualification */ return new String[] { "CodeableConcept" };
1484      default:
1485        return super.getTypesForProperty(hash, name);
1486      }
1487
1488    }
1489
1490    @Override
1491    public Base addChild(String name) throws FHIRException {
1492      if (name.equals("sequence")) {
1493        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
1494      } else if (name.equals("provider")) {
1495        this.provider = new Reference();
1496        return this.provider;
1497      } else if (name.equals("responsible")) {
1498        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.responsible");
1499      } else if (name.equals("role")) {
1500        this.role = new CodeableConcept();
1501        return this.role;
1502      } else if (name.equals("qualification")) {
1503        this.qualification = new CodeableConcept();
1504        return this.qualification;
1505      } else
1506        return super.addChild(name);
1507    }
1508
1509    public CareTeamComponent copy() {
1510      CareTeamComponent dst = new CareTeamComponent();
1511      copyValues(dst);
1512      return dst;
1513    }
1514
1515    public void copyValues(CareTeamComponent dst) {
1516      super.copyValues(dst);
1517      dst.sequence = sequence == null ? null : sequence.copy();
1518      dst.provider = provider == null ? null : provider.copy();
1519      dst.responsible = responsible == null ? null : responsible.copy();
1520      dst.role = role == null ? null : role.copy();
1521      dst.qualification = qualification == null ? null : qualification.copy();
1522    }
1523
1524    @Override
1525    public boolean equalsDeep(Base other_) {
1526      if (!super.equalsDeep(other_))
1527        return false;
1528      if (!(other_ instanceof CareTeamComponent))
1529        return false;
1530      CareTeamComponent o = (CareTeamComponent) other_;
1531      return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true)
1532          && compareDeep(responsible, o.responsible, true) && compareDeep(role, o.role, true)
1533          && compareDeep(qualification, o.qualification, true);
1534    }
1535
1536    @Override
1537    public boolean equalsShallow(Base other_) {
1538      if (!super.equalsShallow(other_))
1539        return false;
1540      if (!(other_ instanceof CareTeamComponent))
1541        return false;
1542      CareTeamComponent o = (CareTeamComponent) other_;
1543      return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true);
1544    }
1545
1546    public boolean isEmpty() {
1547      return super.isEmpty()
1548          && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible, role, qualification);
1549    }
1550
1551    public String fhirType() {
1552      return "ExplanationOfBenefit.careTeam";
1553
1554    }
1555
1556  }
1557
1558  @Block()
1559  public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
1560    /**
1561     * A number to uniquely identify supporting information entries.
1562     */
1563    @Child(name = "sequence", type = {
1564        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
1565    @Description(shortDefinition = "Information instance identifier", formalDefinition = "A number to uniquely identify supporting information entries.")
1566    protected PositiveIntType sequence;
1567
1568    /**
1569     * The general class of the information supplied: information; exception;
1570     * accident, employment; onset, etc.
1571     */
1572    @Child(name = "category", type = {
1573        CodeableConcept.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
1574    @Description(shortDefinition = "Classification of the supplied information", formalDefinition = "The general class of the information supplied: information; exception; accident, employment; onset, etc.")
1575    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-informationcategory")
1576    protected CodeableConcept category;
1577
1578    /**
1579     * System and code pertaining to the specific information regarding special
1580     * conditions relating to the setting, treatment or patient for which care is
1581     * sought.
1582     */
1583    @Child(name = "code", type = {
1584        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
1585    @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.")
1586    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-exception")
1587    protected CodeableConcept code;
1588
1589    /**
1590     * The date when or period to which this information refers.
1591     */
1592    @Child(name = "timing", type = { DateType.class,
1593        Period.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
1594    @Description(shortDefinition = "When it occurred", formalDefinition = "The date when or period to which this information refers.")
1595    protected Type timing;
1596
1597    /**
1598     * Additional data or information such as resources, documents, images etc.
1599     * including references to the data or the actual inclusion of the data.
1600     */
1601    @Child(name = "value", type = { BooleanType.class, StringType.class, Quantity.class, Attachment.class,
1602        Reference.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
1603    @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.")
1604    protected Type value;
1605
1606    /**
1607     * Provides the reason in the situation where a reason code is required in
1608     * addition to the content.
1609     */
1610    @Child(name = "reason", type = { Coding.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
1611    @Description(shortDefinition = "Explanation for the information", formalDefinition = "Provides the reason in the situation where a reason code is required in addition to the content.")
1612    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/missing-tooth-reason")
1613    protected Coding reason;
1614
1615    private static final long serialVersionUID = -410136661L;
1616
1617    /**
1618     * Constructor
1619     */
1620    public SupportingInformationComponent() {
1621      super();
1622    }
1623
1624    /**
1625     * Constructor
1626     */
1627    public SupportingInformationComponent(PositiveIntType sequence, CodeableConcept category) {
1628      super();
1629      this.sequence = sequence;
1630      this.category = category;
1631    }
1632
1633    /**
1634     * @return {@link #sequence} (A number to uniquely identify supporting
1635     *         information entries.). This is the underlying object with id, value
1636     *         and extensions. The accessor "getSequence" gives direct access to the
1637     *         value
1638     */
1639    public PositiveIntType getSequenceElement() {
1640      if (this.sequence == null)
1641        if (Configuration.errorOnAutoCreate())
1642          throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
1643        else if (Configuration.doAutoCreate())
1644          this.sequence = new PositiveIntType(); // bb
1645      return this.sequence;
1646    }
1647
1648    public boolean hasSequenceElement() {
1649      return this.sequence != null && !this.sequence.isEmpty();
1650    }
1651
1652    public boolean hasSequence() {
1653      return this.sequence != null && !this.sequence.isEmpty();
1654    }
1655
1656    /**
1657     * @param value {@link #sequence} (A number to uniquely identify supporting
1658     *              information entries.). This is the underlying object with id,
1659     *              value and extensions. The accessor "getSequence" gives direct
1660     *              access to the value
1661     */
1662    public SupportingInformationComponent setSequenceElement(PositiveIntType value) {
1663      this.sequence = value;
1664      return this;
1665    }
1666
1667    /**
1668     * @return A number to uniquely identify supporting information entries.
1669     */
1670    public int getSequence() {
1671      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1672    }
1673
1674    /**
1675     * @param value A number to uniquely identify supporting information entries.
1676     */
1677    public SupportingInformationComponent setSequence(int value) {
1678      if (this.sequence == null)
1679        this.sequence = new PositiveIntType();
1680      this.sequence.setValue(value);
1681      return this;
1682    }
1683
1684    /**
1685     * @return {@link #category} (The general class of the information supplied:
1686     *         information; exception; accident, employment; onset, etc.)
1687     */
1688    public CodeableConcept getCategory() {
1689      if (this.category == null)
1690        if (Configuration.errorOnAutoCreate())
1691          throw new Error("Attempt to auto-create SupportingInformationComponent.category");
1692        else if (Configuration.doAutoCreate())
1693          this.category = new CodeableConcept(); // cc
1694      return this.category;
1695    }
1696
1697    public boolean hasCategory() {
1698      return this.category != null && !this.category.isEmpty();
1699    }
1700
1701    /**
1702     * @param value {@link #category} (The general class of the information
1703     *              supplied: information; exception; accident, employment; onset,
1704     *              etc.)
1705     */
1706    public SupportingInformationComponent setCategory(CodeableConcept value) {
1707      this.category = value;
1708      return this;
1709    }
1710
1711    /**
1712     * @return {@link #code} (System and code pertaining to the specific information
1713     *         regarding special conditions relating to the setting, treatment or
1714     *         patient for which care is sought.)
1715     */
1716    public CodeableConcept getCode() {
1717      if (this.code == null)
1718        if (Configuration.errorOnAutoCreate())
1719          throw new Error("Attempt to auto-create SupportingInformationComponent.code");
1720        else if (Configuration.doAutoCreate())
1721          this.code = new CodeableConcept(); // cc
1722      return this.code;
1723    }
1724
1725    public boolean hasCode() {
1726      return this.code != null && !this.code.isEmpty();
1727    }
1728
1729    /**
1730     * @param value {@link #code} (System and code pertaining to the specific
1731     *              information regarding special conditions relating to the
1732     *              setting, treatment or patient for which care is sought.)
1733     */
1734    public SupportingInformationComponent setCode(CodeableConcept value) {
1735      this.code = value;
1736      return this;
1737    }
1738
1739    /**
1740     * @return {@link #timing} (The date when or period to which this information
1741     *         refers.)
1742     */
1743    public Type getTiming() {
1744      return this.timing;
1745    }
1746
1747    /**
1748     * @return {@link #timing} (The date when or period to which this information
1749     *         refers.)
1750     */
1751    public DateType getTimingDateType() throws FHIRException {
1752      if (this.timing == null)
1753        this.timing = new DateType();
1754      if (!(this.timing instanceof DateType))
1755        throw new FHIRException("Type mismatch: the type DateType was expected, but " + this.timing.getClass().getName()
1756            + " was encountered");
1757      return (DateType) this.timing;
1758    }
1759
1760    public boolean hasTimingDateType() {
1761      return this != null && this.timing instanceof DateType;
1762    }
1763
1764    /**
1765     * @return {@link #timing} (The date when or period to which this information
1766     *         refers.)
1767     */
1768    public Period getTimingPeriod() throws FHIRException {
1769      if (this.timing == null)
1770        this.timing = new Period();
1771      if (!(this.timing instanceof Period))
1772        throw new FHIRException("Type mismatch: the type Period was expected, but " + this.timing.getClass().getName()
1773            + " was encountered");
1774      return (Period) this.timing;
1775    }
1776
1777    public boolean hasTimingPeriod() {
1778      return this != null && this.timing instanceof Period;
1779    }
1780
1781    public boolean hasTiming() {
1782      return this.timing != null && !this.timing.isEmpty();
1783    }
1784
1785    /**
1786     * @param value {@link #timing} (The date when or period to which this
1787     *              information refers.)
1788     */
1789    public SupportingInformationComponent setTiming(Type value) {
1790      if (value != null && !(value instanceof DateType || value instanceof Period))
1791        throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.timing[x]: " + value.fhirType());
1792      this.timing = value;
1793      return this;
1794    }
1795
1796    /**
1797     * @return {@link #value} (Additional data or information such as resources,
1798     *         documents, images etc. including references to the data or the actual
1799     *         inclusion of the data.)
1800     */
1801    public Type getValue() {
1802      return this.value;
1803    }
1804
1805    /**
1806     * @return {@link #value} (Additional data or information such as resources,
1807     *         documents, images etc. including references to the data or the actual
1808     *         inclusion of the data.)
1809     */
1810    public BooleanType getValueBooleanType() throws FHIRException {
1811      if (this.value == null)
1812        this.value = new BooleanType();
1813      if (!(this.value instanceof BooleanType))
1814        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "
1815            + this.value.getClass().getName() + " was encountered");
1816      return (BooleanType) this.value;
1817    }
1818
1819    public boolean hasValueBooleanType() {
1820      return this != null && this.value instanceof BooleanType;
1821    }
1822
1823    /**
1824     * @return {@link #value} (Additional data or information such as resources,
1825     *         documents, images etc. including references to the data or the actual
1826     *         inclusion of the data.)
1827     */
1828    public StringType getValueStringType() throws FHIRException {
1829      if (this.value == null)
1830        this.value = new StringType();
1831      if (!(this.value instanceof StringType))
1832        throw new FHIRException("Type mismatch: the type StringType was expected, but "
1833            + this.value.getClass().getName() + " was encountered");
1834      return (StringType) this.value;
1835    }
1836
1837    public boolean hasValueStringType() {
1838      return this != null && this.value instanceof StringType;
1839    }
1840
1841    /**
1842     * @return {@link #value} (Additional data or information such as resources,
1843     *         documents, images etc. including references to the data or the actual
1844     *         inclusion of the data.)
1845     */
1846    public Quantity getValueQuantity() throws FHIRException {
1847      if (this.value == null)
1848        this.value = new Quantity();
1849      if (!(this.value instanceof Quantity))
1850        throw new FHIRException("Type mismatch: the type Quantity was expected, but " + this.value.getClass().getName()
1851            + " was encountered");
1852      return (Quantity) this.value;
1853    }
1854
1855    public boolean hasValueQuantity() {
1856      return this != null && this.value instanceof Quantity;
1857    }
1858
1859    /**
1860     * @return {@link #value} (Additional data or information such as resources,
1861     *         documents, images etc. including references to the data or the actual
1862     *         inclusion of the data.)
1863     */
1864    public Attachment getValueAttachment() throws FHIRException {
1865      if (this.value == null)
1866        this.value = new Attachment();
1867      if (!(this.value instanceof Attachment))
1868        throw new FHIRException("Type mismatch: the type Attachment was expected, but "
1869            + this.value.getClass().getName() + " was encountered");
1870      return (Attachment) this.value;
1871    }
1872
1873    public boolean hasValueAttachment() {
1874      return this != null && this.value instanceof Attachment;
1875    }
1876
1877    /**
1878     * @return {@link #value} (Additional data or information such as resources,
1879     *         documents, images etc. including references to the data or the actual
1880     *         inclusion of the data.)
1881     */
1882    public Reference getValueReference() throws FHIRException {
1883      if (this.value == null)
1884        this.value = new Reference();
1885      if (!(this.value instanceof Reference))
1886        throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.value.getClass().getName()
1887            + " was encountered");
1888      return (Reference) this.value;
1889    }
1890
1891    public boolean hasValueReference() {
1892      return this != null && this.value instanceof Reference;
1893    }
1894
1895    public boolean hasValue() {
1896      return this.value != null && !this.value.isEmpty();
1897    }
1898
1899    /**
1900     * @param value {@link #value} (Additional data or information such as
1901     *              resources, documents, images etc. including references to the
1902     *              data or the actual inclusion of the data.)
1903     */
1904    public SupportingInformationComponent setValue(Type value) {
1905      if (value != null && !(value instanceof BooleanType || value instanceof StringType || value instanceof Quantity
1906          || value instanceof Attachment || value instanceof Reference))
1907        throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.value[x]: " + value.fhirType());
1908      this.value = value;
1909      return this;
1910    }
1911
1912    /**
1913     * @return {@link #reason} (Provides the reason in the situation where a reason
1914     *         code is required in addition to the content.)
1915     */
1916    public Coding getReason() {
1917      if (this.reason == null)
1918        if (Configuration.errorOnAutoCreate())
1919          throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1920        else if (Configuration.doAutoCreate())
1921          this.reason = new Coding(); // cc
1922      return this.reason;
1923    }
1924
1925    public boolean hasReason() {
1926      return this.reason != null && !this.reason.isEmpty();
1927    }
1928
1929    /**
1930     * @param value {@link #reason} (Provides the reason in the situation where a
1931     *              reason code is required in addition to the content.)
1932     */
1933    public SupportingInformationComponent setReason(Coding value) {
1934      this.reason = value;
1935      return this;
1936    }
1937
1938    protected void listChildren(List<Property> children) {
1939      super.listChildren(children);
1940      children.add(new Property("sequence", "positiveInt",
1941          "A number to uniquely identify supporting information entries.", 0, 1, sequence));
1942      children.add(new Property("category", "CodeableConcept",
1943          "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0,
1944          1, category));
1945      children.add(new Property("code", "CodeableConcept",
1946          "System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.",
1947          0, 1, code));
1948      children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.",
1949          0, 1, timing));
1950      children.add(new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1951          "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1952          0, 1, value));
1953      children.add(new Property("reason", "Coding",
1954          "Provides the reason in the situation where a reason code is required in addition to the content.", 0, 1,
1955          reason));
1956    }
1957
1958    @Override
1959    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1960      switch (_hash) {
1961      case 1349547969:
1962        /* sequence */ return new Property("sequence", "positiveInt",
1963            "A number to uniquely identify supporting information entries.", 0, 1, sequence);
1964      case 50511102:
1965        /* category */ return new Property("category", "CodeableConcept",
1966            "The general class of the information supplied: information; exception; accident, employment; onset, etc.",
1967            0, 1, category);
1968      case 3059181:
1969        /* code */ return new Property("code", "CodeableConcept",
1970            "System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.",
1971            0, 1, code);
1972      case 164632566:
1973        /* timing[x] */ return new Property("timing[x]", "date|Period",
1974            "The date when or period to which this information refers.", 0, 1, timing);
1975      case -873664438:
1976        /* timing */ return new Property("timing[x]", "date|Period",
1977            "The date when or period to which this information refers.", 0, 1, timing);
1978      case 807935768:
1979        /* timingDate */ return new Property("timing[x]", "date|Period",
1980            "The date when or period to which this information refers.", 0, 1, timing);
1981      case -615615829:
1982        /* timingPeriod */ return new Property("timing[x]", "date|Period",
1983            "The date when or period to which this information refers.", 0, 1, timing);
1984      case -1410166417:
1985        /* value[x] */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1986            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1987            0, 1, value);
1988      case 111972721:
1989        /* value */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1990            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1991            0, 1, value);
1992      case 733421943:
1993        /* valueBoolean */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1994            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1995            0, 1, value);
1996      case -1424603934:
1997        /* valueString */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1998            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1999            0, 1, value);
2000      case -2029823716:
2001        /* valueQuantity */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
2002            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
2003            0, 1, value);
2004      case -475566732:
2005        /* valueAttachment */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
2006            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
2007            0, 1, value);
2008      case 1755241690:
2009        /* valueReference */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
2010            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
2011            0, 1, value);
2012      case -934964668:
2013        /* reason */ return new Property("reason", "Coding",
2014            "Provides the reason in the situation where a reason code is required in addition to the content.", 0, 1,
2015            reason);
2016      default:
2017        return super.getNamedProperty(_hash, _name, _checkValid);
2018      }
2019
2020    }
2021
2022    @Override
2023    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2024      switch (hash) {
2025      case 1349547969:
2026        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
2027      case 50511102:
2028        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
2029      case 3059181:
2030        /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
2031      case -873664438:
2032        /* timing */ return this.timing == null ? new Base[0] : new Base[] { this.timing }; // Type
2033      case 111972721:
2034        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // Type
2035      case -934964668:
2036        /* reason */ return this.reason == null ? new Base[0] : new Base[] { this.reason }; // Coding
2037      default:
2038        return super.getProperty(hash, name, checkValid);
2039      }
2040
2041    }
2042
2043    @Override
2044    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2045      switch (hash) {
2046      case 1349547969: // sequence
2047        this.sequence = castToPositiveInt(value); // PositiveIntType
2048        return value;
2049      case 50511102: // category
2050        this.category = castToCodeableConcept(value); // CodeableConcept
2051        return value;
2052      case 3059181: // code
2053        this.code = castToCodeableConcept(value); // CodeableConcept
2054        return value;
2055      case -873664438: // timing
2056        this.timing = castToType(value); // Type
2057        return value;
2058      case 111972721: // value
2059        this.value = castToType(value); // Type
2060        return value;
2061      case -934964668: // reason
2062        this.reason = castToCoding(value); // Coding
2063        return value;
2064      default:
2065        return super.setProperty(hash, name, value);
2066      }
2067
2068    }
2069
2070    @Override
2071    public Base setProperty(String name, Base value) throws FHIRException {
2072      if (name.equals("sequence")) {
2073        this.sequence = castToPositiveInt(value); // PositiveIntType
2074      } else if (name.equals("category")) {
2075        this.category = castToCodeableConcept(value); // CodeableConcept
2076      } else if (name.equals("code")) {
2077        this.code = castToCodeableConcept(value); // CodeableConcept
2078      } else if (name.equals("timing[x]")) {
2079        this.timing = castToType(value); // Type
2080      } else if (name.equals("value[x]")) {
2081        this.value = castToType(value); // Type
2082      } else if (name.equals("reason")) {
2083        this.reason = castToCoding(value); // Coding
2084      } else
2085        return super.setProperty(name, value);
2086      return value;
2087    }
2088
2089    @Override
2090    public Base makeProperty(int hash, String name) throws FHIRException {
2091      switch (hash) {
2092      case 1349547969:
2093        return getSequenceElement();
2094      case 50511102:
2095        return getCategory();
2096      case 3059181:
2097        return getCode();
2098      case 164632566:
2099        return getTiming();
2100      case -873664438:
2101        return getTiming();
2102      case -1410166417:
2103        return getValue();
2104      case 111972721:
2105        return getValue();
2106      case -934964668:
2107        return getReason();
2108      default:
2109        return super.makeProperty(hash, name);
2110      }
2111
2112    }
2113
2114    @Override
2115    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2116      switch (hash) {
2117      case 1349547969:
2118        /* sequence */ return new String[] { "positiveInt" };
2119      case 50511102:
2120        /* category */ return new String[] { "CodeableConcept" };
2121      case 3059181:
2122        /* code */ return new String[] { "CodeableConcept" };
2123      case -873664438:
2124        /* timing */ return new String[] { "date", "Period" };
2125      case 111972721:
2126        /* value */ return new String[] { "boolean", "string", "Quantity", "Attachment", "Reference" };
2127      case -934964668:
2128        /* reason */ return new String[] { "Coding" };
2129      default:
2130        return super.getTypesForProperty(hash, name);
2131      }
2132
2133    }
2134
2135    @Override
2136    public Base addChild(String name) throws FHIRException {
2137      if (name.equals("sequence")) {
2138        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
2139      } else if (name.equals("category")) {
2140        this.category = new CodeableConcept();
2141        return this.category;
2142      } else if (name.equals("code")) {
2143        this.code = new CodeableConcept();
2144        return this.code;
2145      } else if (name.equals("timingDate")) {
2146        this.timing = new DateType();
2147        return this.timing;
2148      } else if (name.equals("timingPeriod")) {
2149        this.timing = new Period();
2150        return this.timing;
2151      } else if (name.equals("valueBoolean")) {
2152        this.value = new BooleanType();
2153        return this.value;
2154      } else if (name.equals("valueString")) {
2155        this.value = new StringType();
2156        return this.value;
2157      } else if (name.equals("valueQuantity")) {
2158        this.value = new Quantity();
2159        return this.value;
2160      } else if (name.equals("valueAttachment")) {
2161        this.value = new Attachment();
2162        return this.value;
2163      } else if (name.equals("valueReference")) {
2164        this.value = new Reference();
2165        return this.value;
2166      } else if (name.equals("reason")) {
2167        this.reason = new Coding();
2168        return this.reason;
2169      } else
2170        return super.addChild(name);
2171    }
2172
2173    public SupportingInformationComponent copy() {
2174      SupportingInformationComponent dst = new SupportingInformationComponent();
2175      copyValues(dst);
2176      return dst;
2177    }
2178
2179    public void copyValues(SupportingInformationComponent dst) {
2180      super.copyValues(dst);
2181      dst.sequence = sequence == null ? null : sequence.copy();
2182      dst.category = category == null ? null : category.copy();
2183      dst.code = code == null ? null : code.copy();
2184      dst.timing = timing == null ? null : timing.copy();
2185      dst.value = value == null ? null : value.copy();
2186      dst.reason = reason == null ? null : reason.copy();
2187    }
2188
2189    @Override
2190    public boolean equalsDeep(Base other_) {
2191      if (!super.equalsDeep(other_))
2192        return false;
2193      if (!(other_ instanceof SupportingInformationComponent))
2194        return false;
2195      SupportingInformationComponent o = (SupportingInformationComponent) other_;
2196      return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true)
2197          && compareDeep(code, o.code, true) && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true)
2198          && compareDeep(reason, o.reason, true);
2199    }
2200
2201    @Override
2202    public boolean equalsShallow(Base other_) {
2203      if (!super.equalsShallow(other_))
2204        return false;
2205      if (!(other_ instanceof SupportingInformationComponent))
2206        return false;
2207      SupportingInformationComponent o = (SupportingInformationComponent) other_;
2208      return compareValues(sequence, o.sequence, true);
2209    }
2210
2211    public boolean isEmpty() {
2212      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code, timing, value, reason);
2213    }
2214
2215    public String fhirType() {
2216      return "ExplanationOfBenefit.supportingInfo";
2217
2218    }
2219
2220  }
2221
2222  @Block()
2223  public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
2224    /**
2225     * A number to uniquely identify diagnosis entries.
2226     */
2227    @Child(name = "sequence", type = {
2228        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
2229    @Description(shortDefinition = "Diagnosis instance identifier", formalDefinition = "A number to uniquely identify diagnosis entries.")
2230    protected PositiveIntType sequence;
2231
2232    /**
2233     * The nature of illness or problem in a coded form or as a reference to an
2234     * external defined Condition.
2235     */
2236    @Child(name = "diagnosis", type = { CodeableConcept.class,
2237        Condition.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
2238    @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.")
2239    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/icd-10")
2240    protected Type diagnosis;
2241
2242    /**
2243     * When the condition was observed or the relative ranking.
2244     */
2245    @Child(name = "type", type = {
2246        CodeableConcept.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2247    @Description(shortDefinition = "Timing or nature of the diagnosis", formalDefinition = "When the condition was observed or the relative ranking.")
2248    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-diagnosistype")
2249    protected List<CodeableConcept> type;
2250
2251    /**
2252     * Indication of whether the diagnosis was present on admission to a facility.
2253     */
2254    @Child(name = "onAdmission", type = {
2255        CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
2256    @Description(shortDefinition = "Present on admission", formalDefinition = "Indication of whether the diagnosis was present on admission to a facility.")
2257    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-diagnosis-on-admission")
2258    protected CodeableConcept onAdmission;
2259
2260    /**
2261     * A package billing code or bundle code used to group products and services to
2262     * a particular health condition (such as heart attack) which is based on a
2263     * predetermined grouping code system.
2264     */
2265    @Child(name = "packageCode", type = {
2266        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
2267    @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.")
2268    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
2269    protected CodeableConcept packageCode;
2270
2271    private static final long serialVersionUID = 2120593974L;
2272
2273    /**
2274     * Constructor
2275     */
2276    public DiagnosisComponent() {
2277      super();
2278    }
2279
2280    /**
2281     * Constructor
2282     */
2283    public DiagnosisComponent(PositiveIntType sequence, Type diagnosis) {
2284      super();
2285      this.sequence = sequence;
2286      this.diagnosis = diagnosis;
2287    }
2288
2289    /**
2290     * @return {@link #sequence} (A number to uniquely identify diagnosis entries.).
2291     *         This is the underlying object with id, value and extensions. The
2292     *         accessor "getSequence" gives direct access to the value
2293     */
2294    public PositiveIntType getSequenceElement() {
2295      if (this.sequence == null)
2296        if (Configuration.errorOnAutoCreate())
2297          throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
2298        else if (Configuration.doAutoCreate())
2299          this.sequence = new PositiveIntType(); // bb
2300      return this.sequence;
2301    }
2302
2303    public boolean hasSequenceElement() {
2304      return this.sequence != null && !this.sequence.isEmpty();
2305    }
2306
2307    public boolean hasSequence() {
2308      return this.sequence != null && !this.sequence.isEmpty();
2309    }
2310
2311    /**
2312     * @param value {@link #sequence} (A number to uniquely identify diagnosis
2313     *              entries.). This is the underlying object with id, value and
2314     *              extensions. The accessor "getSequence" gives direct access to
2315     *              the value
2316     */
2317    public DiagnosisComponent setSequenceElement(PositiveIntType value) {
2318      this.sequence = value;
2319      return this;
2320    }
2321
2322    /**
2323     * @return A number to uniquely identify diagnosis entries.
2324     */
2325    public int getSequence() {
2326      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2327    }
2328
2329    /**
2330     * @param value A number to uniquely identify diagnosis entries.
2331     */
2332    public DiagnosisComponent setSequence(int value) {
2333      if (this.sequence == null)
2334        this.sequence = new PositiveIntType();
2335      this.sequence.setValue(value);
2336      return this;
2337    }
2338
2339    /**
2340     * @return {@link #diagnosis} (The nature of illness or problem in a coded form
2341     *         or as a reference to an external defined Condition.)
2342     */
2343    public Type getDiagnosis() {
2344      return this.diagnosis;
2345    }
2346
2347    /**
2348     * @return {@link #diagnosis} (The nature of illness or problem in a coded form
2349     *         or as a reference to an external defined Condition.)
2350     */
2351    public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException {
2352      if (this.diagnosis == null)
2353        this.diagnosis = new CodeableConcept();
2354      if (!(this.diagnosis instanceof CodeableConcept))
2355        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
2356            + this.diagnosis.getClass().getName() + " was encountered");
2357      return (CodeableConcept) this.diagnosis;
2358    }
2359
2360    public boolean hasDiagnosisCodeableConcept() {
2361      return this != null && this.diagnosis instanceof CodeableConcept;
2362    }
2363
2364    /**
2365     * @return {@link #diagnosis} (The nature of illness or problem in a coded form
2366     *         or as a reference to an external defined Condition.)
2367     */
2368    public Reference getDiagnosisReference() throws FHIRException {
2369      if (this.diagnosis == null)
2370        this.diagnosis = new Reference();
2371      if (!(this.diagnosis instanceof Reference))
2372        throw new FHIRException("Type mismatch: the type Reference was expected, but "
2373            + this.diagnosis.getClass().getName() + " was encountered");
2374      return (Reference) this.diagnosis;
2375    }
2376
2377    public boolean hasDiagnosisReference() {
2378      return this != null && this.diagnosis instanceof Reference;
2379    }
2380
2381    public boolean hasDiagnosis() {
2382      return this.diagnosis != null && !this.diagnosis.isEmpty();
2383    }
2384
2385    /**
2386     * @param value {@link #diagnosis} (The nature of illness or problem in a coded
2387     *              form or as a reference to an external defined Condition.)
2388     */
2389    public DiagnosisComponent setDiagnosis(Type value) {
2390      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2391        throw new Error("Not the right type for ExplanationOfBenefit.diagnosis.diagnosis[x]: " + value.fhirType());
2392      this.diagnosis = value;
2393      return this;
2394    }
2395
2396    /**
2397     * @return {@link #type} (When the condition was observed or the relative
2398     *         ranking.)
2399     */
2400    public List<CodeableConcept> getType() {
2401      if (this.type == null)
2402        this.type = new ArrayList<CodeableConcept>();
2403      return this.type;
2404    }
2405
2406    /**
2407     * @return Returns a reference to <code>this</code> for easy method chaining
2408     */
2409    public DiagnosisComponent setType(List<CodeableConcept> theType) {
2410      this.type = theType;
2411      return this;
2412    }
2413
2414    public boolean hasType() {
2415      if (this.type == null)
2416        return false;
2417      for (CodeableConcept item : this.type)
2418        if (!item.isEmpty())
2419          return true;
2420      return false;
2421    }
2422
2423    public CodeableConcept addType() { // 3
2424      CodeableConcept t = new CodeableConcept();
2425      if (this.type == null)
2426        this.type = new ArrayList<CodeableConcept>();
2427      this.type.add(t);
2428      return t;
2429    }
2430
2431    public DiagnosisComponent addType(CodeableConcept t) { // 3
2432      if (t == null)
2433        return this;
2434      if (this.type == null)
2435        this.type = new ArrayList<CodeableConcept>();
2436      this.type.add(t);
2437      return this;
2438    }
2439
2440    /**
2441     * @return The first repetition of repeating field {@link #type}, creating it if
2442     *         it does not already exist
2443     */
2444    public CodeableConcept getTypeFirstRep() {
2445      if (getType().isEmpty()) {
2446        addType();
2447      }
2448      return getType().get(0);
2449    }
2450
2451    /**
2452     * @return {@link #onAdmission} (Indication of whether the diagnosis was present
2453     *         on admission to a facility.)
2454     */
2455    public CodeableConcept getOnAdmission() {
2456      if (this.onAdmission == null)
2457        if (Configuration.errorOnAutoCreate())
2458          throw new Error("Attempt to auto-create DiagnosisComponent.onAdmission");
2459        else if (Configuration.doAutoCreate())
2460          this.onAdmission = new CodeableConcept(); // cc
2461      return this.onAdmission;
2462    }
2463
2464    public boolean hasOnAdmission() {
2465      return this.onAdmission != null && !this.onAdmission.isEmpty();
2466    }
2467
2468    /**
2469     * @param value {@link #onAdmission} (Indication of whether the diagnosis was
2470     *              present on admission to a facility.)
2471     */
2472    public DiagnosisComponent setOnAdmission(CodeableConcept value) {
2473      this.onAdmission = value;
2474      return this;
2475    }
2476
2477    /**
2478     * @return {@link #packageCode} (A package billing code or bundle code used to
2479     *         group products and services to a particular health condition (such as
2480     *         heart attack) which is based on a predetermined grouping code
2481     *         system.)
2482     */
2483    public CodeableConcept getPackageCode() {
2484      if (this.packageCode == null)
2485        if (Configuration.errorOnAutoCreate())
2486          throw new Error("Attempt to auto-create DiagnosisComponent.packageCode");
2487        else if (Configuration.doAutoCreate())
2488          this.packageCode = new CodeableConcept(); // cc
2489      return this.packageCode;
2490    }
2491
2492    public boolean hasPackageCode() {
2493      return this.packageCode != null && !this.packageCode.isEmpty();
2494    }
2495
2496    /**
2497     * @param value {@link #packageCode} (A package billing code or bundle code used
2498     *              to group products and services to a particular health condition
2499     *              (such as heart attack) which is based on a predetermined
2500     *              grouping code system.)
2501     */
2502    public DiagnosisComponent setPackageCode(CodeableConcept value) {
2503      this.packageCode = value;
2504      return this;
2505    }
2506
2507    protected void listChildren(List<Property> children) {
2508      super.listChildren(children);
2509      children.add(
2510          new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence));
2511      children.add(new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2512          "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1,
2513          diagnosis));
2514      children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.",
2515          0, java.lang.Integer.MAX_VALUE, type));
2516      children.add(new Property("onAdmission", "CodeableConcept",
2517          "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission));
2518      children.add(new Property("packageCode", "CodeableConcept",
2519          "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.",
2520          0, 1, packageCode));
2521    }
2522
2523    @Override
2524    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2525      switch (_hash) {
2526      case 1349547969:
2527        /* sequence */ return new Property("sequence", "positiveInt",
2528            "A number to uniquely identify diagnosis entries.", 0, 1, sequence);
2529      case -1487009809:
2530        /* diagnosis[x] */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2531            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2532            1, diagnosis);
2533      case 1196993265:
2534        /* diagnosis */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2535            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2536            1, diagnosis);
2537      case 277781616:
2538        /* diagnosisCodeableConcept */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2539            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2540            1, diagnosis);
2541      case 2050454362:
2542        /* diagnosisReference */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2543            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2544            1, diagnosis);
2545      case 3575610:
2546        /* type */ return new Property("type", "CodeableConcept",
2547            "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2548      case -3386134:
2549        /* onAdmission */ return new Property("onAdmission", "CodeableConcept",
2550            "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission);
2551      case 908444499:
2552        /* packageCode */ return new Property("packageCode", "CodeableConcept",
2553            "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.",
2554            0, 1, packageCode);
2555      default:
2556        return super.getNamedProperty(_hash, _name, _checkValid);
2557      }
2558
2559    }
2560
2561    @Override
2562    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2563      switch (hash) {
2564      case 1349547969:
2565        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
2566      case 1196993265:
2567        /* diagnosis */ return this.diagnosis == null ? new Base[0] : new Base[] { this.diagnosis }; // Type
2568      case 3575610:
2569        /* type */ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2570      case -3386134:
2571        /* onAdmission */ return this.onAdmission == null ? new Base[0] : new Base[] { this.onAdmission }; // CodeableConcept
2572      case 908444499:
2573        /* packageCode */ return this.packageCode == null ? new Base[0] : new Base[] { this.packageCode }; // CodeableConcept
2574      default:
2575        return super.getProperty(hash, name, checkValid);
2576      }
2577
2578    }
2579
2580    @Override
2581    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2582      switch (hash) {
2583      case 1349547969: // sequence
2584        this.sequence = castToPositiveInt(value); // PositiveIntType
2585        return value;
2586      case 1196993265: // diagnosis
2587        this.diagnosis = castToType(value); // Type
2588        return value;
2589      case 3575610: // type
2590        this.getType().add(castToCodeableConcept(value)); // CodeableConcept
2591        return value;
2592      case -3386134: // onAdmission
2593        this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2594        return value;
2595      case 908444499: // packageCode
2596        this.packageCode = castToCodeableConcept(value); // CodeableConcept
2597        return value;
2598      default:
2599        return super.setProperty(hash, name, value);
2600      }
2601
2602    }
2603
2604    @Override
2605    public Base setProperty(String name, Base value) throws FHIRException {
2606      if (name.equals("sequence")) {
2607        this.sequence = castToPositiveInt(value); // PositiveIntType
2608      } else if (name.equals("diagnosis[x]")) {
2609        this.diagnosis = castToType(value); // Type
2610      } else if (name.equals("type")) {
2611        this.getType().add(castToCodeableConcept(value));
2612      } else if (name.equals("onAdmission")) {
2613        this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2614      } else if (name.equals("packageCode")) {
2615        this.packageCode = castToCodeableConcept(value); // CodeableConcept
2616      } else
2617        return super.setProperty(name, value);
2618      return value;
2619    }
2620
2621    @Override
2622    public Base makeProperty(int hash, String name) throws FHIRException {
2623      switch (hash) {
2624      case 1349547969:
2625        return getSequenceElement();
2626      case -1487009809:
2627        return getDiagnosis();
2628      case 1196993265:
2629        return getDiagnosis();
2630      case 3575610:
2631        return addType();
2632      case -3386134:
2633        return getOnAdmission();
2634      case 908444499:
2635        return getPackageCode();
2636      default:
2637        return super.makeProperty(hash, name);
2638      }
2639
2640    }
2641
2642    @Override
2643    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2644      switch (hash) {
2645      case 1349547969:
2646        /* sequence */ return new String[] { "positiveInt" };
2647      case 1196993265:
2648        /* diagnosis */ return new String[] { "CodeableConcept", "Reference" };
2649      case 3575610:
2650        /* type */ return new String[] { "CodeableConcept" };
2651      case -3386134:
2652        /* onAdmission */ return new String[] { "CodeableConcept" };
2653      case 908444499:
2654        /* packageCode */ return new String[] { "CodeableConcept" };
2655      default:
2656        return super.getTypesForProperty(hash, name);
2657      }
2658
2659    }
2660
2661    @Override
2662    public Base addChild(String name) throws FHIRException {
2663      if (name.equals("sequence")) {
2664        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
2665      } else if (name.equals("diagnosisCodeableConcept")) {
2666        this.diagnosis = new CodeableConcept();
2667        return this.diagnosis;
2668      } else if (name.equals("diagnosisReference")) {
2669        this.diagnosis = new Reference();
2670        return this.diagnosis;
2671      } else if (name.equals("type")) {
2672        return addType();
2673      } else if (name.equals("onAdmission")) {
2674        this.onAdmission = new CodeableConcept();
2675        return this.onAdmission;
2676      } else if (name.equals("packageCode")) {
2677        this.packageCode = new CodeableConcept();
2678        return this.packageCode;
2679      } else
2680        return super.addChild(name);
2681    }
2682
2683    public DiagnosisComponent copy() {
2684      DiagnosisComponent dst = new DiagnosisComponent();
2685      copyValues(dst);
2686      return dst;
2687    }
2688
2689    public void copyValues(DiagnosisComponent dst) {
2690      super.copyValues(dst);
2691      dst.sequence = sequence == null ? null : sequence.copy();
2692      dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
2693      if (type != null) {
2694        dst.type = new ArrayList<CodeableConcept>();
2695        for (CodeableConcept i : type)
2696          dst.type.add(i.copy());
2697      }
2698      ;
2699      dst.onAdmission = onAdmission == null ? null : onAdmission.copy();
2700      dst.packageCode = packageCode == null ? null : packageCode.copy();
2701    }
2702
2703    @Override
2704    public boolean equalsDeep(Base other_) {
2705      if (!super.equalsDeep(other_))
2706        return false;
2707      if (!(other_ instanceof DiagnosisComponent))
2708        return false;
2709      DiagnosisComponent o = (DiagnosisComponent) other_;
2710      return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true)
2711          && compareDeep(type, o.type, true) && compareDeep(onAdmission, o.onAdmission, true)
2712          && compareDeep(packageCode, o.packageCode, true);
2713    }
2714
2715    @Override
2716    public boolean equalsShallow(Base other_) {
2717      if (!super.equalsShallow(other_))
2718        return false;
2719      if (!(other_ instanceof DiagnosisComponent))
2720        return false;
2721      DiagnosisComponent o = (DiagnosisComponent) other_;
2722      return compareValues(sequence, o.sequence, true);
2723    }
2724
2725    public boolean isEmpty() {
2726      return super.isEmpty()
2727          && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type, onAdmission, packageCode);
2728    }
2729
2730    public String fhirType() {
2731      return "ExplanationOfBenefit.diagnosis";
2732
2733    }
2734
2735  }
2736
2737  @Block()
2738  public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
2739    /**
2740     * A number to uniquely identify procedure entries.
2741     */
2742    @Child(name = "sequence", type = {
2743        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
2744    @Description(shortDefinition = "Procedure instance identifier", formalDefinition = "A number to uniquely identify procedure entries.")
2745    protected PositiveIntType sequence;
2746
2747    /**
2748     * When the condition was observed or the relative ranking.
2749     */
2750    @Child(name = "type", type = {
2751        CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2752    @Description(shortDefinition = "Category of Procedure", formalDefinition = "When the condition was observed or the relative ranking.")
2753    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-procedure-type")
2754    protected List<CodeableConcept> type;
2755
2756    /**
2757     * Date and optionally time the procedure was performed.
2758     */
2759    @Child(name = "date", type = { DateTimeType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
2760    @Description(shortDefinition = "When the procedure was performed", formalDefinition = "Date and optionally time the procedure was performed.")
2761    protected DateTimeType date;
2762
2763    /**
2764     * The code or reference to a Procedure resource which identifies the clinical
2765     * intervention performed.
2766     */
2767    @Child(name = "procedure", type = { CodeableConcept.class,
2768        Procedure.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
2769    @Description(shortDefinition = "Specific clinical procedure", formalDefinition = "The code or reference to a Procedure resource which identifies the clinical intervention performed.")
2770    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/icd-10-procedures")
2771    protected Type procedure;
2772
2773    /**
2774     * Unique Device Identifiers associated with this line item.
2775     */
2776    @Child(name = "udi", type = {
2777        Device.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2778    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
2779    protected List<Reference> udi;
2780    /**
2781     * The actual objects that are the target of the reference (Unique Device
2782     * Identifiers associated with this line item.)
2783     */
2784    protected List<Device> udiTarget;
2785
2786    private static final long serialVersionUID = 935341852L;
2787
2788    /**
2789     * Constructor
2790     */
2791    public ProcedureComponent() {
2792      super();
2793    }
2794
2795    /**
2796     * Constructor
2797     */
2798    public ProcedureComponent(PositiveIntType sequence, Type procedure) {
2799      super();
2800      this.sequence = sequence;
2801      this.procedure = procedure;
2802    }
2803
2804    /**
2805     * @return {@link #sequence} (A number to uniquely identify procedure entries.).
2806     *         This is the underlying object with id, value and extensions. The
2807     *         accessor "getSequence" gives direct access to the value
2808     */
2809    public PositiveIntType getSequenceElement() {
2810      if (this.sequence == null)
2811        if (Configuration.errorOnAutoCreate())
2812          throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2813        else if (Configuration.doAutoCreate())
2814          this.sequence = new PositiveIntType(); // bb
2815      return this.sequence;
2816    }
2817
2818    public boolean hasSequenceElement() {
2819      return this.sequence != null && !this.sequence.isEmpty();
2820    }
2821
2822    public boolean hasSequence() {
2823      return this.sequence != null && !this.sequence.isEmpty();
2824    }
2825
2826    /**
2827     * @param value {@link #sequence} (A number to uniquely identify procedure
2828     *              entries.). This is the underlying object with id, value and
2829     *              extensions. The accessor "getSequence" gives direct access to
2830     *              the value
2831     */
2832    public ProcedureComponent setSequenceElement(PositiveIntType value) {
2833      this.sequence = value;
2834      return this;
2835    }
2836
2837    /**
2838     * @return A number to uniquely identify procedure entries.
2839     */
2840    public int getSequence() {
2841      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2842    }
2843
2844    /**
2845     * @param value A number to uniquely identify procedure entries.
2846     */
2847    public ProcedureComponent setSequence(int value) {
2848      if (this.sequence == null)
2849        this.sequence = new PositiveIntType();
2850      this.sequence.setValue(value);
2851      return this;
2852    }
2853
2854    /**
2855     * @return {@link #type} (When the condition was observed or the relative
2856     *         ranking.)
2857     */
2858    public List<CodeableConcept> getType() {
2859      if (this.type == null)
2860        this.type = new ArrayList<CodeableConcept>();
2861      return this.type;
2862    }
2863
2864    /**
2865     * @return Returns a reference to <code>this</code> for easy method chaining
2866     */
2867    public ProcedureComponent setType(List<CodeableConcept> theType) {
2868      this.type = theType;
2869      return this;
2870    }
2871
2872    public boolean hasType() {
2873      if (this.type == null)
2874        return false;
2875      for (CodeableConcept item : this.type)
2876        if (!item.isEmpty())
2877          return true;
2878      return false;
2879    }
2880
2881    public CodeableConcept addType() { // 3
2882      CodeableConcept t = new CodeableConcept();
2883      if (this.type == null)
2884        this.type = new ArrayList<CodeableConcept>();
2885      this.type.add(t);
2886      return t;
2887    }
2888
2889    public ProcedureComponent addType(CodeableConcept t) { // 3
2890      if (t == null)
2891        return this;
2892      if (this.type == null)
2893        this.type = new ArrayList<CodeableConcept>();
2894      this.type.add(t);
2895      return this;
2896    }
2897
2898    /**
2899     * @return The first repetition of repeating field {@link #type}, creating it if
2900     *         it does not already exist
2901     */
2902    public CodeableConcept getTypeFirstRep() {
2903      if (getType().isEmpty()) {
2904        addType();
2905      }
2906      return getType().get(0);
2907    }
2908
2909    /**
2910     * @return {@link #date} (Date and optionally time the procedure was
2911     *         performed.). This is the underlying object with id, value and
2912     *         extensions. The accessor "getDate" gives direct access to the value
2913     */
2914    public DateTimeType getDateElement() {
2915      if (this.date == null)
2916        if (Configuration.errorOnAutoCreate())
2917          throw new Error("Attempt to auto-create ProcedureComponent.date");
2918        else if (Configuration.doAutoCreate())
2919          this.date = new DateTimeType(); // bb
2920      return this.date;
2921    }
2922
2923    public boolean hasDateElement() {
2924      return this.date != null && !this.date.isEmpty();
2925    }
2926
2927    public boolean hasDate() {
2928      return this.date != null && !this.date.isEmpty();
2929    }
2930
2931    /**
2932     * @param value {@link #date} (Date and optionally time the procedure was
2933     *              performed.). This is the underlying object with id, value and
2934     *              extensions. The accessor "getDate" gives direct access to the
2935     *              value
2936     */
2937    public ProcedureComponent setDateElement(DateTimeType value) {
2938      this.date = value;
2939      return this;
2940    }
2941
2942    /**
2943     * @return Date and optionally time the procedure was performed.
2944     */
2945    public Date getDate() {
2946      return this.date == null ? null : this.date.getValue();
2947    }
2948
2949    /**
2950     * @param value Date and optionally time the procedure was performed.
2951     */
2952    public ProcedureComponent setDate(Date value) {
2953      if (value == null)
2954        this.date = null;
2955      else {
2956        if (this.date == null)
2957          this.date = new DateTimeType();
2958        this.date.setValue(value);
2959      }
2960      return this;
2961    }
2962
2963    /**
2964     * @return {@link #procedure} (The code or reference to a Procedure resource
2965     *         which identifies the clinical intervention performed.)
2966     */
2967    public Type getProcedure() {
2968      return this.procedure;
2969    }
2970
2971    /**
2972     * @return {@link #procedure} (The code or reference to a Procedure resource
2973     *         which identifies the clinical intervention performed.)
2974     */
2975    public CodeableConcept getProcedureCodeableConcept() throws FHIRException {
2976      if (this.procedure == null)
2977        this.procedure = new CodeableConcept();
2978      if (!(this.procedure instanceof CodeableConcept))
2979        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
2980            + this.procedure.getClass().getName() + " was encountered");
2981      return (CodeableConcept) this.procedure;
2982    }
2983
2984    public boolean hasProcedureCodeableConcept() {
2985      return this != null && this.procedure instanceof CodeableConcept;
2986    }
2987
2988    /**
2989     * @return {@link #procedure} (The code or reference to a Procedure resource
2990     *         which identifies the clinical intervention performed.)
2991     */
2992    public Reference getProcedureReference() throws FHIRException {
2993      if (this.procedure == null)
2994        this.procedure = new Reference();
2995      if (!(this.procedure instanceof Reference))
2996        throw new FHIRException("Type mismatch: the type Reference was expected, but "
2997            + this.procedure.getClass().getName() + " was encountered");
2998      return (Reference) this.procedure;
2999    }
3000
3001    public boolean hasProcedureReference() {
3002      return this != null && this.procedure instanceof Reference;
3003    }
3004
3005    public boolean hasProcedure() {
3006      return this.procedure != null && !this.procedure.isEmpty();
3007    }
3008
3009    /**
3010     * @param value {@link #procedure} (The code or reference to a Procedure
3011     *              resource which identifies the clinical intervention performed.)
3012     */
3013    public ProcedureComponent setProcedure(Type value) {
3014      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
3015        throw new Error("Not the right type for ExplanationOfBenefit.procedure.procedure[x]: " + value.fhirType());
3016      this.procedure = value;
3017      return this;
3018    }
3019
3020    /**
3021     * @return {@link #udi} (Unique Device Identifiers associated with this line
3022     *         item.)
3023     */
3024    public List<Reference> getUdi() {
3025      if (this.udi == null)
3026        this.udi = new ArrayList<Reference>();
3027      return this.udi;
3028    }
3029
3030    /**
3031     * @return Returns a reference to <code>this</code> for easy method chaining
3032     */
3033    public ProcedureComponent setUdi(List<Reference> theUdi) {
3034      this.udi = theUdi;
3035      return this;
3036    }
3037
3038    public boolean hasUdi() {
3039      if (this.udi == null)
3040        return false;
3041      for (Reference item : this.udi)
3042        if (!item.isEmpty())
3043          return true;
3044      return false;
3045    }
3046
3047    public Reference addUdi() { // 3
3048      Reference t = new Reference();
3049      if (this.udi == null)
3050        this.udi = new ArrayList<Reference>();
3051      this.udi.add(t);
3052      return t;
3053    }
3054
3055    public ProcedureComponent addUdi(Reference t) { // 3
3056      if (t == null)
3057        return this;
3058      if (this.udi == null)
3059        this.udi = new ArrayList<Reference>();
3060      this.udi.add(t);
3061      return this;
3062    }
3063
3064    /**
3065     * @return The first repetition of repeating field {@link #udi}, creating it if
3066     *         it does not already exist
3067     */
3068    public Reference getUdiFirstRep() {
3069      if (getUdi().isEmpty()) {
3070        addUdi();
3071      }
3072      return getUdi().get(0);
3073    }
3074
3075    /**
3076     * @deprecated Use Reference#setResource(IBaseResource) instead
3077     */
3078    @Deprecated
3079    public List<Device> getUdiTarget() {
3080      if (this.udiTarget == null)
3081        this.udiTarget = new ArrayList<Device>();
3082      return this.udiTarget;
3083    }
3084
3085    /**
3086     * @deprecated Use Reference#setResource(IBaseResource) instead
3087     */
3088    @Deprecated
3089    public Device addUdiTarget() {
3090      Device r = new Device();
3091      if (this.udiTarget == null)
3092        this.udiTarget = new ArrayList<Device>();
3093      this.udiTarget.add(r);
3094      return r;
3095    }
3096
3097    protected void listChildren(List<Property> children) {
3098      super.listChildren(children);
3099      children.add(
3100          new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence));
3101      children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.",
3102          0, java.lang.Integer.MAX_VALUE, type));
3103      children
3104          .add(new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date));
3105      children.add(new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3106          "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3107          procedure));
3108      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
3109          0, java.lang.Integer.MAX_VALUE, udi));
3110    }
3111
3112    @Override
3113    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3114      switch (_hash) {
3115      case 1349547969:
3116        /* sequence */ return new Property("sequence", "positiveInt",
3117            "A number to uniquely identify procedure entries.", 0, 1, sequence);
3118      case 3575610:
3119        /* type */ return new Property("type", "CodeableConcept",
3120            "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
3121      case 3076014:
3122        /* date */ return new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0,
3123            1, date);
3124      case 1640074445:
3125        /* procedure[x] */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3126            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3127            procedure);
3128      case -1095204141:
3129        /* procedure */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3130            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3131            procedure);
3132      case -1284783026:
3133        /* procedureCodeableConcept */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3134            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3135            procedure);
3136      case 881809848:
3137        /* procedureReference */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3138            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3139            procedure);
3140      case 115642:
3141        /* udi */ return new Property("udi", "Reference(Device)",
3142            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
3143      default:
3144        return super.getNamedProperty(_hash, _name, _checkValid);
3145      }
3146
3147    }
3148
3149    @Override
3150    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3151      switch (hash) {
3152      case 1349547969:
3153        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
3154      case 3575610:
3155        /* type */ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
3156      case 3076014:
3157        /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateTimeType
3158      case -1095204141:
3159        /* procedure */ return this.procedure == null ? new Base[0] : new Base[] { this.procedure }; // Type
3160      case 115642:
3161        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
3162      default:
3163        return super.getProperty(hash, name, checkValid);
3164      }
3165
3166    }
3167
3168    @Override
3169    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3170      switch (hash) {
3171      case 1349547969: // sequence
3172        this.sequence = castToPositiveInt(value); // PositiveIntType
3173        return value;
3174      case 3575610: // type
3175        this.getType().add(castToCodeableConcept(value)); // CodeableConcept
3176        return value;
3177      case 3076014: // date
3178        this.date = castToDateTime(value); // DateTimeType
3179        return value;
3180      case -1095204141: // procedure
3181        this.procedure = castToType(value); // Type
3182        return value;
3183      case 115642: // udi
3184        this.getUdi().add(castToReference(value)); // Reference
3185        return value;
3186      default:
3187        return super.setProperty(hash, name, value);
3188      }
3189
3190    }
3191
3192    @Override
3193    public Base setProperty(String name, Base value) throws FHIRException {
3194      if (name.equals("sequence")) {
3195        this.sequence = castToPositiveInt(value); // PositiveIntType
3196      } else if (name.equals("type")) {
3197        this.getType().add(castToCodeableConcept(value));
3198      } else if (name.equals("date")) {
3199        this.date = castToDateTime(value); // DateTimeType
3200      } else if (name.equals("procedure[x]")) {
3201        this.procedure = castToType(value); // Type
3202      } else if (name.equals("udi")) {
3203        this.getUdi().add(castToReference(value));
3204      } else
3205        return super.setProperty(name, value);
3206      return value;
3207    }
3208
3209    @Override
3210    public Base makeProperty(int hash, String name) throws FHIRException {
3211      switch (hash) {
3212      case 1349547969:
3213        return getSequenceElement();
3214      case 3575610:
3215        return addType();
3216      case 3076014:
3217        return getDateElement();
3218      case 1640074445:
3219        return getProcedure();
3220      case -1095204141:
3221        return getProcedure();
3222      case 115642:
3223        return addUdi();
3224      default:
3225        return super.makeProperty(hash, name);
3226      }
3227
3228    }
3229
3230    @Override
3231    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3232      switch (hash) {
3233      case 1349547969:
3234        /* sequence */ return new String[] { "positiveInt" };
3235      case 3575610:
3236        /* type */ return new String[] { "CodeableConcept" };
3237      case 3076014:
3238        /* date */ return new String[] { "dateTime" };
3239      case -1095204141:
3240        /* procedure */ return new String[] { "CodeableConcept", "Reference" };
3241      case 115642:
3242        /* udi */ return new String[] { "Reference" };
3243      default:
3244        return super.getTypesForProperty(hash, name);
3245      }
3246
3247    }
3248
3249    @Override
3250    public Base addChild(String name) throws FHIRException {
3251      if (name.equals("sequence")) {
3252        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
3253      } else if (name.equals("type")) {
3254        return addType();
3255      } else if (name.equals("date")) {
3256        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.date");
3257      } else if (name.equals("procedureCodeableConcept")) {
3258        this.procedure = new CodeableConcept();
3259        return this.procedure;
3260      } else if (name.equals("procedureReference")) {
3261        this.procedure = new Reference();
3262        return this.procedure;
3263      } else if (name.equals("udi")) {
3264        return addUdi();
3265      } else
3266        return super.addChild(name);
3267    }
3268
3269    public ProcedureComponent copy() {
3270      ProcedureComponent dst = new ProcedureComponent();
3271      copyValues(dst);
3272      return dst;
3273    }
3274
3275    public void copyValues(ProcedureComponent dst) {
3276      super.copyValues(dst);
3277      dst.sequence = sequence == null ? null : sequence.copy();
3278      if (type != null) {
3279        dst.type = new ArrayList<CodeableConcept>();
3280        for (CodeableConcept i : type)
3281          dst.type.add(i.copy());
3282      }
3283      ;
3284      dst.date = date == null ? null : date.copy();
3285      dst.procedure = procedure == null ? null : procedure.copy();
3286      if (udi != null) {
3287        dst.udi = new ArrayList<Reference>();
3288        for (Reference i : udi)
3289          dst.udi.add(i.copy());
3290      }
3291      ;
3292    }
3293
3294    @Override
3295    public boolean equalsDeep(Base other_) {
3296      if (!super.equalsDeep(other_))
3297        return false;
3298      if (!(other_ instanceof ProcedureComponent))
3299        return false;
3300      ProcedureComponent o = (ProcedureComponent) other_;
3301      return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true)
3302          && compareDeep(date, o.date, true) && compareDeep(procedure, o.procedure, true)
3303          && compareDeep(udi, o.udi, true);
3304    }
3305
3306    @Override
3307    public boolean equalsShallow(Base other_) {
3308      if (!super.equalsShallow(other_))
3309        return false;
3310      if (!(other_ instanceof ProcedureComponent))
3311        return false;
3312      ProcedureComponent o = (ProcedureComponent) other_;
3313      return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
3314    }
3315
3316    public boolean isEmpty() {
3317      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, date, procedure, udi);
3318    }
3319
3320    public String fhirType() {
3321      return "ExplanationOfBenefit.procedure";
3322
3323    }
3324
3325  }
3326
3327  @Block()
3328  public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
3329    /**
3330     * A flag to indicate that this Coverage is to be used for adjudication of this
3331     * claim when set to true.
3332     */
3333    @Child(name = "focal", type = { BooleanType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
3334    @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.")
3335    protected BooleanType focal;
3336
3337    /**
3338     * Reference to the insurance card level information contained in the Coverage
3339     * resource. The coverage issuing insurer will use these details to locate the
3340     * patient's actual coverage within the insurer's information system.
3341     */
3342    @Child(name = "coverage", type = { Coverage.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
3343    @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.")
3344    protected Reference coverage;
3345
3346    /**
3347     * The actual object that is the target of the reference (Reference to the
3348     * insurance card level information contained in the Coverage resource. The
3349     * coverage issuing insurer will use these details to locate the patient's
3350     * actual coverage within the insurer's information system.)
3351     */
3352    protected Coverage coverageTarget;
3353
3354    /**
3355     * Reference numbers previously provided by the insurer to the provider to be
3356     * quoted on subsequent claims containing services or products related to the
3357     * prior authorization.
3358     */
3359    @Child(name = "preAuthRef", type = {
3360        StringType.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3361    @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.")
3362    protected List<StringType> preAuthRef;
3363
3364    private static final long serialVersionUID = -606383626L;
3365
3366    /**
3367     * Constructor
3368     */
3369    public InsuranceComponent() {
3370      super();
3371    }
3372
3373    /**
3374     * Constructor
3375     */
3376    public InsuranceComponent(BooleanType focal, Reference coverage) {
3377      super();
3378      this.focal = focal;
3379      this.coverage = coverage;
3380    }
3381
3382    /**
3383     * @return {@link #focal} (A flag to indicate that this Coverage is to be used
3384     *         for adjudication of this claim when set to true.). This is the
3385     *         underlying object with id, value and extensions. The accessor
3386     *         "getFocal" gives direct access to the value
3387     */
3388    public BooleanType getFocalElement() {
3389      if (this.focal == null)
3390        if (Configuration.errorOnAutoCreate())
3391          throw new Error("Attempt to auto-create InsuranceComponent.focal");
3392        else if (Configuration.doAutoCreate())
3393          this.focal = new BooleanType(); // bb
3394      return this.focal;
3395    }
3396
3397    public boolean hasFocalElement() {
3398      return this.focal != null && !this.focal.isEmpty();
3399    }
3400
3401    public boolean hasFocal() {
3402      return this.focal != null && !this.focal.isEmpty();
3403    }
3404
3405    /**
3406     * @param value {@link #focal} (A flag to indicate that this Coverage is to be
3407     *              used for adjudication of this claim when set to true.). This is
3408     *              the underlying object with id, value and extensions. The
3409     *              accessor "getFocal" gives direct access to the value
3410     */
3411    public InsuranceComponent setFocalElement(BooleanType value) {
3412      this.focal = value;
3413      return this;
3414    }
3415
3416    /**
3417     * @return A flag to indicate that this Coverage is to be used for adjudication
3418     *         of this claim when set to true.
3419     */
3420    public boolean getFocal() {
3421      return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
3422    }
3423
3424    /**
3425     * @param value A flag to indicate that this Coverage is to be used for
3426     *              adjudication of this claim when set to true.
3427     */
3428    public InsuranceComponent setFocal(boolean value) {
3429      if (this.focal == null)
3430        this.focal = new BooleanType();
3431      this.focal.setValue(value);
3432      return this;
3433    }
3434
3435    /**
3436     * @return {@link #coverage} (Reference to the insurance card level information
3437     *         contained in the Coverage resource. The coverage issuing insurer will
3438     *         use these details to locate the patient's actual coverage within the
3439     *         insurer's information system.)
3440     */
3441    public Reference getCoverage() {
3442      if (this.coverage == null)
3443        if (Configuration.errorOnAutoCreate())
3444          throw new Error("Attempt to auto-create InsuranceComponent.coverage");
3445        else if (Configuration.doAutoCreate())
3446          this.coverage = new Reference(); // cc
3447      return this.coverage;
3448    }
3449
3450    public boolean hasCoverage() {
3451      return this.coverage != null && !this.coverage.isEmpty();
3452    }
3453
3454    /**
3455     * @param value {@link #coverage} (Reference to the insurance card level
3456     *              information contained in the Coverage resource. The coverage
3457     *              issuing insurer will use these details to locate the patient's
3458     *              actual coverage within the insurer's information system.)
3459     */
3460    public InsuranceComponent setCoverage(Reference value) {
3461      this.coverage = value;
3462      return this;
3463    }
3464
3465    /**
3466     * @return {@link #coverage} The actual object that is the target of the
3467     *         reference. The reference library doesn't populate this, but you can
3468     *         use it to hold the resource if you resolve it. (Reference to the
3469     *         insurance card level information contained in the Coverage resource.
3470     *         The coverage issuing insurer will use these details to locate the
3471     *         patient's actual coverage within the insurer's information system.)
3472     */
3473    public Coverage getCoverageTarget() {
3474      if (this.coverageTarget == null)
3475        if (Configuration.errorOnAutoCreate())
3476          throw new Error("Attempt to auto-create InsuranceComponent.coverage");
3477        else if (Configuration.doAutoCreate())
3478          this.coverageTarget = new Coverage(); // aa
3479      return this.coverageTarget;
3480    }
3481
3482    /**
3483     * @param value {@link #coverage} The actual object that is the target of the
3484     *              reference. The reference library doesn't use these, but you can
3485     *              use it to hold the resource if you resolve it. (Reference to the
3486     *              insurance card level information contained in the Coverage
3487     *              resource. The coverage issuing insurer will use these details to
3488     *              locate the patient's actual coverage within the insurer's
3489     *              information system.)
3490     */
3491    public InsuranceComponent setCoverageTarget(Coverage value) {
3492      this.coverageTarget = value;
3493      return this;
3494    }
3495
3496    /**
3497     * @return {@link #preAuthRef} (Reference numbers previously provided by the
3498     *         insurer to the provider to be quoted on subsequent claims containing
3499     *         services or products related to the prior authorization.)
3500     */
3501    public List<StringType> getPreAuthRef() {
3502      if (this.preAuthRef == null)
3503        this.preAuthRef = new ArrayList<StringType>();
3504      return this.preAuthRef;
3505    }
3506
3507    /**
3508     * @return Returns a reference to <code>this</code> for easy method chaining
3509     */
3510    public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) {
3511      this.preAuthRef = thePreAuthRef;
3512      return this;
3513    }
3514
3515    public boolean hasPreAuthRef() {
3516      if (this.preAuthRef == null)
3517        return false;
3518      for (StringType item : this.preAuthRef)
3519        if (!item.isEmpty())
3520          return true;
3521      return false;
3522    }
3523
3524    /**
3525     * @return {@link #preAuthRef} (Reference numbers previously provided by the
3526     *         insurer to the provider to be quoted on subsequent claims containing
3527     *         services or products related to the prior authorization.)
3528     */
3529    public StringType addPreAuthRefElement() {// 2
3530      StringType t = new StringType();
3531      if (this.preAuthRef == null)
3532        this.preAuthRef = new ArrayList<StringType>();
3533      this.preAuthRef.add(t);
3534      return t;
3535    }
3536
3537    /**
3538     * @param value {@link #preAuthRef} (Reference numbers previously provided by
3539     *              the insurer to the provider to be quoted on subsequent claims
3540     *              containing services or products related to the prior
3541     *              authorization.)
3542     */
3543    public InsuranceComponent addPreAuthRef(String value) { // 1
3544      StringType t = new StringType();
3545      t.setValue(value);
3546      if (this.preAuthRef == null)
3547        this.preAuthRef = new ArrayList<StringType>();
3548      this.preAuthRef.add(t);
3549      return this;
3550    }
3551
3552    /**
3553     * @param value {@link #preAuthRef} (Reference numbers previously provided by
3554     *              the insurer to the provider to be quoted on subsequent claims
3555     *              containing services or products related to the prior
3556     *              authorization.)
3557     */
3558    public boolean hasPreAuthRef(String value) {
3559      if (this.preAuthRef == null)
3560        return false;
3561      for (StringType v : this.preAuthRef)
3562        if (v.getValue().equals(value)) // string
3563          return true;
3564      return false;
3565    }
3566
3567    protected void listChildren(List<Property> children) {
3568      super.listChildren(children);
3569      children.add(new Property("focal", "boolean",
3570          "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.", 0, 1,
3571          focal));
3572      children.add(new Property("coverage", "Reference(Coverage)",
3573          "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.",
3574          0, 1, coverage));
3575      children.add(new Property("preAuthRef", "string",
3576          "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.",
3577          0, java.lang.Integer.MAX_VALUE, preAuthRef));
3578    }
3579
3580    @Override
3581    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3582      switch (_hash) {
3583      case 97604197:
3584        /* focal */ return new Property("focal", "boolean",
3585            "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.", 0,
3586            1, focal);
3587      case -351767064:
3588        /* coverage */ return new Property("coverage", "Reference(Coverage)",
3589            "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.",
3590            0, 1, coverage);
3591      case 522246568:
3592        /* preAuthRef */ return new Property("preAuthRef", "string",
3593            "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.",
3594            0, java.lang.Integer.MAX_VALUE, preAuthRef);
3595      default:
3596        return super.getNamedProperty(_hash, _name, _checkValid);
3597      }
3598
3599    }
3600
3601    @Override
3602    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3603      switch (hash) {
3604      case 97604197:
3605        /* focal */ return this.focal == null ? new Base[0] : new Base[] { this.focal }; // BooleanType
3606      case -351767064:
3607        /* coverage */ return this.coverage == null ? new Base[0] : new Base[] { this.coverage }; // Reference
3608      case 522246568:
3609        /* preAuthRef */ return this.preAuthRef == null ? new Base[0]
3610            : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
3611      default:
3612        return super.getProperty(hash, name, checkValid);
3613      }
3614
3615    }
3616
3617    @Override
3618    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3619      switch (hash) {
3620      case 97604197: // focal
3621        this.focal = castToBoolean(value); // BooleanType
3622        return value;
3623      case -351767064: // coverage
3624        this.coverage = castToReference(value); // Reference
3625        return value;
3626      case 522246568: // preAuthRef
3627        this.getPreAuthRef().add(castToString(value)); // StringType
3628        return value;
3629      default:
3630        return super.setProperty(hash, name, value);
3631      }
3632
3633    }
3634
3635    @Override
3636    public Base setProperty(String name, Base value) throws FHIRException {
3637      if (name.equals("focal")) {
3638        this.focal = castToBoolean(value); // BooleanType
3639      } else if (name.equals("coverage")) {
3640        this.coverage = castToReference(value); // Reference
3641      } else if (name.equals("preAuthRef")) {
3642        this.getPreAuthRef().add(castToString(value));
3643      } else
3644        return super.setProperty(name, value);
3645      return value;
3646    }
3647
3648    @Override
3649    public Base makeProperty(int hash, String name) throws FHIRException {
3650      switch (hash) {
3651      case 97604197:
3652        return getFocalElement();
3653      case -351767064:
3654        return getCoverage();
3655      case 522246568:
3656        return addPreAuthRefElement();
3657      default:
3658        return super.makeProperty(hash, name);
3659      }
3660
3661    }
3662
3663    @Override
3664    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3665      switch (hash) {
3666      case 97604197:
3667        /* focal */ return new String[] { "boolean" };
3668      case -351767064:
3669        /* coverage */ return new String[] { "Reference" };
3670      case 522246568:
3671        /* preAuthRef */ return new String[] { "string" };
3672      default:
3673        return super.getTypesForProperty(hash, name);
3674      }
3675
3676    }
3677
3678    @Override
3679    public Base addChild(String name) throws FHIRException {
3680      if (name.equals("focal")) {
3681        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.focal");
3682      } else if (name.equals("coverage")) {
3683        this.coverage = new Reference();
3684        return this.coverage;
3685      } else if (name.equals("preAuthRef")) {
3686        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.preAuthRef");
3687      } else
3688        return super.addChild(name);
3689    }
3690
3691    public InsuranceComponent copy() {
3692      InsuranceComponent dst = new InsuranceComponent();
3693      copyValues(dst);
3694      return dst;
3695    }
3696
3697    public void copyValues(InsuranceComponent dst) {
3698      super.copyValues(dst);
3699      dst.focal = focal == null ? null : focal.copy();
3700      dst.coverage = coverage == null ? null : coverage.copy();
3701      if (preAuthRef != null) {
3702        dst.preAuthRef = new ArrayList<StringType>();
3703        for (StringType i : preAuthRef)
3704          dst.preAuthRef.add(i.copy());
3705      }
3706      ;
3707    }
3708
3709    @Override
3710    public boolean equalsDeep(Base other_) {
3711      if (!super.equalsDeep(other_))
3712        return false;
3713      if (!(other_ instanceof InsuranceComponent))
3714        return false;
3715      InsuranceComponent o = (InsuranceComponent) other_;
3716      return compareDeep(focal, o.focal, true) && compareDeep(coverage, o.coverage, true)
3717          && compareDeep(preAuthRef, o.preAuthRef, true);
3718    }
3719
3720    @Override
3721    public boolean equalsShallow(Base other_) {
3722      if (!super.equalsShallow(other_))
3723        return false;
3724      if (!(other_ instanceof InsuranceComponent))
3725        return false;
3726      InsuranceComponent o = (InsuranceComponent) other_;
3727      return compareValues(focal, o.focal, true) && compareValues(preAuthRef, o.preAuthRef, true);
3728    }
3729
3730    public boolean isEmpty() {
3731      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(focal, coverage, preAuthRef);
3732    }
3733
3734    public String fhirType() {
3735      return "ExplanationOfBenefit.insurance";
3736
3737    }
3738
3739  }
3740
3741  @Block()
3742  public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
3743    /**
3744     * Date of an accident event related to the products and services contained in
3745     * the claim.
3746     */
3747    @Child(name = "date", type = { DateType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
3748    @Description(shortDefinition = "When the incident occurred", formalDefinition = "Date of an accident event  related to the products and services contained in the claim.")
3749    protected DateType date;
3750
3751    /**
3752     * The type or context of the accident event for the purposes of selection of
3753     * potential insurance coverages and determination of coordination between
3754     * insurers.
3755     */
3756    @Child(name = "type", type = {
3757        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
3758    @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.")
3759    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://terminology.hl7.org/ValueSet/v3-ActIncidentCode")
3760    protected CodeableConcept type;
3761
3762    /**
3763     * The physical location of the accident event.
3764     */
3765    @Child(name = "location", type = { Address.class,
3766        Location.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
3767    @Description(shortDefinition = "Where the event occurred", formalDefinition = "The physical location of the accident event.")
3768    protected Type location;
3769
3770    private static final long serialVersionUID = 622904984L;
3771
3772    /**
3773     * Constructor
3774     */
3775    public AccidentComponent() {
3776      super();
3777    }
3778
3779    /**
3780     * @return {@link #date} (Date of an accident event related to the products and
3781     *         services contained in the claim.). This is the underlying object with
3782     *         id, value and extensions. The accessor "getDate" gives direct access
3783     *         to the value
3784     */
3785    public DateType getDateElement() {
3786      if (this.date == null)
3787        if (Configuration.errorOnAutoCreate())
3788          throw new Error("Attempt to auto-create AccidentComponent.date");
3789        else if (Configuration.doAutoCreate())
3790          this.date = new DateType(); // bb
3791      return this.date;
3792    }
3793
3794    public boolean hasDateElement() {
3795      return this.date != null && !this.date.isEmpty();
3796    }
3797
3798    public boolean hasDate() {
3799      return this.date != null && !this.date.isEmpty();
3800    }
3801
3802    /**
3803     * @param value {@link #date} (Date of an accident event related to the products
3804     *              and services contained in the claim.). This is the underlying
3805     *              object with id, value and extensions. The accessor "getDate"
3806     *              gives direct access to the value
3807     */
3808    public AccidentComponent setDateElement(DateType value) {
3809      this.date = value;
3810      return this;
3811    }
3812
3813    /**
3814     * @return Date of an accident event related to the products and services
3815     *         contained in the claim.
3816     */
3817    public Date getDate() {
3818      return this.date == null ? null : this.date.getValue();
3819    }
3820
3821    /**
3822     * @param value Date of an accident event related to the products and services
3823     *              contained in the claim.
3824     */
3825    public AccidentComponent setDate(Date value) {
3826      if (value == null)
3827        this.date = null;
3828      else {
3829        if (this.date == null)
3830          this.date = new DateType();
3831        this.date.setValue(value);
3832      }
3833      return this;
3834    }
3835
3836    /**
3837     * @return {@link #type} (The type or context of the accident event for the
3838     *         purposes of selection of potential insurance coverages and
3839     *         determination of coordination between insurers.)
3840     */
3841    public CodeableConcept getType() {
3842      if (this.type == null)
3843        if (Configuration.errorOnAutoCreate())
3844          throw new Error("Attempt to auto-create AccidentComponent.type");
3845        else if (Configuration.doAutoCreate())
3846          this.type = new CodeableConcept(); // cc
3847      return this.type;
3848    }
3849
3850    public boolean hasType() {
3851      return this.type != null && !this.type.isEmpty();
3852    }
3853
3854    /**
3855     * @param value {@link #type} (The type or context of the accident event for the
3856     *              purposes of selection of potential insurance coverages and
3857     *              determination of coordination between insurers.)
3858     */
3859    public AccidentComponent setType(CodeableConcept value) {
3860      this.type = value;
3861      return this;
3862    }
3863
3864    /**
3865     * @return {@link #location} (The physical location of the accident event.)
3866     */
3867    public Type getLocation() {
3868      return this.location;
3869    }
3870
3871    /**
3872     * @return {@link #location} (The physical location of the accident event.)
3873     */
3874    public Address getLocationAddress() throws FHIRException {
3875      if (this.location == null)
3876        this.location = new Address();
3877      if (!(this.location instanceof Address))
3878        throw new FHIRException("Type mismatch: the type Address was expected, but "
3879            + this.location.getClass().getName() + " was encountered");
3880      return (Address) this.location;
3881    }
3882
3883    public boolean hasLocationAddress() {
3884      return this != null && this.location instanceof Address;
3885    }
3886
3887    /**
3888     * @return {@link #location} (The physical location of the accident event.)
3889     */
3890    public Reference getLocationReference() throws FHIRException {
3891      if (this.location == null)
3892        this.location = new Reference();
3893      if (!(this.location instanceof Reference))
3894        throw new FHIRException("Type mismatch: the type Reference was expected, but "
3895            + this.location.getClass().getName() + " was encountered");
3896      return (Reference) this.location;
3897    }
3898
3899    public boolean hasLocationReference() {
3900      return this != null && this.location instanceof Reference;
3901    }
3902
3903    public boolean hasLocation() {
3904      return this.location != null && !this.location.isEmpty();
3905    }
3906
3907    /**
3908     * @param value {@link #location} (The physical location of the accident event.)
3909     */
3910    public AccidentComponent setLocation(Type value) {
3911      if (value != null && !(value instanceof Address || value instanceof Reference))
3912        throw new Error("Not the right type for ExplanationOfBenefit.accident.location[x]: " + value.fhirType());
3913      this.location = value;
3914      return this;
3915    }
3916
3917    protected void listChildren(List<Property> children) {
3918      super.listChildren(children);
3919      children.add(new Property("date", "date",
3920          "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date));
3921      children.add(new Property("type", "CodeableConcept",
3922          "The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.",
3923          0, 1, type));
3924      children.add(new Property("location[x]", "Address|Reference(Location)",
3925          "The physical location of the accident event.", 0, 1, location));
3926    }
3927
3928    @Override
3929    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3930      switch (_hash) {
3931      case 3076014:
3932        /* date */ return new Property("date", "date",
3933            "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date);
3934      case 3575610:
3935        /* type */ return new Property("type", "CodeableConcept",
3936            "The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.",
3937            0, 1, type);
3938      case 552316075:
3939        /* location[x] */ return new Property("location[x]", "Address|Reference(Location)",
3940            "The physical location of the accident event.", 0, 1, location);
3941      case 1901043637:
3942        /* location */ return new Property("location[x]", "Address|Reference(Location)",
3943            "The physical location of the accident event.", 0, 1, location);
3944      case -1280020865:
3945        /* locationAddress */ return new Property("location[x]", "Address|Reference(Location)",
3946            "The physical location of the accident event.", 0, 1, location);
3947      case 755866390:
3948        /* locationReference */ return new Property("location[x]", "Address|Reference(Location)",
3949            "The physical location of the accident event.", 0, 1, location);
3950      default:
3951        return super.getNamedProperty(_hash, _name, _checkValid);
3952      }
3953
3954    }
3955
3956    @Override
3957    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3958      switch (hash) {
3959      case 3076014:
3960        /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateType
3961      case 3575610:
3962        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
3963      case 1901043637:
3964        /* location */ return this.location == null ? new Base[0] : new Base[] { this.location }; // Type
3965      default:
3966        return super.getProperty(hash, name, checkValid);
3967      }
3968
3969    }
3970
3971    @Override
3972    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3973      switch (hash) {
3974      case 3076014: // date
3975        this.date = castToDate(value); // DateType
3976        return value;
3977      case 3575610: // type
3978        this.type = castToCodeableConcept(value); // CodeableConcept
3979        return value;
3980      case 1901043637: // location
3981        this.location = castToType(value); // Type
3982        return value;
3983      default:
3984        return super.setProperty(hash, name, value);
3985      }
3986
3987    }
3988
3989    @Override
3990    public Base setProperty(String name, Base value) throws FHIRException {
3991      if (name.equals("date")) {
3992        this.date = castToDate(value); // DateType
3993      } else if (name.equals("type")) {
3994        this.type = castToCodeableConcept(value); // CodeableConcept
3995      } else if (name.equals("location[x]")) {
3996        this.location = castToType(value); // Type
3997      } else
3998        return super.setProperty(name, value);
3999      return value;
4000    }
4001
4002    @Override
4003    public Base makeProperty(int hash, String name) throws FHIRException {
4004      switch (hash) {
4005      case 3076014:
4006        return getDateElement();
4007      case 3575610:
4008        return getType();
4009      case 552316075:
4010        return getLocation();
4011      case 1901043637:
4012        return getLocation();
4013      default:
4014        return super.makeProperty(hash, name);
4015      }
4016
4017    }
4018
4019    @Override
4020    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4021      switch (hash) {
4022      case 3076014:
4023        /* date */ return new String[] { "date" };
4024      case 3575610:
4025        /* type */ return new String[] { "CodeableConcept" };
4026      case 1901043637:
4027        /* location */ return new String[] { "Address", "Reference" };
4028      default:
4029        return super.getTypesForProperty(hash, name);
4030      }
4031
4032    }
4033
4034    @Override
4035    public Base addChild(String name) throws FHIRException {
4036      if (name.equals("date")) {
4037        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.date");
4038      } else if (name.equals("type")) {
4039        this.type = new CodeableConcept();
4040        return this.type;
4041      } else if (name.equals("locationAddress")) {
4042        this.location = new Address();
4043        return this.location;
4044      } else if (name.equals("locationReference")) {
4045        this.location = new Reference();
4046        return this.location;
4047      } else
4048        return super.addChild(name);
4049    }
4050
4051    public AccidentComponent copy() {
4052      AccidentComponent dst = new AccidentComponent();
4053      copyValues(dst);
4054      return dst;
4055    }
4056
4057    public void copyValues(AccidentComponent dst) {
4058      super.copyValues(dst);
4059      dst.date = date == null ? null : date.copy();
4060      dst.type = type == null ? null : type.copy();
4061      dst.location = location == null ? null : location.copy();
4062    }
4063
4064    @Override
4065    public boolean equalsDeep(Base other_) {
4066      if (!super.equalsDeep(other_))
4067        return false;
4068      if (!(other_ instanceof AccidentComponent))
4069        return false;
4070      AccidentComponent o = (AccidentComponent) other_;
4071      return compareDeep(date, o.date, true) && compareDeep(type, o.type, true)
4072          && compareDeep(location, o.location, true);
4073    }
4074
4075    @Override
4076    public boolean equalsShallow(Base other_) {
4077      if (!super.equalsShallow(other_))
4078        return false;
4079      if (!(other_ instanceof AccidentComponent))
4080        return false;
4081      AccidentComponent o = (AccidentComponent) other_;
4082      return compareValues(date, o.date, true);
4083    }
4084
4085    public boolean isEmpty() {
4086      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
4087    }
4088
4089    public String fhirType() {
4090      return "ExplanationOfBenefit.accident";
4091
4092    }
4093
4094  }
4095
4096  @Block()
4097  public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
4098    /**
4099     * A number to uniquely identify item entries.
4100     */
4101    @Child(name = "sequence", type = {
4102        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
4103    @Description(shortDefinition = "Item instance identifier", formalDefinition = "A number to uniquely identify item entries.")
4104    protected PositiveIntType sequence;
4105
4106    /**
4107     * Care team members related to this service or product.
4108     */
4109    @Child(name = "careTeamSequence", type = {
4110        PositiveIntType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4111    @Description(shortDefinition = "Applicable care team members", formalDefinition = "Care team members related to this service or product.")
4112    protected List<PositiveIntType> careTeamSequence;
4113
4114    /**
4115     * Diagnoses applicable for this service or product.
4116     */
4117    @Child(name = "diagnosisSequence", type = {
4118        PositiveIntType.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4119    @Description(shortDefinition = "Applicable diagnoses", formalDefinition = "Diagnoses applicable for this service or product.")
4120    protected List<PositiveIntType> diagnosisSequence;
4121
4122    /**
4123     * Procedures applicable for this service or product.
4124     */
4125    @Child(name = "procedureSequence", type = {
4126        PositiveIntType.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4127    @Description(shortDefinition = "Applicable procedures", formalDefinition = "Procedures applicable for this service or product.")
4128    protected List<PositiveIntType> procedureSequence;
4129
4130    /**
4131     * Exceptions, special conditions and supporting information applicable for this
4132     * service or product.
4133     */
4134    @Child(name = "informationSequence", type = {
4135        PositiveIntType.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4136    @Description(shortDefinition = "Applicable exception and supporting information", formalDefinition = "Exceptions, special conditions and supporting information applicable for this service or product.")
4137    protected List<PositiveIntType> informationSequence;
4138
4139    /**
4140     * The type of revenue or cost center providing the product and/or service.
4141     */
4142    @Child(name = "revenue", type = {
4143        CodeableConcept.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
4144    @Description(shortDefinition = "Revenue or cost center code", formalDefinition = "The type of revenue or cost center providing the product and/or service.")
4145    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-revenue-center")
4146    protected CodeableConcept revenue;
4147
4148    /**
4149     * Code to identify the general type of benefits under which products and
4150     * services are provided.
4151     */
4152    @Child(name = "category", type = {
4153        CodeableConcept.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
4154    @Description(shortDefinition = "Benefit classification", formalDefinition = "Code to identify the general type of benefits under which products and services are provided.")
4155    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-benefitcategory")
4156    protected CodeableConcept category;
4157
4158    /**
4159     * When the value is a group code then this item collects a set of related claim
4160     * details, otherwise this contains the product, service, drug or other billing
4161     * code for the item.
4162     */
4163    @Child(name = "productOrService", type = {
4164        CodeableConcept.class }, order = 8, min = 1, max = 1, modifier = false, summary = false)
4165    @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.")
4166    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
4167    protected CodeableConcept productOrService;
4168
4169    /**
4170     * Item typification or modifiers codes to convey additional context for the
4171     * product or service.
4172     */
4173    @Child(name = "modifier", type = {
4174        CodeableConcept.class }, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4175    @Description(shortDefinition = "Product or service billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
4176    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
4177    protected List<CodeableConcept> modifier;
4178
4179    /**
4180     * Identifies the program under which this may be recovered.
4181     */
4182    @Child(name = "programCode", type = {
4183        CodeableConcept.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4184    @Description(shortDefinition = "Program the product or service is provided under", formalDefinition = "Identifies the program under which this may be recovered.")
4185    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-program-code")
4186    protected List<CodeableConcept> programCode;
4187
4188    /**
4189     * The date or dates when the service or product was supplied, performed or
4190     * completed.
4191     */
4192    @Child(name = "serviced", type = { DateType.class,
4193        Period.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
4194    @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.")
4195    protected Type serviced;
4196
4197    /**
4198     * Where the product or service was provided.
4199     */
4200    @Child(name = "location", type = { CodeableConcept.class, Address.class,
4201        Location.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
4202    @Description(shortDefinition = "Place of service or where product was supplied", formalDefinition = "Where the product or service was provided.")
4203    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-place")
4204    protected Type location;
4205
4206    /**
4207     * The number of repetitions of a service or product.
4208     */
4209    @Child(name = "quantity", type = {
4210        Quantity.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
4211    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
4212    protected Quantity quantity;
4213
4214    /**
4215     * If the item is not a group then this is the fee for the product or service,
4216     * otherwise this is the total of the fees for the details of the group.
4217     */
4218    @Child(name = "unitPrice", type = { Money.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
4219    @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.")
4220    protected Money unitPrice;
4221
4222    /**
4223     * A real number that represents a multiplier used in determining the overall
4224     * value of services delivered and/or goods received. The concept of a Factor
4225     * allows for a discount or surcharge multiplier to be applied to a monetary
4226     * amount.
4227     */
4228    @Child(name = "factor", type = {
4229        DecimalType.class }, order = 15, min = 0, max = 1, modifier = false, summary = false)
4230    @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.")
4231    protected DecimalType factor;
4232
4233    /**
4234     * The quantity times the unit price for an additional service or product or
4235     * charge.
4236     */
4237    @Child(name = "net", type = { Money.class }, order = 16, min = 0, max = 1, modifier = false, summary = false)
4238    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
4239    protected Money net;
4240
4241    /**
4242     * Unique Device Identifiers associated with this line item.
4243     */
4244    @Child(name = "udi", type = {
4245        Device.class }, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4246    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
4247    protected List<Reference> udi;
4248    /**
4249     * The actual objects that are the target of the reference (Unique Device
4250     * Identifiers associated with this line item.)
4251     */
4252    protected List<Device> udiTarget;
4253
4254    /**
4255     * Physical service site on the patient (limb, tooth, etc.).
4256     */
4257    @Child(name = "bodySite", type = {
4258        CodeableConcept.class }, order = 18, min = 0, max = 1, modifier = false, summary = false)
4259    @Description(shortDefinition = "Anatomical location", formalDefinition = "Physical service site on the patient (limb, tooth, etc.).")
4260    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/tooth")
4261    protected CodeableConcept bodySite;
4262
4263    /**
4264     * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
4265     */
4266    @Child(name = "subSite", type = {
4267        CodeableConcept.class }, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4268    @Description(shortDefinition = "Anatomical sub-location", formalDefinition = "A region or surface of the bodySite, e.g. limb region or tooth surface(s).")
4269    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/surface")
4270    protected List<CodeableConcept> subSite;
4271
4272    /**
4273     * A billed item may include goods or services provided in multiple encounters.
4274     */
4275    @Child(name = "encounter", type = {
4276        Encounter.class }, order = 20, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4277    @Description(shortDefinition = "Encounters related to this billed item", formalDefinition = "A billed item may include goods or services provided in multiple encounters.")
4278    protected List<Reference> encounter;
4279    /**
4280     * The actual objects that are the target of the reference (A billed item may
4281     * include goods or services provided in multiple encounters.)
4282     */
4283    protected List<Encounter> encounterTarget;
4284
4285    /**
4286     * The numbers associated with notes below which apply to the adjudication of
4287     * this item.
4288     */
4289    @Child(name = "noteNumber", type = {
4290        PositiveIntType.class }, order = 21, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4291    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
4292    protected List<PositiveIntType> noteNumber;
4293
4294    /**
4295     * If this item is a group then the values here are a summary of the
4296     * adjudication of the detail items. If this item is a simple product or service
4297     * then this is the result of the adjudication of this item.
4298     */
4299    @Child(name = "adjudication", type = {}, order = 22, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4300    @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.")
4301    protected List<AdjudicationComponent> adjudication;
4302
4303    /**
4304     * Second-tier of goods and services.
4305     */
4306    @Child(name = "detail", type = {}, order = 23, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4307    @Description(shortDefinition = "Additional items", formalDefinition = "Second-tier of goods and services.")
4308    protected List<DetailComponent> detail;
4309
4310    private static final long serialVersionUID = 67419471L;
4311
4312    /**
4313     * Constructor
4314     */
4315    public ItemComponent() {
4316      super();
4317    }
4318
4319    /**
4320     * Constructor
4321     */
4322    public ItemComponent(PositiveIntType sequence, CodeableConcept productOrService) {
4323      super();
4324      this.sequence = sequence;
4325      this.productOrService = productOrService;
4326    }
4327
4328    /**
4329     * @return {@link #sequence} (A number to uniquely identify item entries.). This
4330     *         is the underlying object with id, value and extensions. The accessor
4331     *         "getSequence" gives direct access to the value
4332     */
4333    public PositiveIntType getSequenceElement() {
4334      if (this.sequence == null)
4335        if (Configuration.errorOnAutoCreate())
4336          throw new Error("Attempt to auto-create ItemComponent.sequence");
4337        else if (Configuration.doAutoCreate())
4338          this.sequence = new PositiveIntType(); // bb
4339      return this.sequence;
4340    }
4341
4342    public boolean hasSequenceElement() {
4343      return this.sequence != null && !this.sequence.isEmpty();
4344    }
4345
4346    public boolean hasSequence() {
4347      return this.sequence != null && !this.sequence.isEmpty();
4348    }
4349
4350    /**
4351     * @param value {@link #sequence} (A number to uniquely identify item entries.).
4352     *              This is the underlying object with id, value and extensions. The
4353     *              accessor "getSequence" gives direct access to the value
4354     */
4355    public ItemComponent setSequenceElement(PositiveIntType value) {
4356      this.sequence = value;
4357      return this;
4358    }
4359
4360    /**
4361     * @return A number to uniquely identify item entries.
4362     */
4363    public int getSequence() {
4364      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
4365    }
4366
4367    /**
4368     * @param value A number to uniquely identify item entries.
4369     */
4370    public ItemComponent setSequence(int value) {
4371      if (this.sequence == null)
4372        this.sequence = new PositiveIntType();
4373      this.sequence.setValue(value);
4374      return this;
4375    }
4376
4377    /**
4378     * @return {@link #careTeamSequence} (Care team members related to this service
4379     *         or product.)
4380     */
4381    public List<PositiveIntType> getCareTeamSequence() {
4382      if (this.careTeamSequence == null)
4383        this.careTeamSequence = new ArrayList<PositiveIntType>();
4384      return this.careTeamSequence;
4385    }
4386
4387    /**
4388     * @return Returns a reference to <code>this</code> for easy method chaining
4389     */
4390    public ItemComponent setCareTeamSequence(List<PositiveIntType> theCareTeamSequence) {
4391      this.careTeamSequence = theCareTeamSequence;
4392      return this;
4393    }
4394
4395    public boolean hasCareTeamSequence() {
4396      if (this.careTeamSequence == null)
4397        return false;
4398      for (PositiveIntType item : this.careTeamSequence)
4399        if (!item.isEmpty())
4400          return true;
4401      return false;
4402    }
4403
4404    /**
4405     * @return {@link #careTeamSequence} (Care team members related to this service
4406     *         or product.)
4407     */
4408    public PositiveIntType addCareTeamSequenceElement() {// 2
4409      PositiveIntType t = new PositiveIntType();
4410      if (this.careTeamSequence == null)
4411        this.careTeamSequence = new ArrayList<PositiveIntType>();
4412      this.careTeamSequence.add(t);
4413      return t;
4414    }
4415
4416    /**
4417     * @param value {@link #careTeamSequence} (Care team members related to this
4418     *              service or product.)
4419     */
4420    public ItemComponent addCareTeamSequence(int value) { // 1
4421      PositiveIntType t = new PositiveIntType();
4422      t.setValue(value);
4423      if (this.careTeamSequence == null)
4424        this.careTeamSequence = new ArrayList<PositiveIntType>();
4425      this.careTeamSequence.add(t);
4426      return this;
4427    }
4428
4429    /**
4430     * @param value {@link #careTeamSequence} (Care team members related to this
4431     *              service or product.)
4432     */
4433    public boolean hasCareTeamSequence(int value) {
4434      if (this.careTeamSequence == null)
4435        return false;
4436      for (PositiveIntType v : this.careTeamSequence)
4437        if (v.getValue().equals(value)) // positiveInt
4438          return true;
4439      return false;
4440    }
4441
4442    /**
4443     * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or
4444     *         product.)
4445     */
4446    public List<PositiveIntType> getDiagnosisSequence() {
4447      if (this.diagnosisSequence == null)
4448        this.diagnosisSequence = new ArrayList<PositiveIntType>();
4449      return this.diagnosisSequence;
4450    }
4451
4452    /**
4453     * @return Returns a reference to <code>this</code> for easy method chaining
4454     */
4455    public ItemComponent setDiagnosisSequence(List<PositiveIntType> theDiagnosisSequence) {
4456      this.diagnosisSequence = theDiagnosisSequence;
4457      return this;
4458    }
4459
4460    public boolean hasDiagnosisSequence() {
4461      if (this.diagnosisSequence == null)
4462        return false;
4463      for (PositiveIntType item : this.diagnosisSequence)
4464        if (!item.isEmpty())
4465          return true;
4466      return false;
4467    }
4468
4469    /**
4470     * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or
4471     *         product.)
4472     */
4473    public PositiveIntType addDiagnosisSequenceElement() {// 2
4474      PositiveIntType t = new PositiveIntType();
4475      if (this.diagnosisSequence == null)
4476        this.diagnosisSequence = new ArrayList<PositiveIntType>();
4477      this.diagnosisSequence.add(t);
4478      return t;
4479    }
4480
4481    /**
4482     * @param value {@link #diagnosisSequence} (Diagnoses applicable for this
4483     *              service or product.)
4484     */
4485    public ItemComponent addDiagnosisSequence(int value) { // 1
4486      PositiveIntType t = new PositiveIntType();
4487      t.setValue(value);
4488      if (this.diagnosisSequence == null)
4489        this.diagnosisSequence = new ArrayList<PositiveIntType>();
4490      this.diagnosisSequence.add(t);
4491      return this;
4492    }
4493
4494    /**
4495     * @param value {@link #diagnosisSequence} (Diagnoses applicable for this
4496     *              service or product.)
4497     */
4498    public boolean hasDiagnosisSequence(int value) {
4499      if (this.diagnosisSequence == null)
4500        return false;
4501      for (PositiveIntType v : this.diagnosisSequence)
4502        if (v.getValue().equals(value)) // positiveInt
4503          return true;
4504      return false;
4505    }
4506
4507    /**
4508     * @return {@link #procedureSequence} (Procedures applicable for this service or
4509     *         product.)
4510     */
4511    public List<PositiveIntType> getProcedureSequence() {
4512      if (this.procedureSequence == null)
4513        this.procedureSequence = new ArrayList<PositiveIntType>();
4514      return this.procedureSequence;
4515    }
4516
4517    /**
4518     * @return Returns a reference to <code>this</code> for easy method chaining
4519     */
4520    public ItemComponent setProcedureSequence(List<PositiveIntType> theProcedureSequence) {
4521      this.procedureSequence = theProcedureSequence;
4522      return this;
4523    }
4524
4525    public boolean hasProcedureSequence() {
4526      if (this.procedureSequence == null)
4527        return false;
4528      for (PositiveIntType item : this.procedureSequence)
4529        if (!item.isEmpty())
4530          return true;
4531      return false;
4532    }
4533
4534    /**
4535     * @return {@link #procedureSequence} (Procedures applicable for this service or
4536     *         product.)
4537     */
4538    public PositiveIntType addProcedureSequenceElement() {// 2
4539      PositiveIntType t = new PositiveIntType();
4540      if (this.procedureSequence == null)
4541        this.procedureSequence = new ArrayList<PositiveIntType>();
4542      this.procedureSequence.add(t);
4543      return t;
4544    }
4545
4546    /**
4547     * @param value {@link #procedureSequence} (Procedures applicable for this
4548     *              service or product.)
4549     */
4550    public ItemComponent addProcedureSequence(int value) { // 1
4551      PositiveIntType t = new PositiveIntType();
4552      t.setValue(value);
4553      if (this.procedureSequence == null)
4554        this.procedureSequence = new ArrayList<PositiveIntType>();
4555      this.procedureSequence.add(t);
4556      return this;
4557    }
4558
4559    /**
4560     * @param value {@link #procedureSequence} (Procedures applicable for this
4561     *              service or product.)
4562     */
4563    public boolean hasProcedureSequence(int value) {
4564      if (this.procedureSequence == null)
4565        return false;
4566      for (PositiveIntType v : this.procedureSequence)
4567        if (v.getValue().equals(value)) // positiveInt
4568          return true;
4569      return false;
4570    }
4571
4572    /**
4573     * @return {@link #informationSequence} (Exceptions, special conditions and
4574     *         supporting information applicable for this service or product.)
4575     */
4576    public List<PositiveIntType> getInformationSequence() {
4577      if (this.informationSequence == null)
4578        this.informationSequence = new ArrayList<PositiveIntType>();
4579      return this.informationSequence;
4580    }
4581
4582    /**
4583     * @return Returns a reference to <code>this</code> for easy method chaining
4584     */
4585    public ItemComponent setInformationSequence(List<PositiveIntType> theInformationSequence) {
4586      this.informationSequence = theInformationSequence;
4587      return this;
4588    }
4589
4590    public boolean hasInformationSequence() {
4591      if (this.informationSequence == null)
4592        return false;
4593      for (PositiveIntType item : this.informationSequence)
4594        if (!item.isEmpty())
4595          return true;
4596      return false;
4597    }
4598
4599    /**
4600     * @return {@link #informationSequence} (Exceptions, special conditions and
4601     *         supporting information applicable for this service or product.)
4602     */
4603    public PositiveIntType addInformationSequenceElement() {// 2
4604      PositiveIntType t = new PositiveIntType();
4605      if (this.informationSequence == null)
4606        this.informationSequence = new ArrayList<PositiveIntType>();
4607      this.informationSequence.add(t);
4608      return t;
4609    }
4610
4611    /**
4612     * @param value {@link #informationSequence} (Exceptions, special conditions and
4613     *              supporting information applicable for this service or product.)
4614     */
4615    public ItemComponent addInformationSequence(int value) { // 1
4616      PositiveIntType t = new PositiveIntType();
4617      t.setValue(value);
4618      if (this.informationSequence == null)
4619        this.informationSequence = new ArrayList<PositiveIntType>();
4620      this.informationSequence.add(t);
4621      return this;
4622    }
4623
4624    /**
4625     * @param value {@link #informationSequence} (Exceptions, special conditions and
4626     *              supporting information applicable for this service or product.)
4627     */
4628    public boolean hasInformationSequence(int value) {
4629      if (this.informationSequence == null)
4630        return false;
4631      for (PositiveIntType v : this.informationSequence)
4632        if (v.getValue().equals(value)) // positiveInt
4633          return true;
4634      return false;
4635    }
4636
4637    /**
4638     * @return {@link #revenue} (The type of revenue or cost center providing the
4639     *         product and/or service.)
4640     */
4641    public CodeableConcept getRevenue() {
4642      if (this.revenue == null)
4643        if (Configuration.errorOnAutoCreate())
4644          throw new Error("Attempt to auto-create ItemComponent.revenue");
4645        else if (Configuration.doAutoCreate())
4646          this.revenue = new CodeableConcept(); // cc
4647      return this.revenue;
4648    }
4649
4650    public boolean hasRevenue() {
4651      return this.revenue != null && !this.revenue.isEmpty();
4652    }
4653
4654    /**
4655     * @param value {@link #revenue} (The type of revenue or cost center providing
4656     *              the product and/or service.)
4657     */
4658    public ItemComponent setRevenue(CodeableConcept value) {
4659      this.revenue = value;
4660      return this;
4661    }
4662
4663    /**
4664     * @return {@link #category} (Code to identify the general type of benefits
4665     *         under which products and services are provided.)
4666     */
4667    public CodeableConcept getCategory() {
4668      if (this.category == null)
4669        if (Configuration.errorOnAutoCreate())
4670          throw new Error("Attempt to auto-create ItemComponent.category");
4671        else if (Configuration.doAutoCreate())
4672          this.category = new CodeableConcept(); // cc
4673      return this.category;
4674    }
4675
4676    public boolean hasCategory() {
4677      return this.category != null && !this.category.isEmpty();
4678    }
4679
4680    /**
4681     * @param value {@link #category} (Code to identify the general type of benefits
4682     *              under which products and services are provided.)
4683     */
4684    public ItemComponent setCategory(CodeableConcept value) {
4685      this.category = value;
4686      return this;
4687    }
4688
4689    /**
4690     * @return {@link #productOrService} (When the value is a group code then this
4691     *         item collects a set of related claim details, otherwise this contains
4692     *         the product, service, drug or other billing code for the item.)
4693     */
4694    public CodeableConcept getProductOrService() {
4695      if (this.productOrService == null)
4696        if (Configuration.errorOnAutoCreate())
4697          throw new Error("Attempt to auto-create ItemComponent.productOrService");
4698        else if (Configuration.doAutoCreate())
4699          this.productOrService = new CodeableConcept(); // cc
4700      return this.productOrService;
4701    }
4702
4703    public boolean hasProductOrService() {
4704      return this.productOrService != null && !this.productOrService.isEmpty();
4705    }
4706
4707    /**
4708     * @param value {@link #productOrService} (When the value is a group code then
4709     *              this item collects a set of related claim details, otherwise
4710     *              this contains the product, service, drug or other billing code
4711     *              for the item.)
4712     */
4713    public ItemComponent setProductOrService(CodeableConcept value) {
4714      this.productOrService = value;
4715      return this;
4716    }
4717
4718    /**
4719     * @return {@link #modifier} (Item typification or modifiers codes to convey
4720     *         additional context for the product or service.)
4721     */
4722    public List<CodeableConcept> getModifier() {
4723      if (this.modifier == null)
4724        this.modifier = new ArrayList<CodeableConcept>();
4725      return this.modifier;
4726    }
4727
4728    /**
4729     * @return Returns a reference to <code>this</code> for easy method chaining
4730     */
4731    public ItemComponent setModifier(List<CodeableConcept> theModifier) {
4732      this.modifier = theModifier;
4733      return this;
4734    }
4735
4736    public boolean hasModifier() {
4737      if (this.modifier == null)
4738        return false;
4739      for (CodeableConcept item : this.modifier)
4740        if (!item.isEmpty())
4741          return true;
4742      return false;
4743    }
4744
4745    public CodeableConcept addModifier() { // 3
4746      CodeableConcept t = new CodeableConcept();
4747      if (this.modifier == null)
4748        this.modifier = new ArrayList<CodeableConcept>();
4749      this.modifier.add(t);
4750      return t;
4751    }
4752
4753    public ItemComponent addModifier(CodeableConcept t) { // 3
4754      if (t == null)
4755        return this;
4756      if (this.modifier == null)
4757        this.modifier = new ArrayList<CodeableConcept>();
4758      this.modifier.add(t);
4759      return this;
4760    }
4761
4762    /**
4763     * @return The first repetition of repeating field {@link #modifier}, creating
4764     *         it if it does not already exist
4765     */
4766    public CodeableConcept getModifierFirstRep() {
4767      if (getModifier().isEmpty()) {
4768        addModifier();
4769      }
4770      return getModifier().get(0);
4771    }
4772
4773    /**
4774     * @return {@link #programCode} (Identifies the program under which this may be
4775     *         recovered.)
4776     */
4777    public List<CodeableConcept> getProgramCode() {
4778      if (this.programCode == null)
4779        this.programCode = new ArrayList<CodeableConcept>();
4780      return this.programCode;
4781    }
4782
4783    /**
4784     * @return Returns a reference to <code>this</code> for easy method chaining
4785     */
4786    public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) {
4787      this.programCode = theProgramCode;
4788      return this;
4789    }
4790
4791    public boolean hasProgramCode() {
4792      if (this.programCode == null)
4793        return false;
4794      for (CodeableConcept item : this.programCode)
4795        if (!item.isEmpty())
4796          return true;
4797      return false;
4798    }
4799
4800    public CodeableConcept addProgramCode() { // 3
4801      CodeableConcept t = new CodeableConcept();
4802      if (this.programCode == null)
4803        this.programCode = new ArrayList<CodeableConcept>();
4804      this.programCode.add(t);
4805      return t;
4806    }
4807
4808    public ItemComponent addProgramCode(CodeableConcept t) { // 3
4809      if (t == null)
4810        return this;
4811      if (this.programCode == null)
4812        this.programCode = new ArrayList<CodeableConcept>();
4813      this.programCode.add(t);
4814      return this;
4815    }
4816
4817    /**
4818     * @return The first repetition of repeating field {@link #programCode},
4819     *         creating it if it does not already exist
4820     */
4821    public CodeableConcept getProgramCodeFirstRep() {
4822      if (getProgramCode().isEmpty()) {
4823        addProgramCode();
4824      }
4825      return getProgramCode().get(0);
4826    }
4827
4828    /**
4829     * @return {@link #serviced} (The date or dates when the service or product was
4830     *         supplied, performed or completed.)
4831     */
4832    public Type getServiced() {
4833      return this.serviced;
4834    }
4835
4836    /**
4837     * @return {@link #serviced} (The date or dates when the service or product was
4838     *         supplied, performed or completed.)
4839     */
4840    public DateType getServicedDateType() throws FHIRException {
4841      if (this.serviced == null)
4842        this.serviced = new DateType();
4843      if (!(this.serviced instanceof DateType))
4844        throw new FHIRException("Type mismatch: the type DateType was expected, but "
4845            + this.serviced.getClass().getName() + " was encountered");
4846      return (DateType) this.serviced;
4847    }
4848
4849    public boolean hasServicedDateType() {
4850      return this != null && this.serviced instanceof DateType;
4851    }
4852
4853    /**
4854     * @return {@link #serviced} (The date or dates when the service or product was
4855     *         supplied, performed or completed.)
4856     */
4857    public Period getServicedPeriod() throws FHIRException {
4858      if (this.serviced == null)
4859        this.serviced = new Period();
4860      if (!(this.serviced instanceof Period))
4861        throw new FHIRException("Type mismatch: the type Period was expected, but " + this.serviced.getClass().getName()
4862            + " was encountered");
4863      return (Period) this.serviced;
4864    }
4865
4866    public boolean hasServicedPeriod() {
4867      return this != null && this.serviced instanceof Period;
4868    }
4869
4870    public boolean hasServiced() {
4871      return this.serviced != null && !this.serviced.isEmpty();
4872    }
4873
4874    /**
4875     * @param value {@link #serviced} (The date or dates when the service or product
4876     *              was supplied, performed or completed.)
4877     */
4878    public ItemComponent setServiced(Type value) {
4879      if (value != null && !(value instanceof DateType || value instanceof Period))
4880        throw new Error("Not the right type for ExplanationOfBenefit.item.serviced[x]: " + value.fhirType());
4881      this.serviced = value;
4882      return this;
4883    }
4884
4885    /**
4886     * @return {@link #location} (Where the product or service was provided.)
4887     */
4888    public Type getLocation() {
4889      return this.location;
4890    }
4891
4892    /**
4893     * @return {@link #location} (Where the product or service was provided.)
4894     */
4895    public CodeableConcept getLocationCodeableConcept() throws FHIRException {
4896      if (this.location == null)
4897        this.location = new CodeableConcept();
4898      if (!(this.location instanceof CodeableConcept))
4899        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
4900            + this.location.getClass().getName() + " was encountered");
4901      return (CodeableConcept) this.location;
4902    }
4903
4904    public boolean hasLocationCodeableConcept() {
4905      return this != null && this.location instanceof CodeableConcept;
4906    }
4907
4908    /**
4909     * @return {@link #location} (Where the product or service was provided.)
4910     */
4911    public Address getLocationAddress() throws FHIRException {
4912      if (this.location == null)
4913        this.location = new Address();
4914      if (!(this.location instanceof Address))
4915        throw new FHIRException("Type mismatch: the type Address was expected, but "
4916            + this.location.getClass().getName() + " was encountered");
4917      return (Address) this.location;
4918    }
4919
4920    public boolean hasLocationAddress() {
4921      return this != null && this.location instanceof Address;
4922    }
4923
4924    /**
4925     * @return {@link #location} (Where the product or service was provided.)
4926     */
4927    public Reference getLocationReference() throws FHIRException {
4928      if (this.location == null)
4929        this.location = new Reference();
4930      if (!(this.location instanceof Reference))
4931        throw new FHIRException("Type mismatch: the type Reference was expected, but "
4932            + this.location.getClass().getName() + " was encountered");
4933      return (Reference) this.location;
4934    }
4935
4936    public boolean hasLocationReference() {
4937      return this != null && this.location instanceof Reference;
4938    }
4939
4940    public boolean hasLocation() {
4941      return this.location != null && !this.location.isEmpty();
4942    }
4943
4944    /**
4945     * @param value {@link #location} (Where the product or service was provided.)
4946     */
4947    public ItemComponent setLocation(Type value) {
4948      if (value != null
4949          && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
4950        throw new Error("Not the right type for ExplanationOfBenefit.item.location[x]: " + value.fhirType());
4951      this.location = value;
4952      return this;
4953    }
4954
4955    /**
4956     * @return {@link #quantity} (The number of repetitions of a service or
4957     *         product.)
4958     */
4959    public Quantity getQuantity() {
4960      if (this.quantity == null)
4961        if (Configuration.errorOnAutoCreate())
4962          throw new Error("Attempt to auto-create ItemComponent.quantity");
4963        else if (Configuration.doAutoCreate())
4964          this.quantity = new Quantity(); // cc
4965      return this.quantity;
4966    }
4967
4968    public boolean hasQuantity() {
4969      return this.quantity != null && !this.quantity.isEmpty();
4970    }
4971
4972    /**
4973     * @param value {@link #quantity} (The number of repetitions of a service or
4974     *              product.)
4975     */
4976    public ItemComponent setQuantity(Quantity value) {
4977      this.quantity = value;
4978      return this;
4979    }
4980
4981    /**
4982     * @return {@link #unitPrice} (If the item is not a group then this is the fee
4983     *         for the product or service, otherwise this is the total of the fees
4984     *         for the details of the group.)
4985     */
4986    public Money getUnitPrice() {
4987      if (this.unitPrice == null)
4988        if (Configuration.errorOnAutoCreate())
4989          throw new Error("Attempt to auto-create ItemComponent.unitPrice");
4990        else if (Configuration.doAutoCreate())
4991          this.unitPrice = new Money(); // cc
4992      return this.unitPrice;
4993    }
4994
4995    public boolean hasUnitPrice() {
4996      return this.unitPrice != null && !this.unitPrice.isEmpty();
4997    }
4998
4999    /**
5000     * @param value {@link #unitPrice} (If the item is not a group then this is the
5001     *              fee for the product or service, otherwise this is the total of
5002     *              the fees for the details of the group.)
5003     */
5004    public ItemComponent setUnitPrice(Money value) {
5005      this.unitPrice = value;
5006      return this;
5007    }
5008
5009    /**
5010     * @return {@link #factor} (A real number that represents a multiplier used in
5011     *         determining the overall value of services delivered and/or goods
5012     *         received. The concept of a Factor allows for a discount or surcharge
5013     *         multiplier to be applied to a monetary amount.). This is the
5014     *         underlying object with id, value and extensions. The accessor
5015     *         "getFactor" gives direct access to the value
5016     */
5017    public DecimalType getFactorElement() {
5018      if (this.factor == null)
5019        if (Configuration.errorOnAutoCreate())
5020          throw new Error("Attempt to auto-create ItemComponent.factor");
5021        else if (Configuration.doAutoCreate())
5022          this.factor = new DecimalType(); // bb
5023      return this.factor;
5024    }
5025
5026    public boolean hasFactorElement() {
5027      return this.factor != null && !this.factor.isEmpty();
5028    }
5029
5030    public boolean hasFactor() {
5031      return this.factor != null && !this.factor.isEmpty();
5032    }
5033
5034    /**
5035     * @param value {@link #factor} (A real number that represents a multiplier used
5036     *              in determining the overall value of services delivered and/or
5037     *              goods received. The concept of a Factor allows for a discount or
5038     *              surcharge multiplier to be applied to a monetary amount.). This
5039     *              is the underlying object with id, value and extensions. The
5040     *              accessor "getFactor" gives direct access to the value
5041     */
5042    public ItemComponent setFactorElement(DecimalType value) {
5043      this.factor = value;
5044      return this;
5045    }
5046
5047    /**
5048     * @return A real number that represents a multiplier used in determining the
5049     *         overall value of services delivered and/or goods received. The
5050     *         concept of a Factor allows for a discount or surcharge multiplier to
5051     *         be applied to a monetary amount.
5052     */
5053    public BigDecimal getFactor() {
5054      return this.factor == null ? null : this.factor.getValue();
5055    }
5056
5057    /**
5058     * @param value A real number that represents a multiplier used in determining
5059     *              the overall value of services delivered and/or goods received.
5060     *              The concept of a Factor allows for a discount or surcharge
5061     *              multiplier to be applied to a monetary amount.
5062     */
5063    public ItemComponent setFactor(BigDecimal value) {
5064      if (value == null)
5065        this.factor = null;
5066      else {
5067        if (this.factor == null)
5068          this.factor = new DecimalType();
5069        this.factor.setValue(value);
5070      }
5071      return this;
5072    }
5073
5074    /**
5075     * @param value A real number that represents a multiplier used in determining
5076     *              the overall value of services delivered and/or goods received.
5077     *              The concept of a Factor allows for a discount or surcharge
5078     *              multiplier to be applied to a monetary amount.
5079     */
5080    public ItemComponent setFactor(long value) {
5081      this.factor = new DecimalType();
5082      this.factor.setValue(value);
5083      return this;
5084    }
5085
5086    /**
5087     * @param value A real number that represents a multiplier used in determining
5088     *              the overall value of services delivered and/or goods received.
5089     *              The concept of a Factor allows for a discount or surcharge
5090     *              multiplier to be applied to a monetary amount.
5091     */
5092    public ItemComponent setFactor(double value) {
5093      this.factor = new DecimalType();
5094      this.factor.setValue(value);
5095      return this;
5096    }
5097
5098    /**
5099     * @return {@link #net} (The quantity times the unit price for an additional
5100     *         service or product or charge.)
5101     */
5102    public Money getNet() {
5103      if (this.net == null)
5104        if (Configuration.errorOnAutoCreate())
5105          throw new Error("Attempt to auto-create ItemComponent.net");
5106        else if (Configuration.doAutoCreate())
5107          this.net = new Money(); // cc
5108      return this.net;
5109    }
5110
5111    public boolean hasNet() {
5112      return this.net != null && !this.net.isEmpty();
5113    }
5114
5115    /**
5116     * @param value {@link #net} (The quantity times the unit price for an
5117     *              additional service or product or charge.)
5118     */
5119    public ItemComponent setNet(Money value) {
5120      this.net = value;
5121      return this;
5122    }
5123
5124    /**
5125     * @return {@link #udi} (Unique Device Identifiers associated with this line
5126     *         item.)
5127     */
5128    public List<Reference> getUdi() {
5129      if (this.udi == null)
5130        this.udi = new ArrayList<Reference>();
5131      return this.udi;
5132    }
5133
5134    /**
5135     * @return Returns a reference to <code>this</code> for easy method chaining
5136     */
5137    public ItemComponent setUdi(List<Reference> theUdi) {
5138      this.udi = theUdi;
5139      return this;
5140    }
5141
5142    public boolean hasUdi() {
5143      if (this.udi == null)
5144        return false;
5145      for (Reference item : this.udi)
5146        if (!item.isEmpty())
5147          return true;
5148      return false;
5149    }
5150
5151    public Reference addUdi() { // 3
5152      Reference t = new Reference();
5153      if (this.udi == null)
5154        this.udi = new ArrayList<Reference>();
5155      this.udi.add(t);
5156      return t;
5157    }
5158
5159    public ItemComponent addUdi(Reference t) { // 3
5160      if (t == null)
5161        return this;
5162      if (this.udi == null)
5163        this.udi = new ArrayList<Reference>();
5164      this.udi.add(t);
5165      return this;
5166    }
5167
5168    /**
5169     * @return The first repetition of repeating field {@link #udi}, creating it if
5170     *         it does not already exist
5171     */
5172    public Reference getUdiFirstRep() {
5173      if (getUdi().isEmpty()) {
5174        addUdi();
5175      }
5176      return getUdi().get(0);
5177    }
5178
5179    /**
5180     * @deprecated Use Reference#setResource(IBaseResource) instead
5181     */
5182    @Deprecated
5183    public List<Device> getUdiTarget() {
5184      if (this.udiTarget == null)
5185        this.udiTarget = new ArrayList<Device>();
5186      return this.udiTarget;
5187    }
5188
5189    /**
5190     * @deprecated Use Reference#setResource(IBaseResource) instead
5191     */
5192    @Deprecated
5193    public Device addUdiTarget() {
5194      Device r = new Device();
5195      if (this.udiTarget == null)
5196        this.udiTarget = new ArrayList<Device>();
5197      this.udiTarget.add(r);
5198      return r;
5199    }
5200
5201    /**
5202     * @return {@link #bodySite} (Physical service site on the patient (limb, tooth,
5203     *         etc.).)
5204     */
5205    public CodeableConcept getBodySite() {
5206      if (this.bodySite == null)
5207        if (Configuration.errorOnAutoCreate())
5208          throw new Error("Attempt to auto-create ItemComponent.bodySite");
5209        else if (Configuration.doAutoCreate())
5210          this.bodySite = new CodeableConcept(); // cc
5211      return this.bodySite;
5212    }
5213
5214    public boolean hasBodySite() {
5215      return this.bodySite != null && !this.bodySite.isEmpty();
5216    }
5217
5218    /**
5219     * @param value {@link #bodySite} (Physical service site on the patient (limb,
5220     *              tooth, etc.).)
5221     */
5222    public ItemComponent setBodySite(CodeableConcept value) {
5223      this.bodySite = value;
5224      return this;
5225    }
5226
5227    /**
5228     * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb
5229     *         region or tooth surface(s).)
5230     */
5231    public List<CodeableConcept> getSubSite() {
5232      if (this.subSite == null)
5233        this.subSite = new ArrayList<CodeableConcept>();
5234      return this.subSite;
5235    }
5236
5237    /**
5238     * @return Returns a reference to <code>this</code> for easy method chaining
5239     */
5240    public ItemComponent setSubSite(List<CodeableConcept> theSubSite) {
5241      this.subSite = theSubSite;
5242      return this;
5243    }
5244
5245    public boolean hasSubSite() {
5246      if (this.subSite == null)
5247        return false;
5248      for (CodeableConcept item : this.subSite)
5249        if (!item.isEmpty())
5250          return true;
5251      return false;
5252    }
5253
5254    public CodeableConcept addSubSite() { // 3
5255      CodeableConcept t = new CodeableConcept();
5256      if (this.subSite == null)
5257        this.subSite = new ArrayList<CodeableConcept>();
5258      this.subSite.add(t);
5259      return t;
5260    }
5261
5262    public ItemComponent addSubSite(CodeableConcept t) { // 3
5263      if (t == null)
5264        return this;
5265      if (this.subSite == null)
5266        this.subSite = new ArrayList<CodeableConcept>();
5267      this.subSite.add(t);
5268      return this;
5269    }
5270
5271    /**
5272     * @return The first repetition of repeating field {@link #subSite}, creating it
5273     *         if it does not already exist
5274     */
5275    public CodeableConcept getSubSiteFirstRep() {
5276      if (getSubSite().isEmpty()) {
5277        addSubSite();
5278      }
5279      return getSubSite().get(0);
5280    }
5281
5282    /**
5283     * @return {@link #encounter} (A billed item may include goods or services
5284     *         provided in multiple encounters.)
5285     */
5286    public List<Reference> getEncounter() {
5287      if (this.encounter == null)
5288        this.encounter = new ArrayList<Reference>();
5289      return this.encounter;
5290    }
5291
5292    /**
5293     * @return Returns a reference to <code>this</code> for easy method chaining
5294     */
5295    public ItemComponent setEncounter(List<Reference> theEncounter) {
5296      this.encounter = theEncounter;
5297      return this;
5298    }
5299
5300    public boolean hasEncounter() {
5301      if (this.encounter == null)
5302        return false;
5303      for (Reference item : this.encounter)
5304        if (!item.isEmpty())
5305          return true;
5306      return false;
5307    }
5308
5309    public Reference addEncounter() { // 3
5310      Reference t = new Reference();
5311      if (this.encounter == null)
5312        this.encounter = new ArrayList<Reference>();
5313      this.encounter.add(t);
5314      return t;
5315    }
5316
5317    public ItemComponent addEncounter(Reference t) { // 3
5318      if (t == null)
5319        return this;
5320      if (this.encounter == null)
5321        this.encounter = new ArrayList<Reference>();
5322      this.encounter.add(t);
5323      return this;
5324    }
5325
5326    /**
5327     * @return The first repetition of repeating field {@link #encounter}, creating
5328     *         it if it does not already exist
5329     */
5330    public Reference getEncounterFirstRep() {
5331      if (getEncounter().isEmpty()) {
5332        addEncounter();
5333      }
5334      return getEncounter().get(0);
5335    }
5336
5337    /**
5338     * @deprecated Use Reference#setResource(IBaseResource) instead
5339     */
5340    @Deprecated
5341    public List<Encounter> getEncounterTarget() {
5342      if (this.encounterTarget == null)
5343        this.encounterTarget = new ArrayList<Encounter>();
5344      return this.encounterTarget;
5345    }
5346
5347    /**
5348     * @deprecated Use Reference#setResource(IBaseResource) instead
5349     */
5350    @Deprecated
5351    public Encounter addEncounterTarget() {
5352      Encounter r = new Encounter();
5353      if (this.encounterTarget == null)
5354        this.encounterTarget = new ArrayList<Encounter>();
5355      this.encounterTarget.add(r);
5356      return r;
5357    }
5358
5359    /**
5360     * @return {@link #noteNumber} (The numbers associated with notes below which
5361     *         apply to the adjudication of this item.)
5362     */
5363    public List<PositiveIntType> getNoteNumber() {
5364      if (this.noteNumber == null)
5365        this.noteNumber = new ArrayList<PositiveIntType>();
5366      return this.noteNumber;
5367    }
5368
5369    /**
5370     * @return Returns a reference to <code>this</code> for easy method chaining
5371     */
5372    public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
5373      this.noteNumber = theNoteNumber;
5374      return this;
5375    }
5376
5377    public boolean hasNoteNumber() {
5378      if (this.noteNumber == null)
5379        return false;
5380      for (PositiveIntType item : this.noteNumber)
5381        if (!item.isEmpty())
5382          return true;
5383      return false;
5384    }
5385
5386    /**
5387     * @return {@link #noteNumber} (The numbers associated with notes below which
5388     *         apply to the adjudication of this item.)
5389     */
5390    public PositiveIntType addNoteNumberElement() {// 2
5391      PositiveIntType t = new PositiveIntType();
5392      if (this.noteNumber == null)
5393        this.noteNumber = new ArrayList<PositiveIntType>();
5394      this.noteNumber.add(t);
5395      return t;
5396    }
5397
5398    /**
5399     * @param value {@link #noteNumber} (The numbers associated with notes below
5400     *              which apply to the adjudication of this item.)
5401     */
5402    public ItemComponent addNoteNumber(int value) { // 1
5403      PositiveIntType t = new PositiveIntType();
5404      t.setValue(value);
5405      if (this.noteNumber == null)
5406        this.noteNumber = new ArrayList<PositiveIntType>();
5407      this.noteNumber.add(t);
5408      return this;
5409    }
5410
5411    /**
5412     * @param value {@link #noteNumber} (The numbers associated with notes below
5413     *              which apply to the adjudication of this item.)
5414     */
5415    public boolean hasNoteNumber(int value) {
5416      if (this.noteNumber == null)
5417        return false;
5418      for (PositiveIntType v : this.noteNumber)
5419        if (v.getValue().equals(value)) // positiveInt
5420          return true;
5421      return false;
5422    }
5423
5424    /**
5425     * @return {@link #adjudication} (If this item is a group then the values here
5426     *         are a summary of the adjudication of the detail items. If this item
5427     *         is a simple product or service then this is the result of the
5428     *         adjudication of this item.)
5429     */
5430    public List<AdjudicationComponent> getAdjudication() {
5431      if (this.adjudication == null)
5432        this.adjudication = new ArrayList<AdjudicationComponent>();
5433      return this.adjudication;
5434    }
5435
5436    /**
5437     * @return Returns a reference to <code>this</code> for easy method chaining
5438     */
5439    public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
5440      this.adjudication = theAdjudication;
5441      return this;
5442    }
5443
5444    public boolean hasAdjudication() {
5445      if (this.adjudication == null)
5446        return false;
5447      for (AdjudicationComponent item : this.adjudication)
5448        if (!item.isEmpty())
5449          return true;
5450      return false;
5451    }
5452
5453    public AdjudicationComponent addAdjudication() { // 3
5454      AdjudicationComponent t = new AdjudicationComponent();
5455      if (this.adjudication == null)
5456        this.adjudication = new ArrayList<AdjudicationComponent>();
5457      this.adjudication.add(t);
5458      return t;
5459    }
5460
5461    public ItemComponent addAdjudication(AdjudicationComponent t) { // 3
5462      if (t == null)
5463        return this;
5464      if (this.adjudication == null)
5465        this.adjudication = new ArrayList<AdjudicationComponent>();
5466      this.adjudication.add(t);
5467      return this;
5468    }
5469
5470    /**
5471     * @return The first repetition of repeating field {@link #adjudication},
5472     *         creating it if it does not already exist
5473     */
5474    public AdjudicationComponent getAdjudicationFirstRep() {
5475      if (getAdjudication().isEmpty()) {
5476        addAdjudication();
5477      }
5478      return getAdjudication().get(0);
5479    }
5480
5481    /**
5482     * @return {@link #detail} (Second-tier of goods and services.)
5483     */
5484    public List<DetailComponent> getDetail() {
5485      if (this.detail == null)
5486        this.detail = new ArrayList<DetailComponent>();
5487      return this.detail;
5488    }
5489
5490    /**
5491     * @return Returns a reference to <code>this</code> for easy method chaining
5492     */
5493    public ItemComponent setDetail(List<DetailComponent> theDetail) {
5494      this.detail = theDetail;
5495      return this;
5496    }
5497
5498    public boolean hasDetail() {
5499      if (this.detail == null)
5500        return false;
5501      for (DetailComponent item : this.detail)
5502        if (!item.isEmpty())
5503          return true;
5504      return false;
5505    }
5506
5507    public DetailComponent addDetail() { // 3
5508      DetailComponent t = new DetailComponent();
5509      if (this.detail == null)
5510        this.detail = new ArrayList<DetailComponent>();
5511      this.detail.add(t);
5512      return t;
5513    }
5514
5515    public ItemComponent addDetail(DetailComponent t) { // 3
5516      if (t == null)
5517        return this;
5518      if (this.detail == null)
5519        this.detail = new ArrayList<DetailComponent>();
5520      this.detail.add(t);
5521      return this;
5522    }
5523
5524    /**
5525     * @return The first repetition of repeating field {@link #detail}, creating it
5526     *         if it does not already exist
5527     */
5528    public DetailComponent getDetailFirstRep() {
5529      if (getDetail().isEmpty()) {
5530        addDetail();
5531      }
5532      return getDetail().get(0);
5533    }
5534
5535    protected void listChildren(List<Property> children) {
5536      super.listChildren(children);
5537      children
5538          .add(new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence));
5539      children.add(new Property("careTeamSequence", "positiveInt",
5540          "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence));
5541      children.add(new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.",
5542          0, java.lang.Integer.MAX_VALUE, diagnosisSequence));
5543      children.add(new Property("procedureSequence", "positiveInt",
5544          "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence));
5545      children.add(new Property("informationSequence", "positiveInt",
5546          "Exceptions, special conditions and supporting information applicable for this service or product.", 0,
5547          java.lang.Integer.MAX_VALUE, informationSequence));
5548      children.add(new Property("revenue", "CodeableConcept",
5549          "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
5550      children.add(new Property("category", "CodeableConcept",
5551          "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
5552          category));
5553      children.add(new Property("productOrService", "CodeableConcept",
5554          "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.",
5555          0, 1, productOrService));
5556      children.add(new Property("modifier", "CodeableConcept",
5557          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
5558          java.lang.Integer.MAX_VALUE, modifier));
5559      children.add(new Property("programCode", "CodeableConcept",
5560          "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
5561      children.add(new Property("serviced[x]", "date|Period",
5562          "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced));
5563      children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5564          "Where the product or service was provided.", 0, 1, location));
5565      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
5566          1, quantity));
5567      children.add(new Property("unitPrice", "Money",
5568          "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.",
5569          0, 1, unitPrice));
5570      children.add(new Property("factor", "decimal",
5571          "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.",
5572          0, 1, factor));
5573      children.add(new Property("net", "Money",
5574          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
5575      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
5576          0, java.lang.Integer.MAX_VALUE, udi));
5577      children.add(new Property("bodySite", "CodeableConcept",
5578          "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
5579      children.add(new Property("subSite", "CodeableConcept",
5580          "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE,
5581          subSite));
5582      children.add(new Property("encounter", "Reference(Encounter)",
5583          "A billed item may include goods or services provided in multiple encounters.", 0,
5584          java.lang.Integer.MAX_VALUE, encounter));
5585      children.add(new Property("noteNumber", "positiveInt",
5586          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
5587          java.lang.Integer.MAX_VALUE, noteNumber));
5588      children.add(new Property("adjudication", "",
5589          "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.",
5590          0, java.lang.Integer.MAX_VALUE, adjudication));
5591      children.add(
5592          new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
5593    }
5594
5595    @Override
5596    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5597      switch (_hash) {
5598      case 1349547969:
5599        /* sequence */ return new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0,
5600            1, sequence);
5601      case 1070083823:
5602        /* careTeamSequence */ return new Property("careTeamSequence", "positiveInt",
5603            "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence);
5604      case -909769262:
5605        /* diagnosisSequence */ return new Property("diagnosisSequence", "positiveInt",
5606            "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence);
5607      case -808920140:
5608        /* procedureSequence */ return new Property("procedureSequence", "positiveInt",
5609            "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence);
5610      case -702585587:
5611        /* informationSequence */ return new Property("informationSequence", "positiveInt",
5612            "Exceptions, special conditions and supporting information applicable for this service or product.", 0,
5613            java.lang.Integer.MAX_VALUE, informationSequence);
5614      case 1099842588:
5615        /* revenue */ return new Property("revenue", "CodeableConcept",
5616            "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
5617      case 50511102:
5618        /* category */ return new Property("category", "CodeableConcept",
5619            "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
5620            category);
5621      case 1957227299:
5622        /* productOrService */ return new Property("productOrService", "CodeableConcept",
5623            "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.",
5624            0, 1, productOrService);
5625      case -615513385:
5626        /* modifier */ return new Property("modifier", "CodeableConcept",
5627            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
5628            java.lang.Integer.MAX_VALUE, modifier);
5629      case 1010065041:
5630        /* programCode */ return new Property("programCode", "CodeableConcept",
5631            "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
5632      case -1927922223:
5633        /* serviced[x] */ return new Property("serviced[x]", "date|Period",
5634            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5635      case 1379209295:
5636        /* serviced */ return new Property("serviced[x]", "date|Period",
5637            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5638      case 363246749:
5639        /* servicedDate */ return new Property("serviced[x]", "date|Period",
5640            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5641      case 1534966512:
5642        /* servicedPeriod */ return new Property("serviced[x]", "date|Period",
5643            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5644      case 552316075:
5645        /* location[x] */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5646            "Where the product or service was provided.", 0, 1, location);
5647      case 1901043637:
5648        /* location */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5649            "Where the product or service was provided.", 0, 1, location);
5650      case -1224800468:
5651        /* locationCodeableConcept */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5652            "Where the product or service was provided.", 0, 1, location);
5653      case -1280020865:
5654        /* locationAddress */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5655            "Where the product or service was provided.", 0, 1, location);
5656      case 755866390:
5657        /* locationReference */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5658            "Where the product or service was provided.", 0, 1, location);
5659      case -1285004149:
5660        /* quantity */ return new Property("quantity", "SimpleQuantity",
5661            "The number of repetitions of a service or product.", 0, 1, quantity);
5662      case -486196699:
5663        /* unitPrice */ return new Property("unitPrice", "Money",
5664            "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.",
5665            0, 1, unitPrice);
5666      case -1282148017:
5667        /* factor */ return new Property("factor", "decimal",
5668            "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.",
5669            0, 1, factor);
5670      case 108957:
5671        /* net */ return new Property("net", "Money",
5672            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
5673      case 115642:
5674        /* udi */ return new Property("udi", "Reference(Device)",
5675            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
5676      case 1702620169:
5677        /* bodySite */ return new Property("bodySite", "CodeableConcept",
5678            "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
5679      case -1868566105:
5680        /* subSite */ return new Property("subSite", "CodeableConcept",
5681            "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0,
5682            java.lang.Integer.MAX_VALUE, subSite);
5683      case 1524132147:
5684        /* encounter */ return new Property("encounter", "Reference(Encounter)",
5685            "A billed item may include goods or services provided in multiple encounters.", 0,
5686            java.lang.Integer.MAX_VALUE, encounter);
5687      case -1110033957:
5688        /* noteNumber */ return new Property("noteNumber", "positiveInt",
5689            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
5690            java.lang.Integer.MAX_VALUE, noteNumber);
5691      case -231349275:
5692        /* adjudication */ return new Property("adjudication", "",
5693            "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.",
5694            0, java.lang.Integer.MAX_VALUE, adjudication);
5695      case -1335224239:
5696        /* detail */ return new Property("detail", "", "Second-tier of goods and services.", 0,
5697            java.lang.Integer.MAX_VALUE, detail);
5698      default:
5699        return super.getNamedProperty(_hash, _name, _checkValid);
5700      }
5701
5702    }
5703
5704    @Override
5705    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5706      switch (hash) {
5707      case 1349547969:
5708        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
5709      case 1070083823:
5710        /* careTeamSequence */ return this.careTeamSequence == null ? new Base[0]
5711            : this.careTeamSequence.toArray(new Base[this.careTeamSequence.size()]); // PositiveIntType
5712      case -909769262:
5713        /* diagnosisSequence */ return this.diagnosisSequence == null ? new Base[0]
5714            : this.diagnosisSequence.toArray(new Base[this.diagnosisSequence.size()]); // PositiveIntType
5715      case -808920140:
5716        /* procedureSequence */ return this.procedureSequence == null ? new Base[0]
5717            : this.procedureSequence.toArray(new Base[this.procedureSequence.size()]); // PositiveIntType
5718      case -702585587:
5719        /* informationSequence */ return this.informationSequence == null ? new Base[0]
5720            : this.informationSequence.toArray(new Base[this.informationSequence.size()]); // PositiveIntType
5721      case 1099842588:
5722        /* revenue */ return this.revenue == null ? new Base[0] : new Base[] { this.revenue }; // CodeableConcept
5723      case 50511102:
5724        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
5725      case 1957227299:
5726        /* productOrService */ return this.productOrService == null ? new Base[0]
5727            : new Base[] { this.productOrService }; // CodeableConcept
5728      case -615513385:
5729        /* modifier */ return this.modifier == null ? new Base[0]
5730            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
5731      case 1010065041:
5732        /* programCode */ return this.programCode == null ? new Base[0]
5733            : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
5734      case 1379209295:
5735        /* serviced */ return this.serviced == null ? new Base[0] : new Base[] { this.serviced }; // Type
5736      case 1901043637:
5737        /* location */ return this.location == null ? new Base[0] : new Base[] { this.location }; // Type
5738      case -1285004149:
5739        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
5740      case -486196699:
5741        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
5742      case -1282148017:
5743        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
5744      case 108957:
5745        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
5746      case 115642:
5747        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
5748      case 1702620169:
5749        /* bodySite */ return this.bodySite == null ? new Base[0] : new Base[] { this.bodySite }; // CodeableConcept
5750      case -1868566105:
5751        /* subSite */ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
5752      case 1524132147:
5753        /* encounter */ return this.encounter == null ? new Base[0]
5754            : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
5755      case -1110033957:
5756        /* noteNumber */ return this.noteNumber == null ? new Base[0]
5757            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
5758      case -231349275:
5759        /* adjudication */ return this.adjudication == null ? new Base[0]
5760            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
5761      case -1335224239:
5762        /* detail */ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
5763      default:
5764        return super.getProperty(hash, name, checkValid);
5765      }
5766
5767    }
5768
5769    @Override
5770    public Base setProperty(int hash, String name, Base value) throws FHIRException {
5771      switch (hash) {
5772      case 1349547969: // sequence
5773        this.sequence = castToPositiveInt(value); // PositiveIntType
5774        return value;
5775      case 1070083823: // careTeamSequence
5776        this.getCareTeamSequence().add(castToPositiveInt(value)); // PositiveIntType
5777        return value;
5778      case -909769262: // diagnosisSequence
5779        this.getDiagnosisSequence().add(castToPositiveInt(value)); // PositiveIntType
5780        return value;
5781      case -808920140: // procedureSequence
5782        this.getProcedureSequence().add(castToPositiveInt(value)); // PositiveIntType
5783        return value;
5784      case -702585587: // informationSequence
5785        this.getInformationSequence().add(castToPositiveInt(value)); // PositiveIntType
5786        return value;
5787      case 1099842588: // revenue
5788        this.revenue = castToCodeableConcept(value); // CodeableConcept
5789        return value;
5790      case 50511102: // category
5791        this.category = castToCodeableConcept(value); // CodeableConcept
5792        return value;
5793      case 1957227299: // productOrService
5794        this.productOrService = castToCodeableConcept(value); // CodeableConcept
5795        return value;
5796      case -615513385: // modifier
5797        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
5798        return value;
5799      case 1010065041: // programCode
5800        this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
5801        return value;
5802      case 1379209295: // serviced
5803        this.serviced = castToType(value); // Type
5804        return value;
5805      case 1901043637: // location
5806        this.location = castToType(value); // Type
5807        return value;
5808      case -1285004149: // quantity
5809        this.quantity = castToQuantity(value); // Quantity
5810        return value;
5811      case -486196699: // unitPrice
5812        this.unitPrice = castToMoney(value); // Money
5813        return value;
5814      case -1282148017: // factor
5815        this.factor = castToDecimal(value); // DecimalType
5816        return value;
5817      case 108957: // net
5818        this.net = castToMoney(value); // Money
5819        return value;
5820      case 115642: // udi
5821        this.getUdi().add(castToReference(value)); // Reference
5822        return value;
5823      case 1702620169: // bodySite
5824        this.bodySite = castToCodeableConcept(value); // CodeableConcept
5825        return value;
5826      case -1868566105: // subSite
5827        this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
5828        return value;
5829      case 1524132147: // encounter
5830        this.getEncounter().add(castToReference(value)); // Reference
5831        return value;
5832      case -1110033957: // noteNumber
5833        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
5834        return value;
5835      case -231349275: // adjudication
5836        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
5837        return value;
5838      case -1335224239: // detail
5839        this.getDetail().add((DetailComponent) value); // DetailComponent
5840        return value;
5841      default:
5842        return super.setProperty(hash, name, value);
5843      }
5844
5845    }
5846
5847    @Override
5848    public Base setProperty(String name, Base value) throws FHIRException {
5849      if (name.equals("sequence")) {
5850        this.sequence = castToPositiveInt(value); // PositiveIntType
5851      } else if (name.equals("careTeamSequence")) {
5852        this.getCareTeamSequence().add(castToPositiveInt(value));
5853      } else if (name.equals("diagnosisSequence")) {
5854        this.getDiagnosisSequence().add(castToPositiveInt(value));
5855      } else if (name.equals("procedureSequence")) {
5856        this.getProcedureSequence().add(castToPositiveInt(value));
5857      } else if (name.equals("informationSequence")) {
5858        this.getInformationSequence().add(castToPositiveInt(value));
5859      } else if (name.equals("revenue")) {
5860        this.revenue = castToCodeableConcept(value); // CodeableConcept
5861      } else if (name.equals("category")) {
5862        this.category = castToCodeableConcept(value); // CodeableConcept
5863      } else if (name.equals("productOrService")) {
5864        this.productOrService = castToCodeableConcept(value); // CodeableConcept
5865      } else if (name.equals("modifier")) {
5866        this.getModifier().add(castToCodeableConcept(value));
5867      } else if (name.equals("programCode")) {
5868        this.getProgramCode().add(castToCodeableConcept(value));
5869      } else if (name.equals("serviced[x]")) {
5870        this.serviced = castToType(value); // Type
5871      } else if (name.equals("location[x]")) {
5872        this.location = castToType(value); // Type
5873      } else if (name.equals("quantity")) {
5874        this.quantity = castToQuantity(value); // Quantity
5875      } else if (name.equals("unitPrice")) {
5876        this.unitPrice = castToMoney(value); // Money
5877      } else if (name.equals("factor")) {
5878        this.factor = castToDecimal(value); // DecimalType
5879      } else if (name.equals("net")) {
5880        this.net = castToMoney(value); // Money
5881      } else if (name.equals("udi")) {
5882        this.getUdi().add(castToReference(value));
5883      } else if (name.equals("bodySite")) {
5884        this.bodySite = castToCodeableConcept(value); // CodeableConcept
5885      } else if (name.equals("subSite")) {
5886        this.getSubSite().add(castToCodeableConcept(value));
5887      } else if (name.equals("encounter")) {
5888        this.getEncounter().add(castToReference(value));
5889      } else if (name.equals("noteNumber")) {
5890        this.getNoteNumber().add(castToPositiveInt(value));
5891      } else if (name.equals("adjudication")) {
5892        this.getAdjudication().add((AdjudicationComponent) value);
5893      } else if (name.equals("detail")) {
5894        this.getDetail().add((DetailComponent) value);
5895      } else
5896        return super.setProperty(name, value);
5897      return value;
5898    }
5899
5900    @Override
5901    public Base makeProperty(int hash, String name) throws FHIRException {
5902      switch (hash) {
5903      case 1349547969:
5904        return getSequenceElement();
5905      case 1070083823:
5906        return addCareTeamSequenceElement();
5907      case -909769262:
5908        return addDiagnosisSequenceElement();
5909      case -808920140:
5910        return addProcedureSequenceElement();
5911      case -702585587:
5912        return addInformationSequenceElement();
5913      case 1099842588:
5914        return getRevenue();
5915      case 50511102:
5916        return getCategory();
5917      case 1957227299:
5918        return getProductOrService();
5919      case -615513385:
5920        return addModifier();
5921      case 1010065041:
5922        return addProgramCode();
5923      case -1927922223:
5924        return getServiced();
5925      case 1379209295:
5926        return getServiced();
5927      case 552316075:
5928        return getLocation();
5929      case 1901043637:
5930        return getLocation();
5931      case -1285004149:
5932        return getQuantity();
5933      case -486196699:
5934        return getUnitPrice();
5935      case -1282148017:
5936        return getFactorElement();
5937      case 108957:
5938        return getNet();
5939      case 115642:
5940        return addUdi();
5941      case 1702620169:
5942        return getBodySite();
5943      case -1868566105:
5944        return addSubSite();
5945      case 1524132147:
5946        return addEncounter();
5947      case -1110033957:
5948        return addNoteNumberElement();
5949      case -231349275:
5950        return addAdjudication();
5951      case -1335224239:
5952        return addDetail();
5953      default:
5954        return super.makeProperty(hash, name);
5955      }
5956
5957    }
5958
5959    @Override
5960    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5961      switch (hash) {
5962      case 1349547969:
5963        /* sequence */ return new String[] { "positiveInt" };
5964      case 1070083823:
5965        /* careTeamSequence */ return new String[] { "positiveInt" };
5966      case -909769262:
5967        /* diagnosisSequence */ return new String[] { "positiveInt" };
5968      case -808920140:
5969        /* procedureSequence */ return new String[] { "positiveInt" };
5970      case -702585587:
5971        /* informationSequence */ return new String[] { "positiveInt" };
5972      case 1099842588:
5973        /* revenue */ return new String[] { "CodeableConcept" };
5974      case 50511102:
5975        /* category */ return new String[] { "CodeableConcept" };
5976      case 1957227299:
5977        /* productOrService */ return new String[] { "CodeableConcept" };
5978      case -615513385:
5979        /* modifier */ return new String[] { "CodeableConcept" };
5980      case 1010065041:
5981        /* programCode */ return new String[] { "CodeableConcept" };
5982      case 1379209295:
5983        /* serviced */ return new String[] { "date", "Period" };
5984      case 1901043637:
5985        /* location */ return new String[] { "CodeableConcept", "Address", "Reference" };
5986      case -1285004149:
5987        /* quantity */ return new String[] { "SimpleQuantity" };
5988      case -486196699:
5989        /* unitPrice */ return new String[] { "Money" };
5990      case -1282148017:
5991        /* factor */ return new String[] { "decimal" };
5992      case 108957:
5993        /* net */ return new String[] { "Money" };
5994      case 115642:
5995        /* udi */ return new String[] { "Reference" };
5996      case 1702620169:
5997        /* bodySite */ return new String[] { "CodeableConcept" };
5998      case -1868566105:
5999        /* subSite */ return new String[] { "CodeableConcept" };
6000      case 1524132147:
6001        /* encounter */ return new String[] { "Reference" };
6002      case -1110033957:
6003        /* noteNumber */ return new String[] { "positiveInt" };
6004      case -231349275:
6005        /* adjudication */ return new String[] {};
6006      case -1335224239:
6007        /* detail */ return new String[] {};
6008      default:
6009        return super.getTypesForProperty(hash, name);
6010      }
6011
6012    }
6013
6014    @Override
6015    public Base addChild(String name) throws FHIRException {
6016      if (name.equals("sequence")) {
6017        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
6018      } else if (name.equals("careTeamSequence")) {
6019        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.careTeamSequence");
6020      } else if (name.equals("diagnosisSequence")) {
6021        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.diagnosisSequence");
6022      } else if (name.equals("procedureSequence")) {
6023        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.procedureSequence");
6024      } else if (name.equals("informationSequence")) {
6025        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.informationSequence");
6026      } else if (name.equals("revenue")) {
6027        this.revenue = new CodeableConcept();
6028        return this.revenue;
6029      } else if (name.equals("category")) {
6030        this.category = new CodeableConcept();
6031        return this.category;
6032      } else if (name.equals("productOrService")) {
6033        this.productOrService = new CodeableConcept();
6034        return this.productOrService;
6035      } else if (name.equals("modifier")) {
6036        return addModifier();
6037      } else if (name.equals("programCode")) {
6038        return addProgramCode();
6039      } else if (name.equals("servicedDate")) {
6040        this.serviced = new DateType();
6041        return this.serviced;
6042      } else if (name.equals("servicedPeriod")) {
6043        this.serviced = new Period();
6044        return this.serviced;
6045      } else if (name.equals("locationCodeableConcept")) {
6046        this.location = new CodeableConcept();
6047        return this.location;
6048      } else if (name.equals("locationAddress")) {
6049        this.location = new Address();
6050        return this.location;
6051      } else if (name.equals("locationReference")) {
6052        this.location = new Reference();
6053        return this.location;
6054      } else if (name.equals("quantity")) {
6055        this.quantity = new Quantity();
6056        return this.quantity;
6057      } else if (name.equals("unitPrice")) {
6058        this.unitPrice = new Money();
6059        return this.unitPrice;
6060      } else if (name.equals("factor")) {
6061        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
6062      } else if (name.equals("net")) {
6063        this.net = new Money();
6064        return this.net;
6065      } else if (name.equals("udi")) {
6066        return addUdi();
6067      } else if (name.equals("bodySite")) {
6068        this.bodySite = new CodeableConcept();
6069        return this.bodySite;
6070      } else if (name.equals("subSite")) {
6071        return addSubSite();
6072      } else if (name.equals("encounter")) {
6073        return addEncounter();
6074      } else if (name.equals("noteNumber")) {
6075        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
6076      } else if (name.equals("adjudication")) {
6077        return addAdjudication();
6078      } else if (name.equals("detail")) {
6079        return addDetail();
6080      } else
6081        return super.addChild(name);
6082    }
6083
6084    public ItemComponent copy() {
6085      ItemComponent dst = new ItemComponent();
6086      copyValues(dst);
6087      return dst;
6088    }
6089
6090    public void copyValues(ItemComponent dst) {
6091      super.copyValues(dst);
6092      dst.sequence = sequence == null ? null : sequence.copy();
6093      if (careTeamSequence != null) {
6094        dst.careTeamSequence = new ArrayList<PositiveIntType>();
6095        for (PositiveIntType i : careTeamSequence)
6096          dst.careTeamSequence.add(i.copy());
6097      }
6098      ;
6099      if (diagnosisSequence != null) {
6100        dst.diagnosisSequence = new ArrayList<PositiveIntType>();
6101        for (PositiveIntType i : diagnosisSequence)
6102          dst.diagnosisSequence.add(i.copy());
6103      }
6104      ;
6105      if (procedureSequence != null) {
6106        dst.procedureSequence = new ArrayList<PositiveIntType>();
6107        for (PositiveIntType i : procedureSequence)
6108          dst.procedureSequence.add(i.copy());
6109      }
6110      ;
6111      if (informationSequence != null) {
6112        dst.informationSequence = new ArrayList<PositiveIntType>();
6113        for (PositiveIntType i : informationSequence)
6114          dst.informationSequence.add(i.copy());
6115      }
6116      ;
6117      dst.revenue = revenue == null ? null : revenue.copy();
6118      dst.category = category == null ? null : category.copy();
6119      dst.productOrService = productOrService == null ? null : productOrService.copy();
6120      if (modifier != null) {
6121        dst.modifier = new ArrayList<CodeableConcept>();
6122        for (CodeableConcept i : modifier)
6123          dst.modifier.add(i.copy());
6124      }
6125      ;
6126      if (programCode != null) {
6127        dst.programCode = new ArrayList<CodeableConcept>();
6128        for (CodeableConcept i : programCode)
6129          dst.programCode.add(i.copy());
6130      }
6131      ;
6132      dst.serviced = serviced == null ? null : serviced.copy();
6133      dst.location = location == null ? null : location.copy();
6134      dst.quantity = quantity == null ? null : quantity.copy();
6135      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6136      dst.factor = factor == null ? null : factor.copy();
6137      dst.net = net == null ? null : net.copy();
6138      if (udi != null) {
6139        dst.udi = new ArrayList<Reference>();
6140        for (Reference i : udi)
6141          dst.udi.add(i.copy());
6142      }
6143      ;
6144      dst.bodySite = bodySite == null ? null : bodySite.copy();
6145      if (subSite != null) {
6146        dst.subSite = new ArrayList<CodeableConcept>();
6147        for (CodeableConcept i : subSite)
6148          dst.subSite.add(i.copy());
6149      }
6150      ;
6151      if (encounter != null) {
6152        dst.encounter = new ArrayList<Reference>();
6153        for (Reference i : encounter)
6154          dst.encounter.add(i.copy());
6155      }
6156      ;
6157      if (noteNumber != null) {
6158        dst.noteNumber = new ArrayList<PositiveIntType>();
6159        for (PositiveIntType i : noteNumber)
6160          dst.noteNumber.add(i.copy());
6161      }
6162      ;
6163      if (adjudication != null) {
6164        dst.adjudication = new ArrayList<AdjudicationComponent>();
6165        for (AdjudicationComponent i : adjudication)
6166          dst.adjudication.add(i.copy());
6167      }
6168      ;
6169      if (detail != null) {
6170        dst.detail = new ArrayList<DetailComponent>();
6171        for (DetailComponent i : detail)
6172          dst.detail.add(i.copy());
6173      }
6174      ;
6175    }
6176
6177    @Override
6178    public boolean equalsDeep(Base other_) {
6179      if (!super.equalsDeep(other_))
6180        return false;
6181      if (!(other_ instanceof ItemComponent))
6182        return false;
6183      ItemComponent o = (ItemComponent) other_;
6184      return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamSequence, o.careTeamSequence, true)
6185          && compareDeep(diagnosisSequence, o.diagnosisSequence, true)
6186          && compareDeep(procedureSequence, o.procedureSequence, true)
6187          && compareDeep(informationSequence, o.informationSequence, true) && compareDeep(revenue, o.revenue, true)
6188          && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
6189          && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
6190          && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
6191          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
6192          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
6193          && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true)
6194          && compareDeep(encounter, o.encounter, true) && compareDeep(noteNumber, o.noteNumber, true)
6195          && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true);
6196    }
6197
6198    @Override
6199    public boolean equalsShallow(Base other_) {
6200      if (!super.equalsShallow(other_))
6201        return false;
6202      if (!(other_ instanceof ItemComponent))
6203        return false;
6204      ItemComponent o = (ItemComponent) other_;
6205      return compareValues(sequence, o.sequence, true) && compareValues(careTeamSequence, o.careTeamSequence, true)
6206          && compareValues(diagnosisSequence, o.diagnosisSequence, true)
6207          && compareValues(procedureSequence, o.procedureSequence, true)
6208          && compareValues(informationSequence, o.informationSequence, true) && compareValues(factor, o.factor, true)
6209          && compareValues(noteNumber, o.noteNumber, true);
6210    }
6211
6212    public boolean isEmpty() {
6213      return super.isEmpty()
6214          && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamSequence, diagnosisSequence, procedureSequence,
6215              informationSequence, revenue, category, productOrService, modifier, programCode, serviced, location,
6216              quantity, unitPrice, factor, net, udi, bodySite, subSite, encounter, noteNumber, adjudication, detail);
6217    }
6218
6219    public String fhirType() {
6220      return "ExplanationOfBenefit.item";
6221
6222    }
6223
6224  }
6225
6226  @Block()
6227  public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
6228    /**
6229     * A code to indicate the information type of this adjudication record.
6230     * Information types may include: the value submitted, maximum values or
6231     * percentages allowed or payable under the plan, amounts that the patient is
6232     * responsible for in-aggregate or pertaining to this item, amounts paid by
6233     * other coverages, and the benefit payable for this item.
6234     */
6235    @Child(name = "category", type = {
6236        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
6237    @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.")
6238    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/adjudication")
6239    protected CodeableConcept category;
6240
6241    /**
6242     * A code supporting the understanding of the adjudication result and explaining
6243     * variance from expected amount.
6244     */
6245    @Child(name = "reason", type = {
6246        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
6247    @Description(shortDefinition = "Explanation of adjudication outcome", formalDefinition = "A code supporting the understanding of the adjudication result and explaining variance from expected amount.")
6248    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/adjudication-reason")
6249    protected CodeableConcept reason;
6250
6251    /**
6252     * Monetary amount associated with the category.
6253     */
6254    @Child(name = "amount", type = { Money.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
6255    @Description(shortDefinition = "Monetary amount", formalDefinition = "Monetary amount associated with the category.")
6256    protected Money amount;
6257
6258    /**
6259     * A non-monetary value associated with the category. Mutually exclusive to the
6260     * amount element above.
6261     */
6262    @Child(name = "value", type = { DecimalType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
6263    @Description(shortDefinition = "Non-monitary value", formalDefinition = "A non-monetary value associated with the category. Mutually exclusive to the amount element above.")
6264    protected DecimalType value;
6265
6266    private static final long serialVersionUID = 1559898786L;
6267
6268    /**
6269     * Constructor
6270     */
6271    public AdjudicationComponent() {
6272      super();
6273    }
6274
6275    /**
6276     * Constructor
6277     */
6278    public AdjudicationComponent(CodeableConcept category) {
6279      super();
6280      this.category = category;
6281    }
6282
6283    /**
6284     * @return {@link #category} (A code to indicate the information type of this
6285     *         adjudication record. Information types may include: the value
6286     *         submitted, maximum values or percentages allowed or payable under the
6287     *         plan, amounts that the patient is responsible for in-aggregate or
6288     *         pertaining to this item, amounts paid by other coverages, and the
6289     *         benefit payable for this item.)
6290     */
6291    public CodeableConcept getCategory() {
6292      if (this.category == null)
6293        if (Configuration.errorOnAutoCreate())
6294          throw new Error("Attempt to auto-create AdjudicationComponent.category");
6295        else if (Configuration.doAutoCreate())
6296          this.category = new CodeableConcept(); // cc
6297      return this.category;
6298    }
6299
6300    public boolean hasCategory() {
6301      return this.category != null && !this.category.isEmpty();
6302    }
6303
6304    /**
6305     * @param value {@link #category} (A code to indicate the information type of
6306     *              this adjudication record. Information types may include: the
6307     *              value submitted, maximum values or percentages allowed or
6308     *              payable under the plan, amounts that the patient is responsible
6309     *              for in-aggregate or pertaining to this item, amounts paid by
6310     *              other coverages, and the benefit payable for this item.)
6311     */
6312    public AdjudicationComponent setCategory(CodeableConcept value) {
6313      this.category = value;
6314      return this;
6315    }
6316
6317    /**
6318     * @return {@link #reason} (A code supporting the understanding of the
6319     *         adjudication result and explaining variance from expected amount.)
6320     */
6321    public CodeableConcept getReason() {
6322      if (this.reason == null)
6323        if (Configuration.errorOnAutoCreate())
6324          throw new Error("Attempt to auto-create AdjudicationComponent.reason");
6325        else if (Configuration.doAutoCreate())
6326          this.reason = new CodeableConcept(); // cc
6327      return this.reason;
6328    }
6329
6330    public boolean hasReason() {
6331      return this.reason != null && !this.reason.isEmpty();
6332    }
6333
6334    /**
6335     * @param value {@link #reason} (A code supporting the understanding of the
6336     *              adjudication result and explaining variance from expected
6337     *              amount.)
6338     */
6339    public AdjudicationComponent setReason(CodeableConcept value) {
6340      this.reason = value;
6341      return this;
6342    }
6343
6344    /**
6345     * @return {@link #amount} (Monetary amount associated with the category.)
6346     */
6347    public Money getAmount() {
6348      if (this.amount == null)
6349        if (Configuration.errorOnAutoCreate())
6350          throw new Error("Attempt to auto-create AdjudicationComponent.amount");
6351        else if (Configuration.doAutoCreate())
6352          this.amount = new Money(); // cc
6353      return this.amount;
6354    }
6355
6356    public boolean hasAmount() {
6357      return this.amount != null && !this.amount.isEmpty();
6358    }
6359
6360    /**
6361     * @param value {@link #amount} (Monetary amount associated with the category.)
6362     */
6363    public AdjudicationComponent setAmount(Money value) {
6364      this.amount = value;
6365      return this;
6366    }
6367
6368    /**
6369     * @return {@link #value} (A non-monetary value associated with the category.
6370     *         Mutually exclusive to the amount element above.). This is the
6371     *         underlying object with id, value and extensions. The accessor
6372     *         "getValue" gives direct access to the value
6373     */
6374    public DecimalType getValueElement() {
6375      if (this.value == null)
6376        if (Configuration.errorOnAutoCreate())
6377          throw new Error("Attempt to auto-create AdjudicationComponent.value");
6378        else if (Configuration.doAutoCreate())
6379          this.value = new DecimalType(); // bb
6380      return this.value;
6381    }
6382
6383    public boolean hasValueElement() {
6384      return this.value != null && !this.value.isEmpty();
6385    }
6386
6387    public boolean hasValue() {
6388      return this.value != null && !this.value.isEmpty();
6389    }
6390
6391    /**
6392     * @param value {@link #value} (A non-monetary value associated with the
6393     *              category. Mutually exclusive to the amount element above.). This
6394     *              is the underlying object with id, value and extensions. The
6395     *              accessor "getValue" gives direct access to the value
6396     */
6397    public AdjudicationComponent setValueElement(DecimalType value) {
6398      this.value = value;
6399      return this;
6400    }
6401
6402    /**
6403     * @return A non-monetary value associated with the category. Mutually exclusive
6404     *         to the amount element above.
6405     */
6406    public BigDecimal getValue() {
6407      return this.value == null ? null : this.value.getValue();
6408    }
6409
6410    /**
6411     * @param value A non-monetary value associated with the category. Mutually
6412     *              exclusive to the amount element above.
6413     */
6414    public AdjudicationComponent setValue(BigDecimal value) {
6415      if (value == null)
6416        this.value = null;
6417      else {
6418        if (this.value == null)
6419          this.value = new DecimalType();
6420        this.value.setValue(value);
6421      }
6422      return this;
6423    }
6424
6425    /**
6426     * @param value A non-monetary value associated with the category. Mutually
6427     *              exclusive to the amount element above.
6428     */
6429    public AdjudicationComponent setValue(long value) {
6430      this.value = new DecimalType();
6431      this.value.setValue(value);
6432      return this;
6433    }
6434
6435    /**
6436     * @param value A non-monetary value associated with the category. Mutually
6437     *              exclusive to the amount element above.
6438     */
6439    public AdjudicationComponent setValue(double value) {
6440      this.value = new DecimalType();
6441      this.value.setValue(value);
6442      return this;
6443    }
6444
6445    protected void listChildren(List<Property> children) {
6446      super.listChildren(children);
6447      children.add(new Property("category", "CodeableConcept",
6448          "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.",
6449          0, 1, category));
6450      children.add(new Property("reason", "CodeableConcept",
6451          "A code supporting the understanding of the adjudication result and explaining variance from expected amount.",
6452          0, 1, reason));
6453      children.add(new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount));
6454      children.add(new Property("value", "decimal",
6455          "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1,
6456          value));
6457    }
6458
6459    @Override
6460    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6461      switch (_hash) {
6462      case 50511102:
6463        /* category */ return new Property("category", "CodeableConcept",
6464            "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.",
6465            0, 1, category);
6466      case -934964668:
6467        /* reason */ return new Property("reason", "CodeableConcept",
6468            "A code supporting the understanding of the adjudication result and explaining variance from expected amount.",
6469            0, 1, reason);
6470      case -1413853096:
6471        /* amount */ return new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1,
6472            amount);
6473      case 111972721:
6474        /* value */ return new Property("value", "decimal",
6475            "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1,
6476            value);
6477      default:
6478        return super.getNamedProperty(_hash, _name, _checkValid);
6479      }
6480
6481    }
6482
6483    @Override
6484    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6485      switch (hash) {
6486      case 50511102:
6487        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
6488      case -934964668:
6489        /* reason */ return this.reason == null ? new Base[0] : new Base[] { this.reason }; // CodeableConcept
6490      case -1413853096:
6491        /* amount */ return this.amount == null ? new Base[0] : new Base[] { this.amount }; // Money
6492      case 111972721:
6493        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // DecimalType
6494      default:
6495        return super.getProperty(hash, name, checkValid);
6496      }
6497
6498    }
6499
6500    @Override
6501    public Base setProperty(int hash, String name, Base value) throws FHIRException {
6502      switch (hash) {
6503      case 50511102: // category
6504        this.category = castToCodeableConcept(value); // CodeableConcept
6505        return value;
6506      case -934964668: // reason
6507        this.reason = castToCodeableConcept(value); // CodeableConcept
6508        return value;
6509      case -1413853096: // amount
6510        this.amount = castToMoney(value); // Money
6511        return value;
6512      case 111972721: // value
6513        this.value = castToDecimal(value); // DecimalType
6514        return value;
6515      default:
6516        return super.setProperty(hash, name, value);
6517      }
6518
6519    }
6520
6521    @Override
6522    public Base setProperty(String name, Base value) throws FHIRException {
6523      if (name.equals("category")) {
6524        this.category = castToCodeableConcept(value); // CodeableConcept
6525      } else if (name.equals("reason")) {
6526        this.reason = castToCodeableConcept(value); // CodeableConcept
6527      } else if (name.equals("amount")) {
6528        this.amount = castToMoney(value); // Money
6529      } else if (name.equals("value")) {
6530        this.value = castToDecimal(value); // DecimalType
6531      } else
6532        return super.setProperty(name, value);
6533      return value;
6534    }
6535
6536    @Override
6537    public Base makeProperty(int hash, String name) throws FHIRException {
6538      switch (hash) {
6539      case 50511102:
6540        return getCategory();
6541      case -934964668:
6542        return getReason();
6543      case -1413853096:
6544        return getAmount();
6545      case 111972721:
6546        return getValueElement();
6547      default:
6548        return super.makeProperty(hash, name);
6549      }
6550
6551    }
6552
6553    @Override
6554    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6555      switch (hash) {
6556      case 50511102:
6557        /* category */ return new String[] { "CodeableConcept" };
6558      case -934964668:
6559        /* reason */ return new String[] { "CodeableConcept" };
6560      case -1413853096:
6561        /* amount */ return new String[] { "Money" };
6562      case 111972721:
6563        /* value */ return new String[] { "decimal" };
6564      default:
6565        return super.getTypesForProperty(hash, name);
6566      }
6567
6568    }
6569
6570    @Override
6571    public Base addChild(String name) throws FHIRException {
6572      if (name.equals("category")) {
6573        this.category = new CodeableConcept();
6574        return this.category;
6575      } else if (name.equals("reason")) {
6576        this.reason = new CodeableConcept();
6577        return this.reason;
6578      } else if (name.equals("amount")) {
6579        this.amount = new Money();
6580        return this.amount;
6581      } else if (name.equals("value")) {
6582        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.value");
6583      } else
6584        return super.addChild(name);
6585    }
6586
6587    public AdjudicationComponent copy() {
6588      AdjudicationComponent dst = new AdjudicationComponent();
6589      copyValues(dst);
6590      return dst;
6591    }
6592
6593    public void copyValues(AdjudicationComponent dst) {
6594      super.copyValues(dst);
6595      dst.category = category == null ? null : category.copy();
6596      dst.reason = reason == null ? null : reason.copy();
6597      dst.amount = amount == null ? null : amount.copy();
6598      dst.value = value == null ? null : value.copy();
6599    }
6600
6601    @Override
6602    public boolean equalsDeep(Base other_) {
6603      if (!super.equalsDeep(other_))
6604        return false;
6605      if (!(other_ instanceof AdjudicationComponent))
6606        return false;
6607      AdjudicationComponent o = (AdjudicationComponent) other_;
6608      return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true)
6609          && compareDeep(amount, o.amount, true) && compareDeep(value, o.value, true);
6610    }
6611
6612    @Override
6613    public boolean equalsShallow(Base other_) {
6614      if (!super.equalsShallow(other_))
6615        return false;
6616      if (!(other_ instanceof AdjudicationComponent))
6617        return false;
6618      AdjudicationComponent o = (AdjudicationComponent) other_;
6619      return compareValues(value, o.value, true);
6620    }
6621
6622    public boolean isEmpty() {
6623      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount, value);
6624    }
6625
6626    public String fhirType() {
6627      return "ExplanationOfBenefit.item.adjudication";
6628
6629    }
6630
6631  }
6632
6633  @Block()
6634  public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
6635    /**
6636     * A claim detail line. Either a simple (a product or service) or a 'group' of
6637     * sub-details which are simple items.
6638     */
6639    @Child(name = "sequence", type = {
6640        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
6641    @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.")
6642    protected PositiveIntType sequence;
6643
6644    /**
6645     * The type of revenue or cost center providing the product and/or service.
6646     */
6647    @Child(name = "revenue", type = {
6648        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
6649    @Description(shortDefinition = "Revenue or cost center code", formalDefinition = "The type of revenue or cost center providing the product and/or service.")
6650    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-revenue-center")
6651    protected CodeableConcept revenue;
6652
6653    /**
6654     * Code to identify the general type of benefits under which products and
6655     * services are provided.
6656     */
6657    @Child(name = "category", type = {
6658        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
6659    @Description(shortDefinition = "Benefit classification", formalDefinition = "Code to identify the general type of benefits under which products and services are provided.")
6660    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-benefitcategory")
6661    protected CodeableConcept category;
6662
6663    /**
6664     * When the value is a group code then this item collects a set of related claim
6665     * details, otherwise this contains the product, service, drug or other billing
6666     * code for the item.
6667     */
6668    @Child(name = "productOrService", type = {
6669        CodeableConcept.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
6670    @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.")
6671    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
6672    protected CodeableConcept productOrService;
6673
6674    /**
6675     * Item typification or modifiers codes to convey additional context for the
6676     * product or service.
6677     */
6678    @Child(name = "modifier", type = {
6679        CodeableConcept.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6680    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
6681    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
6682    protected List<CodeableConcept> modifier;
6683
6684    /**
6685     * Identifies the program under which this may be recovered.
6686     */
6687    @Child(name = "programCode", type = {
6688        CodeableConcept.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6689    @Description(shortDefinition = "Program the product or service is provided under", formalDefinition = "Identifies the program under which this may be recovered.")
6690    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-program-code")
6691    protected List<CodeableConcept> programCode;
6692
6693    /**
6694     * The number of repetitions of a service or product.
6695     */
6696    @Child(name = "quantity", type = { Quantity.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
6697    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
6698    protected Quantity quantity;
6699
6700    /**
6701     * If the item is not a group then this is the fee for the product or service,
6702     * otherwise this is the total of the fees for the details of the group.
6703     */
6704    @Child(name = "unitPrice", type = { Money.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
6705    @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.")
6706    protected Money unitPrice;
6707
6708    /**
6709     * A real number that represents a multiplier used in determining the overall
6710     * value of services delivered and/or goods received. The concept of a Factor
6711     * allows for a discount or surcharge multiplier to be applied to a monetary
6712     * amount.
6713     */
6714    @Child(name = "factor", type = {
6715        DecimalType.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
6716    @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.")
6717    protected DecimalType factor;
6718
6719    /**
6720     * The quantity times the unit price for an additional service or product or
6721     * charge.
6722     */
6723    @Child(name = "net", type = { Money.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
6724    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
6725    protected Money net;
6726
6727    /**
6728     * Unique Device Identifiers associated with this line item.
6729     */
6730    @Child(name = "udi", type = {
6731        Device.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6732    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
6733    protected List<Reference> udi;
6734    /**
6735     * The actual objects that are the target of the reference (Unique Device
6736     * Identifiers associated with this line item.)
6737     */
6738    protected List<Device> udiTarget;
6739
6740    /**
6741     * The numbers associated with notes below which apply to the adjudication of
6742     * this item.
6743     */
6744    @Child(name = "noteNumber", type = {
6745        PositiveIntType.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6746    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
6747    protected List<PositiveIntType> noteNumber;
6748
6749    /**
6750     * The adjudication results.
6751     */
6752    @Child(name = "adjudication", type = {
6753        AdjudicationComponent.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6754    @Description(shortDefinition = "Detail level adjudication details", formalDefinition = "The adjudication results.")
6755    protected List<AdjudicationComponent> adjudication;
6756
6757    /**
6758     * Third-tier of goods and services.
6759     */
6760    @Child(name = "subDetail", type = {}, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6761    @Description(shortDefinition = "Additional items", formalDefinition = "Third-tier of goods and services.")
6762    protected List<SubDetailComponent> subDetail;
6763
6764    private static final long serialVersionUID = 225639798L;
6765
6766    /**
6767     * Constructor
6768     */
6769    public DetailComponent() {
6770      super();
6771    }
6772
6773    /**
6774     * Constructor
6775     */
6776    public DetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
6777      super();
6778      this.sequence = sequence;
6779      this.productOrService = productOrService;
6780    }
6781
6782    /**
6783     * @return {@link #sequence} (A claim detail line. Either a simple (a product or
6784     *         service) or a 'group' of sub-details which are simple items.). This
6785     *         is the underlying object with id, value and extensions. The accessor
6786     *         "getSequence" gives direct access to the value
6787     */
6788    public PositiveIntType getSequenceElement() {
6789      if (this.sequence == null)
6790        if (Configuration.errorOnAutoCreate())
6791          throw new Error("Attempt to auto-create DetailComponent.sequence");
6792        else if (Configuration.doAutoCreate())
6793          this.sequence = new PositiveIntType(); // bb
6794      return this.sequence;
6795    }
6796
6797    public boolean hasSequenceElement() {
6798      return this.sequence != null && !this.sequence.isEmpty();
6799    }
6800
6801    public boolean hasSequence() {
6802      return this.sequence != null && !this.sequence.isEmpty();
6803    }
6804
6805    /**
6806     * @param value {@link #sequence} (A claim detail line. Either a simple (a
6807     *              product or service) or a 'group' of sub-details which are simple
6808     *              items.). This is the underlying object with id, value and
6809     *              extensions. The accessor "getSequence" gives direct access to
6810     *              the value
6811     */
6812    public DetailComponent setSequenceElement(PositiveIntType value) {
6813      this.sequence = value;
6814      return this;
6815    }
6816
6817    /**
6818     * @return A claim detail line. Either a simple (a product or service) or a
6819     *         'group' of sub-details which are simple items.
6820     */
6821    public int getSequence() {
6822      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
6823    }
6824
6825    /**
6826     * @param value A claim detail line. Either a simple (a product or service) or a
6827     *              'group' of sub-details which are simple items.
6828     */
6829    public DetailComponent setSequence(int value) {
6830      if (this.sequence == null)
6831        this.sequence = new PositiveIntType();
6832      this.sequence.setValue(value);
6833      return this;
6834    }
6835
6836    /**
6837     * @return {@link #revenue} (The type of revenue or cost center providing the
6838     *         product and/or service.)
6839     */
6840    public CodeableConcept getRevenue() {
6841      if (this.revenue == null)
6842        if (Configuration.errorOnAutoCreate())
6843          throw new Error("Attempt to auto-create DetailComponent.revenue");
6844        else if (Configuration.doAutoCreate())
6845          this.revenue = new CodeableConcept(); // cc
6846      return this.revenue;
6847    }
6848
6849    public boolean hasRevenue() {
6850      return this.revenue != null && !this.revenue.isEmpty();
6851    }
6852
6853    /**
6854     * @param value {@link #revenue} (The type of revenue or cost center providing
6855     *              the product and/or service.)
6856     */
6857    public DetailComponent setRevenue(CodeableConcept value) {
6858      this.revenue = value;
6859      return this;
6860    }
6861
6862    /**
6863     * @return {@link #category} (Code to identify the general type of benefits
6864     *         under which products and services are provided.)
6865     */
6866    public CodeableConcept getCategory() {
6867      if (this.category == null)
6868        if (Configuration.errorOnAutoCreate())
6869          throw new Error("Attempt to auto-create DetailComponent.category");
6870        else if (Configuration.doAutoCreate())
6871          this.category = new CodeableConcept(); // cc
6872      return this.category;
6873    }
6874
6875    public boolean hasCategory() {
6876      return this.category != null && !this.category.isEmpty();
6877    }
6878
6879    /**
6880     * @param value {@link #category} (Code to identify the general type of benefits
6881     *              under which products and services are provided.)
6882     */
6883    public DetailComponent setCategory(CodeableConcept value) {
6884      this.category = value;
6885      return this;
6886    }
6887
6888    /**
6889     * @return {@link #productOrService} (When the value is a group code then this
6890     *         item collects a set of related claim details, otherwise this contains
6891     *         the product, service, drug or other billing code for the item.)
6892     */
6893    public CodeableConcept getProductOrService() {
6894      if (this.productOrService == null)
6895        if (Configuration.errorOnAutoCreate())
6896          throw new Error("Attempt to auto-create DetailComponent.productOrService");
6897        else if (Configuration.doAutoCreate())
6898          this.productOrService = new CodeableConcept(); // cc
6899      return this.productOrService;
6900    }
6901
6902    public boolean hasProductOrService() {
6903      return this.productOrService != null && !this.productOrService.isEmpty();
6904    }
6905
6906    /**
6907     * @param value {@link #productOrService} (When the value is a group code then
6908     *              this item collects a set of related claim details, otherwise
6909     *              this contains the product, service, drug or other billing code
6910     *              for the item.)
6911     */
6912    public DetailComponent setProductOrService(CodeableConcept value) {
6913      this.productOrService = value;
6914      return this;
6915    }
6916
6917    /**
6918     * @return {@link #modifier} (Item typification or modifiers codes to convey
6919     *         additional context for the product or service.)
6920     */
6921    public List<CodeableConcept> getModifier() {
6922      if (this.modifier == null)
6923        this.modifier = new ArrayList<CodeableConcept>();
6924      return this.modifier;
6925    }
6926
6927    /**
6928     * @return Returns a reference to <code>this</code> for easy method chaining
6929     */
6930    public DetailComponent setModifier(List<CodeableConcept> theModifier) {
6931      this.modifier = theModifier;
6932      return this;
6933    }
6934
6935    public boolean hasModifier() {
6936      if (this.modifier == null)
6937        return false;
6938      for (CodeableConcept item : this.modifier)
6939        if (!item.isEmpty())
6940          return true;
6941      return false;
6942    }
6943
6944    public CodeableConcept addModifier() { // 3
6945      CodeableConcept t = new CodeableConcept();
6946      if (this.modifier == null)
6947        this.modifier = new ArrayList<CodeableConcept>();
6948      this.modifier.add(t);
6949      return t;
6950    }
6951
6952    public DetailComponent addModifier(CodeableConcept t) { // 3
6953      if (t == null)
6954        return this;
6955      if (this.modifier == null)
6956        this.modifier = new ArrayList<CodeableConcept>();
6957      this.modifier.add(t);
6958      return this;
6959    }
6960
6961    /**
6962     * @return The first repetition of repeating field {@link #modifier}, creating
6963     *         it if it does not already exist
6964     */
6965    public CodeableConcept getModifierFirstRep() {
6966      if (getModifier().isEmpty()) {
6967        addModifier();
6968      }
6969      return getModifier().get(0);
6970    }
6971
6972    /**
6973     * @return {@link #programCode} (Identifies the program under which this may be
6974     *         recovered.)
6975     */
6976    public List<CodeableConcept> getProgramCode() {
6977      if (this.programCode == null)
6978        this.programCode = new ArrayList<CodeableConcept>();
6979      return this.programCode;
6980    }
6981
6982    /**
6983     * @return Returns a reference to <code>this</code> for easy method chaining
6984     */
6985    public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) {
6986      this.programCode = theProgramCode;
6987      return this;
6988    }
6989
6990    public boolean hasProgramCode() {
6991      if (this.programCode == null)
6992        return false;
6993      for (CodeableConcept item : this.programCode)
6994        if (!item.isEmpty())
6995          return true;
6996      return false;
6997    }
6998
6999    public CodeableConcept addProgramCode() { // 3
7000      CodeableConcept t = new CodeableConcept();
7001      if (this.programCode == null)
7002        this.programCode = new ArrayList<CodeableConcept>();
7003      this.programCode.add(t);
7004      return t;
7005    }
7006
7007    public DetailComponent addProgramCode(CodeableConcept t) { // 3
7008      if (t == null)
7009        return this;
7010      if (this.programCode == null)
7011        this.programCode = new ArrayList<CodeableConcept>();
7012      this.programCode.add(t);
7013      return this;
7014    }
7015
7016    /**
7017     * @return The first repetition of repeating field {@link #programCode},
7018     *         creating it if it does not already exist
7019     */
7020    public CodeableConcept getProgramCodeFirstRep() {
7021      if (getProgramCode().isEmpty()) {
7022        addProgramCode();
7023      }
7024      return getProgramCode().get(0);
7025    }
7026
7027    /**
7028     * @return {@link #quantity} (The number of repetitions of a service or
7029     *         product.)
7030     */
7031    public Quantity getQuantity() {
7032      if (this.quantity == null)
7033        if (Configuration.errorOnAutoCreate())
7034          throw new Error("Attempt to auto-create DetailComponent.quantity");
7035        else if (Configuration.doAutoCreate())
7036          this.quantity = new Quantity(); // cc
7037      return this.quantity;
7038    }
7039
7040    public boolean hasQuantity() {
7041      return this.quantity != null && !this.quantity.isEmpty();
7042    }
7043
7044    /**
7045     * @param value {@link #quantity} (The number of repetitions of a service or
7046     *              product.)
7047     */
7048    public DetailComponent setQuantity(Quantity value) {
7049      this.quantity = value;
7050      return this;
7051    }
7052
7053    /**
7054     * @return {@link #unitPrice} (If the item is not a group then this is the fee
7055     *         for the product or service, otherwise this is the total of the fees
7056     *         for the details of the group.)
7057     */
7058    public Money getUnitPrice() {
7059      if (this.unitPrice == null)
7060        if (Configuration.errorOnAutoCreate())
7061          throw new Error("Attempt to auto-create DetailComponent.unitPrice");
7062        else if (Configuration.doAutoCreate())
7063          this.unitPrice = new Money(); // cc
7064      return this.unitPrice;
7065    }
7066
7067    public boolean hasUnitPrice() {
7068      return this.unitPrice != null && !this.unitPrice.isEmpty();
7069    }
7070
7071    /**
7072     * @param value {@link #unitPrice} (If the item is not a group then this is the
7073     *              fee for the product or service, otherwise this is the total of
7074     *              the fees for the details of the group.)
7075     */
7076    public DetailComponent setUnitPrice(Money value) {
7077      this.unitPrice = value;
7078      return this;
7079    }
7080
7081    /**
7082     * @return {@link #factor} (A real number that represents a multiplier used in
7083     *         determining the overall value of services delivered and/or goods
7084     *         received. The concept of a Factor allows for a discount or surcharge
7085     *         multiplier to be applied to a monetary amount.). This is the
7086     *         underlying object with id, value and extensions. The accessor
7087     *         "getFactor" gives direct access to the value
7088     */
7089    public DecimalType getFactorElement() {
7090      if (this.factor == null)
7091        if (Configuration.errorOnAutoCreate())
7092          throw new Error("Attempt to auto-create DetailComponent.factor");
7093        else if (Configuration.doAutoCreate())
7094          this.factor = new DecimalType(); // bb
7095      return this.factor;
7096    }
7097
7098    public boolean hasFactorElement() {
7099      return this.factor != null && !this.factor.isEmpty();
7100    }
7101
7102    public boolean hasFactor() {
7103      return this.factor != null && !this.factor.isEmpty();
7104    }
7105
7106    /**
7107     * @param value {@link #factor} (A real number that represents a multiplier used
7108     *              in determining the overall value of services delivered and/or
7109     *              goods received. The concept of a Factor allows for a discount or
7110     *              surcharge multiplier to be applied to a monetary amount.). This
7111     *              is the underlying object with id, value and extensions. The
7112     *              accessor "getFactor" gives direct access to the value
7113     */
7114    public DetailComponent setFactorElement(DecimalType value) {
7115      this.factor = value;
7116      return this;
7117    }
7118
7119    /**
7120     * @return A real number that represents a multiplier used in determining the
7121     *         overall value of services delivered and/or goods received. The
7122     *         concept of a Factor allows for a discount or surcharge multiplier to
7123     *         be applied to a monetary amount.
7124     */
7125    public BigDecimal getFactor() {
7126      return this.factor == null ? null : this.factor.getValue();
7127    }
7128
7129    /**
7130     * @param value A real number that represents a multiplier used in determining
7131     *              the overall value of services delivered and/or goods received.
7132     *              The concept of a Factor allows for a discount or surcharge
7133     *              multiplier to be applied to a monetary amount.
7134     */
7135    public DetailComponent setFactor(BigDecimal value) {
7136      if (value == null)
7137        this.factor = null;
7138      else {
7139        if (this.factor == null)
7140          this.factor = new DecimalType();
7141        this.factor.setValue(value);
7142      }
7143      return this;
7144    }
7145
7146    /**
7147     * @param value A real number that represents a multiplier used in determining
7148     *              the overall value of services delivered and/or goods received.
7149     *              The concept of a Factor allows for a discount or surcharge
7150     *              multiplier to be applied to a monetary amount.
7151     */
7152    public DetailComponent setFactor(long value) {
7153      this.factor = new DecimalType();
7154      this.factor.setValue(value);
7155      return this;
7156    }
7157
7158    /**
7159     * @param value A real number that represents a multiplier used in determining
7160     *              the overall value of services delivered and/or goods received.
7161     *              The concept of a Factor allows for a discount or surcharge
7162     *              multiplier to be applied to a monetary amount.
7163     */
7164    public DetailComponent setFactor(double value) {
7165      this.factor = new DecimalType();
7166      this.factor.setValue(value);
7167      return this;
7168    }
7169
7170    /**
7171     * @return {@link #net} (The quantity times the unit price for an additional
7172     *         service or product or charge.)
7173     */
7174    public Money getNet() {
7175      if (this.net == null)
7176        if (Configuration.errorOnAutoCreate())
7177          throw new Error("Attempt to auto-create DetailComponent.net");
7178        else if (Configuration.doAutoCreate())
7179          this.net = new Money(); // cc
7180      return this.net;
7181    }
7182
7183    public boolean hasNet() {
7184      return this.net != null && !this.net.isEmpty();
7185    }
7186
7187    /**
7188     * @param value {@link #net} (The quantity times the unit price for an
7189     *              additional service or product or charge.)
7190     */
7191    public DetailComponent setNet(Money value) {
7192      this.net = value;
7193      return this;
7194    }
7195
7196    /**
7197     * @return {@link #udi} (Unique Device Identifiers associated with this line
7198     *         item.)
7199     */
7200    public List<Reference> getUdi() {
7201      if (this.udi == null)
7202        this.udi = new ArrayList<Reference>();
7203      return this.udi;
7204    }
7205
7206    /**
7207     * @return Returns a reference to <code>this</code> for easy method chaining
7208     */
7209    public DetailComponent setUdi(List<Reference> theUdi) {
7210      this.udi = theUdi;
7211      return this;
7212    }
7213
7214    public boolean hasUdi() {
7215      if (this.udi == null)
7216        return false;
7217      for (Reference item : this.udi)
7218        if (!item.isEmpty())
7219          return true;
7220      return false;
7221    }
7222
7223    public Reference addUdi() { // 3
7224      Reference t = new Reference();
7225      if (this.udi == null)
7226        this.udi = new ArrayList<Reference>();
7227      this.udi.add(t);
7228      return t;
7229    }
7230
7231    public DetailComponent addUdi(Reference t) { // 3
7232      if (t == null)
7233        return this;
7234      if (this.udi == null)
7235        this.udi = new ArrayList<Reference>();
7236      this.udi.add(t);
7237      return this;
7238    }
7239
7240    /**
7241     * @return The first repetition of repeating field {@link #udi}, creating it if
7242     *         it does not already exist
7243     */
7244    public Reference getUdiFirstRep() {
7245      if (getUdi().isEmpty()) {
7246        addUdi();
7247      }
7248      return getUdi().get(0);
7249    }
7250
7251    /**
7252     * @deprecated Use Reference#setResource(IBaseResource) instead
7253     */
7254    @Deprecated
7255    public List<Device> getUdiTarget() {
7256      if (this.udiTarget == null)
7257        this.udiTarget = new ArrayList<Device>();
7258      return this.udiTarget;
7259    }
7260
7261    /**
7262     * @deprecated Use Reference#setResource(IBaseResource) instead
7263     */
7264    @Deprecated
7265    public Device addUdiTarget() {
7266      Device r = new Device();
7267      if (this.udiTarget == null)
7268        this.udiTarget = new ArrayList<Device>();
7269      this.udiTarget.add(r);
7270      return r;
7271    }
7272
7273    /**
7274     * @return {@link #noteNumber} (The numbers associated with notes below which
7275     *         apply to the adjudication of this item.)
7276     */
7277    public List<PositiveIntType> getNoteNumber() {
7278      if (this.noteNumber == null)
7279        this.noteNumber = new ArrayList<PositiveIntType>();
7280      return this.noteNumber;
7281    }
7282
7283    /**
7284     * @return Returns a reference to <code>this</code> for easy method chaining
7285     */
7286    public DetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
7287      this.noteNumber = theNoteNumber;
7288      return this;
7289    }
7290
7291    public boolean hasNoteNumber() {
7292      if (this.noteNumber == null)
7293        return false;
7294      for (PositiveIntType item : this.noteNumber)
7295        if (!item.isEmpty())
7296          return true;
7297      return false;
7298    }
7299
7300    /**
7301     * @return {@link #noteNumber} (The numbers associated with notes below which
7302     *         apply to the adjudication of this item.)
7303     */
7304    public PositiveIntType addNoteNumberElement() {// 2
7305      PositiveIntType t = new PositiveIntType();
7306      if (this.noteNumber == null)
7307        this.noteNumber = new ArrayList<PositiveIntType>();
7308      this.noteNumber.add(t);
7309      return t;
7310    }
7311
7312    /**
7313     * @param value {@link #noteNumber} (The numbers associated with notes below
7314     *              which apply to the adjudication of this item.)
7315     */
7316    public DetailComponent addNoteNumber(int value) { // 1
7317      PositiveIntType t = new PositiveIntType();
7318      t.setValue(value);
7319      if (this.noteNumber == null)
7320        this.noteNumber = new ArrayList<PositiveIntType>();
7321      this.noteNumber.add(t);
7322      return this;
7323    }
7324
7325    /**
7326     * @param value {@link #noteNumber} (The numbers associated with notes below
7327     *              which apply to the adjudication of this item.)
7328     */
7329    public boolean hasNoteNumber(int value) {
7330      if (this.noteNumber == null)
7331        return false;
7332      for (PositiveIntType v : this.noteNumber)
7333        if (v.getValue().equals(value)) // positiveInt
7334          return true;
7335      return false;
7336    }
7337
7338    /**
7339     * @return {@link #adjudication} (The adjudication results.)
7340     */
7341    public List<AdjudicationComponent> getAdjudication() {
7342      if (this.adjudication == null)
7343        this.adjudication = new ArrayList<AdjudicationComponent>();
7344      return this.adjudication;
7345    }
7346
7347    /**
7348     * @return Returns a reference to <code>this</code> for easy method chaining
7349     */
7350    public DetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
7351      this.adjudication = theAdjudication;
7352      return this;
7353    }
7354
7355    public boolean hasAdjudication() {
7356      if (this.adjudication == null)
7357        return false;
7358      for (AdjudicationComponent item : this.adjudication)
7359        if (!item.isEmpty())
7360          return true;
7361      return false;
7362    }
7363
7364    public AdjudicationComponent addAdjudication() { // 3
7365      AdjudicationComponent t = new AdjudicationComponent();
7366      if (this.adjudication == null)
7367        this.adjudication = new ArrayList<AdjudicationComponent>();
7368      this.adjudication.add(t);
7369      return t;
7370    }
7371
7372    public DetailComponent addAdjudication(AdjudicationComponent t) { // 3
7373      if (t == null)
7374        return this;
7375      if (this.adjudication == null)
7376        this.adjudication = new ArrayList<AdjudicationComponent>();
7377      this.adjudication.add(t);
7378      return this;
7379    }
7380
7381    /**
7382     * @return The first repetition of repeating field {@link #adjudication},
7383     *         creating it if it does not already exist
7384     */
7385    public AdjudicationComponent getAdjudicationFirstRep() {
7386      if (getAdjudication().isEmpty()) {
7387        addAdjudication();
7388      }
7389      return getAdjudication().get(0);
7390    }
7391
7392    /**
7393     * @return {@link #subDetail} (Third-tier of goods and services.)
7394     */
7395    public List<SubDetailComponent> getSubDetail() {
7396      if (this.subDetail == null)
7397        this.subDetail = new ArrayList<SubDetailComponent>();
7398      return this.subDetail;
7399    }
7400
7401    /**
7402     * @return Returns a reference to <code>this</code> for easy method chaining
7403     */
7404    public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) {
7405      this.subDetail = theSubDetail;
7406      return this;
7407    }
7408
7409    public boolean hasSubDetail() {
7410      if (this.subDetail == null)
7411        return false;
7412      for (SubDetailComponent item : this.subDetail)
7413        if (!item.isEmpty())
7414          return true;
7415      return false;
7416    }
7417
7418    public SubDetailComponent addSubDetail() { // 3
7419      SubDetailComponent t = new SubDetailComponent();
7420      if (this.subDetail == null)
7421        this.subDetail = new ArrayList<SubDetailComponent>();
7422      this.subDetail.add(t);
7423      return t;
7424    }
7425
7426    public DetailComponent addSubDetail(SubDetailComponent t) { // 3
7427      if (t == null)
7428        return this;
7429      if (this.subDetail == null)
7430        this.subDetail = new ArrayList<SubDetailComponent>();
7431      this.subDetail.add(t);
7432      return this;
7433    }
7434
7435    /**
7436     * @return The first repetition of repeating field {@link #subDetail}, creating
7437     *         it if it does not already exist
7438     */
7439    public SubDetailComponent getSubDetailFirstRep() {
7440      if (getSubDetail().isEmpty()) {
7441        addSubDetail();
7442      }
7443      return getSubDetail().get(0);
7444    }
7445
7446    protected void listChildren(List<Property> children) {
7447      super.listChildren(children);
7448      children.add(new Property("sequence", "positiveInt",
7449          "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
7450          0, 1, sequence));
7451      children.add(new Property("revenue", "CodeableConcept",
7452          "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
7453      children.add(new Property("category", "CodeableConcept",
7454          "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
7455          category));
7456      children.add(new Property("productOrService", "CodeableConcept",
7457          "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.",
7458          0, 1, productOrService));
7459      children.add(new Property("modifier", "CodeableConcept",
7460          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
7461          java.lang.Integer.MAX_VALUE, modifier));
7462      children.add(new Property("programCode", "CodeableConcept",
7463          "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
7464      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
7465          1, quantity));
7466      children.add(new Property("unitPrice", "Money",
7467          "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.",
7468          0, 1, unitPrice));
7469      children.add(new Property("factor", "decimal",
7470          "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.",
7471          0, 1, factor));
7472      children.add(new Property("net", "Money",
7473          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
7474      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
7475          0, java.lang.Integer.MAX_VALUE, udi));
7476      children.add(new Property("noteNumber", "positiveInt",
7477          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
7478          java.lang.Integer.MAX_VALUE, noteNumber));
7479      children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.",
7480          0, java.lang.Integer.MAX_VALUE, adjudication));
7481      children.add(new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE,
7482          subDetail));
7483    }
7484
7485    @Override
7486    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7487      switch (_hash) {
7488      case 1349547969:
7489        /* sequence */ return new Property("sequence", "positiveInt",
7490            "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
7491            0, 1, sequence);
7492      case 1099842588:
7493        /* revenue */ return new Property("revenue", "CodeableConcept",
7494            "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
7495      case 50511102:
7496        /* category */ return new Property("category", "CodeableConcept",
7497            "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
7498            category);
7499      case 1957227299:
7500        /* productOrService */ return new Property("productOrService", "CodeableConcept",
7501            "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.",
7502            0, 1, productOrService);
7503      case -615513385:
7504        /* modifier */ return new Property("modifier", "CodeableConcept",
7505            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
7506            java.lang.Integer.MAX_VALUE, modifier);
7507      case 1010065041:
7508        /* programCode */ return new Property("programCode", "CodeableConcept",
7509            "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
7510      case -1285004149:
7511        /* quantity */ return new Property("quantity", "SimpleQuantity",
7512            "The number of repetitions of a service or product.", 0, 1, quantity);
7513      case -486196699:
7514        /* unitPrice */ return new Property("unitPrice", "Money",
7515            "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.",
7516            0, 1, unitPrice);
7517      case -1282148017:
7518        /* factor */ return new Property("factor", "decimal",
7519            "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.",
7520            0, 1, factor);
7521      case 108957:
7522        /* net */ return new Property("net", "Money",
7523            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
7524      case 115642:
7525        /* udi */ return new Property("udi", "Reference(Device)",
7526            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
7527      case -1110033957:
7528        /* noteNumber */ return new Property("noteNumber", "positiveInt",
7529            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
7530            java.lang.Integer.MAX_VALUE, noteNumber);
7531      case -231349275:
7532        /* adjudication */ return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
7533            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
7534      case -828829007:
7535        /* subDetail */ return new Property("subDetail", "", "Third-tier of goods and services.", 0,
7536            java.lang.Integer.MAX_VALUE, subDetail);
7537      default:
7538        return super.getNamedProperty(_hash, _name, _checkValid);
7539      }
7540
7541    }
7542
7543    @Override
7544    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7545      switch (hash) {
7546      case 1349547969:
7547        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
7548      case 1099842588:
7549        /* revenue */ return this.revenue == null ? new Base[0] : new Base[] { this.revenue }; // CodeableConcept
7550      case 50511102:
7551        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
7552      case 1957227299:
7553        /* productOrService */ return this.productOrService == null ? new Base[0]
7554            : new Base[] { this.productOrService }; // CodeableConcept
7555      case -615513385:
7556        /* modifier */ return this.modifier == null ? new Base[0]
7557            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7558      case 1010065041:
7559        /* programCode */ return this.programCode == null ? new Base[0]
7560            : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
7561      case -1285004149:
7562        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
7563      case -486196699:
7564        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
7565      case -1282148017:
7566        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
7567      case 108957:
7568        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
7569      case 115642:
7570        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
7571      case -1110033957:
7572        /* noteNumber */ return this.noteNumber == null ? new Base[0]
7573            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
7574      case -231349275:
7575        /* adjudication */ return this.adjudication == null ? new Base[0]
7576            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
7577      case -828829007:
7578        /* subDetail */ return this.subDetail == null ? new Base[0]
7579            : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
7580      default:
7581        return super.getProperty(hash, name, checkValid);
7582      }
7583
7584    }
7585
7586    @Override
7587    public Base setProperty(int hash, String name, Base value) throws FHIRException {
7588      switch (hash) {
7589      case 1349547969: // sequence
7590        this.sequence = castToPositiveInt(value); // PositiveIntType
7591        return value;
7592      case 1099842588: // revenue
7593        this.revenue = castToCodeableConcept(value); // CodeableConcept
7594        return value;
7595      case 50511102: // category
7596        this.category = castToCodeableConcept(value); // CodeableConcept
7597        return value;
7598      case 1957227299: // productOrService
7599        this.productOrService = castToCodeableConcept(value); // CodeableConcept
7600        return value;
7601      case -615513385: // modifier
7602        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
7603        return value;
7604      case 1010065041: // programCode
7605        this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
7606        return value;
7607      case -1285004149: // quantity
7608        this.quantity = castToQuantity(value); // Quantity
7609        return value;
7610      case -486196699: // unitPrice
7611        this.unitPrice = castToMoney(value); // Money
7612        return value;
7613      case -1282148017: // factor
7614        this.factor = castToDecimal(value); // DecimalType
7615        return value;
7616      case 108957: // net
7617        this.net = castToMoney(value); // Money
7618        return value;
7619      case 115642: // udi
7620        this.getUdi().add(castToReference(value)); // Reference
7621        return value;
7622      case -1110033957: // noteNumber
7623        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
7624        return value;
7625      case -231349275: // adjudication
7626        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7627        return value;
7628      case -828829007: // subDetail
7629        this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
7630        return value;
7631      default:
7632        return super.setProperty(hash, name, value);
7633      }
7634
7635    }
7636
7637    @Override
7638    public Base setProperty(String name, Base value) throws FHIRException {
7639      if (name.equals("sequence")) {
7640        this.sequence = castToPositiveInt(value); // PositiveIntType
7641      } else if (name.equals("revenue")) {
7642        this.revenue = castToCodeableConcept(value); // CodeableConcept
7643      } else if (name.equals("category")) {
7644        this.category = castToCodeableConcept(value); // CodeableConcept
7645      } else if (name.equals("productOrService")) {
7646        this.productOrService = castToCodeableConcept(value); // CodeableConcept
7647      } else if (name.equals("modifier")) {
7648        this.getModifier().add(castToCodeableConcept(value));
7649      } else if (name.equals("programCode")) {
7650        this.getProgramCode().add(castToCodeableConcept(value));
7651      } else if (name.equals("quantity")) {
7652        this.quantity = castToQuantity(value); // Quantity
7653      } else if (name.equals("unitPrice")) {
7654        this.unitPrice = castToMoney(value); // Money
7655      } else if (name.equals("factor")) {
7656        this.factor = castToDecimal(value); // DecimalType
7657      } else if (name.equals("net")) {
7658        this.net = castToMoney(value); // Money
7659      } else if (name.equals("udi")) {
7660        this.getUdi().add(castToReference(value));
7661      } else if (name.equals("noteNumber")) {
7662        this.getNoteNumber().add(castToPositiveInt(value));
7663      } else if (name.equals("adjudication")) {
7664        this.getAdjudication().add((AdjudicationComponent) value);
7665      } else if (name.equals("subDetail")) {
7666        this.getSubDetail().add((SubDetailComponent) value);
7667      } else
7668        return super.setProperty(name, value);
7669      return value;
7670    }
7671
7672    @Override
7673    public Base makeProperty(int hash, String name) throws FHIRException {
7674      switch (hash) {
7675      case 1349547969:
7676        return getSequenceElement();
7677      case 1099842588:
7678        return getRevenue();
7679      case 50511102:
7680        return getCategory();
7681      case 1957227299:
7682        return getProductOrService();
7683      case -615513385:
7684        return addModifier();
7685      case 1010065041:
7686        return addProgramCode();
7687      case -1285004149:
7688        return getQuantity();
7689      case -486196699:
7690        return getUnitPrice();
7691      case -1282148017:
7692        return getFactorElement();
7693      case 108957:
7694        return getNet();
7695      case 115642:
7696        return addUdi();
7697      case -1110033957:
7698        return addNoteNumberElement();
7699      case -231349275:
7700        return addAdjudication();
7701      case -828829007:
7702        return addSubDetail();
7703      default:
7704        return super.makeProperty(hash, name);
7705      }
7706
7707    }
7708
7709    @Override
7710    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7711      switch (hash) {
7712      case 1349547969:
7713        /* sequence */ return new String[] { "positiveInt" };
7714      case 1099842588:
7715        /* revenue */ return new String[] { "CodeableConcept" };
7716      case 50511102:
7717        /* category */ return new String[] { "CodeableConcept" };
7718      case 1957227299:
7719        /* productOrService */ return new String[] { "CodeableConcept" };
7720      case -615513385:
7721        /* modifier */ return new String[] { "CodeableConcept" };
7722      case 1010065041:
7723        /* programCode */ return new String[] { "CodeableConcept" };
7724      case -1285004149:
7725        /* quantity */ return new String[] { "SimpleQuantity" };
7726      case -486196699:
7727        /* unitPrice */ return new String[] { "Money" };
7728      case -1282148017:
7729        /* factor */ return new String[] { "decimal" };
7730      case 108957:
7731        /* net */ return new String[] { "Money" };
7732      case 115642:
7733        /* udi */ return new String[] { "Reference" };
7734      case -1110033957:
7735        /* noteNumber */ return new String[] { "positiveInt" };
7736      case -231349275:
7737        /* adjudication */ return new String[] { "@ExplanationOfBenefit.item.adjudication" };
7738      case -828829007:
7739        /* subDetail */ return new String[] {};
7740      default:
7741        return super.getTypesForProperty(hash, name);
7742      }
7743
7744    }
7745
7746    @Override
7747    public Base addChild(String name) throws FHIRException {
7748      if (name.equals("sequence")) {
7749        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
7750      } else if (name.equals("revenue")) {
7751        this.revenue = new CodeableConcept();
7752        return this.revenue;
7753      } else if (name.equals("category")) {
7754        this.category = new CodeableConcept();
7755        return this.category;
7756      } else if (name.equals("productOrService")) {
7757        this.productOrService = new CodeableConcept();
7758        return this.productOrService;
7759      } else if (name.equals("modifier")) {
7760        return addModifier();
7761      } else if (name.equals("programCode")) {
7762        return addProgramCode();
7763      } else if (name.equals("quantity")) {
7764        this.quantity = new Quantity();
7765        return this.quantity;
7766      } else if (name.equals("unitPrice")) {
7767        this.unitPrice = new Money();
7768        return this.unitPrice;
7769      } else if (name.equals("factor")) {
7770        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
7771      } else if (name.equals("net")) {
7772        this.net = new Money();
7773        return this.net;
7774      } else if (name.equals("udi")) {
7775        return addUdi();
7776      } else if (name.equals("noteNumber")) {
7777        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
7778      } else if (name.equals("adjudication")) {
7779        return addAdjudication();
7780      } else if (name.equals("subDetail")) {
7781        return addSubDetail();
7782      } else
7783        return super.addChild(name);
7784    }
7785
7786    public DetailComponent copy() {
7787      DetailComponent dst = new DetailComponent();
7788      copyValues(dst);
7789      return dst;
7790    }
7791
7792    public void copyValues(DetailComponent dst) {
7793      super.copyValues(dst);
7794      dst.sequence = sequence == null ? null : sequence.copy();
7795      dst.revenue = revenue == null ? null : revenue.copy();
7796      dst.category = category == null ? null : category.copy();
7797      dst.productOrService = productOrService == null ? null : productOrService.copy();
7798      if (modifier != null) {
7799        dst.modifier = new ArrayList<CodeableConcept>();
7800        for (CodeableConcept i : modifier)
7801          dst.modifier.add(i.copy());
7802      }
7803      ;
7804      if (programCode != null) {
7805        dst.programCode = new ArrayList<CodeableConcept>();
7806        for (CodeableConcept i : programCode)
7807          dst.programCode.add(i.copy());
7808      }
7809      ;
7810      dst.quantity = quantity == null ? null : quantity.copy();
7811      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7812      dst.factor = factor == null ? null : factor.copy();
7813      dst.net = net == null ? null : net.copy();
7814      if (udi != null) {
7815        dst.udi = new ArrayList<Reference>();
7816        for (Reference i : udi)
7817          dst.udi.add(i.copy());
7818      }
7819      ;
7820      if (noteNumber != null) {
7821        dst.noteNumber = new ArrayList<PositiveIntType>();
7822        for (PositiveIntType i : noteNumber)
7823          dst.noteNumber.add(i.copy());
7824      }
7825      ;
7826      if (adjudication != null) {
7827        dst.adjudication = new ArrayList<AdjudicationComponent>();
7828        for (AdjudicationComponent i : adjudication)
7829          dst.adjudication.add(i.copy());
7830      }
7831      ;
7832      if (subDetail != null) {
7833        dst.subDetail = new ArrayList<SubDetailComponent>();
7834        for (SubDetailComponent i : subDetail)
7835          dst.subDetail.add(i.copy());
7836      }
7837      ;
7838    }
7839
7840    @Override
7841    public boolean equalsDeep(Base other_) {
7842      if (!super.equalsDeep(other_))
7843        return false;
7844      if (!(other_ instanceof DetailComponent))
7845        return false;
7846      DetailComponent o = (DetailComponent) other_;
7847      return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true)
7848          && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
7849          && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
7850          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
7851          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
7852          && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
7853          && compareDeep(subDetail, o.subDetail, true);
7854    }
7855
7856    @Override
7857    public boolean equalsShallow(Base other_) {
7858      if (!super.equalsShallow(other_))
7859        return false;
7860      if (!(other_ instanceof DetailComponent))
7861        return false;
7862      DetailComponent o = (DetailComponent) other_;
7863      return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true)
7864          && compareValues(noteNumber, o.noteNumber, true);
7865    }
7866
7867    public boolean isEmpty() {
7868      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category, productOrService,
7869          modifier, programCode, quantity, unitPrice, factor, net, udi, noteNumber, adjudication, subDetail);
7870    }
7871
7872    public String fhirType() {
7873      return "ExplanationOfBenefit.item.detail";
7874
7875    }
7876
7877  }
7878
7879  @Block()
7880  public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
7881    /**
7882     * A claim detail line. Either a simple (a product or service) or a 'group' of
7883     * sub-details which are simple items.
7884     */
7885    @Child(name = "sequence", type = {
7886        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
7887    @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.")
7888    protected PositiveIntType sequence;
7889
7890    /**
7891     * The type of revenue or cost center providing the product and/or service.
7892     */
7893    @Child(name = "revenue", type = {
7894        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
7895    @Description(shortDefinition = "Revenue or cost center code", formalDefinition = "The type of revenue or cost center providing the product and/or service.")
7896    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-revenue-center")
7897    protected CodeableConcept revenue;
7898
7899    /**
7900     * Code to identify the general type of benefits under which products and
7901     * services are provided.
7902     */
7903    @Child(name = "category", type = {
7904        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
7905    @Description(shortDefinition = "Benefit classification", formalDefinition = "Code to identify the general type of benefits under which products and services are provided.")
7906    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-benefitcategory")
7907    protected CodeableConcept category;
7908
7909    /**
7910     * When the value is a group code then this item collects a set of related claim
7911     * details, otherwise this contains the product, service, drug or other billing
7912     * code for the item.
7913     */
7914    @Child(name = "productOrService", type = {
7915        CodeableConcept.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
7916    @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.")
7917    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
7918    protected CodeableConcept productOrService;
7919
7920    /**
7921     * Item typification or modifiers codes to convey additional context for the
7922     * product or service.
7923     */
7924    @Child(name = "modifier", type = {
7925        CodeableConcept.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7926    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
7927    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
7928    protected List<CodeableConcept> modifier;
7929
7930    /**
7931     * Identifies the program under which this may be recovered.
7932     */
7933    @Child(name = "programCode", type = {
7934        CodeableConcept.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7935    @Description(shortDefinition = "Program the product or service is provided under", formalDefinition = "Identifies the program under which this may be recovered.")
7936    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-program-code")
7937    protected List<CodeableConcept> programCode;
7938
7939    /**
7940     * The number of repetitions of a service or product.
7941     */
7942    @Child(name = "quantity", type = { Quantity.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
7943    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
7944    protected Quantity quantity;
7945
7946    /**
7947     * If the item is not a group then this is the fee for the product or service,
7948     * otherwise this is the total of the fees for the details of the group.
7949     */
7950    @Child(name = "unitPrice", type = { Money.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
7951    @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.")
7952    protected Money unitPrice;
7953
7954    /**
7955     * A real number that represents a multiplier used in determining the overall
7956     * value of services delivered and/or goods received. The concept of a Factor
7957     * allows for a discount or surcharge multiplier to be applied to a monetary
7958     * amount.
7959     */
7960    @Child(name = "factor", type = {
7961        DecimalType.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
7962    @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.")
7963    protected DecimalType factor;
7964
7965    /**
7966     * The quantity times the unit price for an additional service or product or
7967     * charge.
7968     */
7969    @Child(name = "net", type = { Money.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
7970    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
7971    protected Money net;
7972
7973    /**
7974     * Unique Device Identifiers associated with this line item.
7975     */
7976    @Child(name = "udi", type = {
7977        Device.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7978    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
7979    protected List<Reference> udi;
7980    /**
7981     * The actual objects that are the target of the reference (Unique Device
7982     * Identifiers associated with this line item.)
7983     */
7984    protected List<Device> udiTarget;
7985
7986    /**
7987     * The numbers associated with notes below which apply to the adjudication of
7988     * this item.
7989     */
7990    @Child(name = "noteNumber", type = {
7991        PositiveIntType.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7992    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
7993    protected List<PositiveIntType> noteNumber;
7994
7995    /**
7996     * The adjudication results.
7997     */
7998    @Child(name = "adjudication", type = {
7999        AdjudicationComponent.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8000    @Description(shortDefinition = "Subdetail level adjudication details", formalDefinition = "The adjudication results.")
8001    protected List<AdjudicationComponent> adjudication;
8002
8003    private static final long serialVersionUID = -996156853L;
8004
8005    /**
8006     * Constructor
8007     */
8008    public SubDetailComponent() {
8009      super();
8010    }
8011
8012    /**
8013     * Constructor
8014     */
8015    public SubDetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
8016      super();
8017      this.sequence = sequence;
8018      this.productOrService = productOrService;
8019    }
8020
8021    /**
8022     * @return {@link #sequence} (A claim detail line. Either a simple (a product or
8023     *         service) or a 'group' of sub-details which are simple items.). This
8024     *         is the underlying object with id, value and extensions. The accessor
8025     *         "getSequence" gives direct access to the value
8026     */
8027    public PositiveIntType getSequenceElement() {
8028      if (this.sequence == null)
8029        if (Configuration.errorOnAutoCreate())
8030          throw new Error("Attempt to auto-create SubDetailComponent.sequence");
8031        else if (Configuration.doAutoCreate())
8032          this.sequence = new PositiveIntType(); // bb
8033      return this.sequence;
8034    }
8035
8036    public boolean hasSequenceElement() {
8037      return this.sequence != null && !this.sequence.isEmpty();
8038    }
8039
8040    public boolean hasSequence() {
8041      return this.sequence != null && !this.sequence.isEmpty();
8042    }
8043
8044    /**
8045     * @param value {@link #sequence} (A claim detail line. Either a simple (a
8046     *              product or service) or a 'group' of sub-details which are simple
8047     *              items.). This is the underlying object with id, value and
8048     *              extensions. The accessor "getSequence" gives direct access to
8049     *              the value
8050     */
8051    public SubDetailComponent setSequenceElement(PositiveIntType value) {
8052      this.sequence = value;
8053      return this;
8054    }
8055
8056    /**
8057     * @return A claim detail line. Either a simple (a product or service) or a
8058     *         'group' of sub-details which are simple items.
8059     */
8060    public int getSequence() {
8061      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
8062    }
8063
8064    /**
8065     * @param value A claim detail line. Either a simple (a product or service) or a
8066     *              'group' of sub-details which are simple items.
8067     */
8068    public SubDetailComponent setSequence(int value) {
8069      if (this.sequence == null)
8070        this.sequence = new PositiveIntType();
8071      this.sequence.setValue(value);
8072      return this;
8073    }
8074
8075    /**
8076     * @return {@link #revenue} (The type of revenue or cost center providing the
8077     *         product and/or service.)
8078     */
8079    public CodeableConcept getRevenue() {
8080      if (this.revenue == null)
8081        if (Configuration.errorOnAutoCreate())
8082          throw new Error("Attempt to auto-create SubDetailComponent.revenue");
8083        else if (Configuration.doAutoCreate())
8084          this.revenue = new CodeableConcept(); // cc
8085      return this.revenue;
8086    }
8087
8088    public boolean hasRevenue() {
8089      return this.revenue != null && !this.revenue.isEmpty();
8090    }
8091
8092    /**
8093     * @param value {@link #revenue} (The type of revenue or cost center providing
8094     *              the product and/or service.)
8095     */
8096    public SubDetailComponent setRevenue(CodeableConcept value) {
8097      this.revenue = value;
8098      return this;
8099    }
8100
8101    /**
8102     * @return {@link #category} (Code to identify the general type of benefits
8103     *         under which products and services are provided.)
8104     */
8105    public CodeableConcept getCategory() {
8106      if (this.category == null)
8107        if (Configuration.errorOnAutoCreate())
8108          throw new Error("Attempt to auto-create SubDetailComponent.category");
8109        else if (Configuration.doAutoCreate())
8110          this.category = new CodeableConcept(); // cc
8111      return this.category;
8112    }
8113
8114    public boolean hasCategory() {
8115      return this.category != null && !this.category.isEmpty();
8116    }
8117
8118    /**
8119     * @param value {@link #category} (Code to identify the general type of benefits
8120     *              under which products and services are provided.)
8121     */
8122    public SubDetailComponent setCategory(CodeableConcept value) {
8123      this.category = value;
8124      return this;
8125    }
8126
8127    /**
8128     * @return {@link #productOrService} (When the value is a group code then this
8129     *         item collects a set of related claim details, otherwise this contains
8130     *         the product, service, drug or other billing code for the item.)
8131     */
8132    public CodeableConcept getProductOrService() {
8133      if (this.productOrService == null)
8134        if (Configuration.errorOnAutoCreate())
8135          throw new Error("Attempt to auto-create SubDetailComponent.productOrService");
8136        else if (Configuration.doAutoCreate())
8137          this.productOrService = new CodeableConcept(); // cc
8138      return this.productOrService;
8139    }
8140
8141    public boolean hasProductOrService() {
8142      return this.productOrService != null && !this.productOrService.isEmpty();
8143    }
8144
8145    /**
8146     * @param value {@link #productOrService} (When the value is a group code then
8147     *              this item collects a set of related claim details, otherwise
8148     *              this contains the product, service, drug or other billing code
8149     *              for the item.)
8150     */
8151    public SubDetailComponent setProductOrService(CodeableConcept value) {
8152      this.productOrService = value;
8153      return this;
8154    }
8155
8156    /**
8157     * @return {@link #modifier} (Item typification or modifiers codes to convey
8158     *         additional context for the product or service.)
8159     */
8160    public List<CodeableConcept> getModifier() {
8161      if (this.modifier == null)
8162        this.modifier = new ArrayList<CodeableConcept>();
8163      return this.modifier;
8164    }
8165
8166    /**
8167     * @return Returns a reference to <code>this</code> for easy method chaining
8168     */
8169    public SubDetailComponent setModifier(List<CodeableConcept> theModifier) {
8170      this.modifier = theModifier;
8171      return this;
8172    }
8173
8174    public boolean hasModifier() {
8175      if (this.modifier == null)
8176        return false;
8177      for (CodeableConcept item : this.modifier)
8178        if (!item.isEmpty())
8179          return true;
8180      return false;
8181    }
8182
8183    public CodeableConcept addModifier() { // 3
8184      CodeableConcept t = new CodeableConcept();
8185      if (this.modifier == null)
8186        this.modifier = new ArrayList<CodeableConcept>();
8187      this.modifier.add(t);
8188      return t;
8189    }
8190
8191    public SubDetailComponent addModifier(CodeableConcept t) { // 3
8192      if (t == null)
8193        return this;
8194      if (this.modifier == null)
8195        this.modifier = new ArrayList<CodeableConcept>();
8196      this.modifier.add(t);
8197      return this;
8198    }
8199
8200    /**
8201     * @return The first repetition of repeating field {@link #modifier}, creating
8202     *         it if it does not already exist
8203     */
8204    public CodeableConcept getModifierFirstRep() {
8205      if (getModifier().isEmpty()) {
8206        addModifier();
8207      }
8208      return getModifier().get(0);
8209    }
8210
8211    /**
8212     * @return {@link #programCode} (Identifies the program under which this may be
8213     *         recovered.)
8214     */
8215    public List<CodeableConcept> getProgramCode() {
8216      if (this.programCode == null)
8217        this.programCode = new ArrayList<CodeableConcept>();
8218      return this.programCode;
8219    }
8220
8221    /**
8222     * @return Returns a reference to <code>this</code> for easy method chaining
8223     */
8224    public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) {
8225      this.programCode = theProgramCode;
8226      return this;
8227    }
8228
8229    public boolean hasProgramCode() {
8230      if (this.programCode == null)
8231        return false;
8232      for (CodeableConcept item : this.programCode)
8233        if (!item.isEmpty())
8234          return true;
8235      return false;
8236    }
8237
8238    public CodeableConcept addProgramCode() { // 3
8239      CodeableConcept t = new CodeableConcept();
8240      if (this.programCode == null)
8241        this.programCode = new ArrayList<CodeableConcept>();
8242      this.programCode.add(t);
8243      return t;
8244    }
8245
8246    public SubDetailComponent addProgramCode(CodeableConcept t) { // 3
8247      if (t == null)
8248        return this;
8249      if (this.programCode == null)
8250        this.programCode = new ArrayList<CodeableConcept>();
8251      this.programCode.add(t);
8252      return this;
8253    }
8254
8255    /**
8256     * @return The first repetition of repeating field {@link #programCode},
8257     *         creating it if it does not already exist
8258     */
8259    public CodeableConcept getProgramCodeFirstRep() {
8260      if (getProgramCode().isEmpty()) {
8261        addProgramCode();
8262      }
8263      return getProgramCode().get(0);
8264    }
8265
8266    /**
8267     * @return {@link #quantity} (The number of repetitions of a service or
8268     *         product.)
8269     */
8270    public Quantity getQuantity() {
8271      if (this.quantity == null)
8272        if (Configuration.errorOnAutoCreate())
8273          throw new Error("Attempt to auto-create SubDetailComponent.quantity");
8274        else if (Configuration.doAutoCreate())
8275          this.quantity = new Quantity(); // cc
8276      return this.quantity;
8277    }
8278
8279    public boolean hasQuantity() {
8280      return this.quantity != null && !this.quantity.isEmpty();
8281    }
8282
8283    /**
8284     * @param value {@link #quantity} (The number of repetitions of a service or
8285     *              product.)
8286     */
8287    public SubDetailComponent setQuantity(Quantity value) {
8288      this.quantity = value;
8289      return this;
8290    }
8291
8292    /**
8293     * @return {@link #unitPrice} (If the item is not a group then this is the fee
8294     *         for the product or service, otherwise this is the total of the fees
8295     *         for the details of the group.)
8296     */
8297    public Money getUnitPrice() {
8298      if (this.unitPrice == null)
8299        if (Configuration.errorOnAutoCreate())
8300          throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
8301        else if (Configuration.doAutoCreate())
8302          this.unitPrice = new Money(); // cc
8303      return this.unitPrice;
8304    }
8305
8306    public boolean hasUnitPrice() {
8307      return this.unitPrice != null && !this.unitPrice.isEmpty();
8308    }
8309
8310    /**
8311     * @param value {@link #unitPrice} (If the item is not a group then this is the
8312     *              fee for the product or service, otherwise this is the total of
8313     *              the fees for the details of the group.)
8314     */
8315    public SubDetailComponent setUnitPrice(Money value) {
8316      this.unitPrice = value;
8317      return this;
8318    }
8319
8320    /**
8321     * @return {@link #factor} (A real number that represents a multiplier used in
8322     *         determining the overall value of services delivered and/or goods
8323     *         received. The concept of a Factor allows for a discount or surcharge
8324     *         multiplier to be applied to a monetary amount.). This is the
8325     *         underlying object with id, value and extensions. The accessor
8326     *         "getFactor" gives direct access to the value
8327     */
8328    public DecimalType getFactorElement() {
8329      if (this.factor == null)
8330        if (Configuration.errorOnAutoCreate())
8331          throw new Error("Attempt to auto-create SubDetailComponent.factor");
8332        else if (Configuration.doAutoCreate())
8333          this.factor = new DecimalType(); // bb
8334      return this.factor;
8335    }
8336
8337    public boolean hasFactorElement() {
8338      return this.factor != null && !this.factor.isEmpty();
8339    }
8340
8341    public boolean hasFactor() {
8342      return this.factor != null && !this.factor.isEmpty();
8343    }
8344
8345    /**
8346     * @param value {@link #factor} (A real number that represents a multiplier used
8347     *              in determining the overall value of services delivered and/or
8348     *              goods received. The concept of a Factor allows for a discount or
8349     *              surcharge multiplier to be applied to a monetary amount.). This
8350     *              is the underlying object with id, value and extensions. The
8351     *              accessor "getFactor" gives direct access to the value
8352     */
8353    public SubDetailComponent setFactorElement(DecimalType value) {
8354      this.factor = value;
8355      return this;
8356    }
8357
8358    /**
8359     * @return A real number that represents a multiplier used in determining the
8360     *         overall value of services delivered and/or goods received. The
8361     *         concept of a Factor allows for a discount or surcharge multiplier to
8362     *         be applied to a monetary amount.
8363     */
8364    public BigDecimal getFactor() {
8365      return this.factor == null ? null : this.factor.getValue();
8366    }
8367
8368    /**
8369     * @param value A real number that represents a multiplier used in determining
8370     *              the overall value of services delivered and/or goods received.
8371     *              The concept of a Factor allows for a discount or surcharge
8372     *              multiplier to be applied to a monetary amount.
8373     */
8374    public SubDetailComponent setFactor(BigDecimal value) {
8375      if (value == null)
8376        this.factor = null;
8377      else {
8378        if (this.factor == null)
8379          this.factor = new DecimalType();
8380        this.factor.setValue(value);
8381      }
8382      return this;
8383    }
8384
8385    /**
8386     * @param value A real number that represents a multiplier used in determining
8387     *              the overall value of services delivered and/or goods received.
8388     *              The concept of a Factor allows for a discount or surcharge
8389     *              multiplier to be applied to a monetary amount.
8390     */
8391    public SubDetailComponent setFactor(long value) {
8392      this.factor = new DecimalType();
8393      this.factor.setValue(value);
8394      return this;
8395    }
8396
8397    /**
8398     * @param value A real number that represents a multiplier used in determining
8399     *              the overall value of services delivered and/or goods received.
8400     *              The concept of a Factor allows for a discount or surcharge
8401     *              multiplier to be applied to a monetary amount.
8402     */
8403    public SubDetailComponent setFactor(double value) {
8404      this.factor = new DecimalType();
8405      this.factor.setValue(value);
8406      return this;
8407    }
8408
8409    /**
8410     * @return {@link #net} (The quantity times the unit price for an additional
8411     *         service or product or charge.)
8412     */
8413    public Money getNet() {
8414      if (this.net == null)
8415        if (Configuration.errorOnAutoCreate())
8416          throw new Error("Attempt to auto-create SubDetailComponent.net");
8417        else if (Configuration.doAutoCreate())
8418          this.net = new Money(); // cc
8419      return this.net;
8420    }
8421
8422    public boolean hasNet() {
8423      return this.net != null && !this.net.isEmpty();
8424    }
8425
8426    /**
8427     * @param value {@link #net} (The quantity times the unit price for an
8428     *              additional service or product or charge.)
8429     */
8430    public SubDetailComponent setNet(Money value) {
8431      this.net = value;
8432      return this;
8433    }
8434
8435    /**
8436     * @return {@link #udi} (Unique Device Identifiers associated with this line
8437     *         item.)
8438     */
8439    public List<Reference> getUdi() {
8440      if (this.udi == null)
8441        this.udi = new ArrayList<Reference>();
8442      return this.udi;
8443    }
8444
8445    /**
8446     * @return Returns a reference to <code>this</code> for easy method chaining
8447     */
8448    public SubDetailComponent setUdi(List<Reference> theUdi) {
8449      this.udi = theUdi;
8450      return this;
8451    }
8452
8453    public boolean hasUdi() {
8454      if (this.udi == null)
8455        return false;
8456      for (Reference item : this.udi)
8457        if (!item.isEmpty())
8458          return true;
8459      return false;
8460    }
8461
8462    public Reference addUdi() { // 3
8463      Reference t = new Reference();
8464      if (this.udi == null)
8465        this.udi = new ArrayList<Reference>();
8466      this.udi.add(t);
8467      return t;
8468    }
8469
8470    public SubDetailComponent addUdi(Reference t) { // 3
8471      if (t == null)
8472        return this;
8473      if (this.udi == null)
8474        this.udi = new ArrayList<Reference>();
8475      this.udi.add(t);
8476      return this;
8477    }
8478
8479    /**
8480     * @return The first repetition of repeating field {@link #udi}, creating it if
8481     *         it does not already exist
8482     */
8483    public Reference getUdiFirstRep() {
8484      if (getUdi().isEmpty()) {
8485        addUdi();
8486      }
8487      return getUdi().get(0);
8488    }
8489
8490    /**
8491     * @deprecated Use Reference#setResource(IBaseResource) instead
8492     */
8493    @Deprecated
8494    public List<Device> getUdiTarget() {
8495      if (this.udiTarget == null)
8496        this.udiTarget = new ArrayList<Device>();
8497      return this.udiTarget;
8498    }
8499
8500    /**
8501     * @deprecated Use Reference#setResource(IBaseResource) instead
8502     */
8503    @Deprecated
8504    public Device addUdiTarget() {
8505      Device r = new Device();
8506      if (this.udiTarget == null)
8507        this.udiTarget = new ArrayList<Device>();
8508      this.udiTarget.add(r);
8509      return r;
8510    }
8511
8512    /**
8513     * @return {@link #noteNumber} (The numbers associated with notes below which
8514     *         apply to the adjudication of this item.)
8515     */
8516    public List<PositiveIntType> getNoteNumber() {
8517      if (this.noteNumber == null)
8518        this.noteNumber = new ArrayList<PositiveIntType>();
8519      return this.noteNumber;
8520    }
8521
8522    /**
8523     * @return Returns a reference to <code>this</code> for easy method chaining
8524     */
8525    public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
8526      this.noteNumber = theNoteNumber;
8527      return this;
8528    }
8529
8530    public boolean hasNoteNumber() {
8531      if (this.noteNumber == null)
8532        return false;
8533      for (PositiveIntType item : this.noteNumber)
8534        if (!item.isEmpty())
8535          return true;
8536      return false;
8537    }
8538
8539    /**
8540     * @return {@link #noteNumber} (The numbers associated with notes below which
8541     *         apply to the adjudication of this item.)
8542     */
8543    public PositiveIntType addNoteNumberElement() {// 2
8544      PositiveIntType t = new PositiveIntType();
8545      if (this.noteNumber == null)
8546        this.noteNumber = new ArrayList<PositiveIntType>();
8547      this.noteNumber.add(t);
8548      return t;
8549    }
8550
8551    /**
8552     * @param value {@link #noteNumber} (The numbers associated with notes below
8553     *              which apply to the adjudication of this item.)
8554     */
8555    public SubDetailComponent addNoteNumber(int value) { // 1
8556      PositiveIntType t = new PositiveIntType();
8557      t.setValue(value);
8558      if (this.noteNumber == null)
8559        this.noteNumber = new ArrayList<PositiveIntType>();
8560      this.noteNumber.add(t);
8561      return this;
8562    }
8563
8564    /**
8565     * @param value {@link #noteNumber} (The numbers associated with notes below
8566     *              which apply to the adjudication of this item.)
8567     */
8568    public boolean hasNoteNumber(int value) {
8569      if (this.noteNumber == null)
8570        return false;
8571      for (PositiveIntType v : this.noteNumber)
8572        if (v.getValue().equals(value)) // positiveInt
8573          return true;
8574      return false;
8575    }
8576
8577    /**
8578     * @return {@link #adjudication} (The adjudication results.)
8579     */
8580    public List<AdjudicationComponent> getAdjudication() {
8581      if (this.adjudication == null)
8582        this.adjudication = new ArrayList<AdjudicationComponent>();
8583      return this.adjudication;
8584    }
8585
8586    /**
8587     * @return Returns a reference to <code>this</code> for easy method chaining
8588     */
8589    public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
8590      this.adjudication = theAdjudication;
8591      return this;
8592    }
8593
8594    public boolean hasAdjudication() {
8595      if (this.adjudication == null)
8596        return false;
8597      for (AdjudicationComponent item : this.adjudication)
8598        if (!item.isEmpty())
8599          return true;
8600      return false;
8601    }
8602
8603    public AdjudicationComponent addAdjudication() { // 3
8604      AdjudicationComponent t = new AdjudicationComponent();
8605      if (this.adjudication == null)
8606        this.adjudication = new ArrayList<AdjudicationComponent>();
8607      this.adjudication.add(t);
8608      return t;
8609    }
8610
8611    public SubDetailComponent addAdjudication(AdjudicationComponent t) { // 3
8612      if (t == null)
8613        return this;
8614      if (this.adjudication == null)
8615        this.adjudication = new ArrayList<AdjudicationComponent>();
8616      this.adjudication.add(t);
8617      return this;
8618    }
8619
8620    /**
8621     * @return The first repetition of repeating field {@link #adjudication},
8622     *         creating it if it does not already exist
8623     */
8624    public AdjudicationComponent getAdjudicationFirstRep() {
8625      if (getAdjudication().isEmpty()) {
8626        addAdjudication();
8627      }
8628      return getAdjudication().get(0);
8629    }
8630
8631    protected void listChildren(List<Property> children) {
8632      super.listChildren(children);
8633      children.add(new Property("sequence", "positiveInt",
8634          "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
8635          0, 1, sequence));
8636      children.add(new Property("revenue", "CodeableConcept",
8637          "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
8638      children.add(new Property("category", "CodeableConcept",
8639          "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
8640          category));
8641      children.add(new Property("productOrService", "CodeableConcept",
8642          "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.",
8643          0, 1, productOrService));
8644      children.add(new Property("modifier", "CodeableConcept",
8645          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
8646          java.lang.Integer.MAX_VALUE, modifier));
8647      children.add(new Property("programCode", "CodeableConcept",
8648          "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
8649      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
8650          1, quantity));
8651      children.add(new Property("unitPrice", "Money",
8652          "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.",
8653          0, 1, unitPrice));
8654      children.add(new Property("factor", "decimal",
8655          "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.",
8656          0, 1, factor));
8657      children.add(new Property("net", "Money",
8658          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
8659      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
8660          0, java.lang.Integer.MAX_VALUE, udi));
8661      children.add(new Property("noteNumber", "positiveInt",
8662          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
8663          java.lang.Integer.MAX_VALUE, noteNumber));
8664      children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.",
8665          0, java.lang.Integer.MAX_VALUE, adjudication));
8666    }
8667
8668    @Override
8669    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8670      switch (_hash) {
8671      case 1349547969:
8672        /* sequence */ return new Property("sequence", "positiveInt",
8673            "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
8674            0, 1, sequence);
8675      case 1099842588:
8676        /* revenue */ return new Property("revenue", "CodeableConcept",
8677            "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
8678      case 50511102:
8679        /* category */ return new Property("category", "CodeableConcept",
8680            "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
8681            category);
8682      case 1957227299:
8683        /* productOrService */ return new Property("productOrService", "CodeableConcept",
8684            "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.",
8685            0, 1, productOrService);
8686      case -615513385:
8687        /* modifier */ return new Property("modifier", "CodeableConcept",
8688            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
8689            java.lang.Integer.MAX_VALUE, modifier);
8690      case 1010065041:
8691        /* programCode */ return new Property("programCode", "CodeableConcept",
8692            "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
8693      case -1285004149:
8694        /* quantity */ return new Property("quantity", "SimpleQuantity",
8695            "The number of repetitions of a service or product.", 0, 1, quantity);
8696      case -486196699:
8697        /* unitPrice */ return new Property("unitPrice", "Money",
8698            "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.",
8699            0, 1, unitPrice);
8700      case -1282148017:
8701        /* factor */ return new Property("factor", "decimal",
8702            "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.",
8703            0, 1, factor);
8704      case 108957:
8705        /* net */ return new Property("net", "Money",
8706            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
8707      case 115642:
8708        /* udi */ return new Property("udi", "Reference(Device)",
8709            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
8710      case -1110033957:
8711        /* noteNumber */ return new Property("noteNumber", "positiveInt",
8712            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
8713            java.lang.Integer.MAX_VALUE, noteNumber);
8714      case -231349275:
8715        /* adjudication */ return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
8716            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
8717      default:
8718        return super.getNamedProperty(_hash, _name, _checkValid);
8719      }
8720
8721    }
8722
8723    @Override
8724    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8725      switch (hash) {
8726      case 1349547969:
8727        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
8728      case 1099842588:
8729        /* revenue */ return this.revenue == null ? new Base[0] : new Base[] { this.revenue }; // CodeableConcept
8730      case 50511102:
8731        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
8732      case 1957227299:
8733        /* productOrService */ return this.productOrService == null ? new Base[0]
8734            : new Base[] { this.productOrService }; // CodeableConcept
8735      case -615513385:
8736        /* modifier */ return this.modifier == null ? new Base[0]
8737            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
8738      case 1010065041:
8739        /* programCode */ return this.programCode == null ? new Base[0]
8740            : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
8741      case -1285004149:
8742        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
8743      case -486196699:
8744        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
8745      case -1282148017:
8746        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
8747      case 108957:
8748        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
8749      case 115642:
8750        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
8751      case -1110033957:
8752        /* noteNumber */ return this.noteNumber == null ? new Base[0]
8753            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
8754      case -231349275:
8755        /* adjudication */ return this.adjudication == null ? new Base[0]
8756            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
8757      default:
8758        return super.getProperty(hash, name, checkValid);
8759      }
8760
8761    }
8762
8763    @Override
8764    public Base setProperty(int hash, String name, Base value) throws FHIRException {
8765      switch (hash) {
8766      case 1349547969: // sequence
8767        this.sequence = castToPositiveInt(value); // PositiveIntType
8768        return value;
8769      case 1099842588: // revenue
8770        this.revenue = castToCodeableConcept(value); // CodeableConcept
8771        return value;
8772      case 50511102: // category
8773        this.category = castToCodeableConcept(value); // CodeableConcept
8774        return value;
8775      case 1957227299: // productOrService
8776        this.productOrService = castToCodeableConcept(value); // CodeableConcept
8777        return value;
8778      case -615513385: // modifier
8779        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
8780        return value;
8781      case 1010065041: // programCode
8782        this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
8783        return value;
8784      case -1285004149: // quantity
8785        this.quantity = castToQuantity(value); // Quantity
8786        return value;
8787      case -486196699: // unitPrice
8788        this.unitPrice = castToMoney(value); // Money
8789        return value;
8790      case -1282148017: // factor
8791        this.factor = castToDecimal(value); // DecimalType
8792        return value;
8793      case 108957: // net
8794        this.net = castToMoney(value); // Money
8795        return value;
8796      case 115642: // udi
8797        this.getUdi().add(castToReference(value)); // Reference
8798        return value;
8799      case -1110033957: // noteNumber
8800        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
8801        return value;
8802      case -231349275: // adjudication
8803        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
8804        return value;
8805      default:
8806        return super.setProperty(hash, name, value);
8807      }
8808
8809    }
8810
8811    @Override
8812    public Base setProperty(String name, Base value) throws FHIRException {
8813      if (name.equals("sequence")) {
8814        this.sequence = castToPositiveInt(value); // PositiveIntType
8815      } else if (name.equals("revenue")) {
8816        this.revenue = castToCodeableConcept(value); // CodeableConcept
8817      } else if (name.equals("category")) {
8818        this.category = castToCodeableConcept(value); // CodeableConcept
8819      } else if (name.equals("productOrService")) {
8820        this.productOrService = castToCodeableConcept(value); // CodeableConcept
8821      } else if (name.equals("modifier")) {
8822        this.getModifier().add(castToCodeableConcept(value));
8823      } else if (name.equals("programCode")) {
8824        this.getProgramCode().add(castToCodeableConcept(value));
8825      } else if (name.equals("quantity")) {
8826        this.quantity = castToQuantity(value); // Quantity
8827      } else if (name.equals("unitPrice")) {
8828        this.unitPrice = castToMoney(value); // Money
8829      } else if (name.equals("factor")) {
8830        this.factor = castToDecimal(value); // DecimalType
8831      } else if (name.equals("net")) {
8832        this.net = castToMoney(value); // Money
8833      } else if (name.equals("udi")) {
8834        this.getUdi().add(castToReference(value));
8835      } else if (name.equals("noteNumber")) {
8836        this.getNoteNumber().add(castToPositiveInt(value));
8837      } else if (name.equals("adjudication")) {
8838        this.getAdjudication().add((AdjudicationComponent) value);
8839      } else
8840        return super.setProperty(name, value);
8841      return value;
8842    }
8843
8844    @Override
8845    public Base makeProperty(int hash, String name) throws FHIRException {
8846      switch (hash) {
8847      case 1349547969:
8848        return getSequenceElement();
8849      case 1099842588:
8850        return getRevenue();
8851      case 50511102:
8852        return getCategory();
8853      case 1957227299:
8854        return getProductOrService();
8855      case -615513385:
8856        return addModifier();
8857      case 1010065041:
8858        return addProgramCode();
8859      case -1285004149:
8860        return getQuantity();
8861      case -486196699:
8862        return getUnitPrice();
8863      case -1282148017:
8864        return getFactorElement();
8865      case 108957:
8866        return getNet();
8867      case 115642:
8868        return addUdi();
8869      case -1110033957:
8870        return addNoteNumberElement();
8871      case -231349275:
8872        return addAdjudication();
8873      default:
8874        return super.makeProperty(hash, name);
8875      }
8876
8877    }
8878
8879    @Override
8880    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8881      switch (hash) {
8882      case 1349547969:
8883        /* sequence */ return new String[] { "positiveInt" };
8884      case 1099842588:
8885        /* revenue */ return new String[] { "CodeableConcept" };
8886      case 50511102:
8887        /* category */ return new String[] { "CodeableConcept" };
8888      case 1957227299:
8889        /* productOrService */ return new String[] { "CodeableConcept" };
8890      case -615513385:
8891        /* modifier */ return new String[] { "CodeableConcept" };
8892      case 1010065041:
8893        /* programCode */ return new String[] { "CodeableConcept" };
8894      case -1285004149:
8895        /* quantity */ return new String[] { "SimpleQuantity" };
8896      case -486196699:
8897        /* unitPrice */ return new String[] { "Money" };
8898      case -1282148017:
8899        /* factor */ return new String[] { "decimal" };
8900      case 108957:
8901        /* net */ return new String[] { "Money" };
8902      case 115642:
8903        /* udi */ return new String[] { "Reference" };
8904      case -1110033957:
8905        /* noteNumber */ return new String[] { "positiveInt" };
8906      case -231349275:
8907        /* adjudication */ return new String[] { "@ExplanationOfBenefit.item.adjudication" };
8908      default:
8909        return super.getTypesForProperty(hash, name);
8910      }
8911
8912    }
8913
8914    @Override
8915    public Base addChild(String name) throws FHIRException {
8916      if (name.equals("sequence")) {
8917        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
8918      } else if (name.equals("revenue")) {
8919        this.revenue = new CodeableConcept();
8920        return this.revenue;
8921      } else if (name.equals("category")) {
8922        this.category = new CodeableConcept();
8923        return this.category;
8924      } else if (name.equals("productOrService")) {
8925        this.productOrService = new CodeableConcept();
8926        return this.productOrService;
8927      } else if (name.equals("modifier")) {
8928        return addModifier();
8929      } else if (name.equals("programCode")) {
8930        return addProgramCode();
8931      } else if (name.equals("quantity")) {
8932        this.quantity = new Quantity();
8933        return this.quantity;
8934      } else if (name.equals("unitPrice")) {
8935        this.unitPrice = new Money();
8936        return this.unitPrice;
8937      } else if (name.equals("factor")) {
8938        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
8939      } else if (name.equals("net")) {
8940        this.net = new Money();
8941        return this.net;
8942      } else if (name.equals("udi")) {
8943        return addUdi();
8944      } else if (name.equals("noteNumber")) {
8945        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
8946      } else if (name.equals("adjudication")) {
8947        return addAdjudication();
8948      } else
8949        return super.addChild(name);
8950    }
8951
8952    public SubDetailComponent copy() {
8953      SubDetailComponent dst = new SubDetailComponent();
8954      copyValues(dst);
8955      return dst;
8956    }
8957
8958    public void copyValues(SubDetailComponent dst) {
8959      super.copyValues(dst);
8960      dst.sequence = sequence == null ? null : sequence.copy();
8961      dst.revenue = revenue == null ? null : revenue.copy();
8962      dst.category = category == null ? null : category.copy();
8963      dst.productOrService = productOrService == null ? null : productOrService.copy();
8964      if (modifier != null) {
8965        dst.modifier = new ArrayList<CodeableConcept>();
8966        for (CodeableConcept i : modifier)
8967          dst.modifier.add(i.copy());
8968      }
8969      ;
8970      if (programCode != null) {
8971        dst.programCode = new ArrayList<CodeableConcept>();
8972        for (CodeableConcept i : programCode)
8973          dst.programCode.add(i.copy());
8974      }
8975      ;
8976      dst.quantity = quantity == null ? null : quantity.copy();
8977      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
8978      dst.factor = factor == null ? null : factor.copy();
8979      dst.net = net == null ? null : net.copy();
8980      if (udi != null) {
8981        dst.udi = new ArrayList<Reference>();
8982        for (Reference i : udi)
8983          dst.udi.add(i.copy());
8984      }
8985      ;
8986      if (noteNumber != null) {
8987        dst.noteNumber = new ArrayList<PositiveIntType>();
8988        for (PositiveIntType i : noteNumber)
8989          dst.noteNumber.add(i.copy());
8990      }
8991      ;
8992      if (adjudication != null) {
8993        dst.adjudication = new ArrayList<AdjudicationComponent>();
8994        for (AdjudicationComponent i : adjudication)
8995          dst.adjudication.add(i.copy());
8996      }
8997      ;
8998    }
8999
9000    @Override
9001    public boolean equalsDeep(Base other_) {
9002      if (!super.equalsDeep(other_))
9003        return false;
9004      if (!(other_ instanceof SubDetailComponent))
9005        return false;
9006      SubDetailComponent o = (SubDetailComponent) other_;
9007      return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true)
9008          && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
9009          && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
9010          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
9011          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
9012          && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true);
9013    }
9014
9015    @Override
9016    public boolean equalsShallow(Base other_) {
9017      if (!super.equalsShallow(other_))
9018        return false;
9019      if (!(other_ instanceof SubDetailComponent))
9020        return false;
9021      SubDetailComponent o = (SubDetailComponent) other_;
9022      return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true)
9023          && compareValues(noteNumber, o.noteNumber, true);
9024    }
9025
9026    public boolean isEmpty() {
9027      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category, productOrService,
9028          modifier, programCode, quantity, unitPrice, factor, net, udi, noteNumber, adjudication);
9029    }
9030
9031    public String fhirType() {
9032      return "ExplanationOfBenefit.item.detail.subDetail";
9033
9034    }
9035
9036  }
9037
9038  @Block()
9039  public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
9040    /**
9041     * Claim items which this service line is intended to replace.
9042     */
9043    @Child(name = "itemSequence", type = {
9044        PositiveIntType.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9045    @Description(shortDefinition = "Item sequence number", formalDefinition = "Claim items which this service line is intended to replace.")
9046    protected List<PositiveIntType> itemSequence;
9047
9048    /**
9049     * The sequence number of the details within the claim item which this line is
9050     * intended to replace.
9051     */
9052    @Child(name = "detailSequence", type = {
9053        PositiveIntType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9054    @Description(shortDefinition = "Detail sequence number", formalDefinition = "The sequence number of the details within the claim item which this line is intended to replace.")
9055    protected List<PositiveIntType> detailSequence;
9056
9057    /**
9058     * The sequence number of the sub-details woithin the details within the claim
9059     * item which this line is intended to replace.
9060     */
9061    @Child(name = "subDetailSequence", type = {
9062        PositiveIntType.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9063    @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.")
9064    protected List<PositiveIntType> subDetailSequence;
9065
9066    /**
9067     * The providers who are authorized for the services rendered to the patient.
9068     */
9069    @Child(name = "provider", type = { Practitioner.class, PractitionerRole.class,
9070        Organization.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9071    @Description(shortDefinition = "Authorized providers", formalDefinition = "The providers who are authorized for the services rendered to the patient.")
9072    protected List<Reference> provider;
9073    /**
9074     * The actual objects that are the target of the reference (The providers who
9075     * are authorized for the services rendered to the patient.)
9076     */
9077    protected List<Resource> providerTarget;
9078
9079    /**
9080     * When the value is a group code then this item collects a set of related claim
9081     * details, otherwise this contains the product, service, drug or other billing
9082     * code for the item.
9083     */
9084    @Child(name = "productOrService", type = {
9085        CodeableConcept.class }, order = 5, min = 1, max = 1, modifier = false, summary = false)
9086    @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.")
9087    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
9088    protected CodeableConcept productOrService;
9089
9090    /**
9091     * Item typification or modifiers codes to convey additional context for the
9092     * product or service.
9093     */
9094    @Child(name = "modifier", type = {
9095        CodeableConcept.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9096    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
9097    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
9098    protected List<CodeableConcept> modifier;
9099
9100    /**
9101     * Identifies the program under which this may be recovered.
9102     */
9103    @Child(name = "programCode", type = {
9104        CodeableConcept.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9105    @Description(shortDefinition = "Program the product or service is provided under", formalDefinition = "Identifies the program under which this may be recovered.")
9106    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-program-code")
9107    protected List<CodeableConcept> programCode;
9108
9109    /**
9110     * The date or dates when the service or product was supplied, performed or
9111     * completed.
9112     */
9113    @Child(name = "serviced", type = { DateType.class,
9114        Period.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
9115    @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.")
9116    protected Type serviced;
9117
9118    /**
9119     * Where the product or service was provided.
9120     */
9121    @Child(name = "location", type = { CodeableConcept.class, Address.class,
9122        Location.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
9123    @Description(shortDefinition = "Place of service or where product was supplied", formalDefinition = "Where the product or service was provided.")
9124    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-place")
9125    protected Type location;
9126
9127    /**
9128     * The number of repetitions of a service or product.
9129     */
9130    @Child(name = "quantity", type = {
9131        Quantity.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
9132    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
9133    protected Quantity quantity;
9134
9135    /**
9136     * If the item is not a group then this is the fee for the product or service,
9137     * otherwise this is the total of the fees for the details of the group.
9138     */
9139    @Child(name = "unitPrice", type = { Money.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
9140    @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.")
9141    protected Money unitPrice;
9142
9143    /**
9144     * A real number that represents a multiplier used in determining the overall
9145     * value of services delivered and/or goods received. The concept of a Factor
9146     * allows for a discount or surcharge multiplier to be applied to a monetary
9147     * amount.
9148     */
9149    @Child(name = "factor", type = {
9150        DecimalType.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
9151    @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.")
9152    protected DecimalType factor;
9153
9154    /**
9155     * The quantity times the unit price for an additional service or product or
9156     * charge.
9157     */
9158    @Child(name = "net", type = { Money.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
9159    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
9160    protected Money net;
9161
9162    /**
9163     * Physical service site on the patient (limb, tooth, etc.).
9164     */
9165    @Child(name = "bodySite", type = {
9166        CodeableConcept.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
9167    @Description(shortDefinition = "Anatomical location", formalDefinition = "Physical service site on the patient (limb, tooth, etc.).")
9168    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/tooth")
9169    protected CodeableConcept bodySite;
9170
9171    /**
9172     * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
9173     */
9174    @Child(name = "subSite", type = {
9175        CodeableConcept.class }, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9176    @Description(shortDefinition = "Anatomical sub-location", formalDefinition = "A region or surface of the bodySite, e.g. limb region or tooth surface(s).")
9177    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/surface")
9178    protected List<CodeableConcept> subSite;
9179
9180    /**
9181     * The numbers associated with notes below which apply to the adjudication of
9182     * this item.
9183     */
9184    @Child(name = "noteNumber", type = {
9185        PositiveIntType.class }, order = 16, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9186    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
9187    protected List<PositiveIntType> noteNumber;
9188
9189    /**
9190     * The adjudication results.
9191     */
9192    @Child(name = "adjudication", type = {
9193        AdjudicationComponent.class }, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9194    @Description(shortDefinition = "Added items adjudication", formalDefinition = "The adjudication results.")
9195    protected List<AdjudicationComponent> adjudication;
9196
9197    /**
9198     * The second-tier service adjudications for payor added services.
9199     */
9200    @Child(name = "detail", type = {}, order = 18, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9201    @Description(shortDefinition = "Insurer added line items", formalDefinition = "The second-tier service adjudications for payor added services.")
9202    protected List<AddedItemDetailComponent> detail;
9203
9204    private static final long serialVersionUID = -206524210L;
9205
9206    /**
9207     * Constructor
9208     */
9209    public AddedItemComponent() {
9210      super();
9211    }
9212
9213    /**
9214     * Constructor
9215     */
9216    public AddedItemComponent(CodeableConcept productOrService) {
9217      super();
9218      this.productOrService = productOrService;
9219    }
9220
9221    /**
9222     * @return {@link #itemSequence} (Claim items which this service line is
9223     *         intended to replace.)
9224     */
9225    public List<PositiveIntType> getItemSequence() {
9226      if (this.itemSequence == null)
9227        this.itemSequence = new ArrayList<PositiveIntType>();
9228      return this.itemSequence;
9229    }
9230
9231    /**
9232     * @return Returns a reference to <code>this</code> for easy method chaining
9233     */
9234    public AddedItemComponent setItemSequence(List<PositiveIntType> theItemSequence) {
9235      this.itemSequence = theItemSequence;
9236      return this;
9237    }
9238
9239    public boolean hasItemSequence() {
9240      if (this.itemSequence == null)
9241        return false;
9242      for (PositiveIntType item : this.itemSequence)
9243        if (!item.isEmpty())
9244          return true;
9245      return false;
9246    }
9247
9248    /**
9249     * @return {@link #itemSequence} (Claim items which this service line is
9250     *         intended to replace.)
9251     */
9252    public PositiveIntType addItemSequenceElement() {// 2
9253      PositiveIntType t = new PositiveIntType();
9254      if (this.itemSequence == null)
9255        this.itemSequence = new ArrayList<PositiveIntType>();
9256      this.itemSequence.add(t);
9257      return t;
9258    }
9259
9260    /**
9261     * @param value {@link #itemSequence} (Claim items which this service line is
9262     *              intended to replace.)
9263     */
9264    public AddedItemComponent addItemSequence(int value) { // 1
9265      PositiveIntType t = new PositiveIntType();
9266      t.setValue(value);
9267      if (this.itemSequence == null)
9268        this.itemSequence = new ArrayList<PositiveIntType>();
9269      this.itemSequence.add(t);
9270      return this;
9271    }
9272
9273    /**
9274     * @param value {@link #itemSequence} (Claim items which this service line is
9275     *              intended to replace.)
9276     */
9277    public boolean hasItemSequence(int value) {
9278      if (this.itemSequence == null)
9279        return false;
9280      for (PositiveIntType v : this.itemSequence)
9281        if (v.getValue().equals(value)) // positiveInt
9282          return true;
9283      return false;
9284    }
9285
9286    /**
9287     * @return {@link #detailSequence} (The sequence number of the details within
9288     *         the claim item which this line is intended to replace.)
9289     */
9290    public List<PositiveIntType> getDetailSequence() {
9291      if (this.detailSequence == null)
9292        this.detailSequence = new ArrayList<PositiveIntType>();
9293      return this.detailSequence;
9294    }
9295
9296    /**
9297     * @return Returns a reference to <code>this</code> for easy method chaining
9298     */
9299    public AddedItemComponent setDetailSequence(List<PositiveIntType> theDetailSequence) {
9300      this.detailSequence = theDetailSequence;
9301      return this;
9302    }
9303
9304    public boolean hasDetailSequence() {
9305      if (this.detailSequence == null)
9306        return false;
9307      for (PositiveIntType item : this.detailSequence)
9308        if (!item.isEmpty())
9309          return true;
9310      return false;
9311    }
9312
9313    /**
9314     * @return {@link #detailSequence} (The sequence number of the details within
9315     *         the claim item which this line is intended to replace.)
9316     */
9317    public PositiveIntType addDetailSequenceElement() {// 2
9318      PositiveIntType t = new PositiveIntType();
9319      if (this.detailSequence == null)
9320        this.detailSequence = new ArrayList<PositiveIntType>();
9321      this.detailSequence.add(t);
9322      return t;
9323    }
9324
9325    /**
9326     * @param value {@link #detailSequence} (The sequence number of the details
9327     *              within the claim item which this line is intended to replace.)
9328     */
9329    public AddedItemComponent addDetailSequence(int value) { // 1
9330      PositiveIntType t = new PositiveIntType();
9331      t.setValue(value);
9332      if (this.detailSequence == null)
9333        this.detailSequence = new ArrayList<PositiveIntType>();
9334      this.detailSequence.add(t);
9335      return this;
9336    }
9337
9338    /**
9339     * @param value {@link #detailSequence} (The sequence number of the details
9340     *              within the claim item which this line is intended to replace.)
9341     */
9342    public boolean hasDetailSequence(int value) {
9343      if (this.detailSequence == null)
9344        return false;
9345      for (PositiveIntType v : this.detailSequence)
9346        if (v.getValue().equals(value)) // positiveInt
9347          return true;
9348      return false;
9349    }
9350
9351    /**
9352     * @return {@link #subDetailSequence} (The sequence number of the sub-details
9353     *         woithin the details within the claim item which this line is intended
9354     *         to replace.)
9355     */
9356    public List<PositiveIntType> getSubDetailSequence() {
9357      if (this.subDetailSequence == null)
9358        this.subDetailSequence = new ArrayList<PositiveIntType>();
9359      return this.subDetailSequence;
9360    }
9361
9362    /**
9363     * @return Returns a reference to <code>this</code> for easy method chaining
9364     */
9365    public AddedItemComponent setSubDetailSequence(List<PositiveIntType> theSubDetailSequence) {
9366      this.subDetailSequence = theSubDetailSequence;
9367      return this;
9368    }
9369
9370    public boolean hasSubDetailSequence() {
9371      if (this.subDetailSequence == null)
9372        return false;
9373      for (PositiveIntType item : this.subDetailSequence)
9374        if (!item.isEmpty())
9375          return true;
9376      return false;
9377    }
9378
9379    /**
9380     * @return {@link #subDetailSequence} (The sequence number of the sub-details
9381     *         woithin the details within the claim item which this line is intended
9382     *         to replace.)
9383     */
9384    public PositiveIntType addSubDetailSequenceElement() {// 2
9385      PositiveIntType t = new PositiveIntType();
9386      if (this.subDetailSequence == null)
9387        this.subDetailSequence = new ArrayList<PositiveIntType>();
9388      this.subDetailSequence.add(t);
9389      return t;
9390    }
9391
9392    /**
9393     * @param value {@link #subDetailSequence} (The sequence number of the
9394     *              sub-details woithin the details within the claim item which this
9395     *              line is intended to replace.)
9396     */
9397    public AddedItemComponent addSubDetailSequence(int value) { // 1
9398      PositiveIntType t = new PositiveIntType();
9399      t.setValue(value);
9400      if (this.subDetailSequence == null)
9401        this.subDetailSequence = new ArrayList<PositiveIntType>();
9402      this.subDetailSequence.add(t);
9403      return this;
9404    }
9405
9406    /**
9407     * @param value {@link #subDetailSequence} (The sequence number of the
9408     *              sub-details woithin the details within the claim item which this
9409     *              line is intended to replace.)
9410     */
9411    public boolean hasSubDetailSequence(int value) {
9412      if (this.subDetailSequence == null)
9413        return false;
9414      for (PositiveIntType v : this.subDetailSequence)
9415        if (v.getValue().equals(value)) // positiveInt
9416          return true;
9417      return false;
9418    }
9419
9420    /**
9421     * @return {@link #provider} (The providers who are authorized for the services
9422     *         rendered to the patient.)
9423     */
9424    public List<Reference> getProvider() {
9425      if (this.provider == null)
9426        this.provider = new ArrayList<Reference>();
9427      return this.provider;
9428    }
9429
9430    /**
9431     * @return Returns a reference to <code>this</code> for easy method chaining
9432     */
9433    public AddedItemComponent setProvider(List<Reference> theProvider) {
9434      this.provider = theProvider;
9435      return this;
9436    }
9437
9438    public boolean hasProvider() {
9439      if (this.provider == null)
9440        return false;
9441      for (Reference item : this.provider)
9442        if (!item.isEmpty())
9443          return true;
9444      return false;
9445    }
9446
9447    public Reference addProvider() { // 3
9448      Reference t = new Reference();
9449      if (this.provider == null)
9450        this.provider = new ArrayList<Reference>();
9451      this.provider.add(t);
9452      return t;
9453    }
9454
9455    public AddedItemComponent addProvider(Reference t) { // 3
9456      if (t == null)
9457        return this;
9458      if (this.provider == null)
9459        this.provider = new ArrayList<Reference>();
9460      this.provider.add(t);
9461      return this;
9462    }
9463
9464    /**
9465     * @return The first repetition of repeating field {@link #provider}, creating
9466     *         it if it does not already exist
9467     */
9468    public Reference getProviderFirstRep() {
9469      if (getProvider().isEmpty()) {
9470        addProvider();
9471      }
9472      return getProvider().get(0);
9473    }
9474
9475    /**
9476     * @deprecated Use Reference#setResource(IBaseResource) instead
9477     */
9478    @Deprecated
9479    public List<Resource> getProviderTarget() {
9480      if (this.providerTarget == null)
9481        this.providerTarget = new ArrayList<Resource>();
9482      return this.providerTarget;
9483    }
9484
9485    /**
9486     * @return {@link #productOrService} (When the value is a group code then this
9487     *         item collects a set of related claim details, otherwise this contains
9488     *         the product, service, drug or other billing code for the item.)
9489     */
9490    public CodeableConcept getProductOrService() {
9491      if (this.productOrService == null)
9492        if (Configuration.errorOnAutoCreate())
9493          throw new Error("Attempt to auto-create AddedItemComponent.productOrService");
9494        else if (Configuration.doAutoCreate())
9495          this.productOrService = new CodeableConcept(); // cc
9496      return this.productOrService;
9497    }
9498
9499    public boolean hasProductOrService() {
9500      return this.productOrService != null && !this.productOrService.isEmpty();
9501    }
9502
9503    /**
9504     * @param value {@link #productOrService} (When the value is a group code then
9505     *              this item collects a set of related claim details, otherwise
9506     *              this contains the product, service, drug or other billing code
9507     *              for the item.)
9508     */
9509    public AddedItemComponent setProductOrService(CodeableConcept value) {
9510      this.productOrService = value;
9511      return this;
9512    }
9513
9514    /**
9515     * @return {@link #modifier} (Item typification or modifiers codes to convey
9516     *         additional context for the product or service.)
9517     */
9518    public List<CodeableConcept> getModifier() {
9519      if (this.modifier == null)
9520        this.modifier = new ArrayList<CodeableConcept>();
9521      return this.modifier;
9522    }
9523
9524    /**
9525     * @return Returns a reference to <code>this</code> for easy method chaining
9526     */
9527    public AddedItemComponent setModifier(List<CodeableConcept> theModifier) {
9528      this.modifier = theModifier;
9529      return this;
9530    }
9531
9532    public boolean hasModifier() {
9533      if (this.modifier == null)
9534        return false;
9535      for (CodeableConcept item : this.modifier)
9536        if (!item.isEmpty())
9537          return true;
9538      return false;
9539    }
9540
9541    public CodeableConcept addModifier() { // 3
9542      CodeableConcept t = new CodeableConcept();
9543      if (this.modifier == null)
9544        this.modifier = new ArrayList<CodeableConcept>();
9545      this.modifier.add(t);
9546      return t;
9547    }
9548
9549    public AddedItemComponent addModifier(CodeableConcept t) { // 3
9550      if (t == null)
9551        return this;
9552      if (this.modifier == null)
9553        this.modifier = new ArrayList<CodeableConcept>();
9554      this.modifier.add(t);
9555      return this;
9556    }
9557
9558    /**
9559     * @return The first repetition of repeating field {@link #modifier}, creating
9560     *         it if it does not already exist
9561     */
9562    public CodeableConcept getModifierFirstRep() {
9563      if (getModifier().isEmpty()) {
9564        addModifier();
9565      }
9566      return getModifier().get(0);
9567    }
9568
9569    /**
9570     * @return {@link #programCode} (Identifies the program under which this may be
9571     *         recovered.)
9572     */
9573    public List<CodeableConcept> getProgramCode() {
9574      if (this.programCode == null)
9575        this.programCode = new ArrayList<CodeableConcept>();
9576      return this.programCode;
9577    }
9578
9579    /**
9580     * @return Returns a reference to <code>this</code> for easy method chaining
9581     */
9582    public AddedItemComponent setProgramCode(List<CodeableConcept> theProgramCode) {
9583      this.programCode = theProgramCode;
9584      return this;
9585    }
9586
9587    public boolean hasProgramCode() {
9588      if (this.programCode == null)
9589        return false;
9590      for (CodeableConcept item : this.programCode)
9591        if (!item.isEmpty())
9592          return true;
9593      return false;
9594    }
9595
9596    public CodeableConcept addProgramCode() { // 3
9597      CodeableConcept t = new CodeableConcept();
9598      if (this.programCode == null)
9599        this.programCode = new ArrayList<CodeableConcept>();
9600      this.programCode.add(t);
9601      return t;
9602    }
9603
9604    public AddedItemComponent addProgramCode(CodeableConcept t) { // 3
9605      if (t == null)
9606        return this;
9607      if (this.programCode == null)
9608        this.programCode = new ArrayList<CodeableConcept>();
9609      this.programCode.add(t);
9610      return this;
9611    }
9612
9613    /**
9614     * @return The first repetition of repeating field {@link #programCode},
9615     *         creating it if it does not already exist
9616     */
9617    public CodeableConcept getProgramCodeFirstRep() {
9618      if (getProgramCode().isEmpty()) {
9619        addProgramCode();
9620      }
9621      return getProgramCode().get(0);
9622    }
9623
9624    /**
9625     * @return {@link #serviced} (The date or dates when the service or product was
9626     *         supplied, performed or completed.)
9627     */
9628    public Type getServiced() {
9629      return this.serviced;
9630    }
9631
9632    /**
9633     * @return {@link #serviced} (The date or dates when the service or product was
9634     *         supplied, performed or completed.)
9635     */
9636    public DateType getServicedDateType() throws FHIRException {
9637      if (this.serviced == null)
9638        this.serviced = new DateType();
9639      if (!(this.serviced instanceof DateType))
9640        throw new FHIRException("Type mismatch: the type DateType was expected, but "
9641            + this.serviced.getClass().getName() + " was encountered");
9642      return (DateType) this.serviced;
9643    }
9644
9645    public boolean hasServicedDateType() {
9646      return this != null && this.serviced instanceof DateType;
9647    }
9648
9649    /**
9650     * @return {@link #serviced} (The date or dates when the service or product was
9651     *         supplied, performed or completed.)
9652     */
9653    public Period getServicedPeriod() throws FHIRException {
9654      if (this.serviced == null)
9655        this.serviced = new Period();
9656      if (!(this.serviced instanceof Period))
9657        throw new FHIRException("Type mismatch: the type Period was expected, but " + this.serviced.getClass().getName()
9658            + " was encountered");
9659      return (Period) this.serviced;
9660    }
9661
9662    public boolean hasServicedPeriod() {
9663      return this != null && this.serviced instanceof Period;
9664    }
9665
9666    public boolean hasServiced() {
9667      return this.serviced != null && !this.serviced.isEmpty();
9668    }
9669
9670    /**
9671     * @param value {@link #serviced} (The date or dates when the service or product
9672     *              was supplied, performed or completed.)
9673     */
9674    public AddedItemComponent setServiced(Type value) {
9675      if (value != null && !(value instanceof DateType || value instanceof Period))
9676        throw new Error("Not the right type for ExplanationOfBenefit.addItem.serviced[x]: " + value.fhirType());
9677      this.serviced = value;
9678      return this;
9679    }
9680
9681    /**
9682     * @return {@link #location} (Where the product or service was provided.)
9683     */
9684    public Type getLocation() {
9685      return this.location;
9686    }
9687
9688    /**
9689     * @return {@link #location} (Where the product or service was provided.)
9690     */
9691    public CodeableConcept getLocationCodeableConcept() throws FHIRException {
9692      if (this.location == null)
9693        this.location = new CodeableConcept();
9694      if (!(this.location instanceof CodeableConcept))
9695        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
9696            + this.location.getClass().getName() + " was encountered");
9697      return (CodeableConcept) this.location;
9698    }
9699
9700    public boolean hasLocationCodeableConcept() {
9701      return this != null && this.location instanceof CodeableConcept;
9702    }
9703
9704    /**
9705     * @return {@link #location} (Where the product or service was provided.)
9706     */
9707    public Address getLocationAddress() throws FHIRException {
9708      if (this.location == null)
9709        this.location = new Address();
9710      if (!(this.location instanceof Address))
9711        throw new FHIRException("Type mismatch: the type Address was expected, but "
9712            + this.location.getClass().getName() + " was encountered");
9713      return (Address) this.location;
9714    }
9715
9716    public boolean hasLocationAddress() {
9717      return this != null && this.location instanceof Address;
9718    }
9719
9720    /**
9721     * @return {@link #location} (Where the product or service was provided.)
9722     */
9723    public Reference getLocationReference() throws FHIRException {
9724      if (this.location == null)
9725        this.location = new Reference();
9726      if (!(this.location instanceof Reference))
9727        throw new FHIRException("Type mismatch: the type Reference was expected, but "
9728            + this.location.getClass().getName() + " was encountered");
9729      return (Reference) this.location;
9730    }
9731
9732    public boolean hasLocationReference() {
9733      return this != null && this.location instanceof Reference;
9734    }
9735
9736    public boolean hasLocation() {
9737      return this.location != null && !this.location.isEmpty();
9738    }
9739
9740    /**
9741     * @param value {@link #location} (Where the product or service was provided.)
9742     */
9743    public AddedItemComponent setLocation(Type value) {
9744      if (value != null
9745          && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
9746        throw new Error("Not the right type for ExplanationOfBenefit.addItem.location[x]: " + value.fhirType());
9747      this.location = value;
9748      return this;
9749    }
9750
9751    /**
9752     * @return {@link #quantity} (The number of repetitions of a service or
9753     *         product.)
9754     */
9755    public Quantity getQuantity() {
9756      if (this.quantity == null)
9757        if (Configuration.errorOnAutoCreate())
9758          throw new Error("Attempt to auto-create AddedItemComponent.quantity");
9759        else if (Configuration.doAutoCreate())
9760          this.quantity = new Quantity(); // cc
9761      return this.quantity;
9762    }
9763
9764    public boolean hasQuantity() {
9765      return this.quantity != null && !this.quantity.isEmpty();
9766    }
9767
9768    /**
9769     * @param value {@link #quantity} (The number of repetitions of a service or
9770     *              product.)
9771     */
9772    public AddedItemComponent setQuantity(Quantity value) {
9773      this.quantity = value;
9774      return this;
9775    }
9776
9777    /**
9778     * @return {@link #unitPrice} (If the item is not a group then this is the fee
9779     *         for the product or service, otherwise this is the total of the fees
9780     *         for the details of the group.)
9781     */
9782    public Money getUnitPrice() {
9783      if (this.unitPrice == null)
9784        if (Configuration.errorOnAutoCreate())
9785          throw new Error("Attempt to auto-create AddedItemComponent.unitPrice");
9786        else if (Configuration.doAutoCreate())
9787          this.unitPrice = new Money(); // cc
9788      return this.unitPrice;
9789    }
9790
9791    public boolean hasUnitPrice() {
9792      return this.unitPrice != null && !this.unitPrice.isEmpty();
9793    }
9794
9795    /**
9796     * @param value {@link #unitPrice} (If the item is not a group then this is the
9797     *              fee for the product or service, otherwise this is the total of
9798     *              the fees for the details of the group.)
9799     */
9800    public AddedItemComponent setUnitPrice(Money value) {
9801      this.unitPrice = value;
9802      return this;
9803    }
9804
9805    /**
9806     * @return {@link #factor} (A real number that represents a multiplier used in
9807     *         determining the overall value of services delivered and/or goods
9808     *         received. The concept of a Factor allows for a discount or surcharge
9809     *         multiplier to be applied to a monetary amount.). This is the
9810     *         underlying object with id, value and extensions. The accessor
9811     *         "getFactor" gives direct access to the value
9812     */
9813    public DecimalType getFactorElement() {
9814      if (this.factor == null)
9815        if (Configuration.errorOnAutoCreate())
9816          throw new Error("Attempt to auto-create AddedItemComponent.factor");
9817        else if (Configuration.doAutoCreate())
9818          this.factor = new DecimalType(); // bb
9819      return this.factor;
9820    }
9821
9822    public boolean hasFactorElement() {
9823      return this.factor != null && !this.factor.isEmpty();
9824    }
9825
9826    public boolean hasFactor() {
9827      return this.factor != null && !this.factor.isEmpty();
9828    }
9829
9830    /**
9831     * @param value {@link #factor} (A real number that represents a multiplier used
9832     *              in determining the overall value of services delivered and/or
9833     *              goods received. The concept of a Factor allows for a discount or
9834     *              surcharge multiplier to be applied to a monetary amount.). This
9835     *              is the underlying object with id, value and extensions. The
9836     *              accessor "getFactor" gives direct access to the value
9837     */
9838    public AddedItemComponent setFactorElement(DecimalType value) {
9839      this.factor = value;
9840      return this;
9841    }
9842
9843    /**
9844     * @return A real number that represents a multiplier used in determining the
9845     *         overall value of services delivered and/or goods received. The
9846     *         concept of a Factor allows for a discount or surcharge multiplier to
9847     *         be applied to a monetary amount.
9848     */
9849    public BigDecimal getFactor() {
9850      return this.factor == null ? null : this.factor.getValue();
9851    }
9852
9853    /**
9854     * @param value A real number that represents a multiplier used in determining
9855     *              the overall value of services delivered and/or goods received.
9856     *              The concept of a Factor allows for a discount or surcharge
9857     *              multiplier to be applied to a monetary amount.
9858     */
9859    public AddedItemComponent setFactor(BigDecimal value) {
9860      if (value == null)
9861        this.factor = null;
9862      else {
9863        if (this.factor == null)
9864          this.factor = new DecimalType();
9865        this.factor.setValue(value);
9866      }
9867      return this;
9868    }
9869
9870    /**
9871     * @param value A real number that represents a multiplier used in determining
9872     *              the overall value of services delivered and/or goods received.
9873     *              The concept of a Factor allows for a discount or surcharge
9874     *              multiplier to be applied to a monetary amount.
9875     */
9876    public AddedItemComponent setFactor(long value) {
9877      this.factor = new DecimalType();
9878      this.factor.setValue(value);
9879      return this;
9880    }
9881
9882    /**
9883     * @param value A real number that represents a multiplier used in determining
9884     *              the overall value of services delivered and/or goods received.
9885     *              The concept of a Factor allows for a discount or surcharge
9886     *              multiplier to be applied to a monetary amount.
9887     */
9888    public AddedItemComponent setFactor(double value) {
9889      this.factor = new DecimalType();
9890      this.factor.setValue(value);
9891      return this;
9892    }
9893
9894    /**
9895     * @return {@link #net} (The quantity times the unit price for an additional
9896     *         service or product or charge.)
9897     */
9898    public Money getNet() {
9899      if (this.net == null)
9900        if (Configuration.errorOnAutoCreate())
9901          throw new Error("Attempt to auto-create AddedItemComponent.net");
9902        else if (Configuration.doAutoCreate())
9903          this.net = new Money(); // cc
9904      return this.net;
9905    }
9906
9907    public boolean hasNet() {
9908      return this.net != null && !this.net.isEmpty();
9909    }
9910
9911    /**
9912     * @param value {@link #net} (The quantity times the unit price for an
9913     *              additional service or product or charge.)
9914     */
9915    public AddedItemComponent setNet(Money value) {
9916      this.net = value;
9917      return this;
9918    }
9919
9920    /**
9921     * @return {@link #bodySite} (Physical service site on the patient (limb, tooth,
9922     *         etc.).)
9923     */
9924    public CodeableConcept getBodySite() {
9925      if (this.bodySite == null)
9926        if (Configuration.errorOnAutoCreate())
9927          throw new Error("Attempt to auto-create AddedItemComponent.bodySite");
9928        else if (Configuration.doAutoCreate())
9929          this.bodySite = new CodeableConcept(); // cc
9930      return this.bodySite;
9931    }
9932
9933    public boolean hasBodySite() {
9934      return this.bodySite != null && !this.bodySite.isEmpty();
9935    }
9936
9937    /**
9938     * @param value {@link #bodySite} (Physical service site on the patient (limb,
9939     *              tooth, etc.).)
9940     */
9941    public AddedItemComponent setBodySite(CodeableConcept value) {
9942      this.bodySite = value;
9943      return this;
9944    }
9945
9946    /**
9947     * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb
9948     *         region or tooth surface(s).)
9949     */
9950    public List<CodeableConcept> getSubSite() {
9951      if (this.subSite == null)
9952        this.subSite = new ArrayList<CodeableConcept>();
9953      return this.subSite;
9954    }
9955
9956    /**
9957     * @return Returns a reference to <code>this</code> for easy method chaining
9958     */
9959    public AddedItemComponent setSubSite(List<CodeableConcept> theSubSite) {
9960      this.subSite = theSubSite;
9961      return this;
9962    }
9963
9964    public boolean hasSubSite() {
9965      if (this.subSite == null)
9966        return false;
9967      for (CodeableConcept item : this.subSite)
9968        if (!item.isEmpty())
9969          return true;
9970      return false;
9971    }
9972
9973    public CodeableConcept addSubSite() { // 3
9974      CodeableConcept t = new CodeableConcept();
9975      if (this.subSite == null)
9976        this.subSite = new ArrayList<CodeableConcept>();
9977      this.subSite.add(t);
9978      return t;
9979    }
9980
9981    public AddedItemComponent addSubSite(CodeableConcept t) { // 3
9982      if (t == null)
9983        return this;
9984      if (this.subSite == null)
9985        this.subSite = new ArrayList<CodeableConcept>();
9986      this.subSite.add(t);
9987      return this;
9988    }
9989
9990    /**
9991     * @return The first repetition of repeating field {@link #subSite}, creating it
9992     *         if it does not already exist
9993     */
9994    public CodeableConcept getSubSiteFirstRep() {
9995      if (getSubSite().isEmpty()) {
9996        addSubSite();
9997      }
9998      return getSubSite().get(0);
9999    }
10000
10001    /**
10002     * @return {@link #noteNumber} (The numbers associated with notes below which
10003     *         apply to the adjudication of this item.)
10004     */
10005    public List<PositiveIntType> getNoteNumber() {
10006      if (this.noteNumber == null)
10007        this.noteNumber = new ArrayList<PositiveIntType>();
10008      return this.noteNumber;
10009    }
10010
10011    /**
10012     * @return Returns a reference to <code>this</code> for easy method chaining
10013     */
10014    public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
10015      this.noteNumber = theNoteNumber;
10016      return this;
10017    }
10018
10019    public boolean hasNoteNumber() {
10020      if (this.noteNumber == null)
10021        return false;
10022      for (PositiveIntType item : this.noteNumber)
10023        if (!item.isEmpty())
10024          return true;
10025      return false;
10026    }
10027
10028    /**
10029     * @return {@link #noteNumber} (The numbers associated with notes below which
10030     *         apply to the adjudication of this item.)
10031     */
10032    public PositiveIntType addNoteNumberElement() {// 2
10033      PositiveIntType t = new PositiveIntType();
10034      if (this.noteNumber == null)
10035        this.noteNumber = new ArrayList<PositiveIntType>();
10036      this.noteNumber.add(t);
10037      return t;
10038    }
10039
10040    /**
10041     * @param value {@link #noteNumber} (The numbers associated with notes below
10042     *              which apply to the adjudication of this item.)
10043     */
10044    public AddedItemComponent addNoteNumber(int value) { // 1
10045      PositiveIntType t = new PositiveIntType();
10046      t.setValue(value);
10047      if (this.noteNumber == null)
10048        this.noteNumber = new ArrayList<PositiveIntType>();
10049      this.noteNumber.add(t);
10050      return this;
10051    }
10052
10053    /**
10054     * @param value {@link #noteNumber} (The numbers associated with notes below
10055     *              which apply to the adjudication of this item.)
10056     */
10057    public boolean hasNoteNumber(int value) {
10058      if (this.noteNumber == null)
10059        return false;
10060      for (PositiveIntType v : this.noteNumber)
10061        if (v.getValue().equals(value)) // positiveInt
10062          return true;
10063      return false;
10064    }
10065
10066    /**
10067     * @return {@link #adjudication} (The adjudication results.)
10068     */
10069    public List<AdjudicationComponent> getAdjudication() {
10070      if (this.adjudication == null)
10071        this.adjudication = new ArrayList<AdjudicationComponent>();
10072      return this.adjudication;
10073    }
10074
10075    /**
10076     * @return Returns a reference to <code>this</code> for easy method chaining
10077     */
10078    public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
10079      this.adjudication = theAdjudication;
10080      return this;
10081    }
10082
10083    public boolean hasAdjudication() {
10084      if (this.adjudication == null)
10085        return false;
10086      for (AdjudicationComponent item : this.adjudication)
10087        if (!item.isEmpty())
10088          return true;
10089      return false;
10090    }
10091
10092    public AdjudicationComponent addAdjudication() { // 3
10093      AdjudicationComponent t = new AdjudicationComponent();
10094      if (this.adjudication == null)
10095        this.adjudication = new ArrayList<AdjudicationComponent>();
10096      this.adjudication.add(t);
10097      return t;
10098    }
10099
10100    public AddedItemComponent addAdjudication(AdjudicationComponent t) { // 3
10101      if (t == null)
10102        return this;
10103      if (this.adjudication == null)
10104        this.adjudication = new ArrayList<AdjudicationComponent>();
10105      this.adjudication.add(t);
10106      return this;
10107    }
10108
10109    /**
10110     * @return The first repetition of repeating field {@link #adjudication},
10111     *         creating it if it does not already exist
10112     */
10113    public AdjudicationComponent getAdjudicationFirstRep() {
10114      if (getAdjudication().isEmpty()) {
10115        addAdjudication();
10116      }
10117      return getAdjudication().get(0);
10118    }
10119
10120    /**
10121     * @return {@link #detail} (The second-tier service adjudications for payor
10122     *         added services.)
10123     */
10124    public List<AddedItemDetailComponent> getDetail() {
10125      if (this.detail == null)
10126        this.detail = new ArrayList<AddedItemDetailComponent>();
10127      return this.detail;
10128    }
10129
10130    /**
10131     * @return Returns a reference to <code>this</code> for easy method chaining
10132     */
10133    public AddedItemComponent setDetail(List<AddedItemDetailComponent> theDetail) {
10134      this.detail = theDetail;
10135      return this;
10136    }
10137
10138    public boolean hasDetail() {
10139      if (this.detail == null)
10140        return false;
10141      for (AddedItemDetailComponent item : this.detail)
10142        if (!item.isEmpty())
10143          return true;
10144      return false;
10145    }
10146
10147    public AddedItemDetailComponent addDetail() { // 3
10148      AddedItemDetailComponent t = new AddedItemDetailComponent();
10149      if (this.detail == null)
10150        this.detail = new ArrayList<AddedItemDetailComponent>();
10151      this.detail.add(t);
10152      return t;
10153    }
10154
10155    public AddedItemComponent addDetail(AddedItemDetailComponent t) { // 3
10156      if (t == null)
10157        return this;
10158      if (this.detail == null)
10159        this.detail = new ArrayList<AddedItemDetailComponent>();
10160      this.detail.add(t);
10161      return this;
10162    }
10163
10164    /**
10165     * @return The first repetition of repeating field {@link #detail}, creating it
10166     *         if it does not already exist
10167     */
10168    public AddedItemDetailComponent getDetailFirstRep() {
10169      if (getDetail().isEmpty()) {
10170        addDetail();
10171      }
10172      return getDetail().get(0);
10173    }
10174
10175    protected void listChildren(List<Property> children) {
10176      super.listChildren(children);
10177      children.add(new Property("itemSequence", "positiveInt",
10178          "Claim items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, itemSequence));
10179      children.add(new Property("detailSequence", "positiveInt",
10180          "The sequence number of the details within the claim item which this line is intended to replace.", 0,
10181          java.lang.Integer.MAX_VALUE, detailSequence));
10182      children.add(new Property("subDetailSequence", "positiveInt",
10183          "The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.",
10184          0, java.lang.Integer.MAX_VALUE, subDetailSequence));
10185      children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
10186          "The providers who are authorized for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE,
10187          provider));
10188      children.add(new Property("productOrService", "CodeableConcept",
10189          "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.",
10190          0, 1, productOrService));
10191      children.add(new Property("modifier", "CodeableConcept",
10192          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
10193          java.lang.Integer.MAX_VALUE, modifier));
10194      children.add(new Property("programCode", "CodeableConcept",
10195          "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
10196      children.add(new Property("serviced[x]", "date|Period",
10197          "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced));
10198      children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
10199          "Where the product or service was provided.", 0, 1, location));
10200      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
10201          1, quantity));
10202      children.add(new Property("unitPrice", "Money",
10203          "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.",
10204          0, 1, unitPrice));
10205      children.add(new Property("factor", "decimal",
10206          "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.",
10207          0, 1, factor));
10208      children.add(new Property("net", "Money",
10209          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
10210      children.add(new Property("bodySite", "CodeableConcept",
10211          "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
10212      children.add(new Property("subSite", "CodeableConcept",
10213          "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE,
10214          subSite));
10215      children.add(new Property("noteNumber", "positiveInt",
10216          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
10217          java.lang.Integer.MAX_VALUE, noteNumber));
10218      children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.",
10219          0, java.lang.Integer.MAX_VALUE, adjudication));
10220      children.add(new Property("detail", "", "The second-tier service adjudications for payor added services.", 0,
10221          java.lang.Integer.MAX_VALUE, detail));
10222    }
10223
10224    @Override
10225    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10226      switch (_hash) {
10227      case 1977979892:
10228        /* itemSequence */ return new Property("itemSequence", "positiveInt",
10229            "Claim items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE,
10230            itemSequence);
10231      case 1321472818:
10232        /* detailSequence */ return new Property("detailSequence", "positiveInt",
10233            "The sequence number of the details within the claim item which this line is intended to replace.", 0,
10234            java.lang.Integer.MAX_VALUE, detailSequence);
10235      case -855462510:
10236        /* subDetailSequence */ return new Property("subDetailSequence", "positiveInt",
10237            "The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.",
10238            0, java.lang.Integer.MAX_VALUE, subDetailSequence);
10239      case -987494927:
10240        /* provider */ return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
10241            "The providers who are authorized for the services rendered to the patient.", 0,
10242            java.lang.Integer.MAX_VALUE, provider);
10243      case 1957227299:
10244        /* productOrService */ return new Property("productOrService", "CodeableConcept",
10245            "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.",
10246            0, 1, productOrService);
10247      case -615513385:
10248        /* modifier */ return new Property("modifier", "CodeableConcept",
10249            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
10250            java.lang.Integer.MAX_VALUE, modifier);
10251      case 1010065041:
10252        /* programCode */ return new Property("programCode", "CodeableConcept",
10253            "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
10254      case -1927922223:
10255        /* serviced[x] */ return new Property("serviced[x]", "date|Period",
10256            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
10257      case 1379209295:
10258        /* serviced */ return new Property("serviced[x]", "date|Period",
10259            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
10260      case 363246749:
10261        /* servicedDate */ return new Property("serviced[x]", "date|Period",
10262            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
10263      case 1534966512:
10264        /* servicedPeriod */ return new Property("serviced[x]", "date|Period",
10265            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
10266      case 552316075:
10267        /* location[x] */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
10268            "Where the product or service was provided.", 0, 1, location);
10269      case 1901043637:
10270        /* location */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
10271            "Where the product or service was provided.", 0, 1, location);
10272      case -1224800468:
10273        /* locationCodeableConcept */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
10274            "Where the product or service was provided.", 0, 1, location);
10275      case -1280020865:
10276        /* locationAddress */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
10277            "Where the product or service was provided.", 0, 1, location);
10278      case 755866390:
10279        /* locationReference */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
10280            "Where the product or service was provided.", 0, 1, location);
10281      case -1285004149:
10282        /* quantity */ return new Property("quantity", "SimpleQuantity",
10283            "The number of repetitions of a service or product.", 0, 1, quantity);
10284      case -486196699:
10285        /* unitPrice */ return new Property("unitPrice", "Money",
10286            "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.",
10287            0, 1, unitPrice);
10288      case -1282148017:
10289        /* factor */ return new Property("factor", "decimal",
10290            "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.",
10291            0, 1, factor);
10292      case 108957:
10293        /* net */ return new Property("net", "Money",
10294            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
10295      case 1702620169:
10296        /* bodySite */ return new Property("bodySite", "CodeableConcept",
10297            "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
10298      case -1868566105:
10299        /* subSite */ return new Property("subSite", "CodeableConcept",
10300            "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0,
10301            java.lang.Integer.MAX_VALUE, subSite);
10302      case -1110033957:
10303        /* noteNumber */ return new Property("noteNumber", "positiveInt",
10304            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
10305            java.lang.Integer.MAX_VALUE, noteNumber);
10306      case -231349275:
10307        /* adjudication */ return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
10308            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
10309      case -1335224239:
10310        /* detail */ return new Property("detail", "",
10311            "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail);
10312      default:
10313        return super.getNamedProperty(_hash, _name, _checkValid);
10314      }
10315
10316    }
10317
10318    @Override
10319    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10320      switch (hash) {
10321      case 1977979892:
10322        /* itemSequence */ return this.itemSequence == null ? new Base[0]
10323            : this.itemSequence.toArray(new Base[this.itemSequence.size()]); // PositiveIntType
10324      case 1321472818:
10325        /* detailSequence */ return this.detailSequence == null ? new Base[0]
10326            : this.detailSequence.toArray(new Base[this.detailSequence.size()]); // PositiveIntType
10327      case -855462510:
10328        /* subDetailSequence */ return this.subDetailSequence == null ? new Base[0]
10329            : this.subDetailSequence.toArray(new Base[this.subDetailSequence.size()]); // PositiveIntType
10330      case -987494927:
10331        /* provider */ return this.provider == null ? new Base[0]
10332            : this.provider.toArray(new Base[this.provider.size()]); // Reference
10333      case 1957227299:
10334        /* productOrService */ return this.productOrService == null ? new Base[0]
10335            : new Base[] { this.productOrService }; // CodeableConcept
10336      case -615513385:
10337        /* modifier */ return this.modifier == null ? new Base[0]
10338            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
10339      case 1010065041:
10340        /* programCode */ return this.programCode == null ? new Base[0]
10341            : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
10342      case 1379209295:
10343        /* serviced */ return this.serviced == null ? new Base[0] : new Base[] { this.serviced }; // Type
10344      case 1901043637:
10345        /* location */ return this.location == null ? new Base[0] : new Base[] { this.location }; // Type
10346      case -1285004149:
10347        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
10348      case -486196699:
10349        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
10350      case -1282148017:
10351        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
10352      case 108957:
10353        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
10354      case 1702620169:
10355        /* bodySite */ return this.bodySite == null ? new Base[0] : new Base[] { this.bodySite }; // CodeableConcept
10356      case -1868566105:
10357        /* subSite */ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
10358      case -1110033957:
10359        /* noteNumber */ return this.noteNumber == null ? new Base[0]
10360            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
10361      case -231349275:
10362        /* adjudication */ return this.adjudication == null ? new Base[0]
10363            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
10364      case -1335224239:
10365        /* detail */ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemDetailComponent
10366      default:
10367        return super.getProperty(hash, name, checkValid);
10368      }
10369
10370    }
10371
10372    @Override
10373    public Base setProperty(int hash, String name, Base value) throws FHIRException {
10374      switch (hash) {
10375      case 1977979892: // itemSequence
10376        this.getItemSequence().add(castToPositiveInt(value)); // PositiveIntType
10377        return value;
10378      case 1321472818: // detailSequence
10379        this.getDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
10380        return value;
10381      case -855462510: // subDetailSequence
10382        this.getSubDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
10383        return value;
10384      case -987494927: // provider
10385        this.getProvider().add(castToReference(value)); // Reference
10386        return value;
10387      case 1957227299: // productOrService
10388        this.productOrService = castToCodeableConcept(value); // CodeableConcept
10389        return value;
10390      case -615513385: // modifier
10391        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
10392        return value;
10393      case 1010065041: // programCode
10394        this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
10395        return value;
10396      case 1379209295: // serviced
10397        this.serviced = castToType(value); // Type
10398        return value;
10399      case 1901043637: // location
10400        this.location = castToType(value); // Type
10401        return value;
10402      case -1285004149: // quantity
10403        this.quantity = castToQuantity(value); // Quantity
10404        return value;
10405      case -486196699: // unitPrice
10406        this.unitPrice = castToMoney(value); // Money
10407        return value;
10408      case -1282148017: // factor
10409        this.factor = castToDecimal(value); // DecimalType
10410        return value;
10411      case 108957: // net
10412        this.net = castToMoney(value); // Money
10413        return value;
10414      case 1702620169: // bodySite
10415        this.bodySite = castToCodeableConcept(value); // CodeableConcept
10416        return value;
10417      case -1868566105: // subSite
10418        this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
10419        return value;
10420      case -1110033957: // noteNumber
10421        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
10422        return value;
10423      case -231349275: // adjudication
10424        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
10425        return value;
10426      case -1335224239: // detail
10427        this.getDetail().add((AddedItemDetailComponent) value); // AddedItemDetailComponent
10428        return value;
10429      default:
10430        return super.setProperty(hash, name, value);
10431      }
10432
10433    }
10434
10435    @Override
10436    public Base setProperty(String name, Base value) throws FHIRException {
10437      if (name.equals("itemSequence")) {
10438        this.getItemSequence().add(castToPositiveInt(value));
10439      } else if (name.equals("detailSequence")) {
10440        this.getDetailSequence().add(castToPositiveInt(value));
10441      } else if (name.equals("subDetailSequence")) {
10442        this.getSubDetailSequence().add(castToPositiveInt(value));
10443      } else if (name.equals("provider")) {
10444        this.getProvider().add(castToReference(value));
10445      } else if (name.equals("productOrService")) {
10446        this.productOrService = castToCodeableConcept(value); // CodeableConcept
10447      } else if (name.equals("modifier")) {
10448        this.getModifier().add(castToCodeableConcept(value));
10449      } else if (name.equals("programCode")) {
10450        this.getProgramCode().add(castToCodeableConcept(value));
10451      } else if (name.equals("serviced[x]")) {
10452        this.serviced = castToType(value); // Type
10453      } else if (name.equals("location[x]")) {
10454        this.location = castToType(value); // Type
10455      } else if (name.equals("quantity")) {
10456        this.quantity = castToQuantity(value); // Quantity
10457      } else if (name.equals("unitPrice")) {
10458        this.unitPrice = castToMoney(value); // Money
10459      } else if (name.equals("factor")) {
10460        this.factor = castToDecimal(value); // DecimalType
10461      } else if (name.equals("net")) {
10462        this.net = castToMoney(value); // Money
10463      } else if (name.equals("bodySite")) {
10464        this.bodySite = castToCodeableConcept(value); // CodeableConcept
10465      } else if (name.equals("subSite")) {
10466        this.getSubSite().add(castToCodeableConcept(value));
10467      } else if (name.equals("noteNumber")) {
10468        this.getNoteNumber().add(castToPositiveInt(value));
10469      } else if (name.equals("adjudication")) {
10470        this.getAdjudication().add((AdjudicationComponent) value);
10471      } else if (name.equals("detail")) {
10472        this.getDetail().add((AddedItemDetailComponent) value);
10473      } else
10474        return super.setProperty(name, value);
10475      return value;
10476    }
10477
10478    @Override
10479    public Base makeProperty(int hash, String name) throws FHIRException {
10480      switch (hash) {
10481      case 1977979892:
10482        return addItemSequenceElement();
10483      case 1321472818:
10484        return addDetailSequenceElement();
10485      case -855462510:
10486        return addSubDetailSequenceElement();
10487      case -987494927:
10488        return addProvider();
10489      case 1957227299:
10490        return getProductOrService();
10491      case -615513385:
10492        return addModifier();
10493      case 1010065041:
10494        return addProgramCode();
10495      case -1927922223:
10496        return getServiced();
10497      case 1379209295:
10498        return getServiced();
10499      case 552316075:
10500        return getLocation();
10501      case 1901043637:
10502        return getLocation();
10503      case -1285004149:
10504        return getQuantity();
10505      case -486196699:
10506        return getUnitPrice();
10507      case -1282148017:
10508        return getFactorElement();
10509      case 108957:
10510        return getNet();
10511      case 1702620169:
10512        return getBodySite();
10513      case -1868566105:
10514        return addSubSite();
10515      case -1110033957:
10516        return addNoteNumberElement();
10517      case -231349275:
10518        return addAdjudication();
10519      case -1335224239:
10520        return addDetail();
10521      default:
10522        return super.makeProperty(hash, name);
10523      }
10524
10525    }
10526
10527    @Override
10528    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10529      switch (hash) {
10530      case 1977979892:
10531        /* itemSequence */ return new String[] { "positiveInt" };
10532      case 1321472818:
10533        /* detailSequence */ return new String[] { "positiveInt" };
10534      case -855462510:
10535        /* subDetailSequence */ return new String[] { "positiveInt" };
10536      case -987494927:
10537        /* provider */ return new String[] { "Reference" };
10538      case 1957227299:
10539        /* productOrService */ return new String[] { "CodeableConcept" };
10540      case -615513385:
10541        /* modifier */ return new String[] { "CodeableConcept" };
10542      case 1010065041:
10543        /* programCode */ return new String[] { "CodeableConcept" };
10544      case 1379209295:
10545        /* serviced */ return new String[] { "date", "Period" };
10546      case 1901043637:
10547        /* location */ return new String[] { "CodeableConcept", "Address", "Reference" };
10548      case -1285004149:
10549        /* quantity */ return new String[] { "SimpleQuantity" };
10550      case -486196699:
10551        /* unitPrice */ return new String[] { "Money" };
10552      case -1282148017:
10553        /* factor */ return new String[] { "decimal" };
10554      case 108957:
10555        /* net */ return new String[] { "Money" };
10556      case 1702620169:
10557        /* bodySite */ return new String[] { "CodeableConcept" };
10558      case -1868566105:
10559        /* subSite */ return new String[] { "CodeableConcept" };
10560      case -1110033957:
10561        /* noteNumber */ return new String[] { "positiveInt" };
10562      case -231349275:
10563        /* adjudication */ return new String[] { "@ExplanationOfBenefit.item.adjudication" };
10564      case -1335224239:
10565        /* detail */ return new String[] {};
10566      default:
10567        return super.getTypesForProperty(hash, name);
10568      }
10569
10570    }
10571
10572    @Override
10573    public Base addChild(String name) throws FHIRException {
10574      if (name.equals("itemSequence")) {
10575        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.itemSequence");
10576      } else if (name.equals("detailSequence")) {
10577        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.detailSequence");
10578      } else if (name.equals("subDetailSequence")) {
10579        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.subDetailSequence");
10580      } else if (name.equals("provider")) {
10581        return addProvider();
10582      } else if (name.equals("productOrService")) {
10583        this.productOrService = new CodeableConcept();
10584        return this.productOrService;
10585      } else if (name.equals("modifier")) {
10586        return addModifier();
10587      } else if (name.equals("programCode")) {
10588        return addProgramCode();
10589      } else if (name.equals("servicedDate")) {
10590        this.serviced = new DateType();
10591        return this.serviced;
10592      } else if (name.equals("servicedPeriod")) {
10593        this.serviced = new Period();
10594        return this.serviced;
10595      } else if (name.equals("locationCodeableConcept")) {
10596        this.location = new CodeableConcept();
10597        return this.location;
10598      } else if (name.equals("locationAddress")) {
10599        this.location = new Address();
10600        return this.location;
10601      } else if (name.equals("locationReference")) {
10602        this.location = new Reference();
10603        return this.location;
10604      } else if (name.equals("quantity")) {
10605        this.quantity = new Quantity();
10606        return this.quantity;
10607      } else if (name.equals("unitPrice")) {
10608        this.unitPrice = new Money();
10609        return this.unitPrice;
10610      } else if (name.equals("factor")) {
10611        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
10612      } else if (name.equals("net")) {
10613        this.net = new Money();
10614        return this.net;
10615      } else if (name.equals("bodySite")) {
10616        this.bodySite = new CodeableConcept();
10617        return this.bodySite;
10618      } else if (name.equals("subSite")) {
10619        return addSubSite();
10620      } else if (name.equals("noteNumber")) {
10621        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
10622      } else if (name.equals("adjudication")) {
10623        return addAdjudication();
10624      } else if (name.equals("detail")) {
10625        return addDetail();
10626      } else
10627        return super.addChild(name);
10628    }
10629
10630    public AddedItemComponent copy() {
10631      AddedItemComponent dst = new AddedItemComponent();
10632      copyValues(dst);
10633      return dst;
10634    }
10635
10636    public void copyValues(AddedItemComponent dst) {
10637      super.copyValues(dst);
10638      if (itemSequence != null) {
10639        dst.itemSequence = new ArrayList<PositiveIntType>();
10640        for (PositiveIntType i : itemSequence)
10641          dst.itemSequence.add(i.copy());
10642      }
10643      ;
10644      if (detailSequence != null) {
10645        dst.detailSequence = new ArrayList<PositiveIntType>();
10646        for (PositiveIntType i : detailSequence)
10647          dst.detailSequence.add(i.copy());
10648      }
10649      ;
10650      if (subDetailSequence != null) {
10651        dst.subDetailSequence = new ArrayList<PositiveIntType>();
10652        for (PositiveIntType i : subDetailSequence)
10653          dst.subDetailSequence.add(i.copy());
10654      }
10655      ;
10656      if (provider != null) {
10657        dst.provider = new ArrayList<Reference>();
10658        for (Reference i : provider)
10659          dst.provider.add(i.copy());
10660      }
10661      ;
10662      dst.productOrService = productOrService == null ? null : productOrService.copy();
10663      if (modifier != null) {
10664        dst.modifier = new ArrayList<CodeableConcept>();
10665        for (CodeableConcept i : modifier)
10666          dst.modifier.add(i.copy());
10667      }
10668      ;
10669      if (programCode != null) {
10670        dst.programCode = new ArrayList<CodeableConcept>();
10671        for (CodeableConcept i : programCode)
10672          dst.programCode.add(i.copy());
10673      }
10674      ;
10675      dst.serviced = serviced == null ? null : serviced.copy();
10676      dst.location = location == null ? null : location.copy();
10677      dst.quantity = quantity == null ? null : quantity.copy();
10678      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
10679      dst.factor = factor == null ? null : factor.copy();
10680      dst.net = net == null ? null : net.copy();
10681      dst.bodySite = bodySite == null ? null : bodySite.copy();
10682      if (subSite != null) {
10683        dst.subSite = new ArrayList<CodeableConcept>();
10684        for (CodeableConcept i : subSite)
10685          dst.subSite.add(i.copy());
10686      }
10687      ;
10688      if (noteNumber != null) {
10689        dst.noteNumber = new ArrayList<PositiveIntType>();
10690        for (PositiveIntType i : noteNumber)
10691          dst.noteNumber.add(i.copy());
10692      }
10693      ;
10694      if (adjudication != null) {
10695        dst.adjudication = new ArrayList<AdjudicationComponent>();
10696        for (AdjudicationComponent i : adjudication)
10697          dst.adjudication.add(i.copy());
10698      }
10699      ;
10700      if (detail != null) {
10701        dst.detail = new ArrayList<AddedItemDetailComponent>();
10702        for (AddedItemDetailComponent i : detail)
10703          dst.detail.add(i.copy());
10704      }
10705      ;
10706    }
10707
10708    @Override
10709    public boolean equalsDeep(Base other_) {
10710      if (!super.equalsDeep(other_))
10711        return false;
10712      if (!(other_ instanceof AddedItemComponent))
10713        return false;
10714      AddedItemComponent o = (AddedItemComponent) other_;
10715      return compareDeep(itemSequence, o.itemSequence, true) && compareDeep(detailSequence, o.detailSequence, true)
10716          && compareDeep(subDetailSequence, o.subDetailSequence, true) && compareDeep(provider, o.provider, true)
10717          && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
10718          && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true)
10719          && compareDeep(location, o.location, true) && compareDeep(quantity, o.quantity, true)
10720          && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
10721          && compareDeep(net, o.net, true) && compareDeep(bodySite, o.bodySite, true)
10722          && compareDeep(subSite, o.subSite, true) && compareDeep(noteNumber, o.noteNumber, true)
10723          && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true);
10724    }
10725
10726    @Override
10727    public boolean equalsShallow(Base other_) {
10728      if (!super.equalsShallow(other_))
10729        return false;
10730      if (!(other_ instanceof AddedItemComponent))
10731        return false;
10732      AddedItemComponent o = (AddedItemComponent) other_;
10733      return compareValues(itemSequence, o.itemSequence, true) && compareValues(detailSequence, o.detailSequence, true)
10734          && compareValues(subDetailSequence, o.subDetailSequence, true) && compareValues(factor, o.factor, true)
10735          && compareValues(noteNumber, o.noteNumber, true);
10736    }
10737
10738    public boolean isEmpty() {
10739      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(itemSequence, detailSequence, subDetailSequence,
10740          provider, productOrService, modifier, programCode, serviced, location, quantity, unitPrice, factor, net,
10741          bodySite, subSite, noteNumber, adjudication, detail);
10742    }
10743
10744    public String fhirType() {
10745      return "ExplanationOfBenefit.addItem";
10746
10747    }
10748
10749  }
10750
10751  @Block()
10752  public static class AddedItemDetailComponent extends BackboneElement implements IBaseBackboneElement {
10753    /**
10754     * When the value is a group code then this item collects a set of related claim
10755     * details, otherwise this contains the product, service, drug or other billing
10756     * code for the item.
10757     */
10758    @Child(name = "productOrService", type = {
10759        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
10760    @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.")
10761    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
10762    protected CodeableConcept productOrService;
10763
10764    /**
10765     * Item typification or modifiers codes to convey additional context for the
10766     * product or service.
10767     */
10768    @Child(name = "modifier", type = {
10769        CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
10770    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
10771    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
10772    protected List<CodeableConcept> modifier;
10773
10774    /**
10775     * The number of repetitions of a service or product.
10776     */
10777    @Child(name = "quantity", type = { Quantity.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
10778    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
10779    protected Quantity quantity;
10780
10781    /**
10782     * If the item is not a group then this is the fee for the product or service,
10783     * otherwise this is the total of the fees for the details of the group.
10784     */
10785    @Child(name = "unitPrice", type = { Money.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
10786    @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.")
10787    protected Money unitPrice;
10788
10789    /**
10790     * A real number that represents a multiplier used in determining the overall
10791     * value of services delivered and/or goods received. The concept of a Factor
10792     * allows for a discount or surcharge multiplier to be applied to a monetary
10793     * amount.
10794     */
10795    @Child(name = "factor", type = {
10796        DecimalType.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
10797    @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.")
10798    protected DecimalType factor;
10799
10800    /**
10801     * The quantity times the unit price for an additional service or product or
10802     * charge.
10803     */
10804    @Child(name = "net", type = { Money.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
10805    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
10806    protected Money net;
10807
10808    /**
10809     * The numbers associated with notes below which apply to the adjudication of
10810     * this item.
10811     */
10812    @Child(name = "noteNumber", type = {
10813        PositiveIntType.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
10814    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
10815    protected List<PositiveIntType> noteNumber;
10816
10817    /**
10818     * The adjudication results.
10819     */
10820    @Child(name = "adjudication", type = {
10821        AdjudicationComponent.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
10822    @Description(shortDefinition = "Added items adjudication", formalDefinition = "The adjudication results.")
10823    protected List<AdjudicationComponent> adjudication;
10824
10825    /**
10826     * The third-tier service adjudications for payor added services.
10827     */
10828    @Child(name = "subDetail", type = {}, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
10829    @Description(shortDefinition = "Insurer added line items", formalDefinition = "The third-tier service adjudications for payor added services.")
10830    protected List<AddedItemDetailSubDetailComponent> subDetail;
10831
10832    private static final long serialVersionUID = 295910869L;
10833
10834    /**
10835     * Constructor
10836     */
10837    public AddedItemDetailComponent() {
10838      super();
10839    }
10840
10841    /**
10842     * Constructor
10843     */
10844    public AddedItemDetailComponent(CodeableConcept productOrService) {
10845      super();
10846      this.productOrService = productOrService;
10847    }
10848
10849    /**
10850     * @return {@link #productOrService} (When the value is a group code then this
10851     *         item collects a set of related claim details, otherwise this contains
10852     *         the product, service, drug or other billing code for the item.)
10853     */
10854    public CodeableConcept getProductOrService() {
10855      if (this.productOrService == null)
10856        if (Configuration.errorOnAutoCreate())
10857          throw new Error("Attempt to auto-create AddedItemDetailComponent.productOrService");
10858        else if (Configuration.doAutoCreate())
10859          this.productOrService = new CodeableConcept(); // cc
10860      return this.productOrService;
10861    }
10862
10863    public boolean hasProductOrService() {
10864      return this.productOrService != null && !this.productOrService.isEmpty();
10865    }
10866
10867    /**
10868     * @param value {@link #productOrService} (When the value is a group code then
10869     *              this item collects a set of related claim details, otherwise
10870     *              this contains the product, service, drug or other billing code
10871     *              for the item.)
10872     */
10873    public AddedItemDetailComponent setProductOrService(CodeableConcept value) {
10874      this.productOrService = value;
10875      return this;
10876    }
10877
10878    /**
10879     * @return {@link #modifier} (Item typification or modifiers codes to convey
10880     *         additional context for the product or service.)
10881     */
10882    public List<CodeableConcept> getModifier() {
10883      if (this.modifier == null)
10884        this.modifier = new ArrayList<CodeableConcept>();
10885      return this.modifier;
10886    }
10887
10888    /**
10889     * @return Returns a reference to <code>this</code> for easy method chaining
10890     */
10891    public AddedItemDetailComponent setModifier(List<CodeableConcept> theModifier) {
10892      this.modifier = theModifier;
10893      return this;
10894    }
10895
10896    public boolean hasModifier() {
10897      if (this.modifier == null)
10898        return false;
10899      for (CodeableConcept item : this.modifier)
10900        if (!item.isEmpty())
10901          return true;
10902      return false;
10903    }
10904
10905    public CodeableConcept addModifier() { // 3
10906      CodeableConcept t = new CodeableConcept();
10907      if (this.modifier == null)
10908        this.modifier = new ArrayList<CodeableConcept>();
10909      this.modifier.add(t);
10910      return t;
10911    }
10912
10913    public AddedItemDetailComponent addModifier(CodeableConcept t) { // 3
10914      if (t == null)
10915        return this;
10916      if (this.modifier == null)
10917        this.modifier = new ArrayList<CodeableConcept>();
10918      this.modifier.add(t);
10919      return this;
10920    }
10921
10922    /**
10923     * @return The first repetition of repeating field {@link #modifier}, creating
10924     *         it if it does not already exist
10925     */
10926    public CodeableConcept getModifierFirstRep() {
10927      if (getModifier().isEmpty()) {
10928        addModifier();
10929      }
10930      return getModifier().get(0);
10931    }
10932
10933    /**
10934     * @return {@link #quantity} (The number of repetitions of a service or
10935     *         product.)
10936     */
10937    public Quantity getQuantity() {
10938      if (this.quantity == null)
10939        if (Configuration.errorOnAutoCreate())
10940          throw new Error("Attempt to auto-create AddedItemDetailComponent.quantity");
10941        else if (Configuration.doAutoCreate())
10942          this.quantity = new Quantity(); // cc
10943      return this.quantity;
10944    }
10945
10946    public boolean hasQuantity() {
10947      return this.quantity != null && !this.quantity.isEmpty();
10948    }
10949
10950    /**
10951     * @param value {@link #quantity} (The number of repetitions of a service or
10952     *              product.)
10953     */
10954    public AddedItemDetailComponent setQuantity(Quantity value) {
10955      this.quantity = value;
10956      return this;
10957    }
10958
10959    /**
10960     * @return {@link #unitPrice} (If the item is not a group then this is the fee
10961     *         for the product or service, otherwise this is the total of the fees
10962     *         for the details of the group.)
10963     */
10964    public Money getUnitPrice() {
10965      if (this.unitPrice == null)
10966        if (Configuration.errorOnAutoCreate())
10967          throw new Error("Attempt to auto-create AddedItemDetailComponent.unitPrice");
10968        else if (Configuration.doAutoCreate())
10969          this.unitPrice = new Money(); // cc
10970      return this.unitPrice;
10971    }
10972
10973    public boolean hasUnitPrice() {
10974      return this.unitPrice != null && !this.unitPrice.isEmpty();
10975    }
10976
10977    /**
10978     * @param value {@link #unitPrice} (If the item is not a group then this is the
10979     *              fee for the product or service, otherwise this is the total of
10980     *              the fees for the details of the group.)
10981     */
10982    public AddedItemDetailComponent setUnitPrice(Money value) {
10983      this.unitPrice = value;
10984      return this;
10985    }
10986
10987    /**
10988     * @return {@link #factor} (A real number that represents a multiplier used in
10989     *         determining the overall value of services delivered and/or goods
10990     *         received. The concept of a Factor allows for a discount or surcharge
10991     *         multiplier to be applied to a monetary amount.). This is the
10992     *         underlying object with id, value and extensions. The accessor
10993     *         "getFactor" gives direct access to the value
10994     */
10995    public DecimalType getFactorElement() {
10996      if (this.factor == null)
10997        if (Configuration.errorOnAutoCreate())
10998          throw new Error("Attempt to auto-create AddedItemDetailComponent.factor");
10999        else if (Configuration.doAutoCreate())
11000          this.factor = new DecimalType(); // bb
11001      return this.factor;
11002    }
11003
11004    public boolean hasFactorElement() {
11005      return this.factor != null && !this.factor.isEmpty();
11006    }
11007
11008    public boolean hasFactor() {
11009      return this.factor != null && !this.factor.isEmpty();
11010    }
11011
11012    /**
11013     * @param value {@link #factor} (A real number that represents a multiplier used
11014     *              in determining the overall value of services delivered and/or
11015     *              goods received. The concept of a Factor allows for a discount or
11016     *              surcharge multiplier to be applied to a monetary amount.). This
11017     *              is the underlying object with id, value and extensions. The
11018     *              accessor "getFactor" gives direct access to the value
11019     */
11020    public AddedItemDetailComponent setFactorElement(DecimalType value) {
11021      this.factor = value;
11022      return this;
11023    }
11024
11025    /**
11026     * @return A real number that represents a multiplier used in determining the
11027     *         overall value of services delivered and/or goods received. The
11028     *         concept of a Factor allows for a discount or surcharge multiplier to
11029     *         be applied to a monetary amount.
11030     */
11031    public BigDecimal getFactor() {
11032      return this.factor == null ? null : this.factor.getValue();
11033    }
11034
11035    /**
11036     * @param value A real number that represents a multiplier used in determining
11037     *              the overall value of services delivered and/or goods received.
11038     *              The concept of a Factor allows for a discount or surcharge
11039     *              multiplier to be applied to a monetary amount.
11040     */
11041    public AddedItemDetailComponent setFactor(BigDecimal value) {
11042      if (value == null)
11043        this.factor = null;
11044      else {
11045        if (this.factor == null)
11046          this.factor = new DecimalType();
11047        this.factor.setValue(value);
11048      }
11049      return this;
11050    }
11051
11052    /**
11053     * @param value A real number that represents a multiplier used in determining
11054     *              the overall value of services delivered and/or goods received.
11055     *              The concept of a Factor allows for a discount or surcharge
11056     *              multiplier to be applied to a monetary amount.
11057     */
11058    public AddedItemDetailComponent setFactor(long value) {
11059      this.factor = new DecimalType();
11060      this.factor.setValue(value);
11061      return this;
11062    }
11063
11064    /**
11065     * @param value A real number that represents a multiplier used in determining
11066     *              the overall value of services delivered and/or goods received.
11067     *              The concept of a Factor allows for a discount or surcharge
11068     *              multiplier to be applied to a monetary amount.
11069     */
11070    public AddedItemDetailComponent setFactor(double value) {
11071      this.factor = new DecimalType();
11072      this.factor.setValue(value);
11073      return this;
11074    }
11075
11076    /**
11077     * @return {@link #net} (The quantity times the unit price for an additional
11078     *         service or product or charge.)
11079     */
11080    public Money getNet() {
11081      if (this.net == null)
11082        if (Configuration.errorOnAutoCreate())
11083          throw new Error("Attempt to auto-create AddedItemDetailComponent.net");
11084        else if (Configuration.doAutoCreate())
11085          this.net = new Money(); // cc
11086      return this.net;
11087    }
11088
11089    public boolean hasNet() {
11090      return this.net != null && !this.net.isEmpty();
11091    }
11092
11093    /**
11094     * @param value {@link #net} (The quantity times the unit price for an
11095     *              additional service or product or charge.)
11096     */
11097    public AddedItemDetailComponent setNet(Money value) {
11098      this.net = value;
11099      return this;
11100    }
11101
11102    /**
11103     * @return {@link #noteNumber} (The numbers associated with notes below which
11104     *         apply to the adjudication of this item.)
11105     */
11106    public List<PositiveIntType> getNoteNumber() {
11107      if (this.noteNumber == null)
11108        this.noteNumber = new ArrayList<PositiveIntType>();
11109      return this.noteNumber;
11110    }
11111
11112    /**
11113     * @return Returns a reference to <code>this</code> for easy method chaining
11114     */
11115    public AddedItemDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
11116      this.noteNumber = theNoteNumber;
11117      return this;
11118    }
11119
11120    public boolean hasNoteNumber() {
11121      if (this.noteNumber == null)
11122        return false;
11123      for (PositiveIntType item : this.noteNumber)
11124        if (!item.isEmpty())
11125          return true;
11126      return false;
11127    }
11128
11129    /**
11130     * @return {@link #noteNumber} (The numbers associated with notes below which
11131     *         apply to the adjudication of this item.)
11132     */
11133    public PositiveIntType addNoteNumberElement() {// 2
11134      PositiveIntType t = new PositiveIntType();
11135      if (this.noteNumber == null)
11136        this.noteNumber = new ArrayList<PositiveIntType>();
11137      this.noteNumber.add(t);
11138      return t;
11139    }
11140
11141    /**
11142     * @param value {@link #noteNumber} (The numbers associated with notes below
11143     *              which apply to the adjudication of this item.)
11144     */
11145    public AddedItemDetailComponent addNoteNumber(int value) { // 1
11146      PositiveIntType t = new PositiveIntType();
11147      t.setValue(value);
11148      if (this.noteNumber == null)
11149        this.noteNumber = new ArrayList<PositiveIntType>();
11150      this.noteNumber.add(t);
11151      return this;
11152    }
11153
11154    /**
11155     * @param value {@link #noteNumber} (The numbers associated with notes below
11156     *              which apply to the adjudication of this item.)
11157     */
11158    public boolean hasNoteNumber(int value) {
11159      if (this.noteNumber == null)
11160        return false;
11161      for (PositiveIntType v : this.noteNumber)
11162        if (v.getValue().equals(value)) // positiveInt
11163          return true;
11164      return false;
11165    }
11166
11167    /**
11168     * @return {@link #adjudication} (The adjudication results.)
11169     */
11170    public List<AdjudicationComponent> getAdjudication() {
11171      if (this.adjudication == null)
11172        this.adjudication = new ArrayList<AdjudicationComponent>();
11173      return this.adjudication;
11174    }
11175
11176    /**
11177     * @return Returns a reference to <code>this</code> for easy method chaining
11178     */
11179    public AddedItemDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
11180      this.adjudication = theAdjudication;
11181      return this;
11182    }
11183
11184    public boolean hasAdjudication() {
11185      if (this.adjudication == null)
11186        return false;
11187      for (AdjudicationComponent item : this.adjudication)
11188        if (!item.isEmpty())
11189          return true;
11190      return false;
11191    }
11192
11193    public AdjudicationComponent addAdjudication() { // 3
11194      AdjudicationComponent t = new AdjudicationComponent();
11195      if (this.adjudication == null)
11196        this.adjudication = new ArrayList<AdjudicationComponent>();
11197      this.adjudication.add(t);
11198      return t;
11199    }
11200
11201    public AddedItemDetailComponent addAdjudication(AdjudicationComponent t) { // 3
11202      if (t == null)
11203        return this;
11204      if (this.adjudication == null)
11205        this.adjudication = new ArrayList<AdjudicationComponent>();
11206      this.adjudication.add(t);
11207      return this;
11208    }
11209
11210    /**
11211     * @return The first repetition of repeating field {@link #adjudication},
11212     *         creating it if it does not already exist
11213     */
11214    public AdjudicationComponent getAdjudicationFirstRep() {
11215      if (getAdjudication().isEmpty()) {
11216        addAdjudication();
11217      }
11218      return getAdjudication().get(0);
11219    }
11220
11221    /**
11222     * @return {@link #subDetail} (The third-tier service adjudications for payor
11223     *         added services.)
11224     */
11225    public List<AddedItemDetailSubDetailComponent> getSubDetail() {
11226      if (this.subDetail == null)
11227        this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
11228      return this.subDetail;
11229    }
11230
11231    /**
11232     * @return Returns a reference to <code>this</code> for easy method chaining
11233     */
11234    public AddedItemDetailComponent setSubDetail(List<AddedItemDetailSubDetailComponent> theSubDetail) {
11235      this.subDetail = theSubDetail;
11236      return this;
11237    }
11238
11239    public boolean hasSubDetail() {
11240      if (this.subDetail == null)
11241        return false;
11242      for (AddedItemDetailSubDetailComponent item : this.subDetail)
11243        if (!item.isEmpty())
11244          return true;
11245      return false;
11246    }
11247
11248    public AddedItemDetailSubDetailComponent addSubDetail() { // 3
11249      AddedItemDetailSubDetailComponent t = new AddedItemDetailSubDetailComponent();
11250      if (this.subDetail == null)
11251        this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
11252      this.subDetail.add(t);
11253      return t;
11254    }
11255
11256    public AddedItemDetailComponent addSubDetail(AddedItemDetailSubDetailComponent t) { // 3
11257      if (t == null)
11258        return this;
11259      if (this.subDetail == null)
11260        this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
11261      this.subDetail.add(t);
11262      return this;
11263    }
11264
11265    /**
11266     * @return The first repetition of repeating field {@link #subDetail}, creating
11267     *         it if it does not already exist
11268     */
11269    public AddedItemDetailSubDetailComponent getSubDetailFirstRep() {
11270      if (getSubDetail().isEmpty()) {
11271        addSubDetail();
11272      }
11273      return getSubDetail().get(0);
11274    }
11275
11276    protected void listChildren(List<Property> children) {
11277      super.listChildren(children);
11278      children.add(new Property("productOrService", "CodeableConcept",
11279          "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.",
11280          0, 1, productOrService));
11281      children.add(new Property("modifier", "CodeableConcept",
11282          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
11283          java.lang.Integer.MAX_VALUE, modifier));
11284      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
11285          1, quantity));
11286      children.add(new Property("unitPrice", "Money",
11287          "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.",
11288          0, 1, unitPrice));
11289      children.add(new Property("factor", "decimal",
11290          "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.",
11291          0, 1, factor));
11292      children.add(new Property("net", "Money",
11293          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
11294      children.add(new Property("noteNumber", "positiveInt",
11295          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
11296          java.lang.Integer.MAX_VALUE, noteNumber));
11297      children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.",
11298          0, java.lang.Integer.MAX_VALUE, adjudication));
11299      children.add(new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0,
11300          java.lang.Integer.MAX_VALUE, subDetail));
11301    }
11302
11303    @Override
11304    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11305      switch (_hash) {
11306      case 1957227299:
11307        /* productOrService */ return new Property("productOrService", "CodeableConcept",
11308            "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.",
11309            0, 1, productOrService);
11310      case -615513385:
11311        /* modifier */ return new Property("modifier", "CodeableConcept",
11312            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
11313            java.lang.Integer.MAX_VALUE, modifier);
11314      case -1285004149:
11315        /* quantity */ return new Property("quantity", "SimpleQuantity",
11316            "The number of repetitions of a service or product.", 0, 1, quantity);
11317      case -486196699:
11318        /* unitPrice */ return new Property("unitPrice", "Money",
11319            "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.",
11320            0, 1, unitPrice);
11321      case -1282148017:
11322        /* factor */ return new Property("factor", "decimal",
11323            "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.",
11324            0, 1, factor);
11325      case 108957:
11326        /* net */ return new Property("net", "Money",
11327            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
11328      case -1110033957:
11329        /* noteNumber */ return new Property("noteNumber", "positiveInt",
11330            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
11331            java.lang.Integer.MAX_VALUE, noteNumber);
11332      case -231349275:
11333        /* adjudication */ return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
11334            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
11335      case -828829007:
11336        /* subDetail */ return new Property("subDetail", "",
11337            "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE,
11338            subDetail);
11339      default:
11340        return super.getNamedProperty(_hash, _name, _checkValid);
11341      }
11342
11343    }
11344
11345    @Override
11346    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11347      switch (hash) {
11348      case 1957227299:
11349        /* productOrService */ return this.productOrService == null ? new Base[0]
11350            : new Base[] { this.productOrService }; // CodeableConcept
11351      case -615513385:
11352        /* modifier */ return this.modifier == null ? new Base[0]
11353            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
11354      case -1285004149:
11355        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
11356      case -486196699:
11357        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
11358      case -1282148017:
11359        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
11360      case 108957:
11361        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
11362      case -1110033957:
11363        /* noteNumber */ return this.noteNumber == null ? new Base[0]
11364            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
11365      case -231349275:
11366        /* adjudication */ return this.adjudication == null ? new Base[0]
11367            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
11368      case -828829007:
11369        /* subDetail */ return this.subDetail == null ? new Base[0]
11370            : this.subDetail.toArray(new Base[this.subDetail.size()]); // AddedItemDetailSubDetailComponent
11371      default:
11372        return super.getProperty(hash, name, checkValid);
11373      }
11374
11375    }
11376
11377    @Override
11378    public Base setProperty(int hash, String name, Base value) throws FHIRException {
11379      switch (hash) {
11380      case 1957227299: // productOrService
11381        this.productOrService = castToCodeableConcept(value); // CodeableConcept
11382        return value;
11383      case -615513385: // modifier
11384        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
11385        return value;
11386      case -1285004149: // quantity
11387        this.quantity = castToQuantity(value); // Quantity
11388        return value;
11389      case -486196699: // unitPrice
11390        this.unitPrice = castToMoney(value); // Money
11391        return value;
11392      case -1282148017: // factor
11393        this.factor = castToDecimal(value); // DecimalType
11394        return value;
11395      case 108957: // net
11396        this.net = castToMoney(value); // Money
11397        return value;
11398      case -1110033957: // noteNumber
11399        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
11400        return value;
11401      case -231349275: // adjudication
11402        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
11403        return value;
11404      case -828829007: // subDetail
11405        this.getSubDetail().add((AddedItemDetailSubDetailComponent) value); // AddedItemDetailSubDetailComponent
11406        return value;
11407      default:
11408        return super.setProperty(hash, name, value);
11409      }
11410
11411    }
11412
11413    @Override
11414    public Base setProperty(String name, Base value) throws FHIRException {
11415      if (name.equals("productOrService")) {
11416        this.productOrService = castToCodeableConcept(value); // CodeableConcept
11417      } else if (name.equals("modifier")) {
11418        this.getModifier().add(castToCodeableConcept(value));
11419      } else if (name.equals("quantity")) {
11420        this.quantity = castToQuantity(value); // Quantity
11421      } else if (name.equals("unitPrice")) {
11422        this.unitPrice = castToMoney(value); // Money
11423      } else if (name.equals("factor")) {
11424        this.factor = castToDecimal(value); // DecimalType
11425      } else if (name.equals("net")) {
11426        this.net = castToMoney(value); // Money
11427      } else if (name.equals("noteNumber")) {
11428        this.getNoteNumber().add(castToPositiveInt(value));
11429      } else if (name.equals("adjudication")) {
11430        this.getAdjudication().add((AdjudicationComponent) value);
11431      } else if (name.equals("subDetail")) {
11432        this.getSubDetail().add((AddedItemDetailSubDetailComponent) value);
11433      } else
11434        return super.setProperty(name, value);
11435      return value;
11436    }
11437
11438    @Override
11439    public Base makeProperty(int hash, String name) throws FHIRException {
11440      switch (hash) {
11441      case 1957227299:
11442        return getProductOrService();
11443      case -615513385:
11444        return addModifier();
11445      case -1285004149:
11446        return getQuantity();
11447      case -486196699:
11448        return getUnitPrice();
11449      case -1282148017:
11450        return getFactorElement();
11451      case 108957:
11452        return getNet();
11453      case -1110033957:
11454        return addNoteNumberElement();
11455      case -231349275:
11456        return addAdjudication();
11457      case -828829007:
11458        return addSubDetail();
11459      default:
11460        return super.makeProperty(hash, name);
11461      }
11462
11463    }
11464
11465    @Override
11466    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11467      switch (hash) {
11468      case 1957227299:
11469        /* productOrService */ return new String[] { "CodeableConcept" };
11470      case -615513385:
11471        /* modifier */ return new String[] { "CodeableConcept" };
11472      case -1285004149:
11473        /* quantity */ return new String[] { "SimpleQuantity" };
11474      case -486196699:
11475        /* unitPrice */ return new String[] { "Money" };
11476      case -1282148017:
11477        /* factor */ return new String[] { "decimal" };
11478      case 108957:
11479        /* net */ return new String[] { "Money" };
11480      case -1110033957:
11481        /* noteNumber */ return new String[] { "positiveInt" };
11482      case -231349275:
11483        /* adjudication */ return new String[] { "@ExplanationOfBenefit.item.adjudication" };
11484      case -828829007:
11485        /* subDetail */ return new String[] {};
11486      default:
11487        return super.getTypesForProperty(hash, name);
11488      }
11489
11490    }
11491
11492    @Override
11493    public Base addChild(String name) throws FHIRException {
11494      if (name.equals("productOrService")) {
11495        this.productOrService = new CodeableConcept();
11496        return this.productOrService;
11497      } else if (name.equals("modifier")) {
11498        return addModifier();
11499      } else if (name.equals("quantity")) {
11500        this.quantity = new Quantity();
11501        return this.quantity;
11502      } else if (name.equals("unitPrice")) {
11503        this.unitPrice = new Money();
11504        return this.unitPrice;
11505      } else if (name.equals("factor")) {
11506        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
11507      } else if (name.equals("net")) {
11508        this.net = new Money();
11509        return this.net;
11510      } else if (name.equals("noteNumber")) {
11511        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
11512      } else if (name.equals("adjudication")) {
11513        return addAdjudication();
11514      } else if (name.equals("subDetail")) {
11515        return addSubDetail();
11516      } else
11517        return super.addChild(name);
11518    }
11519
11520    public AddedItemDetailComponent copy() {
11521      AddedItemDetailComponent dst = new AddedItemDetailComponent();
11522      copyValues(dst);
11523      return dst;
11524    }
11525
11526    public void copyValues(AddedItemDetailComponent dst) {
11527      super.copyValues(dst);
11528      dst.productOrService = productOrService == null ? null : productOrService.copy();
11529      if (modifier != null) {
11530        dst.modifier = new ArrayList<CodeableConcept>();
11531        for (CodeableConcept i : modifier)
11532          dst.modifier.add(i.copy());
11533      }
11534      ;
11535      dst.quantity = quantity == null ? null : quantity.copy();
11536      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
11537      dst.factor = factor == null ? null : factor.copy();
11538      dst.net = net == null ? null : net.copy();
11539      if (noteNumber != null) {
11540        dst.noteNumber = new ArrayList<PositiveIntType>();
11541        for (PositiveIntType i : noteNumber)
11542          dst.noteNumber.add(i.copy());
11543      }
11544      ;
11545      if (adjudication != null) {
11546        dst.adjudication = new ArrayList<AdjudicationComponent>();
11547        for (AdjudicationComponent i : adjudication)
11548          dst.adjudication.add(i.copy());
11549      }
11550      ;
11551      if (subDetail != null) {
11552        dst.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
11553        for (AddedItemDetailSubDetailComponent i : subDetail)
11554          dst.subDetail.add(i.copy());
11555      }
11556      ;
11557    }
11558
11559    @Override
11560    public boolean equalsDeep(Base other_) {
11561      if (!super.equalsDeep(other_))
11562        return false;
11563      if (!(other_ instanceof AddedItemDetailComponent))
11564        return false;
11565      AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
11566      return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
11567          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
11568          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true)
11569          && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
11570          && compareDeep(subDetail, o.subDetail, true);
11571    }
11572
11573    @Override
11574    public boolean equalsShallow(Base other_) {
11575      if (!super.equalsShallow(other_))
11576        return false;
11577      if (!(other_ instanceof AddedItemDetailComponent))
11578        return false;
11579      AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
11580      return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
11581    }
11582
11583    public boolean isEmpty() {
11584      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier, quantity, unitPrice,
11585          factor, net, noteNumber, adjudication, subDetail);
11586    }
11587
11588    public String fhirType() {
11589      return "ExplanationOfBenefit.addItem.detail";
11590
11591    }
11592
11593  }
11594
11595  @Block()
11596  public static class AddedItemDetailSubDetailComponent extends BackboneElement implements IBaseBackboneElement {
11597    /**
11598     * When the value is a group code then this item collects a set of related claim
11599     * details, otherwise this contains the product, service, drug or other billing
11600     * code for the item.
11601     */
11602    @Child(name = "productOrService", type = {
11603        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
11604    @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.")
11605    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
11606    protected CodeableConcept productOrService;
11607
11608    /**
11609     * Item typification or modifiers codes to convey additional context for the
11610     * product or service.
11611     */
11612    @Child(name = "modifier", type = {
11613        CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11614    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
11615    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
11616    protected List<CodeableConcept> modifier;
11617
11618    /**
11619     * The number of repetitions of a service or product.
11620     */
11621    @Child(name = "quantity", type = { Quantity.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
11622    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
11623    protected Quantity quantity;
11624
11625    /**
11626     * If the item is not a group then this is the fee for the product or service,
11627     * otherwise this is the total of the fees for the details of the group.
11628     */
11629    @Child(name = "unitPrice", type = { Money.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
11630    @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.")
11631    protected Money unitPrice;
11632
11633    /**
11634     * A real number that represents a multiplier used in determining the overall
11635     * value of services delivered and/or goods received. The concept of a Factor
11636     * allows for a discount or surcharge multiplier to be applied to a monetary
11637     * amount.
11638     */
11639    @Child(name = "factor", type = {
11640        DecimalType.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
11641    @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.")
11642    protected DecimalType factor;
11643
11644    /**
11645     * The quantity times the unit price for an additional service or product or
11646     * charge.
11647     */
11648    @Child(name = "net", type = { Money.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
11649    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
11650    protected Money net;
11651
11652    /**
11653     * The numbers associated with notes below which apply to the adjudication of
11654     * this item.
11655     */
11656    @Child(name = "noteNumber", type = {
11657        PositiveIntType.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11658    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
11659    protected List<PositiveIntType> noteNumber;
11660
11661    /**
11662     * The adjudication results.
11663     */
11664    @Child(name = "adjudication", type = {
11665        AdjudicationComponent.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11666    @Description(shortDefinition = "Added items adjudication", formalDefinition = "The adjudication results.")
11667    protected List<AdjudicationComponent> adjudication;
11668
11669    private static final long serialVersionUID = 1301363592L;
11670
11671    /**
11672     * Constructor
11673     */
11674    public AddedItemDetailSubDetailComponent() {
11675      super();
11676    }
11677
11678    /**
11679     * Constructor
11680     */
11681    public AddedItemDetailSubDetailComponent(CodeableConcept productOrService) {
11682      super();
11683      this.productOrService = productOrService;
11684    }
11685
11686    /**
11687     * @return {@link #productOrService} (When the value is a group code then this
11688     *         item collects a set of related claim details, otherwise this contains
11689     *         the product, service, drug or other billing code for the item.)
11690     */
11691    public CodeableConcept getProductOrService() {
11692      if (this.productOrService == null)
11693        if (Configuration.errorOnAutoCreate())
11694          throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.productOrService");
11695        else if (Configuration.doAutoCreate())
11696          this.productOrService = new CodeableConcept(); // cc
11697      return this.productOrService;
11698    }
11699
11700    public boolean hasProductOrService() {
11701      return this.productOrService != null && !this.productOrService.isEmpty();
11702    }
11703
11704    /**
11705     * @param value {@link #productOrService} (When the value is a group code then
11706     *              this item collects a set of related claim details, otherwise
11707     *              this contains the product, service, drug or other billing code
11708     *              for the item.)
11709     */
11710    public AddedItemDetailSubDetailComponent setProductOrService(CodeableConcept value) {
11711      this.productOrService = value;
11712      return this;
11713    }
11714
11715    /**
11716     * @return {@link #modifier} (Item typification or modifiers codes to convey
11717     *         additional context for the product or service.)
11718     */
11719    public List<CodeableConcept> getModifier() {
11720      if (this.modifier == null)
11721        this.modifier = new ArrayList<CodeableConcept>();
11722      return this.modifier;
11723    }
11724
11725    /**
11726     * @return Returns a reference to <code>this</code> for easy method chaining
11727     */
11728    public AddedItemDetailSubDetailComponent setModifier(List<CodeableConcept> theModifier) {
11729      this.modifier = theModifier;
11730      return this;
11731    }
11732
11733    public boolean hasModifier() {
11734      if (this.modifier == null)
11735        return false;
11736      for (CodeableConcept item : this.modifier)
11737        if (!item.isEmpty())
11738          return true;
11739      return false;
11740    }
11741
11742    public CodeableConcept addModifier() { // 3
11743      CodeableConcept t = new CodeableConcept();
11744      if (this.modifier == null)
11745        this.modifier = new ArrayList<CodeableConcept>();
11746      this.modifier.add(t);
11747      return t;
11748    }
11749
11750    public AddedItemDetailSubDetailComponent addModifier(CodeableConcept t) { // 3
11751      if (t == null)
11752        return this;
11753      if (this.modifier == null)
11754        this.modifier = new ArrayList<CodeableConcept>();
11755      this.modifier.add(t);
11756      return this;
11757    }
11758
11759    /**
11760     * @return The first repetition of repeating field {@link #modifier}, creating
11761     *         it if it does not already exist
11762     */
11763    public CodeableConcept getModifierFirstRep() {
11764      if (getModifier().isEmpty()) {
11765        addModifier();
11766      }
11767      return getModifier().get(0);
11768    }
11769
11770    /**
11771     * @return {@link #quantity} (The number of repetitions of a service or
11772     *         product.)
11773     */
11774    public Quantity getQuantity() {
11775      if (this.quantity == null)
11776        if (Configuration.errorOnAutoCreate())
11777          throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.quantity");
11778        else if (Configuration.doAutoCreate())
11779          this.quantity = new Quantity(); // cc
11780      return this.quantity;
11781    }
11782
11783    public boolean hasQuantity() {
11784      return this.quantity != null && !this.quantity.isEmpty();
11785    }
11786
11787    /**
11788     * @param value {@link #quantity} (The number of repetitions of a service or
11789     *              product.)
11790     */
11791    public AddedItemDetailSubDetailComponent setQuantity(Quantity value) {
11792      this.quantity = value;
11793      return this;
11794    }
11795
11796    /**
11797     * @return {@link #unitPrice} (If the item is not a group then this is the fee
11798     *         for the product or service, otherwise this is the total of the fees
11799     *         for the details of the group.)
11800     */
11801    public Money getUnitPrice() {
11802      if (this.unitPrice == null)
11803        if (Configuration.errorOnAutoCreate())
11804          throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.unitPrice");
11805        else if (Configuration.doAutoCreate())
11806          this.unitPrice = new Money(); // cc
11807      return this.unitPrice;
11808    }
11809
11810    public boolean hasUnitPrice() {
11811      return this.unitPrice != null && !this.unitPrice.isEmpty();
11812    }
11813
11814    /**
11815     * @param value {@link #unitPrice} (If the item is not a group then this is the
11816     *              fee for the product or service, otherwise this is the total of
11817     *              the fees for the details of the group.)
11818     */
11819    public AddedItemDetailSubDetailComponent setUnitPrice(Money value) {
11820      this.unitPrice = value;
11821      return this;
11822    }
11823
11824    /**
11825     * @return {@link #factor} (A real number that represents a multiplier used in
11826     *         determining the overall value of services delivered and/or goods
11827     *         received. The concept of a Factor allows for a discount or surcharge
11828     *         multiplier to be applied to a monetary amount.). This is the
11829     *         underlying object with id, value and extensions. The accessor
11830     *         "getFactor" gives direct access to the value
11831     */
11832    public DecimalType getFactorElement() {
11833      if (this.factor == null)
11834        if (Configuration.errorOnAutoCreate())
11835          throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.factor");
11836        else if (Configuration.doAutoCreate())
11837          this.factor = new DecimalType(); // bb
11838      return this.factor;
11839    }
11840
11841    public boolean hasFactorElement() {
11842      return this.factor != null && !this.factor.isEmpty();
11843    }
11844
11845    public boolean hasFactor() {
11846      return this.factor != null && !this.factor.isEmpty();
11847    }
11848
11849    /**
11850     * @param value {@link #factor} (A real number that represents a multiplier used
11851     *              in determining the overall value of services delivered and/or
11852     *              goods received. The concept of a Factor allows for a discount or
11853     *              surcharge multiplier to be applied to a monetary amount.). This
11854     *              is the underlying object with id, value and extensions. The
11855     *              accessor "getFactor" gives direct access to the value
11856     */
11857    public AddedItemDetailSubDetailComponent setFactorElement(DecimalType value) {
11858      this.factor = value;
11859      return this;
11860    }
11861
11862    /**
11863     * @return A real number that represents a multiplier used in determining the
11864     *         overall value of services delivered and/or goods received. The
11865     *         concept of a Factor allows for a discount or surcharge multiplier to
11866     *         be applied to a monetary amount.
11867     */
11868    public BigDecimal getFactor() {
11869      return this.factor == null ? null : this.factor.getValue();
11870    }
11871
11872    /**
11873     * @param value A real number that represents a multiplier used in determining
11874     *              the overall value of services delivered and/or goods received.
11875     *              The concept of a Factor allows for a discount or surcharge
11876     *              multiplier to be applied to a monetary amount.
11877     */
11878    public AddedItemDetailSubDetailComponent setFactor(BigDecimal value) {
11879      if (value == null)
11880        this.factor = null;
11881      else {
11882        if (this.factor == null)
11883          this.factor = new DecimalType();
11884        this.factor.setValue(value);
11885      }
11886      return this;
11887    }
11888
11889    /**
11890     * @param value A real number that represents a multiplier used in determining
11891     *              the overall value of services delivered and/or goods received.
11892     *              The concept of a Factor allows for a discount or surcharge
11893     *              multiplier to be applied to a monetary amount.
11894     */
11895    public AddedItemDetailSubDetailComponent setFactor(long value) {
11896      this.factor = new DecimalType();
11897      this.factor.setValue(value);
11898      return this;
11899    }
11900
11901    /**
11902     * @param value A real number that represents a multiplier used in determining
11903     *              the overall value of services delivered and/or goods received.
11904     *              The concept of a Factor allows for a discount or surcharge
11905     *              multiplier to be applied to a monetary amount.
11906     */
11907    public AddedItemDetailSubDetailComponent setFactor(double value) {
11908      this.factor = new DecimalType();
11909      this.factor.setValue(value);
11910      return this;
11911    }
11912
11913    /**
11914     * @return {@link #net} (The quantity times the unit price for an additional
11915     *         service or product or charge.)
11916     */
11917    public Money getNet() {
11918      if (this.net == null)
11919        if (Configuration.errorOnAutoCreate())
11920          throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.net");
11921        else if (Configuration.doAutoCreate())
11922          this.net = new Money(); // cc
11923      return this.net;
11924    }
11925
11926    public boolean hasNet() {
11927      return this.net != null && !this.net.isEmpty();
11928    }
11929
11930    /**
11931     * @param value {@link #net} (The quantity times the unit price for an
11932     *              additional service or product or charge.)
11933     */
11934    public AddedItemDetailSubDetailComponent setNet(Money value) {
11935      this.net = value;
11936      return this;
11937    }
11938
11939    /**
11940     * @return {@link #noteNumber} (The numbers associated with notes below which
11941     *         apply to the adjudication of this item.)
11942     */
11943    public List<PositiveIntType> getNoteNumber() {
11944      if (this.noteNumber == null)
11945        this.noteNumber = new ArrayList<PositiveIntType>();
11946      return this.noteNumber;
11947    }
11948
11949    /**
11950     * @return Returns a reference to <code>this</code> for easy method chaining
11951     */
11952    public AddedItemDetailSubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
11953      this.noteNumber = theNoteNumber;
11954      return this;
11955    }
11956
11957    public boolean hasNoteNumber() {
11958      if (this.noteNumber == null)
11959        return false;
11960      for (PositiveIntType item : this.noteNumber)
11961        if (!item.isEmpty())
11962          return true;
11963      return false;
11964    }
11965
11966    /**
11967     * @return {@link #noteNumber} (The numbers associated with notes below which
11968     *         apply to the adjudication of this item.)
11969     */
11970    public PositiveIntType addNoteNumberElement() {// 2
11971      PositiveIntType t = new PositiveIntType();
11972      if (this.noteNumber == null)
11973        this.noteNumber = new ArrayList<PositiveIntType>();
11974      this.noteNumber.add(t);
11975      return t;
11976    }
11977
11978    /**
11979     * @param value {@link #noteNumber} (The numbers associated with notes below
11980     *              which apply to the adjudication of this item.)
11981     */
11982    public AddedItemDetailSubDetailComponent addNoteNumber(int value) { // 1
11983      PositiveIntType t = new PositiveIntType();
11984      t.setValue(value);
11985      if (this.noteNumber == null)
11986        this.noteNumber = new ArrayList<PositiveIntType>();
11987      this.noteNumber.add(t);
11988      return this;
11989    }
11990
11991    /**
11992     * @param value {@link #noteNumber} (The numbers associated with notes below
11993     *              which apply to the adjudication of this item.)
11994     */
11995    public boolean hasNoteNumber(int value) {
11996      if (this.noteNumber == null)
11997        return false;
11998      for (PositiveIntType v : this.noteNumber)
11999        if (v.getValue().equals(value)) // positiveInt
12000          return true;
12001      return false;
12002    }
12003
12004    /**
12005     * @return {@link #adjudication} (The adjudication results.)
12006     */
12007    public List<AdjudicationComponent> getAdjudication() {
12008      if (this.adjudication == null)
12009        this.adjudication = new ArrayList<AdjudicationComponent>();
12010      return this.adjudication;
12011    }
12012
12013    /**
12014     * @return Returns a reference to <code>this</code> for easy method chaining
12015     */
12016    public AddedItemDetailSubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
12017      this.adjudication = theAdjudication;
12018      return this;
12019    }
12020
12021    public boolean hasAdjudication() {
12022      if (this.adjudication == null)
12023        return false;
12024      for (AdjudicationComponent item : this.adjudication)
12025        if (!item.isEmpty())
12026          return true;
12027      return false;
12028    }
12029
12030    public AdjudicationComponent addAdjudication() { // 3
12031      AdjudicationComponent t = new AdjudicationComponent();
12032      if (this.adjudication == null)
12033        this.adjudication = new ArrayList<AdjudicationComponent>();
12034      this.adjudication.add(t);
12035      return t;
12036    }
12037
12038    public AddedItemDetailSubDetailComponent addAdjudication(AdjudicationComponent t) { // 3
12039      if (t == null)
12040        return this;
12041      if (this.adjudication == null)
12042        this.adjudication = new ArrayList<AdjudicationComponent>();
12043      this.adjudication.add(t);
12044      return this;
12045    }
12046
12047    /**
12048     * @return The first repetition of repeating field {@link #adjudication},
12049     *         creating it if it does not already exist
12050     */
12051    public AdjudicationComponent getAdjudicationFirstRep() {
12052      if (getAdjudication().isEmpty()) {
12053        addAdjudication();
12054      }
12055      return getAdjudication().get(0);
12056    }
12057
12058    protected void listChildren(List<Property> children) {
12059      super.listChildren(children);
12060      children.add(new Property("productOrService", "CodeableConcept",
12061          "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.",
12062          0, 1, productOrService));
12063      children.add(new Property("modifier", "CodeableConcept",
12064          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
12065          java.lang.Integer.MAX_VALUE, modifier));
12066      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
12067          1, quantity));
12068      children.add(new Property("unitPrice", "Money",
12069          "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.",
12070          0, 1, unitPrice));
12071      children.add(new Property("factor", "decimal",
12072          "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.",
12073          0, 1, factor));
12074      children.add(new Property("net", "Money",
12075          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
12076      children.add(new Property("noteNumber", "positiveInt",
12077          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
12078          java.lang.Integer.MAX_VALUE, noteNumber));
12079      children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.",
12080          0, java.lang.Integer.MAX_VALUE, adjudication));
12081    }
12082
12083    @Override
12084    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
12085      switch (_hash) {
12086      case 1957227299:
12087        /* productOrService */ return new Property("productOrService", "CodeableConcept",
12088            "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.",
12089            0, 1, productOrService);
12090      case -615513385:
12091        /* modifier */ return new Property("modifier", "CodeableConcept",
12092            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
12093            java.lang.Integer.MAX_VALUE, modifier);
12094      case -1285004149:
12095        /* quantity */ return new Property("quantity", "SimpleQuantity",
12096            "The number of repetitions of a service or product.", 0, 1, quantity);
12097      case -486196699:
12098        /* unitPrice */ return new Property("unitPrice", "Money",
12099            "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.",
12100            0, 1, unitPrice);
12101      case -1282148017:
12102        /* factor */ return new Property("factor", "decimal",
12103            "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.",
12104            0, 1, factor);
12105      case 108957:
12106        /* net */ return new Property("net", "Money",
12107            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
12108      case -1110033957:
12109        /* noteNumber */ return new Property("noteNumber", "positiveInt",
12110            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
12111            java.lang.Integer.MAX_VALUE, noteNumber);
12112      case -231349275:
12113        /* adjudication */ return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
12114            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
12115      default:
12116        return super.getNamedProperty(_hash, _name, _checkValid);
12117      }
12118
12119    }
12120
12121    @Override
12122    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
12123      switch (hash) {
12124      case 1957227299:
12125        /* productOrService */ return this.productOrService == null ? new Base[0]
12126            : new Base[] { this.productOrService }; // CodeableConcept
12127      case -615513385:
12128        /* modifier */ return this.modifier == null ? new Base[0]
12129            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
12130      case -1285004149:
12131        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
12132      case -486196699:
12133        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
12134      case -1282148017:
12135        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
12136      case 108957:
12137        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
12138      case -1110033957:
12139        /* noteNumber */ return this.noteNumber == null ? new Base[0]
12140            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
12141      case -231349275:
12142        /* adjudication */ return this.adjudication == null ? new Base[0]
12143            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
12144      default:
12145        return super.getProperty(hash, name, checkValid);
12146      }
12147
12148    }
12149
12150    @Override
12151    public Base setProperty(int hash, String name, Base value) throws FHIRException {
12152      switch (hash) {
12153      case 1957227299: // productOrService
12154        this.productOrService = castToCodeableConcept(value); // CodeableConcept
12155        return value;
12156      case -615513385: // modifier
12157        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
12158        return value;
12159      case -1285004149: // quantity
12160        this.quantity = castToQuantity(value); // Quantity
12161        return value;
12162      case -486196699: // unitPrice
12163        this.unitPrice = castToMoney(value); // Money
12164        return value;
12165      case -1282148017: // factor
12166        this.factor = castToDecimal(value); // DecimalType
12167        return value;
12168      case 108957: // net
12169        this.net = castToMoney(value); // Money
12170        return value;
12171      case -1110033957: // noteNumber
12172        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
12173        return value;
12174      case -231349275: // adjudication
12175        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
12176        return value;
12177      default:
12178        return super.setProperty(hash, name, value);
12179      }
12180
12181    }
12182
12183    @Override
12184    public Base setProperty(String name, Base value) throws FHIRException {
12185      if (name.equals("productOrService")) {
12186        this.productOrService = castToCodeableConcept(value); // CodeableConcept
12187      } else if (name.equals("modifier")) {
12188        this.getModifier().add(castToCodeableConcept(value));
12189      } else if (name.equals("quantity")) {
12190        this.quantity = castToQuantity(value); // Quantity
12191      } else if (name.equals("unitPrice")) {
12192        this.unitPrice = castToMoney(value); // Money
12193      } else if (name.equals("factor")) {
12194        this.factor = castToDecimal(value); // DecimalType
12195      } else if (name.equals("net")) {
12196        this.net = castToMoney(value); // Money
12197      } else if (name.equals("noteNumber")) {
12198        this.getNoteNumber().add(castToPositiveInt(value));
12199      } else if (name.equals("adjudication")) {
12200        this.getAdjudication().add((AdjudicationComponent) value);
12201      } else
12202        return super.setProperty(name, value);
12203      return value;
12204    }
12205
12206    @Override
12207    public Base makeProperty(int hash, String name) throws FHIRException {
12208      switch (hash) {
12209      case 1957227299:
12210        return getProductOrService();
12211      case -615513385:
12212        return addModifier();
12213      case -1285004149:
12214        return getQuantity();
12215      case -486196699:
12216        return getUnitPrice();
12217      case -1282148017:
12218        return getFactorElement();
12219      case 108957:
12220        return getNet();
12221      case -1110033957:
12222        return addNoteNumberElement();
12223      case -231349275:
12224        return addAdjudication();
12225      default:
12226        return super.makeProperty(hash, name);
12227      }
12228
12229    }
12230
12231    @Override
12232    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12233      switch (hash) {
12234      case 1957227299:
12235        /* productOrService */ return new String[] { "CodeableConcept" };
12236      case -615513385:
12237        /* modifier */ return new String[] { "CodeableConcept" };
12238      case -1285004149:
12239        /* quantity */ return new String[] { "SimpleQuantity" };
12240      case -486196699:
12241        /* unitPrice */ return new String[] { "Money" };
12242      case -1282148017:
12243        /* factor */ return new String[] { "decimal" };
12244      case 108957:
12245        /* net */ return new String[] { "Money" };
12246      case -1110033957:
12247        /* noteNumber */ return new String[] { "positiveInt" };
12248      case -231349275:
12249        /* adjudication */ return new String[] { "@ExplanationOfBenefit.item.adjudication" };
12250      default:
12251        return super.getTypesForProperty(hash, name);
12252      }
12253
12254    }
12255
12256    @Override
12257    public Base addChild(String name) throws FHIRException {
12258      if (name.equals("productOrService")) {
12259        this.productOrService = new CodeableConcept();
12260        return this.productOrService;
12261      } else if (name.equals("modifier")) {
12262        return addModifier();
12263      } else if (name.equals("quantity")) {
12264        this.quantity = new Quantity();
12265        return this.quantity;
12266      } else if (name.equals("unitPrice")) {
12267        this.unitPrice = new Money();
12268        return this.unitPrice;
12269      } else if (name.equals("factor")) {
12270        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
12271      } else if (name.equals("net")) {
12272        this.net = new Money();
12273        return this.net;
12274      } else if (name.equals("noteNumber")) {
12275        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
12276      } else if (name.equals("adjudication")) {
12277        return addAdjudication();
12278      } else
12279        return super.addChild(name);
12280    }
12281
12282    public AddedItemDetailSubDetailComponent copy() {
12283      AddedItemDetailSubDetailComponent dst = new AddedItemDetailSubDetailComponent();
12284      copyValues(dst);
12285      return dst;
12286    }
12287
12288    public void copyValues(AddedItemDetailSubDetailComponent dst) {
12289      super.copyValues(dst);
12290      dst.productOrService = productOrService == null ? null : productOrService.copy();
12291      if (modifier != null) {
12292        dst.modifier = new ArrayList<CodeableConcept>();
12293        for (CodeableConcept i : modifier)
12294          dst.modifier.add(i.copy());
12295      }
12296      ;
12297      dst.quantity = quantity == null ? null : quantity.copy();
12298      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
12299      dst.factor = factor == null ? null : factor.copy();
12300      dst.net = net == null ? null : net.copy();
12301      if (noteNumber != null) {
12302        dst.noteNumber = new ArrayList<PositiveIntType>();
12303        for (PositiveIntType i : noteNumber)
12304          dst.noteNumber.add(i.copy());
12305      }
12306      ;
12307      if (adjudication != null) {
12308        dst.adjudication = new ArrayList<AdjudicationComponent>();
12309        for (AdjudicationComponent i : adjudication)
12310          dst.adjudication.add(i.copy());
12311      }
12312      ;
12313    }
12314
12315    @Override
12316    public boolean equalsDeep(Base other_) {
12317      if (!super.equalsDeep(other_))
12318        return false;
12319      if (!(other_ instanceof AddedItemDetailSubDetailComponent))
12320        return false;
12321      AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
12322      return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
12323          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
12324          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true)
12325          && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true);
12326    }
12327
12328    @Override
12329    public boolean equalsShallow(Base other_) {
12330      if (!super.equalsShallow(other_))
12331        return false;
12332      if (!(other_ instanceof AddedItemDetailSubDetailComponent))
12333        return false;
12334      AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
12335      return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
12336    }
12337
12338    public boolean isEmpty() {
12339      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier, quantity, unitPrice,
12340          factor, net, noteNumber, adjudication);
12341    }
12342
12343    public String fhirType() {
12344      return "ExplanationOfBenefit.addItem.detail.subDetail";
12345
12346    }
12347
12348  }
12349
12350  @Block()
12351  public static class TotalComponent extends BackboneElement implements IBaseBackboneElement {
12352    /**
12353     * A code to indicate the information type of this adjudication record.
12354     * Information types may include: the value submitted, maximum values or
12355     * percentages allowed or payable under the plan, amounts that the patient is
12356     * responsible for in aggregate or pertaining to this item, amounts paid by
12357     * other coverages, and the benefit payable for this item.
12358     */
12359    @Child(name = "category", type = {
12360        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
12361    @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.")
12362    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/adjudication")
12363    protected CodeableConcept category;
12364
12365    /**
12366     * Monetary total amount associated with the category.
12367     */
12368    @Child(name = "amount", type = { Money.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
12369    @Description(shortDefinition = "Financial total for the category", formalDefinition = "Monetary total amount associated with the category.")
12370    protected Money amount;
12371
12372    private static final long serialVersionUID = 2012310309L;
12373
12374    /**
12375     * Constructor
12376     */
12377    public TotalComponent() {
12378      super();
12379    }
12380
12381    /**
12382     * Constructor
12383     */
12384    public TotalComponent(CodeableConcept category, Money amount) {
12385      super();
12386      this.category = category;
12387      this.amount = amount;
12388    }
12389
12390    /**
12391     * @return {@link #category} (A code to indicate the information type of this
12392     *         adjudication record. Information types may include: the value
12393     *         submitted, maximum values or percentages allowed or payable under the
12394     *         plan, amounts that the patient is responsible for in aggregate or
12395     *         pertaining to this item, amounts paid by other coverages, and the
12396     *         benefit payable for this item.)
12397     */
12398    public CodeableConcept getCategory() {
12399      if (this.category == null)
12400        if (Configuration.errorOnAutoCreate())
12401          throw new Error("Attempt to auto-create TotalComponent.category");
12402        else if (Configuration.doAutoCreate())
12403          this.category = new CodeableConcept(); // cc
12404      return this.category;
12405    }
12406
12407    public boolean hasCategory() {
12408      return this.category != null && !this.category.isEmpty();
12409    }
12410
12411    /**
12412     * @param value {@link #category} (A code to indicate the information type of
12413     *              this adjudication record. Information types may include: the
12414     *              value submitted, maximum values or percentages allowed or
12415     *              payable under the plan, amounts that the patient is responsible
12416     *              for in aggregate or pertaining to this item, amounts paid by
12417     *              other coverages, and the benefit payable for this item.)
12418     */
12419    public TotalComponent setCategory(CodeableConcept value) {
12420      this.category = value;
12421      return this;
12422    }
12423
12424    /**
12425     * @return {@link #amount} (Monetary total amount associated with the category.)
12426     */
12427    public Money getAmount() {
12428      if (this.amount == null)
12429        if (Configuration.errorOnAutoCreate())
12430          throw new Error("Attempt to auto-create TotalComponent.amount");
12431        else if (Configuration.doAutoCreate())
12432          this.amount = new Money(); // cc
12433      return this.amount;
12434    }
12435
12436    public boolean hasAmount() {
12437      return this.amount != null && !this.amount.isEmpty();
12438    }
12439
12440    /**
12441     * @param value {@link #amount} (Monetary total amount associated with the
12442     *              category.)
12443     */
12444    public TotalComponent setAmount(Money value) {
12445      this.amount = value;
12446      return this;
12447    }
12448
12449    protected void listChildren(List<Property> children) {
12450      super.listChildren(children);
12451      children.add(new Property("category", "CodeableConcept",
12452          "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.",
12453          0, 1, category));
12454      children
12455          .add(new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount));
12456    }
12457
12458    @Override
12459    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
12460      switch (_hash) {
12461      case 50511102:
12462        /* category */ return new Property("category", "CodeableConcept",
12463            "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.",
12464            0, 1, category);
12465      case -1413853096:
12466        /* amount */ return new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1,
12467            amount);
12468      default:
12469        return super.getNamedProperty(_hash, _name, _checkValid);
12470      }
12471
12472    }
12473
12474    @Override
12475    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
12476      switch (hash) {
12477      case 50511102:
12478        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
12479      case -1413853096:
12480        /* amount */ return this.amount == null ? new Base[0] : new Base[] { this.amount }; // Money
12481      default:
12482        return super.getProperty(hash, name, checkValid);
12483      }
12484
12485    }
12486
12487    @Override
12488    public Base setProperty(int hash, String name, Base value) throws FHIRException {
12489      switch (hash) {
12490      case 50511102: // category
12491        this.category = castToCodeableConcept(value); // CodeableConcept
12492        return value;
12493      case -1413853096: // amount
12494        this.amount = castToMoney(value); // Money
12495        return value;
12496      default:
12497        return super.setProperty(hash, name, value);
12498      }
12499
12500    }
12501
12502    @Override
12503    public Base setProperty(String name, Base value) throws FHIRException {
12504      if (name.equals("category")) {
12505        this.category = castToCodeableConcept(value); // CodeableConcept
12506      } else if (name.equals("amount")) {
12507        this.amount = castToMoney(value); // Money
12508      } else
12509        return super.setProperty(name, value);
12510      return value;
12511    }
12512
12513    @Override
12514    public Base makeProperty(int hash, String name) throws FHIRException {
12515      switch (hash) {
12516      case 50511102:
12517        return getCategory();
12518      case -1413853096:
12519        return getAmount();
12520      default:
12521        return super.makeProperty(hash, name);
12522      }
12523
12524    }
12525
12526    @Override
12527    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12528      switch (hash) {
12529      case 50511102:
12530        /* category */ return new String[] { "CodeableConcept" };
12531      case -1413853096:
12532        /* amount */ return new String[] { "Money" };
12533      default:
12534        return super.getTypesForProperty(hash, name);
12535      }
12536
12537    }
12538
12539    @Override
12540    public Base addChild(String name) throws FHIRException {
12541      if (name.equals("category")) {
12542        this.category = new CodeableConcept();
12543        return this.category;
12544      } else if (name.equals("amount")) {
12545        this.amount = new Money();
12546        return this.amount;
12547      } else
12548        return super.addChild(name);
12549    }
12550
12551    public TotalComponent copy() {
12552      TotalComponent dst = new TotalComponent();
12553      copyValues(dst);
12554      return dst;
12555    }
12556
12557    public void copyValues(TotalComponent dst) {
12558      super.copyValues(dst);
12559      dst.category = category == null ? null : category.copy();
12560      dst.amount = amount == null ? null : amount.copy();
12561    }
12562
12563    @Override
12564    public boolean equalsDeep(Base other_) {
12565      if (!super.equalsDeep(other_))
12566        return false;
12567      if (!(other_ instanceof TotalComponent))
12568        return false;
12569      TotalComponent o = (TotalComponent) other_;
12570      return compareDeep(category, o.category, true) && compareDeep(amount, o.amount, true);
12571    }
12572
12573    @Override
12574    public boolean equalsShallow(Base other_) {
12575      if (!super.equalsShallow(other_))
12576        return false;
12577      if (!(other_ instanceof TotalComponent))
12578        return false;
12579      TotalComponent o = (TotalComponent) other_;
12580      return true;
12581    }
12582
12583    public boolean isEmpty() {
12584      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, amount);
12585    }
12586
12587    public String fhirType() {
12588      return "ExplanationOfBenefit.total";
12589
12590    }
12591
12592  }
12593
12594  @Block()
12595  public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
12596    /**
12597     * Whether this represents partial or complete payment of the benefits payable.
12598     */
12599    @Child(name = "type", type = {
12600        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
12601    @Description(shortDefinition = "Partial or complete payment", formalDefinition = "Whether this represents partial or complete payment of the benefits payable.")
12602    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-paymenttype")
12603    protected CodeableConcept type;
12604
12605    /**
12606     * Total amount of all adjustments to this payment included in this transaction
12607     * which are not related to this claim's adjudication.
12608     */
12609    @Child(name = "adjustment", type = { Money.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
12610    @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.")
12611    protected Money adjustment;
12612
12613    /**
12614     * Reason for the payment adjustment.
12615     */
12616    @Child(name = "adjustmentReason", type = {
12617        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
12618    @Description(shortDefinition = "Explanation for the variance", formalDefinition = "Reason for the payment adjustment.")
12619    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
12620    protected CodeableConcept adjustmentReason;
12621
12622    /**
12623     * Estimated date the payment will be issued or the actual issue date of
12624     * payment.
12625     */
12626    @Child(name = "date", type = { DateType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
12627    @Description(shortDefinition = "Expected date of payment", formalDefinition = "Estimated date the payment will be issued or the actual issue date of payment.")
12628    protected DateType date;
12629
12630    /**
12631     * Benefits payable less any payment adjustment.
12632     */
12633    @Child(name = "amount", type = { Money.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
12634    @Description(shortDefinition = "Payable amount after adjustment", formalDefinition = "Benefits payable less any payment adjustment.")
12635    protected Money amount;
12636
12637    /**
12638     * Issuer's unique identifier for the payment instrument.
12639     */
12640    @Child(name = "identifier", type = {
12641        Identifier.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
12642    @Description(shortDefinition = "Business identifier for the payment", formalDefinition = "Issuer's unique identifier for the payment instrument.")
12643    protected Identifier identifier;
12644
12645    private static final long serialVersionUID = 1539906026L;
12646
12647    /**
12648     * Constructor
12649     */
12650    public PaymentComponent() {
12651      super();
12652    }
12653
12654    /**
12655     * @return {@link #type} (Whether this represents partial or complete payment of
12656     *         the benefits payable.)
12657     */
12658    public CodeableConcept getType() {
12659      if (this.type == null)
12660        if (Configuration.errorOnAutoCreate())
12661          throw new Error("Attempt to auto-create PaymentComponent.type");
12662        else if (Configuration.doAutoCreate())
12663          this.type = new CodeableConcept(); // cc
12664      return this.type;
12665    }
12666
12667    public boolean hasType() {
12668      return this.type != null && !this.type.isEmpty();
12669    }
12670
12671    /**
12672     * @param value {@link #type} (Whether this represents partial or complete
12673     *              payment of the benefits payable.)
12674     */
12675    public PaymentComponent setType(CodeableConcept value) {
12676      this.type = value;
12677      return this;
12678    }
12679
12680    /**
12681     * @return {@link #adjustment} (Total amount of all adjustments to this payment
12682     *         included in this transaction which are not related to this claim's
12683     *         adjudication.)
12684     */
12685    public Money getAdjustment() {
12686      if (this.adjustment == null)
12687        if (Configuration.errorOnAutoCreate())
12688          throw new Error("Attempt to auto-create PaymentComponent.adjustment");
12689        else if (Configuration.doAutoCreate())
12690          this.adjustment = new Money(); // cc
12691      return this.adjustment;
12692    }
12693
12694    public boolean hasAdjustment() {
12695      return this.adjustment != null && !this.adjustment.isEmpty();
12696    }
12697
12698    /**
12699     * @param value {@link #adjustment} (Total amount of all adjustments to this
12700     *              payment included in this transaction which are not related to
12701     *              this claim's adjudication.)
12702     */
12703    public PaymentComponent setAdjustment(Money value) {
12704      this.adjustment = value;
12705      return this;
12706    }
12707
12708    /**
12709     * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
12710     */
12711    public CodeableConcept getAdjustmentReason() {
12712      if (this.adjustmentReason == null)
12713        if (Configuration.errorOnAutoCreate())
12714          throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
12715        else if (Configuration.doAutoCreate())
12716          this.adjustmentReason = new CodeableConcept(); // cc
12717      return this.adjustmentReason;
12718    }
12719
12720    public boolean hasAdjustmentReason() {
12721      return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
12722    }
12723
12724    /**
12725     * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
12726     */
12727    public PaymentComponent setAdjustmentReason(CodeableConcept value) {
12728      this.adjustmentReason = value;
12729      return this;
12730    }
12731
12732    /**
12733     * @return {@link #date} (Estimated date the payment will be issued or the
12734     *         actual issue date of payment.). This is the underlying object with
12735     *         id, value and extensions. The accessor "getDate" gives direct access
12736     *         to the value
12737     */
12738    public DateType getDateElement() {
12739      if (this.date == null)
12740        if (Configuration.errorOnAutoCreate())
12741          throw new Error("Attempt to auto-create PaymentComponent.date");
12742        else if (Configuration.doAutoCreate())
12743          this.date = new DateType(); // bb
12744      return this.date;
12745    }
12746
12747    public boolean hasDateElement() {
12748      return this.date != null && !this.date.isEmpty();
12749    }
12750
12751    public boolean hasDate() {
12752      return this.date != null && !this.date.isEmpty();
12753    }
12754
12755    /**
12756     * @param value {@link #date} (Estimated date the payment will be issued or the
12757     *              actual issue date of payment.). This is the underlying object
12758     *              with id, value and extensions. The accessor "getDate" gives
12759     *              direct access to the value
12760     */
12761    public PaymentComponent setDateElement(DateType value) {
12762      this.date = value;
12763      return this;
12764    }
12765
12766    /**
12767     * @return Estimated date the payment will be issued or the actual issue date of
12768     *         payment.
12769     */
12770    public Date getDate() {
12771      return this.date == null ? null : this.date.getValue();
12772    }
12773
12774    /**
12775     * @param value Estimated date the payment will be issued or the actual issue
12776     *              date of payment.
12777     */
12778    public PaymentComponent setDate(Date value) {
12779      if (value == null)
12780        this.date = null;
12781      else {
12782        if (this.date == null)
12783          this.date = new DateType();
12784        this.date.setValue(value);
12785      }
12786      return this;
12787    }
12788
12789    /**
12790     * @return {@link #amount} (Benefits payable less any payment adjustment.)
12791     */
12792    public Money getAmount() {
12793      if (this.amount == null)
12794        if (Configuration.errorOnAutoCreate())
12795          throw new Error("Attempt to auto-create PaymentComponent.amount");
12796        else if (Configuration.doAutoCreate())
12797          this.amount = new Money(); // cc
12798      return this.amount;
12799    }
12800
12801    public boolean hasAmount() {
12802      return this.amount != null && !this.amount.isEmpty();
12803    }
12804
12805    /**
12806     * @param value {@link #amount} (Benefits payable less any payment adjustment.)
12807     */
12808    public PaymentComponent setAmount(Money value) {
12809      this.amount = value;
12810      return this;
12811    }
12812
12813    /**
12814     * @return {@link #identifier} (Issuer's unique identifier for the payment
12815     *         instrument.)
12816     */
12817    public Identifier getIdentifier() {
12818      if (this.identifier == null)
12819        if (Configuration.errorOnAutoCreate())
12820          throw new Error("Attempt to auto-create PaymentComponent.identifier");
12821        else if (Configuration.doAutoCreate())
12822          this.identifier = new Identifier(); // cc
12823      return this.identifier;
12824    }
12825
12826    public boolean hasIdentifier() {
12827      return this.identifier != null && !this.identifier.isEmpty();
12828    }
12829
12830    /**
12831     * @param value {@link #identifier} (Issuer's unique identifier for the payment
12832     *              instrument.)
12833     */
12834    public PaymentComponent setIdentifier(Identifier value) {
12835      this.identifier = value;
12836      return this;
12837    }
12838
12839    protected void listChildren(List<Property> children) {
12840      super.listChildren(children);
12841      children.add(new Property("type", "CodeableConcept",
12842          "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type));
12843      children.add(new Property("adjustment", "Money",
12844          "Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.",
12845          0, 1, adjustment));
12846      children.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1,
12847          adjustmentReason));
12848      children.add(new Property("date", "date",
12849          "Estimated date the payment will be issued or the actual issue date of payment.", 0, 1, date));
12850      children.add(new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount));
12851      children.add(new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0,
12852          1, identifier));
12853    }
12854
12855    @Override
12856    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
12857      switch (_hash) {
12858      case 3575610:
12859        /* type */ return new Property("type", "CodeableConcept",
12860            "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type);
12861      case 1977085293:
12862        /* adjustment */ return new Property("adjustment", "Money",
12863            "Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.",
12864            0, 1, adjustment);
12865      case -1255938543:
12866        /* adjustmentReason */ return new Property("adjustmentReason", "CodeableConcept",
12867            "Reason for the payment adjustment.", 0, 1, adjustmentReason);
12868      case 3076014:
12869        /* date */ return new Property("date", "date",
12870            "Estimated date the payment will be issued or the actual issue date of payment.", 0, 1, date);
12871      case -1413853096:
12872        /* amount */ return new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1,
12873            amount);
12874      case -1618432855:
12875        /* identifier */ return new Property("identifier", "Identifier",
12876            "Issuer's unique identifier for the payment instrument.", 0, 1, identifier);
12877      default:
12878        return super.getNamedProperty(_hash, _name, _checkValid);
12879      }
12880
12881    }
12882
12883    @Override
12884    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
12885      switch (hash) {
12886      case 3575610:
12887        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
12888      case 1977085293:
12889        /* adjustment */ return this.adjustment == null ? new Base[0] : new Base[] { this.adjustment }; // Money
12890      case -1255938543:
12891        /* adjustmentReason */ return this.adjustmentReason == null ? new Base[0]
12892            : new Base[] { this.adjustmentReason }; // CodeableConcept
12893      case 3076014:
12894        /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateType
12895      case -1413853096:
12896        /* amount */ return this.amount == null ? new Base[0] : new Base[] { this.amount }; // Money
12897      case -1618432855:
12898        /* identifier */ return this.identifier == null ? new Base[0] : new Base[] { this.identifier }; // Identifier
12899      default:
12900        return super.getProperty(hash, name, checkValid);
12901      }
12902
12903    }
12904
12905    @Override
12906    public Base setProperty(int hash, String name, Base value) throws FHIRException {
12907      switch (hash) {
12908      case 3575610: // type
12909        this.type = castToCodeableConcept(value); // CodeableConcept
12910        return value;
12911      case 1977085293: // adjustment
12912        this.adjustment = castToMoney(value); // Money
12913        return value;
12914      case -1255938543: // adjustmentReason
12915        this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
12916        return value;
12917      case 3076014: // date
12918        this.date = castToDate(value); // DateType
12919        return value;
12920      case -1413853096: // amount
12921        this.amount = castToMoney(value); // Money
12922        return value;
12923      case -1618432855: // identifier
12924        this.identifier = castToIdentifier(value); // Identifier
12925        return value;
12926      default:
12927        return super.setProperty(hash, name, value);
12928      }
12929
12930    }
12931
12932    @Override
12933    public Base setProperty(String name, Base value) throws FHIRException {
12934      if (name.equals("type")) {
12935        this.type = castToCodeableConcept(value); // CodeableConcept
12936      } else if (name.equals("adjustment")) {
12937        this.adjustment = castToMoney(value); // Money
12938      } else if (name.equals("adjustmentReason")) {
12939        this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
12940      } else if (name.equals("date")) {
12941        this.date = castToDate(value); // DateType
12942      } else if (name.equals("amount")) {
12943        this.amount = castToMoney(value); // Money
12944      } else if (name.equals("identifier")) {
12945        this.identifier = castToIdentifier(value); // Identifier
12946      } else
12947        return super.setProperty(name, value);
12948      return value;
12949    }
12950
12951    @Override
12952    public Base makeProperty(int hash, String name) throws FHIRException {
12953      switch (hash) {
12954      case 3575610:
12955        return getType();
12956      case 1977085293:
12957        return getAdjustment();
12958      case -1255938543:
12959        return getAdjustmentReason();
12960      case 3076014:
12961        return getDateElement();
12962      case -1413853096:
12963        return getAmount();
12964      case -1618432855:
12965        return getIdentifier();
12966      default:
12967        return super.makeProperty(hash, name);
12968      }
12969
12970    }
12971
12972    @Override
12973    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12974      switch (hash) {
12975      case 3575610:
12976        /* type */ return new String[] { "CodeableConcept" };
12977      case 1977085293:
12978        /* adjustment */ return new String[] { "Money" };
12979      case -1255938543:
12980        /* adjustmentReason */ return new String[] { "CodeableConcept" };
12981      case 3076014:
12982        /* date */ return new String[] { "date" };
12983      case -1413853096:
12984        /* amount */ return new String[] { "Money" };
12985      case -1618432855:
12986        /* identifier */ return new String[] { "Identifier" };
12987      default:
12988        return super.getTypesForProperty(hash, name);
12989      }
12990
12991    }
12992
12993    @Override
12994    public Base addChild(String name) throws FHIRException {
12995      if (name.equals("type")) {
12996        this.type = new CodeableConcept();
12997        return this.type;
12998      } else if (name.equals("adjustment")) {
12999        this.adjustment = new Money();
13000        return this.adjustment;
13001      } else if (name.equals("adjustmentReason")) {
13002        this.adjustmentReason = new CodeableConcept();
13003        return this.adjustmentReason;
13004      } else if (name.equals("date")) {
13005        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.date");
13006      } else if (name.equals("amount")) {
13007        this.amount = new Money();
13008        return this.amount;
13009      } else if (name.equals("identifier")) {
13010        this.identifier = new Identifier();
13011        return this.identifier;
13012      } else
13013        return super.addChild(name);
13014    }
13015
13016    public PaymentComponent copy() {
13017      PaymentComponent dst = new PaymentComponent();
13018      copyValues(dst);
13019      return dst;
13020    }
13021
13022    public void copyValues(PaymentComponent dst) {
13023      super.copyValues(dst);
13024      dst.type = type == null ? null : type.copy();
13025      dst.adjustment = adjustment == null ? null : adjustment.copy();
13026      dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
13027      dst.date = date == null ? null : date.copy();
13028      dst.amount = amount == null ? null : amount.copy();
13029      dst.identifier = identifier == null ? null : identifier.copy();
13030    }
13031
13032    @Override
13033    public boolean equalsDeep(Base other_) {
13034      if (!super.equalsDeep(other_))
13035        return false;
13036      if (!(other_ instanceof PaymentComponent))
13037        return false;
13038      PaymentComponent o = (PaymentComponent) other_;
13039      return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true)
13040          && compareDeep(adjustmentReason, o.adjustmentReason, true) && compareDeep(date, o.date, true)
13041          && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true);
13042    }
13043
13044    @Override
13045    public boolean equalsShallow(Base other_) {
13046      if (!super.equalsShallow(other_))
13047        return false;
13048      if (!(other_ instanceof PaymentComponent))
13049        return false;
13050      PaymentComponent o = (PaymentComponent) other_;
13051      return compareValues(date, o.date, true);
13052    }
13053
13054    public boolean isEmpty() {
13055      return super.isEmpty()
13056          && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason, date, amount, identifier);
13057    }
13058
13059    public String fhirType() {
13060      return "ExplanationOfBenefit.payment";
13061
13062    }
13063
13064  }
13065
13066  @Block()
13067  public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
13068    /**
13069     * A number to uniquely identify a note entry.
13070     */
13071    @Child(name = "number", type = {
13072        PositiveIntType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
13073    @Description(shortDefinition = "Note instance identifier", formalDefinition = "A number to uniquely identify a note entry.")
13074    protected PositiveIntType number;
13075
13076    /**
13077     * The business purpose of the note text.
13078     */
13079    @Child(name = "type", type = { CodeType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
13080    @Description(shortDefinition = "display | print | printoper", formalDefinition = "The business purpose of the note text.")
13081    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/note-type")
13082    protected Enumeration<NoteType> type;
13083
13084    /**
13085     * The explanation or description associated with the processing.
13086     */
13087    @Child(name = "text", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
13088    @Description(shortDefinition = "Note explanatory text", formalDefinition = "The explanation or description associated with the processing.")
13089    protected StringType text;
13090
13091    /**
13092     * A code to define the language used in the text of the note.
13093     */
13094    @Child(name = "language", type = {
13095        CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
13096    @Description(shortDefinition = "Language of the text", formalDefinition = "A code to define the language used in the text of the note.")
13097    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/languages")
13098    protected CodeableConcept language;
13099
13100    private static final long serialVersionUID = -385184277L;
13101
13102    /**
13103     * Constructor
13104     */
13105    public NoteComponent() {
13106      super();
13107    }
13108
13109    /**
13110     * @return {@link #number} (A number to uniquely identify a note entry.). This
13111     *         is the underlying object with id, value and extensions. The accessor
13112     *         "getNumber" gives direct access to the value
13113     */
13114    public PositiveIntType getNumberElement() {
13115      if (this.number == null)
13116        if (Configuration.errorOnAutoCreate())
13117          throw new Error("Attempt to auto-create NoteComponent.number");
13118        else if (Configuration.doAutoCreate())
13119          this.number = new PositiveIntType(); // bb
13120      return this.number;
13121    }
13122
13123    public boolean hasNumberElement() {
13124      return this.number != null && !this.number.isEmpty();
13125    }
13126
13127    public boolean hasNumber() {
13128      return this.number != null && !this.number.isEmpty();
13129    }
13130
13131    /**
13132     * @param value {@link #number} (A number to uniquely identify a note entry.).
13133     *              This is the underlying object with id, value and extensions. The
13134     *              accessor "getNumber" gives direct access to the value
13135     */
13136    public NoteComponent setNumberElement(PositiveIntType value) {
13137      this.number = value;
13138      return this;
13139    }
13140
13141    /**
13142     * @return A number to uniquely identify a note entry.
13143     */
13144    public int getNumber() {
13145      return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
13146    }
13147
13148    /**
13149     * @param value A number to uniquely identify a note entry.
13150     */
13151    public NoteComponent setNumber(int value) {
13152      if (this.number == null)
13153        this.number = new PositiveIntType();
13154      this.number.setValue(value);
13155      return this;
13156    }
13157
13158    /**
13159     * @return {@link #type} (The business purpose of the note text.). This is the
13160     *         underlying object with id, value and extensions. The accessor
13161     *         "getType" gives direct access to the value
13162     */
13163    public Enumeration<NoteType> getTypeElement() {
13164      if (this.type == null)
13165        if (Configuration.errorOnAutoCreate())
13166          throw new Error("Attempt to auto-create NoteComponent.type");
13167        else if (Configuration.doAutoCreate())
13168          this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory()); // bb
13169      return this.type;
13170    }
13171
13172    public boolean hasTypeElement() {
13173      return this.type != null && !this.type.isEmpty();
13174    }
13175
13176    public boolean hasType() {
13177      return this.type != null && !this.type.isEmpty();
13178    }
13179
13180    /**
13181     * @param value {@link #type} (The business purpose of the note text.). This is
13182     *              the underlying object with id, value and extensions. The
13183     *              accessor "getType" gives direct access to the value
13184     */
13185    public NoteComponent setTypeElement(Enumeration<NoteType> value) {
13186      this.type = value;
13187      return this;
13188    }
13189
13190    /**
13191     * @return The business purpose of the note text.
13192     */
13193    public NoteType getType() {
13194      return this.type == null ? null : this.type.getValue();
13195    }
13196
13197    /**
13198     * @param value The business purpose of the note text.
13199     */
13200    public NoteComponent setType(NoteType value) {
13201      if (value == null)
13202        this.type = null;
13203      else {
13204        if (this.type == null)
13205          this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory());
13206        this.type.setValue(value);
13207      }
13208      return this;
13209    }
13210
13211    /**
13212     * @return {@link #text} (The explanation or description associated with the
13213     *         processing.). This is the underlying object with id, value and
13214     *         extensions. The accessor "getText" gives direct access to the value
13215     */
13216    public StringType getTextElement() {
13217      if (this.text == null)
13218        if (Configuration.errorOnAutoCreate())
13219          throw new Error("Attempt to auto-create NoteComponent.text");
13220        else if (Configuration.doAutoCreate())
13221          this.text = new StringType(); // bb
13222      return this.text;
13223    }
13224
13225    public boolean hasTextElement() {
13226      return this.text != null && !this.text.isEmpty();
13227    }
13228
13229    public boolean hasText() {
13230      return this.text != null && !this.text.isEmpty();
13231    }
13232
13233    /**
13234     * @param value {@link #text} (The explanation or description associated with
13235     *              the processing.). This is the underlying object with id, value
13236     *              and extensions. The accessor "getText" gives direct access to
13237     *              the value
13238     */
13239    public NoteComponent setTextElement(StringType value) {
13240      this.text = value;
13241      return this;
13242    }
13243
13244    /**
13245     * @return The explanation or description associated with the processing.
13246     */
13247    public String getText() {
13248      return this.text == null ? null : this.text.getValue();
13249    }
13250
13251    /**
13252     * @param value The explanation or description associated with the processing.
13253     */
13254    public NoteComponent setText(String value) {
13255      if (Utilities.noString(value))
13256        this.text = null;
13257      else {
13258        if (this.text == null)
13259          this.text = new StringType();
13260        this.text.setValue(value);
13261      }
13262      return this;
13263    }
13264
13265    /**
13266     * @return {@link #language} (A code to define the language used in the text of
13267     *         the note.)
13268     */
13269    public CodeableConcept getLanguage() {
13270      if (this.language == null)
13271        if (Configuration.errorOnAutoCreate())
13272          throw new Error("Attempt to auto-create NoteComponent.language");
13273        else if (Configuration.doAutoCreate())
13274          this.language = new CodeableConcept(); // cc
13275      return this.language;
13276    }
13277
13278    public boolean hasLanguage() {
13279      return this.language != null && !this.language.isEmpty();
13280    }
13281
13282    /**
13283     * @param value {@link #language} (A code to define the language used in the
13284     *              text of the note.)
13285     */
13286    public NoteComponent setLanguage(CodeableConcept value) {
13287      this.language = value;
13288      return this;
13289    }
13290
13291    protected void listChildren(List<Property> children) {
13292      super.listChildren(children);
13293      children.add(new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number));
13294      children.add(new Property("type", "code", "The business purpose of the note text.", 0, 1, type));
13295      children.add(
13296          new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text));
13297      children.add(new Property("language", "CodeableConcept",
13298          "A code to define the language used in the text of the note.", 0, 1, language));
13299    }
13300
13301    @Override
13302    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
13303      switch (_hash) {
13304      case -1034364087:
13305        /* number */ return new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1,
13306            number);
13307      case 3575610:
13308        /* type */ return new Property("type", "code", "The business purpose of the note text.", 0, 1, type);
13309      case 3556653:
13310        /* text */ return new Property("text", "string",
13311            "The explanation or description associated with the processing.", 0, 1, text);
13312      case -1613589672:
13313        /* language */ return new Property("language", "CodeableConcept",
13314            "A code to define the language used in the text of the note.", 0, 1, language);
13315      default:
13316        return super.getNamedProperty(_hash, _name, _checkValid);
13317      }
13318
13319    }
13320
13321    @Override
13322    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
13323      switch (hash) {
13324      case -1034364087:
13325        /* number */ return this.number == null ? new Base[0] : new Base[] { this.number }; // PositiveIntType
13326      case 3575610:
13327        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // Enumeration<NoteType>
13328      case 3556653:
13329        /* text */ return this.text == null ? new Base[0] : new Base[] { this.text }; // StringType
13330      case -1613589672:
13331        /* language */ return this.language == null ? new Base[0] : new Base[] { this.language }; // CodeableConcept
13332      default:
13333        return super.getProperty(hash, name, checkValid);
13334      }
13335
13336    }
13337
13338    @Override
13339    public Base setProperty(int hash, String name, Base value) throws FHIRException {
13340      switch (hash) {
13341      case -1034364087: // number
13342        this.number = castToPositiveInt(value); // PositiveIntType
13343        return value;
13344      case 3575610: // type
13345        value = new NoteTypeEnumFactory().fromType(castToCode(value));
13346        this.type = (Enumeration) value; // Enumeration<NoteType>
13347        return value;
13348      case 3556653: // text
13349        this.text = castToString(value); // StringType
13350        return value;
13351      case -1613589672: // language
13352        this.language = castToCodeableConcept(value); // CodeableConcept
13353        return value;
13354      default:
13355        return super.setProperty(hash, name, value);
13356      }
13357
13358    }
13359
13360    @Override
13361    public Base setProperty(String name, Base value) throws FHIRException {
13362      if (name.equals("number")) {
13363        this.number = castToPositiveInt(value); // PositiveIntType
13364      } else if (name.equals("type")) {
13365        value = new NoteTypeEnumFactory().fromType(castToCode(value));
13366        this.type = (Enumeration) value; // Enumeration<NoteType>
13367      } else if (name.equals("text")) {
13368        this.text = castToString(value); // StringType
13369      } else if (name.equals("language")) {
13370        this.language = castToCodeableConcept(value); // CodeableConcept
13371      } else
13372        return super.setProperty(name, value);
13373      return value;
13374    }
13375
13376    @Override
13377    public Base makeProperty(int hash, String name) throws FHIRException {
13378      switch (hash) {
13379      case -1034364087:
13380        return getNumberElement();
13381      case 3575610:
13382        return getTypeElement();
13383      case 3556653:
13384        return getTextElement();
13385      case -1613589672:
13386        return getLanguage();
13387      default:
13388        return super.makeProperty(hash, name);
13389      }
13390
13391    }
13392
13393    @Override
13394    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
13395      switch (hash) {
13396      case -1034364087:
13397        /* number */ return new String[] { "positiveInt" };
13398      case 3575610:
13399        /* type */ return new String[] { "code" };
13400      case 3556653:
13401        /* text */ return new String[] { "string" };
13402      case -1613589672:
13403        /* language */ return new String[] { "CodeableConcept" };
13404      default:
13405        return super.getTypesForProperty(hash, name);
13406      }
13407
13408    }
13409
13410    @Override
13411    public Base addChild(String name) throws FHIRException {
13412      if (name.equals("number")) {
13413        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.number");
13414      } else if (name.equals("type")) {
13415        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.type");
13416      } else if (name.equals("text")) {
13417        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.text");
13418      } else if (name.equals("language")) {
13419        this.language = new CodeableConcept();
13420        return this.language;
13421      } else
13422        return super.addChild(name);
13423    }
13424
13425    public NoteComponent copy() {
13426      NoteComponent dst = new NoteComponent();
13427      copyValues(dst);
13428      return dst;
13429    }
13430
13431    public void copyValues(NoteComponent dst) {
13432      super.copyValues(dst);
13433      dst.number = number == null ? null : number.copy();
13434      dst.type = type == null ? null : type.copy();
13435      dst.text = text == null ? null : text.copy();
13436      dst.language = language == null ? null : language.copy();
13437    }
13438
13439    @Override
13440    public boolean equalsDeep(Base other_) {
13441      if (!super.equalsDeep(other_))
13442        return false;
13443      if (!(other_ instanceof NoteComponent))
13444        return false;
13445      NoteComponent o = (NoteComponent) other_;
13446      return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
13447          && compareDeep(language, o.language, true);
13448    }
13449
13450    @Override
13451    public boolean equalsShallow(Base other_) {
13452      if (!super.equalsShallow(other_))
13453        return false;
13454      if (!(other_ instanceof NoteComponent))
13455        return false;
13456      NoteComponent o = (NoteComponent) other_;
13457      return compareValues(number, o.number, true) && compareValues(type, o.type, true)
13458          && compareValues(text, o.text, true);
13459    }
13460
13461    public boolean isEmpty() {
13462      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language);
13463    }
13464
13465    public String fhirType() {
13466      return "ExplanationOfBenefit.processNote";
13467
13468    }
13469
13470  }
13471
13472  @Block()
13473  public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
13474    /**
13475     * Code to identify the general type of benefits under which products and
13476     * services are provided.
13477     */
13478    @Child(name = "category", type = {
13479        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
13480    @Description(shortDefinition = "Benefit classification", formalDefinition = "Code to identify the general type of benefits under which products and services are provided.")
13481    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-benefitcategory")
13482    protected CodeableConcept category;
13483
13484    /**
13485     * True if the indicated class of service is excluded from the plan, missing or
13486     * False indicates the product or service is included in the coverage.
13487     */
13488    @Child(name = "excluded", type = {
13489        BooleanType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
13490    @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.")
13491    protected BooleanType excluded;
13492
13493    /**
13494     * A short name or tag for the benefit.
13495     */
13496    @Child(name = "name", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
13497    @Description(shortDefinition = "Short name for the benefit", formalDefinition = "A short name or tag for the benefit.")
13498    protected StringType name;
13499
13500    /**
13501     * A richer description of the benefit or services covered.
13502     */
13503    @Child(name = "description", type = {
13504        StringType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
13505    @Description(shortDefinition = "Description of the benefit or services covered", formalDefinition = "A richer description of the benefit or services covered.")
13506    protected StringType description;
13507
13508    /**
13509     * Is a flag to indicate whether the benefits refer to in-network providers or
13510     * out-of-network providers.
13511     */
13512    @Child(name = "network", type = {
13513        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
13514    @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.")
13515    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/benefit-network")
13516    protected CodeableConcept network;
13517
13518    /**
13519     * Indicates if the benefits apply to an individual or to the family.
13520     */
13521    @Child(name = "unit", type = {
13522        CodeableConcept.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
13523    @Description(shortDefinition = "Individual or family", formalDefinition = "Indicates if the benefits apply to an individual or to the family.")
13524    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/benefit-unit")
13525    protected CodeableConcept unit;
13526
13527    /**
13528     * The term or period of the values such as 'maximum lifetime benefit' or
13529     * 'maximum annual visits'.
13530     */
13531    @Child(name = "term", type = {
13532        CodeableConcept.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
13533    @Description(shortDefinition = "Annual or lifetime", formalDefinition = "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.")
13534    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/benefit-term")
13535    protected CodeableConcept term;
13536
13537    /**
13538     * Benefits Used to date.
13539     */
13540    @Child(name = "financial", type = {}, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
13541    @Description(shortDefinition = "Benefit Summary", formalDefinition = "Benefits Used to date.")
13542    protected List<BenefitComponent> financial;
13543
13544    private static final long serialVersionUID = -1889655824L;
13545
13546    /**
13547     * Constructor
13548     */
13549    public BenefitBalanceComponent() {
13550      super();
13551    }
13552
13553    /**
13554     * Constructor
13555     */
13556    public BenefitBalanceComponent(CodeableConcept category) {
13557      super();
13558      this.category = category;
13559    }
13560
13561    /**
13562     * @return {@link #category} (Code to identify the general type of benefits
13563     *         under which products and services are provided.)
13564     */
13565    public CodeableConcept getCategory() {
13566      if (this.category == null)
13567        if (Configuration.errorOnAutoCreate())
13568          throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
13569        else if (Configuration.doAutoCreate())
13570          this.category = new CodeableConcept(); // cc
13571      return this.category;
13572    }
13573
13574    public boolean hasCategory() {
13575      return this.category != null && !this.category.isEmpty();
13576    }
13577
13578    /**
13579     * @param value {@link #category} (Code to identify the general type of benefits
13580     *              under which products and services are provided.)
13581     */
13582    public BenefitBalanceComponent setCategory(CodeableConcept value) {
13583      this.category = value;
13584      return this;
13585    }
13586
13587    /**
13588     * @return {@link #excluded} (True if the indicated class of service is excluded
13589     *         from the plan, missing or False indicates the product or service is
13590     *         included in the coverage.). This is the underlying object with id,
13591     *         value and extensions. The accessor "getExcluded" gives direct access
13592     *         to the value
13593     */
13594    public BooleanType getExcludedElement() {
13595      if (this.excluded == null)
13596        if (Configuration.errorOnAutoCreate())
13597          throw new Error("Attempt to auto-create BenefitBalanceComponent.excluded");
13598        else if (Configuration.doAutoCreate())
13599          this.excluded = new BooleanType(); // bb
13600      return this.excluded;
13601    }
13602
13603    public boolean hasExcludedElement() {
13604      return this.excluded != null && !this.excluded.isEmpty();
13605    }
13606
13607    public boolean hasExcluded() {
13608      return this.excluded != null && !this.excluded.isEmpty();
13609    }
13610
13611    /**
13612     * @param value {@link #excluded} (True if the indicated class of service is
13613     *              excluded from the plan, missing or False indicates the product
13614     *              or service is included in the coverage.). This is the underlying
13615     *              object with id, value and extensions. The accessor "getExcluded"
13616     *              gives direct access to the value
13617     */
13618    public BenefitBalanceComponent setExcludedElement(BooleanType value) {
13619      this.excluded = value;
13620      return this;
13621    }
13622
13623    /**
13624     * @return True if the indicated class of service is excluded from the plan,
13625     *         missing or False indicates the product or service is included in the
13626     *         coverage.
13627     */
13628    public boolean getExcluded() {
13629      return this.excluded == null || this.excluded.isEmpty() ? false : this.excluded.getValue();
13630    }
13631
13632    /**
13633     * @param value True if the indicated class of service is excluded from the
13634     *              plan, missing or False indicates the product or service is
13635     *              included in the coverage.
13636     */
13637    public BenefitBalanceComponent setExcluded(boolean value) {
13638      if (this.excluded == null)
13639        this.excluded = new BooleanType();
13640      this.excluded.setValue(value);
13641      return this;
13642    }
13643
13644    /**
13645     * @return {@link #name} (A short name or tag for the benefit.). This is the
13646     *         underlying object with id, value and extensions. The accessor
13647     *         "getName" gives direct access to the value
13648     */
13649    public StringType getNameElement() {
13650      if (this.name == null)
13651        if (Configuration.errorOnAutoCreate())
13652          throw new Error("Attempt to auto-create BenefitBalanceComponent.name");
13653        else if (Configuration.doAutoCreate())
13654          this.name = new StringType(); // bb
13655      return this.name;
13656    }
13657
13658    public boolean hasNameElement() {
13659      return this.name != null && !this.name.isEmpty();
13660    }
13661
13662    public boolean hasName() {
13663      return this.name != null && !this.name.isEmpty();
13664    }
13665
13666    /**
13667     * @param value {@link #name} (A short name or tag for the benefit.). This is
13668     *              the underlying object with id, value and extensions. The
13669     *              accessor "getName" gives direct access to the value
13670     */
13671    public BenefitBalanceComponent setNameElement(StringType value) {
13672      this.name = value;
13673      return this;
13674    }
13675
13676    /**
13677     * @return A short name or tag for the benefit.
13678     */
13679    public String getName() {
13680      return this.name == null ? null : this.name.getValue();
13681    }
13682
13683    /**
13684     * @param value A short name or tag for the benefit.
13685     */
13686    public BenefitBalanceComponent setName(String value) {
13687      if (Utilities.noString(value))
13688        this.name = null;
13689      else {
13690        if (this.name == null)
13691          this.name = new StringType();
13692        this.name.setValue(value);
13693      }
13694      return this;
13695    }
13696
13697    /**
13698     * @return {@link #description} (A richer description of the benefit or services
13699     *         covered.). This is the underlying object with id, value and
13700     *         extensions. The accessor "getDescription" gives direct access to the
13701     *         value
13702     */
13703    public StringType getDescriptionElement() {
13704      if (this.description == null)
13705        if (Configuration.errorOnAutoCreate())
13706          throw new Error("Attempt to auto-create BenefitBalanceComponent.description");
13707        else if (Configuration.doAutoCreate())
13708          this.description = new StringType(); // bb
13709      return this.description;
13710    }
13711
13712    public boolean hasDescriptionElement() {
13713      return this.description != null && !this.description.isEmpty();
13714    }
13715
13716    public boolean hasDescription() {
13717      return this.description != null && !this.description.isEmpty();
13718    }
13719
13720    /**
13721     * @param value {@link #description} (A richer description of the benefit or
13722     *              services covered.). This is the underlying object with id, value
13723     *              and extensions. The accessor "getDescription" gives direct
13724     *              access to the value
13725     */
13726    public BenefitBalanceComponent setDescriptionElement(StringType value) {
13727      this.description = value;
13728      return this;
13729    }
13730
13731    /**
13732     * @return A richer description of the benefit or services covered.
13733     */
13734    public String getDescription() {
13735      return this.description == null ? null : this.description.getValue();
13736    }
13737
13738    /**
13739     * @param value A richer description of the benefit or services covered.
13740     */
13741    public BenefitBalanceComponent setDescription(String value) {
13742      if (Utilities.noString(value))
13743        this.description = null;
13744      else {
13745        if (this.description == null)
13746          this.description = new StringType();
13747        this.description.setValue(value);
13748      }
13749      return this;
13750    }
13751
13752    /**
13753     * @return {@link #network} (Is a flag to indicate whether the benefits refer to
13754     *         in-network providers or out-of-network providers.)
13755     */
13756    public CodeableConcept getNetwork() {
13757      if (this.network == null)
13758        if (Configuration.errorOnAutoCreate())
13759          throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
13760        else if (Configuration.doAutoCreate())
13761          this.network = new CodeableConcept(); // cc
13762      return this.network;
13763    }
13764
13765    public boolean hasNetwork() {
13766      return this.network != null && !this.network.isEmpty();
13767    }
13768
13769    /**
13770     * @param value {@link #network} (Is a flag to indicate whether the benefits
13771     *              refer to in-network providers or out-of-network providers.)
13772     */
13773    public BenefitBalanceComponent setNetwork(CodeableConcept value) {
13774      this.network = value;
13775      return this;
13776    }
13777
13778    /**
13779     * @return {@link #unit} (Indicates if the benefits apply to an individual or to
13780     *         the family.)
13781     */
13782    public CodeableConcept getUnit() {
13783      if (this.unit == null)
13784        if (Configuration.errorOnAutoCreate())
13785          throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
13786        else if (Configuration.doAutoCreate())
13787          this.unit = new CodeableConcept(); // cc
13788      return this.unit;
13789    }
13790
13791    public boolean hasUnit() {
13792      return this.unit != null && !this.unit.isEmpty();
13793    }
13794
13795    /**
13796     * @param value {@link #unit} (Indicates if the benefits apply to an individual
13797     *              or to the family.)
13798     */
13799    public BenefitBalanceComponent setUnit(CodeableConcept value) {
13800      this.unit = value;
13801      return this;
13802    }
13803
13804    /**
13805     * @return {@link #term} (The term or period of the values such as 'maximum
13806     *         lifetime benefit' or 'maximum annual visits'.)
13807     */
13808    public CodeableConcept getTerm() {
13809      if (this.term == null)
13810        if (Configuration.errorOnAutoCreate())
13811          throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
13812        else if (Configuration.doAutoCreate())
13813          this.term = new CodeableConcept(); // cc
13814      return this.term;
13815    }
13816
13817    public boolean hasTerm() {
13818      return this.term != null && !this.term.isEmpty();
13819    }
13820
13821    /**
13822     * @param value {@link #term} (The term or period of the values such as 'maximum
13823     *              lifetime benefit' or 'maximum annual visits'.)
13824     */
13825    public BenefitBalanceComponent setTerm(CodeableConcept value) {
13826      this.term = value;
13827      return this;
13828    }
13829
13830    /**
13831     * @return {@link #financial} (Benefits Used to date.)
13832     */
13833    public List<BenefitComponent> getFinancial() {
13834      if (this.financial == null)
13835        this.financial = new ArrayList<BenefitComponent>();
13836      return this.financial;
13837    }
13838
13839    /**
13840     * @return Returns a reference to <code>this</code> for easy method chaining
13841     */
13842    public BenefitBalanceComponent setFinancial(List<BenefitComponent> theFinancial) {
13843      this.financial = theFinancial;
13844      return this;
13845    }
13846
13847    public boolean hasFinancial() {
13848      if (this.financial == null)
13849        return false;
13850      for (BenefitComponent item : this.financial)
13851        if (!item.isEmpty())
13852          return true;
13853      return false;
13854    }
13855
13856    public BenefitComponent addFinancial() { // 3
13857      BenefitComponent t = new BenefitComponent();
13858      if (this.financial == null)
13859        this.financial = new ArrayList<BenefitComponent>();
13860      this.financial.add(t);
13861      return t;
13862    }
13863
13864    public BenefitBalanceComponent addFinancial(BenefitComponent t) { // 3
13865      if (t == null)
13866        return this;
13867      if (this.financial == null)
13868        this.financial = new ArrayList<BenefitComponent>();
13869      this.financial.add(t);
13870      return this;
13871    }
13872
13873    /**
13874     * @return The first repetition of repeating field {@link #financial}, creating
13875     *         it if it does not already exist
13876     */
13877    public BenefitComponent getFinancialFirstRep() {
13878      if (getFinancial().isEmpty()) {
13879        addFinancial();
13880      }
13881      return getFinancial().get(0);
13882    }
13883
13884    protected void listChildren(List<Property> children) {
13885      super.listChildren(children);
13886      children.add(new Property("category", "CodeableConcept",
13887          "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
13888          category));
13889      children.add(new Property("excluded", "boolean",
13890          "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.",
13891          0, 1, excluded));
13892      children.add(new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name));
13893      children.add(new Property("description", "string", "A richer description of the benefit or services covered.", 0,
13894          1, description));
13895      children.add(new Property("network", "CodeableConcept",
13896          "Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.", 0, 1,
13897          network));
13898      children.add(new Property("unit", "CodeableConcept",
13899          "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit));
13900      children.add(new Property("term", "CodeableConcept",
13901          "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.", 0, 1,
13902          term));
13903      children.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
13904    }
13905
13906    @Override
13907    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
13908      switch (_hash) {
13909      case 50511102:
13910        /* category */ return new Property("category", "CodeableConcept",
13911            "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
13912            category);
13913      case 1994055114:
13914        /* excluded */ return new Property("excluded", "boolean",
13915            "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.",
13916            0, 1, excluded);
13917      case 3373707:
13918        /* name */ return new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name);
13919      case -1724546052:
13920        /* description */ return new Property("description", "string",
13921            "A richer description of the benefit or services covered.", 0, 1, description);
13922      case 1843485230:
13923        /* network */ return new Property("network", "CodeableConcept",
13924            "Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.", 0,
13925            1, network);
13926      case 3594628:
13927        /* unit */ return new Property("unit", "CodeableConcept",
13928            "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit);
13929      case 3556460:
13930        /* term */ return new Property("term", "CodeableConcept",
13931            "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.", 0, 1,
13932            term);
13933      case 357555337:
13934        /* financial */ return new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE,
13935            financial);
13936      default:
13937        return super.getNamedProperty(_hash, _name, _checkValid);
13938      }
13939
13940    }
13941
13942    @Override
13943    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
13944      switch (hash) {
13945      case 50511102:
13946        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
13947      case 1994055114:
13948        /* excluded */ return this.excluded == null ? new Base[0] : new Base[] { this.excluded }; // BooleanType
13949      case 3373707:
13950        /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // StringType
13951      case -1724546052:
13952        /* description */ return this.description == null ? new Base[0] : new Base[] { this.description }; // StringType
13953      case 1843485230:
13954        /* network */ return this.network == null ? new Base[0] : new Base[] { this.network }; // CodeableConcept
13955      case 3594628:
13956        /* unit */ return this.unit == null ? new Base[0] : new Base[] { this.unit }; // CodeableConcept
13957      case 3556460:
13958        /* term */ return this.term == null ? new Base[0] : new Base[] { this.term }; // CodeableConcept
13959      case 357555337:
13960        /* financial */ return this.financial == null ? new Base[0]
13961            : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
13962      default:
13963        return super.getProperty(hash, name, checkValid);
13964      }
13965
13966    }
13967
13968    @Override
13969    public Base setProperty(int hash, String name, Base value) throws FHIRException {
13970      switch (hash) {
13971      case 50511102: // category
13972        this.category = castToCodeableConcept(value); // CodeableConcept
13973        return value;
13974      case 1994055114: // excluded
13975        this.excluded = castToBoolean(value); // BooleanType
13976        return value;
13977      case 3373707: // name
13978        this.name = castToString(value); // StringType
13979        return value;
13980      case -1724546052: // description
13981        this.description = castToString(value); // StringType
13982        return value;
13983      case 1843485230: // network
13984        this.network = castToCodeableConcept(value); // CodeableConcept
13985        return value;
13986      case 3594628: // unit
13987        this.unit = castToCodeableConcept(value); // CodeableConcept
13988        return value;
13989      case 3556460: // term
13990        this.term = castToCodeableConcept(value); // CodeableConcept
13991        return value;
13992      case 357555337: // financial
13993        this.getFinancial().add((BenefitComponent) value); // BenefitComponent
13994        return value;
13995      default:
13996        return super.setProperty(hash, name, value);
13997      }
13998
13999    }
14000
14001    @Override
14002    public Base setProperty(String name, Base value) throws FHIRException {
14003      if (name.equals("category")) {
14004        this.category = castToCodeableConcept(value); // CodeableConcept
14005      } else if (name.equals("excluded")) {
14006        this.excluded = castToBoolean(value); // BooleanType
14007      } else if (name.equals("name")) {
14008        this.name = castToString(value); // StringType
14009      } else if (name.equals("description")) {
14010        this.description = castToString(value); // StringType
14011      } else if (name.equals("network")) {
14012        this.network = castToCodeableConcept(value); // CodeableConcept
14013      } else if (name.equals("unit")) {
14014        this.unit = castToCodeableConcept(value); // CodeableConcept
14015      } else if (name.equals("term")) {
14016        this.term = castToCodeableConcept(value); // CodeableConcept
14017      } else if (name.equals("financial")) {
14018        this.getFinancial().add((BenefitComponent) value);
14019      } else
14020        return super.setProperty(name, value);
14021      return value;
14022    }
14023
14024    @Override
14025    public Base makeProperty(int hash, String name) throws FHIRException {
14026      switch (hash) {
14027      case 50511102:
14028        return getCategory();
14029      case 1994055114:
14030        return getExcludedElement();
14031      case 3373707:
14032        return getNameElement();
14033      case -1724546052:
14034        return getDescriptionElement();
14035      case 1843485230:
14036        return getNetwork();
14037      case 3594628:
14038        return getUnit();
14039      case 3556460:
14040        return getTerm();
14041      case 357555337:
14042        return addFinancial();
14043      default:
14044        return super.makeProperty(hash, name);
14045      }
14046
14047    }
14048
14049    @Override
14050    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
14051      switch (hash) {
14052      case 50511102:
14053        /* category */ return new String[] { "CodeableConcept" };
14054      case 1994055114:
14055        /* excluded */ return new String[] { "boolean" };
14056      case 3373707:
14057        /* name */ return new String[] { "string" };
14058      case -1724546052:
14059        /* description */ return new String[] { "string" };
14060      case 1843485230:
14061        /* network */ return new String[] { "CodeableConcept" };
14062      case 3594628:
14063        /* unit */ return new String[] { "CodeableConcept" };
14064      case 3556460:
14065        /* term */ return new String[] { "CodeableConcept" };
14066      case 357555337:
14067        /* financial */ return new String[] {};
14068      default:
14069        return super.getTypesForProperty(hash, name);
14070      }
14071
14072    }
14073
14074    @Override
14075    public Base addChild(String name) throws FHIRException {
14076      if (name.equals("category")) {
14077        this.category = new CodeableConcept();
14078        return this.category;
14079      } else if (name.equals("excluded")) {
14080        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.excluded");
14081      } else if (name.equals("name")) {
14082        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.name");
14083      } else if (name.equals("description")) {
14084        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.description");
14085      } else if (name.equals("network")) {
14086        this.network = new CodeableConcept();
14087        return this.network;
14088      } else if (name.equals("unit")) {
14089        this.unit = new CodeableConcept();
14090        return this.unit;
14091      } else if (name.equals("term")) {
14092        this.term = new CodeableConcept();
14093        return this.term;
14094      } else if (name.equals("financial")) {
14095        return addFinancial();
14096      } else
14097        return super.addChild(name);
14098    }
14099
14100    public BenefitBalanceComponent copy() {
14101      BenefitBalanceComponent dst = new BenefitBalanceComponent();
14102      copyValues(dst);
14103      return dst;
14104    }
14105
14106    public void copyValues(BenefitBalanceComponent dst) {
14107      super.copyValues(dst);
14108      dst.category = category == null ? null : category.copy();
14109      dst.excluded = excluded == null ? null : excluded.copy();
14110      dst.name = name == null ? null : name.copy();
14111      dst.description = description == null ? null : description.copy();
14112      dst.network = network == null ? null : network.copy();
14113      dst.unit = unit == null ? null : unit.copy();
14114      dst.term = term == null ? null : term.copy();
14115      if (financial != null) {
14116        dst.financial = new ArrayList<BenefitComponent>();
14117        for (BenefitComponent i : financial)
14118          dst.financial.add(i.copy());
14119      }
14120      ;
14121    }
14122
14123    @Override
14124    public boolean equalsDeep(Base other_) {
14125      if (!super.equalsDeep(other_))
14126        return false;
14127      if (!(other_ instanceof BenefitBalanceComponent))
14128        return false;
14129      BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
14130      return compareDeep(category, o.category, true) && compareDeep(excluded, o.excluded, true)
14131          && compareDeep(name, o.name, true) && compareDeep(description, o.description, true)
14132          && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true) && compareDeep(term, o.term, true)
14133          && compareDeep(financial, o.financial, true);
14134    }
14135
14136    @Override
14137    public boolean equalsShallow(Base other_) {
14138      if (!super.equalsShallow(other_))
14139        return false;
14140      if (!(other_ instanceof BenefitBalanceComponent))
14141        return false;
14142      BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
14143      return compareValues(excluded, o.excluded, true) && compareValues(name, o.name, true)
14144          && compareValues(description, o.description, true);
14145    }
14146
14147    public boolean isEmpty() {
14148      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, excluded, name, description, network,
14149          unit, term, financial);
14150    }
14151
14152    public String fhirType() {
14153      return "ExplanationOfBenefit.benefitBalance";
14154
14155    }
14156
14157  }
14158
14159  @Block()
14160  public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
14161    /**
14162     * Classification of benefit being provided.
14163     */
14164    @Child(name = "type", type = {
14165        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
14166    @Description(shortDefinition = "Benefit classification", formalDefinition = "Classification of benefit being provided.")
14167    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/benefit-type")
14168    protected CodeableConcept type;
14169
14170    /**
14171     * The quantity of the benefit which is permitted under the coverage.
14172     */
14173    @Child(name = "allowed", type = { UnsignedIntType.class, StringType.class,
14174        Money.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
14175    @Description(shortDefinition = "Benefits allowed", formalDefinition = "The quantity of the benefit which is permitted under the coverage.")
14176    protected Type allowed;
14177
14178    /**
14179     * The quantity of the benefit which have been consumed to date.
14180     */
14181    @Child(name = "used", type = { UnsignedIntType.class,
14182        Money.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
14183    @Description(shortDefinition = "Benefits used", formalDefinition = "The quantity of the benefit which have been consumed to date.")
14184    protected Type used;
14185
14186    private static final long serialVersionUID = -1506285314L;
14187
14188    /**
14189     * Constructor
14190     */
14191    public BenefitComponent() {
14192      super();
14193    }
14194
14195    /**
14196     * Constructor
14197     */
14198    public BenefitComponent(CodeableConcept type) {
14199      super();
14200      this.type = type;
14201    }
14202
14203    /**
14204     * @return {@link #type} (Classification of benefit being provided.)
14205     */
14206    public CodeableConcept getType() {
14207      if (this.type == null)
14208        if (Configuration.errorOnAutoCreate())
14209          throw new Error("Attempt to auto-create BenefitComponent.type");
14210        else if (Configuration.doAutoCreate())
14211          this.type = new CodeableConcept(); // cc
14212      return this.type;
14213    }
14214
14215    public boolean hasType() {
14216      return this.type != null && !this.type.isEmpty();
14217    }
14218
14219    /**
14220     * @param value {@link #type} (Classification of benefit being provided.)
14221     */
14222    public BenefitComponent setType(CodeableConcept value) {
14223      this.type = value;
14224      return this;
14225    }
14226
14227    /**
14228     * @return {@link #allowed} (The quantity of the benefit which is permitted
14229     *         under the coverage.)
14230     */
14231    public Type getAllowed() {
14232      return this.allowed;
14233    }
14234
14235    /**
14236     * @return {@link #allowed} (The quantity of the benefit which is permitted
14237     *         under the coverage.)
14238     */
14239    public UnsignedIntType getAllowedUnsignedIntType() throws FHIRException {
14240      if (this.allowed == null)
14241        this.allowed = new UnsignedIntType();
14242      if (!(this.allowed instanceof UnsignedIntType))
14243        throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "
14244            + this.allowed.getClass().getName() + " was encountered");
14245      return (UnsignedIntType) this.allowed;
14246    }
14247
14248    public boolean hasAllowedUnsignedIntType() {
14249      return this != null && this.allowed instanceof UnsignedIntType;
14250    }
14251
14252    /**
14253     * @return {@link #allowed} (The quantity of the benefit which is permitted
14254     *         under the coverage.)
14255     */
14256    public StringType getAllowedStringType() throws FHIRException {
14257      if (this.allowed == null)
14258        this.allowed = new StringType();
14259      if (!(this.allowed instanceof StringType))
14260        throw new FHIRException("Type mismatch: the type StringType was expected, but "
14261            + this.allowed.getClass().getName() + " was encountered");
14262      return (StringType) this.allowed;
14263    }
14264
14265    public boolean hasAllowedStringType() {
14266      return this != null && this.allowed instanceof StringType;
14267    }
14268
14269    /**
14270     * @return {@link #allowed} (The quantity of the benefit which is permitted
14271     *         under the coverage.)
14272     */
14273    public Money getAllowedMoney() throws FHIRException {
14274      if (this.allowed == null)
14275        this.allowed = new Money();
14276      if (!(this.allowed instanceof Money))
14277        throw new FHIRException("Type mismatch: the type Money was expected, but " + this.allowed.getClass().getName()
14278            + " was encountered");
14279      return (Money) this.allowed;
14280    }
14281
14282    public boolean hasAllowedMoney() {
14283      return this != null && this.allowed instanceof Money;
14284    }
14285
14286    public boolean hasAllowed() {
14287      return this.allowed != null && !this.allowed.isEmpty();
14288    }
14289
14290    /**
14291     * @param value {@link #allowed} (The quantity of the benefit which is permitted
14292     *              under the coverage.)
14293     */
14294    public BenefitComponent setAllowed(Type value) {
14295      if (value != null && !(value instanceof UnsignedIntType || value instanceof StringType || value instanceof Money))
14296        throw new Error(
14297            "Not the right type for ExplanationOfBenefit.benefitBalance.financial.allowed[x]: " + value.fhirType());
14298      this.allowed = value;
14299      return this;
14300    }
14301
14302    /**
14303     * @return {@link #used} (The quantity of the benefit which have been consumed
14304     *         to date.)
14305     */
14306    public Type getUsed() {
14307      return this.used;
14308    }
14309
14310    /**
14311     * @return {@link #used} (The quantity of the benefit which have been consumed
14312     *         to date.)
14313     */
14314    public UnsignedIntType getUsedUnsignedIntType() throws FHIRException {
14315      if (this.used == null)
14316        this.used = new UnsignedIntType();
14317      if (!(this.used instanceof UnsignedIntType))
14318        throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "
14319            + this.used.getClass().getName() + " was encountered");
14320      return (UnsignedIntType) this.used;
14321    }
14322
14323    public boolean hasUsedUnsignedIntType() {
14324      return this != null && this.used instanceof UnsignedIntType;
14325    }
14326
14327    /**
14328     * @return {@link #used} (The quantity of the benefit which have been consumed
14329     *         to date.)
14330     */
14331    public Money getUsedMoney() throws FHIRException {
14332      if (this.used == null)
14333        this.used = new Money();
14334      if (!(this.used instanceof Money))
14335        throw new FHIRException(
14336            "Type mismatch: the type Money was expected, but " + this.used.getClass().getName() + " was encountered");
14337      return (Money) this.used;
14338    }
14339
14340    public boolean hasUsedMoney() {
14341      return this != null && this.used instanceof Money;
14342    }
14343
14344    public boolean hasUsed() {
14345      return this.used != null && !this.used.isEmpty();
14346    }
14347
14348    /**
14349     * @param value {@link #used} (The quantity of the benefit which have been
14350     *              consumed to date.)
14351     */
14352    public BenefitComponent setUsed(Type value) {
14353      if (value != null && !(value instanceof UnsignedIntType || value instanceof Money))
14354        throw new Error(
14355            "Not the right type for ExplanationOfBenefit.benefitBalance.financial.used[x]: " + value.fhirType());
14356      this.used = value;
14357      return this;
14358    }
14359
14360    protected void listChildren(List<Property> children) {
14361      super.listChildren(children);
14362      children.add(new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type));
14363      children.add(new Property("allowed[x]", "unsignedInt|string|Money",
14364          "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed));
14365      children.add(new Property("used[x]", "unsignedInt|Money",
14366          "The quantity of the benefit which have been consumed to date.", 0, 1, used));
14367    }
14368
14369    @Override
14370    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
14371      switch (_hash) {
14372      case 3575610:
14373        /* type */ return new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1,
14374            type);
14375      case -1336663592:
14376        /* allowed[x] */ return new Property("allowed[x]", "unsignedInt|string|Money",
14377            "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
14378      case -911343192:
14379        /* allowed */ return new Property("allowed[x]", "unsignedInt|string|Money",
14380            "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
14381      case 1668802034:
14382        /* allowedUnsignedInt */ return new Property("allowed[x]", "unsignedInt|string|Money",
14383            "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
14384      case -2135265319:
14385        /* allowedString */ return new Property("allowed[x]", "unsignedInt|string|Money",
14386            "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
14387      case -351668232:
14388        /* allowedMoney */ return new Property("allowed[x]", "unsignedInt|string|Money",
14389            "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
14390      case -147553373:
14391        /* used[x] */ return new Property("used[x]", "unsignedInt|Money",
14392            "The quantity of the benefit which have been consumed to date.", 0, 1, used);
14393      case 3599293:
14394        /* used */ return new Property("used[x]", "unsignedInt|Money",
14395            "The quantity of the benefit which have been consumed to date.", 0, 1, used);
14396      case 1252740285:
14397        /* usedUnsignedInt */ return new Property("used[x]", "unsignedInt|Money",
14398            "The quantity of the benefit which have been consumed to date.", 0, 1, used);
14399      case -78048509:
14400        /* usedMoney */ return new Property("used[x]", "unsignedInt|Money",
14401            "The quantity of the benefit which have been consumed to date.", 0, 1, used);
14402      default:
14403        return super.getNamedProperty(_hash, _name, _checkValid);
14404      }
14405
14406    }
14407
14408    @Override
14409    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
14410      switch (hash) {
14411      case 3575610:
14412        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
14413      case -911343192:
14414        /* allowed */ return this.allowed == null ? new Base[0] : new Base[] { this.allowed }; // Type
14415      case 3599293:
14416        /* used */ return this.used == null ? new Base[0] : new Base[] { this.used }; // Type
14417      default:
14418        return super.getProperty(hash, name, checkValid);
14419      }
14420
14421    }
14422
14423    @Override
14424    public Base setProperty(int hash, String name, Base value) throws FHIRException {
14425      switch (hash) {
14426      case 3575610: // type
14427        this.type = castToCodeableConcept(value); // CodeableConcept
14428        return value;
14429      case -911343192: // allowed
14430        this.allowed = castToType(value); // Type
14431        return value;
14432      case 3599293: // used
14433        this.used = castToType(value); // Type
14434        return value;
14435      default:
14436        return super.setProperty(hash, name, value);
14437      }
14438
14439    }
14440
14441    @Override
14442    public Base setProperty(String name, Base value) throws FHIRException {
14443      if (name.equals("type")) {
14444        this.type = castToCodeableConcept(value); // CodeableConcept
14445      } else if (name.equals("allowed[x]")) {
14446        this.allowed = castToType(value); // Type
14447      } else if (name.equals("used[x]")) {
14448        this.used = castToType(value); // Type
14449      } else
14450        return super.setProperty(name, value);
14451      return value;
14452    }
14453
14454    @Override
14455    public Base makeProperty(int hash, String name) throws FHIRException {
14456      switch (hash) {
14457      case 3575610:
14458        return getType();
14459      case -1336663592:
14460        return getAllowed();
14461      case -911343192:
14462        return getAllowed();
14463      case -147553373:
14464        return getUsed();
14465      case 3599293:
14466        return getUsed();
14467      default:
14468        return super.makeProperty(hash, name);
14469      }
14470
14471    }
14472
14473    @Override
14474    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
14475      switch (hash) {
14476      case 3575610:
14477        /* type */ return new String[] { "CodeableConcept" };
14478      case -911343192:
14479        /* allowed */ return new String[] { "unsignedInt", "string", "Money" };
14480      case 3599293:
14481        /* used */ return new String[] { "unsignedInt", "Money" };
14482      default:
14483        return super.getTypesForProperty(hash, name);
14484      }
14485
14486    }
14487
14488    @Override
14489    public Base addChild(String name) throws FHIRException {
14490      if (name.equals("type")) {
14491        this.type = new CodeableConcept();
14492        return this.type;
14493      } else if (name.equals("allowedUnsignedInt")) {
14494        this.allowed = new UnsignedIntType();
14495        return this.allowed;
14496      } else if (name.equals("allowedString")) {
14497        this.allowed = new StringType();
14498        return this.allowed;
14499      } else if (name.equals("allowedMoney")) {
14500        this.allowed = new Money();
14501        return this.allowed;
14502      } else if (name.equals("usedUnsignedInt")) {
14503        this.used = new UnsignedIntType();
14504        return this.used;
14505      } else if (name.equals("usedMoney")) {
14506        this.used = new Money();
14507        return this.used;
14508      } else
14509        return super.addChild(name);
14510    }
14511
14512    public BenefitComponent copy() {
14513      BenefitComponent dst = new BenefitComponent();
14514      copyValues(dst);
14515      return dst;
14516    }
14517
14518    public void copyValues(BenefitComponent dst) {
14519      super.copyValues(dst);
14520      dst.type = type == null ? null : type.copy();
14521      dst.allowed = allowed == null ? null : allowed.copy();
14522      dst.used = used == null ? null : used.copy();
14523    }
14524
14525    @Override
14526    public boolean equalsDeep(Base other_) {
14527      if (!super.equalsDeep(other_))
14528        return false;
14529      if (!(other_ instanceof BenefitComponent))
14530        return false;
14531      BenefitComponent o = (BenefitComponent) other_;
14532      return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true)
14533          && compareDeep(used, o.used, true);
14534    }
14535
14536    @Override
14537    public boolean equalsShallow(Base other_) {
14538      if (!super.equalsShallow(other_))
14539        return false;
14540      if (!(other_ instanceof BenefitComponent))
14541        return false;
14542      BenefitComponent o = (BenefitComponent) other_;
14543      return true;
14544    }
14545
14546    public boolean isEmpty() {
14547      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed, used);
14548    }
14549
14550    public String fhirType() {
14551      return "ExplanationOfBenefit.benefitBalance.financial";
14552
14553    }
14554
14555  }
14556
14557  /**
14558   * A unique identifier assigned to this explanation of benefit.
14559   */
14560  @Child(name = "identifier", type = {
14561      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
14562  @Description(shortDefinition = "Business Identifier for the resource", formalDefinition = "A unique identifier assigned to this explanation of benefit.")
14563  protected List<Identifier> identifier;
14564
14565  /**
14566   * The status of the resource instance.
14567   */
14568  @Child(name = "status", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = true, summary = true)
14569  @Description(shortDefinition = "active | cancelled | draft | entered-in-error", formalDefinition = "The status of the resource instance.")
14570  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/explanationofbenefit-status")
14571  protected Enumeration<ExplanationOfBenefitStatus> status;
14572
14573  /**
14574   * The category of claim, e.g. oral, pharmacy, vision, institutional,
14575   * professional.
14576   */
14577  @Child(name = "type", type = { CodeableConcept.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
14578  @Description(shortDefinition = "Category or discipline", formalDefinition = "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.")
14579  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-type")
14580  protected CodeableConcept type;
14581
14582  /**
14583   * A finer grained suite of claim type codes which may convey additional
14584   * information such as Inpatient vs Outpatient and/or a specialty service.
14585   */
14586  @Child(name = "subType", type = {
14587      CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
14588  @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.")
14589  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-subtype")
14590  protected CodeableConcept subType;
14591
14592  /**
14593   * A code to indicate whether the nature of the request is: to request
14594   * adjudication of products and services previously rendered; or requesting
14595   * authorization and adjudication for provision in the future; or requesting the
14596   * non-binding adjudication of the listed products and services which could be
14597   * provided in the future.
14598   */
14599  @Child(name = "use", type = { CodeType.class }, order = 4, min = 1, max = 1, modifier = false, summary = true)
14600  @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.")
14601  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-use")
14602  protected Enumeration<Use> use;
14603
14604  /**
14605   * The party to whom the professional services and/or products have been
14606   * supplied or are being considered and for whom actual for forecast
14607   * reimbursement is sought.
14608   */
14609  @Child(name = "patient", type = { Patient.class }, order = 5, min = 1, max = 1, modifier = false, summary = true)
14610  @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.")
14611  protected Reference patient;
14612
14613  /**
14614   * The actual object that is the target of the reference (The party to whom the
14615   * professional services and/or products have been supplied or are being
14616   * considered and for whom actual for forecast reimbursement is sought.)
14617   */
14618  protected Patient patientTarget;
14619
14620  /**
14621   * The period for which charges are being submitted.
14622   */
14623  @Child(name = "billablePeriod", type = {
14624      Period.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
14625  @Description(shortDefinition = "Relevant time frame for the claim", formalDefinition = "The period for which charges are being submitted.")
14626  protected Period billablePeriod;
14627
14628  /**
14629   * The date this resource was created.
14630   */
14631  @Child(name = "created", type = { DateTimeType.class }, order = 7, min = 1, max = 1, modifier = false, summary = true)
14632  @Description(shortDefinition = "Response creation date", formalDefinition = "The date this resource was created.")
14633  protected DateTimeType created;
14634
14635  /**
14636   * Individual who created the claim, predetermination or preauthorization.
14637   */
14638  @Child(name = "enterer", type = { Practitioner.class,
14639      PractitionerRole.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
14640  @Description(shortDefinition = "Author of the claim", formalDefinition = "Individual who created the claim, predetermination or preauthorization.")
14641  protected Reference enterer;
14642
14643  /**
14644   * The actual object that is the target of the reference (Individual who created
14645   * the claim, predetermination or preauthorization.)
14646   */
14647  protected Resource entererTarget;
14648
14649  /**
14650   * The party responsible for authorization, adjudication and reimbursement.
14651   */
14652  @Child(name = "insurer", type = { Organization.class }, order = 9, min = 1, max = 1, modifier = false, summary = true)
14653  @Description(shortDefinition = "Party responsible for reimbursement", formalDefinition = "The party responsible for authorization, adjudication and reimbursement.")
14654  protected Reference insurer;
14655
14656  /**
14657   * The actual object that is the target of the reference (The party responsible
14658   * for authorization, adjudication and reimbursement.)
14659   */
14660  protected Organization insurerTarget;
14661
14662  /**
14663   * The provider which is responsible for the claim, predetermination or
14664   * preauthorization.
14665   */
14666  @Child(name = "provider", type = { Practitioner.class, PractitionerRole.class,
14667      Organization.class }, order = 10, min = 1, max = 1, modifier = false, summary = true)
14668  @Description(shortDefinition = "Party responsible for the claim", formalDefinition = "The provider which is responsible for the claim, predetermination or preauthorization.")
14669  protected Reference provider;
14670
14671  /**
14672   * The actual object that is the target of the reference (The provider which is
14673   * responsible for the claim, predetermination or preauthorization.)
14674   */
14675  protected Resource providerTarget;
14676
14677  /**
14678   * The provider-required urgency of processing the request. Typical values
14679   * include: stat, routine deferred.
14680   */
14681  @Child(name = "priority", type = {
14682      CodeableConcept.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
14683  @Description(shortDefinition = "Desired processing urgency", formalDefinition = "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.")
14684  protected CodeableConcept priority;
14685
14686  /**
14687   * A code to indicate whether and for whom funds are to be reserved for future
14688   * claims.
14689   */
14690  @Child(name = "fundsReserveRequested", type = {
14691      CodeableConcept.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
14692  @Description(shortDefinition = "For whom to reserve funds", formalDefinition = "A code to indicate whether and for whom funds are to be reserved for future claims.")
14693  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/fundsreserve")
14694  protected CodeableConcept fundsReserveRequested;
14695
14696  /**
14697   * A code, used only on a response to a preauthorization, to indicate whether
14698   * the benefits payable have been reserved and for whom.
14699   */
14700  @Child(name = "fundsReserve", type = {
14701      CodeableConcept.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
14702  @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.")
14703  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/fundsreserve")
14704  protected CodeableConcept fundsReserve;
14705
14706  /**
14707   * Other claims which are related to this claim such as prior submissions or
14708   * claims for related services or for the same event.
14709   */
14710  @Child(name = "related", type = {}, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
14711  @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.")
14712  protected List<RelatedClaimComponent> related;
14713
14714  /**
14715   * Prescription to support the dispensing of pharmacy, device or vision
14716   * products.
14717   */
14718  @Child(name = "prescription", type = { MedicationRequest.class,
14719      VisionPrescription.class }, order = 15, min = 0, max = 1, modifier = false, summary = false)
14720  @Description(shortDefinition = "Prescription authorizing services or products", formalDefinition = "Prescription to support the dispensing of pharmacy, device or vision products.")
14721  protected Reference prescription;
14722
14723  /**
14724   * The actual object that is the target of the reference (Prescription to
14725   * support the dispensing of pharmacy, device or vision products.)
14726   */
14727  protected Resource prescriptionTarget;
14728
14729  /**
14730   * Original prescription which has been superseded by this prescription to
14731   * support the dispensing of pharmacy services, medications or products.
14732   */
14733  @Child(name = "originalPrescription", type = {
14734      MedicationRequest.class }, order = 16, min = 0, max = 1, modifier = false, summary = false)
14735  @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.")
14736  protected Reference originalPrescription;
14737
14738  /**
14739   * The actual object that is the target of the reference (Original prescription
14740   * which has been superseded by this prescription to support the dispensing of
14741   * pharmacy services, medications or products.)
14742   */
14743  protected MedicationRequest originalPrescriptionTarget;
14744
14745  /**
14746   * The party to be reimbursed for cost of the products and services according to
14747   * the terms of the policy.
14748   */
14749  @Child(name = "payee", type = {}, order = 17, min = 0, max = 1, modifier = false, summary = false)
14750  @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.")
14751  protected PayeeComponent payee;
14752
14753  /**
14754   * A reference to a referral resource.
14755   */
14756  @Child(name = "referral", type = {
14757      ServiceRequest.class }, order = 18, min = 0, max = 1, modifier = false, summary = false)
14758  @Description(shortDefinition = "Treatment Referral", formalDefinition = "A reference to a referral resource.")
14759  protected Reference referral;
14760
14761  /**
14762   * The actual object that is the target of the reference (A reference to a
14763   * referral resource.)
14764   */
14765  protected ServiceRequest referralTarget;
14766
14767  /**
14768   * Facility where the services were provided.
14769   */
14770  @Child(name = "facility", type = { Location.class }, order = 19, min = 0, max = 1, modifier = false, summary = false)
14771  @Description(shortDefinition = "Servicing Facility", formalDefinition = "Facility where the services were provided.")
14772  protected Reference facility;
14773
14774  /**
14775   * The actual object that is the target of the reference (Facility where the
14776   * services were provided.)
14777   */
14778  protected Location facilityTarget;
14779
14780  /**
14781   * The business identifier for the instance of the adjudication request: claim
14782   * predetermination or preauthorization.
14783   */
14784  @Child(name = "claim", type = { Claim.class }, order = 20, min = 0, max = 1, modifier = false, summary = false)
14785  @Description(shortDefinition = "Claim reference", formalDefinition = "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.")
14786  protected Reference claim;
14787
14788  /**
14789   * The actual object that is the target of the reference (The business
14790   * identifier for the instance of the adjudication request: claim
14791   * predetermination or preauthorization.)
14792   */
14793  protected Claim claimTarget;
14794
14795  /**
14796   * The business identifier for the instance of the adjudication response: claim,
14797   * predetermination or preauthorization response.
14798   */
14799  @Child(name = "claimResponse", type = {
14800      ClaimResponse.class }, order = 21, min = 0, max = 1, modifier = false, summary = false)
14801  @Description(shortDefinition = "Claim response reference", formalDefinition = "The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.")
14802  protected Reference claimResponse;
14803
14804  /**
14805   * The actual object that is the target of the reference (The business
14806   * identifier for the instance of the adjudication response: claim,
14807   * predetermination or preauthorization response.)
14808   */
14809  protected ClaimResponse claimResponseTarget;
14810
14811  /**
14812   * The outcome of the claim, predetermination, or preauthorization processing.
14813   */
14814  @Child(name = "outcome", type = { CodeType.class }, order = 22, min = 1, max = 1, modifier = false, summary = true)
14815  @Description(shortDefinition = "queued | complete | error | partial", formalDefinition = "The outcome of the claim, predetermination, or preauthorization processing.")
14816  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/remittance-outcome")
14817  protected Enumeration<RemittanceOutcome> outcome;
14818
14819  /**
14820   * A human readable description of the status of the adjudication.
14821   */
14822  @Child(name = "disposition", type = {
14823      StringType.class }, order = 23, min = 0, max = 1, modifier = false, summary = false)
14824  @Description(shortDefinition = "Disposition Message", formalDefinition = "A human readable description of the status of the adjudication.")
14825  protected StringType disposition;
14826
14827  /**
14828   * Reference from the Insurer which is used in later communications which refers
14829   * to this adjudication.
14830   */
14831  @Child(name = "preAuthRef", type = {
14832      StringType.class }, order = 24, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
14833  @Description(shortDefinition = "Preauthorization reference", formalDefinition = "Reference from the Insurer which is used in later communications which refers to this adjudication.")
14834  protected List<StringType> preAuthRef;
14835
14836  /**
14837   * The timeframe during which the supplied preauthorization reference may be
14838   * quoted on claims to obtain the adjudication as provided.
14839   */
14840  @Child(name = "preAuthRefPeriod", type = {
14841      Period.class }, order = 25, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
14842  @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.")
14843  protected List<Period> preAuthRefPeriod;
14844
14845  /**
14846   * The members of the team who provided the products and services.
14847   */
14848  @Child(name = "careTeam", type = {}, order = 26, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
14849  @Description(shortDefinition = "Care Team members", formalDefinition = "The members of the team who provided the products and services.")
14850  protected List<CareTeamComponent> careTeam;
14851
14852  /**
14853   * Additional information codes regarding exceptions, special considerations,
14854   * the condition, situation, prior or concurrent issues.
14855   */
14856  @Child(name = "supportingInfo", type = {}, order = 27, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
14857  @Description(shortDefinition = "Supporting information", formalDefinition = "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.")
14858  protected List<SupportingInformationComponent> supportingInfo;
14859
14860  /**
14861   * Information about diagnoses relevant to the claim items.
14862   */
14863  @Child(name = "diagnosis", type = {}, order = 28, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
14864  @Description(shortDefinition = "Pertinent diagnosis information", formalDefinition = "Information about diagnoses relevant to the claim items.")
14865  protected List<DiagnosisComponent> diagnosis;
14866
14867  /**
14868   * Procedures performed on the patient relevant to the billing items with the
14869   * claim.
14870   */
14871  @Child(name = "procedure", type = {}, order = 29, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
14872  @Description(shortDefinition = "Clinical procedures performed", formalDefinition = "Procedures performed on the patient relevant to the billing items with the claim.")
14873  protected List<ProcedureComponent> procedure;
14874
14875  /**
14876   * This indicates the relative order of a series of EOBs related to different
14877   * coverages for the same suite of services.
14878   */
14879  @Child(name = "precedence", type = {
14880      PositiveIntType.class }, order = 30, min = 0, max = 1, modifier = false, summary = false)
14881  @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.")
14882  protected PositiveIntType precedence;
14883
14884  /**
14885   * Financial instruments for reimbursement for the health care products and
14886   * services specified on the claim.
14887   */
14888  @Child(name = "insurance", type = {}, order = 31, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
14889  @Description(shortDefinition = "Patient insurance information", formalDefinition = "Financial instruments for reimbursement for the health care products and services specified on the claim.")
14890  protected List<InsuranceComponent> insurance;
14891
14892  /**
14893   * Details of a accident which resulted in injuries which required the products
14894   * and services listed in the claim.
14895   */
14896  @Child(name = "accident", type = {}, order = 32, min = 0, max = 1, modifier = false, summary = false)
14897  @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.")
14898  protected AccidentComponent accident;
14899
14900  /**
14901   * A claim line. Either a simple (a product or service) or a 'group' of details
14902   * which can also be a simple items or groups of sub-details.
14903   */
14904  @Child(name = "item", type = {}, order = 33, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
14905  @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.")
14906  protected List<ItemComponent> item;
14907
14908  /**
14909   * The first-tier service adjudications for payor added product or service
14910   * lines.
14911   */
14912  @Child(name = "addItem", type = {}, order = 34, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
14913  @Description(shortDefinition = "Insurer added line items", formalDefinition = "The first-tier service adjudications for payor added product or service lines.")
14914  protected List<AddedItemComponent> addItem;
14915
14916  /**
14917   * The adjudication results which are presented at the header level rather than
14918   * at the line-item or add-item levels.
14919   */
14920  @Child(name = "adjudication", type = {
14921      AdjudicationComponent.class }, order = 35, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
14922  @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.")
14923  protected List<AdjudicationComponent> adjudication;
14924
14925  /**
14926   * Categorized monetary totals for the adjudication.
14927   */
14928  @Child(name = "total", type = {}, order = 36, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
14929  @Description(shortDefinition = "Adjudication totals", formalDefinition = "Categorized monetary totals for the adjudication.")
14930  protected List<TotalComponent> total;
14931
14932  /**
14933   * Payment details for the adjudication of the claim.
14934   */
14935  @Child(name = "payment", type = {}, order = 37, min = 0, max = 1, modifier = false, summary = false)
14936  @Description(shortDefinition = "Payment Details", formalDefinition = "Payment details for the adjudication of the claim.")
14937  protected PaymentComponent payment;
14938
14939  /**
14940   * A code for the form to be used for printing the content.
14941   */
14942  @Child(name = "formCode", type = {
14943      CodeableConcept.class }, order = 38, min = 0, max = 1, modifier = false, summary = false)
14944  @Description(shortDefinition = "Printed form identifier", formalDefinition = "A code for the form to be used for printing the content.")
14945  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/forms")
14946  protected CodeableConcept formCode;
14947
14948  /**
14949   * The actual form, by reference or inclusion, for printing the content or an
14950   * EOB.
14951   */
14952  @Child(name = "form", type = { Attachment.class }, order = 39, min = 0, max = 1, modifier = false, summary = false)
14953  @Description(shortDefinition = "Printed reference or actual form", formalDefinition = "The actual form, by reference or inclusion, for printing the content or an EOB.")
14954  protected Attachment form;
14955
14956  /**
14957   * A note that describes or explains adjudication results in a human readable
14958   * form.
14959   */
14960  @Child(name = "processNote", type = {}, order = 40, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
14961  @Description(shortDefinition = "Note concerning adjudication", formalDefinition = "A note that describes or explains adjudication results in a human readable form.")
14962  protected List<NoteComponent> processNote;
14963
14964  /**
14965   * The term of the benefits documented in this response.
14966   */
14967  @Child(name = "benefitPeriod", type = {
14968      Period.class }, order = 41, min = 0, max = 1, modifier = false, summary = false)
14969  @Description(shortDefinition = "When the benefits are applicable", formalDefinition = "The term of the benefits documented in this response.")
14970  protected Period benefitPeriod;
14971
14972  /**
14973   * Balance by Benefit Category.
14974   */
14975  @Child(name = "benefitBalance", type = {}, order = 42, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
14976  @Description(shortDefinition = "Balance by Benefit Category", formalDefinition = "Balance by Benefit Category.")
14977  protected List<BenefitBalanceComponent> benefitBalance;
14978
14979  private static final long serialVersionUID = -1515422099L;
14980
14981  /**
14982   * Constructor
14983   */
14984  public ExplanationOfBenefit() {
14985    super();
14986  }
14987
14988  /**
14989   * Constructor
14990   */
14991  public ExplanationOfBenefit(Enumeration<ExplanationOfBenefitStatus> status, CodeableConcept type,
14992      Enumeration<Use> use, Reference patient, DateTimeType created, Reference insurer, Reference provider,
14993      Enumeration<RemittanceOutcome> outcome) {
14994    super();
14995    this.status = status;
14996    this.type = type;
14997    this.use = use;
14998    this.patient = patient;
14999    this.created = created;
15000    this.insurer = insurer;
15001    this.provider = provider;
15002    this.outcome = outcome;
15003  }
15004
15005  /**
15006   * @return {@link #identifier} (A unique identifier assigned to this explanation
15007   *         of benefit.)
15008   */
15009  public List<Identifier> getIdentifier() {
15010    if (this.identifier == null)
15011      this.identifier = new ArrayList<Identifier>();
15012    return this.identifier;
15013  }
15014
15015  /**
15016   * @return Returns a reference to <code>this</code> for easy method chaining
15017   */
15018  public ExplanationOfBenefit setIdentifier(List<Identifier> theIdentifier) {
15019    this.identifier = theIdentifier;
15020    return this;
15021  }
15022
15023  public boolean hasIdentifier() {
15024    if (this.identifier == null)
15025      return false;
15026    for (Identifier item : this.identifier)
15027      if (!item.isEmpty())
15028        return true;
15029    return false;
15030  }
15031
15032  public Identifier addIdentifier() { // 3
15033    Identifier t = new Identifier();
15034    if (this.identifier == null)
15035      this.identifier = new ArrayList<Identifier>();
15036    this.identifier.add(t);
15037    return t;
15038  }
15039
15040  public ExplanationOfBenefit addIdentifier(Identifier t) { // 3
15041    if (t == null)
15042      return this;
15043    if (this.identifier == null)
15044      this.identifier = new ArrayList<Identifier>();
15045    this.identifier.add(t);
15046    return this;
15047  }
15048
15049  /**
15050   * @return The first repetition of repeating field {@link #identifier}, creating
15051   *         it if it does not already exist
15052   */
15053  public Identifier getIdentifierFirstRep() {
15054    if (getIdentifier().isEmpty()) {
15055      addIdentifier();
15056    }
15057    return getIdentifier().get(0);
15058  }
15059
15060  /**
15061   * @return {@link #status} (The status of the resource instance.). This is the
15062   *         underlying object with id, value and extensions. The accessor
15063   *         "getStatus" gives direct access to the value
15064   */
15065  public Enumeration<ExplanationOfBenefitStatus> getStatusElement() {
15066    if (this.status == null)
15067      if (Configuration.errorOnAutoCreate())
15068        throw new Error("Attempt to auto-create ExplanationOfBenefit.status");
15069      else if (Configuration.doAutoCreate())
15070        this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory()); // bb
15071    return this.status;
15072  }
15073
15074  public boolean hasStatusElement() {
15075    return this.status != null && !this.status.isEmpty();
15076  }
15077
15078  public boolean hasStatus() {
15079    return this.status != null && !this.status.isEmpty();
15080  }
15081
15082  /**
15083   * @param value {@link #status} (The status of the resource instance.). This is
15084   *              the underlying object with id, value and extensions. The
15085   *              accessor "getStatus" gives direct access to the value
15086   */
15087  public ExplanationOfBenefit setStatusElement(Enumeration<ExplanationOfBenefitStatus> value) {
15088    this.status = value;
15089    return this;
15090  }
15091
15092  /**
15093   * @return The status of the resource instance.
15094   */
15095  public ExplanationOfBenefitStatus getStatus() {
15096    return this.status == null ? null : this.status.getValue();
15097  }
15098
15099  /**
15100   * @param value The status of the resource instance.
15101   */
15102  public ExplanationOfBenefit setStatus(ExplanationOfBenefitStatus value) {
15103    if (this.status == null)
15104      this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory());
15105    this.status.setValue(value);
15106    return this;
15107  }
15108
15109  /**
15110   * @return {@link #type} (The category of claim, e.g. oral, pharmacy, vision,
15111   *         institutional, professional.)
15112   */
15113  public CodeableConcept getType() {
15114    if (this.type == null)
15115      if (Configuration.errorOnAutoCreate())
15116        throw new Error("Attempt to auto-create ExplanationOfBenefit.type");
15117      else if (Configuration.doAutoCreate())
15118        this.type = new CodeableConcept(); // cc
15119    return this.type;
15120  }
15121
15122  public boolean hasType() {
15123    return this.type != null && !this.type.isEmpty();
15124  }
15125
15126  /**
15127   * @param value {@link #type} (The category of claim, e.g. oral, pharmacy,
15128   *              vision, institutional, professional.)
15129   */
15130  public ExplanationOfBenefit setType(CodeableConcept value) {
15131    this.type = value;
15132    return this;
15133  }
15134
15135  /**
15136   * @return {@link #subType} (A finer grained suite of claim type codes which may
15137   *         convey additional information such as Inpatient vs Outpatient and/or
15138   *         a specialty service.)
15139   */
15140  public CodeableConcept getSubType() {
15141    if (this.subType == null)
15142      if (Configuration.errorOnAutoCreate())
15143        throw new Error("Attempt to auto-create ExplanationOfBenefit.subType");
15144      else if (Configuration.doAutoCreate())
15145        this.subType = new CodeableConcept(); // cc
15146    return this.subType;
15147  }
15148
15149  public boolean hasSubType() {
15150    return this.subType != null && !this.subType.isEmpty();
15151  }
15152
15153  /**
15154   * @param value {@link #subType} (A finer grained suite of claim type codes
15155   *              which may convey additional information such as Inpatient vs
15156   *              Outpatient and/or a specialty service.)
15157   */
15158  public ExplanationOfBenefit setSubType(CodeableConcept value) {
15159    this.subType = value;
15160    return this;
15161  }
15162
15163  /**
15164   * @return {@link #use} (A code to indicate whether the nature of the request
15165   *         is: to request adjudication of products and services previously
15166   *         rendered; or requesting authorization and adjudication for provision
15167   *         in the future; or requesting the non-binding adjudication of the
15168   *         listed products and services which could be provided in the future.).
15169   *         This is the underlying object with id, value and extensions. The
15170   *         accessor "getUse" gives direct access to the value
15171   */
15172  public Enumeration<Use> getUseElement() {
15173    if (this.use == null)
15174      if (Configuration.errorOnAutoCreate())
15175        throw new Error("Attempt to auto-create ExplanationOfBenefit.use");
15176      else if (Configuration.doAutoCreate())
15177        this.use = new Enumeration<Use>(new UseEnumFactory()); // bb
15178    return this.use;
15179  }
15180
15181  public boolean hasUseElement() {
15182    return this.use != null && !this.use.isEmpty();
15183  }
15184
15185  public boolean hasUse() {
15186    return this.use != null && !this.use.isEmpty();
15187  }
15188
15189  /**
15190   * @param value {@link #use} (A code to indicate whether the nature of the
15191   *              request is: to request adjudication of products and services
15192   *              previously rendered; or requesting authorization and
15193   *              adjudication for provision in the future; or requesting the
15194   *              non-binding adjudication of the listed products and services
15195   *              which could be provided in the future.). This is the underlying
15196   *              object with id, value and extensions. The accessor "getUse"
15197   *              gives direct access to the value
15198   */
15199  public ExplanationOfBenefit setUseElement(Enumeration<Use> value) {
15200    this.use = value;
15201    return this;
15202  }
15203
15204  /**
15205   * @return A code to indicate whether the nature of the request is: to request
15206   *         adjudication of products and services previously rendered; or
15207   *         requesting authorization and adjudication for provision in the
15208   *         future; or requesting the non-binding adjudication of the listed
15209   *         products and services which could be provided in the future.
15210   */
15211  public Use getUse() {
15212    return this.use == null ? null : this.use.getValue();
15213  }
15214
15215  /**
15216   * @param value A code to indicate whether the nature of the request is: to
15217   *              request adjudication of products and services previously
15218   *              rendered; or requesting authorization and adjudication for
15219   *              provision in the future; or requesting the non-binding
15220   *              adjudication of the listed products and services which could be
15221   *              provided in the future.
15222   */
15223  public ExplanationOfBenefit setUse(Use value) {
15224    if (this.use == null)
15225      this.use = new Enumeration<Use>(new UseEnumFactory());
15226    this.use.setValue(value);
15227    return this;
15228  }
15229
15230  /**
15231   * @return {@link #patient} (The party to whom the professional services and/or
15232   *         products have been supplied or are being considered and for whom
15233   *         actual for forecast reimbursement is sought.)
15234   */
15235  public Reference getPatient() {
15236    if (this.patient == null)
15237      if (Configuration.errorOnAutoCreate())
15238        throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
15239      else if (Configuration.doAutoCreate())
15240        this.patient = new Reference(); // cc
15241    return this.patient;
15242  }
15243
15244  public boolean hasPatient() {
15245    return this.patient != null && !this.patient.isEmpty();
15246  }
15247
15248  /**
15249   * @param value {@link #patient} (The party to whom the professional services
15250   *              and/or products have been supplied or are being considered and
15251   *              for whom actual for forecast reimbursement is sought.)
15252   */
15253  public ExplanationOfBenefit setPatient(Reference value) {
15254    this.patient = value;
15255    return this;
15256  }
15257
15258  /**
15259   * @return {@link #patient} The actual object that is the target of the
15260   *         reference. The reference library doesn't populate this, but you can
15261   *         use it to hold the resource if you resolve it. (The party to whom the
15262   *         professional services and/or products have been supplied or are being
15263   *         considered and for whom actual for forecast reimbursement is sought.)
15264   */
15265  public Patient getPatientTarget() {
15266    if (this.patientTarget == null)
15267      if (Configuration.errorOnAutoCreate())
15268        throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
15269      else if (Configuration.doAutoCreate())
15270        this.patientTarget = new Patient(); // aa
15271    return this.patientTarget;
15272  }
15273
15274  /**
15275   * @param value {@link #patient} The actual object that is the target of the
15276   *              reference. The reference library doesn't use these, but you can
15277   *              use it to hold the resource if you resolve it. (The party to
15278   *              whom the professional services and/or products have been
15279   *              supplied or are being considered and for whom actual for
15280   *              forecast reimbursement is sought.)
15281   */
15282  public ExplanationOfBenefit setPatientTarget(Patient value) {
15283    this.patientTarget = value;
15284    return this;
15285  }
15286
15287  /**
15288   * @return {@link #billablePeriod} (The period for which charges are being
15289   *         submitted.)
15290   */
15291  public Period getBillablePeriod() {
15292    if (this.billablePeriod == null)
15293      if (Configuration.errorOnAutoCreate())
15294        throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
15295      else if (Configuration.doAutoCreate())
15296        this.billablePeriod = new Period(); // cc
15297    return this.billablePeriod;
15298  }
15299
15300  public boolean hasBillablePeriod() {
15301    return this.billablePeriod != null && !this.billablePeriod.isEmpty();
15302  }
15303
15304  /**
15305   * @param value {@link #billablePeriod} (The period for which charges are being
15306   *              submitted.)
15307   */
15308  public ExplanationOfBenefit setBillablePeriod(Period value) {
15309    this.billablePeriod = value;
15310    return this;
15311  }
15312
15313  /**
15314   * @return {@link #created} (The date this resource was created.). This is the
15315   *         underlying object with id, value and extensions. The accessor
15316   *         "getCreated" gives direct access to the value
15317   */
15318  public DateTimeType getCreatedElement() {
15319    if (this.created == null)
15320      if (Configuration.errorOnAutoCreate())
15321        throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
15322      else if (Configuration.doAutoCreate())
15323        this.created = new DateTimeType(); // bb
15324    return this.created;
15325  }
15326
15327  public boolean hasCreatedElement() {
15328    return this.created != null && !this.created.isEmpty();
15329  }
15330
15331  public boolean hasCreated() {
15332    return this.created != null && !this.created.isEmpty();
15333  }
15334
15335  /**
15336   * @param value {@link #created} (The date this resource was created.). This is
15337   *              the underlying object with id, value and extensions. The
15338   *              accessor "getCreated" gives direct access to the value
15339   */
15340  public ExplanationOfBenefit setCreatedElement(DateTimeType value) {
15341    this.created = value;
15342    return this;
15343  }
15344
15345  /**
15346   * @return The date this resource was created.
15347   */
15348  public Date getCreated() {
15349    return this.created == null ? null : this.created.getValue();
15350  }
15351
15352  /**
15353   * @param value The date this resource was created.
15354   */
15355  public ExplanationOfBenefit setCreated(Date value) {
15356    if (this.created == null)
15357      this.created = new DateTimeType();
15358    this.created.setValue(value);
15359    return this;
15360  }
15361
15362  /**
15363   * @return {@link #enterer} (Individual who created the claim, predetermination
15364   *         or preauthorization.)
15365   */
15366  public Reference getEnterer() {
15367    if (this.enterer == null)
15368      if (Configuration.errorOnAutoCreate())
15369        throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
15370      else if (Configuration.doAutoCreate())
15371        this.enterer = new Reference(); // cc
15372    return this.enterer;
15373  }
15374
15375  public boolean hasEnterer() {
15376    return this.enterer != null && !this.enterer.isEmpty();
15377  }
15378
15379  /**
15380   * @param value {@link #enterer} (Individual who created the claim,
15381   *              predetermination or preauthorization.)
15382   */
15383  public ExplanationOfBenefit setEnterer(Reference value) {
15384    this.enterer = value;
15385    return this;
15386  }
15387
15388  /**
15389   * @return {@link #enterer} The actual object that is the target of the
15390   *         reference. The reference library doesn't populate this, but you can
15391   *         use it to hold the resource if you resolve it. (Individual who
15392   *         created the claim, predetermination or preauthorization.)
15393   */
15394  public Resource getEntererTarget() {
15395    return this.entererTarget;
15396  }
15397
15398  /**
15399   * @param value {@link #enterer} The actual object that is the target of the
15400   *              reference. The reference library doesn't use these, but you can
15401   *              use it to hold the resource if you resolve it. (Individual who
15402   *              created the claim, predetermination or preauthorization.)
15403   */
15404  public ExplanationOfBenefit setEntererTarget(Resource value) {
15405    this.entererTarget = value;
15406    return this;
15407  }
15408
15409  /**
15410   * @return {@link #insurer} (The party responsible for authorization,
15411   *         adjudication and reimbursement.)
15412   */
15413  public Reference getInsurer() {
15414    if (this.insurer == null)
15415      if (Configuration.errorOnAutoCreate())
15416        throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
15417      else if (Configuration.doAutoCreate())
15418        this.insurer = new Reference(); // cc
15419    return this.insurer;
15420  }
15421
15422  public boolean hasInsurer() {
15423    return this.insurer != null && !this.insurer.isEmpty();
15424  }
15425
15426  /**
15427   * @param value {@link #insurer} (The party responsible for authorization,
15428   *              adjudication and reimbursement.)
15429   */
15430  public ExplanationOfBenefit setInsurer(Reference value) {
15431    this.insurer = value;
15432    return this;
15433  }
15434
15435  /**
15436   * @return {@link #insurer} The actual object that is the target of the
15437   *         reference. The reference library doesn't populate this, but you can
15438   *         use it to hold the resource if you resolve it. (The party responsible
15439   *         for authorization, adjudication and reimbursement.)
15440   */
15441  public Organization getInsurerTarget() {
15442    if (this.insurerTarget == null)
15443      if (Configuration.errorOnAutoCreate())
15444        throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
15445      else if (Configuration.doAutoCreate())
15446        this.insurerTarget = new Organization(); // aa
15447    return this.insurerTarget;
15448  }
15449
15450  /**
15451   * @param value {@link #insurer} The actual object that is the target of the
15452   *              reference. The reference library doesn't use these, but you can
15453   *              use it to hold the resource if you resolve it. (The party
15454   *              responsible for authorization, adjudication and reimbursement.)
15455   */
15456  public ExplanationOfBenefit setInsurerTarget(Organization value) {
15457    this.insurerTarget = value;
15458    return this;
15459  }
15460
15461  /**
15462   * @return {@link #provider} (The provider which is responsible for the claim,
15463   *         predetermination or preauthorization.)
15464   */
15465  public Reference getProvider() {
15466    if (this.provider == null)
15467      if (Configuration.errorOnAutoCreate())
15468        throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
15469      else if (Configuration.doAutoCreate())
15470        this.provider = new Reference(); // cc
15471    return this.provider;
15472  }
15473
15474  public boolean hasProvider() {
15475    return this.provider != null && !this.provider.isEmpty();
15476  }
15477
15478  /**
15479   * @param value {@link #provider} (The provider which is responsible for the
15480   *              claim, predetermination or preauthorization.)
15481   */
15482  public ExplanationOfBenefit setProvider(Reference value) {
15483    this.provider = value;
15484    return this;
15485  }
15486
15487  /**
15488   * @return {@link #provider} The actual object that is the target of the
15489   *         reference. The reference library doesn't populate this, but you can
15490   *         use it to hold the resource if you resolve it. (The provider which is
15491   *         responsible for the claim, predetermination or preauthorization.)
15492   */
15493  public Resource getProviderTarget() {
15494    return this.providerTarget;
15495  }
15496
15497  /**
15498   * @param value {@link #provider} The actual object that is the target of the
15499   *              reference. The reference library doesn't use these, but you can
15500   *              use it to hold the resource if you resolve it. (The provider
15501   *              which is responsible for the claim, predetermination or
15502   *              preauthorization.)
15503   */
15504  public ExplanationOfBenefit setProviderTarget(Resource value) {
15505    this.providerTarget = value;
15506    return this;
15507  }
15508
15509  /**
15510   * @return {@link #priority} (The provider-required urgency of processing the
15511   *         request. Typical values include: stat, routine deferred.)
15512   */
15513  public CodeableConcept getPriority() {
15514    if (this.priority == null)
15515      if (Configuration.errorOnAutoCreate())
15516        throw new Error("Attempt to auto-create ExplanationOfBenefit.priority");
15517      else if (Configuration.doAutoCreate())
15518        this.priority = new CodeableConcept(); // cc
15519    return this.priority;
15520  }
15521
15522  public boolean hasPriority() {
15523    return this.priority != null && !this.priority.isEmpty();
15524  }
15525
15526  /**
15527   * @param value {@link #priority} (The provider-required urgency of processing
15528   *              the request. Typical values include: stat, routine deferred.)
15529   */
15530  public ExplanationOfBenefit setPriority(CodeableConcept value) {
15531    this.priority = value;
15532    return this;
15533  }
15534
15535  /**
15536   * @return {@link #fundsReserveRequested} (A code to indicate whether and for
15537   *         whom funds are to be reserved for future claims.)
15538   */
15539  public CodeableConcept getFundsReserveRequested() {
15540    if (this.fundsReserveRequested == null)
15541      if (Configuration.errorOnAutoCreate())
15542        throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserveRequested");
15543      else if (Configuration.doAutoCreate())
15544        this.fundsReserveRequested = new CodeableConcept(); // cc
15545    return this.fundsReserveRequested;
15546  }
15547
15548  public boolean hasFundsReserveRequested() {
15549    return this.fundsReserveRequested != null && !this.fundsReserveRequested.isEmpty();
15550  }
15551
15552  /**
15553   * @param value {@link #fundsReserveRequested} (A code to indicate whether and
15554   *              for whom funds are to be reserved for future claims.)
15555   */
15556  public ExplanationOfBenefit setFundsReserveRequested(CodeableConcept value) {
15557    this.fundsReserveRequested = value;
15558    return this;
15559  }
15560
15561  /**
15562   * @return {@link #fundsReserve} (A code, used only on a response to a
15563   *         preauthorization, to indicate whether the benefits payable have been
15564   *         reserved and for whom.)
15565   */
15566  public CodeableConcept getFundsReserve() {
15567    if (this.fundsReserve == null)
15568      if (Configuration.errorOnAutoCreate())
15569        throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserve");
15570      else if (Configuration.doAutoCreate())
15571        this.fundsReserve = new CodeableConcept(); // cc
15572    return this.fundsReserve;
15573  }
15574
15575  public boolean hasFundsReserve() {
15576    return this.fundsReserve != null && !this.fundsReserve.isEmpty();
15577  }
15578
15579  /**
15580   * @param value {@link #fundsReserve} (A code, used only on a response to a
15581   *              preauthorization, to indicate whether the benefits payable have
15582   *              been reserved and for whom.)
15583   */
15584  public ExplanationOfBenefit setFundsReserve(CodeableConcept value) {
15585    this.fundsReserve = value;
15586    return this;
15587  }
15588
15589  /**
15590   * @return {@link #related} (Other claims which are related to this claim such
15591   *         as prior submissions or claims for related services or for the same
15592   *         event.)
15593   */
15594  public List<RelatedClaimComponent> getRelated() {
15595    if (this.related == null)
15596      this.related = new ArrayList<RelatedClaimComponent>();
15597    return this.related;
15598  }
15599
15600  /**
15601   * @return Returns a reference to <code>this</code> for easy method chaining
15602   */
15603  public ExplanationOfBenefit setRelated(List<RelatedClaimComponent> theRelated) {
15604    this.related = theRelated;
15605    return this;
15606  }
15607
15608  public boolean hasRelated() {
15609    if (this.related == null)
15610      return false;
15611    for (RelatedClaimComponent item : this.related)
15612      if (!item.isEmpty())
15613        return true;
15614    return false;
15615  }
15616
15617  public RelatedClaimComponent addRelated() { // 3
15618    RelatedClaimComponent t = new RelatedClaimComponent();
15619    if (this.related == null)
15620      this.related = new ArrayList<RelatedClaimComponent>();
15621    this.related.add(t);
15622    return t;
15623  }
15624
15625  public ExplanationOfBenefit addRelated(RelatedClaimComponent t) { // 3
15626    if (t == null)
15627      return this;
15628    if (this.related == null)
15629      this.related = new ArrayList<RelatedClaimComponent>();
15630    this.related.add(t);
15631    return this;
15632  }
15633
15634  /**
15635   * @return The first repetition of repeating field {@link #related}, creating it
15636   *         if it does not already exist
15637   */
15638  public RelatedClaimComponent getRelatedFirstRep() {
15639    if (getRelated().isEmpty()) {
15640      addRelated();
15641    }
15642    return getRelated().get(0);
15643  }
15644
15645  /**
15646   * @return {@link #prescription} (Prescription to support the dispensing of
15647   *         pharmacy, device or vision products.)
15648   */
15649  public Reference getPrescription() {
15650    if (this.prescription == null)
15651      if (Configuration.errorOnAutoCreate())
15652        throw new Error("Attempt to auto-create ExplanationOfBenefit.prescription");
15653      else if (Configuration.doAutoCreate())
15654        this.prescription = new Reference(); // cc
15655    return this.prescription;
15656  }
15657
15658  public boolean hasPrescription() {
15659    return this.prescription != null && !this.prescription.isEmpty();
15660  }
15661
15662  /**
15663   * @param value {@link #prescription} (Prescription to support the dispensing of
15664   *              pharmacy, device or vision products.)
15665   */
15666  public ExplanationOfBenefit setPrescription(Reference value) {
15667    this.prescription = value;
15668    return this;
15669  }
15670
15671  /**
15672   * @return {@link #prescription} The actual object that is the target of the
15673   *         reference. The reference library doesn't populate this, but you can
15674   *         use it to hold the resource if you resolve it. (Prescription to
15675   *         support the dispensing of pharmacy, device or vision products.)
15676   */
15677  public Resource getPrescriptionTarget() {
15678    return this.prescriptionTarget;
15679  }
15680
15681  /**
15682   * @param value {@link #prescription} The actual object that is the target of
15683   *              the reference. The reference library doesn't use these, but you
15684   *              can use it to hold the resource if you resolve it. (Prescription
15685   *              to support the dispensing of pharmacy, device or vision
15686   *              products.)
15687   */
15688  public ExplanationOfBenefit setPrescriptionTarget(Resource value) {
15689    this.prescriptionTarget = value;
15690    return this;
15691  }
15692
15693  /**
15694   * @return {@link #originalPrescription} (Original prescription which has been
15695   *         superseded by this prescription to support the dispensing of pharmacy
15696   *         services, medications or products.)
15697   */
15698  public Reference getOriginalPrescription() {
15699    if (this.originalPrescription == null)
15700      if (Configuration.errorOnAutoCreate())
15701        throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
15702      else if (Configuration.doAutoCreate())
15703        this.originalPrescription = new Reference(); // cc
15704    return this.originalPrescription;
15705  }
15706
15707  public boolean hasOriginalPrescription() {
15708    return this.originalPrescription != null && !this.originalPrescription.isEmpty();
15709  }
15710
15711  /**
15712   * @param value {@link #originalPrescription} (Original prescription which has
15713   *              been superseded by this prescription to support the dispensing
15714   *              of pharmacy services, medications or products.)
15715   */
15716  public ExplanationOfBenefit setOriginalPrescription(Reference value) {
15717    this.originalPrescription = value;
15718    return this;
15719  }
15720
15721  /**
15722   * @return {@link #originalPrescription} The actual object that is the target of
15723   *         the reference. The reference library doesn't populate this, but you
15724   *         can use it to hold the resource if you resolve it. (Original
15725   *         prescription which has been superseded by this prescription to
15726   *         support the dispensing of pharmacy services, medications or
15727   *         products.)
15728   */
15729  public MedicationRequest getOriginalPrescriptionTarget() {
15730    if (this.originalPrescriptionTarget == null)
15731      if (Configuration.errorOnAutoCreate())
15732        throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
15733      else if (Configuration.doAutoCreate())
15734        this.originalPrescriptionTarget = new MedicationRequest(); // aa
15735    return this.originalPrescriptionTarget;
15736  }
15737
15738  /**
15739   * @param value {@link #originalPrescription} The actual object that is the
15740   *              target of the reference. The reference library doesn't use
15741   *              these, but you can use it to hold the resource if you resolve
15742   *              it. (Original prescription which has been superseded by this
15743   *              prescription to support the dispensing of pharmacy services,
15744   *              medications or products.)
15745   */
15746  public ExplanationOfBenefit setOriginalPrescriptionTarget(MedicationRequest value) {
15747    this.originalPrescriptionTarget = value;
15748    return this;
15749  }
15750
15751  /**
15752   * @return {@link #payee} (The party to be reimbursed for cost of the products
15753   *         and services according to the terms of the policy.)
15754   */
15755  public PayeeComponent getPayee() {
15756    if (this.payee == null)
15757      if (Configuration.errorOnAutoCreate())
15758        throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
15759      else if (Configuration.doAutoCreate())
15760        this.payee = new PayeeComponent(); // cc
15761    return this.payee;
15762  }
15763
15764  public boolean hasPayee() {
15765    return this.payee != null && !this.payee.isEmpty();
15766  }
15767
15768  /**
15769   * @param value {@link #payee} (The party to be reimbursed for cost of the
15770   *              products and services according to the terms of the policy.)
15771   */
15772  public ExplanationOfBenefit setPayee(PayeeComponent value) {
15773    this.payee = value;
15774    return this;
15775  }
15776
15777  /**
15778   * @return {@link #referral} (A reference to a referral resource.)
15779   */
15780  public Reference getReferral() {
15781    if (this.referral == null)
15782      if (Configuration.errorOnAutoCreate())
15783        throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
15784      else if (Configuration.doAutoCreate())
15785        this.referral = new Reference(); // cc
15786    return this.referral;
15787  }
15788
15789  public boolean hasReferral() {
15790    return this.referral != null && !this.referral.isEmpty();
15791  }
15792
15793  /**
15794   * @param value {@link #referral} (A reference to a referral resource.)
15795   */
15796  public ExplanationOfBenefit setReferral(Reference value) {
15797    this.referral = value;
15798    return this;
15799  }
15800
15801  /**
15802   * @return {@link #referral} The actual object that is the target of the
15803   *         reference. The reference library doesn't populate this, but you can
15804   *         use it to hold the resource if you resolve it. (A reference to a
15805   *         referral resource.)
15806   */
15807  public ServiceRequest getReferralTarget() {
15808    if (this.referralTarget == null)
15809      if (Configuration.errorOnAutoCreate())
15810        throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
15811      else if (Configuration.doAutoCreate())
15812        this.referralTarget = new ServiceRequest(); // aa
15813    return this.referralTarget;
15814  }
15815
15816  /**
15817   * @param value {@link #referral} The actual object that is the target of the
15818   *              reference. The reference library doesn't use these, but you can
15819   *              use it to hold the resource if you resolve it. (A reference to a
15820   *              referral resource.)
15821   */
15822  public ExplanationOfBenefit setReferralTarget(ServiceRequest value) {
15823    this.referralTarget = value;
15824    return this;
15825  }
15826
15827  /**
15828   * @return {@link #facility} (Facility where the services were provided.)
15829   */
15830  public Reference getFacility() {
15831    if (this.facility == null)
15832      if (Configuration.errorOnAutoCreate())
15833        throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
15834      else if (Configuration.doAutoCreate())
15835        this.facility = new Reference(); // cc
15836    return this.facility;
15837  }
15838
15839  public boolean hasFacility() {
15840    return this.facility != null && !this.facility.isEmpty();
15841  }
15842
15843  /**
15844   * @param value {@link #facility} (Facility where the services were provided.)
15845   */
15846  public ExplanationOfBenefit setFacility(Reference value) {
15847    this.facility = value;
15848    return this;
15849  }
15850
15851  /**
15852   * @return {@link #facility} The actual object that is the target of the
15853   *         reference. The reference library doesn't populate this, but you can
15854   *         use it to hold the resource if you resolve it. (Facility where the
15855   *         services were provided.)
15856   */
15857  public Location getFacilityTarget() {
15858    if (this.facilityTarget == null)
15859      if (Configuration.errorOnAutoCreate())
15860        throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
15861      else if (Configuration.doAutoCreate())
15862        this.facilityTarget = new Location(); // aa
15863    return this.facilityTarget;
15864  }
15865
15866  /**
15867   * @param value {@link #facility} The actual object that is the target of the
15868   *              reference. The reference library doesn't use these, but you can
15869   *              use it to hold the resource if you resolve it. (Facility where
15870   *              the services were provided.)
15871   */
15872  public ExplanationOfBenefit setFacilityTarget(Location value) {
15873    this.facilityTarget = value;
15874    return this;
15875  }
15876
15877  /**
15878   * @return {@link #claim} (The business identifier for the instance of the
15879   *         adjudication request: claim predetermination or preauthorization.)
15880   */
15881  public Reference getClaim() {
15882    if (this.claim == null)
15883      if (Configuration.errorOnAutoCreate())
15884        throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
15885      else if (Configuration.doAutoCreate())
15886        this.claim = new Reference(); // cc
15887    return this.claim;
15888  }
15889
15890  public boolean hasClaim() {
15891    return this.claim != null && !this.claim.isEmpty();
15892  }
15893
15894  /**
15895   * @param value {@link #claim} (The business identifier for the instance of the
15896   *              adjudication request: claim predetermination or
15897   *              preauthorization.)
15898   */
15899  public ExplanationOfBenefit setClaim(Reference value) {
15900    this.claim = value;
15901    return this;
15902  }
15903
15904  /**
15905   * @return {@link #claim} The actual object that is the target of the reference.
15906   *         The reference library doesn't populate this, but you can use it to
15907   *         hold the resource if you resolve it. (The business identifier for the
15908   *         instance of the adjudication request: claim predetermination or
15909   *         preauthorization.)
15910   */
15911  public Claim getClaimTarget() {
15912    if (this.claimTarget == null)
15913      if (Configuration.errorOnAutoCreate())
15914        throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
15915      else if (Configuration.doAutoCreate())
15916        this.claimTarget = new Claim(); // aa
15917    return this.claimTarget;
15918  }
15919
15920  /**
15921   * @param value {@link #claim} The actual object that is the target of the
15922   *              reference. The reference library doesn't use these, but you can
15923   *              use it to hold the resource if you resolve it. (The business
15924   *              identifier for the instance of the adjudication request: claim
15925   *              predetermination or preauthorization.)
15926   */
15927  public ExplanationOfBenefit setClaimTarget(Claim value) {
15928    this.claimTarget = value;
15929    return this;
15930  }
15931
15932  /**
15933   * @return {@link #claimResponse} (The business identifier for the instance of
15934   *         the adjudication response: claim, predetermination or
15935   *         preauthorization response.)
15936   */
15937  public Reference getClaimResponse() {
15938    if (this.claimResponse == null)
15939      if (Configuration.errorOnAutoCreate())
15940        throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
15941      else if (Configuration.doAutoCreate())
15942        this.claimResponse = new Reference(); // cc
15943    return this.claimResponse;
15944  }
15945
15946  public boolean hasClaimResponse() {
15947    return this.claimResponse != null && !this.claimResponse.isEmpty();
15948  }
15949
15950  /**
15951   * @param value {@link #claimResponse} (The business identifier for the instance
15952   *              of the adjudication response: claim, predetermination or
15953   *              preauthorization response.)
15954   */
15955  public ExplanationOfBenefit setClaimResponse(Reference value) {
15956    this.claimResponse = value;
15957    return this;
15958  }
15959
15960  /**
15961   * @return {@link #claimResponse} The actual object that is the target of the
15962   *         reference. The reference library doesn't populate this, but you can
15963   *         use it to hold the resource if you resolve it. (The business
15964   *         identifier for the instance of the adjudication response: claim,
15965   *         predetermination or preauthorization response.)
15966   */
15967  public ClaimResponse getClaimResponseTarget() {
15968    if (this.claimResponseTarget == null)
15969      if (Configuration.errorOnAutoCreate())
15970        throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
15971      else if (Configuration.doAutoCreate())
15972        this.claimResponseTarget = new ClaimResponse(); // aa
15973    return this.claimResponseTarget;
15974  }
15975
15976  /**
15977   * @param value {@link #claimResponse} The actual object that is the target of
15978   *              the reference. The reference library doesn't use these, but you
15979   *              can use it to hold the resource if you resolve it. (The business
15980   *              identifier for the instance of the adjudication response: claim,
15981   *              predetermination or preauthorization response.)
15982   */
15983  public ExplanationOfBenefit setClaimResponseTarget(ClaimResponse value) {
15984    this.claimResponseTarget = value;
15985    return this;
15986  }
15987
15988  /**
15989   * @return {@link #outcome} (The outcome of the claim, predetermination, or
15990   *         preauthorization processing.). This is the underlying object with id,
15991   *         value and extensions. The accessor "getOutcome" gives direct access
15992   *         to the value
15993   */
15994  public Enumeration<RemittanceOutcome> getOutcomeElement() {
15995    if (this.outcome == null)
15996      if (Configuration.errorOnAutoCreate())
15997        throw new Error("Attempt to auto-create ExplanationOfBenefit.outcome");
15998      else if (Configuration.doAutoCreate())
15999        this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory()); // bb
16000    return this.outcome;
16001  }
16002
16003  public boolean hasOutcomeElement() {
16004    return this.outcome != null && !this.outcome.isEmpty();
16005  }
16006
16007  public boolean hasOutcome() {
16008    return this.outcome != null && !this.outcome.isEmpty();
16009  }
16010
16011  /**
16012   * @param value {@link #outcome} (The outcome of the claim, predetermination, or
16013   *              preauthorization processing.). This is the underlying object
16014   *              with id, value and extensions. The accessor "getOutcome" gives
16015   *              direct access to the value
16016   */
16017  public ExplanationOfBenefit setOutcomeElement(Enumeration<RemittanceOutcome> value) {
16018    this.outcome = value;
16019    return this;
16020  }
16021
16022  /**
16023   * @return The outcome of the claim, predetermination, or preauthorization
16024   *         processing.
16025   */
16026  public RemittanceOutcome getOutcome() {
16027    return this.outcome == null ? null : this.outcome.getValue();
16028  }
16029
16030  /**
16031   * @param value The outcome of the claim, predetermination, or preauthorization
16032   *              processing.
16033   */
16034  public ExplanationOfBenefit setOutcome(RemittanceOutcome value) {
16035    if (this.outcome == null)
16036      this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory());
16037    this.outcome.setValue(value);
16038    return this;
16039  }
16040
16041  /**
16042   * @return {@link #disposition} (A human readable description of the status of
16043   *         the adjudication.). This is the underlying object with id, value and
16044   *         extensions. The accessor "getDisposition" gives direct access to the
16045   *         value
16046   */
16047  public StringType getDispositionElement() {
16048    if (this.disposition == null)
16049      if (Configuration.errorOnAutoCreate())
16050        throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
16051      else if (Configuration.doAutoCreate())
16052        this.disposition = new StringType(); // bb
16053    return this.disposition;
16054  }
16055
16056  public boolean hasDispositionElement() {
16057    return this.disposition != null && !this.disposition.isEmpty();
16058  }
16059
16060  public boolean hasDisposition() {
16061    return this.disposition != null && !this.disposition.isEmpty();
16062  }
16063
16064  /**
16065   * @param value {@link #disposition} (A human readable description of the status
16066   *              of the adjudication.). This is the underlying object with id,
16067   *              value and extensions. The accessor "getDisposition" gives direct
16068   *              access to the value
16069   */
16070  public ExplanationOfBenefit setDispositionElement(StringType value) {
16071    this.disposition = value;
16072    return this;
16073  }
16074
16075  /**
16076   * @return A human readable description of the status of the adjudication.
16077   */
16078  public String getDisposition() {
16079    return this.disposition == null ? null : this.disposition.getValue();
16080  }
16081
16082  /**
16083   * @param value A human readable description of the status of the adjudication.
16084   */
16085  public ExplanationOfBenefit setDisposition(String value) {
16086    if (Utilities.noString(value))
16087      this.disposition = null;
16088    else {
16089      if (this.disposition == null)
16090        this.disposition = new StringType();
16091      this.disposition.setValue(value);
16092    }
16093    return this;
16094  }
16095
16096  /**
16097   * @return {@link #preAuthRef} (Reference from the Insurer which is used in
16098   *         later communications which refers to this adjudication.)
16099   */
16100  public List<StringType> getPreAuthRef() {
16101    if (this.preAuthRef == null)
16102      this.preAuthRef = new ArrayList<StringType>();
16103    return this.preAuthRef;
16104  }
16105
16106  /**
16107   * @return Returns a reference to <code>this</code> for easy method chaining
16108   */
16109  public ExplanationOfBenefit setPreAuthRef(List<StringType> thePreAuthRef) {
16110    this.preAuthRef = thePreAuthRef;
16111    return this;
16112  }
16113
16114  public boolean hasPreAuthRef() {
16115    if (this.preAuthRef == null)
16116      return false;
16117    for (StringType item : this.preAuthRef)
16118      if (!item.isEmpty())
16119        return true;
16120    return false;
16121  }
16122
16123  /**
16124   * @return {@link #preAuthRef} (Reference from the Insurer which is used in
16125   *         later communications which refers to this adjudication.)
16126   */
16127  public StringType addPreAuthRefElement() {// 2
16128    StringType t = new StringType();
16129    if (this.preAuthRef == null)
16130      this.preAuthRef = new ArrayList<StringType>();
16131    this.preAuthRef.add(t);
16132    return t;
16133  }
16134
16135  /**
16136   * @param value {@link #preAuthRef} (Reference from the Insurer which is used in
16137   *              later communications which refers to this adjudication.)
16138   */
16139  public ExplanationOfBenefit addPreAuthRef(String value) { // 1
16140    StringType t = new StringType();
16141    t.setValue(value);
16142    if (this.preAuthRef == null)
16143      this.preAuthRef = new ArrayList<StringType>();
16144    this.preAuthRef.add(t);
16145    return this;
16146  }
16147
16148  /**
16149   * @param value {@link #preAuthRef} (Reference from the Insurer which is used in
16150   *              later communications which refers to this adjudication.)
16151   */
16152  public boolean hasPreAuthRef(String value) {
16153    if (this.preAuthRef == null)
16154      return false;
16155    for (StringType v : this.preAuthRef)
16156      if (v.getValue().equals(value)) // string
16157        return true;
16158    return false;
16159  }
16160
16161  /**
16162   * @return {@link #preAuthRefPeriod} (The timeframe during which the supplied
16163   *         preauthorization reference may be quoted on claims to obtain the
16164   *         adjudication as provided.)
16165   */
16166  public List<Period> getPreAuthRefPeriod() {
16167    if (this.preAuthRefPeriod == null)
16168      this.preAuthRefPeriod = new ArrayList<Period>();
16169    return this.preAuthRefPeriod;
16170  }
16171
16172  /**
16173   * @return Returns a reference to <code>this</code> for easy method chaining
16174   */
16175  public ExplanationOfBenefit setPreAuthRefPeriod(List<Period> thePreAuthRefPeriod) {
16176    this.preAuthRefPeriod = thePreAuthRefPeriod;
16177    return this;
16178  }
16179
16180  public boolean hasPreAuthRefPeriod() {
16181    if (this.preAuthRefPeriod == null)
16182      return false;
16183    for (Period item : this.preAuthRefPeriod)
16184      if (!item.isEmpty())
16185        return true;
16186    return false;
16187  }
16188
16189  public Period addPreAuthRefPeriod() { // 3
16190    Period t = new Period();
16191    if (this.preAuthRefPeriod == null)
16192      this.preAuthRefPeriod = new ArrayList<Period>();
16193    this.preAuthRefPeriod.add(t);
16194    return t;
16195  }
16196
16197  public ExplanationOfBenefit addPreAuthRefPeriod(Period t) { // 3
16198    if (t == null)
16199      return this;
16200    if (this.preAuthRefPeriod == null)
16201      this.preAuthRefPeriod = new ArrayList<Period>();
16202    this.preAuthRefPeriod.add(t);
16203    return this;
16204  }
16205
16206  /**
16207   * @return The first repetition of repeating field {@link #preAuthRefPeriod},
16208   *         creating it if it does not already exist
16209   */
16210  public Period getPreAuthRefPeriodFirstRep() {
16211    if (getPreAuthRefPeriod().isEmpty()) {
16212      addPreAuthRefPeriod();
16213    }
16214    return getPreAuthRefPeriod().get(0);
16215  }
16216
16217  /**
16218   * @return {@link #careTeam} (The members of the team who provided the products
16219   *         and services.)
16220   */
16221  public List<CareTeamComponent> getCareTeam() {
16222    if (this.careTeam == null)
16223      this.careTeam = new ArrayList<CareTeamComponent>();
16224    return this.careTeam;
16225  }
16226
16227  /**
16228   * @return Returns a reference to <code>this</code> for easy method chaining
16229   */
16230  public ExplanationOfBenefit setCareTeam(List<CareTeamComponent> theCareTeam) {
16231    this.careTeam = theCareTeam;
16232    return this;
16233  }
16234
16235  public boolean hasCareTeam() {
16236    if (this.careTeam == null)
16237      return false;
16238    for (CareTeamComponent item : this.careTeam)
16239      if (!item.isEmpty())
16240        return true;
16241    return false;
16242  }
16243
16244  public CareTeamComponent addCareTeam() { // 3
16245    CareTeamComponent t = new CareTeamComponent();
16246    if (this.careTeam == null)
16247      this.careTeam = new ArrayList<CareTeamComponent>();
16248    this.careTeam.add(t);
16249    return t;
16250  }
16251
16252  public ExplanationOfBenefit addCareTeam(CareTeamComponent t) { // 3
16253    if (t == null)
16254      return this;
16255    if (this.careTeam == null)
16256      this.careTeam = new ArrayList<CareTeamComponent>();
16257    this.careTeam.add(t);
16258    return this;
16259  }
16260
16261  /**
16262   * @return The first repetition of repeating field {@link #careTeam}, creating
16263   *         it if it does not already exist
16264   */
16265  public CareTeamComponent getCareTeamFirstRep() {
16266    if (getCareTeam().isEmpty()) {
16267      addCareTeam();
16268    }
16269    return getCareTeam().get(0);
16270  }
16271
16272  /**
16273   * @return {@link #supportingInfo} (Additional information codes regarding
16274   *         exceptions, special considerations, the condition, situation, prior
16275   *         or concurrent issues.)
16276   */
16277  public List<SupportingInformationComponent> getSupportingInfo() {
16278    if (this.supportingInfo == null)
16279      this.supportingInfo = new ArrayList<SupportingInformationComponent>();
16280    return this.supportingInfo;
16281  }
16282
16283  /**
16284   * @return Returns a reference to <code>this</code> for easy method chaining
16285   */
16286  public ExplanationOfBenefit setSupportingInfo(List<SupportingInformationComponent> theSupportingInfo) {
16287    this.supportingInfo = theSupportingInfo;
16288    return this;
16289  }
16290
16291  public boolean hasSupportingInfo() {
16292    if (this.supportingInfo == null)
16293      return false;
16294    for (SupportingInformationComponent item : this.supportingInfo)
16295      if (!item.isEmpty())
16296        return true;
16297    return false;
16298  }
16299
16300  public SupportingInformationComponent addSupportingInfo() { // 3
16301    SupportingInformationComponent t = new SupportingInformationComponent();
16302    if (this.supportingInfo == null)
16303      this.supportingInfo = new ArrayList<SupportingInformationComponent>();
16304    this.supportingInfo.add(t);
16305    return t;
16306  }
16307
16308  public ExplanationOfBenefit addSupportingInfo(SupportingInformationComponent t) { // 3
16309    if (t == null)
16310      return this;
16311    if (this.supportingInfo == null)
16312      this.supportingInfo = new ArrayList<SupportingInformationComponent>();
16313    this.supportingInfo.add(t);
16314    return this;
16315  }
16316
16317  /**
16318   * @return The first repetition of repeating field {@link #supportingInfo},
16319   *         creating it if it does not already exist
16320   */
16321  public SupportingInformationComponent getSupportingInfoFirstRep() {
16322    if (getSupportingInfo().isEmpty()) {
16323      addSupportingInfo();
16324    }
16325    return getSupportingInfo().get(0);
16326  }
16327
16328  /**
16329   * @return {@link #diagnosis} (Information about diagnoses relevant to the claim
16330   *         items.)
16331   */
16332  public List<DiagnosisComponent> getDiagnosis() {
16333    if (this.diagnosis == null)
16334      this.diagnosis = new ArrayList<DiagnosisComponent>();
16335    return this.diagnosis;
16336  }
16337
16338  /**
16339   * @return Returns a reference to <code>this</code> for easy method chaining
16340   */
16341  public ExplanationOfBenefit setDiagnosis(List<DiagnosisComponent> theDiagnosis) {
16342    this.diagnosis = theDiagnosis;
16343    return this;
16344  }
16345
16346  public boolean hasDiagnosis() {
16347    if (this.diagnosis == null)
16348      return false;
16349    for (DiagnosisComponent item : this.diagnosis)
16350      if (!item.isEmpty())
16351        return true;
16352    return false;
16353  }
16354
16355  public DiagnosisComponent addDiagnosis() { // 3
16356    DiagnosisComponent t = new DiagnosisComponent();
16357    if (this.diagnosis == null)
16358      this.diagnosis = new ArrayList<DiagnosisComponent>();
16359    this.diagnosis.add(t);
16360    return t;
16361  }
16362
16363  public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { // 3
16364    if (t == null)
16365      return this;
16366    if (this.diagnosis == null)
16367      this.diagnosis = new ArrayList<DiagnosisComponent>();
16368    this.diagnosis.add(t);
16369    return this;
16370  }
16371
16372  /**
16373   * @return The first repetition of repeating field {@link #diagnosis}, creating
16374   *         it if it does not already exist
16375   */
16376  public DiagnosisComponent getDiagnosisFirstRep() {
16377    if (getDiagnosis().isEmpty()) {
16378      addDiagnosis();
16379    }
16380    return getDiagnosis().get(0);
16381  }
16382
16383  /**
16384   * @return {@link #procedure} (Procedures performed on the patient relevant to
16385   *         the billing items with the claim.)
16386   */
16387  public List<ProcedureComponent> getProcedure() {
16388    if (this.procedure == null)
16389      this.procedure = new ArrayList<ProcedureComponent>();
16390    return this.procedure;
16391  }
16392
16393  /**
16394   * @return Returns a reference to <code>this</code> for easy method chaining
16395   */
16396  public ExplanationOfBenefit setProcedure(List<ProcedureComponent> theProcedure) {
16397    this.procedure = theProcedure;
16398    return this;
16399  }
16400
16401  public boolean hasProcedure() {
16402    if (this.procedure == null)
16403      return false;
16404    for (ProcedureComponent item : this.procedure)
16405      if (!item.isEmpty())
16406        return true;
16407    return false;
16408  }
16409
16410  public ProcedureComponent addProcedure() { // 3
16411    ProcedureComponent t = new ProcedureComponent();
16412    if (this.procedure == null)
16413      this.procedure = new ArrayList<ProcedureComponent>();
16414    this.procedure.add(t);
16415    return t;
16416  }
16417
16418  public ExplanationOfBenefit addProcedure(ProcedureComponent t) { // 3
16419    if (t == null)
16420      return this;
16421    if (this.procedure == null)
16422      this.procedure = new ArrayList<ProcedureComponent>();
16423    this.procedure.add(t);
16424    return this;
16425  }
16426
16427  /**
16428   * @return The first repetition of repeating field {@link #procedure}, creating
16429   *         it if it does not already exist
16430   */
16431  public ProcedureComponent getProcedureFirstRep() {
16432    if (getProcedure().isEmpty()) {
16433      addProcedure();
16434    }
16435    return getProcedure().get(0);
16436  }
16437
16438  /**
16439   * @return {@link #precedence} (This indicates the relative order of a series of
16440   *         EOBs related to different coverages for the same suite of services.).
16441   *         This is the underlying object with id, value and extensions. The
16442   *         accessor "getPrecedence" gives direct access to the value
16443   */
16444  public PositiveIntType getPrecedenceElement() {
16445    if (this.precedence == null)
16446      if (Configuration.errorOnAutoCreate())
16447        throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
16448      else if (Configuration.doAutoCreate())
16449        this.precedence = new PositiveIntType(); // bb
16450    return this.precedence;
16451  }
16452
16453  public boolean hasPrecedenceElement() {
16454    return this.precedence != null && !this.precedence.isEmpty();
16455  }
16456
16457  public boolean hasPrecedence() {
16458    return this.precedence != null && !this.precedence.isEmpty();
16459  }
16460
16461  /**
16462   * @param value {@link #precedence} (This indicates the relative order of a
16463   *              series of EOBs related to different coverages for the same suite
16464   *              of services.). This is the underlying object with id, value and
16465   *              extensions. The accessor "getPrecedence" gives direct access to
16466   *              the value
16467   */
16468  public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) {
16469    this.precedence = value;
16470    return this;
16471  }
16472
16473  /**
16474   * @return This indicates the relative order of a series of EOBs related to
16475   *         different coverages for the same suite of services.
16476   */
16477  public int getPrecedence() {
16478    return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
16479  }
16480
16481  /**
16482   * @param value This indicates the relative order of a series of EOBs related to
16483   *              different coverages for the same suite of services.
16484   */
16485  public ExplanationOfBenefit setPrecedence(int value) {
16486    if (this.precedence == null)
16487      this.precedence = new PositiveIntType();
16488    this.precedence.setValue(value);
16489    return this;
16490  }
16491
16492  /**
16493   * @return {@link #insurance} (Financial instruments for reimbursement for the
16494   *         health care products and services specified on the claim.)
16495   */
16496  public List<InsuranceComponent> getInsurance() {
16497    if (this.insurance == null)
16498      this.insurance = new ArrayList<InsuranceComponent>();
16499    return this.insurance;
16500  }
16501
16502  /**
16503   * @return Returns a reference to <code>this</code> for easy method chaining
16504   */
16505  public ExplanationOfBenefit setInsurance(List<InsuranceComponent> theInsurance) {
16506    this.insurance = theInsurance;
16507    return this;
16508  }
16509
16510  public boolean hasInsurance() {
16511    if (this.insurance == null)
16512      return false;
16513    for (InsuranceComponent item : this.insurance)
16514      if (!item.isEmpty())
16515        return true;
16516    return false;
16517  }
16518
16519  public InsuranceComponent addInsurance() { // 3
16520    InsuranceComponent t = new InsuranceComponent();
16521    if (this.insurance == null)
16522      this.insurance = new ArrayList<InsuranceComponent>();
16523    this.insurance.add(t);
16524    return t;
16525  }
16526
16527  public ExplanationOfBenefit addInsurance(InsuranceComponent t) { // 3
16528    if (t == null)
16529      return this;
16530    if (this.insurance == null)
16531      this.insurance = new ArrayList<InsuranceComponent>();
16532    this.insurance.add(t);
16533    return this;
16534  }
16535
16536  /**
16537   * @return The first repetition of repeating field {@link #insurance}, creating
16538   *         it if it does not already exist
16539   */
16540  public InsuranceComponent getInsuranceFirstRep() {
16541    if (getInsurance().isEmpty()) {
16542      addInsurance();
16543    }
16544    return getInsurance().get(0);
16545  }
16546
16547  /**
16548   * @return {@link #accident} (Details of a accident which resulted in injuries
16549   *         which required the products and services listed in the claim.)
16550   */
16551  public AccidentComponent getAccident() {
16552    if (this.accident == null)
16553      if (Configuration.errorOnAutoCreate())
16554        throw new Error("Attempt to auto-create ExplanationOfBenefit.accident");
16555      else if (Configuration.doAutoCreate())
16556        this.accident = new AccidentComponent(); // cc
16557    return this.accident;
16558  }
16559
16560  public boolean hasAccident() {
16561    return this.accident != null && !this.accident.isEmpty();
16562  }
16563
16564  /**
16565   * @param value {@link #accident} (Details of a accident which resulted in
16566   *              injuries which required the products and services listed in the
16567   *              claim.)
16568   */
16569  public ExplanationOfBenefit setAccident(AccidentComponent value) {
16570    this.accident = value;
16571    return this;
16572  }
16573
16574  /**
16575   * @return {@link #item} (A claim line. Either a simple (a product or service)
16576   *         or a 'group' of details which can also be a simple items or groups of
16577   *         sub-details.)
16578   */
16579  public List<ItemComponent> getItem() {
16580    if (this.item == null)
16581      this.item = new ArrayList<ItemComponent>();
16582    return this.item;
16583  }
16584
16585  /**
16586   * @return Returns a reference to <code>this</code> for easy method chaining
16587   */
16588  public ExplanationOfBenefit setItem(List<ItemComponent> theItem) {
16589    this.item = theItem;
16590    return this;
16591  }
16592
16593  public boolean hasItem() {
16594    if (this.item == null)
16595      return false;
16596    for (ItemComponent item : this.item)
16597      if (!item.isEmpty())
16598        return true;
16599    return false;
16600  }
16601
16602  public ItemComponent addItem() { // 3
16603    ItemComponent t = new ItemComponent();
16604    if (this.item == null)
16605      this.item = new ArrayList<ItemComponent>();
16606    this.item.add(t);
16607    return t;
16608  }
16609
16610  public ExplanationOfBenefit addItem(ItemComponent t) { // 3
16611    if (t == null)
16612      return this;
16613    if (this.item == null)
16614      this.item = new ArrayList<ItemComponent>();
16615    this.item.add(t);
16616    return this;
16617  }
16618
16619  /**
16620   * @return The first repetition of repeating field {@link #item}, creating it if
16621   *         it does not already exist
16622   */
16623  public ItemComponent getItemFirstRep() {
16624    if (getItem().isEmpty()) {
16625      addItem();
16626    }
16627    return getItem().get(0);
16628  }
16629
16630  /**
16631   * @return {@link #addItem} (The first-tier service adjudications for payor
16632   *         added product or service lines.)
16633   */
16634  public List<AddedItemComponent> getAddItem() {
16635    if (this.addItem == null)
16636      this.addItem = new ArrayList<AddedItemComponent>();
16637    return this.addItem;
16638  }
16639
16640  /**
16641   * @return Returns a reference to <code>this</code> for easy method chaining
16642   */
16643  public ExplanationOfBenefit setAddItem(List<AddedItemComponent> theAddItem) {
16644    this.addItem = theAddItem;
16645    return this;
16646  }
16647
16648  public boolean hasAddItem() {
16649    if (this.addItem == null)
16650      return false;
16651    for (AddedItemComponent item : this.addItem)
16652      if (!item.isEmpty())
16653        return true;
16654    return false;
16655  }
16656
16657  public AddedItemComponent addAddItem() { // 3
16658    AddedItemComponent t = new AddedItemComponent();
16659    if (this.addItem == null)
16660      this.addItem = new ArrayList<AddedItemComponent>();
16661    this.addItem.add(t);
16662    return t;
16663  }
16664
16665  public ExplanationOfBenefit addAddItem(AddedItemComponent t) { // 3
16666    if (t == null)
16667      return this;
16668    if (this.addItem == null)
16669      this.addItem = new ArrayList<AddedItemComponent>();
16670    this.addItem.add(t);
16671    return this;
16672  }
16673
16674  /**
16675   * @return The first repetition of repeating field {@link #addItem}, creating it
16676   *         if it does not already exist
16677   */
16678  public AddedItemComponent getAddItemFirstRep() {
16679    if (getAddItem().isEmpty()) {
16680      addAddItem();
16681    }
16682    return getAddItem().get(0);
16683  }
16684
16685  /**
16686   * @return {@link #adjudication} (The adjudication results which are presented
16687   *         at the header level rather than at the line-item or add-item levels.)
16688   */
16689  public List<AdjudicationComponent> getAdjudication() {
16690    if (this.adjudication == null)
16691      this.adjudication = new ArrayList<AdjudicationComponent>();
16692    return this.adjudication;
16693  }
16694
16695  /**
16696   * @return Returns a reference to <code>this</code> for easy method chaining
16697   */
16698  public ExplanationOfBenefit setAdjudication(List<AdjudicationComponent> theAdjudication) {
16699    this.adjudication = theAdjudication;
16700    return this;
16701  }
16702
16703  public boolean hasAdjudication() {
16704    if (this.adjudication == null)
16705      return false;
16706    for (AdjudicationComponent item : this.adjudication)
16707      if (!item.isEmpty())
16708        return true;
16709    return false;
16710  }
16711
16712  public AdjudicationComponent addAdjudication() { // 3
16713    AdjudicationComponent t = new AdjudicationComponent();
16714    if (this.adjudication == null)
16715      this.adjudication = new ArrayList<AdjudicationComponent>();
16716    this.adjudication.add(t);
16717    return t;
16718  }
16719
16720  public ExplanationOfBenefit addAdjudication(AdjudicationComponent t) { // 3
16721    if (t == null)
16722      return this;
16723    if (this.adjudication == null)
16724      this.adjudication = new ArrayList<AdjudicationComponent>();
16725    this.adjudication.add(t);
16726    return this;
16727  }
16728
16729  /**
16730   * @return The first repetition of repeating field {@link #adjudication},
16731   *         creating it if it does not already exist
16732   */
16733  public AdjudicationComponent getAdjudicationFirstRep() {
16734    if (getAdjudication().isEmpty()) {
16735      addAdjudication();
16736    }
16737    return getAdjudication().get(0);
16738  }
16739
16740  /**
16741   * @return {@link #total} (Categorized monetary totals for the adjudication.)
16742   */
16743  public List<TotalComponent> getTotal() {
16744    if (this.total == null)
16745      this.total = new ArrayList<TotalComponent>();
16746    return this.total;
16747  }
16748
16749  /**
16750   * @return Returns a reference to <code>this</code> for easy method chaining
16751   */
16752  public ExplanationOfBenefit setTotal(List<TotalComponent> theTotal) {
16753    this.total = theTotal;
16754    return this;
16755  }
16756
16757  public boolean hasTotal() {
16758    if (this.total == null)
16759      return false;
16760    for (TotalComponent item : this.total)
16761      if (!item.isEmpty())
16762        return true;
16763    return false;
16764  }
16765
16766  public TotalComponent addTotal() { // 3
16767    TotalComponent t = new TotalComponent();
16768    if (this.total == null)
16769      this.total = new ArrayList<TotalComponent>();
16770    this.total.add(t);
16771    return t;
16772  }
16773
16774  public ExplanationOfBenefit addTotal(TotalComponent t) { // 3
16775    if (t == null)
16776      return this;
16777    if (this.total == null)
16778      this.total = new ArrayList<TotalComponent>();
16779    this.total.add(t);
16780    return this;
16781  }
16782
16783  /**
16784   * @return The first repetition of repeating field {@link #total}, creating it
16785   *         if it does not already exist
16786   */
16787  public TotalComponent getTotalFirstRep() {
16788    if (getTotal().isEmpty()) {
16789      addTotal();
16790    }
16791    return getTotal().get(0);
16792  }
16793
16794  /**
16795   * @return {@link #payment} (Payment details for the adjudication of the claim.)
16796   */
16797  public PaymentComponent getPayment() {
16798    if (this.payment == null)
16799      if (Configuration.errorOnAutoCreate())
16800        throw new Error("Attempt to auto-create ExplanationOfBenefit.payment");
16801      else if (Configuration.doAutoCreate())
16802        this.payment = new PaymentComponent(); // cc
16803    return this.payment;
16804  }
16805
16806  public boolean hasPayment() {
16807    return this.payment != null && !this.payment.isEmpty();
16808  }
16809
16810  /**
16811   * @param value {@link #payment} (Payment details for the adjudication of the
16812   *              claim.)
16813   */
16814  public ExplanationOfBenefit setPayment(PaymentComponent value) {
16815    this.payment = value;
16816    return this;
16817  }
16818
16819  /**
16820   * @return {@link #formCode} (A code for the form to be used for printing the
16821   *         content.)
16822   */
16823  public CodeableConcept getFormCode() {
16824    if (this.formCode == null)
16825      if (Configuration.errorOnAutoCreate())
16826        throw new Error("Attempt to auto-create ExplanationOfBenefit.formCode");
16827      else if (Configuration.doAutoCreate())
16828        this.formCode = new CodeableConcept(); // cc
16829    return this.formCode;
16830  }
16831
16832  public boolean hasFormCode() {
16833    return this.formCode != null && !this.formCode.isEmpty();
16834  }
16835
16836  /**
16837   * @param value {@link #formCode} (A code for the form to be used for printing
16838   *              the content.)
16839   */
16840  public ExplanationOfBenefit setFormCode(CodeableConcept value) {
16841    this.formCode = value;
16842    return this;
16843  }
16844
16845  /**
16846   * @return {@link #form} (The actual form, by reference or inclusion, for
16847   *         printing the content or an EOB.)
16848   */
16849  public Attachment getForm() {
16850    if (this.form == null)
16851      if (Configuration.errorOnAutoCreate())
16852        throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
16853      else if (Configuration.doAutoCreate())
16854        this.form = new Attachment(); // cc
16855    return this.form;
16856  }
16857
16858  public boolean hasForm() {
16859    return this.form != null && !this.form.isEmpty();
16860  }
16861
16862  /**
16863   * @param value {@link #form} (The actual form, by reference or inclusion, for
16864   *              printing the content or an EOB.)
16865   */
16866  public ExplanationOfBenefit setForm(Attachment value) {
16867    this.form = value;
16868    return this;
16869  }
16870
16871  /**
16872   * @return {@link #processNote} (A note that describes or explains adjudication
16873   *         results in a human readable form.)
16874   */
16875  public List<NoteComponent> getProcessNote() {
16876    if (this.processNote == null)
16877      this.processNote = new ArrayList<NoteComponent>();
16878    return this.processNote;
16879  }
16880
16881  /**
16882   * @return Returns a reference to <code>this</code> for easy method chaining
16883   */
16884  public ExplanationOfBenefit setProcessNote(List<NoteComponent> theProcessNote) {
16885    this.processNote = theProcessNote;
16886    return this;
16887  }
16888
16889  public boolean hasProcessNote() {
16890    if (this.processNote == null)
16891      return false;
16892    for (NoteComponent item : this.processNote)
16893      if (!item.isEmpty())
16894        return true;
16895    return false;
16896  }
16897
16898  public NoteComponent addProcessNote() { // 3
16899    NoteComponent t = new NoteComponent();
16900    if (this.processNote == null)
16901      this.processNote = new ArrayList<NoteComponent>();
16902    this.processNote.add(t);
16903    return t;
16904  }
16905
16906  public ExplanationOfBenefit addProcessNote(NoteComponent t) { // 3
16907    if (t == null)
16908      return this;
16909    if (this.processNote == null)
16910      this.processNote = new ArrayList<NoteComponent>();
16911    this.processNote.add(t);
16912    return this;
16913  }
16914
16915  /**
16916   * @return The first repetition of repeating field {@link #processNote},
16917   *         creating it if it does not already exist
16918   */
16919  public NoteComponent getProcessNoteFirstRep() {
16920    if (getProcessNote().isEmpty()) {
16921      addProcessNote();
16922    }
16923    return getProcessNote().get(0);
16924  }
16925
16926  /**
16927   * @return {@link #benefitPeriod} (The term of the benefits documented in this
16928   *         response.)
16929   */
16930  public Period getBenefitPeriod() {
16931    if (this.benefitPeriod == null)
16932      if (Configuration.errorOnAutoCreate())
16933        throw new Error("Attempt to auto-create ExplanationOfBenefit.benefitPeriod");
16934      else if (Configuration.doAutoCreate())
16935        this.benefitPeriod = new Period(); // cc
16936    return this.benefitPeriod;
16937  }
16938
16939  public boolean hasBenefitPeriod() {
16940    return this.benefitPeriod != null && !this.benefitPeriod.isEmpty();
16941  }
16942
16943  /**
16944   * @param value {@link #benefitPeriod} (The term of the benefits documented in
16945   *              this response.)
16946   */
16947  public ExplanationOfBenefit setBenefitPeriod(Period value) {
16948    this.benefitPeriod = value;
16949    return this;
16950  }
16951
16952  /**
16953   * @return {@link #benefitBalance} (Balance by Benefit Category.)
16954   */
16955  public List<BenefitBalanceComponent> getBenefitBalance() {
16956    if (this.benefitBalance == null)
16957      this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
16958    return this.benefitBalance;
16959  }
16960
16961  /**
16962   * @return Returns a reference to <code>this</code> for easy method chaining
16963   */
16964  public ExplanationOfBenefit setBenefitBalance(List<BenefitBalanceComponent> theBenefitBalance) {
16965    this.benefitBalance = theBenefitBalance;
16966    return this;
16967  }
16968
16969  public boolean hasBenefitBalance() {
16970    if (this.benefitBalance == null)
16971      return false;
16972    for (BenefitBalanceComponent item : this.benefitBalance)
16973      if (!item.isEmpty())
16974        return true;
16975    return false;
16976  }
16977
16978  public BenefitBalanceComponent addBenefitBalance() { // 3
16979    BenefitBalanceComponent t = new BenefitBalanceComponent();
16980    if (this.benefitBalance == null)
16981      this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
16982    this.benefitBalance.add(t);
16983    return t;
16984  }
16985
16986  public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { // 3
16987    if (t == null)
16988      return this;
16989    if (this.benefitBalance == null)
16990      this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
16991    this.benefitBalance.add(t);
16992    return this;
16993  }
16994
16995  /**
16996   * @return The first repetition of repeating field {@link #benefitBalance},
16997   *         creating it if it does not already exist
16998   */
16999  public BenefitBalanceComponent getBenefitBalanceFirstRep() {
17000    if (getBenefitBalance().isEmpty()) {
17001      addBenefitBalance();
17002    }
17003    return getBenefitBalance().get(0);
17004  }
17005
17006  protected void listChildren(List<Property> children) {
17007    super.listChildren(children);
17008    children.add(new Property("identifier", "Identifier",
17009        "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier));
17010    children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
17011    children.add(new Property("type", "CodeableConcept",
17012        "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type));
17013    children.add(new Property("subType", "CodeableConcept",
17014        "A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.",
17015        0, 1, subType));
17016    children.add(new Property("use", "code",
17017        "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.",
17018        0, 1, use));
17019    children.add(new Property("patient", "Reference(Patient)",
17020        "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.",
17021        0, 1, patient));
17022    children.add(new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1,
17023        billablePeriod));
17024    children.add(new Property("created", "dateTime", "The date this resource was created.", 0, 1, created));
17025    children.add(new Property("enterer", "Reference(Practitioner|PractitionerRole)",
17026        "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer));
17027    children.add(new Property("insurer", "Reference(Organization)",
17028        "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer));
17029    children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
17030        "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider));
17031    children.add(new Property("priority", "CodeableConcept",
17032        "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.", 0,
17033        1, priority));
17034    children.add(new Property("fundsReserveRequested", "CodeableConcept",
17035        "A code to indicate whether and for whom funds are to be reserved for future claims.", 0, 1,
17036        fundsReserveRequested));
17037    children.add(new Property("fundsReserve", "CodeableConcept",
17038        "A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.",
17039        0, 1, fundsReserve));
17040    children.add(new Property("related", "",
17041        "Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.",
17042        0, java.lang.Integer.MAX_VALUE, related));
17043    children.add(new Property("prescription", "Reference(MedicationRequest|VisionPrescription)",
17044        "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription));
17045    children.add(new Property("originalPrescription", "Reference(MedicationRequest)",
17046        "Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.",
17047        0, 1, originalPrescription));
17048    children.add(new Property("payee", "",
17049        "The party to be reimbursed for cost of the products and services according to the terms of the policy.", 0, 1,
17050        payee));
17051    children.add(
17052        new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral));
17053    children.add(
17054        new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility));
17055    children.add(new Property("claim", "Reference(Claim)",
17056        "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.",
17057        0, 1, claim));
17058    children.add(new Property("claimResponse", "Reference(ClaimResponse)",
17059        "The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.",
17060        0, 1, claimResponse));
17061    children.add(new Property("outcome", "code",
17062        "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome));
17063    children.add(new Property("disposition", "string",
17064        "A human readable description of the status of the adjudication.", 0, 1, disposition));
17065    children.add(new Property("preAuthRef", "string",
17066        "Reference from the Insurer which is used in later communications which refers to this adjudication.", 0,
17067        java.lang.Integer.MAX_VALUE, preAuthRef));
17068    children.add(new Property("preAuthRefPeriod", "Period",
17069        "The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.",
17070        0, java.lang.Integer.MAX_VALUE, preAuthRefPeriod));
17071    children.add(new Property("careTeam", "", "The members of the team who provided the products and services.", 0,
17072        java.lang.Integer.MAX_VALUE, careTeam));
17073    children.add(new Property("supportingInfo", "",
17074        "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.",
17075        0, java.lang.Integer.MAX_VALUE, supportingInfo));
17076    children.add(new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0,
17077        java.lang.Integer.MAX_VALUE, diagnosis));
17078    children.add(new Property("procedure", "",
17079        "Procedures performed on the patient relevant to the billing items with the claim.", 0,
17080        java.lang.Integer.MAX_VALUE, procedure));
17081    children.add(new Property("precedence", "positiveInt",
17082        "This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.",
17083        0, 1, precedence));
17084    children.add(new Property("insurance", "",
17085        "Financial instruments for reimbursement for the health care products and services specified on the claim.", 0,
17086        java.lang.Integer.MAX_VALUE, insurance));
17087    children.add(new Property("accident", "",
17088        "Details of a accident which resulted in injuries which required the products and services listed in the claim.",
17089        0, 1, accident));
17090    children.add(new Property("item", "",
17091        "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.",
17092        0, java.lang.Integer.MAX_VALUE, item));
17093    children.add(
17094        new Property("addItem", "", "The first-tier service adjudications for payor added product or service lines.", 0,
17095            java.lang.Integer.MAX_VALUE, addItem));
17096    children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
17097        "The adjudication results which are presented at the header level rather than at the line-item or add-item levels.",
17098        0, java.lang.Integer.MAX_VALUE, adjudication));
17099    children.add(new Property("total", "", "Categorized monetary totals for the adjudication.", 0,
17100        java.lang.Integer.MAX_VALUE, total));
17101    children.add(new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment));
17102    children.add(new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.",
17103        0, 1, formCode));
17104    children.add(new Property("form", "Attachment",
17105        "The actual form, by reference or inclusion, for printing the content or an EOB.", 0, 1, form));
17106    children.add(new Property("processNote", "",
17107        "A note that describes or explains adjudication results in a human readable form.", 0,
17108        java.lang.Integer.MAX_VALUE, processNote));
17109    children.add(new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1,
17110        benefitPeriod));
17111    children.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE,
17112        benefitBalance));
17113  }
17114
17115  @Override
17116  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
17117    switch (_hash) {
17118    case -1618432855:
17119      /* identifier */ return new Property("identifier", "Identifier",
17120          "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier);
17121    case -892481550:
17122      /* status */ return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
17123    case 3575610:
17124      /* type */ return new Property("type", "CodeableConcept",
17125          "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type);
17126    case -1868521062:
17127      /* subType */ return new Property("subType", "CodeableConcept",
17128          "A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.",
17129          0, 1, subType);
17130    case 116103:
17131      /* use */ return new Property("use", "code",
17132          "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.",
17133          0, 1, use);
17134    case -791418107:
17135      /* patient */ return new Property("patient", "Reference(Patient)",
17136          "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.",
17137          0, 1, patient);
17138    case -332066046:
17139      /* billablePeriod */ return new Property("billablePeriod", "Period",
17140          "The period for which charges are being submitted.", 0, 1, billablePeriod);
17141    case 1028554472:
17142      /* created */ return new Property("created", "dateTime", "The date this resource was created.", 0, 1, created);
17143    case -1591951995:
17144      /* enterer */ return new Property("enterer", "Reference(Practitioner|PractitionerRole)",
17145          "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer);
17146    case 1957615864:
17147      /* insurer */ return new Property("insurer", "Reference(Organization)",
17148          "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer);
17149    case -987494927:
17150      /* provider */ return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
17151          "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider);
17152    case -1165461084:
17153      /* priority */ return new Property("priority", "CodeableConcept",
17154          "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.", 0,
17155          1, priority);
17156    case -1688904576:
17157      /* fundsReserveRequested */ return new Property("fundsReserveRequested", "CodeableConcept",
17158          "A code to indicate whether and for whom funds are to be reserved for future claims.", 0, 1,
17159          fundsReserveRequested);
17160    case 1314609806:
17161      /* fundsReserve */ return new Property("fundsReserve", "CodeableConcept",
17162          "A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.",
17163          0, 1, fundsReserve);
17164    case 1090493483:
17165      /* related */ return new Property("related", "",
17166          "Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.",
17167          0, java.lang.Integer.MAX_VALUE, related);
17168    case 460301338:
17169      /* prescription */ return new Property("prescription", "Reference(MedicationRequest|VisionPrescription)",
17170          "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription);
17171    case -1814015861:
17172      /* originalPrescription */ return new Property("originalPrescription", "Reference(MedicationRequest)",
17173          "Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.",
17174          0, 1, originalPrescription);
17175    case 106443592:
17176      /* payee */ return new Property("payee", "",
17177          "The party to be reimbursed for cost of the products and services according to the terms of the policy.", 0,
17178          1, payee);
17179    case -722568291:
17180      /* referral */ return new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.",
17181          0, 1, referral);
17182    case 501116579:
17183      /* facility */ return new Property("facility", "Reference(Location)",
17184          "Facility where the services were provided.", 0, 1, facility);
17185    case 94742588:
17186      /* claim */ return new Property("claim", "Reference(Claim)",
17187          "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.",
17188          0, 1, claim);
17189    case 689513629:
17190      /* claimResponse */ return new Property("claimResponse", "Reference(ClaimResponse)",
17191          "The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.",
17192          0, 1, claimResponse);
17193    case -1106507950:
17194      /* outcome */ return new Property("outcome", "code",
17195          "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome);
17196    case 583380919:
17197      /* disposition */ return new Property("disposition", "string",
17198          "A human readable description of the status of the adjudication.", 0, 1, disposition);
17199    case 522246568:
17200      /* preAuthRef */ return new Property("preAuthRef", "string",
17201          "Reference from the Insurer which is used in later communications which refers to this adjudication.", 0,
17202          java.lang.Integer.MAX_VALUE, preAuthRef);
17203    case -1262920311:
17204      /* preAuthRefPeriod */ return new Property("preAuthRefPeriod", "Period",
17205          "The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.",
17206          0, java.lang.Integer.MAX_VALUE, preAuthRefPeriod);
17207    case -7323378:
17208      /* careTeam */ return new Property("careTeam", "",
17209          "The members of the team who provided the products and services.", 0, java.lang.Integer.MAX_VALUE, careTeam);
17210    case 1922406657:
17211      /* supportingInfo */ return new Property("supportingInfo", "",
17212          "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.",
17213          0, java.lang.Integer.MAX_VALUE, supportingInfo);
17214    case 1196993265:
17215      /* diagnosis */ return new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.",
17216          0, java.lang.Integer.MAX_VALUE, diagnosis);
17217    case -1095204141:
17218      /* procedure */ return new Property("procedure", "",
17219          "Procedures performed on the patient relevant to the billing items with the claim.", 0,
17220          java.lang.Integer.MAX_VALUE, procedure);
17221    case 159695370:
17222      /* precedence */ return new Property("precedence", "positiveInt",
17223          "This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.",
17224          0, 1, precedence);
17225    case 73049818:
17226      /* insurance */ return new Property("insurance", "",
17227          "Financial instruments for reimbursement for the health care products and services specified on the claim.",
17228          0, java.lang.Integer.MAX_VALUE, insurance);
17229    case -2143202801:
17230      /* accident */ return new Property("accident", "",
17231          "Details of a accident which resulted in injuries which required the products and services listed in the claim.",
17232          0, 1, accident);
17233    case 3242771:
17234      /* item */ return new Property("item", "",
17235          "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.",
17236          0, java.lang.Integer.MAX_VALUE, item);
17237    case -1148899500:
17238      /* addItem */ return new Property("addItem", "",
17239          "The first-tier service adjudications for payor added product or service lines.", 0,
17240          java.lang.Integer.MAX_VALUE, addItem);
17241    case -231349275:
17242      /* adjudication */ return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
17243          "The adjudication results which are presented at the header level rather than at the line-item or add-item levels.",
17244          0, java.lang.Integer.MAX_VALUE, adjudication);
17245    case 110549828:
17246      /* total */ return new Property("total", "", "Categorized monetary totals for the adjudication.", 0,
17247          java.lang.Integer.MAX_VALUE, total);
17248    case -786681338:
17249      /* payment */ return new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1,
17250          payment);
17251    case 473181393:
17252      /* formCode */ return new Property("formCode", "CodeableConcept",
17253          "A code for the form to be used for printing the content.", 0, 1, formCode);
17254    case 3148996:
17255      /* form */ return new Property("form", "Attachment",
17256          "The actual form, by reference or inclusion, for printing the content or an EOB.", 0, 1, form);
17257    case 202339073:
17258      /* processNote */ return new Property("processNote", "",
17259          "A note that describes or explains adjudication results in a human readable form.", 0,
17260          java.lang.Integer.MAX_VALUE, processNote);
17261    case -407369416:
17262      /* benefitPeriod */ return new Property("benefitPeriod", "Period",
17263          "The term of the benefits documented in this response.", 0, 1, benefitPeriod);
17264    case 596003397:
17265      /* benefitBalance */ return new Property("benefitBalance", "", "Balance by Benefit Category.", 0,
17266          java.lang.Integer.MAX_VALUE, benefitBalance);
17267    default:
17268      return super.getNamedProperty(_hash, _name, _checkValid);
17269    }
17270
17271  }
17272
17273  @Override
17274  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
17275    switch (hash) {
17276    case -1618432855:
17277      /* identifier */ return this.identifier == null ? new Base[0]
17278          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
17279    case -892481550:
17280      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<ExplanationOfBenefitStatus>
17281    case 3575610:
17282      /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
17283    case -1868521062:
17284      /* subType */ return this.subType == null ? new Base[0] : new Base[] { this.subType }; // CodeableConcept
17285    case 116103:
17286      /* use */ return this.use == null ? new Base[0] : new Base[] { this.use }; // Enumeration<Use>
17287    case -791418107:
17288      /* patient */ return this.patient == null ? new Base[0] : new Base[] { this.patient }; // Reference
17289    case -332066046:
17290      /* billablePeriod */ return this.billablePeriod == null ? new Base[0] : new Base[] { this.billablePeriod }; // Period
17291    case 1028554472:
17292      /* created */ return this.created == null ? new Base[0] : new Base[] { this.created }; // DateTimeType
17293    case -1591951995:
17294      /* enterer */ return this.enterer == null ? new Base[0] : new Base[] { this.enterer }; // Reference
17295    case 1957615864:
17296      /* insurer */ return this.insurer == null ? new Base[0] : new Base[] { this.insurer }; // Reference
17297    case -987494927:
17298      /* provider */ return this.provider == null ? new Base[0] : new Base[] { this.provider }; // Reference
17299    case -1165461084:
17300      /* priority */ return this.priority == null ? new Base[0] : new Base[] { this.priority }; // CodeableConcept
17301    case -1688904576:
17302      /* fundsReserveRequested */ return this.fundsReserveRequested == null ? new Base[0]
17303          : new Base[] { this.fundsReserveRequested }; // CodeableConcept
17304    case 1314609806:
17305      /* fundsReserve */ return this.fundsReserve == null ? new Base[0] : new Base[] { this.fundsReserve }; // CodeableConcept
17306    case 1090493483:
17307      /* related */ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimComponent
17308    case 460301338:
17309      /* prescription */ return this.prescription == null ? new Base[0] : new Base[] { this.prescription }; // Reference
17310    case -1814015861:
17311      /* originalPrescription */ return this.originalPrescription == null ? new Base[0]
17312          : new Base[] { this.originalPrescription }; // Reference
17313    case 106443592:
17314      /* payee */ return this.payee == null ? new Base[0] : new Base[] { this.payee }; // PayeeComponent
17315    case -722568291:
17316      /* referral */ return this.referral == null ? new Base[0] : new Base[] { this.referral }; // Reference
17317    case 501116579:
17318      /* facility */ return this.facility == null ? new Base[0] : new Base[] { this.facility }; // Reference
17319    case 94742588:
17320      /* claim */ return this.claim == null ? new Base[0] : new Base[] { this.claim }; // Reference
17321    case 689513629:
17322      /* claimResponse */ return this.claimResponse == null ? new Base[0] : new Base[] { this.claimResponse }; // Reference
17323    case -1106507950:
17324      /* outcome */ return this.outcome == null ? new Base[0] : new Base[] { this.outcome }; // Enumeration<RemittanceOutcome>
17325    case 583380919:
17326      /* disposition */ return this.disposition == null ? new Base[0] : new Base[] { this.disposition }; // StringType
17327    case 522246568:
17328      /* preAuthRef */ return this.preAuthRef == null ? new Base[0]
17329          : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
17330    case -1262920311:
17331      /* preAuthRefPeriod */ return this.preAuthRefPeriod == null ? new Base[0]
17332          : this.preAuthRefPeriod.toArray(new Base[this.preAuthRefPeriod.size()]); // Period
17333    case -7323378:
17334      /* careTeam */ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // CareTeamComponent
17335    case 1922406657:
17336      /* supportingInfo */ return this.supportingInfo == null ? new Base[0]
17337          : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // SupportingInformationComponent
17338    case 1196993265:
17339      /* diagnosis */ return this.diagnosis == null ? new Base[0]
17340          : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
17341    case -1095204141:
17342      /* procedure */ return this.procedure == null ? new Base[0]
17343          : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
17344    case 159695370:
17345      /* precedence */ return this.precedence == null ? new Base[0] : new Base[] { this.precedence }; // PositiveIntType
17346    case 73049818:
17347      /* insurance */ return this.insurance == null ? new Base[0]
17348          : this.insurance.toArray(new Base[this.insurance.size()]); // InsuranceComponent
17349    case -2143202801:
17350      /* accident */ return this.accident == null ? new Base[0] : new Base[] { this.accident }; // AccidentComponent
17351    case 3242771:
17352      /* item */ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
17353    case -1148899500:
17354      /* addItem */ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
17355    case -231349275:
17356      /* adjudication */ return this.adjudication == null ? new Base[0]
17357          : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
17358    case 110549828:
17359      /* total */ return this.total == null ? new Base[0] : this.total.toArray(new Base[this.total.size()]); // TotalComponent
17360    case -786681338:
17361      /* payment */ return this.payment == null ? new Base[0] : new Base[] { this.payment }; // PaymentComponent
17362    case 473181393:
17363      /* formCode */ return this.formCode == null ? new Base[0] : new Base[] { this.formCode }; // CodeableConcept
17364    case 3148996:
17365      /* form */ return this.form == null ? new Base[0] : new Base[] { this.form }; // Attachment
17366    case 202339073:
17367      /* processNote */ return this.processNote == null ? new Base[0]
17368          : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
17369    case -407369416:
17370      /* benefitPeriod */ return this.benefitPeriod == null ? new Base[0] : new Base[] { this.benefitPeriod }; // Period
17371    case 596003397:
17372      /* benefitBalance */ return this.benefitBalance == null ? new Base[0]
17373          : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
17374    default:
17375      return super.getProperty(hash, name, checkValid);
17376    }
17377
17378  }
17379
17380  @Override
17381  public Base setProperty(int hash, String name, Base value) throws FHIRException {
17382    switch (hash) {
17383    case -1618432855: // identifier
17384      this.getIdentifier().add(castToIdentifier(value)); // Identifier
17385      return value;
17386    case -892481550: // status
17387      value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
17388      this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
17389      return value;
17390    case 3575610: // type
17391      this.type = castToCodeableConcept(value); // CodeableConcept
17392      return value;
17393    case -1868521062: // subType
17394      this.subType = castToCodeableConcept(value); // CodeableConcept
17395      return value;
17396    case 116103: // use
17397      value = new UseEnumFactory().fromType(castToCode(value));
17398      this.use = (Enumeration) value; // Enumeration<Use>
17399      return value;
17400    case -791418107: // patient
17401      this.patient = castToReference(value); // Reference
17402      return value;
17403    case -332066046: // billablePeriod
17404      this.billablePeriod = castToPeriod(value); // Period
17405      return value;
17406    case 1028554472: // created
17407      this.created = castToDateTime(value); // DateTimeType
17408      return value;
17409    case -1591951995: // enterer
17410      this.enterer = castToReference(value); // Reference
17411      return value;
17412    case 1957615864: // insurer
17413      this.insurer = castToReference(value); // Reference
17414      return value;
17415    case -987494927: // provider
17416      this.provider = castToReference(value); // Reference
17417      return value;
17418    case -1165461084: // priority
17419      this.priority = castToCodeableConcept(value); // CodeableConcept
17420      return value;
17421    case -1688904576: // fundsReserveRequested
17422      this.fundsReserveRequested = castToCodeableConcept(value); // CodeableConcept
17423      return value;
17424    case 1314609806: // fundsReserve
17425      this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
17426      return value;
17427    case 1090493483: // related
17428      this.getRelated().add((RelatedClaimComponent) value); // RelatedClaimComponent
17429      return value;
17430    case 460301338: // prescription
17431      this.prescription = castToReference(value); // Reference
17432      return value;
17433    case -1814015861: // originalPrescription
17434      this.originalPrescription = castToReference(value); // Reference
17435      return value;
17436    case 106443592: // payee
17437      this.payee = (PayeeComponent) value; // PayeeComponent
17438      return value;
17439    case -722568291: // referral
17440      this.referral = castToReference(value); // Reference
17441      return value;
17442    case 501116579: // facility
17443      this.facility = castToReference(value); // Reference
17444      return value;
17445    case 94742588: // claim
17446      this.claim = castToReference(value); // Reference
17447      return value;
17448    case 689513629: // claimResponse
17449      this.claimResponse = castToReference(value); // Reference
17450      return value;
17451    case -1106507950: // outcome
17452      value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
17453      this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
17454      return value;
17455    case 583380919: // disposition
17456      this.disposition = castToString(value); // StringType
17457      return value;
17458    case 522246568: // preAuthRef
17459      this.getPreAuthRef().add(castToString(value)); // StringType
17460      return value;
17461    case -1262920311: // preAuthRefPeriod
17462      this.getPreAuthRefPeriod().add(castToPeriod(value)); // Period
17463      return value;
17464    case -7323378: // careTeam
17465      this.getCareTeam().add((CareTeamComponent) value); // CareTeamComponent
17466      return value;
17467    case 1922406657: // supportingInfo
17468      this.getSupportingInfo().add((SupportingInformationComponent) value); // SupportingInformationComponent
17469      return value;
17470    case 1196993265: // diagnosis
17471      this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
17472      return value;
17473    case -1095204141: // procedure
17474      this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
17475      return value;
17476    case 159695370: // precedence
17477      this.precedence = castToPositiveInt(value); // PositiveIntType
17478      return value;
17479    case 73049818: // insurance
17480      this.getInsurance().add((InsuranceComponent) value); // InsuranceComponent
17481      return value;
17482    case -2143202801: // accident
17483      this.accident = (AccidentComponent) value; // AccidentComponent
17484      return value;
17485    case 3242771: // item
17486      this.getItem().add((ItemComponent) value); // ItemComponent
17487      return value;
17488    case -1148899500: // addItem
17489      this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
17490      return value;
17491    case -231349275: // adjudication
17492      this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
17493      return value;
17494    case 110549828: // total
17495      this.getTotal().add((TotalComponent) value); // TotalComponent
17496      return value;
17497    case -786681338: // payment
17498      this.payment = (PaymentComponent) value; // PaymentComponent
17499      return value;
17500    case 473181393: // formCode
17501      this.formCode = castToCodeableConcept(value); // CodeableConcept
17502      return value;
17503    case 3148996: // form
17504      this.form = castToAttachment(value); // Attachment
17505      return value;
17506    case 202339073: // processNote
17507      this.getProcessNote().add((NoteComponent) value); // NoteComponent
17508      return value;
17509    case -407369416: // benefitPeriod
17510      this.benefitPeriod = castToPeriod(value); // Period
17511      return value;
17512    case 596003397: // benefitBalance
17513      this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
17514      return value;
17515    default:
17516      return super.setProperty(hash, name, value);
17517    }
17518
17519  }
17520
17521  @Override
17522  public Base setProperty(String name, Base value) throws FHIRException {
17523    if (name.equals("identifier")) {
17524      this.getIdentifier().add(castToIdentifier(value));
17525    } else if (name.equals("status")) {
17526      value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
17527      this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
17528    } else if (name.equals("type")) {
17529      this.type = castToCodeableConcept(value); // CodeableConcept
17530    } else if (name.equals("subType")) {
17531      this.subType = castToCodeableConcept(value); // CodeableConcept
17532    } else if (name.equals("use")) {
17533      value = new UseEnumFactory().fromType(castToCode(value));
17534      this.use = (Enumeration) value; // Enumeration<Use>
17535    } else if (name.equals("patient")) {
17536      this.patient = castToReference(value); // Reference
17537    } else if (name.equals("billablePeriod")) {
17538      this.billablePeriod = castToPeriod(value); // Period
17539    } else if (name.equals("created")) {
17540      this.created = castToDateTime(value); // DateTimeType
17541    } else if (name.equals("enterer")) {
17542      this.enterer = castToReference(value); // Reference
17543    } else if (name.equals("insurer")) {
17544      this.insurer = castToReference(value); // Reference
17545    } else if (name.equals("provider")) {
17546      this.provider = castToReference(value); // Reference
17547    } else if (name.equals("priority")) {
17548      this.priority = castToCodeableConcept(value); // CodeableConcept
17549    } else if (name.equals("fundsReserveRequested")) {
17550      this.fundsReserveRequested = castToCodeableConcept(value); // CodeableConcept
17551    } else if (name.equals("fundsReserve")) {
17552      this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
17553    } else if (name.equals("related")) {
17554      this.getRelated().add((RelatedClaimComponent) value);
17555    } else if (name.equals("prescription")) {
17556      this.prescription = castToReference(value); // Reference
17557    } else if (name.equals("originalPrescription")) {
17558      this.originalPrescription = castToReference(value); // Reference
17559    } else if (name.equals("payee")) {
17560      this.payee = (PayeeComponent) value; // PayeeComponent
17561    } else if (name.equals("referral")) {
17562      this.referral = castToReference(value); // Reference
17563    } else if (name.equals("facility")) {
17564      this.facility = castToReference(value); // Reference
17565    } else if (name.equals("claim")) {
17566      this.claim = castToReference(value); // Reference
17567    } else if (name.equals("claimResponse")) {
17568      this.claimResponse = castToReference(value); // Reference
17569    } else if (name.equals("outcome")) {
17570      value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
17571      this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
17572    } else if (name.equals("disposition")) {
17573      this.disposition = castToString(value); // StringType
17574    } else if (name.equals("preAuthRef")) {
17575      this.getPreAuthRef().add(castToString(value));
17576    } else if (name.equals("preAuthRefPeriod")) {
17577      this.getPreAuthRefPeriod().add(castToPeriod(value));
17578    } else if (name.equals("careTeam")) {
17579      this.getCareTeam().add((CareTeamComponent) value);
17580    } else if (name.equals("supportingInfo")) {
17581      this.getSupportingInfo().add((SupportingInformationComponent) value);
17582    } else if (name.equals("diagnosis")) {
17583      this.getDiagnosis().add((DiagnosisComponent) value);
17584    } else if (name.equals("procedure")) {
17585      this.getProcedure().add((ProcedureComponent) value);
17586    } else if (name.equals("precedence")) {
17587      this.precedence = castToPositiveInt(value); // PositiveIntType
17588    } else if (name.equals("insurance")) {
17589      this.getInsurance().add((InsuranceComponent) value);
17590    } else if (name.equals("accident")) {
17591      this.accident = (AccidentComponent) value; // AccidentComponent
17592    } else if (name.equals("item")) {
17593      this.getItem().add((ItemComponent) value);
17594    } else if (name.equals("addItem")) {
17595      this.getAddItem().add((AddedItemComponent) value);
17596    } else if (name.equals("adjudication")) {
17597      this.getAdjudication().add((AdjudicationComponent) value);
17598    } else if (name.equals("total")) {
17599      this.getTotal().add((TotalComponent) value);
17600    } else if (name.equals("payment")) {
17601      this.payment = (PaymentComponent) value; // PaymentComponent
17602    } else if (name.equals("formCode")) {
17603      this.formCode = castToCodeableConcept(value); // CodeableConcept
17604    } else if (name.equals("form")) {
17605      this.form = castToAttachment(value); // Attachment
17606    } else if (name.equals("processNote")) {
17607      this.getProcessNote().add((NoteComponent) value);
17608    } else if (name.equals("benefitPeriod")) {
17609      this.benefitPeriod = castToPeriod(value); // Period
17610    } else if (name.equals("benefitBalance")) {
17611      this.getBenefitBalance().add((BenefitBalanceComponent) value);
17612    } else
17613      return super.setProperty(name, value);
17614    return value;
17615  }
17616
17617  @Override
17618  public Base makeProperty(int hash, String name) throws FHIRException {
17619    switch (hash) {
17620    case -1618432855:
17621      return addIdentifier();
17622    case -892481550:
17623      return getStatusElement();
17624    case 3575610:
17625      return getType();
17626    case -1868521062:
17627      return getSubType();
17628    case 116103:
17629      return getUseElement();
17630    case -791418107:
17631      return getPatient();
17632    case -332066046:
17633      return getBillablePeriod();
17634    case 1028554472:
17635      return getCreatedElement();
17636    case -1591951995:
17637      return getEnterer();
17638    case 1957615864:
17639      return getInsurer();
17640    case -987494927:
17641      return getProvider();
17642    case -1165461084:
17643      return getPriority();
17644    case -1688904576:
17645      return getFundsReserveRequested();
17646    case 1314609806:
17647      return getFundsReserve();
17648    case 1090493483:
17649      return addRelated();
17650    case 460301338:
17651      return getPrescription();
17652    case -1814015861:
17653      return getOriginalPrescription();
17654    case 106443592:
17655      return getPayee();
17656    case -722568291:
17657      return getReferral();
17658    case 501116579:
17659      return getFacility();
17660    case 94742588:
17661      return getClaim();
17662    case 689513629:
17663      return getClaimResponse();
17664    case -1106507950:
17665      return getOutcomeElement();
17666    case 583380919:
17667      return getDispositionElement();
17668    case 522246568:
17669      return addPreAuthRefElement();
17670    case -1262920311:
17671      return addPreAuthRefPeriod();
17672    case -7323378:
17673      return addCareTeam();
17674    case 1922406657:
17675      return addSupportingInfo();
17676    case 1196993265:
17677      return addDiagnosis();
17678    case -1095204141:
17679      return addProcedure();
17680    case 159695370:
17681      return getPrecedenceElement();
17682    case 73049818:
17683      return addInsurance();
17684    case -2143202801:
17685      return getAccident();
17686    case 3242771:
17687      return addItem();
17688    case -1148899500:
17689      return addAddItem();
17690    case -231349275:
17691      return addAdjudication();
17692    case 110549828:
17693      return addTotal();
17694    case -786681338:
17695      return getPayment();
17696    case 473181393:
17697      return getFormCode();
17698    case 3148996:
17699      return getForm();
17700    case 202339073:
17701      return addProcessNote();
17702    case -407369416:
17703      return getBenefitPeriod();
17704    case 596003397:
17705      return addBenefitBalance();
17706    default:
17707      return super.makeProperty(hash, name);
17708    }
17709
17710  }
17711
17712  @Override
17713  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
17714    switch (hash) {
17715    case -1618432855:
17716      /* identifier */ return new String[] { "Identifier" };
17717    case -892481550:
17718      /* status */ return new String[] { "code" };
17719    case 3575610:
17720      /* type */ return new String[] { "CodeableConcept" };
17721    case -1868521062:
17722      /* subType */ return new String[] { "CodeableConcept" };
17723    case 116103:
17724      /* use */ return new String[] { "code" };
17725    case -791418107:
17726      /* patient */ return new String[] { "Reference" };
17727    case -332066046:
17728      /* billablePeriod */ return new String[] { "Period" };
17729    case 1028554472:
17730      /* created */ return new String[] { "dateTime" };
17731    case -1591951995:
17732      /* enterer */ return new String[] { "Reference" };
17733    case 1957615864:
17734      /* insurer */ return new String[] { "Reference" };
17735    case -987494927:
17736      /* provider */ return new String[] { "Reference" };
17737    case -1165461084:
17738      /* priority */ return new String[] { "CodeableConcept" };
17739    case -1688904576:
17740      /* fundsReserveRequested */ return new String[] { "CodeableConcept" };
17741    case 1314609806:
17742      /* fundsReserve */ return new String[] { "CodeableConcept" };
17743    case 1090493483:
17744      /* related */ return new String[] {};
17745    case 460301338:
17746      /* prescription */ return new String[] { "Reference" };
17747    case -1814015861:
17748      /* originalPrescription */ return new String[] { "Reference" };
17749    case 106443592:
17750      /* payee */ return new String[] {};
17751    case -722568291:
17752      /* referral */ return new String[] { "Reference" };
17753    case 501116579:
17754      /* facility */ return new String[] { "Reference" };
17755    case 94742588:
17756      /* claim */ return new String[] { "Reference" };
17757    case 689513629:
17758      /* claimResponse */ return new String[] { "Reference" };
17759    case -1106507950:
17760      /* outcome */ return new String[] { "code" };
17761    case 583380919:
17762      /* disposition */ return new String[] { "string" };
17763    case 522246568:
17764      /* preAuthRef */ return new String[] { "string" };
17765    case -1262920311:
17766      /* preAuthRefPeriod */ return new String[] { "Period" };
17767    case -7323378:
17768      /* careTeam */ return new String[] {};
17769    case 1922406657:
17770      /* supportingInfo */ return new String[] {};
17771    case 1196993265:
17772      /* diagnosis */ return new String[] {};
17773    case -1095204141:
17774      /* procedure */ return new String[] {};
17775    case 159695370:
17776      /* precedence */ return new String[] { "positiveInt" };
17777    case 73049818:
17778      /* insurance */ return new String[] {};
17779    case -2143202801:
17780      /* accident */ return new String[] {};
17781    case 3242771:
17782      /* item */ return new String[] {};
17783    case -1148899500:
17784      /* addItem */ return new String[] {};
17785    case -231349275:
17786      /* adjudication */ return new String[] { "@ExplanationOfBenefit.item.adjudication" };
17787    case 110549828:
17788      /* total */ return new String[] {};
17789    case -786681338:
17790      /* payment */ return new String[] {};
17791    case 473181393:
17792      /* formCode */ return new String[] { "CodeableConcept" };
17793    case 3148996:
17794      /* form */ return new String[] { "Attachment" };
17795    case 202339073:
17796      /* processNote */ return new String[] {};
17797    case -407369416:
17798      /* benefitPeriod */ return new String[] { "Period" };
17799    case 596003397:
17800      /* benefitBalance */ return new String[] {};
17801    default:
17802      return super.getTypesForProperty(hash, name);
17803    }
17804
17805  }
17806
17807  @Override
17808  public Base addChild(String name) throws FHIRException {
17809    if (name.equals("identifier")) {
17810      return addIdentifier();
17811    } else if (name.equals("status")) {
17812      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.status");
17813    } else if (name.equals("type")) {
17814      this.type = new CodeableConcept();
17815      return this.type;
17816    } else if (name.equals("subType")) {
17817      this.subType = new CodeableConcept();
17818      return this.subType;
17819    } else if (name.equals("use")) {
17820      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.use");
17821    } else if (name.equals("patient")) {
17822      this.patient = new Reference();
17823      return this.patient;
17824    } else if (name.equals("billablePeriod")) {
17825      this.billablePeriod = new Period();
17826      return this.billablePeriod;
17827    } else if (name.equals("created")) {
17828      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.created");
17829    } else if (name.equals("enterer")) {
17830      this.enterer = new Reference();
17831      return this.enterer;
17832    } else if (name.equals("insurer")) {
17833      this.insurer = new Reference();
17834      return this.insurer;
17835    } else if (name.equals("provider")) {
17836      this.provider = new Reference();
17837      return this.provider;
17838    } else if (name.equals("priority")) {
17839      this.priority = new CodeableConcept();
17840      return this.priority;
17841    } else if (name.equals("fundsReserveRequested")) {
17842      this.fundsReserveRequested = new CodeableConcept();
17843      return this.fundsReserveRequested;
17844    } else if (name.equals("fundsReserve")) {
17845      this.fundsReserve = new CodeableConcept();
17846      return this.fundsReserve;
17847    } else if (name.equals("related")) {
17848      return addRelated();
17849    } else if (name.equals("prescription")) {
17850      this.prescription = new Reference();
17851      return this.prescription;
17852    } else if (name.equals("originalPrescription")) {
17853      this.originalPrescription = new Reference();
17854      return this.originalPrescription;
17855    } else if (name.equals("payee")) {
17856      this.payee = new PayeeComponent();
17857      return this.payee;
17858    } else if (name.equals("referral")) {
17859      this.referral = new Reference();
17860      return this.referral;
17861    } else if (name.equals("facility")) {
17862      this.facility = new Reference();
17863      return this.facility;
17864    } else if (name.equals("claim")) {
17865      this.claim = new Reference();
17866      return this.claim;
17867    } else if (name.equals("claimResponse")) {
17868      this.claimResponse = new Reference();
17869      return this.claimResponse;
17870    } else if (name.equals("outcome")) {
17871      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.outcome");
17872    } else if (name.equals("disposition")) {
17873      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.disposition");
17874    } else if (name.equals("preAuthRef")) {
17875      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.preAuthRef");
17876    } else if (name.equals("preAuthRefPeriod")) {
17877      return addPreAuthRefPeriod();
17878    } else if (name.equals("careTeam")) {
17879      return addCareTeam();
17880    } else if (name.equals("supportingInfo")) {
17881      return addSupportingInfo();
17882    } else if (name.equals("diagnosis")) {
17883      return addDiagnosis();
17884    } else if (name.equals("procedure")) {
17885      return addProcedure();
17886    } else if (name.equals("precedence")) {
17887      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.precedence");
17888    } else if (name.equals("insurance")) {
17889      return addInsurance();
17890    } else if (name.equals("accident")) {
17891      this.accident = new AccidentComponent();
17892      return this.accident;
17893    } else if (name.equals("item")) {
17894      return addItem();
17895    } else if (name.equals("addItem")) {
17896      return addAddItem();
17897    } else if (name.equals("adjudication")) {
17898      return addAdjudication();
17899    } else if (name.equals("total")) {
17900      return addTotal();
17901    } else if (name.equals("payment")) {
17902      this.payment = new PaymentComponent();
17903      return this.payment;
17904    } else if (name.equals("formCode")) {
17905      this.formCode = new CodeableConcept();
17906      return this.formCode;
17907    } else if (name.equals("form")) {
17908      this.form = new Attachment();
17909      return this.form;
17910    } else if (name.equals("processNote")) {
17911      return addProcessNote();
17912    } else if (name.equals("benefitPeriod")) {
17913      this.benefitPeriod = new Period();
17914      return this.benefitPeriod;
17915    } else if (name.equals("benefitBalance")) {
17916      return addBenefitBalance();
17917    } else
17918      return super.addChild(name);
17919  }
17920
17921  public String fhirType() {
17922    return "ExplanationOfBenefit";
17923
17924  }
17925
17926  public ExplanationOfBenefit copy() {
17927    ExplanationOfBenefit dst = new ExplanationOfBenefit();
17928    copyValues(dst);
17929    return dst;
17930  }
17931
17932  public void copyValues(ExplanationOfBenefit dst) {
17933    super.copyValues(dst);
17934    if (identifier != null) {
17935      dst.identifier = new ArrayList<Identifier>();
17936      for (Identifier i : identifier)
17937        dst.identifier.add(i.copy());
17938    }
17939    ;
17940    dst.status = status == null ? null : status.copy();
17941    dst.type = type == null ? null : type.copy();
17942    dst.subType = subType == null ? null : subType.copy();
17943    dst.use = use == null ? null : use.copy();
17944    dst.patient = patient == null ? null : patient.copy();
17945    dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
17946    dst.created = created == null ? null : created.copy();
17947    dst.enterer = enterer == null ? null : enterer.copy();
17948    dst.insurer = insurer == null ? null : insurer.copy();
17949    dst.provider = provider == null ? null : provider.copy();
17950    dst.priority = priority == null ? null : priority.copy();
17951    dst.fundsReserveRequested = fundsReserveRequested == null ? null : fundsReserveRequested.copy();
17952    dst.fundsReserve = fundsReserve == null ? null : fundsReserve.copy();
17953    if (related != null) {
17954      dst.related = new ArrayList<RelatedClaimComponent>();
17955      for (RelatedClaimComponent i : related)
17956        dst.related.add(i.copy());
17957    }
17958    ;
17959    dst.prescription = prescription == null ? null : prescription.copy();
17960    dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
17961    dst.payee = payee == null ? null : payee.copy();
17962    dst.referral = referral == null ? null : referral.copy();
17963    dst.facility = facility == null ? null : facility.copy();
17964    dst.claim = claim == null ? null : claim.copy();
17965    dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
17966    dst.outcome = outcome == null ? null : outcome.copy();
17967    dst.disposition = disposition == null ? null : disposition.copy();
17968    if (preAuthRef != null) {
17969      dst.preAuthRef = new ArrayList<StringType>();
17970      for (StringType i : preAuthRef)
17971        dst.preAuthRef.add(i.copy());
17972    }
17973    ;
17974    if (preAuthRefPeriod != null) {
17975      dst.preAuthRefPeriod = new ArrayList<Period>();
17976      for (Period i : preAuthRefPeriod)
17977        dst.preAuthRefPeriod.add(i.copy());
17978    }
17979    ;
17980    if (careTeam != null) {
17981      dst.careTeam = new ArrayList<CareTeamComponent>();
17982      for (CareTeamComponent i : careTeam)
17983        dst.careTeam.add(i.copy());
17984    }
17985    ;
17986    if (supportingInfo != null) {
17987      dst.supportingInfo = new ArrayList<SupportingInformationComponent>();
17988      for (SupportingInformationComponent i : supportingInfo)
17989        dst.supportingInfo.add(i.copy());
17990    }
17991    ;
17992    if (diagnosis != null) {
17993      dst.diagnosis = new ArrayList<DiagnosisComponent>();
17994      for (DiagnosisComponent i : diagnosis)
17995        dst.diagnosis.add(i.copy());
17996    }
17997    ;
17998    if (procedure != null) {
17999      dst.procedure = new ArrayList<ProcedureComponent>();
18000      for (ProcedureComponent i : procedure)
18001        dst.procedure.add(i.copy());
18002    }
18003    ;
18004    dst.precedence = precedence == null ? null : precedence.copy();
18005    if (insurance != null) {
18006      dst.insurance = new ArrayList<InsuranceComponent>();
18007      for (InsuranceComponent i : insurance)
18008        dst.insurance.add(i.copy());
18009    }
18010    ;
18011    dst.accident = accident == null ? null : accident.copy();
18012    if (item != null) {
18013      dst.item = new ArrayList<ItemComponent>();
18014      for (ItemComponent i : item)
18015        dst.item.add(i.copy());
18016    }
18017    ;
18018    if (addItem != null) {
18019      dst.addItem = new ArrayList<AddedItemComponent>();
18020      for (AddedItemComponent i : addItem)
18021        dst.addItem.add(i.copy());
18022    }
18023    ;
18024    if (adjudication != null) {
18025      dst.adjudication = new ArrayList<AdjudicationComponent>();
18026      for (AdjudicationComponent i : adjudication)
18027        dst.adjudication.add(i.copy());
18028    }
18029    ;
18030    if (total != null) {
18031      dst.total = new ArrayList<TotalComponent>();
18032      for (TotalComponent i : total)
18033        dst.total.add(i.copy());
18034    }
18035    ;
18036    dst.payment = payment == null ? null : payment.copy();
18037    dst.formCode = formCode == null ? null : formCode.copy();
18038    dst.form = form == null ? null : form.copy();
18039    if (processNote != null) {
18040      dst.processNote = new ArrayList<NoteComponent>();
18041      for (NoteComponent i : processNote)
18042        dst.processNote.add(i.copy());
18043    }
18044    ;
18045    dst.benefitPeriod = benefitPeriod == null ? null : benefitPeriod.copy();
18046    if (benefitBalance != null) {
18047      dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
18048      for (BenefitBalanceComponent i : benefitBalance)
18049        dst.benefitBalance.add(i.copy());
18050    }
18051    ;
18052  }
18053
18054  protected ExplanationOfBenefit typedCopy() {
18055    return copy();
18056  }
18057
18058  @Override
18059  public boolean equalsDeep(Base other_) {
18060    if (!super.equalsDeep(other_))
18061      return false;
18062    if (!(other_ instanceof ExplanationOfBenefit))
18063      return false;
18064    ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
18065    return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true)
18066        && compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true) && compareDeep(use, o.use, true)
18067        && compareDeep(patient, o.patient, true) && compareDeep(billablePeriod, o.billablePeriod, true)
18068        && compareDeep(created, o.created, true) && compareDeep(enterer, o.enterer, true)
18069        && compareDeep(insurer, o.insurer, true) && compareDeep(provider, o.provider, true)
18070        && compareDeep(priority, o.priority, true) && compareDeep(fundsReserveRequested, o.fundsReserveRequested, true)
18071        && compareDeep(fundsReserve, o.fundsReserve, true) && compareDeep(related, o.related, true)
18072        && compareDeep(prescription, o.prescription, true)
18073        && compareDeep(originalPrescription, o.originalPrescription, true) && compareDeep(payee, o.payee, true)
18074        && compareDeep(referral, o.referral, true) && compareDeep(facility, o.facility, true)
18075        && compareDeep(claim, o.claim, true) && compareDeep(claimResponse, o.claimResponse, true)
18076        && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true)
18077        && compareDeep(preAuthRef, o.preAuthRef, true) && compareDeep(preAuthRefPeriod, o.preAuthRefPeriod, true)
18078        && compareDeep(careTeam, o.careTeam, true) && compareDeep(supportingInfo, o.supportingInfo, true)
18079        && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true)
18080        && compareDeep(precedence, o.precedence, true) && compareDeep(insurance, o.insurance, true)
18081        && compareDeep(accident, o.accident, true) && compareDeep(item, o.item, true)
18082        && compareDeep(addItem, o.addItem, true) && compareDeep(adjudication, o.adjudication, true)
18083        && compareDeep(total, o.total, true) && compareDeep(payment, o.payment, true)
18084        && compareDeep(formCode, o.formCode, true) && compareDeep(form, o.form, true)
18085        && compareDeep(processNote, o.processNote, true) && compareDeep(benefitPeriod, o.benefitPeriod, true)
18086        && compareDeep(benefitBalance, o.benefitBalance, true);
18087  }
18088
18089  @Override
18090  public boolean equalsShallow(Base other_) {
18091    if (!super.equalsShallow(other_))
18092      return false;
18093    if (!(other_ instanceof ExplanationOfBenefit))
18094      return false;
18095    ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
18096    return compareValues(status, o.status, true) && compareValues(use, o.use, true)
18097        && compareValues(created, o.created, true) && compareValues(outcome, o.outcome, true)
18098        && compareValues(disposition, o.disposition, true) && compareValues(preAuthRef, o.preAuthRef, true)
18099        && compareValues(precedence, o.precedence, true);
18100  }
18101
18102  public boolean isEmpty() {
18103    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type, subType, use, patient,
18104        billablePeriod, created, enterer, insurer, provider, priority, fundsReserveRequested, fundsReserve, related,
18105        prescription, originalPrescription, payee, referral, facility, claim, claimResponse, outcome, disposition,
18106        preAuthRef, preAuthRefPeriod, careTeam, supportingInfo, diagnosis, procedure, precedence, insurance, accident,
18107        item, addItem, adjudication, total, payment, formCode, form, processNote, benefitPeriod, benefitBalance);
18108  }
18109
18110  @Override
18111  public ResourceType getResourceType() {
18112    return ResourceType.ExplanationOfBenefit;
18113  }
18114
18115  /**
18116   * Search parameter: <b>coverage</b>
18117   * <p>
18118   * Description: <b>The plan under which the claim was adjudicated</b><br>
18119   * Type: <b>reference</b><br>
18120   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
18121   * </p>
18122   */
18123  @SearchParamDefinition(name = "coverage", path = "ExplanationOfBenefit.insurance.coverage", description = "The plan under which the claim was adjudicated", type = "reference", target = {
18124      Coverage.class })
18125  public static final String SP_COVERAGE = "coverage";
18126  /**
18127   * <b>Fluent Client</b> search parameter constant for <b>coverage</b>
18128   * <p>
18129   * Description: <b>The plan under which the claim was adjudicated</b><br>
18130   * Type: <b>reference</b><br>
18131   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
18132   * </p>
18133   */
18134  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18135      SP_COVERAGE);
18136
18137  /**
18138   * Constant for fluent queries to be used to add include statements. Specifies
18139   * the path value of "<b>ExplanationOfBenefit:coverage</b>".
18140   */
18141  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE = new ca.uhn.fhir.model.api.Include(
18142      "ExplanationOfBenefit:coverage").toLocked();
18143
18144  /**
18145   * Search parameter: <b>care-team</b>
18146   * <p>
18147   * Description: <b>Member of the CareTeam</b><br>
18148   * Type: <b>reference</b><br>
18149   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
18150   * </p>
18151   */
18152  @SearchParamDefinition(name = "care-team", path = "ExplanationOfBenefit.careTeam.provider", description = "Member of the CareTeam", type = "reference", providesMembershipIn = {
18153      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Organization.class,
18154          Practitioner.class, PractitionerRole.class })
18155  public static final String SP_CARE_TEAM = "care-team";
18156  /**
18157   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
18158   * <p>
18159   * Description: <b>Member of the CareTeam</b><br>
18160   * Type: <b>reference</b><br>
18161   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
18162   * </p>
18163   */
18164  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18165      SP_CARE_TEAM);
18166
18167  /**
18168   * Constant for fluent queries to be used to add include statements. Specifies
18169   * the path value of "<b>ExplanationOfBenefit:care-team</b>".
18170   */
18171  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include(
18172      "ExplanationOfBenefit:care-team").toLocked();
18173
18174  /**
18175   * Search parameter: <b>identifier</b>
18176   * <p>
18177   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
18178   * Type: <b>token</b><br>
18179   * Path: <b>ExplanationOfBenefit.identifier</b><br>
18180   * </p>
18181   */
18182  @SearchParamDefinition(name = "identifier", path = "ExplanationOfBenefit.identifier", description = "The business identifier of the Explanation of Benefit", type = "token")
18183  public static final String SP_IDENTIFIER = "identifier";
18184  /**
18185   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
18186   * <p>
18187   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
18188   * Type: <b>token</b><br>
18189   * Path: <b>ExplanationOfBenefit.identifier</b><br>
18190   * </p>
18191   */
18192  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
18193      SP_IDENTIFIER);
18194
18195  /**
18196   * Search parameter: <b>created</b>
18197   * <p>
18198   * Description: <b>The creation date for the EOB</b><br>
18199   * Type: <b>date</b><br>
18200   * Path: <b>ExplanationOfBenefit.created</b><br>
18201   * </p>
18202   */
18203  @SearchParamDefinition(name = "created", path = "ExplanationOfBenefit.created", description = "The creation date for the EOB", type = "date")
18204  public static final String SP_CREATED = "created";
18205  /**
18206   * <b>Fluent Client</b> search parameter constant for <b>created</b>
18207   * <p>
18208   * Description: <b>The creation date for the EOB</b><br>
18209   * Type: <b>date</b><br>
18210   * Path: <b>ExplanationOfBenefit.created</b><br>
18211   * </p>
18212   */
18213  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(
18214      SP_CREATED);
18215
18216  /**
18217   * Search parameter: <b>encounter</b>
18218   * <p>
18219   * Description: <b>Encounters associated with a billed line item</b><br>
18220   * Type: <b>reference</b><br>
18221   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
18222   * </p>
18223   */
18224  @SearchParamDefinition(name = "encounter", path = "ExplanationOfBenefit.item.encounter", description = "Encounters associated with a billed line item", type = "reference", providesMembershipIn = {
18225      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Encounter") }, target = { Encounter.class })
18226  public static final String SP_ENCOUNTER = "encounter";
18227  /**
18228   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
18229   * <p>
18230   * Description: <b>Encounters associated with a billed line item</b><br>
18231   * Type: <b>reference</b><br>
18232   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
18233   * </p>
18234   */
18235  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18236      SP_ENCOUNTER);
18237
18238  /**
18239   * Constant for fluent queries to be used to add include statements. Specifies
18240   * the path value of "<b>ExplanationOfBenefit:encounter</b>".
18241   */
18242  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include(
18243      "ExplanationOfBenefit:encounter").toLocked();
18244
18245  /**
18246   * Search parameter: <b>payee</b>
18247   * <p>
18248   * Description: <b>The party receiving any payment for the Claim</b><br>
18249   * Type: <b>reference</b><br>
18250   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
18251   * </p>
18252   */
18253  @SearchParamDefinition(name = "payee", path = "ExplanationOfBenefit.payee.party", description = "The party receiving any payment for the Claim", type = "reference", providesMembershipIn = {
18254      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient"),
18255      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner"),
18256      @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { Organization.class,
18257          Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class })
18258  public static final String SP_PAYEE = "payee";
18259  /**
18260   * <b>Fluent Client</b> search parameter constant for <b>payee</b>
18261   * <p>
18262   * Description: <b>The party receiving any payment for the Claim</b><br>
18263   * Type: <b>reference</b><br>
18264   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
18265   * </p>
18266   */
18267  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18268      SP_PAYEE);
18269
18270  /**
18271   * Constant for fluent queries to be used to add include statements. Specifies
18272   * the path value of "<b>ExplanationOfBenefit:payee</b>".
18273   */
18274  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYEE = new ca.uhn.fhir.model.api.Include(
18275      "ExplanationOfBenefit:payee").toLocked();
18276
18277  /**
18278   * Search parameter: <b>disposition</b>
18279   * <p>
18280   * Description: <b>The contents of the disposition message</b><br>
18281   * Type: <b>string</b><br>
18282   * Path: <b>ExplanationOfBenefit.disposition</b><br>
18283   * </p>
18284   */
18285  @SearchParamDefinition(name = "disposition", path = "ExplanationOfBenefit.disposition", description = "The contents of the disposition message", type = "string")
18286  public static final String SP_DISPOSITION = "disposition";
18287  /**
18288   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
18289   * <p>
18290   * Description: <b>The contents of the disposition message</b><br>
18291   * Type: <b>string</b><br>
18292   * Path: <b>ExplanationOfBenefit.disposition</b><br>
18293   * </p>
18294   */
18295  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(
18296      SP_DISPOSITION);
18297
18298  /**
18299   * Search parameter: <b>provider</b>
18300   * <p>
18301   * Description: <b>The reference to the provider</b><br>
18302   * Type: <b>reference</b><br>
18303   * Path: <b>ExplanationOfBenefit.provider</b><br>
18304   * </p>
18305   */
18306  @SearchParamDefinition(name = "provider", path = "ExplanationOfBenefit.provider", description = "The reference to the provider", type = "reference", providesMembershipIn = {
18307      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Organization.class,
18308          Practitioner.class, PractitionerRole.class })
18309  public static final String SP_PROVIDER = "provider";
18310  /**
18311   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
18312   * <p>
18313   * Description: <b>The reference to the provider</b><br>
18314   * Type: <b>reference</b><br>
18315   * Path: <b>ExplanationOfBenefit.provider</b><br>
18316   * </p>
18317   */
18318  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18319      SP_PROVIDER);
18320
18321  /**
18322   * Constant for fluent queries to be used to add include statements. Specifies
18323   * the path value of "<b>ExplanationOfBenefit:provider</b>".
18324   */
18325  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include(
18326      "ExplanationOfBenefit:provider").toLocked();
18327
18328  /**
18329   * Search parameter: <b>patient</b>
18330   * <p>
18331   * Description: <b>The reference to the patient</b><br>
18332   * Type: <b>reference</b><br>
18333   * Path: <b>ExplanationOfBenefit.patient</b><br>
18334   * </p>
18335   */
18336  @SearchParamDefinition(name = "patient", path = "ExplanationOfBenefit.patient", description = "The reference to the patient", type = "reference", providesMembershipIn = {
18337      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Patient.class })
18338  public static final String SP_PATIENT = "patient";
18339  /**
18340   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
18341   * <p>
18342   * Description: <b>The reference to the patient</b><br>
18343   * Type: <b>reference</b><br>
18344   * Path: <b>ExplanationOfBenefit.patient</b><br>
18345   * </p>
18346   */
18347  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18348      SP_PATIENT);
18349
18350  /**
18351   * Constant for fluent queries to be used to add include statements. Specifies
18352   * the path value of "<b>ExplanationOfBenefit:patient</b>".
18353   */
18354  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
18355      "ExplanationOfBenefit:patient").toLocked();
18356
18357  /**
18358   * Search parameter: <b>detail-udi</b>
18359   * <p>
18360   * Description: <b>UDI associated with a line item detail product or
18361   * service</b><br>
18362   * Type: <b>reference</b><br>
18363   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
18364   * </p>
18365   */
18366  @SearchParamDefinition(name = "detail-udi", path = "ExplanationOfBenefit.item.detail.udi", description = "UDI associated with a line item detail product or service", type = "reference", providesMembershipIn = {
18367      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device") }, target = { Device.class })
18368  public static final String SP_DETAIL_UDI = "detail-udi";
18369  /**
18370   * <b>Fluent Client</b> search parameter constant for <b>detail-udi</b>
18371   * <p>
18372   * Description: <b>UDI associated with a line item detail product or
18373   * service</b><br>
18374   * Type: <b>reference</b><br>
18375   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
18376   * </p>
18377   */
18378  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18379      SP_DETAIL_UDI);
18380
18381  /**
18382   * Constant for fluent queries to be used to add include statements. Specifies
18383   * the path value of "<b>ExplanationOfBenefit:detail-udi</b>".
18384   */
18385  public static final ca.uhn.fhir.model.api.Include INCLUDE_DETAIL_UDI = new ca.uhn.fhir.model.api.Include(
18386      "ExplanationOfBenefit:detail-udi").toLocked();
18387
18388  /**
18389   * Search parameter: <b>claim</b>
18390   * <p>
18391   * Description: <b>The reference to the claim</b><br>
18392   * Type: <b>reference</b><br>
18393   * Path: <b>ExplanationOfBenefit.claim</b><br>
18394   * </p>
18395   */
18396  @SearchParamDefinition(name = "claim", path = "ExplanationOfBenefit.claim", description = "The reference to the claim", type = "reference", target = {
18397      Claim.class })
18398  public static final String SP_CLAIM = "claim";
18399  /**
18400   * <b>Fluent Client</b> search parameter constant for <b>claim</b>
18401   * <p>
18402   * Description: <b>The reference to the claim</b><br>
18403   * Type: <b>reference</b><br>
18404   * Path: <b>ExplanationOfBenefit.claim</b><br>
18405   * </p>
18406   */
18407  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18408      SP_CLAIM);
18409
18410  /**
18411   * Constant for fluent queries to be used to add include statements. Specifies
18412   * the path value of "<b>ExplanationOfBenefit:claim</b>".
18413   */
18414  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIM = new ca.uhn.fhir.model.api.Include(
18415      "ExplanationOfBenefit:claim").toLocked();
18416
18417  /**
18418   * Search parameter: <b>enterer</b>
18419   * <p>
18420   * Description: <b>The party responsible for the entry of the Claim</b><br>
18421   * Type: <b>reference</b><br>
18422   * Path: <b>ExplanationOfBenefit.enterer</b><br>
18423   * </p>
18424   */
18425  @SearchParamDefinition(name = "enterer", path = "ExplanationOfBenefit.enterer", description = "The party responsible for the entry of the Claim", type = "reference", providesMembershipIn = {
18426      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Practitioner.class,
18427          PractitionerRole.class })
18428  public static final String SP_ENTERER = "enterer";
18429  /**
18430   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
18431   * <p>
18432   * Description: <b>The party responsible for the entry of the Claim</b><br>
18433   * Type: <b>reference</b><br>
18434   * Path: <b>ExplanationOfBenefit.enterer</b><br>
18435   * </p>
18436   */
18437  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18438      SP_ENTERER);
18439
18440  /**
18441   * Constant for fluent queries to be used to add include statements. Specifies
18442   * the path value of "<b>ExplanationOfBenefit:enterer</b>".
18443   */
18444  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include(
18445      "ExplanationOfBenefit:enterer").toLocked();
18446
18447  /**
18448   * Search parameter: <b>procedure-udi</b>
18449   * <p>
18450   * Description: <b>UDI associated with a procedure</b><br>
18451   * Type: <b>reference</b><br>
18452   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
18453   * </p>
18454   */
18455  @SearchParamDefinition(name = "procedure-udi", path = "ExplanationOfBenefit.procedure.udi", description = "UDI associated with a procedure", type = "reference", providesMembershipIn = {
18456      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device") }, target = { Device.class })
18457  public static final String SP_PROCEDURE_UDI = "procedure-udi";
18458  /**
18459   * <b>Fluent Client</b> search parameter constant for <b>procedure-udi</b>
18460   * <p>
18461   * Description: <b>UDI associated with a procedure</b><br>
18462   * Type: <b>reference</b><br>
18463   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
18464   * </p>
18465   */
18466  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROCEDURE_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18467      SP_PROCEDURE_UDI);
18468
18469  /**
18470   * Constant for fluent queries to be used to add include statements. Specifies
18471   * the path value of "<b>ExplanationOfBenefit:procedure-udi</b>".
18472   */
18473  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROCEDURE_UDI = new ca.uhn.fhir.model.api.Include(
18474      "ExplanationOfBenefit:procedure-udi").toLocked();
18475
18476  /**
18477   * Search parameter: <b>subdetail-udi</b>
18478   * <p>
18479   * Description: <b>UDI associated with a line item detail subdetail product or
18480   * service</b><br>
18481   * Type: <b>reference</b><br>
18482   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
18483   * </p>
18484   */
18485  @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 = {
18486      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device") }, target = { Device.class })
18487  public static final String SP_SUBDETAIL_UDI = "subdetail-udi";
18488  /**
18489   * <b>Fluent Client</b> search parameter constant for <b>subdetail-udi</b>
18490   * <p>
18491   * Description: <b>UDI associated with a line item detail subdetail product or
18492   * service</b><br>
18493   * Type: <b>reference</b><br>
18494   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
18495   * </p>
18496   */
18497  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBDETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18498      SP_SUBDETAIL_UDI);
18499
18500  /**
18501   * Constant for fluent queries to be used to add include statements. Specifies
18502   * the path value of "<b>ExplanationOfBenefit:subdetail-udi</b>".
18503   */
18504  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBDETAIL_UDI = new ca.uhn.fhir.model.api.Include(
18505      "ExplanationOfBenefit:subdetail-udi").toLocked();
18506
18507  /**
18508   * Search parameter: <b>facility</b>
18509   * <p>
18510   * Description: <b>Facility responsible for the goods and services</b><br>
18511   * Type: <b>reference</b><br>
18512   * Path: <b>ExplanationOfBenefit.facility</b><br>
18513   * </p>
18514   */
18515  @SearchParamDefinition(name = "facility", path = "ExplanationOfBenefit.facility", description = "Facility responsible for the goods and services", type = "reference", target = {
18516      Location.class })
18517  public static final String SP_FACILITY = "facility";
18518  /**
18519   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
18520   * <p>
18521   * Description: <b>Facility responsible for the goods and services</b><br>
18522   * Type: <b>reference</b><br>
18523   * Path: <b>ExplanationOfBenefit.facility</b><br>
18524   * </p>
18525   */
18526  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18527      SP_FACILITY);
18528
18529  /**
18530   * Constant for fluent queries to be used to add include statements. Specifies
18531   * the path value of "<b>ExplanationOfBenefit:facility</b>".
18532   */
18533  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include(
18534      "ExplanationOfBenefit:facility").toLocked();
18535
18536  /**
18537   * Search parameter: <b>item-udi</b>
18538   * <p>
18539   * Description: <b>UDI associated with a line item product or service</b><br>
18540   * Type: <b>reference</b><br>
18541   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
18542   * </p>
18543   */
18544  @SearchParamDefinition(name = "item-udi", path = "ExplanationOfBenefit.item.udi", description = "UDI associated with a line item product or service", type = "reference", providesMembershipIn = {
18545      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device") }, target = { Device.class })
18546  public static final String SP_ITEM_UDI = "item-udi";
18547  /**
18548   * <b>Fluent Client</b> search parameter constant for <b>item-udi</b>
18549   * <p>
18550   * Description: <b>UDI associated with a line item product or service</b><br>
18551   * Type: <b>reference</b><br>
18552   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
18553   * </p>
18554   */
18555  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18556      SP_ITEM_UDI);
18557
18558  /**
18559   * Constant for fluent queries to be used to add include statements. Specifies
18560   * the path value of "<b>ExplanationOfBenefit:item-udi</b>".
18561   */
18562  public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM_UDI = new ca.uhn.fhir.model.api.Include(
18563      "ExplanationOfBenefit:item-udi").toLocked();
18564
18565  /**
18566   * Search parameter: <b>status</b>
18567   * <p>
18568   * Description: <b>Status of the instance</b><br>
18569   * Type: <b>token</b><br>
18570   * Path: <b>ExplanationOfBenefit.status</b><br>
18571   * </p>
18572   */
18573  @SearchParamDefinition(name = "status", path = "ExplanationOfBenefit.status", description = "Status of the instance", type = "token")
18574  public static final String SP_STATUS = "status";
18575  /**
18576   * <b>Fluent Client</b> search parameter constant for <b>status</b>
18577   * <p>
18578   * Description: <b>Status of the instance</b><br>
18579   * Type: <b>token</b><br>
18580   * Path: <b>ExplanationOfBenefit.status</b><br>
18581   * </p>
18582   */
18583  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
18584      SP_STATUS);
18585
18586}