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.NULL)
204           return null;
205       if (code == ExplanationOfBenefitStatus.ACTIVE)
206        return "active";
207      if (code == ExplanationOfBenefitStatus.CANCELLED)
208        return "cancelled";
209      if (code == ExplanationOfBenefitStatus.DRAFT)
210        return "draft";
211      if (code == ExplanationOfBenefitStatus.ENTEREDINERROR)
212        return "entered-in-error";
213      return "?";
214   }
215
216    public String toSystem(ExplanationOfBenefitStatus code) {
217      return code.getSystem();
218    }
219  }
220
221  public enum Use {
222    /**
223     * The treatment is complete and this represents a Claim for the services.
224     */
225    CLAIM,
226    /**
227     * The treatment is proposed and this represents a Pre-authorization for the
228     * services.
229     */
230    PREAUTHORIZATION,
231    /**
232     * The treatment is proposed and this represents a Pre-determination for the
233     * services.
234     */
235    PREDETERMINATION,
236    /**
237     * added to help the parsers with the generic types
238     */
239    NULL;
240
241    public static Use fromCode(String codeString) throws FHIRException {
242      if (codeString == null || "".equals(codeString))
243        return null;
244      if ("claim".equals(codeString))
245        return CLAIM;
246      if ("preauthorization".equals(codeString))
247        return PREAUTHORIZATION;
248      if ("predetermination".equals(codeString))
249        return PREDETERMINATION;
250      if (Configuration.isAcceptInvalidEnums())
251        return null;
252      else
253        throw new FHIRException("Unknown Use code '" + codeString + "'");
254    }
255
256    public String toCode() {
257      switch (this) {
258      case CLAIM:
259        return "claim";
260      case PREAUTHORIZATION:
261        return "preauthorization";
262      case PREDETERMINATION:
263        return "predetermination";
264      case NULL:
265        return null;
266      default:
267        return "?";
268      }
269    }
270
271    public String getSystem() {
272      switch (this) {
273      case CLAIM:
274        return "http://hl7.org/fhir/claim-use";
275      case PREAUTHORIZATION:
276        return "http://hl7.org/fhir/claim-use";
277      case PREDETERMINATION:
278        return "http://hl7.org/fhir/claim-use";
279      case NULL:
280        return null;
281      default:
282        return "?";
283      }
284    }
285
286    public String getDefinition() {
287      switch (this) {
288      case CLAIM:
289        return "The treatment is complete and this represents a Claim for the services.";
290      case PREAUTHORIZATION:
291        return "The treatment is proposed and this represents a Pre-authorization for the services.";
292      case PREDETERMINATION:
293        return "The treatment is proposed and this represents a Pre-determination for the services.";
294      case NULL:
295        return null;
296      default:
297        return "?";
298      }
299    }
300
301    public String getDisplay() {
302      switch (this) {
303      case CLAIM:
304        return "Claim";
305      case PREAUTHORIZATION:
306        return "Preauthorization";
307      case PREDETERMINATION:
308        return "Predetermination";
309      case NULL:
310        return null;
311      default:
312        return "?";
313      }
314    }
315  }
316
317  public static class UseEnumFactory implements EnumFactory<Use> {
318    public Use fromCode(String codeString) throws IllegalArgumentException {
319      if (codeString == null || "".equals(codeString))
320        if (codeString == null || "".equals(codeString))
321          return null;
322      if ("claim".equals(codeString))
323        return Use.CLAIM;
324      if ("preauthorization".equals(codeString))
325        return Use.PREAUTHORIZATION;
326      if ("predetermination".equals(codeString))
327        return Use.PREDETERMINATION;
328      throw new IllegalArgumentException("Unknown Use code '" + codeString + "'");
329    }
330
331    public Enumeration<Use> fromType(PrimitiveType<?> code) throws FHIRException {
332      if (code == null)
333        return null;
334      if (code.isEmpty())
335        return new Enumeration<Use>(this, Use.NULL, code);
336      String codeString = code.asStringValue();
337      if (codeString == null || "".equals(codeString))
338        return new Enumeration<Use>(this, Use.NULL, code);
339      if ("claim".equals(codeString))
340        return new Enumeration<Use>(this, Use.CLAIM, code);
341      if ("preauthorization".equals(codeString))
342        return new Enumeration<Use>(this, Use.PREAUTHORIZATION, code);
343      if ("predetermination".equals(codeString))
344        return new Enumeration<Use>(this, Use.PREDETERMINATION, code);
345      throw new FHIRException("Unknown Use code '" + codeString + "'");
346    }
347
348    public String toCode(Use code) {
349       if (code == Use.NULL)
350           return null;
351       if (code == Use.CLAIM)
352        return "claim";
353      if (code == Use.PREAUTHORIZATION)
354        return "preauthorization";
355      if (code == Use.PREDETERMINATION)
356        return "predetermination";
357      return "?";
358   }
359
360    public String toSystem(Use code) {
361      return code.getSystem();
362    }
363  }
364
365  public enum RemittanceOutcome {
366    /**
367     * The Claim/Pre-authorization/Pre-determination has been received but
368     * processing has not begun.
369     */
370    QUEUED,
371    /**
372     * The processing has completed without errors
373     */
374    COMPLETE,
375    /**
376     * One or more errors have been detected in the Claim
377     */
378    ERROR,
379    /**
380     * No errors have been detected in the Claim and some of the adjudication has
381     * been performed.
382     */
383    PARTIAL,
384    /**
385     * added to help the parsers with the generic types
386     */
387    NULL;
388
389    public static RemittanceOutcome fromCode(String codeString) throws FHIRException {
390      if (codeString == null || "".equals(codeString))
391        return null;
392      if ("queued".equals(codeString))
393        return QUEUED;
394      if ("complete".equals(codeString))
395        return COMPLETE;
396      if ("error".equals(codeString))
397        return ERROR;
398      if ("partial".equals(codeString))
399        return PARTIAL;
400      if (Configuration.isAcceptInvalidEnums())
401        return null;
402      else
403        throw new FHIRException("Unknown RemittanceOutcome code '" + codeString + "'");
404    }
405
406    public String toCode() {
407      switch (this) {
408      case QUEUED:
409        return "queued";
410      case COMPLETE:
411        return "complete";
412      case ERROR:
413        return "error";
414      case PARTIAL:
415        return "partial";
416      case NULL:
417        return null;
418      default:
419        return "?";
420      }
421    }
422
423    public String getSystem() {
424      switch (this) {
425      case QUEUED:
426        return "http://hl7.org/fhir/remittance-outcome";
427      case COMPLETE:
428        return "http://hl7.org/fhir/remittance-outcome";
429      case ERROR:
430        return "http://hl7.org/fhir/remittance-outcome";
431      case PARTIAL:
432        return "http://hl7.org/fhir/remittance-outcome";
433      case NULL:
434        return null;
435      default:
436        return "?";
437      }
438    }
439
440    public String getDefinition() {
441      switch (this) {
442      case QUEUED:
443        return "The Claim/Pre-authorization/Pre-determination has been received but processing has not begun.";
444      case COMPLETE:
445        return "The processing has completed without errors";
446      case ERROR:
447        return "One or more errors have been detected in the Claim";
448      case PARTIAL:
449        return "No errors have been detected in the Claim and some of the adjudication has been performed.";
450      case NULL:
451        return null;
452      default:
453        return "?";
454      }
455    }
456
457    public String getDisplay() {
458      switch (this) {
459      case QUEUED:
460        return "Queued";
461      case COMPLETE:
462        return "Processing Complete";
463      case ERROR:
464        return "Error";
465      case PARTIAL:
466        return "Partial Processing";
467      case NULL:
468        return null;
469      default:
470        return "?";
471      }
472    }
473  }
474
475  public static class RemittanceOutcomeEnumFactory implements EnumFactory<RemittanceOutcome> {
476    public RemittanceOutcome fromCode(String codeString) throws IllegalArgumentException {
477      if (codeString == null || "".equals(codeString))
478        if (codeString == null || "".equals(codeString))
479          return null;
480      if ("queued".equals(codeString))
481        return RemittanceOutcome.QUEUED;
482      if ("complete".equals(codeString))
483        return RemittanceOutcome.COMPLETE;
484      if ("error".equals(codeString))
485        return RemittanceOutcome.ERROR;
486      if ("partial".equals(codeString))
487        return RemittanceOutcome.PARTIAL;
488      throw new IllegalArgumentException("Unknown RemittanceOutcome code '" + codeString + "'");
489    }
490
491    public Enumeration<RemittanceOutcome> fromType(PrimitiveType<?> code) throws FHIRException {
492      if (code == null)
493        return null;
494      if (code.isEmpty())
495        return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.NULL, code);
496      String codeString = code.asStringValue();
497      if (codeString == null || "".equals(codeString))
498        return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.NULL, code);
499      if ("queued".equals(codeString))
500        return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.QUEUED, code);
501      if ("complete".equals(codeString))
502        return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.COMPLETE, code);
503      if ("error".equals(codeString))
504        return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.ERROR, code);
505      if ("partial".equals(codeString))
506        return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.PARTIAL, code);
507      throw new FHIRException("Unknown RemittanceOutcome code '" + codeString + "'");
508    }
509
510    public String toCode(RemittanceOutcome code) {
511       if (code == RemittanceOutcome.NULL)
512           return null;
513       if (code == RemittanceOutcome.QUEUED)
514        return "queued";
515      if (code == RemittanceOutcome.COMPLETE)
516        return "complete";
517      if (code == RemittanceOutcome.ERROR)
518        return "error";
519      if (code == RemittanceOutcome.PARTIAL)
520        return "partial";
521      return "?";
522   }
523
524    public String toSystem(RemittanceOutcome code) {
525      return code.getSystem();
526    }
527  }
528
529  @Block()
530  public static class RelatedClaimComponent extends BackboneElement implements IBaseBackboneElement {
531    /**
532     * Reference to a related claim.
533     */
534    @Child(name = "claim", type = { Claim.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
535    @Description(shortDefinition = "Reference to the related claim", formalDefinition = "Reference to a related claim.")
536    protected Reference claim;
537
538    /**
539     * The actual object that is the target of the reference (Reference to a related
540     * claim.)
541     */
542    protected Claim claimTarget;
543
544    /**
545     * A code to convey how the claims are related.
546     */
547    @Child(name = "relationship", type = {
548        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
549    @Description(shortDefinition = "How the reference claim is related", formalDefinition = "A code to convey how the claims are related.")
550    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/related-claim-relationship")
551    protected CodeableConcept relationship;
552
553    /**
554     * An alternate organizational reference to the case or file to which this
555     * particular claim pertains.
556     */
557    @Child(name = "reference", type = {
558        Identifier.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
559    @Description(shortDefinition = "File or case reference", formalDefinition = "An alternate organizational reference to the case or file to which this particular claim pertains.")
560    protected Identifier reference;
561
562    private static final long serialVersionUID = -379338905L;
563
564    /**
565     * Constructor
566     */
567    public RelatedClaimComponent() {
568      super();
569    }
570
571    /**
572     * @return {@link #claim} (Reference to a related claim.)
573     */
574    public Reference getClaim() {
575      if (this.claim == null)
576        if (Configuration.errorOnAutoCreate())
577          throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
578        else if (Configuration.doAutoCreate())
579          this.claim = new Reference(); // cc
580      return this.claim;
581    }
582
583    public boolean hasClaim() {
584      return this.claim != null && !this.claim.isEmpty();
585    }
586
587    /**
588     * @param value {@link #claim} (Reference to a related claim.)
589     */
590    public RelatedClaimComponent setClaim(Reference value) {
591      this.claim = value;
592      return this;
593    }
594
595    /**
596     * @return {@link #claim} The actual object that is the target of the reference.
597     *         The reference library doesn't populate this, but you can use it to
598     *         hold the resource if you resolve it. (Reference to a related claim.)
599     */
600    public Claim getClaimTarget() {
601      if (this.claimTarget == null)
602        if (Configuration.errorOnAutoCreate())
603          throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
604        else if (Configuration.doAutoCreate())
605          this.claimTarget = new Claim(); // aa
606      return this.claimTarget;
607    }
608
609    /**
610     * @param value {@link #claim} The actual object that is the target of the
611     *              reference. The reference library doesn't use these, but you can
612     *              use it to hold the resource if you resolve it. (Reference to a
613     *              related claim.)
614     */
615    public RelatedClaimComponent setClaimTarget(Claim value) {
616      this.claimTarget = value;
617      return this;
618    }
619
620    /**
621     * @return {@link #relationship} (A code to convey how the claims are related.)
622     */
623    public CodeableConcept getRelationship() {
624      if (this.relationship == null)
625        if (Configuration.errorOnAutoCreate())
626          throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
627        else if (Configuration.doAutoCreate())
628          this.relationship = new CodeableConcept(); // cc
629      return this.relationship;
630    }
631
632    public boolean hasRelationship() {
633      return this.relationship != null && !this.relationship.isEmpty();
634    }
635
636    /**
637     * @param value {@link #relationship} (A code to convey how the claims are
638     *              related.)
639     */
640    public RelatedClaimComponent setRelationship(CodeableConcept value) {
641      this.relationship = value;
642      return this;
643    }
644
645    /**
646     * @return {@link #reference} (An alternate organizational reference to the case
647     *         or file to which this particular claim pertains.)
648     */
649    public Identifier getReference() {
650      if (this.reference == null)
651        if (Configuration.errorOnAutoCreate())
652          throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
653        else if (Configuration.doAutoCreate())
654          this.reference = new Identifier(); // cc
655      return this.reference;
656    }
657
658    public boolean hasReference() {
659      return this.reference != null && !this.reference.isEmpty();
660    }
661
662    /**
663     * @param value {@link #reference} (An alternate organizational reference to the
664     *              case or file to which this particular claim pertains.)
665     */
666    public RelatedClaimComponent setReference(Identifier value) {
667      this.reference = value;
668      return this;
669    }
670
671    protected void listChildren(List<Property> children) {
672      super.listChildren(children);
673      children.add(new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim));
674      children.add(new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1,
675          relationship));
676      children.add(new Property("reference", "Identifier",
677          "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1,
678          reference));
679    }
680
681    @Override
682    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
683      switch (_hash) {
684      case 94742588:
685        /* claim */ return new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim);
686      case -261851592:
687        /* relationship */ return new Property("relationship", "CodeableConcept",
688            "A code to convey how the claims are related.", 0, 1, relationship);
689      case -925155509:
690        /* reference */ return new Property("reference", "Identifier",
691            "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1,
692            reference);
693      default:
694        return super.getNamedProperty(_hash, _name, _checkValid);
695      }
696
697    }
698
699    @Override
700    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
701      switch (hash) {
702      case 94742588:
703        /* claim */ return this.claim == null ? new Base[0] : new Base[] { this.claim }; // Reference
704      case -261851592:
705        /* relationship */ return this.relationship == null ? new Base[0] : new Base[] { this.relationship }; // CodeableConcept
706      case -925155509:
707        /* reference */ return this.reference == null ? new Base[0] : new Base[] { this.reference }; // Identifier
708      default:
709        return super.getProperty(hash, name, checkValid);
710      }
711
712    }
713
714    @Override
715    public Base setProperty(int hash, String name, Base value) throws FHIRException {
716      switch (hash) {
717      case 94742588: // claim
718        this.claim = castToReference(value); // Reference
719        return value;
720      case -261851592: // relationship
721        this.relationship = castToCodeableConcept(value); // CodeableConcept
722        return value;
723      case -925155509: // reference
724        this.reference = castToIdentifier(value); // Identifier
725        return value;
726      default:
727        return super.setProperty(hash, name, value);
728      }
729
730    }
731
732    @Override
733    public Base setProperty(String name, Base value) throws FHIRException {
734      if (name.equals("claim")) {
735        this.claim = castToReference(value); // Reference
736      } else if (name.equals("relationship")) {
737        this.relationship = castToCodeableConcept(value); // CodeableConcept
738      } else if (name.equals("reference")) {
739        this.reference = castToIdentifier(value); // Identifier
740      } else
741        return super.setProperty(name, value);
742      return value;
743    }
744
745  @Override
746  public void removeChild(String name, Base value) throws FHIRException {
747      if (name.equals("claim")) {
748        this.claim = null;
749      } else if (name.equals("relationship")) {
750        this.relationship = null;
751      } else if (name.equals("reference")) {
752        this.reference = null;
753      } else
754        super.removeChild(name, value);
755      
756    }
757
758    @Override
759    public Base makeProperty(int hash, String name) throws FHIRException {
760      switch (hash) {
761      case 94742588:
762        return getClaim();
763      case -261851592:
764        return getRelationship();
765      case -925155509:
766        return getReference();
767      default:
768        return super.makeProperty(hash, name);
769      }
770
771    }
772
773    @Override
774    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
775      switch (hash) {
776      case 94742588:
777        /* claim */ return new String[] { "Reference" };
778      case -261851592:
779        /* relationship */ return new String[] { "CodeableConcept" };
780      case -925155509:
781        /* reference */ return new String[] { "Identifier" };
782      default:
783        return super.getTypesForProperty(hash, name);
784      }
785
786    }
787
788    @Override
789    public Base addChild(String name) throws FHIRException {
790      if (name.equals("claim")) {
791        this.claim = new Reference();
792        return this.claim;
793      } else if (name.equals("relationship")) {
794        this.relationship = new CodeableConcept();
795        return this.relationship;
796      } else if (name.equals("reference")) {
797        this.reference = new Identifier();
798        return this.reference;
799      } else
800        return super.addChild(name);
801    }
802
803    public RelatedClaimComponent copy() {
804      RelatedClaimComponent dst = new RelatedClaimComponent();
805      copyValues(dst);
806      return dst;
807    }
808
809    public void copyValues(RelatedClaimComponent dst) {
810      super.copyValues(dst);
811      dst.claim = claim == null ? null : claim.copy();
812      dst.relationship = relationship == null ? null : relationship.copy();
813      dst.reference = reference == null ? null : reference.copy();
814    }
815
816    @Override
817    public boolean equalsDeep(Base other_) {
818      if (!super.equalsDeep(other_))
819        return false;
820      if (!(other_ instanceof RelatedClaimComponent))
821        return false;
822      RelatedClaimComponent o = (RelatedClaimComponent) other_;
823      return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true)
824          && compareDeep(reference, o.reference, true);
825    }
826
827    @Override
828    public boolean equalsShallow(Base other_) {
829      if (!super.equalsShallow(other_))
830        return false;
831      if (!(other_ instanceof RelatedClaimComponent))
832        return false;
833      RelatedClaimComponent o = (RelatedClaimComponent) other_;
834      return true;
835    }
836
837    public boolean isEmpty() {
838      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference);
839    }
840
841    public String fhirType() {
842      return "ExplanationOfBenefit.related";
843
844    }
845
846  }
847
848  @Block()
849  public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
850    /**
851     * Type of Party to be reimbursed: Subscriber, provider, other.
852     */
853    @Child(name = "type", type = {
854        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
855    @Description(shortDefinition = "Category of recipient", formalDefinition = "Type of Party to be reimbursed: Subscriber, provider, other.")
856    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/payeetype")
857    protected CodeableConcept type;
858
859    /**
860     * Reference to the individual or organization to whom any payment will be made.
861     */
862    @Child(name = "party", type = { Practitioner.class, PractitionerRole.class, Organization.class, Patient.class,
863        RelatedPerson.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
864    @Description(shortDefinition = "Recipient reference", formalDefinition = "Reference to the individual or organization to whom any payment will be made.")
865    protected Reference party;
866
867    /**
868     * The actual object that is the target of the reference (Reference to the
869     * individual or organization to whom any payment will be made.)
870     */
871    protected Resource partyTarget;
872
873    private static final long serialVersionUID = 1609484699L;
874
875    /**
876     * Constructor
877     */
878    public PayeeComponent() {
879      super();
880    }
881
882    /**
883     * @return {@link #type} (Type of Party to be reimbursed: Subscriber, provider,
884     *         other.)
885     */
886    public CodeableConcept getType() {
887      if (this.type == null)
888        if (Configuration.errorOnAutoCreate())
889          throw new Error("Attempt to auto-create PayeeComponent.type");
890        else if (Configuration.doAutoCreate())
891          this.type = new CodeableConcept(); // cc
892      return this.type;
893    }
894
895    public boolean hasType() {
896      return this.type != null && !this.type.isEmpty();
897    }
898
899    /**
900     * @param value {@link #type} (Type of Party to be reimbursed: Subscriber,
901     *              provider, other.)
902     */
903    public PayeeComponent setType(CodeableConcept value) {
904      this.type = value;
905      return this;
906    }
907
908    /**
909     * @return {@link #party} (Reference to the individual or organization to whom
910     *         any payment will be made.)
911     */
912    public Reference getParty() {
913      if (this.party == null)
914        if (Configuration.errorOnAutoCreate())
915          throw new Error("Attempt to auto-create PayeeComponent.party");
916        else if (Configuration.doAutoCreate())
917          this.party = new Reference(); // cc
918      return this.party;
919    }
920
921    public boolean hasParty() {
922      return this.party != null && !this.party.isEmpty();
923    }
924
925    /**
926     * @param value {@link #party} (Reference to the individual or organization to
927     *              whom any payment will be made.)
928     */
929    public PayeeComponent setParty(Reference value) {
930      this.party = value;
931      return this;
932    }
933
934    /**
935     * @return {@link #party} The actual object that is the target of the reference.
936     *         The reference library doesn't populate this, but you can use it to
937     *         hold the resource if you resolve it. (Reference to the individual or
938     *         organization to whom any payment will be made.)
939     */
940    public Resource getPartyTarget() {
941      return this.partyTarget;
942    }
943
944    /**
945     * @param value {@link #party} The actual object that is the target of the
946     *              reference. The reference library doesn't use these, but you can
947     *              use it to hold the resource if you resolve it. (Reference to the
948     *              individual or organization to whom any payment will be made.)
949     */
950    public PayeeComponent setPartyTarget(Resource value) {
951      this.partyTarget = value;
952      return this;
953    }
954
955    protected void listChildren(List<Property> children) {
956      super.listChildren(children);
957      children.add(new Property("type", "CodeableConcept",
958          "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type));
959      children.add(new Property("party", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)",
960          "Reference to the individual or organization to whom any payment will be made.", 0, 1, party));
961    }
962
963    @Override
964    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
965      switch (_hash) {
966      case 3575610:
967        /* type */ return new Property("type", "CodeableConcept",
968            "Type of Party to be reimbursed: Subscriber, provider, other.", 0, 1, type);
969      case 106437350:
970        /* party */ return new Property("party",
971            "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)",
972            "Reference to the individual or organization to whom any payment will be made.", 0, 1, party);
973      default:
974        return super.getNamedProperty(_hash, _name, _checkValid);
975      }
976
977    }
978
979    @Override
980    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
981      switch (hash) {
982      case 3575610:
983        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
984      case 106437350:
985        /* party */ return this.party == null ? new Base[0] : new Base[] { this.party }; // Reference
986      default:
987        return super.getProperty(hash, name, checkValid);
988      }
989
990    }
991
992    @Override
993    public Base setProperty(int hash, String name, Base value) throws FHIRException {
994      switch (hash) {
995      case 3575610: // type
996        this.type = castToCodeableConcept(value); // CodeableConcept
997        return value;
998      case 106437350: // party
999        this.party = castToReference(value); // Reference
1000        return value;
1001      default:
1002        return super.setProperty(hash, name, value);
1003      }
1004
1005    }
1006
1007    @Override
1008    public Base setProperty(String name, Base value) throws FHIRException {
1009      if (name.equals("type")) {
1010        this.type = castToCodeableConcept(value); // CodeableConcept
1011      } else if (name.equals("party")) {
1012        this.party = castToReference(value); // Reference
1013      } else
1014        return super.setProperty(name, value);
1015      return value;
1016    }
1017
1018  @Override
1019  public void removeChild(String name, Base value) throws FHIRException {
1020      if (name.equals("type")) {
1021        this.type = null;
1022      } else if (name.equals("party")) {
1023        this.party = null;
1024      } else
1025        super.removeChild(name, value);
1026      
1027    }
1028
1029    @Override
1030    public Base makeProperty(int hash, String name) throws FHIRException {
1031      switch (hash) {
1032      case 3575610:
1033        return getType();
1034      case 106437350:
1035        return getParty();
1036      default:
1037        return super.makeProperty(hash, name);
1038      }
1039
1040    }
1041
1042    @Override
1043    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1044      switch (hash) {
1045      case 3575610:
1046        /* type */ return new String[] { "CodeableConcept" };
1047      case 106437350:
1048        /* party */ return new String[] { "Reference" };
1049      default:
1050        return super.getTypesForProperty(hash, name);
1051      }
1052
1053    }
1054
1055    @Override
1056    public Base addChild(String name) throws FHIRException {
1057      if (name.equals("type")) {
1058        this.type = new CodeableConcept();
1059        return this.type;
1060      } else if (name.equals("party")) {
1061        this.party = new Reference();
1062        return this.party;
1063      } else
1064        return super.addChild(name);
1065    }
1066
1067    public PayeeComponent copy() {
1068      PayeeComponent dst = new PayeeComponent();
1069      copyValues(dst);
1070      return dst;
1071    }
1072
1073    public void copyValues(PayeeComponent dst) {
1074      super.copyValues(dst);
1075      dst.type = type == null ? null : type.copy();
1076      dst.party = party == null ? null : party.copy();
1077    }
1078
1079    @Override
1080    public boolean equalsDeep(Base other_) {
1081      if (!super.equalsDeep(other_))
1082        return false;
1083      if (!(other_ instanceof PayeeComponent))
1084        return false;
1085      PayeeComponent o = (PayeeComponent) other_;
1086      return compareDeep(type, o.type, true) && compareDeep(party, o.party, true);
1087    }
1088
1089    @Override
1090    public boolean equalsShallow(Base other_) {
1091      if (!super.equalsShallow(other_))
1092        return false;
1093      if (!(other_ instanceof PayeeComponent))
1094        return false;
1095      PayeeComponent o = (PayeeComponent) other_;
1096      return true;
1097    }
1098
1099    public boolean isEmpty() {
1100      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party);
1101    }
1102
1103    public String fhirType() {
1104      return "ExplanationOfBenefit.payee";
1105
1106    }
1107
1108  }
1109
1110  @Block()
1111  public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
1112    /**
1113     * A number to uniquely identify care team entries.
1114     */
1115    @Child(name = "sequence", type = {
1116        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
1117    @Description(shortDefinition = "Order of care team", formalDefinition = "A number to uniquely identify care team entries.")
1118    protected PositiveIntType sequence;
1119
1120    /**
1121     * Member of the team who provided the product or service.
1122     */
1123    @Child(name = "provider", type = { Practitioner.class, PractitionerRole.class,
1124        Organization.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
1125    @Description(shortDefinition = "Practitioner or organization", formalDefinition = "Member of the team who provided the product or service.")
1126    protected Reference provider;
1127
1128    /**
1129     * The actual object that is the target of the reference (Member of the team who
1130     * provided the product or service.)
1131     */
1132    protected Resource providerTarget;
1133
1134    /**
1135     * The party who is billing and/or responsible for the claimed products or
1136     * services.
1137     */
1138    @Child(name = "responsible", type = {
1139        BooleanType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
1140    @Description(shortDefinition = "Indicator of the lead practitioner", formalDefinition = "The party who is billing and/or responsible for the claimed products or services.")
1141    protected BooleanType responsible;
1142
1143    /**
1144     * The lead, assisting or supervising practitioner and their discipline if a
1145     * multidisciplinary team.
1146     */
1147    @Child(name = "role", type = {
1148        CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
1149    @Description(shortDefinition = "Function within the team", formalDefinition = "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.")
1150    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-careteamrole")
1151    protected CodeableConcept role;
1152
1153    /**
1154     * The qualification of the practitioner which is applicable for this service.
1155     */
1156    @Child(name = "qualification", type = {
1157        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
1158    @Description(shortDefinition = "Practitioner credential or specialization", formalDefinition = "The qualification of the practitioner which is applicable for this service.")
1159    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/provider-qualification")
1160    protected CodeableConcept qualification;
1161
1162    private static final long serialVersionUID = 1758966968L;
1163
1164    /**
1165     * Constructor
1166     */
1167    public CareTeamComponent() {
1168      super();
1169    }
1170
1171    /**
1172     * Constructor
1173     */
1174    public CareTeamComponent(PositiveIntType sequence, Reference provider) {
1175      super();
1176      this.sequence = sequence;
1177      this.provider = provider;
1178    }
1179
1180    /**
1181     * @return {@link #sequence} (A number to uniquely identify care team entries.).
1182     *         This is the underlying object with id, value and extensions. The
1183     *         accessor "getSequence" gives direct access to the value
1184     */
1185    public PositiveIntType getSequenceElement() {
1186      if (this.sequence == null)
1187        if (Configuration.errorOnAutoCreate())
1188          throw new Error("Attempt to auto-create CareTeamComponent.sequence");
1189        else if (Configuration.doAutoCreate())
1190          this.sequence = new PositiveIntType(); // bb
1191      return this.sequence;
1192    }
1193
1194    public boolean hasSequenceElement() {
1195      return this.sequence != null && !this.sequence.isEmpty();
1196    }
1197
1198    public boolean hasSequence() {
1199      return this.sequence != null && !this.sequence.isEmpty();
1200    }
1201
1202    /**
1203     * @param value {@link #sequence} (A number to uniquely identify care team
1204     *              entries.). This is the underlying object with id, value and
1205     *              extensions. The accessor "getSequence" gives direct access to
1206     *              the value
1207     */
1208    public CareTeamComponent setSequenceElement(PositiveIntType value) {
1209      this.sequence = value;
1210      return this;
1211    }
1212
1213    /**
1214     * @return A number to uniquely identify care team entries.
1215     */
1216    public int getSequence() {
1217      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1218    }
1219
1220    /**
1221     * @param value A number to uniquely identify care team entries.
1222     */
1223    public CareTeamComponent setSequence(int value) {
1224      if (this.sequence == null)
1225        this.sequence = new PositiveIntType();
1226      this.sequence.setValue(value);
1227      return this;
1228    }
1229
1230    /**
1231     * @return {@link #provider} (Member of the team who provided the product or
1232     *         service.)
1233     */
1234    public Reference getProvider() {
1235      if (this.provider == null)
1236        if (Configuration.errorOnAutoCreate())
1237          throw new Error("Attempt to auto-create CareTeamComponent.provider");
1238        else if (Configuration.doAutoCreate())
1239          this.provider = new Reference(); // cc
1240      return this.provider;
1241    }
1242
1243    public boolean hasProvider() {
1244      return this.provider != null && !this.provider.isEmpty();
1245    }
1246
1247    /**
1248     * @param value {@link #provider} (Member of the team who provided the product
1249     *              or service.)
1250     */
1251    public CareTeamComponent setProvider(Reference value) {
1252      this.provider = value;
1253      return this;
1254    }
1255
1256    /**
1257     * @return {@link #provider} The actual object that is the target of the
1258     *         reference. The reference library doesn't populate this, but you can
1259     *         use it to hold the resource if you resolve it. (Member of the team
1260     *         who provided the product or service.)
1261     */
1262    public Resource getProviderTarget() {
1263      return this.providerTarget;
1264    }
1265
1266    /**
1267     * @param value {@link #provider} The actual object that is the target of the
1268     *              reference. The reference library doesn't use these, but you can
1269     *              use it to hold the resource if you resolve it. (Member of the
1270     *              team who provided the product or service.)
1271     */
1272    public CareTeamComponent setProviderTarget(Resource value) {
1273      this.providerTarget = value;
1274      return this;
1275    }
1276
1277    /**
1278     * @return {@link #responsible} (The party who is billing and/or responsible for
1279     *         the claimed products or services.). This is the underlying object
1280     *         with id, value and extensions. The accessor "getResponsible" gives
1281     *         direct access to the value
1282     */
1283    public BooleanType getResponsibleElement() {
1284      if (this.responsible == null)
1285        if (Configuration.errorOnAutoCreate())
1286          throw new Error("Attempt to auto-create CareTeamComponent.responsible");
1287        else if (Configuration.doAutoCreate())
1288          this.responsible = new BooleanType(); // bb
1289      return this.responsible;
1290    }
1291
1292    public boolean hasResponsibleElement() {
1293      return this.responsible != null && !this.responsible.isEmpty();
1294    }
1295
1296    public boolean hasResponsible() {
1297      return this.responsible != null && !this.responsible.isEmpty();
1298    }
1299
1300    /**
1301     * @param value {@link #responsible} (The party who is billing and/or
1302     *              responsible for the claimed products or services.). This is the
1303     *              underlying object with id, value and extensions. The accessor
1304     *              "getResponsible" gives direct access to the value
1305     */
1306    public CareTeamComponent setResponsibleElement(BooleanType value) {
1307      this.responsible = value;
1308      return this;
1309    }
1310
1311    /**
1312     * @return The party who is billing and/or responsible for the claimed products
1313     *         or services.
1314     */
1315    public boolean getResponsible() {
1316      return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
1317    }
1318
1319    /**
1320     * @param value The party who is billing and/or responsible for the claimed
1321     *              products or services.
1322     */
1323    public CareTeamComponent setResponsible(boolean value) {
1324      if (this.responsible == null)
1325        this.responsible = new BooleanType();
1326      this.responsible.setValue(value);
1327      return this;
1328    }
1329
1330    /**
1331     * @return {@link #role} (The lead, assisting or supervising practitioner and
1332     *         their discipline if a multidisciplinary team.)
1333     */
1334    public CodeableConcept getRole() {
1335      if (this.role == null)
1336        if (Configuration.errorOnAutoCreate())
1337          throw new Error("Attempt to auto-create CareTeamComponent.role");
1338        else if (Configuration.doAutoCreate())
1339          this.role = new CodeableConcept(); // cc
1340      return this.role;
1341    }
1342
1343    public boolean hasRole() {
1344      return this.role != null && !this.role.isEmpty();
1345    }
1346
1347    /**
1348     * @param value {@link #role} (The lead, assisting or supervising practitioner
1349     *              and their discipline if a multidisciplinary team.)
1350     */
1351    public CareTeamComponent setRole(CodeableConcept value) {
1352      this.role = value;
1353      return this;
1354    }
1355
1356    /**
1357     * @return {@link #qualification} (The qualification of the practitioner which
1358     *         is applicable for this service.)
1359     */
1360    public CodeableConcept getQualification() {
1361      if (this.qualification == null)
1362        if (Configuration.errorOnAutoCreate())
1363          throw new Error("Attempt to auto-create CareTeamComponent.qualification");
1364        else if (Configuration.doAutoCreate())
1365          this.qualification = new CodeableConcept(); // cc
1366      return this.qualification;
1367    }
1368
1369    public boolean hasQualification() {
1370      return this.qualification != null && !this.qualification.isEmpty();
1371    }
1372
1373    /**
1374     * @param value {@link #qualification} (The qualification of the practitioner
1375     *              which is applicable for this service.)
1376     */
1377    public CareTeamComponent setQualification(CodeableConcept value) {
1378      this.qualification = value;
1379      return this;
1380    }
1381
1382    protected void listChildren(List<Property> children) {
1383      super.listChildren(children);
1384      children.add(
1385          new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence));
1386      children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
1387          "Member of the team who provided the product or service.", 0, 1, provider));
1388      children.add(new Property("responsible", "boolean",
1389          "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible));
1390      children.add(new Property("role", "CodeableConcept",
1391          "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1,
1392          role));
1393      children.add(new Property("qualification", "CodeableConcept",
1394          "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification));
1395    }
1396
1397    @Override
1398    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1399      switch (_hash) {
1400      case 1349547969:
1401        /* sequence */ return new Property("sequence", "positiveInt",
1402            "A number to uniquely identify care team entries.", 0, 1, sequence);
1403      case -987494927:
1404        /* provider */ return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
1405            "Member of the team who provided the product or service.", 0, 1, provider);
1406      case 1847674614:
1407        /* responsible */ return new Property("responsible", "boolean",
1408            "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible);
1409      case 3506294:
1410        /* role */ return new Property("role", "CodeableConcept",
1411            "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1,
1412            role);
1413      case -631333393:
1414        /* qualification */ return new Property("qualification", "CodeableConcept",
1415            "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification);
1416      default:
1417        return super.getNamedProperty(_hash, _name, _checkValid);
1418      }
1419
1420    }
1421
1422    @Override
1423    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1424      switch (hash) {
1425      case 1349547969:
1426        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
1427      case -987494927:
1428        /* provider */ return this.provider == null ? new Base[0] : new Base[] { this.provider }; // Reference
1429      case 1847674614:
1430        /* responsible */ return this.responsible == null ? new Base[0] : new Base[] { this.responsible }; // BooleanType
1431      case 3506294:
1432        /* role */ return this.role == null ? new Base[0] : new Base[] { this.role }; // CodeableConcept
1433      case -631333393:
1434        /* qualification */ return this.qualification == null ? new Base[0] : new Base[] { this.qualification }; // CodeableConcept
1435      default:
1436        return super.getProperty(hash, name, checkValid);
1437      }
1438
1439    }
1440
1441    @Override
1442    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1443      switch (hash) {
1444      case 1349547969: // sequence
1445        this.sequence = castToPositiveInt(value); // PositiveIntType
1446        return value;
1447      case -987494927: // provider
1448        this.provider = castToReference(value); // Reference
1449        return value;
1450      case 1847674614: // responsible
1451        this.responsible = castToBoolean(value); // BooleanType
1452        return value;
1453      case 3506294: // role
1454        this.role = castToCodeableConcept(value); // CodeableConcept
1455        return value;
1456      case -631333393: // qualification
1457        this.qualification = castToCodeableConcept(value); // CodeableConcept
1458        return value;
1459      default:
1460        return super.setProperty(hash, name, value);
1461      }
1462
1463    }
1464
1465    @Override
1466    public Base setProperty(String name, Base value) throws FHIRException {
1467      if (name.equals("sequence")) {
1468        this.sequence = castToPositiveInt(value); // PositiveIntType
1469      } else if (name.equals("provider")) {
1470        this.provider = castToReference(value); // Reference
1471      } else if (name.equals("responsible")) {
1472        this.responsible = castToBoolean(value); // BooleanType
1473      } else if (name.equals("role")) {
1474        this.role = castToCodeableConcept(value); // CodeableConcept
1475      } else if (name.equals("qualification")) {
1476        this.qualification = castToCodeableConcept(value); // CodeableConcept
1477      } else
1478        return super.setProperty(name, value);
1479      return value;
1480    }
1481
1482  @Override
1483  public void removeChild(String name, Base value) throws FHIRException {
1484      if (name.equals("sequence")) {
1485        this.sequence = null;
1486      } else if (name.equals("provider")) {
1487        this.provider = null;
1488      } else if (name.equals("responsible")) {
1489        this.responsible = null;
1490      } else if (name.equals("role")) {
1491        this.role = null;
1492      } else if (name.equals("qualification")) {
1493        this.qualification = null;
1494      } else
1495        super.removeChild(name, value);
1496      
1497    }
1498
1499    @Override
1500    public Base makeProperty(int hash, String name) throws FHIRException {
1501      switch (hash) {
1502      case 1349547969:
1503        return getSequenceElement();
1504      case -987494927:
1505        return getProvider();
1506      case 1847674614:
1507        return getResponsibleElement();
1508      case 3506294:
1509        return getRole();
1510      case -631333393:
1511        return getQualification();
1512      default:
1513        return super.makeProperty(hash, name);
1514      }
1515
1516    }
1517
1518    @Override
1519    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1520      switch (hash) {
1521      case 1349547969:
1522        /* sequence */ return new String[] { "positiveInt" };
1523      case -987494927:
1524        /* provider */ return new String[] { "Reference" };
1525      case 1847674614:
1526        /* responsible */ return new String[] { "boolean" };
1527      case 3506294:
1528        /* role */ return new String[] { "CodeableConcept" };
1529      case -631333393:
1530        /* qualification */ return new String[] { "CodeableConcept" };
1531      default:
1532        return super.getTypesForProperty(hash, name);
1533      }
1534
1535    }
1536
1537    @Override
1538    public Base addChild(String name) throws FHIRException {
1539      if (name.equals("sequence")) {
1540        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
1541      } else if (name.equals("provider")) {
1542        this.provider = new Reference();
1543        return this.provider;
1544      } else if (name.equals("responsible")) {
1545        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.responsible");
1546      } else if (name.equals("role")) {
1547        this.role = new CodeableConcept();
1548        return this.role;
1549      } else if (name.equals("qualification")) {
1550        this.qualification = new CodeableConcept();
1551        return this.qualification;
1552      } else
1553        return super.addChild(name);
1554    }
1555
1556    public CareTeamComponent copy() {
1557      CareTeamComponent dst = new CareTeamComponent();
1558      copyValues(dst);
1559      return dst;
1560    }
1561
1562    public void copyValues(CareTeamComponent dst) {
1563      super.copyValues(dst);
1564      dst.sequence = sequence == null ? null : sequence.copy();
1565      dst.provider = provider == null ? null : provider.copy();
1566      dst.responsible = responsible == null ? null : responsible.copy();
1567      dst.role = role == null ? null : role.copy();
1568      dst.qualification = qualification == null ? null : qualification.copy();
1569    }
1570
1571    @Override
1572    public boolean equalsDeep(Base other_) {
1573      if (!super.equalsDeep(other_))
1574        return false;
1575      if (!(other_ instanceof CareTeamComponent))
1576        return false;
1577      CareTeamComponent o = (CareTeamComponent) other_;
1578      return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true)
1579          && compareDeep(responsible, o.responsible, true) && compareDeep(role, o.role, true)
1580          && compareDeep(qualification, o.qualification, true);
1581    }
1582
1583    @Override
1584    public boolean equalsShallow(Base other_) {
1585      if (!super.equalsShallow(other_))
1586        return false;
1587      if (!(other_ instanceof CareTeamComponent))
1588        return false;
1589      CareTeamComponent o = (CareTeamComponent) other_;
1590      return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true);
1591    }
1592
1593    public boolean isEmpty() {
1594      return super.isEmpty()
1595          && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible, role, qualification);
1596    }
1597
1598    public String fhirType() {
1599      return "ExplanationOfBenefit.careTeam";
1600
1601    }
1602
1603  }
1604
1605  @Block()
1606  public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
1607    /**
1608     * A number to uniquely identify supporting information entries.
1609     */
1610    @Child(name = "sequence", type = {
1611        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
1612    @Description(shortDefinition = "Information instance identifier", formalDefinition = "A number to uniquely identify supporting information entries.")
1613    protected PositiveIntType sequence;
1614
1615    /**
1616     * The general class of the information supplied: information; exception;
1617     * accident, employment; onset, etc.
1618     */
1619    @Child(name = "category", type = {
1620        CodeableConcept.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
1621    @Description(shortDefinition = "Classification of the supplied information", formalDefinition = "The general class of the information supplied: information; exception; accident, employment; onset, etc.")
1622    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-informationcategory")
1623    protected CodeableConcept category;
1624
1625    /**
1626     * System and code pertaining to the specific information regarding special
1627     * conditions relating to the setting, treatment or patient for which care is
1628     * sought.
1629     */
1630    @Child(name = "code", type = {
1631        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
1632    @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.")
1633    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-exception")
1634    protected CodeableConcept code;
1635
1636    /**
1637     * The date when or period to which this information refers.
1638     */
1639    @Child(name = "timing", type = { DateType.class,
1640        Period.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
1641    @Description(shortDefinition = "When it occurred", formalDefinition = "The date when or period to which this information refers.")
1642    protected Type timing;
1643
1644    /**
1645     * Additional data or information such as resources, documents, images etc.
1646     * including references to the data or the actual inclusion of the data.
1647     */
1648    @Child(name = "value", type = { BooleanType.class, StringType.class, Quantity.class, Attachment.class,
1649        Reference.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
1650    @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.")
1651    protected Type value;
1652
1653    /**
1654     * Provides the reason in the situation where a reason code is required in
1655     * addition to the content.
1656     */
1657    @Child(name = "reason", type = { Coding.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
1658    @Description(shortDefinition = "Explanation for the information", formalDefinition = "Provides the reason in the situation where a reason code is required in addition to the content.")
1659    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/missing-tooth-reason")
1660    protected Coding reason;
1661
1662    private static final long serialVersionUID = -410136661L;
1663
1664    /**
1665     * Constructor
1666     */
1667    public SupportingInformationComponent() {
1668      super();
1669    }
1670
1671    /**
1672     * Constructor
1673     */
1674    public SupportingInformationComponent(PositiveIntType sequence, CodeableConcept category) {
1675      super();
1676      this.sequence = sequence;
1677      this.category = category;
1678    }
1679
1680    /**
1681     * @return {@link #sequence} (A number to uniquely identify supporting
1682     *         information entries.). This is the underlying object with id, value
1683     *         and extensions. The accessor "getSequence" gives direct access to the
1684     *         value
1685     */
1686    public PositiveIntType getSequenceElement() {
1687      if (this.sequence == null)
1688        if (Configuration.errorOnAutoCreate())
1689          throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
1690        else if (Configuration.doAutoCreate())
1691          this.sequence = new PositiveIntType(); // bb
1692      return this.sequence;
1693    }
1694
1695    public boolean hasSequenceElement() {
1696      return this.sequence != null && !this.sequence.isEmpty();
1697    }
1698
1699    public boolean hasSequence() {
1700      return this.sequence != null && !this.sequence.isEmpty();
1701    }
1702
1703    /**
1704     * @param value {@link #sequence} (A number to uniquely identify supporting
1705     *              information entries.). This is the underlying object with id,
1706     *              value and extensions. The accessor "getSequence" gives direct
1707     *              access to the value
1708     */
1709    public SupportingInformationComponent setSequenceElement(PositiveIntType value) {
1710      this.sequence = value;
1711      return this;
1712    }
1713
1714    /**
1715     * @return A number to uniquely identify supporting information entries.
1716     */
1717    public int getSequence() {
1718      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1719    }
1720
1721    /**
1722     * @param value A number to uniquely identify supporting information entries.
1723     */
1724    public SupportingInformationComponent setSequence(int value) {
1725      if (this.sequence == null)
1726        this.sequence = new PositiveIntType();
1727      this.sequence.setValue(value);
1728      return this;
1729    }
1730
1731    /**
1732     * @return {@link #category} (The general class of the information supplied:
1733     *         information; exception; accident, employment; onset, etc.)
1734     */
1735    public CodeableConcept getCategory() {
1736      if (this.category == null)
1737        if (Configuration.errorOnAutoCreate())
1738          throw new Error("Attempt to auto-create SupportingInformationComponent.category");
1739        else if (Configuration.doAutoCreate())
1740          this.category = new CodeableConcept(); // cc
1741      return this.category;
1742    }
1743
1744    public boolean hasCategory() {
1745      return this.category != null && !this.category.isEmpty();
1746    }
1747
1748    /**
1749     * @param value {@link #category} (The general class of the information
1750     *              supplied: information; exception; accident, employment; onset,
1751     *              etc.)
1752     */
1753    public SupportingInformationComponent setCategory(CodeableConcept value) {
1754      this.category = value;
1755      return this;
1756    }
1757
1758    /**
1759     * @return {@link #code} (System and code pertaining to the specific information
1760     *         regarding special conditions relating to the setting, treatment or
1761     *         patient for which care is sought.)
1762     */
1763    public CodeableConcept getCode() {
1764      if (this.code == null)
1765        if (Configuration.errorOnAutoCreate())
1766          throw new Error("Attempt to auto-create SupportingInformationComponent.code");
1767        else if (Configuration.doAutoCreate())
1768          this.code = new CodeableConcept(); // cc
1769      return this.code;
1770    }
1771
1772    public boolean hasCode() {
1773      return this.code != null && !this.code.isEmpty();
1774    }
1775
1776    /**
1777     * @param value {@link #code} (System and code pertaining to the specific
1778     *              information regarding special conditions relating to the
1779     *              setting, treatment or patient for which care is sought.)
1780     */
1781    public SupportingInformationComponent setCode(CodeableConcept value) {
1782      this.code = value;
1783      return this;
1784    }
1785
1786    /**
1787     * @return {@link #timing} (The date when or period to which this information
1788     *         refers.)
1789     */
1790    public Type getTiming() {
1791      return this.timing;
1792    }
1793
1794    /**
1795     * @return {@link #timing} (The date when or period to which this information
1796     *         refers.)
1797     */
1798    public DateType getTimingDateType() throws FHIRException {
1799      if (this.timing == null)
1800        this.timing = new DateType();
1801      if (!(this.timing instanceof DateType))
1802        throw new FHIRException("Type mismatch: the type DateType was expected, but " + this.timing.getClass().getName()
1803            + " was encountered");
1804      return (DateType) this.timing;
1805    }
1806
1807    public boolean hasTimingDateType() {
1808        return this.timing instanceof DateType;
1809    }
1810
1811    /**
1812     * @return {@link #timing} (The date when or period to which this information
1813     *         refers.)
1814     */
1815    public Period getTimingPeriod() throws FHIRException {
1816      if (this.timing == null)
1817        this.timing = new Period();
1818      if (!(this.timing instanceof Period))
1819        throw new FHIRException("Type mismatch: the type Period was expected, but " + this.timing.getClass().getName()
1820            + " was encountered");
1821      return (Period) this.timing;
1822    }
1823
1824    public boolean hasTimingPeriod() {
1825        return this.timing instanceof Period;
1826    }
1827
1828    public boolean hasTiming() {
1829      return this.timing != null && !this.timing.isEmpty();
1830    }
1831
1832    /**
1833     * @param value {@link #timing} (The date when or period to which this
1834     *              information refers.)
1835     */
1836    public SupportingInformationComponent setTiming(Type value) {
1837      if (value != null && !(value instanceof DateType || value instanceof Period))
1838        throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.timing[x]: " + value.fhirType());
1839      this.timing = value;
1840      return this;
1841    }
1842
1843    /**
1844     * @return {@link #value} (Additional data or information such as resources,
1845     *         documents, images etc. including references to the data or the actual
1846     *         inclusion of the data.)
1847     */
1848    public Type getValue() {
1849      return this.value;
1850    }
1851
1852    /**
1853     * @return {@link #value} (Additional data or information such as resources,
1854     *         documents, images etc. including references to the data or the actual
1855     *         inclusion of the data.)
1856     */
1857    public BooleanType getValueBooleanType() throws FHIRException {
1858      if (this.value == null)
1859        this.value = new BooleanType();
1860      if (!(this.value instanceof BooleanType))
1861        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "
1862            + this.value.getClass().getName() + " was encountered");
1863      return (BooleanType) this.value;
1864    }
1865
1866    public boolean hasValueBooleanType() {
1867        return this.value instanceof BooleanType;
1868    }
1869
1870    /**
1871     * @return {@link #value} (Additional data or information such as resources,
1872     *         documents, images etc. including references to the data or the actual
1873     *         inclusion of the data.)
1874     */
1875    public StringType getValueStringType() throws FHIRException {
1876      if (this.value == null)
1877        this.value = new StringType();
1878      if (!(this.value instanceof StringType))
1879        throw new FHIRException("Type mismatch: the type StringType was expected, but "
1880            + this.value.getClass().getName() + " was encountered");
1881      return (StringType) this.value;
1882    }
1883
1884    public boolean hasValueStringType() {
1885        return this.value instanceof StringType;
1886    }
1887
1888    /**
1889     * @return {@link #value} (Additional data or information such as resources,
1890     *         documents, images etc. including references to the data or the actual
1891     *         inclusion of the data.)
1892     */
1893    public Quantity getValueQuantity() throws FHIRException {
1894      if (this.value == null)
1895        this.value = new Quantity();
1896      if (!(this.value instanceof Quantity))
1897        throw new FHIRException("Type mismatch: the type Quantity was expected, but " + this.value.getClass().getName()
1898            + " was encountered");
1899      return (Quantity) this.value;
1900    }
1901
1902    public boolean hasValueQuantity() {
1903        return this.value instanceof Quantity;
1904    }
1905
1906    /**
1907     * @return {@link #value} (Additional data or information such as resources,
1908     *         documents, images etc. including references to the data or the actual
1909     *         inclusion of the data.)
1910     */
1911    public Attachment getValueAttachment() throws FHIRException {
1912      if (this.value == null)
1913        this.value = new Attachment();
1914      if (!(this.value instanceof Attachment))
1915        throw new FHIRException("Type mismatch: the type Attachment was expected, but "
1916            + this.value.getClass().getName() + " was encountered");
1917      return (Attachment) this.value;
1918    }
1919
1920    public boolean hasValueAttachment() {
1921        return this.value instanceof Attachment;
1922    }
1923
1924    /**
1925     * @return {@link #value} (Additional data or information such as resources,
1926     *         documents, images etc. including references to the data or the actual
1927     *         inclusion of the data.)
1928     */
1929    public Reference getValueReference() throws FHIRException {
1930      if (this.value == null)
1931        this.value = new Reference();
1932      if (!(this.value instanceof Reference))
1933        throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.value.getClass().getName()
1934            + " was encountered");
1935      return (Reference) this.value;
1936    }
1937
1938    public boolean hasValueReference() {
1939        return this.value instanceof Reference;
1940    }
1941
1942    public boolean hasValue() {
1943      return this.value != null && !this.value.isEmpty();
1944    }
1945
1946    /**
1947     * @param value {@link #value} (Additional data or information such as
1948     *              resources, documents, images etc. including references to the
1949     *              data or the actual inclusion of the data.)
1950     */
1951    public SupportingInformationComponent setValue(Type value) {
1952      if (value != null && !(value instanceof BooleanType || value instanceof StringType || value instanceof Quantity
1953          || value instanceof Attachment || value instanceof Reference))
1954        throw new Error("Not the right type for ExplanationOfBenefit.supportingInfo.value[x]: " + value.fhirType());
1955      this.value = value;
1956      return this;
1957    }
1958
1959    /**
1960     * @return {@link #reason} (Provides the reason in the situation where a reason
1961     *         code is required in addition to the content.)
1962     */
1963    public Coding getReason() {
1964      if (this.reason == null)
1965        if (Configuration.errorOnAutoCreate())
1966          throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1967        else if (Configuration.doAutoCreate())
1968          this.reason = new Coding(); // cc
1969      return this.reason;
1970    }
1971
1972    public boolean hasReason() {
1973      return this.reason != null && !this.reason.isEmpty();
1974    }
1975
1976    /**
1977     * @param value {@link #reason} (Provides the reason in the situation where a
1978     *              reason code is required in addition to the content.)
1979     */
1980    public SupportingInformationComponent setReason(Coding value) {
1981      this.reason = value;
1982      return this;
1983    }
1984
1985    protected void listChildren(List<Property> children) {
1986      super.listChildren(children);
1987      children.add(new Property("sequence", "positiveInt",
1988          "A number to uniquely identify supporting information entries.", 0, 1, sequence));
1989      children.add(new Property("category", "CodeableConcept",
1990          "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0,
1991          1, category));
1992      children.add(new Property("code", "CodeableConcept",
1993          "System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.",
1994          0, 1, code));
1995      children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.",
1996          0, 1, timing));
1997      children.add(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      children.add(new Property("reason", "Coding",
2001          "Provides the reason in the situation where a reason code is required in addition to the content.", 0, 1,
2002          reason));
2003    }
2004
2005    @Override
2006    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2007      switch (_hash) {
2008      case 1349547969:
2009        /* sequence */ return new Property("sequence", "positiveInt",
2010            "A number to uniquely identify supporting information entries.", 0, 1, sequence);
2011      case 50511102:
2012        /* category */ return new Property("category", "CodeableConcept",
2013            "The general class of the information supplied: information; exception; accident, employment; onset, etc.",
2014            0, 1, category);
2015      case 3059181:
2016        /* code */ return new Property("code", "CodeableConcept",
2017            "System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.",
2018            0, 1, code);
2019      case 164632566:
2020        /* timing[x] */ return new Property("timing[x]", "date|Period",
2021            "The date when or period to which this information refers.", 0, 1, timing);
2022      case -873664438:
2023        /* timing */ return new Property("timing[x]", "date|Period",
2024            "The date when or period to which this information refers.", 0, 1, timing);
2025      case 807935768:
2026        /* timingDate */ return new Property("timing[x]", "date|Period",
2027            "The date when or period to which this information refers.", 0, 1, timing);
2028      case -615615829:
2029        /* timingPeriod */ return new Property("timing[x]", "date|Period",
2030            "The date when or period to which this information refers.", 0, 1, timing);
2031      case -1410166417:
2032        /* value[x] */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
2033            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
2034            0, 1, value);
2035      case 111972721:
2036        /* value */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
2037            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
2038            0, 1, value);
2039      case 733421943:
2040        /* valueBoolean */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
2041            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
2042            0, 1, value);
2043      case -1424603934:
2044        /* valueString */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
2045            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
2046            0, 1, value);
2047      case -2029823716:
2048        /* valueQuantity */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
2049            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
2050            0, 1, value);
2051      case -475566732:
2052        /* valueAttachment */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
2053            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
2054            0, 1, value);
2055      case 1755241690:
2056        /* valueReference */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
2057            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
2058            0, 1, value);
2059      case -934964668:
2060        /* reason */ return new Property("reason", "Coding",
2061            "Provides the reason in the situation where a reason code is required in addition to the content.", 0, 1,
2062            reason);
2063      default:
2064        return super.getNamedProperty(_hash, _name, _checkValid);
2065      }
2066
2067    }
2068
2069    @Override
2070    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2071      switch (hash) {
2072      case 1349547969:
2073        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
2074      case 50511102:
2075        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
2076      case 3059181:
2077        /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
2078      case -873664438:
2079        /* timing */ return this.timing == null ? new Base[0] : new Base[] { this.timing }; // Type
2080      case 111972721:
2081        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // Type
2082      case -934964668:
2083        /* reason */ return this.reason == null ? new Base[0] : new Base[] { this.reason }; // Coding
2084      default:
2085        return super.getProperty(hash, name, checkValid);
2086      }
2087
2088    }
2089
2090    @Override
2091    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2092      switch (hash) {
2093      case 1349547969: // sequence
2094        this.sequence = castToPositiveInt(value); // PositiveIntType
2095        return value;
2096      case 50511102: // category
2097        this.category = castToCodeableConcept(value); // CodeableConcept
2098        return value;
2099      case 3059181: // code
2100        this.code = castToCodeableConcept(value); // CodeableConcept
2101        return value;
2102      case -873664438: // timing
2103        this.timing = castToType(value); // Type
2104        return value;
2105      case 111972721: // value
2106        this.value = castToType(value); // Type
2107        return value;
2108      case -934964668: // reason
2109        this.reason = castToCoding(value); // Coding
2110        return value;
2111      default:
2112        return super.setProperty(hash, name, value);
2113      }
2114
2115    }
2116
2117    @Override
2118    public Base setProperty(String name, Base value) throws FHIRException {
2119      if (name.equals("sequence")) {
2120        this.sequence = castToPositiveInt(value); // PositiveIntType
2121      } else if (name.equals("category")) {
2122        this.category = castToCodeableConcept(value); // CodeableConcept
2123      } else if (name.equals("code")) {
2124        this.code = castToCodeableConcept(value); // CodeableConcept
2125      } else if (name.equals("timing[x]")) {
2126        this.timing = castToType(value); // Type
2127      } else if (name.equals("value[x]")) {
2128        this.value = castToType(value); // Type
2129      } else if (name.equals("reason")) {
2130        this.reason = castToCoding(value); // Coding
2131      } else
2132        return super.setProperty(name, value);
2133      return value;
2134    }
2135
2136  @Override
2137  public void removeChild(String name, Base value) throws FHIRException {
2138      if (name.equals("sequence")) {
2139        this.sequence = null;
2140      } else if (name.equals("category")) {
2141        this.category = null;
2142      } else if (name.equals("code")) {
2143        this.code = null;
2144      } else if (name.equals("timing[x]")) {
2145        this.timing = null;
2146      } else if (name.equals("value[x]")) {
2147        this.value = null;
2148      } else if (name.equals("reason")) {
2149        this.reason = null;
2150      } else
2151        super.removeChild(name, value);
2152      
2153    }
2154
2155    @Override
2156    public Base makeProperty(int hash, String name) throws FHIRException {
2157      switch (hash) {
2158      case 1349547969:
2159        return getSequenceElement();
2160      case 50511102:
2161        return getCategory();
2162      case 3059181:
2163        return getCode();
2164      case 164632566:
2165        return getTiming();
2166      case -873664438:
2167        return getTiming();
2168      case -1410166417:
2169        return getValue();
2170      case 111972721:
2171        return getValue();
2172      case -934964668:
2173        return getReason();
2174      default:
2175        return super.makeProperty(hash, name);
2176      }
2177
2178    }
2179
2180    @Override
2181    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2182      switch (hash) {
2183      case 1349547969:
2184        /* sequence */ return new String[] { "positiveInt" };
2185      case 50511102:
2186        /* category */ return new String[] { "CodeableConcept" };
2187      case 3059181:
2188        /* code */ return new String[] { "CodeableConcept" };
2189      case -873664438:
2190        /* timing */ return new String[] { "date", "Period" };
2191      case 111972721:
2192        /* value */ return new String[] { "boolean", "string", "Quantity", "Attachment", "Reference" };
2193      case -934964668:
2194        /* reason */ return new String[] { "Coding" };
2195      default:
2196        return super.getTypesForProperty(hash, name);
2197      }
2198
2199    }
2200
2201    @Override
2202    public Base addChild(String name) throws FHIRException {
2203      if (name.equals("sequence")) {
2204        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
2205      } else if (name.equals("category")) {
2206        this.category = new CodeableConcept();
2207        return this.category;
2208      } else if (name.equals("code")) {
2209        this.code = new CodeableConcept();
2210        return this.code;
2211      } else if (name.equals("timingDate")) {
2212        this.timing = new DateType();
2213        return this.timing;
2214      } else if (name.equals("timingPeriod")) {
2215        this.timing = new Period();
2216        return this.timing;
2217      } else if (name.equals("valueBoolean")) {
2218        this.value = new BooleanType();
2219        return this.value;
2220      } else if (name.equals("valueString")) {
2221        this.value = new StringType();
2222        return this.value;
2223      } else if (name.equals("valueQuantity")) {
2224        this.value = new Quantity();
2225        return this.value;
2226      } else if (name.equals("valueAttachment")) {
2227        this.value = new Attachment();
2228        return this.value;
2229      } else if (name.equals("valueReference")) {
2230        this.value = new Reference();
2231        return this.value;
2232      } else if (name.equals("reason")) {
2233        this.reason = new Coding();
2234        return this.reason;
2235      } else
2236        return super.addChild(name);
2237    }
2238
2239    public SupportingInformationComponent copy() {
2240      SupportingInformationComponent dst = new SupportingInformationComponent();
2241      copyValues(dst);
2242      return dst;
2243    }
2244
2245    public void copyValues(SupportingInformationComponent dst) {
2246      super.copyValues(dst);
2247      dst.sequence = sequence == null ? null : sequence.copy();
2248      dst.category = category == null ? null : category.copy();
2249      dst.code = code == null ? null : code.copy();
2250      dst.timing = timing == null ? null : timing.copy();
2251      dst.value = value == null ? null : value.copy();
2252      dst.reason = reason == null ? null : reason.copy();
2253    }
2254
2255    @Override
2256    public boolean equalsDeep(Base other_) {
2257      if (!super.equalsDeep(other_))
2258        return false;
2259      if (!(other_ instanceof SupportingInformationComponent))
2260        return false;
2261      SupportingInformationComponent o = (SupportingInformationComponent) other_;
2262      return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true)
2263          && compareDeep(code, o.code, true) && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true)
2264          && compareDeep(reason, o.reason, true);
2265    }
2266
2267    @Override
2268    public boolean equalsShallow(Base other_) {
2269      if (!super.equalsShallow(other_))
2270        return false;
2271      if (!(other_ instanceof SupportingInformationComponent))
2272        return false;
2273      SupportingInformationComponent o = (SupportingInformationComponent) other_;
2274      return compareValues(sequence, o.sequence, true);
2275    }
2276
2277    public boolean isEmpty() {
2278      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code, timing, value, reason);
2279    }
2280
2281    public String fhirType() {
2282      return "ExplanationOfBenefit.supportingInfo";
2283
2284    }
2285
2286  }
2287
2288  @Block()
2289  public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
2290    /**
2291     * A number to uniquely identify diagnosis entries.
2292     */
2293    @Child(name = "sequence", type = {
2294        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
2295    @Description(shortDefinition = "Diagnosis instance identifier", formalDefinition = "A number to uniquely identify diagnosis entries.")
2296    protected PositiveIntType sequence;
2297
2298    /**
2299     * The nature of illness or problem in a coded form or as a reference to an
2300     * external defined Condition.
2301     */
2302    @Child(name = "diagnosis", type = { CodeableConcept.class,
2303        Condition.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
2304    @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.")
2305    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/icd-10")
2306    protected Type diagnosis;
2307
2308    /**
2309     * When the condition was observed or the relative ranking.
2310     */
2311    @Child(name = "type", type = {
2312        CodeableConcept.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2313    @Description(shortDefinition = "Timing or nature of the diagnosis", formalDefinition = "When the condition was observed or the relative ranking.")
2314    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-diagnosistype")
2315    protected List<CodeableConcept> type;
2316
2317    /**
2318     * Indication of whether the diagnosis was present on admission to a facility.
2319     */
2320    @Child(name = "onAdmission", type = {
2321        CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
2322    @Description(shortDefinition = "Present on admission", formalDefinition = "Indication of whether the diagnosis was present on admission to a facility.")
2323    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-diagnosis-on-admission")
2324    protected CodeableConcept onAdmission;
2325
2326    /**
2327     * A package billing code or bundle code used to group products and services to
2328     * a particular health condition (such as heart attack) which is based on a
2329     * predetermined grouping code system.
2330     */
2331    @Child(name = "packageCode", type = {
2332        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
2333    @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.")
2334    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
2335    protected CodeableConcept packageCode;
2336
2337    private static final long serialVersionUID = 2120593974L;
2338
2339    /**
2340     * Constructor
2341     */
2342    public DiagnosisComponent() {
2343      super();
2344    }
2345
2346    /**
2347     * Constructor
2348     */
2349    public DiagnosisComponent(PositiveIntType sequence, Type diagnosis) {
2350      super();
2351      this.sequence = sequence;
2352      this.diagnosis = diagnosis;
2353    }
2354
2355    /**
2356     * @return {@link #sequence} (A number to uniquely identify diagnosis entries.).
2357     *         This is the underlying object with id, value and extensions. The
2358     *         accessor "getSequence" gives direct access to the value
2359     */
2360    public PositiveIntType getSequenceElement() {
2361      if (this.sequence == null)
2362        if (Configuration.errorOnAutoCreate())
2363          throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
2364        else if (Configuration.doAutoCreate())
2365          this.sequence = new PositiveIntType(); // bb
2366      return this.sequence;
2367    }
2368
2369    public boolean hasSequenceElement() {
2370      return this.sequence != null && !this.sequence.isEmpty();
2371    }
2372
2373    public boolean hasSequence() {
2374      return this.sequence != null && !this.sequence.isEmpty();
2375    }
2376
2377    /**
2378     * @param value {@link #sequence} (A number to uniquely identify diagnosis
2379     *              entries.). This is the underlying object with id, value and
2380     *              extensions. The accessor "getSequence" gives direct access to
2381     *              the value
2382     */
2383    public DiagnosisComponent setSequenceElement(PositiveIntType value) {
2384      this.sequence = value;
2385      return this;
2386    }
2387
2388    /**
2389     * @return A number to uniquely identify diagnosis entries.
2390     */
2391    public int getSequence() {
2392      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2393    }
2394
2395    /**
2396     * @param value A number to uniquely identify diagnosis entries.
2397     */
2398    public DiagnosisComponent setSequence(int value) {
2399      if (this.sequence == null)
2400        this.sequence = new PositiveIntType();
2401      this.sequence.setValue(value);
2402      return this;
2403    }
2404
2405    /**
2406     * @return {@link #diagnosis} (The nature of illness or problem in a coded form
2407     *         or as a reference to an external defined Condition.)
2408     */
2409    public Type getDiagnosis() {
2410      return this.diagnosis;
2411    }
2412
2413    /**
2414     * @return {@link #diagnosis} (The nature of illness or problem in a coded form
2415     *         or as a reference to an external defined Condition.)
2416     */
2417    public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException {
2418      if (this.diagnosis == null)
2419        this.diagnosis = new CodeableConcept();
2420      if (!(this.diagnosis instanceof CodeableConcept))
2421        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
2422            + this.diagnosis.getClass().getName() + " was encountered");
2423      return (CodeableConcept) this.diagnosis;
2424    }
2425
2426    public boolean hasDiagnosisCodeableConcept() {
2427        return this.diagnosis instanceof CodeableConcept;
2428    }
2429
2430    /**
2431     * @return {@link #diagnosis} (The nature of illness or problem in a coded form
2432     *         or as a reference to an external defined Condition.)
2433     */
2434    public Reference getDiagnosisReference() throws FHIRException {
2435      if (this.diagnosis == null)
2436        this.diagnosis = new Reference();
2437      if (!(this.diagnosis instanceof Reference))
2438        throw new FHIRException("Type mismatch: the type Reference was expected, but "
2439            + this.diagnosis.getClass().getName() + " was encountered");
2440      return (Reference) this.diagnosis;
2441    }
2442
2443    public boolean hasDiagnosisReference() {
2444        return this.diagnosis instanceof Reference;
2445    }
2446
2447    public boolean hasDiagnosis() {
2448      return this.diagnosis != null && !this.diagnosis.isEmpty();
2449    }
2450
2451    /**
2452     * @param value {@link #diagnosis} (The nature of illness or problem in a coded
2453     *              form or as a reference to an external defined Condition.)
2454     */
2455    public DiagnosisComponent setDiagnosis(Type value) {
2456      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2457        throw new Error("Not the right type for ExplanationOfBenefit.diagnosis.diagnosis[x]: " + value.fhirType());
2458      this.diagnosis = value;
2459      return this;
2460    }
2461
2462    /**
2463     * @return {@link #type} (When the condition was observed or the relative
2464     *         ranking.)
2465     */
2466    public List<CodeableConcept> getType() {
2467      if (this.type == null)
2468        this.type = new ArrayList<CodeableConcept>();
2469      return this.type;
2470    }
2471
2472    /**
2473     * @return Returns a reference to <code>this</code> for easy method chaining
2474     */
2475    public DiagnosisComponent setType(List<CodeableConcept> theType) {
2476      this.type = theType;
2477      return this;
2478    }
2479
2480    public boolean hasType() {
2481      if (this.type == null)
2482        return false;
2483      for (CodeableConcept item : this.type)
2484        if (!item.isEmpty())
2485          return true;
2486      return false;
2487    }
2488
2489    public CodeableConcept addType() { // 3
2490      CodeableConcept t = new CodeableConcept();
2491      if (this.type == null)
2492        this.type = new ArrayList<CodeableConcept>();
2493      this.type.add(t);
2494      return t;
2495    }
2496
2497    public DiagnosisComponent addType(CodeableConcept t) { // 3
2498      if (t == null)
2499        return this;
2500      if (this.type == null)
2501        this.type = new ArrayList<CodeableConcept>();
2502      this.type.add(t);
2503      return this;
2504    }
2505
2506    /**
2507     * @return The first repetition of repeating field {@link #type}, creating it if
2508     *         it does not already exist
2509     */
2510    public CodeableConcept getTypeFirstRep() {
2511      if (getType().isEmpty()) {
2512        addType();
2513      }
2514      return getType().get(0);
2515    }
2516
2517    /**
2518     * @return {@link #onAdmission} (Indication of whether the diagnosis was present
2519     *         on admission to a facility.)
2520     */
2521    public CodeableConcept getOnAdmission() {
2522      if (this.onAdmission == null)
2523        if (Configuration.errorOnAutoCreate())
2524          throw new Error("Attempt to auto-create DiagnosisComponent.onAdmission");
2525        else if (Configuration.doAutoCreate())
2526          this.onAdmission = new CodeableConcept(); // cc
2527      return this.onAdmission;
2528    }
2529
2530    public boolean hasOnAdmission() {
2531      return this.onAdmission != null && !this.onAdmission.isEmpty();
2532    }
2533
2534    /**
2535     * @param value {@link #onAdmission} (Indication of whether the diagnosis was
2536     *              present on admission to a facility.)
2537     */
2538    public DiagnosisComponent setOnAdmission(CodeableConcept value) {
2539      this.onAdmission = value;
2540      return this;
2541    }
2542
2543    /**
2544     * @return {@link #packageCode} (A package billing code or bundle code used to
2545     *         group products and services to a particular health condition (such as
2546     *         heart attack) which is based on a predetermined grouping code
2547     *         system.)
2548     */
2549    public CodeableConcept getPackageCode() {
2550      if (this.packageCode == null)
2551        if (Configuration.errorOnAutoCreate())
2552          throw new Error("Attempt to auto-create DiagnosisComponent.packageCode");
2553        else if (Configuration.doAutoCreate())
2554          this.packageCode = new CodeableConcept(); // cc
2555      return this.packageCode;
2556    }
2557
2558    public boolean hasPackageCode() {
2559      return this.packageCode != null && !this.packageCode.isEmpty();
2560    }
2561
2562    /**
2563     * @param value {@link #packageCode} (A package billing code or bundle code used
2564     *              to group products and services to a particular health condition
2565     *              (such as heart attack) which is based on a predetermined
2566     *              grouping code system.)
2567     */
2568    public DiagnosisComponent setPackageCode(CodeableConcept value) {
2569      this.packageCode = value;
2570      return this;
2571    }
2572
2573    protected void listChildren(List<Property> children) {
2574      super.listChildren(children);
2575      children.add(
2576          new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence));
2577      children.add(new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2578          "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1,
2579          diagnosis));
2580      children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.",
2581          0, java.lang.Integer.MAX_VALUE, type));
2582      children.add(new Property("onAdmission", "CodeableConcept",
2583          "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission));
2584      children.add(new Property("packageCode", "CodeableConcept",
2585          "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.",
2586          0, 1, packageCode));
2587    }
2588
2589    @Override
2590    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2591      switch (_hash) {
2592      case 1349547969:
2593        /* sequence */ return new Property("sequence", "positiveInt",
2594            "A number to uniquely identify diagnosis entries.", 0, 1, sequence);
2595      case -1487009809:
2596        /* diagnosis[x] */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2597            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2598            1, diagnosis);
2599      case 1196993265:
2600        /* diagnosis */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2601            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2602            1, diagnosis);
2603      case 277781616:
2604        /* diagnosisCodeableConcept */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2605            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2606            1, diagnosis);
2607      case 2050454362:
2608        /* diagnosisReference */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2609            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2610            1, diagnosis);
2611      case 3575610:
2612        /* type */ return new Property("type", "CodeableConcept",
2613            "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2614      case -3386134:
2615        /* onAdmission */ return new Property("onAdmission", "CodeableConcept",
2616            "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission);
2617      case 908444499:
2618        /* packageCode */ return new Property("packageCode", "CodeableConcept",
2619            "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.",
2620            0, 1, packageCode);
2621      default:
2622        return super.getNamedProperty(_hash, _name, _checkValid);
2623      }
2624
2625    }
2626
2627    @Override
2628    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2629      switch (hash) {
2630      case 1349547969:
2631        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
2632      case 1196993265:
2633        /* diagnosis */ return this.diagnosis == null ? new Base[0] : new Base[] { this.diagnosis }; // Type
2634      case 3575610:
2635        /* type */ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2636      case -3386134:
2637        /* onAdmission */ return this.onAdmission == null ? new Base[0] : new Base[] { this.onAdmission }; // CodeableConcept
2638      case 908444499:
2639        /* packageCode */ return this.packageCode == null ? new Base[0] : new Base[] { this.packageCode }; // CodeableConcept
2640      default:
2641        return super.getProperty(hash, name, checkValid);
2642      }
2643
2644    }
2645
2646    @Override
2647    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2648      switch (hash) {
2649      case 1349547969: // sequence
2650        this.sequence = castToPositiveInt(value); // PositiveIntType
2651        return value;
2652      case 1196993265: // diagnosis
2653        this.diagnosis = castToType(value); // Type
2654        return value;
2655      case 3575610: // type
2656        this.getType().add(castToCodeableConcept(value)); // CodeableConcept
2657        return value;
2658      case -3386134: // onAdmission
2659        this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2660        return value;
2661      case 908444499: // packageCode
2662        this.packageCode = castToCodeableConcept(value); // CodeableConcept
2663        return value;
2664      default:
2665        return super.setProperty(hash, name, value);
2666      }
2667
2668    }
2669
2670    @Override
2671    public Base setProperty(String name, Base value) throws FHIRException {
2672      if (name.equals("sequence")) {
2673        this.sequence = castToPositiveInt(value); // PositiveIntType
2674      } else if (name.equals("diagnosis[x]")) {
2675        this.diagnosis = castToType(value); // Type
2676      } else if (name.equals("type")) {
2677        this.getType().add(castToCodeableConcept(value));
2678      } else if (name.equals("onAdmission")) {
2679        this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2680      } else if (name.equals("packageCode")) {
2681        this.packageCode = castToCodeableConcept(value); // CodeableConcept
2682      } else
2683        return super.setProperty(name, value);
2684      return value;
2685    }
2686
2687  @Override
2688  public void removeChild(String name, Base value) throws FHIRException {
2689      if (name.equals("sequence")) {
2690        this.sequence = null;
2691      } else if (name.equals("diagnosis[x]")) {
2692        this.diagnosis = null;
2693      } else if (name.equals("type")) {
2694        this.getType().remove(castToCodeableConcept(value));
2695      } else if (name.equals("onAdmission")) {
2696        this.onAdmission = null;
2697      } else if (name.equals("packageCode")) {
2698        this.packageCode = null;
2699      } else
2700        super.removeChild(name, value);
2701      
2702    }
2703
2704    @Override
2705    public Base makeProperty(int hash, String name) throws FHIRException {
2706      switch (hash) {
2707      case 1349547969:
2708        return getSequenceElement();
2709      case -1487009809:
2710        return getDiagnosis();
2711      case 1196993265:
2712        return getDiagnosis();
2713      case 3575610:
2714        return addType();
2715      case -3386134:
2716        return getOnAdmission();
2717      case 908444499:
2718        return getPackageCode();
2719      default:
2720        return super.makeProperty(hash, name);
2721      }
2722
2723    }
2724
2725    @Override
2726    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2727      switch (hash) {
2728      case 1349547969:
2729        /* sequence */ return new String[] { "positiveInt" };
2730      case 1196993265:
2731        /* diagnosis */ return new String[] { "CodeableConcept", "Reference" };
2732      case 3575610:
2733        /* type */ return new String[] { "CodeableConcept" };
2734      case -3386134:
2735        /* onAdmission */ return new String[] { "CodeableConcept" };
2736      case 908444499:
2737        /* packageCode */ return new String[] { "CodeableConcept" };
2738      default:
2739        return super.getTypesForProperty(hash, name);
2740      }
2741
2742    }
2743
2744    @Override
2745    public Base addChild(String name) throws FHIRException {
2746      if (name.equals("sequence")) {
2747        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
2748      } else if (name.equals("diagnosisCodeableConcept")) {
2749        this.diagnosis = new CodeableConcept();
2750        return this.diagnosis;
2751      } else if (name.equals("diagnosisReference")) {
2752        this.diagnosis = new Reference();
2753        return this.diagnosis;
2754      } else if (name.equals("type")) {
2755        return addType();
2756      } else if (name.equals("onAdmission")) {
2757        this.onAdmission = new CodeableConcept();
2758        return this.onAdmission;
2759      } else if (name.equals("packageCode")) {
2760        this.packageCode = new CodeableConcept();
2761        return this.packageCode;
2762      } else
2763        return super.addChild(name);
2764    }
2765
2766    public DiagnosisComponent copy() {
2767      DiagnosisComponent dst = new DiagnosisComponent();
2768      copyValues(dst);
2769      return dst;
2770    }
2771
2772    public void copyValues(DiagnosisComponent dst) {
2773      super.copyValues(dst);
2774      dst.sequence = sequence == null ? null : sequence.copy();
2775      dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
2776      if (type != null) {
2777        dst.type = new ArrayList<CodeableConcept>();
2778        for (CodeableConcept i : type)
2779          dst.type.add(i.copy());
2780      }
2781      ;
2782      dst.onAdmission = onAdmission == null ? null : onAdmission.copy();
2783      dst.packageCode = packageCode == null ? null : packageCode.copy();
2784    }
2785
2786    @Override
2787    public boolean equalsDeep(Base other_) {
2788      if (!super.equalsDeep(other_))
2789        return false;
2790      if (!(other_ instanceof DiagnosisComponent))
2791        return false;
2792      DiagnosisComponent o = (DiagnosisComponent) other_;
2793      return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true)
2794          && compareDeep(type, o.type, true) && compareDeep(onAdmission, o.onAdmission, true)
2795          && compareDeep(packageCode, o.packageCode, true);
2796    }
2797
2798    @Override
2799    public boolean equalsShallow(Base other_) {
2800      if (!super.equalsShallow(other_))
2801        return false;
2802      if (!(other_ instanceof DiagnosisComponent))
2803        return false;
2804      DiagnosisComponent o = (DiagnosisComponent) other_;
2805      return compareValues(sequence, o.sequence, true);
2806    }
2807
2808    public boolean isEmpty() {
2809      return super.isEmpty()
2810          && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type, onAdmission, packageCode);
2811    }
2812
2813    public String fhirType() {
2814      return "ExplanationOfBenefit.diagnosis";
2815
2816    }
2817
2818  }
2819
2820  @Block()
2821  public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
2822    /**
2823     * A number to uniquely identify procedure entries.
2824     */
2825    @Child(name = "sequence", type = {
2826        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
2827    @Description(shortDefinition = "Procedure instance identifier", formalDefinition = "A number to uniquely identify procedure entries.")
2828    protected PositiveIntType sequence;
2829
2830    /**
2831     * When the condition was observed or the relative ranking.
2832     */
2833    @Child(name = "type", type = {
2834        CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2835    @Description(shortDefinition = "Category of Procedure", formalDefinition = "When the condition was observed or the relative ranking.")
2836    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-procedure-type")
2837    protected List<CodeableConcept> type;
2838
2839    /**
2840     * Date and optionally time the procedure was performed.
2841     */
2842    @Child(name = "date", type = { DateTimeType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
2843    @Description(shortDefinition = "When the procedure was performed", formalDefinition = "Date and optionally time the procedure was performed.")
2844    protected DateTimeType date;
2845
2846    /**
2847     * The code or reference to a Procedure resource which identifies the clinical
2848     * intervention performed.
2849     */
2850    @Child(name = "procedure", type = { CodeableConcept.class,
2851        Procedure.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
2852    @Description(shortDefinition = "Specific clinical procedure", formalDefinition = "The code or reference to a Procedure resource which identifies the clinical intervention performed.")
2853    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/icd-10-procedures")
2854    protected Type procedure;
2855
2856    /**
2857     * Unique Device Identifiers associated with this line item.
2858     */
2859    @Child(name = "udi", type = {
2860        Device.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2861    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
2862    protected List<Reference> udi;
2863    /**
2864     * The actual objects that are the target of the reference (Unique Device
2865     * Identifiers associated with this line item.)
2866     */
2867    protected List<Device> udiTarget;
2868
2869    private static final long serialVersionUID = 935341852L;
2870
2871    /**
2872     * Constructor
2873     */
2874    public ProcedureComponent() {
2875      super();
2876    }
2877
2878    /**
2879     * Constructor
2880     */
2881    public ProcedureComponent(PositiveIntType sequence, Type procedure) {
2882      super();
2883      this.sequence = sequence;
2884      this.procedure = procedure;
2885    }
2886
2887    /**
2888     * @return {@link #sequence} (A number to uniquely identify procedure entries.).
2889     *         This is the underlying object with id, value and extensions. The
2890     *         accessor "getSequence" gives direct access to the value
2891     */
2892    public PositiveIntType getSequenceElement() {
2893      if (this.sequence == null)
2894        if (Configuration.errorOnAutoCreate())
2895          throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2896        else if (Configuration.doAutoCreate())
2897          this.sequence = new PositiveIntType(); // bb
2898      return this.sequence;
2899    }
2900
2901    public boolean hasSequenceElement() {
2902      return this.sequence != null && !this.sequence.isEmpty();
2903    }
2904
2905    public boolean hasSequence() {
2906      return this.sequence != null && !this.sequence.isEmpty();
2907    }
2908
2909    /**
2910     * @param value {@link #sequence} (A number to uniquely identify procedure
2911     *              entries.). This is the underlying object with id, value and
2912     *              extensions. The accessor "getSequence" gives direct access to
2913     *              the value
2914     */
2915    public ProcedureComponent setSequenceElement(PositiveIntType value) {
2916      this.sequence = value;
2917      return this;
2918    }
2919
2920    /**
2921     * @return A number to uniquely identify procedure entries.
2922     */
2923    public int getSequence() {
2924      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2925    }
2926
2927    /**
2928     * @param value A number to uniquely identify procedure entries.
2929     */
2930    public ProcedureComponent setSequence(int value) {
2931      if (this.sequence == null)
2932        this.sequence = new PositiveIntType();
2933      this.sequence.setValue(value);
2934      return this;
2935    }
2936
2937    /**
2938     * @return {@link #type} (When the condition was observed or the relative
2939     *         ranking.)
2940     */
2941    public List<CodeableConcept> getType() {
2942      if (this.type == null)
2943        this.type = new ArrayList<CodeableConcept>();
2944      return this.type;
2945    }
2946
2947    /**
2948     * @return Returns a reference to <code>this</code> for easy method chaining
2949     */
2950    public ProcedureComponent setType(List<CodeableConcept> theType) {
2951      this.type = theType;
2952      return this;
2953    }
2954
2955    public boolean hasType() {
2956      if (this.type == null)
2957        return false;
2958      for (CodeableConcept item : this.type)
2959        if (!item.isEmpty())
2960          return true;
2961      return false;
2962    }
2963
2964    public CodeableConcept addType() { // 3
2965      CodeableConcept t = new CodeableConcept();
2966      if (this.type == null)
2967        this.type = new ArrayList<CodeableConcept>();
2968      this.type.add(t);
2969      return t;
2970    }
2971
2972    public ProcedureComponent addType(CodeableConcept t) { // 3
2973      if (t == null)
2974        return this;
2975      if (this.type == null)
2976        this.type = new ArrayList<CodeableConcept>();
2977      this.type.add(t);
2978      return this;
2979    }
2980
2981    /**
2982     * @return The first repetition of repeating field {@link #type}, creating it if
2983     *         it does not already exist
2984     */
2985    public CodeableConcept getTypeFirstRep() {
2986      if (getType().isEmpty()) {
2987        addType();
2988      }
2989      return getType().get(0);
2990    }
2991
2992    /**
2993     * @return {@link #date} (Date and optionally time the procedure was
2994     *         performed.). This is the underlying object with id, value and
2995     *         extensions. The accessor "getDate" gives direct access to the value
2996     */
2997    public DateTimeType getDateElement() {
2998      if (this.date == null)
2999        if (Configuration.errorOnAutoCreate())
3000          throw new Error("Attempt to auto-create ProcedureComponent.date");
3001        else if (Configuration.doAutoCreate())
3002          this.date = new DateTimeType(); // bb
3003      return this.date;
3004    }
3005
3006    public boolean hasDateElement() {
3007      return this.date != null && !this.date.isEmpty();
3008    }
3009
3010    public boolean hasDate() {
3011      return this.date != null && !this.date.isEmpty();
3012    }
3013
3014    /**
3015     * @param value {@link #date} (Date and optionally time the procedure was
3016     *              performed.). This is the underlying object with id, value and
3017     *              extensions. The accessor "getDate" gives direct access to the
3018     *              value
3019     */
3020    public ProcedureComponent setDateElement(DateTimeType value) {
3021      this.date = value;
3022      return this;
3023    }
3024
3025    /**
3026     * @return Date and optionally time the procedure was performed.
3027     */
3028    public Date getDate() {
3029      return this.date == null ? null : this.date.getValue();
3030    }
3031
3032    /**
3033     * @param value Date and optionally time the procedure was performed.
3034     */
3035    public ProcedureComponent setDate(Date value) {
3036      if (value == null)
3037        this.date = null;
3038      else {
3039        if (this.date == null)
3040          this.date = new DateTimeType();
3041        this.date.setValue(value);
3042      }
3043      return this;
3044    }
3045
3046    /**
3047     * @return {@link #procedure} (The code or reference to a Procedure resource
3048     *         which identifies the clinical intervention performed.)
3049     */
3050    public Type getProcedure() {
3051      return this.procedure;
3052    }
3053
3054    /**
3055     * @return {@link #procedure} (The code or reference to a Procedure resource
3056     *         which identifies the clinical intervention performed.)
3057     */
3058    public CodeableConcept getProcedureCodeableConcept() throws FHIRException {
3059      if (this.procedure == null)
3060        this.procedure = new CodeableConcept();
3061      if (!(this.procedure instanceof CodeableConcept))
3062        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
3063            + this.procedure.getClass().getName() + " was encountered");
3064      return (CodeableConcept) this.procedure;
3065    }
3066
3067    public boolean hasProcedureCodeableConcept() {
3068        return this.procedure instanceof CodeableConcept;
3069    }
3070
3071    /**
3072     * @return {@link #procedure} (The code or reference to a Procedure resource
3073     *         which identifies the clinical intervention performed.)
3074     */
3075    public Reference getProcedureReference() throws FHIRException {
3076      if (this.procedure == null)
3077        this.procedure = new Reference();
3078      if (!(this.procedure instanceof Reference))
3079        throw new FHIRException("Type mismatch: the type Reference was expected, but "
3080            + this.procedure.getClass().getName() + " was encountered");
3081      return (Reference) this.procedure;
3082    }
3083
3084    public boolean hasProcedureReference() {
3085        return this.procedure instanceof Reference;
3086    }
3087
3088    public boolean hasProcedure() {
3089      return this.procedure != null && !this.procedure.isEmpty();
3090    }
3091
3092    /**
3093     * @param value {@link #procedure} (The code or reference to a Procedure
3094     *              resource which identifies the clinical intervention performed.)
3095     */
3096    public ProcedureComponent setProcedure(Type value) {
3097      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
3098        throw new Error("Not the right type for ExplanationOfBenefit.procedure.procedure[x]: " + value.fhirType());
3099      this.procedure = value;
3100      return this;
3101    }
3102
3103    /**
3104     * @return {@link #udi} (Unique Device Identifiers associated with this line
3105     *         item.)
3106     */
3107    public List<Reference> getUdi() {
3108      if (this.udi == null)
3109        this.udi = new ArrayList<Reference>();
3110      return this.udi;
3111    }
3112
3113    /**
3114     * @return Returns a reference to <code>this</code> for easy method chaining
3115     */
3116    public ProcedureComponent setUdi(List<Reference> theUdi) {
3117      this.udi = theUdi;
3118      return this;
3119    }
3120
3121    public boolean hasUdi() {
3122      if (this.udi == null)
3123        return false;
3124      for (Reference item : this.udi)
3125        if (!item.isEmpty())
3126          return true;
3127      return false;
3128    }
3129
3130    public Reference addUdi() { // 3
3131      Reference t = new Reference();
3132      if (this.udi == null)
3133        this.udi = new ArrayList<Reference>();
3134      this.udi.add(t);
3135      return t;
3136    }
3137
3138    public ProcedureComponent addUdi(Reference t) { // 3
3139      if (t == null)
3140        return this;
3141      if (this.udi == null)
3142        this.udi = new ArrayList<Reference>();
3143      this.udi.add(t);
3144      return this;
3145    }
3146
3147    /**
3148     * @return The first repetition of repeating field {@link #udi}, creating it if
3149     *         it does not already exist
3150     */
3151    public Reference getUdiFirstRep() {
3152      if (getUdi().isEmpty()) {
3153        addUdi();
3154      }
3155      return getUdi().get(0);
3156    }
3157
3158    protected void listChildren(List<Property> children) {
3159      super.listChildren(children);
3160      children.add(
3161          new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence));
3162      children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.",
3163          0, java.lang.Integer.MAX_VALUE, type));
3164      children
3165          .add(new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date));
3166      children.add(new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3167          "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3168          procedure));
3169      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
3170          0, java.lang.Integer.MAX_VALUE, udi));
3171    }
3172
3173    @Override
3174    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3175      switch (_hash) {
3176      case 1349547969:
3177        /* sequence */ return new Property("sequence", "positiveInt",
3178            "A number to uniquely identify procedure entries.", 0, 1, sequence);
3179      case 3575610:
3180        /* type */ return new Property("type", "CodeableConcept",
3181            "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
3182      case 3076014:
3183        /* date */ return new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0,
3184            1, date);
3185      case 1640074445:
3186        /* procedure[x] */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3187            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3188            procedure);
3189      case -1095204141:
3190        /* procedure */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3191            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3192            procedure);
3193      case -1284783026:
3194        /* procedureCodeableConcept */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3195            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3196            procedure);
3197      case 881809848:
3198        /* procedureReference */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3199            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3200            procedure);
3201      case 115642:
3202        /* udi */ return new Property("udi", "Reference(Device)",
3203            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
3204      default:
3205        return super.getNamedProperty(_hash, _name, _checkValid);
3206      }
3207
3208    }
3209
3210    @Override
3211    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3212      switch (hash) {
3213      case 1349547969:
3214        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
3215      case 3575610:
3216        /* type */ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
3217      case 3076014:
3218        /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateTimeType
3219      case -1095204141:
3220        /* procedure */ return this.procedure == null ? new Base[0] : new Base[] { this.procedure }; // Type
3221      case 115642:
3222        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
3223      default:
3224        return super.getProperty(hash, name, checkValid);
3225      }
3226
3227    }
3228
3229    @Override
3230    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3231      switch (hash) {
3232      case 1349547969: // sequence
3233        this.sequence = castToPositiveInt(value); // PositiveIntType
3234        return value;
3235      case 3575610: // type
3236        this.getType().add(castToCodeableConcept(value)); // CodeableConcept
3237        return value;
3238      case 3076014: // date
3239        this.date = castToDateTime(value); // DateTimeType
3240        return value;
3241      case -1095204141: // procedure
3242        this.procedure = castToType(value); // Type
3243        return value;
3244      case 115642: // udi
3245        this.getUdi().add(castToReference(value)); // Reference
3246        return value;
3247      default:
3248        return super.setProperty(hash, name, value);
3249      }
3250
3251    }
3252
3253    @Override
3254    public Base setProperty(String name, Base value) throws FHIRException {
3255      if (name.equals("sequence")) {
3256        this.sequence = castToPositiveInt(value); // PositiveIntType
3257      } else if (name.equals("type")) {
3258        this.getType().add(castToCodeableConcept(value));
3259      } else if (name.equals("date")) {
3260        this.date = castToDateTime(value); // DateTimeType
3261      } else if (name.equals("procedure[x]")) {
3262        this.procedure = castToType(value); // Type
3263      } else if (name.equals("udi")) {
3264        this.getUdi().add(castToReference(value));
3265      } else
3266        return super.setProperty(name, value);
3267      return value;
3268    }
3269
3270  @Override
3271  public void removeChild(String name, Base value) throws FHIRException {
3272      if (name.equals("sequence")) {
3273        this.sequence = null;
3274      } else if (name.equals("type")) {
3275        this.getType().remove(castToCodeableConcept(value));
3276      } else if (name.equals("date")) {
3277        this.date = null;
3278      } else if (name.equals("procedure[x]")) {
3279        this.procedure = null;
3280      } else if (name.equals("udi")) {
3281        this.getUdi().remove(castToReference(value));
3282      } else
3283        super.removeChild(name, value);
3284      
3285    }
3286
3287    @Override
3288    public Base makeProperty(int hash, String name) throws FHIRException {
3289      switch (hash) {
3290      case 1349547969:
3291        return getSequenceElement();
3292      case 3575610:
3293        return addType();
3294      case 3076014:
3295        return getDateElement();
3296      case 1640074445:
3297        return getProcedure();
3298      case -1095204141:
3299        return getProcedure();
3300      case 115642:
3301        return addUdi();
3302      default:
3303        return super.makeProperty(hash, name);
3304      }
3305
3306    }
3307
3308    @Override
3309    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3310      switch (hash) {
3311      case 1349547969:
3312        /* sequence */ return new String[] { "positiveInt" };
3313      case 3575610:
3314        /* type */ return new String[] { "CodeableConcept" };
3315      case 3076014:
3316        /* date */ return new String[] { "dateTime" };
3317      case -1095204141:
3318        /* procedure */ return new String[] { "CodeableConcept", "Reference" };
3319      case 115642:
3320        /* udi */ return new String[] { "Reference" };
3321      default:
3322        return super.getTypesForProperty(hash, name);
3323      }
3324
3325    }
3326
3327    @Override
3328    public Base addChild(String name) throws FHIRException {
3329      if (name.equals("sequence")) {
3330        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
3331      } else if (name.equals("type")) {
3332        return addType();
3333      } else if (name.equals("date")) {
3334        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.date");
3335      } else if (name.equals("procedureCodeableConcept")) {
3336        this.procedure = new CodeableConcept();
3337        return this.procedure;
3338      } else if (name.equals("procedureReference")) {
3339        this.procedure = new Reference();
3340        return this.procedure;
3341      } else if (name.equals("udi")) {
3342        return addUdi();
3343      } else
3344        return super.addChild(name);
3345    }
3346
3347    public ProcedureComponent copy() {
3348      ProcedureComponent dst = new ProcedureComponent();
3349      copyValues(dst);
3350      return dst;
3351    }
3352
3353    public void copyValues(ProcedureComponent dst) {
3354      super.copyValues(dst);
3355      dst.sequence = sequence == null ? null : sequence.copy();
3356      if (type != null) {
3357        dst.type = new ArrayList<CodeableConcept>();
3358        for (CodeableConcept i : type)
3359          dst.type.add(i.copy());
3360      }
3361      ;
3362      dst.date = date == null ? null : date.copy();
3363      dst.procedure = procedure == null ? null : procedure.copy();
3364      if (udi != null) {
3365        dst.udi = new ArrayList<Reference>();
3366        for (Reference i : udi)
3367          dst.udi.add(i.copy());
3368      }
3369      ;
3370    }
3371
3372    @Override
3373    public boolean equalsDeep(Base other_) {
3374      if (!super.equalsDeep(other_))
3375        return false;
3376      if (!(other_ instanceof ProcedureComponent))
3377        return false;
3378      ProcedureComponent o = (ProcedureComponent) other_;
3379      return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true)
3380          && compareDeep(date, o.date, true) && compareDeep(procedure, o.procedure, true)
3381          && compareDeep(udi, o.udi, true);
3382    }
3383
3384    @Override
3385    public boolean equalsShallow(Base other_) {
3386      if (!super.equalsShallow(other_))
3387        return false;
3388      if (!(other_ instanceof ProcedureComponent))
3389        return false;
3390      ProcedureComponent o = (ProcedureComponent) other_;
3391      return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
3392    }
3393
3394    public boolean isEmpty() {
3395      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, date, procedure, udi);
3396    }
3397
3398    public String fhirType() {
3399      return "ExplanationOfBenefit.procedure";
3400
3401    }
3402
3403  }
3404
3405  @Block()
3406  public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
3407    /**
3408     * A flag to indicate that this Coverage is to be used for adjudication of this
3409     * claim when set to true.
3410     */
3411    @Child(name = "focal", type = { BooleanType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
3412    @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.")
3413    protected BooleanType focal;
3414
3415    /**
3416     * Reference to the insurance card level information contained in the Coverage
3417     * resource. The coverage issuing insurer will use these details to locate the
3418     * patient's actual coverage within the insurer's information system.
3419     */
3420    @Child(name = "coverage", type = { Coverage.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
3421    @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.")
3422    protected Reference coverage;
3423
3424    /**
3425     * The actual object that is the target of the reference (Reference to the
3426     * insurance card level information contained in the Coverage resource. The
3427     * coverage issuing insurer will use these details to locate the patient's
3428     * actual coverage within the insurer's information system.)
3429     */
3430    protected Coverage coverageTarget;
3431
3432    /**
3433     * Reference numbers previously provided by the insurer to the provider to be
3434     * quoted on subsequent claims containing services or products related to the
3435     * prior authorization.
3436     */
3437    @Child(name = "preAuthRef", type = {
3438        StringType.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3439    @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.")
3440    protected List<StringType> preAuthRef;
3441
3442    private static final long serialVersionUID = -606383626L;
3443
3444    /**
3445     * Constructor
3446     */
3447    public InsuranceComponent() {
3448      super();
3449    }
3450
3451    /**
3452     * Constructor
3453     */
3454    public InsuranceComponent(BooleanType focal, Reference coverage) {
3455      super();
3456      this.focal = focal;
3457      this.coverage = coverage;
3458    }
3459
3460    /**
3461     * @return {@link #focal} (A flag to indicate that this Coverage is to be used
3462     *         for adjudication of this claim when set to true.). This is the
3463     *         underlying object with id, value and extensions. The accessor
3464     *         "getFocal" gives direct access to the value
3465     */
3466    public BooleanType getFocalElement() {
3467      if (this.focal == null)
3468        if (Configuration.errorOnAutoCreate())
3469          throw new Error("Attempt to auto-create InsuranceComponent.focal");
3470        else if (Configuration.doAutoCreate())
3471          this.focal = new BooleanType(); // bb
3472      return this.focal;
3473    }
3474
3475    public boolean hasFocalElement() {
3476      return this.focal != null && !this.focal.isEmpty();
3477    }
3478
3479    public boolean hasFocal() {
3480      return this.focal != null && !this.focal.isEmpty();
3481    }
3482
3483    /**
3484     * @param value {@link #focal} (A flag to indicate that this Coverage is to be
3485     *              used for adjudication of this claim when set to true.). This is
3486     *              the underlying object with id, value and extensions. The
3487     *              accessor "getFocal" gives direct access to the value
3488     */
3489    public InsuranceComponent setFocalElement(BooleanType value) {
3490      this.focal = value;
3491      return this;
3492    }
3493
3494    /**
3495     * @return A flag to indicate that this Coverage is to be used for adjudication
3496     *         of this claim when set to true.
3497     */
3498    public boolean getFocal() {
3499      return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
3500    }
3501
3502    /**
3503     * @param value A flag to indicate that this Coverage is to be used for
3504     *              adjudication of this claim when set to true.
3505     */
3506    public InsuranceComponent setFocal(boolean value) {
3507      if (this.focal == null)
3508        this.focal = new BooleanType();
3509      this.focal.setValue(value);
3510      return this;
3511    }
3512
3513    /**
3514     * @return {@link #coverage} (Reference to the insurance card level information
3515     *         contained in the Coverage resource. The coverage issuing insurer will
3516     *         use these details to locate the patient's actual coverage within the
3517     *         insurer's information system.)
3518     */
3519    public Reference getCoverage() {
3520      if (this.coverage == null)
3521        if (Configuration.errorOnAutoCreate())
3522          throw new Error("Attempt to auto-create InsuranceComponent.coverage");
3523        else if (Configuration.doAutoCreate())
3524          this.coverage = new Reference(); // cc
3525      return this.coverage;
3526    }
3527
3528    public boolean hasCoverage() {
3529      return this.coverage != null && !this.coverage.isEmpty();
3530    }
3531
3532    /**
3533     * @param value {@link #coverage} (Reference to the insurance card level
3534     *              information contained in the Coverage resource. The coverage
3535     *              issuing insurer will use these details to locate the patient's
3536     *              actual coverage within the insurer's information system.)
3537     */
3538    public InsuranceComponent setCoverage(Reference value) {
3539      this.coverage = value;
3540      return this;
3541    }
3542
3543    /**
3544     * @return {@link #coverage} The actual object that is the target of the
3545     *         reference. The reference library doesn't populate this, but you can
3546     *         use it to hold the resource if you resolve it. (Reference to the
3547     *         insurance card level information contained in the Coverage resource.
3548     *         The coverage issuing insurer will use these details to locate the
3549     *         patient's actual coverage within the insurer's information system.)
3550     */
3551    public Coverage getCoverageTarget() {
3552      if (this.coverageTarget == null)
3553        if (Configuration.errorOnAutoCreate())
3554          throw new Error("Attempt to auto-create InsuranceComponent.coverage");
3555        else if (Configuration.doAutoCreate())
3556          this.coverageTarget = new Coverage(); // aa
3557      return this.coverageTarget;
3558    }
3559
3560    /**
3561     * @param value {@link #coverage} The actual object that is the target of the
3562     *              reference. The reference library doesn't use these, but you can
3563     *              use it to hold the resource if you resolve it. (Reference to the
3564     *              insurance card level information contained in the Coverage
3565     *              resource. The coverage issuing insurer will use these details to
3566     *              locate the patient's actual coverage within the insurer's
3567     *              information system.)
3568     */
3569    public InsuranceComponent setCoverageTarget(Coverage value) {
3570      this.coverageTarget = value;
3571      return this;
3572    }
3573
3574    /**
3575     * @return {@link #preAuthRef} (Reference numbers previously provided by the
3576     *         insurer to the provider to be quoted on subsequent claims containing
3577     *         services or products related to the prior authorization.)
3578     */
3579    public List<StringType> getPreAuthRef() {
3580      if (this.preAuthRef == null)
3581        this.preAuthRef = new ArrayList<StringType>();
3582      return this.preAuthRef;
3583    }
3584
3585    /**
3586     * @return Returns a reference to <code>this</code> for easy method chaining
3587     */
3588    public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) {
3589      this.preAuthRef = thePreAuthRef;
3590      return this;
3591    }
3592
3593    public boolean hasPreAuthRef() {
3594      if (this.preAuthRef == null)
3595        return false;
3596      for (StringType item : this.preAuthRef)
3597        if (!item.isEmpty())
3598          return true;
3599      return false;
3600    }
3601
3602    /**
3603     * @return {@link #preAuthRef} (Reference numbers previously provided by the
3604     *         insurer to the provider to be quoted on subsequent claims containing
3605     *         services or products related to the prior authorization.)
3606     */
3607    public StringType addPreAuthRefElement() {// 2
3608      StringType t = new StringType();
3609      if (this.preAuthRef == null)
3610        this.preAuthRef = new ArrayList<StringType>();
3611      this.preAuthRef.add(t);
3612      return t;
3613    }
3614
3615    /**
3616     * @param value {@link #preAuthRef} (Reference numbers previously provided by
3617     *              the insurer to the provider to be quoted on subsequent claims
3618     *              containing services or products related to the prior
3619     *              authorization.)
3620     */
3621    public InsuranceComponent addPreAuthRef(String value) { // 1
3622      StringType t = new StringType();
3623      t.setValue(value);
3624      if (this.preAuthRef == null)
3625        this.preAuthRef = new ArrayList<StringType>();
3626      this.preAuthRef.add(t);
3627      return this;
3628    }
3629
3630    /**
3631     * @param value {@link #preAuthRef} (Reference numbers previously provided by
3632     *              the insurer to the provider to be quoted on subsequent claims
3633     *              containing services or products related to the prior
3634     *              authorization.)
3635     */
3636    public boolean hasPreAuthRef(String value) {
3637      if (this.preAuthRef == null)
3638        return false;
3639      for (StringType v : this.preAuthRef)
3640        if (v.getValue().equals(value)) // string
3641          return true;
3642      return false;
3643    }
3644
3645    protected void listChildren(List<Property> children) {
3646      super.listChildren(children);
3647      children.add(new Property("focal", "boolean",
3648          "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.", 0, 1,
3649          focal));
3650      children.add(new Property("coverage", "Reference(Coverage)",
3651          "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.",
3652          0, 1, coverage));
3653      children.add(new Property("preAuthRef", "string",
3654          "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.",
3655          0, java.lang.Integer.MAX_VALUE, preAuthRef));
3656    }
3657
3658    @Override
3659    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3660      switch (_hash) {
3661      case 97604197:
3662        /* focal */ return new Property("focal", "boolean",
3663            "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.", 0,
3664            1, focal);
3665      case -351767064:
3666        /* coverage */ return new Property("coverage", "Reference(Coverage)",
3667            "Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.",
3668            0, 1, coverage);
3669      case 522246568:
3670        /* preAuthRef */ return new Property("preAuthRef", "string",
3671            "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.",
3672            0, java.lang.Integer.MAX_VALUE, preAuthRef);
3673      default:
3674        return super.getNamedProperty(_hash, _name, _checkValid);
3675      }
3676
3677    }
3678
3679    @Override
3680    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3681      switch (hash) {
3682      case 97604197:
3683        /* focal */ return this.focal == null ? new Base[0] : new Base[] { this.focal }; // BooleanType
3684      case -351767064:
3685        /* coverage */ return this.coverage == null ? new Base[0] : new Base[] { this.coverage }; // Reference
3686      case 522246568:
3687        /* preAuthRef */ return this.preAuthRef == null ? new Base[0]
3688            : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
3689      default:
3690        return super.getProperty(hash, name, checkValid);
3691      }
3692
3693    }
3694
3695    @Override
3696    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3697      switch (hash) {
3698      case 97604197: // focal
3699        this.focal = castToBoolean(value); // BooleanType
3700        return value;
3701      case -351767064: // coverage
3702        this.coverage = castToReference(value); // Reference
3703        return value;
3704      case 522246568: // preAuthRef
3705        this.getPreAuthRef().add(castToString(value)); // StringType
3706        return value;
3707      default:
3708        return super.setProperty(hash, name, value);
3709      }
3710
3711    }
3712
3713    @Override
3714    public Base setProperty(String name, Base value) throws FHIRException {
3715      if (name.equals("focal")) {
3716        this.focal = castToBoolean(value); // BooleanType
3717      } else if (name.equals("coverage")) {
3718        this.coverage = castToReference(value); // Reference
3719      } else if (name.equals("preAuthRef")) {
3720        this.getPreAuthRef().add(castToString(value));
3721      } else
3722        return super.setProperty(name, value);
3723      return value;
3724    }
3725
3726  @Override
3727  public void removeChild(String name, Base value) throws FHIRException {
3728      if (name.equals("focal")) {
3729        this.focal = null;
3730      } else if (name.equals("coverage")) {
3731        this.coverage = null;
3732      } else if (name.equals("preAuthRef")) {
3733        this.getPreAuthRef().remove(castToString(value));
3734      } else
3735        super.removeChild(name, value);
3736      
3737    }
3738
3739    @Override
3740    public Base makeProperty(int hash, String name) throws FHIRException {
3741      switch (hash) {
3742      case 97604197:
3743        return getFocalElement();
3744      case -351767064:
3745        return getCoverage();
3746      case 522246568:
3747        return addPreAuthRefElement();
3748      default:
3749        return super.makeProperty(hash, name);
3750      }
3751
3752    }
3753
3754    @Override
3755    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3756      switch (hash) {
3757      case 97604197:
3758        /* focal */ return new String[] { "boolean" };
3759      case -351767064:
3760        /* coverage */ return new String[] { "Reference" };
3761      case 522246568:
3762        /* preAuthRef */ return new String[] { "string" };
3763      default:
3764        return super.getTypesForProperty(hash, name);
3765      }
3766
3767    }
3768
3769    @Override
3770    public Base addChild(String name) throws FHIRException {
3771      if (name.equals("focal")) {
3772        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.focal");
3773      } else if (name.equals("coverage")) {
3774        this.coverage = new Reference();
3775        return this.coverage;
3776      } else if (name.equals("preAuthRef")) {
3777        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.preAuthRef");
3778      } else
3779        return super.addChild(name);
3780    }
3781
3782    public InsuranceComponent copy() {
3783      InsuranceComponent dst = new InsuranceComponent();
3784      copyValues(dst);
3785      return dst;
3786    }
3787
3788    public void copyValues(InsuranceComponent dst) {
3789      super.copyValues(dst);
3790      dst.focal = focal == null ? null : focal.copy();
3791      dst.coverage = coverage == null ? null : coverage.copy();
3792      if (preAuthRef != null) {
3793        dst.preAuthRef = new ArrayList<StringType>();
3794        for (StringType i : preAuthRef)
3795          dst.preAuthRef.add(i.copy());
3796      }
3797      ;
3798    }
3799
3800    @Override
3801    public boolean equalsDeep(Base other_) {
3802      if (!super.equalsDeep(other_))
3803        return false;
3804      if (!(other_ instanceof InsuranceComponent))
3805        return false;
3806      InsuranceComponent o = (InsuranceComponent) other_;
3807      return compareDeep(focal, o.focal, true) && compareDeep(coverage, o.coverage, true)
3808          && compareDeep(preAuthRef, o.preAuthRef, true);
3809    }
3810
3811    @Override
3812    public boolean equalsShallow(Base other_) {
3813      if (!super.equalsShallow(other_))
3814        return false;
3815      if (!(other_ instanceof InsuranceComponent))
3816        return false;
3817      InsuranceComponent o = (InsuranceComponent) other_;
3818      return compareValues(focal, o.focal, true) && compareValues(preAuthRef, o.preAuthRef, true);
3819    }
3820
3821    public boolean isEmpty() {
3822      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(focal, coverage, preAuthRef);
3823    }
3824
3825    public String fhirType() {
3826      return "ExplanationOfBenefit.insurance";
3827
3828    }
3829
3830  }
3831
3832  @Block()
3833  public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
3834    /**
3835     * Date of an accident event related to the products and services contained in
3836     * the claim.
3837     */
3838    @Child(name = "date", type = { DateType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
3839    @Description(shortDefinition = "When the incident occurred", formalDefinition = "Date of an accident event  related to the products and services contained in the claim.")
3840    protected DateType date;
3841
3842    /**
3843     * The type or context of the accident event for the purposes of selection of
3844     * potential insurance coverages and determination of coordination between
3845     * insurers.
3846     */
3847    @Child(name = "type", type = {
3848        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
3849    @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.")
3850    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://terminology.hl7.org/ValueSet/v3-ActIncidentCode")
3851    protected CodeableConcept type;
3852
3853    /**
3854     * The physical location of the accident event.
3855     */
3856    @Child(name = "location", type = { Address.class,
3857        Location.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
3858    @Description(shortDefinition = "Where the event occurred", formalDefinition = "The physical location of the accident event.")
3859    protected Type location;
3860
3861    private static final long serialVersionUID = 622904984L;
3862
3863    /**
3864     * Constructor
3865     */
3866    public AccidentComponent() {
3867      super();
3868    }
3869
3870    /**
3871     * @return {@link #date} (Date of an accident event related to the products and
3872     *         services contained in the claim.). This is the underlying object with
3873     *         id, value and extensions. The accessor "getDate" gives direct access
3874     *         to the value
3875     */
3876    public DateType getDateElement() {
3877      if (this.date == null)
3878        if (Configuration.errorOnAutoCreate())
3879          throw new Error("Attempt to auto-create AccidentComponent.date");
3880        else if (Configuration.doAutoCreate())
3881          this.date = new DateType(); // bb
3882      return this.date;
3883    }
3884
3885    public boolean hasDateElement() {
3886      return this.date != null && !this.date.isEmpty();
3887    }
3888
3889    public boolean hasDate() {
3890      return this.date != null && !this.date.isEmpty();
3891    }
3892
3893    /**
3894     * @param value {@link #date} (Date of an accident event related to the products
3895     *              and services contained in the claim.). This is the underlying
3896     *              object with id, value and extensions. The accessor "getDate"
3897     *              gives direct access to the value
3898     */
3899    public AccidentComponent setDateElement(DateType value) {
3900      this.date = value;
3901      return this;
3902    }
3903
3904    /**
3905     * @return Date of an accident event related to the products and services
3906     *         contained in the claim.
3907     */
3908    public Date getDate() {
3909      return this.date == null ? null : this.date.getValue();
3910    }
3911
3912    /**
3913     * @param value Date of an accident event related to the products and services
3914     *              contained in the claim.
3915     */
3916    public AccidentComponent setDate(Date value) {
3917      if (value == null)
3918        this.date = null;
3919      else {
3920        if (this.date == null)
3921          this.date = new DateType();
3922        this.date.setValue(value);
3923      }
3924      return this;
3925    }
3926
3927    /**
3928     * @return {@link #type} (The type or context of the accident event for the
3929     *         purposes of selection of potential insurance coverages and
3930     *         determination of coordination between insurers.)
3931     */
3932    public CodeableConcept getType() {
3933      if (this.type == null)
3934        if (Configuration.errorOnAutoCreate())
3935          throw new Error("Attempt to auto-create AccidentComponent.type");
3936        else if (Configuration.doAutoCreate())
3937          this.type = new CodeableConcept(); // cc
3938      return this.type;
3939    }
3940
3941    public boolean hasType() {
3942      return this.type != null && !this.type.isEmpty();
3943    }
3944
3945    /**
3946     * @param value {@link #type} (The type or context of the accident event for the
3947     *              purposes of selection of potential insurance coverages and
3948     *              determination of coordination between insurers.)
3949     */
3950    public AccidentComponent setType(CodeableConcept value) {
3951      this.type = value;
3952      return this;
3953    }
3954
3955    /**
3956     * @return {@link #location} (The physical location of the accident event.)
3957     */
3958    public Type getLocation() {
3959      return this.location;
3960    }
3961
3962    /**
3963     * @return {@link #location} (The physical location of the accident event.)
3964     */
3965    public Address getLocationAddress() throws FHIRException {
3966      if (this.location == null)
3967        this.location = new Address();
3968      if (!(this.location instanceof Address))
3969        throw new FHIRException("Type mismatch: the type Address was expected, but "
3970            + this.location.getClass().getName() + " was encountered");
3971      return (Address) this.location;
3972    }
3973
3974    public boolean hasLocationAddress() {
3975        return this.location instanceof Address;
3976    }
3977
3978    /**
3979     * @return {@link #location} (The physical location of the accident event.)
3980     */
3981    public Reference getLocationReference() throws FHIRException {
3982      if (this.location == null)
3983        this.location = new Reference();
3984      if (!(this.location instanceof Reference))
3985        throw new FHIRException("Type mismatch: the type Reference was expected, but "
3986            + this.location.getClass().getName() + " was encountered");
3987      return (Reference) this.location;
3988    }
3989
3990    public boolean hasLocationReference() {
3991        return this.location instanceof Reference;
3992    }
3993
3994    public boolean hasLocation() {
3995      return this.location != null && !this.location.isEmpty();
3996    }
3997
3998    /**
3999     * @param value {@link #location} (The physical location of the accident event.)
4000     */
4001    public AccidentComponent setLocation(Type value) {
4002      if (value != null && !(value instanceof Address || value instanceof Reference))
4003        throw new Error("Not the right type for ExplanationOfBenefit.accident.location[x]: " + value.fhirType());
4004      this.location = value;
4005      return this;
4006    }
4007
4008    protected void listChildren(List<Property> children) {
4009      super.listChildren(children);
4010      children.add(new Property("date", "date",
4011          "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date));
4012      children.add(new Property("type", "CodeableConcept",
4013          "The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.",
4014          0, 1, type));
4015      children.add(new Property("location[x]", "Address|Reference(Location)",
4016          "The physical location of the accident event.", 0, 1, location));
4017    }
4018
4019    @Override
4020    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4021      switch (_hash) {
4022      case 3076014:
4023        /* date */ return new Property("date", "date",
4024            "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date);
4025      case 3575610:
4026        /* type */ return new Property("type", "CodeableConcept",
4027            "The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.",
4028            0, 1, type);
4029      case 552316075:
4030        /* location[x] */ return new Property("location[x]", "Address|Reference(Location)",
4031            "The physical location of the accident event.", 0, 1, location);
4032      case 1901043637:
4033        /* location */ return new Property("location[x]", "Address|Reference(Location)",
4034            "The physical location of the accident event.", 0, 1, location);
4035      case -1280020865:
4036        /* locationAddress */ return new Property("location[x]", "Address|Reference(Location)",
4037            "The physical location of the accident event.", 0, 1, location);
4038      case 755866390:
4039        /* locationReference */ return new Property("location[x]", "Address|Reference(Location)",
4040            "The physical location of the accident event.", 0, 1, location);
4041      default:
4042        return super.getNamedProperty(_hash, _name, _checkValid);
4043      }
4044
4045    }
4046
4047    @Override
4048    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4049      switch (hash) {
4050      case 3076014:
4051        /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateType
4052      case 3575610:
4053        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
4054      case 1901043637:
4055        /* location */ return this.location == null ? new Base[0] : new Base[] { this.location }; // Type
4056      default:
4057        return super.getProperty(hash, name, checkValid);
4058      }
4059
4060    }
4061
4062    @Override
4063    public Base setProperty(int hash, String name, Base value) throws FHIRException {
4064      switch (hash) {
4065      case 3076014: // date
4066        this.date = castToDate(value); // DateType
4067        return value;
4068      case 3575610: // type
4069        this.type = castToCodeableConcept(value); // CodeableConcept
4070        return value;
4071      case 1901043637: // location
4072        this.location = castToType(value); // Type
4073        return value;
4074      default:
4075        return super.setProperty(hash, name, value);
4076      }
4077
4078    }
4079
4080    @Override
4081    public Base setProperty(String name, Base value) throws FHIRException {
4082      if (name.equals("date")) {
4083        this.date = castToDate(value); // DateType
4084      } else if (name.equals("type")) {
4085        this.type = castToCodeableConcept(value); // CodeableConcept
4086      } else if (name.equals("location[x]")) {
4087        this.location = castToType(value); // Type
4088      } else
4089        return super.setProperty(name, value);
4090      return value;
4091    }
4092
4093  @Override
4094  public void removeChild(String name, Base value) throws FHIRException {
4095      if (name.equals("date")) {
4096        this.date = null;
4097      } else if (name.equals("type")) {
4098        this.type = null;
4099      } else if (name.equals("location[x]")) {
4100        this.location = null;
4101      } else
4102        super.removeChild(name, value);
4103      
4104    }
4105
4106    @Override
4107    public Base makeProperty(int hash, String name) throws FHIRException {
4108      switch (hash) {
4109      case 3076014:
4110        return getDateElement();
4111      case 3575610:
4112        return getType();
4113      case 552316075:
4114        return getLocation();
4115      case 1901043637:
4116        return getLocation();
4117      default:
4118        return super.makeProperty(hash, name);
4119      }
4120
4121    }
4122
4123    @Override
4124    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4125      switch (hash) {
4126      case 3076014:
4127        /* date */ return new String[] { "date" };
4128      case 3575610:
4129        /* type */ return new String[] { "CodeableConcept" };
4130      case 1901043637:
4131        /* location */ return new String[] { "Address", "Reference" };
4132      default:
4133        return super.getTypesForProperty(hash, name);
4134      }
4135
4136    }
4137
4138    @Override
4139    public Base addChild(String name) throws FHIRException {
4140      if (name.equals("date")) {
4141        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.date");
4142      } else if (name.equals("type")) {
4143        this.type = new CodeableConcept();
4144        return this.type;
4145      } else if (name.equals("locationAddress")) {
4146        this.location = new Address();
4147        return this.location;
4148      } else if (name.equals("locationReference")) {
4149        this.location = new Reference();
4150        return this.location;
4151      } else
4152        return super.addChild(name);
4153    }
4154
4155    public AccidentComponent copy() {
4156      AccidentComponent dst = new AccidentComponent();
4157      copyValues(dst);
4158      return dst;
4159    }
4160
4161    public void copyValues(AccidentComponent dst) {
4162      super.copyValues(dst);
4163      dst.date = date == null ? null : date.copy();
4164      dst.type = type == null ? null : type.copy();
4165      dst.location = location == null ? null : location.copy();
4166    }
4167
4168    @Override
4169    public boolean equalsDeep(Base other_) {
4170      if (!super.equalsDeep(other_))
4171        return false;
4172      if (!(other_ instanceof AccidentComponent))
4173        return false;
4174      AccidentComponent o = (AccidentComponent) other_;
4175      return compareDeep(date, o.date, true) && compareDeep(type, o.type, true)
4176          && compareDeep(location, o.location, true);
4177    }
4178
4179    @Override
4180    public boolean equalsShallow(Base other_) {
4181      if (!super.equalsShallow(other_))
4182        return false;
4183      if (!(other_ instanceof AccidentComponent))
4184        return false;
4185      AccidentComponent o = (AccidentComponent) other_;
4186      return compareValues(date, o.date, true);
4187    }
4188
4189    public boolean isEmpty() {
4190      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
4191    }
4192
4193    public String fhirType() {
4194      return "ExplanationOfBenefit.accident";
4195
4196    }
4197
4198  }
4199
4200  @Block()
4201  public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
4202    /**
4203     * A number to uniquely identify item entries.
4204     */
4205    @Child(name = "sequence", type = {
4206        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
4207    @Description(shortDefinition = "Item instance identifier", formalDefinition = "A number to uniquely identify item entries.")
4208    protected PositiveIntType sequence;
4209
4210    /**
4211     * Care team members related to this service or product.
4212     */
4213    @Child(name = "careTeamSequence", type = {
4214        PositiveIntType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4215    @Description(shortDefinition = "Applicable care team members", formalDefinition = "Care team members related to this service or product.")
4216    protected List<PositiveIntType> careTeamSequence;
4217
4218    /**
4219     * Diagnoses applicable for this service or product.
4220     */
4221    @Child(name = "diagnosisSequence", type = {
4222        PositiveIntType.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4223    @Description(shortDefinition = "Applicable diagnoses", formalDefinition = "Diagnoses applicable for this service or product.")
4224    protected List<PositiveIntType> diagnosisSequence;
4225
4226    /**
4227     * Procedures applicable for this service or product.
4228     */
4229    @Child(name = "procedureSequence", type = {
4230        PositiveIntType.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4231    @Description(shortDefinition = "Applicable procedures", formalDefinition = "Procedures applicable for this service or product.")
4232    protected List<PositiveIntType> procedureSequence;
4233
4234    /**
4235     * Exceptions, special conditions and supporting information applicable for this
4236     * service or product.
4237     */
4238    @Child(name = "informationSequence", type = {
4239        PositiveIntType.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4240    @Description(shortDefinition = "Applicable exception and supporting information", formalDefinition = "Exceptions, special conditions and supporting information applicable for this service or product.")
4241    protected List<PositiveIntType> informationSequence;
4242
4243    /**
4244     * The type of revenue or cost center providing the product and/or service.
4245     */
4246    @Child(name = "revenue", type = {
4247        CodeableConcept.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
4248    @Description(shortDefinition = "Revenue or cost center code", formalDefinition = "The type of revenue or cost center providing the product and/or service.")
4249    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-revenue-center")
4250    protected CodeableConcept revenue;
4251
4252    /**
4253     * Code to identify the general type of benefits under which products and
4254     * services are provided.
4255     */
4256    @Child(name = "category", type = {
4257        CodeableConcept.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
4258    @Description(shortDefinition = "Benefit classification", formalDefinition = "Code to identify the general type of benefits under which products and services are provided.")
4259    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-benefitcategory")
4260    protected CodeableConcept category;
4261
4262    /**
4263     * When the value is a group code then this item collects a set of related claim
4264     * details, otherwise this contains the product, service, drug or other billing
4265     * code for the item.
4266     */
4267    @Child(name = "productOrService", type = {
4268        CodeableConcept.class }, order = 8, min = 1, max = 1, modifier = false, summary = false)
4269    @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.")
4270    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
4271    protected CodeableConcept productOrService;
4272
4273    /**
4274     * Item typification or modifiers codes to convey additional context for the
4275     * product or service.
4276     */
4277    @Child(name = "modifier", type = {
4278        CodeableConcept.class }, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4279    @Description(shortDefinition = "Product or service billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
4280    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
4281    protected List<CodeableConcept> modifier;
4282
4283    /**
4284     * Identifies the program under which this may be recovered.
4285     */
4286    @Child(name = "programCode", type = {
4287        CodeableConcept.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4288    @Description(shortDefinition = "Program the product or service is provided under", formalDefinition = "Identifies the program under which this may be recovered.")
4289    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-program-code")
4290    protected List<CodeableConcept> programCode;
4291
4292    /**
4293     * The date or dates when the service or product was supplied, performed or
4294     * completed.
4295     */
4296    @Child(name = "serviced", type = { DateType.class,
4297        Period.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
4298    @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.")
4299    protected Type serviced;
4300
4301    /**
4302     * Where the product or service was provided.
4303     */
4304    @Child(name = "location", type = { CodeableConcept.class, Address.class,
4305        Location.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
4306    @Description(shortDefinition = "Place of service or where product was supplied", formalDefinition = "Where the product or service was provided.")
4307    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-place")
4308    protected Type location;
4309
4310    /**
4311     * The number of repetitions of a service or product.
4312     */
4313    @Child(name = "quantity", type = {
4314        Quantity.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
4315    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
4316    protected Quantity quantity;
4317
4318    /**
4319     * If the item is not a group then this is the fee for the product or service,
4320     * otherwise this is the total of the fees for the details of the group.
4321     */
4322    @Child(name = "unitPrice", type = { Money.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
4323    @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.")
4324    protected Money unitPrice;
4325
4326    /**
4327     * A real number that represents a multiplier used in determining the overall
4328     * value of services delivered and/or goods received. The concept of a Factor
4329     * allows for a discount or surcharge multiplier to be applied to a monetary
4330     * amount.
4331     */
4332    @Child(name = "factor", type = {
4333        DecimalType.class }, order = 15, min = 0, max = 1, modifier = false, summary = false)
4334    @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.")
4335    protected DecimalType factor;
4336
4337    /**
4338     * The quantity times the unit price for an additional service or product or
4339     * charge.
4340     */
4341    @Child(name = "net", type = { Money.class }, order = 16, min = 0, max = 1, modifier = false, summary = false)
4342    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
4343    protected Money net;
4344
4345    /**
4346     * Unique Device Identifiers associated with this line item.
4347     */
4348    @Child(name = "udi", type = {
4349        Device.class }, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4350    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
4351    protected List<Reference> udi;
4352    /**
4353     * The actual objects that are the target of the reference (Unique Device
4354     * Identifiers associated with this line item.)
4355     */
4356    protected List<Device> udiTarget;
4357
4358    /**
4359     * Physical service site on the patient (limb, tooth, etc.).
4360     */
4361    @Child(name = "bodySite", type = {
4362        CodeableConcept.class }, order = 18, min = 0, max = 1, modifier = false, summary = false)
4363    @Description(shortDefinition = "Anatomical location", formalDefinition = "Physical service site on the patient (limb, tooth, etc.).")
4364    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/tooth")
4365    protected CodeableConcept bodySite;
4366
4367    /**
4368     * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
4369     */
4370    @Child(name = "subSite", type = {
4371        CodeableConcept.class }, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4372    @Description(shortDefinition = "Anatomical sub-location", formalDefinition = "A region or surface of the bodySite, e.g. limb region or tooth surface(s).")
4373    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/surface")
4374    protected List<CodeableConcept> subSite;
4375
4376    /**
4377     * A billed item may include goods or services provided in multiple encounters.
4378     */
4379    @Child(name = "encounter", type = {
4380        Encounter.class }, order = 20, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4381    @Description(shortDefinition = "Encounters related to this billed item", formalDefinition = "A billed item may include goods or services provided in multiple encounters.")
4382    protected List<Reference> encounter;
4383    /**
4384     * The actual objects that are the target of the reference (A billed item may
4385     * include goods or services provided in multiple encounters.)
4386     */
4387    protected List<Encounter> encounterTarget;
4388
4389    /**
4390     * The numbers associated with notes below which apply to the adjudication of
4391     * this item.
4392     */
4393    @Child(name = "noteNumber", type = {
4394        PositiveIntType.class }, order = 21, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4395    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
4396    protected List<PositiveIntType> noteNumber;
4397
4398    /**
4399     * If this item is a group then the values here are a summary of the
4400     * adjudication of the detail items. If this item is a simple product or service
4401     * then this is the result of the adjudication of this item.
4402     */
4403    @Child(name = "adjudication", type = {}, order = 22, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4404    @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.")
4405    protected List<AdjudicationComponent> adjudication;
4406
4407    /**
4408     * Second-tier of goods and services.
4409     */
4410    @Child(name = "detail", type = {}, order = 23, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4411    @Description(shortDefinition = "Additional items", formalDefinition = "Second-tier of goods and services.")
4412    protected List<DetailComponent> detail;
4413
4414    private static final long serialVersionUID = 67419471L;
4415
4416    /**
4417     * Constructor
4418     */
4419    public ItemComponent() {
4420      super();
4421    }
4422
4423    /**
4424     * Constructor
4425     */
4426    public ItemComponent(PositiveIntType sequence, CodeableConcept productOrService) {
4427      super();
4428      this.sequence = sequence;
4429      this.productOrService = productOrService;
4430    }
4431
4432    /**
4433     * @return {@link #sequence} (A number to uniquely identify item entries.). This
4434     *         is the underlying object with id, value and extensions. The accessor
4435     *         "getSequence" gives direct access to the value
4436     */
4437    public PositiveIntType getSequenceElement() {
4438      if (this.sequence == null)
4439        if (Configuration.errorOnAutoCreate())
4440          throw new Error("Attempt to auto-create ItemComponent.sequence");
4441        else if (Configuration.doAutoCreate())
4442          this.sequence = new PositiveIntType(); // bb
4443      return this.sequence;
4444    }
4445
4446    public boolean hasSequenceElement() {
4447      return this.sequence != null && !this.sequence.isEmpty();
4448    }
4449
4450    public boolean hasSequence() {
4451      return this.sequence != null && !this.sequence.isEmpty();
4452    }
4453
4454    /**
4455     * @param value {@link #sequence} (A number to uniquely identify item entries.).
4456     *              This is the underlying object with id, value and extensions. The
4457     *              accessor "getSequence" gives direct access to the value
4458     */
4459    public ItemComponent setSequenceElement(PositiveIntType value) {
4460      this.sequence = value;
4461      return this;
4462    }
4463
4464    /**
4465     * @return A number to uniquely identify item entries.
4466     */
4467    public int getSequence() {
4468      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
4469    }
4470
4471    /**
4472     * @param value A number to uniquely identify item entries.
4473     */
4474    public ItemComponent setSequence(int value) {
4475      if (this.sequence == null)
4476        this.sequence = new PositiveIntType();
4477      this.sequence.setValue(value);
4478      return this;
4479    }
4480
4481    /**
4482     * @return {@link #careTeamSequence} (Care team members related to this service
4483     *         or product.)
4484     */
4485    public List<PositiveIntType> getCareTeamSequence() {
4486      if (this.careTeamSequence == null)
4487        this.careTeamSequence = new ArrayList<PositiveIntType>();
4488      return this.careTeamSequence;
4489    }
4490
4491    /**
4492     * @return Returns a reference to <code>this</code> for easy method chaining
4493     */
4494    public ItemComponent setCareTeamSequence(List<PositiveIntType> theCareTeamSequence) {
4495      this.careTeamSequence = theCareTeamSequence;
4496      return this;
4497    }
4498
4499    public boolean hasCareTeamSequence() {
4500      if (this.careTeamSequence == null)
4501        return false;
4502      for (PositiveIntType item : this.careTeamSequence)
4503        if (!item.isEmpty())
4504          return true;
4505      return false;
4506    }
4507
4508    /**
4509     * @return {@link #careTeamSequence} (Care team members related to this service
4510     *         or product.)
4511     */
4512    public PositiveIntType addCareTeamSequenceElement() {// 2
4513      PositiveIntType t = new PositiveIntType();
4514      if (this.careTeamSequence == null)
4515        this.careTeamSequence = new ArrayList<PositiveIntType>();
4516      this.careTeamSequence.add(t);
4517      return t;
4518    }
4519
4520    /**
4521     * @param value {@link #careTeamSequence} (Care team members related to this
4522     *              service or product.)
4523     */
4524    public ItemComponent addCareTeamSequence(int value) { // 1
4525      PositiveIntType t = new PositiveIntType();
4526      t.setValue(value);
4527      if (this.careTeamSequence == null)
4528        this.careTeamSequence = new ArrayList<PositiveIntType>();
4529      this.careTeamSequence.add(t);
4530      return this;
4531    }
4532
4533    /**
4534     * @param value {@link #careTeamSequence} (Care team members related to this
4535     *              service or product.)
4536     */
4537    public boolean hasCareTeamSequence(int value) {
4538      if (this.careTeamSequence == null)
4539        return false;
4540      for (PositiveIntType v : this.careTeamSequence)
4541        if (v.getValue().equals(value)) // positiveInt
4542          return true;
4543      return false;
4544    }
4545
4546    /**
4547     * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or
4548     *         product.)
4549     */
4550    public List<PositiveIntType> getDiagnosisSequence() {
4551      if (this.diagnosisSequence == null)
4552        this.diagnosisSequence = new ArrayList<PositiveIntType>();
4553      return this.diagnosisSequence;
4554    }
4555
4556    /**
4557     * @return Returns a reference to <code>this</code> for easy method chaining
4558     */
4559    public ItemComponent setDiagnosisSequence(List<PositiveIntType> theDiagnosisSequence) {
4560      this.diagnosisSequence = theDiagnosisSequence;
4561      return this;
4562    }
4563
4564    public boolean hasDiagnosisSequence() {
4565      if (this.diagnosisSequence == null)
4566        return false;
4567      for (PositiveIntType item : this.diagnosisSequence)
4568        if (!item.isEmpty())
4569          return true;
4570      return false;
4571    }
4572
4573    /**
4574     * @return {@link #diagnosisSequence} (Diagnoses applicable for this service or
4575     *         product.)
4576     */
4577    public PositiveIntType addDiagnosisSequenceElement() {// 2
4578      PositiveIntType t = new PositiveIntType();
4579      if (this.diagnosisSequence == null)
4580        this.diagnosisSequence = new ArrayList<PositiveIntType>();
4581      this.diagnosisSequence.add(t);
4582      return t;
4583    }
4584
4585    /**
4586     * @param value {@link #diagnosisSequence} (Diagnoses applicable for this
4587     *              service or product.)
4588     */
4589    public ItemComponent addDiagnosisSequence(int value) { // 1
4590      PositiveIntType t = new PositiveIntType();
4591      t.setValue(value);
4592      if (this.diagnosisSequence == null)
4593        this.diagnosisSequence = new ArrayList<PositiveIntType>();
4594      this.diagnosisSequence.add(t);
4595      return this;
4596    }
4597
4598    /**
4599     * @param value {@link #diagnosisSequence} (Diagnoses applicable for this
4600     *              service or product.)
4601     */
4602    public boolean hasDiagnosisSequence(int value) {
4603      if (this.diagnosisSequence == null)
4604        return false;
4605      for (PositiveIntType v : this.diagnosisSequence)
4606        if (v.getValue().equals(value)) // positiveInt
4607          return true;
4608      return false;
4609    }
4610
4611    /**
4612     * @return {@link #procedureSequence} (Procedures applicable for this service or
4613     *         product.)
4614     */
4615    public List<PositiveIntType> getProcedureSequence() {
4616      if (this.procedureSequence == null)
4617        this.procedureSequence = new ArrayList<PositiveIntType>();
4618      return this.procedureSequence;
4619    }
4620
4621    /**
4622     * @return Returns a reference to <code>this</code> for easy method chaining
4623     */
4624    public ItemComponent setProcedureSequence(List<PositiveIntType> theProcedureSequence) {
4625      this.procedureSequence = theProcedureSequence;
4626      return this;
4627    }
4628
4629    public boolean hasProcedureSequence() {
4630      if (this.procedureSequence == null)
4631        return false;
4632      for (PositiveIntType item : this.procedureSequence)
4633        if (!item.isEmpty())
4634          return true;
4635      return false;
4636    }
4637
4638    /**
4639     * @return {@link #procedureSequence} (Procedures applicable for this service or
4640     *         product.)
4641     */
4642    public PositiveIntType addProcedureSequenceElement() {// 2
4643      PositiveIntType t = new PositiveIntType();
4644      if (this.procedureSequence == null)
4645        this.procedureSequence = new ArrayList<PositiveIntType>();
4646      this.procedureSequence.add(t);
4647      return t;
4648    }
4649
4650    /**
4651     * @param value {@link #procedureSequence} (Procedures applicable for this
4652     *              service or product.)
4653     */
4654    public ItemComponent addProcedureSequence(int value) { // 1
4655      PositiveIntType t = new PositiveIntType();
4656      t.setValue(value);
4657      if (this.procedureSequence == null)
4658        this.procedureSequence = new ArrayList<PositiveIntType>();
4659      this.procedureSequence.add(t);
4660      return this;
4661    }
4662
4663    /**
4664     * @param value {@link #procedureSequence} (Procedures applicable for this
4665     *              service or product.)
4666     */
4667    public boolean hasProcedureSequence(int value) {
4668      if (this.procedureSequence == null)
4669        return false;
4670      for (PositiveIntType v : this.procedureSequence)
4671        if (v.getValue().equals(value)) // positiveInt
4672          return true;
4673      return false;
4674    }
4675
4676    /**
4677     * @return {@link #informationSequence} (Exceptions, special conditions and
4678     *         supporting information applicable for this service or product.)
4679     */
4680    public List<PositiveIntType> getInformationSequence() {
4681      if (this.informationSequence == null)
4682        this.informationSequence = new ArrayList<PositiveIntType>();
4683      return this.informationSequence;
4684    }
4685
4686    /**
4687     * @return Returns a reference to <code>this</code> for easy method chaining
4688     */
4689    public ItemComponent setInformationSequence(List<PositiveIntType> theInformationSequence) {
4690      this.informationSequence = theInformationSequence;
4691      return this;
4692    }
4693
4694    public boolean hasInformationSequence() {
4695      if (this.informationSequence == null)
4696        return false;
4697      for (PositiveIntType item : this.informationSequence)
4698        if (!item.isEmpty())
4699          return true;
4700      return false;
4701    }
4702
4703    /**
4704     * @return {@link #informationSequence} (Exceptions, special conditions and
4705     *         supporting information applicable for this service or product.)
4706     */
4707    public PositiveIntType addInformationSequenceElement() {// 2
4708      PositiveIntType t = new PositiveIntType();
4709      if (this.informationSequence == null)
4710        this.informationSequence = new ArrayList<PositiveIntType>();
4711      this.informationSequence.add(t);
4712      return t;
4713    }
4714
4715    /**
4716     * @param value {@link #informationSequence} (Exceptions, special conditions and
4717     *              supporting information applicable for this service or product.)
4718     */
4719    public ItemComponent addInformationSequence(int value) { // 1
4720      PositiveIntType t = new PositiveIntType();
4721      t.setValue(value);
4722      if (this.informationSequence == null)
4723        this.informationSequence = new ArrayList<PositiveIntType>();
4724      this.informationSequence.add(t);
4725      return this;
4726    }
4727
4728    /**
4729     * @param value {@link #informationSequence} (Exceptions, special conditions and
4730     *              supporting information applicable for this service or product.)
4731     */
4732    public boolean hasInformationSequence(int value) {
4733      if (this.informationSequence == null)
4734        return false;
4735      for (PositiveIntType v : this.informationSequence)
4736        if (v.getValue().equals(value)) // positiveInt
4737          return true;
4738      return false;
4739    }
4740
4741    /**
4742     * @return {@link #revenue} (The type of revenue or cost center providing the
4743     *         product and/or service.)
4744     */
4745    public CodeableConcept getRevenue() {
4746      if (this.revenue == null)
4747        if (Configuration.errorOnAutoCreate())
4748          throw new Error("Attempt to auto-create ItemComponent.revenue");
4749        else if (Configuration.doAutoCreate())
4750          this.revenue = new CodeableConcept(); // cc
4751      return this.revenue;
4752    }
4753
4754    public boolean hasRevenue() {
4755      return this.revenue != null && !this.revenue.isEmpty();
4756    }
4757
4758    /**
4759     * @param value {@link #revenue} (The type of revenue or cost center providing
4760     *              the product and/or service.)
4761     */
4762    public ItemComponent setRevenue(CodeableConcept value) {
4763      this.revenue = value;
4764      return this;
4765    }
4766
4767    /**
4768     * @return {@link #category} (Code to identify the general type of benefits
4769     *         under which products and services are provided.)
4770     */
4771    public CodeableConcept getCategory() {
4772      if (this.category == null)
4773        if (Configuration.errorOnAutoCreate())
4774          throw new Error("Attempt to auto-create ItemComponent.category");
4775        else if (Configuration.doAutoCreate())
4776          this.category = new CodeableConcept(); // cc
4777      return this.category;
4778    }
4779
4780    public boolean hasCategory() {
4781      return this.category != null && !this.category.isEmpty();
4782    }
4783
4784    /**
4785     * @param value {@link #category} (Code to identify the general type of benefits
4786     *              under which products and services are provided.)
4787     */
4788    public ItemComponent setCategory(CodeableConcept value) {
4789      this.category = value;
4790      return this;
4791    }
4792
4793    /**
4794     * @return {@link #productOrService} (When the value is a group code then this
4795     *         item collects a set of related claim details, otherwise this contains
4796     *         the product, service, drug or other billing code for the item.)
4797     */
4798    public CodeableConcept getProductOrService() {
4799      if (this.productOrService == null)
4800        if (Configuration.errorOnAutoCreate())
4801          throw new Error("Attempt to auto-create ItemComponent.productOrService");
4802        else if (Configuration.doAutoCreate())
4803          this.productOrService = new CodeableConcept(); // cc
4804      return this.productOrService;
4805    }
4806
4807    public boolean hasProductOrService() {
4808      return this.productOrService != null && !this.productOrService.isEmpty();
4809    }
4810
4811    /**
4812     * @param value {@link #productOrService} (When the value is a group code then
4813     *              this item collects a set of related claim details, otherwise
4814     *              this contains the product, service, drug or other billing code
4815     *              for the item.)
4816     */
4817    public ItemComponent setProductOrService(CodeableConcept value) {
4818      this.productOrService = value;
4819      return this;
4820    }
4821
4822    /**
4823     * @return {@link #modifier} (Item typification or modifiers codes to convey
4824     *         additional context for the product or service.)
4825     */
4826    public List<CodeableConcept> getModifier() {
4827      if (this.modifier == null)
4828        this.modifier = new ArrayList<CodeableConcept>();
4829      return this.modifier;
4830    }
4831
4832    /**
4833     * @return Returns a reference to <code>this</code> for easy method chaining
4834     */
4835    public ItemComponent setModifier(List<CodeableConcept> theModifier) {
4836      this.modifier = theModifier;
4837      return this;
4838    }
4839
4840    public boolean hasModifier() {
4841      if (this.modifier == null)
4842        return false;
4843      for (CodeableConcept item : this.modifier)
4844        if (!item.isEmpty())
4845          return true;
4846      return false;
4847    }
4848
4849    public CodeableConcept addModifier() { // 3
4850      CodeableConcept t = new CodeableConcept();
4851      if (this.modifier == null)
4852        this.modifier = new ArrayList<CodeableConcept>();
4853      this.modifier.add(t);
4854      return t;
4855    }
4856
4857    public ItemComponent addModifier(CodeableConcept t) { // 3
4858      if (t == null)
4859        return this;
4860      if (this.modifier == null)
4861        this.modifier = new ArrayList<CodeableConcept>();
4862      this.modifier.add(t);
4863      return this;
4864    }
4865
4866    /**
4867     * @return The first repetition of repeating field {@link #modifier}, creating
4868     *         it if it does not already exist
4869     */
4870    public CodeableConcept getModifierFirstRep() {
4871      if (getModifier().isEmpty()) {
4872        addModifier();
4873      }
4874      return getModifier().get(0);
4875    }
4876
4877    /**
4878     * @return {@link #programCode} (Identifies the program under which this may be
4879     *         recovered.)
4880     */
4881    public List<CodeableConcept> getProgramCode() {
4882      if (this.programCode == null)
4883        this.programCode = new ArrayList<CodeableConcept>();
4884      return this.programCode;
4885    }
4886
4887    /**
4888     * @return Returns a reference to <code>this</code> for easy method chaining
4889     */
4890    public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) {
4891      this.programCode = theProgramCode;
4892      return this;
4893    }
4894
4895    public boolean hasProgramCode() {
4896      if (this.programCode == null)
4897        return false;
4898      for (CodeableConcept item : this.programCode)
4899        if (!item.isEmpty())
4900          return true;
4901      return false;
4902    }
4903
4904    public CodeableConcept addProgramCode() { // 3
4905      CodeableConcept t = new CodeableConcept();
4906      if (this.programCode == null)
4907        this.programCode = new ArrayList<CodeableConcept>();
4908      this.programCode.add(t);
4909      return t;
4910    }
4911
4912    public ItemComponent addProgramCode(CodeableConcept t) { // 3
4913      if (t == null)
4914        return this;
4915      if (this.programCode == null)
4916        this.programCode = new ArrayList<CodeableConcept>();
4917      this.programCode.add(t);
4918      return this;
4919    }
4920
4921    /**
4922     * @return The first repetition of repeating field {@link #programCode},
4923     *         creating it if it does not already exist
4924     */
4925    public CodeableConcept getProgramCodeFirstRep() {
4926      if (getProgramCode().isEmpty()) {
4927        addProgramCode();
4928      }
4929      return getProgramCode().get(0);
4930    }
4931
4932    /**
4933     * @return {@link #serviced} (The date or dates when the service or product was
4934     *         supplied, performed or completed.)
4935     */
4936    public Type getServiced() {
4937      return this.serviced;
4938    }
4939
4940    /**
4941     * @return {@link #serviced} (The date or dates when the service or product was
4942     *         supplied, performed or completed.)
4943     */
4944    public DateType getServicedDateType() throws FHIRException {
4945      if (this.serviced == null)
4946        this.serviced = new DateType();
4947      if (!(this.serviced instanceof DateType))
4948        throw new FHIRException("Type mismatch: the type DateType was expected, but "
4949            + this.serviced.getClass().getName() + " was encountered");
4950      return (DateType) this.serviced;
4951    }
4952
4953    public boolean hasServicedDateType() {
4954        return this.serviced instanceof DateType;
4955    }
4956
4957    /**
4958     * @return {@link #serviced} (The date or dates when the service or product was
4959     *         supplied, performed or completed.)
4960     */
4961    public Period getServicedPeriod() throws FHIRException {
4962      if (this.serviced == null)
4963        this.serviced = new Period();
4964      if (!(this.serviced instanceof Period))
4965        throw new FHIRException("Type mismatch: the type Period was expected, but " + this.serviced.getClass().getName()
4966            + " was encountered");
4967      return (Period) this.serviced;
4968    }
4969
4970    public boolean hasServicedPeriod() {
4971        return this.serviced instanceof Period;
4972    }
4973
4974    public boolean hasServiced() {
4975      return this.serviced != null && !this.serviced.isEmpty();
4976    }
4977
4978    /**
4979     * @param value {@link #serviced} (The date or dates when the service or product
4980     *              was supplied, performed or completed.)
4981     */
4982    public ItemComponent setServiced(Type value) {
4983      if (value != null && !(value instanceof DateType || value instanceof Period))
4984        throw new Error("Not the right type for ExplanationOfBenefit.item.serviced[x]: " + value.fhirType());
4985      this.serviced = value;
4986      return this;
4987    }
4988
4989    /**
4990     * @return {@link #location} (Where the product or service was provided.)
4991     */
4992    public Type getLocation() {
4993      return this.location;
4994    }
4995
4996    /**
4997     * @return {@link #location} (Where the product or service was provided.)
4998     */
4999    public CodeableConcept getLocationCodeableConcept() throws FHIRException {
5000      if (this.location == null)
5001        this.location = new CodeableConcept();
5002      if (!(this.location instanceof CodeableConcept))
5003        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
5004            + this.location.getClass().getName() + " was encountered");
5005      return (CodeableConcept) this.location;
5006    }
5007
5008    public boolean hasLocationCodeableConcept() {
5009        return this.location instanceof CodeableConcept;
5010    }
5011
5012    /**
5013     * @return {@link #location} (Where the product or service was provided.)
5014     */
5015    public Address getLocationAddress() throws FHIRException {
5016      if (this.location == null)
5017        this.location = new Address();
5018      if (!(this.location instanceof Address))
5019        throw new FHIRException("Type mismatch: the type Address was expected, but "
5020            + this.location.getClass().getName() + " was encountered");
5021      return (Address) this.location;
5022    }
5023
5024    public boolean hasLocationAddress() {
5025        return this.location instanceof Address;
5026    }
5027
5028    /**
5029     * @return {@link #location} (Where the product or service was provided.)
5030     */
5031    public Reference getLocationReference() throws FHIRException {
5032      if (this.location == null)
5033        this.location = new Reference();
5034      if (!(this.location instanceof Reference))
5035        throw new FHIRException("Type mismatch: the type Reference was expected, but "
5036            + this.location.getClass().getName() + " was encountered");
5037      return (Reference) this.location;
5038    }
5039
5040    public boolean hasLocationReference() {
5041        return this.location instanceof Reference;
5042    }
5043
5044    public boolean hasLocation() {
5045      return this.location != null && !this.location.isEmpty();
5046    }
5047
5048    /**
5049     * @param value {@link #location} (Where the product or service was provided.)
5050     */
5051    public ItemComponent setLocation(Type value) {
5052      if (value != null
5053          && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
5054        throw new Error("Not the right type for ExplanationOfBenefit.item.location[x]: " + value.fhirType());
5055      this.location = value;
5056      return this;
5057    }
5058
5059    /**
5060     * @return {@link #quantity} (The number of repetitions of a service or
5061     *         product.)
5062     */
5063    public Quantity getQuantity() {
5064      if (this.quantity == null)
5065        if (Configuration.errorOnAutoCreate())
5066          throw new Error("Attempt to auto-create ItemComponent.quantity");
5067        else if (Configuration.doAutoCreate())
5068          this.quantity = new Quantity(); // cc
5069      return this.quantity;
5070    }
5071
5072    public boolean hasQuantity() {
5073      return this.quantity != null && !this.quantity.isEmpty();
5074    }
5075
5076    /**
5077     * @param value {@link #quantity} (The number of repetitions of a service or
5078     *              product.)
5079     */
5080    public ItemComponent setQuantity(Quantity value) {
5081      this.quantity = value;
5082      return this;
5083    }
5084
5085    /**
5086     * @return {@link #unitPrice} (If the item is not a group then this is the fee
5087     *         for the product or service, otherwise this is the total of the fees
5088     *         for the details of the group.)
5089     */
5090    public Money getUnitPrice() {
5091      if (this.unitPrice == null)
5092        if (Configuration.errorOnAutoCreate())
5093          throw new Error("Attempt to auto-create ItemComponent.unitPrice");
5094        else if (Configuration.doAutoCreate())
5095          this.unitPrice = new Money(); // cc
5096      return this.unitPrice;
5097    }
5098
5099    public boolean hasUnitPrice() {
5100      return this.unitPrice != null && !this.unitPrice.isEmpty();
5101    }
5102
5103    /**
5104     * @param value {@link #unitPrice} (If the item is not a group then this is the
5105     *              fee for the product or service, otherwise this is the total of
5106     *              the fees for the details of the group.)
5107     */
5108    public ItemComponent setUnitPrice(Money value) {
5109      this.unitPrice = value;
5110      return this;
5111    }
5112
5113    /**
5114     * @return {@link #factor} (A real number that represents a multiplier used in
5115     *         determining the overall value of services delivered and/or goods
5116     *         received. The concept of a Factor allows for a discount or surcharge
5117     *         multiplier to be applied to a monetary amount.). This is the
5118     *         underlying object with id, value and extensions. The accessor
5119     *         "getFactor" gives direct access to the value
5120     */
5121    public DecimalType getFactorElement() {
5122      if (this.factor == null)
5123        if (Configuration.errorOnAutoCreate())
5124          throw new Error("Attempt to auto-create ItemComponent.factor");
5125        else if (Configuration.doAutoCreate())
5126          this.factor = new DecimalType(); // bb
5127      return this.factor;
5128    }
5129
5130    public boolean hasFactorElement() {
5131      return this.factor != null && !this.factor.isEmpty();
5132    }
5133
5134    public boolean hasFactor() {
5135      return this.factor != null && !this.factor.isEmpty();
5136    }
5137
5138    /**
5139     * @param value {@link #factor} (A real number that represents a multiplier used
5140     *              in determining the overall value of services delivered and/or
5141     *              goods received. The concept of a Factor allows for a discount or
5142     *              surcharge multiplier to be applied to a monetary amount.). This
5143     *              is the underlying object with id, value and extensions. The
5144     *              accessor "getFactor" gives direct access to the value
5145     */
5146    public ItemComponent setFactorElement(DecimalType value) {
5147      this.factor = value;
5148      return this;
5149    }
5150
5151    /**
5152     * @return A real number that represents a multiplier used in determining the
5153     *         overall value of services delivered and/or goods received. The
5154     *         concept of a Factor allows for a discount or surcharge multiplier to
5155     *         be applied to a monetary amount.
5156     */
5157    public BigDecimal getFactor() {
5158      return this.factor == null ? null : this.factor.getValue();
5159    }
5160
5161    /**
5162     * @param value A real number that represents a multiplier used in determining
5163     *              the overall value of services delivered and/or goods received.
5164     *              The concept of a Factor allows for a discount or surcharge
5165     *              multiplier to be applied to a monetary amount.
5166     */
5167    public ItemComponent setFactor(BigDecimal value) {
5168      if (value == null)
5169        this.factor = null;
5170      else {
5171        if (this.factor == null)
5172          this.factor = new DecimalType();
5173        this.factor.setValue(value);
5174      }
5175      return this;
5176    }
5177
5178    /**
5179     * @param value A real number that represents a multiplier used in determining
5180     *              the overall value of services delivered and/or goods received.
5181     *              The concept of a Factor allows for a discount or surcharge
5182     *              multiplier to be applied to a monetary amount.
5183     */
5184    public ItemComponent setFactor(long value) {
5185      this.factor = new DecimalType();
5186      this.factor.setValue(value);
5187      return this;
5188    }
5189
5190    /**
5191     * @param value A real number that represents a multiplier used in determining
5192     *              the overall value of services delivered and/or goods received.
5193     *              The concept of a Factor allows for a discount or surcharge
5194     *              multiplier to be applied to a monetary amount.
5195     */
5196    public ItemComponent setFactor(double value) {
5197      this.factor = new DecimalType();
5198      this.factor.setValue(value);
5199      return this;
5200    }
5201
5202    /**
5203     * @return {@link #net} (The quantity times the unit price for an additional
5204     *         service or product or charge.)
5205     */
5206    public Money getNet() {
5207      if (this.net == null)
5208        if (Configuration.errorOnAutoCreate())
5209          throw new Error("Attempt to auto-create ItemComponent.net");
5210        else if (Configuration.doAutoCreate())
5211          this.net = new Money(); // cc
5212      return this.net;
5213    }
5214
5215    public boolean hasNet() {
5216      return this.net != null && !this.net.isEmpty();
5217    }
5218
5219    /**
5220     * @param value {@link #net} (The quantity times the unit price for an
5221     *              additional service or product or charge.)
5222     */
5223    public ItemComponent setNet(Money value) {
5224      this.net = value;
5225      return this;
5226    }
5227
5228    /**
5229     * @return {@link #udi} (Unique Device Identifiers associated with this line
5230     *         item.)
5231     */
5232    public List<Reference> getUdi() {
5233      if (this.udi == null)
5234        this.udi = new ArrayList<Reference>();
5235      return this.udi;
5236    }
5237
5238    /**
5239     * @return Returns a reference to <code>this</code> for easy method chaining
5240     */
5241    public ItemComponent setUdi(List<Reference> theUdi) {
5242      this.udi = theUdi;
5243      return this;
5244    }
5245
5246    public boolean hasUdi() {
5247      if (this.udi == null)
5248        return false;
5249      for (Reference item : this.udi)
5250        if (!item.isEmpty())
5251          return true;
5252      return false;
5253    }
5254
5255    public Reference addUdi() { // 3
5256      Reference t = new Reference();
5257      if (this.udi == null)
5258        this.udi = new ArrayList<Reference>();
5259      this.udi.add(t);
5260      return t;
5261    }
5262
5263    public ItemComponent addUdi(Reference t) { // 3
5264      if (t == null)
5265        return this;
5266      if (this.udi == null)
5267        this.udi = new ArrayList<Reference>();
5268      this.udi.add(t);
5269      return this;
5270    }
5271
5272    /**
5273     * @return The first repetition of repeating field {@link #udi}, creating it if
5274     *         it does not already exist
5275     */
5276    public Reference getUdiFirstRep() {
5277      if (getUdi().isEmpty()) {
5278        addUdi();
5279      }
5280      return getUdi().get(0);
5281    }
5282
5283    /**
5284     * @return {@link #bodySite} (Physical service site on the patient (limb, tooth,
5285     *         etc.).)
5286     */
5287    public CodeableConcept getBodySite() {
5288      if (this.bodySite == null)
5289        if (Configuration.errorOnAutoCreate())
5290          throw new Error("Attempt to auto-create ItemComponent.bodySite");
5291        else if (Configuration.doAutoCreate())
5292          this.bodySite = new CodeableConcept(); // cc
5293      return this.bodySite;
5294    }
5295
5296    public boolean hasBodySite() {
5297      return this.bodySite != null && !this.bodySite.isEmpty();
5298    }
5299
5300    /**
5301     * @param value {@link #bodySite} (Physical service site on the patient (limb,
5302     *              tooth, etc.).)
5303     */
5304    public ItemComponent setBodySite(CodeableConcept value) {
5305      this.bodySite = value;
5306      return this;
5307    }
5308
5309    /**
5310     * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb
5311     *         region or tooth surface(s).)
5312     */
5313    public List<CodeableConcept> getSubSite() {
5314      if (this.subSite == null)
5315        this.subSite = new ArrayList<CodeableConcept>();
5316      return this.subSite;
5317    }
5318
5319    /**
5320     * @return Returns a reference to <code>this</code> for easy method chaining
5321     */
5322    public ItemComponent setSubSite(List<CodeableConcept> theSubSite) {
5323      this.subSite = theSubSite;
5324      return this;
5325    }
5326
5327    public boolean hasSubSite() {
5328      if (this.subSite == null)
5329        return false;
5330      for (CodeableConcept item : this.subSite)
5331        if (!item.isEmpty())
5332          return true;
5333      return false;
5334    }
5335
5336    public CodeableConcept addSubSite() { // 3
5337      CodeableConcept t = new CodeableConcept();
5338      if (this.subSite == null)
5339        this.subSite = new ArrayList<CodeableConcept>();
5340      this.subSite.add(t);
5341      return t;
5342    }
5343
5344    public ItemComponent addSubSite(CodeableConcept t) { // 3
5345      if (t == null)
5346        return this;
5347      if (this.subSite == null)
5348        this.subSite = new ArrayList<CodeableConcept>();
5349      this.subSite.add(t);
5350      return this;
5351    }
5352
5353    /**
5354     * @return The first repetition of repeating field {@link #subSite}, creating it
5355     *         if it does not already exist
5356     */
5357    public CodeableConcept getSubSiteFirstRep() {
5358      if (getSubSite().isEmpty()) {
5359        addSubSite();
5360      }
5361      return getSubSite().get(0);
5362    }
5363
5364    /**
5365     * @return {@link #encounter} (A billed item may include goods or services
5366     *         provided in multiple encounters.)
5367     */
5368    public List<Reference> getEncounter() {
5369      if (this.encounter == null)
5370        this.encounter = new ArrayList<Reference>();
5371      return this.encounter;
5372    }
5373
5374    /**
5375     * @return Returns a reference to <code>this</code> for easy method chaining
5376     */
5377    public ItemComponent setEncounter(List<Reference> theEncounter) {
5378      this.encounter = theEncounter;
5379      return this;
5380    }
5381
5382    public boolean hasEncounter() {
5383      if (this.encounter == null)
5384        return false;
5385      for (Reference item : this.encounter)
5386        if (!item.isEmpty())
5387          return true;
5388      return false;
5389    }
5390
5391    public Reference addEncounter() { // 3
5392      Reference t = new Reference();
5393      if (this.encounter == null)
5394        this.encounter = new ArrayList<Reference>();
5395      this.encounter.add(t);
5396      return t;
5397    }
5398
5399    public ItemComponent addEncounter(Reference t) { // 3
5400      if (t == null)
5401        return this;
5402      if (this.encounter == null)
5403        this.encounter = new ArrayList<Reference>();
5404      this.encounter.add(t);
5405      return this;
5406    }
5407
5408    /**
5409     * @return The first repetition of repeating field {@link #encounter}, creating
5410     *         it if it does not already exist
5411     */
5412    public Reference getEncounterFirstRep() {
5413      if (getEncounter().isEmpty()) {
5414        addEncounter();
5415      }
5416      return getEncounter().get(0);
5417    }
5418
5419    /**
5420     * @return {@link #noteNumber} (The numbers associated with notes below which
5421     *         apply to the adjudication of this item.)
5422     */
5423    public List<PositiveIntType> getNoteNumber() {
5424      if (this.noteNumber == null)
5425        this.noteNumber = new ArrayList<PositiveIntType>();
5426      return this.noteNumber;
5427    }
5428
5429    /**
5430     * @return Returns a reference to <code>this</code> for easy method chaining
5431     */
5432    public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
5433      this.noteNumber = theNoteNumber;
5434      return this;
5435    }
5436
5437    public boolean hasNoteNumber() {
5438      if (this.noteNumber == null)
5439        return false;
5440      for (PositiveIntType item : this.noteNumber)
5441        if (!item.isEmpty())
5442          return true;
5443      return false;
5444    }
5445
5446    /**
5447     * @return {@link #noteNumber} (The numbers associated with notes below which
5448     *         apply to the adjudication of this item.)
5449     */
5450    public PositiveIntType addNoteNumberElement() {// 2
5451      PositiveIntType t = new PositiveIntType();
5452      if (this.noteNumber == null)
5453        this.noteNumber = new ArrayList<PositiveIntType>();
5454      this.noteNumber.add(t);
5455      return t;
5456    }
5457
5458    /**
5459     * @param value {@link #noteNumber} (The numbers associated with notes below
5460     *              which apply to the adjudication of this item.)
5461     */
5462    public ItemComponent addNoteNumber(int value) { // 1
5463      PositiveIntType t = new PositiveIntType();
5464      t.setValue(value);
5465      if (this.noteNumber == null)
5466        this.noteNumber = new ArrayList<PositiveIntType>();
5467      this.noteNumber.add(t);
5468      return this;
5469    }
5470
5471    /**
5472     * @param value {@link #noteNumber} (The numbers associated with notes below
5473     *              which apply to the adjudication of this item.)
5474     */
5475    public boolean hasNoteNumber(int value) {
5476      if (this.noteNumber == null)
5477        return false;
5478      for (PositiveIntType v : this.noteNumber)
5479        if (v.getValue().equals(value)) // positiveInt
5480          return true;
5481      return false;
5482    }
5483
5484    /**
5485     * @return {@link #adjudication} (If this item is a group then the values here
5486     *         are a summary of the adjudication of the detail items. If this item
5487     *         is a simple product or service then this is the result of the
5488     *         adjudication of this item.)
5489     */
5490    public List<AdjudicationComponent> getAdjudication() {
5491      if (this.adjudication == null)
5492        this.adjudication = new ArrayList<AdjudicationComponent>();
5493      return this.adjudication;
5494    }
5495
5496    /**
5497     * @return Returns a reference to <code>this</code> for easy method chaining
5498     */
5499    public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
5500      this.adjudication = theAdjudication;
5501      return this;
5502    }
5503
5504    public boolean hasAdjudication() {
5505      if (this.adjudication == null)
5506        return false;
5507      for (AdjudicationComponent item : this.adjudication)
5508        if (!item.isEmpty())
5509          return true;
5510      return false;
5511    }
5512
5513    public AdjudicationComponent addAdjudication() { // 3
5514      AdjudicationComponent t = new AdjudicationComponent();
5515      if (this.adjudication == null)
5516        this.adjudication = new ArrayList<AdjudicationComponent>();
5517      this.adjudication.add(t);
5518      return t;
5519    }
5520
5521    public ItemComponent addAdjudication(AdjudicationComponent t) { // 3
5522      if (t == null)
5523        return this;
5524      if (this.adjudication == null)
5525        this.adjudication = new ArrayList<AdjudicationComponent>();
5526      this.adjudication.add(t);
5527      return this;
5528    }
5529
5530    /**
5531     * @return The first repetition of repeating field {@link #adjudication},
5532     *         creating it if it does not already exist
5533     */
5534    public AdjudicationComponent getAdjudicationFirstRep() {
5535      if (getAdjudication().isEmpty()) {
5536        addAdjudication();
5537      }
5538      return getAdjudication().get(0);
5539    }
5540
5541    /**
5542     * @return {@link #detail} (Second-tier of goods and services.)
5543     */
5544    public List<DetailComponent> getDetail() {
5545      if (this.detail == null)
5546        this.detail = new ArrayList<DetailComponent>();
5547      return this.detail;
5548    }
5549
5550    /**
5551     * @return Returns a reference to <code>this</code> for easy method chaining
5552     */
5553    public ItemComponent setDetail(List<DetailComponent> theDetail) {
5554      this.detail = theDetail;
5555      return this;
5556    }
5557
5558    public boolean hasDetail() {
5559      if (this.detail == null)
5560        return false;
5561      for (DetailComponent item : this.detail)
5562        if (!item.isEmpty())
5563          return true;
5564      return false;
5565    }
5566
5567    public DetailComponent addDetail() { // 3
5568      DetailComponent t = new DetailComponent();
5569      if (this.detail == null)
5570        this.detail = new ArrayList<DetailComponent>();
5571      this.detail.add(t);
5572      return t;
5573    }
5574
5575    public ItemComponent addDetail(DetailComponent t) { // 3
5576      if (t == null)
5577        return this;
5578      if (this.detail == null)
5579        this.detail = new ArrayList<DetailComponent>();
5580      this.detail.add(t);
5581      return this;
5582    }
5583
5584    /**
5585     * @return The first repetition of repeating field {@link #detail}, creating it
5586     *         if it does not already exist
5587     */
5588    public DetailComponent getDetailFirstRep() {
5589      if (getDetail().isEmpty()) {
5590        addDetail();
5591      }
5592      return getDetail().get(0);
5593    }
5594
5595    protected void listChildren(List<Property> children) {
5596      super.listChildren(children);
5597      children
5598          .add(new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence));
5599      children.add(new Property("careTeamSequence", "positiveInt",
5600          "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence));
5601      children.add(new Property("diagnosisSequence", "positiveInt", "Diagnoses applicable for this service or product.",
5602          0, java.lang.Integer.MAX_VALUE, diagnosisSequence));
5603      children.add(new Property("procedureSequence", "positiveInt",
5604          "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence));
5605      children.add(new Property("informationSequence", "positiveInt",
5606          "Exceptions, special conditions and supporting information applicable for this service or product.", 0,
5607          java.lang.Integer.MAX_VALUE, informationSequence));
5608      children.add(new Property("revenue", "CodeableConcept",
5609          "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
5610      children.add(new Property("category", "CodeableConcept",
5611          "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
5612          category));
5613      children.add(new Property("productOrService", "CodeableConcept",
5614          "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.",
5615          0, 1, productOrService));
5616      children.add(new Property("modifier", "CodeableConcept",
5617          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
5618          java.lang.Integer.MAX_VALUE, modifier));
5619      children.add(new Property("programCode", "CodeableConcept",
5620          "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
5621      children.add(new Property("serviced[x]", "date|Period",
5622          "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced));
5623      children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5624          "Where the product or service was provided.", 0, 1, location));
5625      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
5626          1, quantity));
5627      children.add(new Property("unitPrice", "Money",
5628          "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.",
5629          0, 1, unitPrice));
5630      children.add(new Property("factor", "decimal",
5631          "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.",
5632          0, 1, factor));
5633      children.add(new Property("net", "Money",
5634          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
5635      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
5636          0, java.lang.Integer.MAX_VALUE, udi));
5637      children.add(new Property("bodySite", "CodeableConcept",
5638          "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
5639      children.add(new Property("subSite", "CodeableConcept",
5640          "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE,
5641          subSite));
5642      children.add(new Property("encounter", "Reference(Encounter)",
5643          "A billed item may include goods or services provided in multiple encounters.", 0,
5644          java.lang.Integer.MAX_VALUE, encounter));
5645      children.add(new Property("noteNumber", "positiveInt",
5646          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
5647          java.lang.Integer.MAX_VALUE, noteNumber));
5648      children.add(new Property("adjudication", "",
5649          "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.",
5650          0, java.lang.Integer.MAX_VALUE, adjudication));
5651      children.add(
5652          new Property("detail", "", "Second-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE, detail));
5653    }
5654
5655    @Override
5656    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5657      switch (_hash) {
5658      case 1349547969:
5659        /* sequence */ return new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0,
5660            1, sequence);
5661      case 1070083823:
5662        /* careTeamSequence */ return new Property("careTeamSequence", "positiveInt",
5663            "Care team members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence);
5664      case -909769262:
5665        /* diagnosisSequence */ return new Property("diagnosisSequence", "positiveInt",
5666            "Diagnoses applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence);
5667      case -808920140:
5668        /* procedureSequence */ return new Property("procedureSequence", "positiveInt",
5669            "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence);
5670      case -702585587:
5671        /* informationSequence */ return new Property("informationSequence", "positiveInt",
5672            "Exceptions, special conditions and supporting information applicable for this service or product.", 0,
5673            java.lang.Integer.MAX_VALUE, informationSequence);
5674      case 1099842588:
5675        /* revenue */ return new Property("revenue", "CodeableConcept",
5676            "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
5677      case 50511102:
5678        /* category */ return new Property("category", "CodeableConcept",
5679            "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
5680            category);
5681      case 1957227299:
5682        /* productOrService */ return new Property("productOrService", "CodeableConcept",
5683            "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.",
5684            0, 1, productOrService);
5685      case -615513385:
5686        /* modifier */ return new Property("modifier", "CodeableConcept",
5687            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
5688            java.lang.Integer.MAX_VALUE, modifier);
5689      case 1010065041:
5690        /* programCode */ return new Property("programCode", "CodeableConcept",
5691            "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
5692      case -1927922223:
5693        /* serviced[x] */ return new Property("serviced[x]", "date|Period",
5694            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5695      case 1379209295:
5696        /* serviced */ return new Property("serviced[x]", "date|Period",
5697            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5698      case 363246749:
5699        /* servicedDate */ return new Property("serviced[x]", "date|Period",
5700            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5701      case 1534966512:
5702        /* servicedPeriod */ return new Property("serviced[x]", "date|Period",
5703            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5704      case 552316075:
5705        /* location[x] */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5706            "Where the product or service was provided.", 0, 1, location);
5707      case 1901043637:
5708        /* location */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5709            "Where the product or service was provided.", 0, 1, location);
5710      case -1224800468:
5711        /* locationCodeableConcept */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5712            "Where the product or service was provided.", 0, 1, location);
5713      case -1280020865:
5714        /* locationAddress */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5715            "Where the product or service was provided.", 0, 1, location);
5716      case 755866390:
5717        /* locationReference */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5718            "Where the product or service was provided.", 0, 1, location);
5719      case -1285004149:
5720        /* quantity */ return new Property("quantity", "SimpleQuantity",
5721            "The number of repetitions of a service or product.", 0, 1, quantity);
5722      case -486196699:
5723        /* unitPrice */ return new Property("unitPrice", "Money",
5724            "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.",
5725            0, 1, unitPrice);
5726      case -1282148017:
5727        /* factor */ return new Property("factor", "decimal",
5728            "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.",
5729            0, 1, factor);
5730      case 108957:
5731        /* net */ return new Property("net", "Money",
5732            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
5733      case 115642:
5734        /* udi */ return new Property("udi", "Reference(Device)",
5735            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
5736      case 1702620169:
5737        /* bodySite */ return new Property("bodySite", "CodeableConcept",
5738            "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
5739      case -1868566105:
5740        /* subSite */ return new Property("subSite", "CodeableConcept",
5741            "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0,
5742            java.lang.Integer.MAX_VALUE, subSite);
5743      case 1524132147:
5744        /* encounter */ return new Property("encounter", "Reference(Encounter)",
5745            "A billed item may include goods or services provided in multiple encounters.", 0,
5746            java.lang.Integer.MAX_VALUE, encounter);
5747      case -1110033957:
5748        /* noteNumber */ return new Property("noteNumber", "positiveInt",
5749            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
5750            java.lang.Integer.MAX_VALUE, noteNumber);
5751      case -231349275:
5752        /* adjudication */ return new Property("adjudication", "",
5753            "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.",
5754            0, java.lang.Integer.MAX_VALUE, adjudication);
5755      case -1335224239:
5756        /* detail */ return new Property("detail", "", "Second-tier of goods and services.", 0,
5757            java.lang.Integer.MAX_VALUE, detail);
5758      default:
5759        return super.getNamedProperty(_hash, _name, _checkValid);
5760      }
5761
5762    }
5763
5764    @Override
5765    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5766      switch (hash) {
5767      case 1349547969:
5768        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
5769      case 1070083823:
5770        /* careTeamSequence */ return this.careTeamSequence == null ? new Base[0]
5771            : this.careTeamSequence.toArray(new Base[this.careTeamSequence.size()]); // PositiveIntType
5772      case -909769262:
5773        /* diagnosisSequence */ return this.diagnosisSequence == null ? new Base[0]
5774            : this.diagnosisSequence.toArray(new Base[this.diagnosisSequence.size()]); // PositiveIntType
5775      case -808920140:
5776        /* procedureSequence */ return this.procedureSequence == null ? new Base[0]
5777            : this.procedureSequence.toArray(new Base[this.procedureSequence.size()]); // PositiveIntType
5778      case -702585587:
5779        /* informationSequence */ return this.informationSequence == null ? new Base[0]
5780            : this.informationSequence.toArray(new Base[this.informationSequence.size()]); // PositiveIntType
5781      case 1099842588:
5782        /* revenue */ return this.revenue == null ? new Base[0] : new Base[] { this.revenue }; // CodeableConcept
5783      case 50511102:
5784        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
5785      case 1957227299:
5786        /* productOrService */ return this.productOrService == null ? new Base[0]
5787            : new Base[] { this.productOrService }; // CodeableConcept
5788      case -615513385:
5789        /* modifier */ return this.modifier == null ? new Base[0]
5790            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
5791      case 1010065041:
5792        /* programCode */ return this.programCode == null ? new Base[0]
5793            : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
5794      case 1379209295:
5795        /* serviced */ return this.serviced == null ? new Base[0] : new Base[] { this.serviced }; // Type
5796      case 1901043637:
5797        /* location */ return this.location == null ? new Base[0] : new Base[] { this.location }; // Type
5798      case -1285004149:
5799        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
5800      case -486196699:
5801        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
5802      case -1282148017:
5803        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
5804      case 108957:
5805        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
5806      case 115642:
5807        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
5808      case 1702620169:
5809        /* bodySite */ return this.bodySite == null ? new Base[0] : new Base[] { this.bodySite }; // CodeableConcept
5810      case -1868566105:
5811        /* subSite */ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
5812      case 1524132147:
5813        /* encounter */ return this.encounter == null ? new Base[0]
5814            : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
5815      case -1110033957:
5816        /* noteNumber */ return this.noteNumber == null ? new Base[0]
5817            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
5818      case -231349275:
5819        /* adjudication */ return this.adjudication == null ? new Base[0]
5820            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
5821      case -1335224239:
5822        /* detail */ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
5823      default:
5824        return super.getProperty(hash, name, checkValid);
5825      }
5826
5827    }
5828
5829    @Override
5830    public Base setProperty(int hash, String name, Base value) throws FHIRException {
5831      switch (hash) {
5832      case 1349547969: // sequence
5833        this.sequence = castToPositiveInt(value); // PositiveIntType
5834        return value;
5835      case 1070083823: // careTeamSequence
5836        this.getCareTeamSequence().add(castToPositiveInt(value)); // PositiveIntType
5837        return value;
5838      case -909769262: // diagnosisSequence
5839        this.getDiagnosisSequence().add(castToPositiveInt(value)); // PositiveIntType
5840        return value;
5841      case -808920140: // procedureSequence
5842        this.getProcedureSequence().add(castToPositiveInt(value)); // PositiveIntType
5843        return value;
5844      case -702585587: // informationSequence
5845        this.getInformationSequence().add(castToPositiveInt(value)); // PositiveIntType
5846        return value;
5847      case 1099842588: // revenue
5848        this.revenue = castToCodeableConcept(value); // CodeableConcept
5849        return value;
5850      case 50511102: // category
5851        this.category = castToCodeableConcept(value); // CodeableConcept
5852        return value;
5853      case 1957227299: // productOrService
5854        this.productOrService = castToCodeableConcept(value); // CodeableConcept
5855        return value;
5856      case -615513385: // modifier
5857        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
5858        return value;
5859      case 1010065041: // programCode
5860        this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
5861        return value;
5862      case 1379209295: // serviced
5863        this.serviced = castToType(value); // Type
5864        return value;
5865      case 1901043637: // location
5866        this.location = castToType(value); // Type
5867        return value;
5868      case -1285004149: // quantity
5869        this.quantity = castToQuantity(value); // Quantity
5870        return value;
5871      case -486196699: // unitPrice
5872        this.unitPrice = castToMoney(value); // Money
5873        return value;
5874      case -1282148017: // factor
5875        this.factor = castToDecimal(value); // DecimalType
5876        return value;
5877      case 108957: // net
5878        this.net = castToMoney(value); // Money
5879        return value;
5880      case 115642: // udi
5881        this.getUdi().add(castToReference(value)); // Reference
5882        return value;
5883      case 1702620169: // bodySite
5884        this.bodySite = castToCodeableConcept(value); // CodeableConcept
5885        return value;
5886      case -1868566105: // subSite
5887        this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
5888        return value;
5889      case 1524132147: // encounter
5890        this.getEncounter().add(castToReference(value)); // Reference
5891        return value;
5892      case -1110033957: // noteNumber
5893        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
5894        return value;
5895      case -231349275: // adjudication
5896        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
5897        return value;
5898      case -1335224239: // detail
5899        this.getDetail().add((DetailComponent) value); // DetailComponent
5900        return value;
5901      default:
5902        return super.setProperty(hash, name, value);
5903      }
5904
5905    }
5906
5907    @Override
5908    public Base setProperty(String name, Base value) throws FHIRException {
5909      if (name.equals("sequence")) {
5910        this.sequence = castToPositiveInt(value); // PositiveIntType
5911      } else if (name.equals("careTeamSequence")) {
5912        this.getCareTeamSequence().add(castToPositiveInt(value));
5913      } else if (name.equals("diagnosisSequence")) {
5914        this.getDiagnosisSequence().add(castToPositiveInt(value));
5915      } else if (name.equals("procedureSequence")) {
5916        this.getProcedureSequence().add(castToPositiveInt(value));
5917      } else if (name.equals("informationSequence")) {
5918        this.getInformationSequence().add(castToPositiveInt(value));
5919      } else if (name.equals("revenue")) {
5920        this.revenue = castToCodeableConcept(value); // CodeableConcept
5921      } else if (name.equals("category")) {
5922        this.category = castToCodeableConcept(value); // CodeableConcept
5923      } else if (name.equals("productOrService")) {
5924        this.productOrService = castToCodeableConcept(value); // CodeableConcept
5925      } else if (name.equals("modifier")) {
5926        this.getModifier().add(castToCodeableConcept(value));
5927      } else if (name.equals("programCode")) {
5928        this.getProgramCode().add(castToCodeableConcept(value));
5929      } else if (name.equals("serviced[x]")) {
5930        this.serviced = castToType(value); // Type
5931      } else if (name.equals("location[x]")) {
5932        this.location = castToType(value); // Type
5933      } else if (name.equals("quantity")) {
5934        this.quantity = castToQuantity(value); // Quantity
5935      } else if (name.equals("unitPrice")) {
5936        this.unitPrice = castToMoney(value); // Money
5937      } else if (name.equals("factor")) {
5938        this.factor = castToDecimal(value); // DecimalType
5939      } else if (name.equals("net")) {
5940        this.net = castToMoney(value); // Money
5941      } else if (name.equals("udi")) {
5942        this.getUdi().add(castToReference(value));
5943      } else if (name.equals("bodySite")) {
5944        this.bodySite = castToCodeableConcept(value); // CodeableConcept
5945      } else if (name.equals("subSite")) {
5946        this.getSubSite().add(castToCodeableConcept(value));
5947      } else if (name.equals("encounter")) {
5948        this.getEncounter().add(castToReference(value));
5949      } else if (name.equals("noteNumber")) {
5950        this.getNoteNumber().add(castToPositiveInt(value));
5951      } else if (name.equals("adjudication")) {
5952        this.getAdjudication().add((AdjudicationComponent) value);
5953      } else if (name.equals("detail")) {
5954        this.getDetail().add((DetailComponent) value);
5955      } else
5956        return super.setProperty(name, value);
5957      return value;
5958    }
5959
5960  @Override
5961  public void removeChild(String name, Base value) throws FHIRException {
5962      if (name.equals("sequence")) {
5963        this.sequence = null;
5964      } else if (name.equals("careTeamSequence")) {
5965        this.getCareTeamSequence().remove(castToPositiveInt(value));
5966      } else if (name.equals("diagnosisSequence")) {
5967        this.getDiagnosisSequence().remove(castToPositiveInt(value));
5968      } else if (name.equals("procedureSequence")) {
5969        this.getProcedureSequence().remove(castToPositiveInt(value));
5970      } else if (name.equals("informationSequence")) {
5971        this.getInformationSequence().remove(castToPositiveInt(value));
5972      } else if (name.equals("revenue")) {
5973        this.revenue = null;
5974      } else if (name.equals("category")) {
5975        this.category = null;
5976      } else if (name.equals("productOrService")) {
5977        this.productOrService = null;
5978      } else if (name.equals("modifier")) {
5979        this.getModifier().remove(castToCodeableConcept(value));
5980      } else if (name.equals("programCode")) {
5981        this.getProgramCode().remove(castToCodeableConcept(value));
5982      } else if (name.equals("serviced[x]")) {
5983        this.serviced = null;
5984      } else if (name.equals("location[x]")) {
5985        this.location = null;
5986      } else if (name.equals("quantity")) {
5987        this.quantity = null;
5988      } else if (name.equals("unitPrice")) {
5989        this.unitPrice = null;
5990      } else if (name.equals("factor")) {
5991        this.factor = null;
5992      } else if (name.equals("net")) {
5993        this.net = null;
5994      } else if (name.equals("udi")) {
5995        this.getUdi().remove(castToReference(value));
5996      } else if (name.equals("bodySite")) {
5997        this.bodySite = null;
5998      } else if (name.equals("subSite")) {
5999        this.getSubSite().remove(castToCodeableConcept(value));
6000      } else if (name.equals("encounter")) {
6001        this.getEncounter().remove(castToReference(value));
6002      } else if (name.equals("noteNumber")) {
6003        this.getNoteNumber().remove(castToPositiveInt(value));
6004      } else if (name.equals("adjudication")) {
6005        this.getAdjudication().remove((AdjudicationComponent) value);
6006      } else if (name.equals("detail")) {
6007        this.getDetail().remove((DetailComponent) value);
6008      } else
6009        super.removeChild(name, value);
6010      
6011    }
6012
6013    @Override
6014    public Base makeProperty(int hash, String name) throws FHIRException {
6015      switch (hash) {
6016      case 1349547969:
6017        return getSequenceElement();
6018      case 1070083823:
6019        return addCareTeamSequenceElement();
6020      case -909769262:
6021        return addDiagnosisSequenceElement();
6022      case -808920140:
6023        return addProcedureSequenceElement();
6024      case -702585587:
6025        return addInformationSequenceElement();
6026      case 1099842588:
6027        return getRevenue();
6028      case 50511102:
6029        return getCategory();
6030      case 1957227299:
6031        return getProductOrService();
6032      case -615513385:
6033        return addModifier();
6034      case 1010065041:
6035        return addProgramCode();
6036      case -1927922223:
6037        return getServiced();
6038      case 1379209295:
6039        return getServiced();
6040      case 552316075:
6041        return getLocation();
6042      case 1901043637:
6043        return getLocation();
6044      case -1285004149:
6045        return getQuantity();
6046      case -486196699:
6047        return getUnitPrice();
6048      case -1282148017:
6049        return getFactorElement();
6050      case 108957:
6051        return getNet();
6052      case 115642:
6053        return addUdi();
6054      case 1702620169:
6055        return getBodySite();
6056      case -1868566105:
6057        return addSubSite();
6058      case 1524132147:
6059        return addEncounter();
6060      case -1110033957:
6061        return addNoteNumberElement();
6062      case -231349275:
6063        return addAdjudication();
6064      case -1335224239:
6065        return addDetail();
6066      default:
6067        return super.makeProperty(hash, name);
6068      }
6069
6070    }
6071
6072    @Override
6073    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6074      switch (hash) {
6075      case 1349547969:
6076        /* sequence */ return new String[] { "positiveInt" };
6077      case 1070083823:
6078        /* careTeamSequence */ return new String[] { "positiveInt" };
6079      case -909769262:
6080        /* diagnosisSequence */ return new String[] { "positiveInt" };
6081      case -808920140:
6082        /* procedureSequence */ return new String[] { "positiveInt" };
6083      case -702585587:
6084        /* informationSequence */ return new String[] { "positiveInt" };
6085      case 1099842588:
6086        /* revenue */ return new String[] { "CodeableConcept" };
6087      case 50511102:
6088        /* category */ return new String[] { "CodeableConcept" };
6089      case 1957227299:
6090        /* productOrService */ return new String[] { "CodeableConcept" };
6091      case -615513385:
6092        /* modifier */ return new String[] { "CodeableConcept" };
6093      case 1010065041:
6094        /* programCode */ return new String[] { "CodeableConcept" };
6095      case 1379209295:
6096        /* serviced */ return new String[] { "date", "Period" };
6097      case 1901043637:
6098        /* location */ return new String[] { "CodeableConcept", "Address", "Reference" };
6099      case -1285004149:
6100        /* quantity */ return new String[] { "SimpleQuantity" };
6101      case -486196699:
6102        /* unitPrice */ return new String[] { "Money" };
6103      case -1282148017:
6104        /* factor */ return new String[] { "decimal" };
6105      case 108957:
6106        /* net */ return new String[] { "Money" };
6107      case 115642:
6108        /* udi */ return new String[] { "Reference" };
6109      case 1702620169:
6110        /* bodySite */ return new String[] { "CodeableConcept" };
6111      case -1868566105:
6112        /* subSite */ return new String[] { "CodeableConcept" };
6113      case 1524132147:
6114        /* encounter */ return new String[] { "Reference" };
6115      case -1110033957:
6116        /* noteNumber */ return new String[] { "positiveInt" };
6117      case -231349275:
6118        /* adjudication */ return new String[] {};
6119      case -1335224239:
6120        /* detail */ return new String[] {};
6121      default:
6122        return super.getTypesForProperty(hash, name);
6123      }
6124
6125    }
6126
6127    @Override
6128    public Base addChild(String name) throws FHIRException {
6129      if (name.equals("sequence")) {
6130        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
6131      } else if (name.equals("careTeamSequence")) {
6132        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.careTeamSequence");
6133      } else if (name.equals("diagnosisSequence")) {
6134        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.diagnosisSequence");
6135      } else if (name.equals("procedureSequence")) {
6136        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.procedureSequence");
6137      } else if (name.equals("informationSequence")) {
6138        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.informationSequence");
6139      } else if (name.equals("revenue")) {
6140        this.revenue = new CodeableConcept();
6141        return this.revenue;
6142      } else if (name.equals("category")) {
6143        this.category = new CodeableConcept();
6144        return this.category;
6145      } else if (name.equals("productOrService")) {
6146        this.productOrService = new CodeableConcept();
6147        return this.productOrService;
6148      } else if (name.equals("modifier")) {
6149        return addModifier();
6150      } else if (name.equals("programCode")) {
6151        return addProgramCode();
6152      } else if (name.equals("servicedDate")) {
6153        this.serviced = new DateType();
6154        return this.serviced;
6155      } else if (name.equals("servicedPeriod")) {
6156        this.serviced = new Period();
6157        return this.serviced;
6158      } else if (name.equals("locationCodeableConcept")) {
6159        this.location = new CodeableConcept();
6160        return this.location;
6161      } else if (name.equals("locationAddress")) {
6162        this.location = new Address();
6163        return this.location;
6164      } else if (name.equals("locationReference")) {
6165        this.location = new Reference();
6166        return this.location;
6167      } else if (name.equals("quantity")) {
6168        this.quantity = new Quantity();
6169        return this.quantity;
6170      } else if (name.equals("unitPrice")) {
6171        this.unitPrice = new Money();
6172        return this.unitPrice;
6173      } else if (name.equals("factor")) {
6174        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
6175      } else if (name.equals("net")) {
6176        this.net = new Money();
6177        return this.net;
6178      } else if (name.equals("udi")) {
6179        return addUdi();
6180      } else if (name.equals("bodySite")) {
6181        this.bodySite = new CodeableConcept();
6182        return this.bodySite;
6183      } else if (name.equals("subSite")) {
6184        return addSubSite();
6185      } else if (name.equals("encounter")) {
6186        return addEncounter();
6187      } else if (name.equals("noteNumber")) {
6188        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
6189      } else if (name.equals("adjudication")) {
6190        return addAdjudication();
6191      } else if (name.equals("detail")) {
6192        return addDetail();
6193      } else
6194        return super.addChild(name);
6195    }
6196
6197    public ItemComponent copy() {
6198      ItemComponent dst = new ItemComponent();
6199      copyValues(dst);
6200      return dst;
6201    }
6202
6203    public void copyValues(ItemComponent dst) {
6204      super.copyValues(dst);
6205      dst.sequence = sequence == null ? null : sequence.copy();
6206      if (careTeamSequence != null) {
6207        dst.careTeamSequence = new ArrayList<PositiveIntType>();
6208        for (PositiveIntType i : careTeamSequence)
6209          dst.careTeamSequence.add(i.copy());
6210      }
6211      ;
6212      if (diagnosisSequence != null) {
6213        dst.diagnosisSequence = new ArrayList<PositiveIntType>();
6214        for (PositiveIntType i : diagnosisSequence)
6215          dst.diagnosisSequence.add(i.copy());
6216      }
6217      ;
6218      if (procedureSequence != null) {
6219        dst.procedureSequence = new ArrayList<PositiveIntType>();
6220        for (PositiveIntType i : procedureSequence)
6221          dst.procedureSequence.add(i.copy());
6222      }
6223      ;
6224      if (informationSequence != null) {
6225        dst.informationSequence = new ArrayList<PositiveIntType>();
6226        for (PositiveIntType i : informationSequence)
6227          dst.informationSequence.add(i.copy());
6228      }
6229      ;
6230      dst.revenue = revenue == null ? null : revenue.copy();
6231      dst.category = category == null ? null : category.copy();
6232      dst.productOrService = productOrService == null ? null : productOrService.copy();
6233      if (modifier != null) {
6234        dst.modifier = new ArrayList<CodeableConcept>();
6235        for (CodeableConcept i : modifier)
6236          dst.modifier.add(i.copy());
6237      }
6238      ;
6239      if (programCode != null) {
6240        dst.programCode = new ArrayList<CodeableConcept>();
6241        for (CodeableConcept i : programCode)
6242          dst.programCode.add(i.copy());
6243      }
6244      ;
6245      dst.serviced = serviced == null ? null : serviced.copy();
6246      dst.location = location == null ? null : location.copy();
6247      dst.quantity = quantity == null ? null : quantity.copy();
6248      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6249      dst.factor = factor == null ? null : factor.copy();
6250      dst.net = net == null ? null : net.copy();
6251      if (udi != null) {
6252        dst.udi = new ArrayList<Reference>();
6253        for (Reference i : udi)
6254          dst.udi.add(i.copy());
6255      }
6256      ;
6257      dst.bodySite = bodySite == null ? null : bodySite.copy();
6258      if (subSite != null) {
6259        dst.subSite = new ArrayList<CodeableConcept>();
6260        for (CodeableConcept i : subSite)
6261          dst.subSite.add(i.copy());
6262      }
6263      ;
6264      if (encounter != null) {
6265        dst.encounter = new ArrayList<Reference>();
6266        for (Reference i : encounter)
6267          dst.encounter.add(i.copy());
6268      }
6269      ;
6270      if (noteNumber != null) {
6271        dst.noteNumber = new ArrayList<PositiveIntType>();
6272        for (PositiveIntType i : noteNumber)
6273          dst.noteNumber.add(i.copy());
6274      }
6275      ;
6276      if (adjudication != null) {
6277        dst.adjudication = new ArrayList<AdjudicationComponent>();
6278        for (AdjudicationComponent i : adjudication)
6279          dst.adjudication.add(i.copy());
6280      }
6281      ;
6282      if (detail != null) {
6283        dst.detail = new ArrayList<DetailComponent>();
6284        for (DetailComponent i : detail)
6285          dst.detail.add(i.copy());
6286      }
6287      ;
6288    }
6289
6290    @Override
6291    public boolean equalsDeep(Base other_) {
6292      if (!super.equalsDeep(other_))
6293        return false;
6294      if (!(other_ instanceof ItemComponent))
6295        return false;
6296      ItemComponent o = (ItemComponent) other_;
6297      return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamSequence, o.careTeamSequence, true)
6298          && compareDeep(diagnosisSequence, o.diagnosisSequence, true)
6299          && compareDeep(procedureSequence, o.procedureSequence, true)
6300          && compareDeep(informationSequence, o.informationSequence, true) && compareDeep(revenue, o.revenue, true)
6301          && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
6302          && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
6303          && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
6304          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
6305          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
6306          && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true)
6307          && compareDeep(encounter, o.encounter, true) && compareDeep(noteNumber, o.noteNumber, true)
6308          && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true);
6309    }
6310
6311    @Override
6312    public boolean equalsShallow(Base other_) {
6313      if (!super.equalsShallow(other_))
6314        return false;
6315      if (!(other_ instanceof ItemComponent))
6316        return false;
6317      ItemComponent o = (ItemComponent) other_;
6318      return compareValues(sequence, o.sequence, true) && compareValues(careTeamSequence, o.careTeamSequence, true)
6319          && compareValues(diagnosisSequence, o.diagnosisSequence, true)
6320          && compareValues(procedureSequence, o.procedureSequence, true)
6321          && compareValues(informationSequence, o.informationSequence, true) && compareValues(factor, o.factor, true)
6322          && compareValues(noteNumber, o.noteNumber, true);
6323    }
6324
6325    public boolean isEmpty() {
6326      return super.isEmpty()
6327          && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamSequence, diagnosisSequence, procedureSequence,
6328              informationSequence, revenue, category, productOrService, modifier, programCode, serviced, location,
6329              quantity, unitPrice, factor, net, udi, bodySite, subSite, encounter, noteNumber, adjudication, detail);
6330    }
6331
6332    public String fhirType() {
6333      return "ExplanationOfBenefit.item";
6334
6335    }
6336
6337  }
6338
6339  @Block()
6340  public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
6341    /**
6342     * A code to indicate the information type of this adjudication record.
6343     * Information types may include: the value submitted, maximum values or
6344     * percentages allowed or payable under the plan, amounts that the patient is
6345     * responsible for in-aggregate or pertaining to this item, amounts paid by
6346     * other coverages, and the benefit payable for this item.
6347     */
6348    @Child(name = "category", type = {
6349        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
6350    @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.")
6351    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/adjudication")
6352    protected CodeableConcept category;
6353
6354    /**
6355     * A code supporting the understanding of the adjudication result and explaining
6356     * variance from expected amount.
6357     */
6358    @Child(name = "reason", type = {
6359        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
6360    @Description(shortDefinition = "Explanation of adjudication outcome", formalDefinition = "A code supporting the understanding of the adjudication result and explaining variance from expected amount.")
6361    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/adjudication-reason")
6362    protected CodeableConcept reason;
6363
6364    /**
6365     * Monetary amount associated with the category.
6366     */
6367    @Child(name = "amount", type = { Money.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
6368    @Description(shortDefinition = "Monetary amount", formalDefinition = "Monetary amount associated with the category.")
6369    protected Money amount;
6370
6371    /**
6372     * A non-monetary value associated with the category. Mutually exclusive to the
6373     * amount element above.
6374     */
6375    @Child(name = "value", type = { DecimalType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
6376    @Description(shortDefinition = "Non-monitary value", formalDefinition = "A non-monetary value associated with the category. Mutually exclusive to the amount element above.")
6377    protected DecimalType value;
6378
6379    private static final long serialVersionUID = 1559898786L;
6380
6381    /**
6382     * Constructor
6383     */
6384    public AdjudicationComponent() {
6385      super();
6386    }
6387
6388    /**
6389     * Constructor
6390     */
6391    public AdjudicationComponent(CodeableConcept category) {
6392      super();
6393      this.category = category;
6394    }
6395
6396    /**
6397     * @return {@link #category} (A code to indicate the information type of this
6398     *         adjudication record. Information types may include: the value
6399     *         submitted, maximum values or percentages allowed or payable under the
6400     *         plan, amounts that the patient is responsible for in-aggregate or
6401     *         pertaining to this item, amounts paid by other coverages, and the
6402     *         benefit payable for this item.)
6403     */
6404    public CodeableConcept getCategory() {
6405      if (this.category == null)
6406        if (Configuration.errorOnAutoCreate())
6407          throw new Error("Attempt to auto-create AdjudicationComponent.category");
6408        else if (Configuration.doAutoCreate())
6409          this.category = new CodeableConcept(); // cc
6410      return this.category;
6411    }
6412
6413    public boolean hasCategory() {
6414      return this.category != null && !this.category.isEmpty();
6415    }
6416
6417    /**
6418     * @param value {@link #category} (A code to indicate the information type of
6419     *              this adjudication record. Information types may include: the
6420     *              value submitted, maximum values or percentages allowed or
6421     *              payable under the plan, amounts that the patient is responsible
6422     *              for in-aggregate or pertaining to this item, amounts paid by
6423     *              other coverages, and the benefit payable for this item.)
6424     */
6425    public AdjudicationComponent setCategory(CodeableConcept value) {
6426      this.category = value;
6427      return this;
6428    }
6429
6430    /**
6431     * @return {@link #reason} (A code supporting the understanding of the
6432     *         adjudication result and explaining variance from expected amount.)
6433     */
6434    public CodeableConcept getReason() {
6435      if (this.reason == null)
6436        if (Configuration.errorOnAutoCreate())
6437          throw new Error("Attempt to auto-create AdjudicationComponent.reason");
6438        else if (Configuration.doAutoCreate())
6439          this.reason = new CodeableConcept(); // cc
6440      return this.reason;
6441    }
6442
6443    public boolean hasReason() {
6444      return this.reason != null && !this.reason.isEmpty();
6445    }
6446
6447    /**
6448     * @param value {@link #reason} (A code supporting the understanding of the
6449     *              adjudication result and explaining variance from expected
6450     *              amount.)
6451     */
6452    public AdjudicationComponent setReason(CodeableConcept value) {
6453      this.reason = value;
6454      return this;
6455    }
6456
6457    /**
6458     * @return {@link #amount} (Monetary amount associated with the category.)
6459     */
6460    public Money getAmount() {
6461      if (this.amount == null)
6462        if (Configuration.errorOnAutoCreate())
6463          throw new Error("Attempt to auto-create AdjudicationComponent.amount");
6464        else if (Configuration.doAutoCreate())
6465          this.amount = new Money(); // cc
6466      return this.amount;
6467    }
6468
6469    public boolean hasAmount() {
6470      return this.amount != null && !this.amount.isEmpty();
6471    }
6472
6473    /**
6474     * @param value {@link #amount} (Monetary amount associated with the category.)
6475     */
6476    public AdjudicationComponent setAmount(Money value) {
6477      this.amount = value;
6478      return this;
6479    }
6480
6481    /**
6482     * @return {@link #value} (A non-monetary value associated with the category.
6483     *         Mutually exclusive to the amount element above.). This is the
6484     *         underlying object with id, value and extensions. The accessor
6485     *         "getValue" gives direct access to the value
6486     */
6487    public DecimalType getValueElement() {
6488      if (this.value == null)
6489        if (Configuration.errorOnAutoCreate())
6490          throw new Error("Attempt to auto-create AdjudicationComponent.value");
6491        else if (Configuration.doAutoCreate())
6492          this.value = new DecimalType(); // bb
6493      return this.value;
6494    }
6495
6496    public boolean hasValueElement() {
6497      return this.value != null && !this.value.isEmpty();
6498    }
6499
6500    public boolean hasValue() {
6501      return this.value != null && !this.value.isEmpty();
6502    }
6503
6504    /**
6505     * @param value {@link #value} (A non-monetary value associated with the
6506     *              category. Mutually exclusive to the amount element above.). This
6507     *              is the underlying object with id, value and extensions. The
6508     *              accessor "getValue" gives direct access to the value
6509     */
6510    public AdjudicationComponent setValueElement(DecimalType value) {
6511      this.value = value;
6512      return this;
6513    }
6514
6515    /**
6516     * @return A non-monetary value associated with the category. Mutually exclusive
6517     *         to the amount element above.
6518     */
6519    public BigDecimal getValue() {
6520      return this.value == null ? null : this.value.getValue();
6521    }
6522
6523    /**
6524     * @param value A non-monetary value associated with the category. Mutually
6525     *              exclusive to the amount element above.
6526     */
6527    public AdjudicationComponent setValue(BigDecimal value) {
6528      if (value == null)
6529        this.value = null;
6530      else {
6531        if (this.value == null)
6532          this.value = new DecimalType();
6533        this.value.setValue(value);
6534      }
6535      return this;
6536    }
6537
6538    /**
6539     * @param value A non-monetary value associated with the category. Mutually
6540     *              exclusive to the amount element above.
6541     */
6542    public AdjudicationComponent setValue(long value) {
6543      this.value = new DecimalType();
6544      this.value.setValue(value);
6545      return this;
6546    }
6547
6548    /**
6549     * @param value A non-monetary value associated with the category. Mutually
6550     *              exclusive to the amount element above.
6551     */
6552    public AdjudicationComponent setValue(double value) {
6553      this.value = new DecimalType();
6554      this.value.setValue(value);
6555      return this;
6556    }
6557
6558    protected void listChildren(List<Property> children) {
6559      super.listChildren(children);
6560      children.add(new Property("category", "CodeableConcept",
6561          "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.",
6562          0, 1, category));
6563      children.add(new Property("reason", "CodeableConcept",
6564          "A code supporting the understanding of the adjudication result and explaining variance from expected amount.",
6565          0, 1, reason));
6566      children.add(new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount));
6567      children.add(new Property("value", "decimal",
6568          "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1,
6569          value));
6570    }
6571
6572    @Override
6573    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6574      switch (_hash) {
6575      case 50511102:
6576        /* category */ return new Property("category", "CodeableConcept",
6577            "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.",
6578            0, 1, category);
6579      case -934964668:
6580        /* reason */ return new Property("reason", "CodeableConcept",
6581            "A code supporting the understanding of the adjudication result and explaining variance from expected amount.",
6582            0, 1, reason);
6583      case -1413853096:
6584        /* amount */ return new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1,
6585            amount);
6586      case 111972721:
6587        /* value */ return new Property("value", "decimal",
6588            "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1,
6589            value);
6590      default:
6591        return super.getNamedProperty(_hash, _name, _checkValid);
6592      }
6593
6594    }
6595
6596    @Override
6597    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6598      switch (hash) {
6599      case 50511102:
6600        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
6601      case -934964668:
6602        /* reason */ return this.reason == null ? new Base[0] : new Base[] { this.reason }; // CodeableConcept
6603      case -1413853096:
6604        /* amount */ return this.amount == null ? new Base[0] : new Base[] { this.amount }; // Money
6605      case 111972721:
6606        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // DecimalType
6607      default:
6608        return super.getProperty(hash, name, checkValid);
6609      }
6610
6611    }
6612
6613    @Override
6614    public Base setProperty(int hash, String name, Base value) throws FHIRException {
6615      switch (hash) {
6616      case 50511102: // category
6617        this.category = castToCodeableConcept(value); // CodeableConcept
6618        return value;
6619      case -934964668: // reason
6620        this.reason = castToCodeableConcept(value); // CodeableConcept
6621        return value;
6622      case -1413853096: // amount
6623        this.amount = castToMoney(value); // Money
6624        return value;
6625      case 111972721: // value
6626        this.value = castToDecimal(value); // DecimalType
6627        return value;
6628      default:
6629        return super.setProperty(hash, name, value);
6630      }
6631
6632    }
6633
6634    @Override
6635    public Base setProperty(String name, Base value) throws FHIRException {
6636      if (name.equals("category")) {
6637        this.category = castToCodeableConcept(value); // CodeableConcept
6638      } else if (name.equals("reason")) {
6639        this.reason = castToCodeableConcept(value); // CodeableConcept
6640      } else if (name.equals("amount")) {
6641        this.amount = castToMoney(value); // Money
6642      } else if (name.equals("value")) {
6643        this.value = castToDecimal(value); // DecimalType
6644      } else
6645        return super.setProperty(name, value);
6646      return value;
6647    }
6648
6649  @Override
6650  public void removeChild(String name, Base value) throws FHIRException {
6651      if (name.equals("category")) {
6652        this.category = null;
6653      } else if (name.equals("reason")) {
6654        this.reason = null;
6655      } else if (name.equals("amount")) {
6656        this.amount = null;
6657      } else if (name.equals("value")) {
6658        this.value = null;
6659      } else
6660        super.removeChild(name, value);
6661      
6662    }
6663
6664    @Override
6665    public Base makeProperty(int hash, String name) throws FHIRException {
6666      switch (hash) {
6667      case 50511102:
6668        return getCategory();
6669      case -934964668:
6670        return getReason();
6671      case -1413853096:
6672        return getAmount();
6673      case 111972721:
6674        return getValueElement();
6675      default:
6676        return super.makeProperty(hash, name);
6677      }
6678
6679    }
6680
6681    @Override
6682    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6683      switch (hash) {
6684      case 50511102:
6685        /* category */ return new String[] { "CodeableConcept" };
6686      case -934964668:
6687        /* reason */ return new String[] { "CodeableConcept" };
6688      case -1413853096:
6689        /* amount */ return new String[] { "Money" };
6690      case 111972721:
6691        /* value */ return new String[] { "decimal" };
6692      default:
6693        return super.getTypesForProperty(hash, name);
6694      }
6695
6696    }
6697
6698    @Override
6699    public Base addChild(String name) throws FHIRException {
6700      if (name.equals("category")) {
6701        this.category = new CodeableConcept();
6702        return this.category;
6703      } else if (name.equals("reason")) {
6704        this.reason = new CodeableConcept();
6705        return this.reason;
6706      } else if (name.equals("amount")) {
6707        this.amount = new Money();
6708        return this.amount;
6709      } else if (name.equals("value")) {
6710        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.value");
6711      } else
6712        return super.addChild(name);
6713    }
6714
6715    public AdjudicationComponent copy() {
6716      AdjudicationComponent dst = new AdjudicationComponent();
6717      copyValues(dst);
6718      return dst;
6719    }
6720
6721    public void copyValues(AdjudicationComponent dst) {
6722      super.copyValues(dst);
6723      dst.category = category == null ? null : category.copy();
6724      dst.reason = reason == null ? null : reason.copy();
6725      dst.amount = amount == null ? null : amount.copy();
6726      dst.value = value == null ? null : value.copy();
6727    }
6728
6729    @Override
6730    public boolean equalsDeep(Base other_) {
6731      if (!super.equalsDeep(other_))
6732        return false;
6733      if (!(other_ instanceof AdjudicationComponent))
6734        return false;
6735      AdjudicationComponent o = (AdjudicationComponent) other_;
6736      return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true)
6737          && compareDeep(amount, o.amount, true) && compareDeep(value, o.value, true);
6738    }
6739
6740    @Override
6741    public boolean equalsShallow(Base other_) {
6742      if (!super.equalsShallow(other_))
6743        return false;
6744      if (!(other_ instanceof AdjudicationComponent))
6745        return false;
6746      AdjudicationComponent o = (AdjudicationComponent) other_;
6747      return compareValues(value, o.value, true);
6748    }
6749
6750    public boolean isEmpty() {
6751      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount, value);
6752    }
6753
6754    public String fhirType() {
6755      return "ExplanationOfBenefit.item.adjudication";
6756
6757    }
6758
6759  }
6760
6761  @Block()
6762  public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
6763    /**
6764     * A claim detail line. Either a simple (a product or service) or a 'group' of
6765     * sub-details which are simple items.
6766     */
6767    @Child(name = "sequence", type = {
6768        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
6769    @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.")
6770    protected PositiveIntType sequence;
6771
6772    /**
6773     * The type of revenue or cost center providing the product and/or service.
6774     */
6775    @Child(name = "revenue", type = {
6776        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
6777    @Description(shortDefinition = "Revenue or cost center code", formalDefinition = "The type of revenue or cost center providing the product and/or service.")
6778    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-revenue-center")
6779    protected CodeableConcept revenue;
6780
6781    /**
6782     * Code to identify the general type of benefits under which products and
6783     * services are provided.
6784     */
6785    @Child(name = "category", type = {
6786        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
6787    @Description(shortDefinition = "Benefit classification", formalDefinition = "Code to identify the general type of benefits under which products and services are provided.")
6788    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-benefitcategory")
6789    protected CodeableConcept category;
6790
6791    /**
6792     * When the value is a group code then this item collects a set of related claim
6793     * details, otherwise this contains the product, service, drug or other billing
6794     * code for the item.
6795     */
6796    @Child(name = "productOrService", type = {
6797        CodeableConcept.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
6798    @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.")
6799    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
6800    protected CodeableConcept productOrService;
6801
6802    /**
6803     * Item typification or modifiers codes to convey additional context for the
6804     * product or service.
6805     */
6806    @Child(name = "modifier", type = {
6807        CodeableConcept.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6808    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
6809    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
6810    protected List<CodeableConcept> modifier;
6811
6812    /**
6813     * Identifies the program under which this may be recovered.
6814     */
6815    @Child(name = "programCode", type = {
6816        CodeableConcept.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6817    @Description(shortDefinition = "Program the product or service is provided under", formalDefinition = "Identifies the program under which this may be recovered.")
6818    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-program-code")
6819    protected List<CodeableConcept> programCode;
6820
6821    /**
6822     * The number of repetitions of a service or product.
6823     */
6824    @Child(name = "quantity", type = { Quantity.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
6825    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
6826    protected Quantity quantity;
6827
6828    /**
6829     * If the item is not a group then this is the fee for the product or service,
6830     * otherwise this is the total of the fees for the details of the group.
6831     */
6832    @Child(name = "unitPrice", type = { Money.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
6833    @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.")
6834    protected Money unitPrice;
6835
6836    /**
6837     * A real number that represents a multiplier used in determining the overall
6838     * value of services delivered and/or goods received. The concept of a Factor
6839     * allows for a discount or surcharge multiplier to be applied to a monetary
6840     * amount.
6841     */
6842    @Child(name = "factor", type = {
6843        DecimalType.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
6844    @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.")
6845    protected DecimalType factor;
6846
6847    /**
6848     * The quantity times the unit price for an additional service or product or
6849     * charge.
6850     */
6851    @Child(name = "net", type = { Money.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
6852    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
6853    protected Money net;
6854
6855    /**
6856     * Unique Device Identifiers associated with this line item.
6857     */
6858    @Child(name = "udi", type = {
6859        Device.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6860    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
6861    protected List<Reference> udi;
6862    /**
6863     * The actual objects that are the target of the reference (Unique Device
6864     * Identifiers associated with this line item.)
6865     */
6866    protected List<Device> udiTarget;
6867
6868    /**
6869     * The numbers associated with notes below which apply to the adjudication of
6870     * this item.
6871     */
6872    @Child(name = "noteNumber", type = {
6873        PositiveIntType.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6874    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
6875    protected List<PositiveIntType> noteNumber;
6876
6877    /**
6878     * The adjudication results.
6879     */
6880    @Child(name = "adjudication", type = {
6881        AdjudicationComponent.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6882    @Description(shortDefinition = "Detail level adjudication details", formalDefinition = "The adjudication results.")
6883    protected List<AdjudicationComponent> adjudication;
6884
6885    /**
6886     * Third-tier of goods and services.
6887     */
6888    @Child(name = "subDetail", type = {}, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6889    @Description(shortDefinition = "Additional items", formalDefinition = "Third-tier of goods and services.")
6890    protected List<SubDetailComponent> subDetail;
6891
6892    private static final long serialVersionUID = 225639798L;
6893
6894    /**
6895     * Constructor
6896     */
6897    public DetailComponent() {
6898      super();
6899    }
6900
6901    /**
6902     * Constructor
6903     */
6904    public DetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
6905      super();
6906      this.sequence = sequence;
6907      this.productOrService = productOrService;
6908    }
6909
6910    /**
6911     * @return {@link #sequence} (A claim detail line. Either a simple (a product or
6912     *         service) or a 'group' of sub-details which are simple items.). This
6913     *         is the underlying object with id, value and extensions. The accessor
6914     *         "getSequence" gives direct access to the value
6915     */
6916    public PositiveIntType getSequenceElement() {
6917      if (this.sequence == null)
6918        if (Configuration.errorOnAutoCreate())
6919          throw new Error("Attempt to auto-create DetailComponent.sequence");
6920        else if (Configuration.doAutoCreate())
6921          this.sequence = new PositiveIntType(); // bb
6922      return this.sequence;
6923    }
6924
6925    public boolean hasSequenceElement() {
6926      return this.sequence != null && !this.sequence.isEmpty();
6927    }
6928
6929    public boolean hasSequence() {
6930      return this.sequence != null && !this.sequence.isEmpty();
6931    }
6932
6933    /**
6934     * @param value {@link #sequence} (A claim detail line. Either a simple (a
6935     *              product or service) or a 'group' of sub-details which are simple
6936     *              items.). This is the underlying object with id, value and
6937     *              extensions. The accessor "getSequence" gives direct access to
6938     *              the value
6939     */
6940    public DetailComponent setSequenceElement(PositiveIntType value) {
6941      this.sequence = value;
6942      return this;
6943    }
6944
6945    /**
6946     * @return A claim detail line. Either a simple (a product or service) or a
6947     *         'group' of sub-details which are simple items.
6948     */
6949    public int getSequence() {
6950      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
6951    }
6952
6953    /**
6954     * @param value A claim detail line. Either a simple (a product or service) or a
6955     *              'group' of sub-details which are simple items.
6956     */
6957    public DetailComponent setSequence(int value) {
6958      if (this.sequence == null)
6959        this.sequence = new PositiveIntType();
6960      this.sequence.setValue(value);
6961      return this;
6962    }
6963
6964    /**
6965     * @return {@link #revenue} (The type of revenue or cost center providing the
6966     *         product and/or service.)
6967     */
6968    public CodeableConcept getRevenue() {
6969      if (this.revenue == null)
6970        if (Configuration.errorOnAutoCreate())
6971          throw new Error("Attempt to auto-create DetailComponent.revenue");
6972        else if (Configuration.doAutoCreate())
6973          this.revenue = new CodeableConcept(); // cc
6974      return this.revenue;
6975    }
6976
6977    public boolean hasRevenue() {
6978      return this.revenue != null && !this.revenue.isEmpty();
6979    }
6980
6981    /**
6982     * @param value {@link #revenue} (The type of revenue or cost center providing
6983     *              the product and/or service.)
6984     */
6985    public DetailComponent setRevenue(CodeableConcept value) {
6986      this.revenue = value;
6987      return this;
6988    }
6989
6990    /**
6991     * @return {@link #category} (Code to identify the general type of benefits
6992     *         under which products and services are provided.)
6993     */
6994    public CodeableConcept getCategory() {
6995      if (this.category == null)
6996        if (Configuration.errorOnAutoCreate())
6997          throw new Error("Attempt to auto-create DetailComponent.category");
6998        else if (Configuration.doAutoCreate())
6999          this.category = new CodeableConcept(); // cc
7000      return this.category;
7001    }
7002
7003    public boolean hasCategory() {
7004      return this.category != null && !this.category.isEmpty();
7005    }
7006
7007    /**
7008     * @param value {@link #category} (Code to identify the general type of benefits
7009     *              under which products and services are provided.)
7010     */
7011    public DetailComponent setCategory(CodeableConcept value) {
7012      this.category = value;
7013      return this;
7014    }
7015
7016    /**
7017     * @return {@link #productOrService} (When the value is a group code then this
7018     *         item collects a set of related claim details, otherwise this contains
7019     *         the product, service, drug or other billing code for the item.)
7020     */
7021    public CodeableConcept getProductOrService() {
7022      if (this.productOrService == null)
7023        if (Configuration.errorOnAutoCreate())
7024          throw new Error("Attempt to auto-create DetailComponent.productOrService");
7025        else if (Configuration.doAutoCreate())
7026          this.productOrService = new CodeableConcept(); // cc
7027      return this.productOrService;
7028    }
7029
7030    public boolean hasProductOrService() {
7031      return this.productOrService != null && !this.productOrService.isEmpty();
7032    }
7033
7034    /**
7035     * @param value {@link #productOrService} (When the value is a group code then
7036     *              this item collects a set of related claim details, otherwise
7037     *              this contains the product, service, drug or other billing code
7038     *              for the item.)
7039     */
7040    public DetailComponent setProductOrService(CodeableConcept value) {
7041      this.productOrService = value;
7042      return this;
7043    }
7044
7045    /**
7046     * @return {@link #modifier} (Item typification or modifiers codes to convey
7047     *         additional context for the product or service.)
7048     */
7049    public List<CodeableConcept> getModifier() {
7050      if (this.modifier == null)
7051        this.modifier = new ArrayList<CodeableConcept>();
7052      return this.modifier;
7053    }
7054
7055    /**
7056     * @return Returns a reference to <code>this</code> for easy method chaining
7057     */
7058    public DetailComponent setModifier(List<CodeableConcept> theModifier) {
7059      this.modifier = theModifier;
7060      return this;
7061    }
7062
7063    public boolean hasModifier() {
7064      if (this.modifier == null)
7065        return false;
7066      for (CodeableConcept item : this.modifier)
7067        if (!item.isEmpty())
7068          return true;
7069      return false;
7070    }
7071
7072    public CodeableConcept addModifier() { // 3
7073      CodeableConcept t = new CodeableConcept();
7074      if (this.modifier == null)
7075        this.modifier = new ArrayList<CodeableConcept>();
7076      this.modifier.add(t);
7077      return t;
7078    }
7079
7080    public DetailComponent addModifier(CodeableConcept t) { // 3
7081      if (t == null)
7082        return this;
7083      if (this.modifier == null)
7084        this.modifier = new ArrayList<CodeableConcept>();
7085      this.modifier.add(t);
7086      return this;
7087    }
7088
7089    /**
7090     * @return The first repetition of repeating field {@link #modifier}, creating
7091     *         it if it does not already exist
7092     */
7093    public CodeableConcept getModifierFirstRep() {
7094      if (getModifier().isEmpty()) {
7095        addModifier();
7096      }
7097      return getModifier().get(0);
7098    }
7099
7100    /**
7101     * @return {@link #programCode} (Identifies the program under which this may be
7102     *         recovered.)
7103     */
7104    public List<CodeableConcept> getProgramCode() {
7105      if (this.programCode == null)
7106        this.programCode = new ArrayList<CodeableConcept>();
7107      return this.programCode;
7108    }
7109
7110    /**
7111     * @return Returns a reference to <code>this</code> for easy method chaining
7112     */
7113    public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) {
7114      this.programCode = theProgramCode;
7115      return this;
7116    }
7117
7118    public boolean hasProgramCode() {
7119      if (this.programCode == null)
7120        return false;
7121      for (CodeableConcept item : this.programCode)
7122        if (!item.isEmpty())
7123          return true;
7124      return false;
7125    }
7126
7127    public CodeableConcept addProgramCode() { // 3
7128      CodeableConcept t = new CodeableConcept();
7129      if (this.programCode == null)
7130        this.programCode = new ArrayList<CodeableConcept>();
7131      this.programCode.add(t);
7132      return t;
7133    }
7134
7135    public DetailComponent addProgramCode(CodeableConcept t) { // 3
7136      if (t == null)
7137        return this;
7138      if (this.programCode == null)
7139        this.programCode = new ArrayList<CodeableConcept>();
7140      this.programCode.add(t);
7141      return this;
7142    }
7143
7144    /**
7145     * @return The first repetition of repeating field {@link #programCode},
7146     *         creating it if it does not already exist
7147     */
7148    public CodeableConcept getProgramCodeFirstRep() {
7149      if (getProgramCode().isEmpty()) {
7150        addProgramCode();
7151      }
7152      return getProgramCode().get(0);
7153    }
7154
7155    /**
7156     * @return {@link #quantity} (The number of repetitions of a service or
7157     *         product.)
7158     */
7159    public Quantity getQuantity() {
7160      if (this.quantity == null)
7161        if (Configuration.errorOnAutoCreate())
7162          throw new Error("Attempt to auto-create DetailComponent.quantity");
7163        else if (Configuration.doAutoCreate())
7164          this.quantity = new Quantity(); // cc
7165      return this.quantity;
7166    }
7167
7168    public boolean hasQuantity() {
7169      return this.quantity != null && !this.quantity.isEmpty();
7170    }
7171
7172    /**
7173     * @param value {@link #quantity} (The number of repetitions of a service or
7174     *              product.)
7175     */
7176    public DetailComponent setQuantity(Quantity value) {
7177      this.quantity = value;
7178      return this;
7179    }
7180
7181    /**
7182     * @return {@link #unitPrice} (If the item is not a group then this is the fee
7183     *         for the product or service, otherwise this is the total of the fees
7184     *         for the details of the group.)
7185     */
7186    public Money getUnitPrice() {
7187      if (this.unitPrice == null)
7188        if (Configuration.errorOnAutoCreate())
7189          throw new Error("Attempt to auto-create DetailComponent.unitPrice");
7190        else if (Configuration.doAutoCreate())
7191          this.unitPrice = new Money(); // cc
7192      return this.unitPrice;
7193    }
7194
7195    public boolean hasUnitPrice() {
7196      return this.unitPrice != null && !this.unitPrice.isEmpty();
7197    }
7198
7199    /**
7200     * @param value {@link #unitPrice} (If the item is not a group then this is the
7201     *              fee for the product or service, otherwise this is the total of
7202     *              the fees for the details of the group.)
7203     */
7204    public DetailComponent setUnitPrice(Money value) {
7205      this.unitPrice = value;
7206      return this;
7207    }
7208
7209    /**
7210     * @return {@link #factor} (A real number that represents a multiplier used in
7211     *         determining the overall value of services delivered and/or goods
7212     *         received. The concept of a Factor allows for a discount or surcharge
7213     *         multiplier to be applied to a monetary amount.). This is the
7214     *         underlying object with id, value and extensions. The accessor
7215     *         "getFactor" gives direct access to the value
7216     */
7217    public DecimalType getFactorElement() {
7218      if (this.factor == null)
7219        if (Configuration.errorOnAutoCreate())
7220          throw new Error("Attempt to auto-create DetailComponent.factor");
7221        else if (Configuration.doAutoCreate())
7222          this.factor = new DecimalType(); // bb
7223      return this.factor;
7224    }
7225
7226    public boolean hasFactorElement() {
7227      return this.factor != null && !this.factor.isEmpty();
7228    }
7229
7230    public boolean hasFactor() {
7231      return this.factor != null && !this.factor.isEmpty();
7232    }
7233
7234    /**
7235     * @param value {@link #factor} (A real number that represents a multiplier used
7236     *              in determining the overall value of services delivered and/or
7237     *              goods received. The concept of a Factor allows for a discount or
7238     *              surcharge multiplier to be applied to a monetary amount.). This
7239     *              is the underlying object with id, value and extensions. The
7240     *              accessor "getFactor" gives direct access to the value
7241     */
7242    public DetailComponent setFactorElement(DecimalType value) {
7243      this.factor = value;
7244      return this;
7245    }
7246
7247    /**
7248     * @return A real number that represents a multiplier used in determining the
7249     *         overall value of services delivered and/or goods received. The
7250     *         concept of a Factor allows for a discount or surcharge multiplier to
7251     *         be applied to a monetary amount.
7252     */
7253    public BigDecimal getFactor() {
7254      return this.factor == null ? null : this.factor.getValue();
7255    }
7256
7257    /**
7258     * @param value A real number that represents a multiplier used in determining
7259     *              the overall value of services delivered and/or goods received.
7260     *              The concept of a Factor allows for a discount or surcharge
7261     *              multiplier to be applied to a monetary amount.
7262     */
7263    public DetailComponent setFactor(BigDecimal value) {
7264      if (value == null)
7265        this.factor = null;
7266      else {
7267        if (this.factor == null)
7268          this.factor = new DecimalType();
7269        this.factor.setValue(value);
7270      }
7271      return this;
7272    }
7273
7274    /**
7275     * @param value A real number that represents a multiplier used in determining
7276     *              the overall value of services delivered and/or goods received.
7277     *              The concept of a Factor allows for a discount or surcharge
7278     *              multiplier to be applied to a monetary amount.
7279     */
7280    public DetailComponent setFactor(long value) {
7281      this.factor = new DecimalType();
7282      this.factor.setValue(value);
7283      return this;
7284    }
7285
7286    /**
7287     * @param value A real number that represents a multiplier used in determining
7288     *              the overall value of services delivered and/or goods received.
7289     *              The concept of a Factor allows for a discount or surcharge
7290     *              multiplier to be applied to a monetary amount.
7291     */
7292    public DetailComponent setFactor(double value) {
7293      this.factor = new DecimalType();
7294      this.factor.setValue(value);
7295      return this;
7296    }
7297
7298    /**
7299     * @return {@link #net} (The quantity times the unit price for an additional
7300     *         service or product or charge.)
7301     */
7302    public Money getNet() {
7303      if (this.net == null)
7304        if (Configuration.errorOnAutoCreate())
7305          throw new Error("Attempt to auto-create DetailComponent.net");
7306        else if (Configuration.doAutoCreate())
7307          this.net = new Money(); // cc
7308      return this.net;
7309    }
7310
7311    public boolean hasNet() {
7312      return this.net != null && !this.net.isEmpty();
7313    }
7314
7315    /**
7316     * @param value {@link #net} (The quantity times the unit price for an
7317     *              additional service or product or charge.)
7318     */
7319    public DetailComponent setNet(Money value) {
7320      this.net = value;
7321      return this;
7322    }
7323
7324    /**
7325     * @return {@link #udi} (Unique Device Identifiers associated with this line
7326     *         item.)
7327     */
7328    public List<Reference> getUdi() {
7329      if (this.udi == null)
7330        this.udi = new ArrayList<Reference>();
7331      return this.udi;
7332    }
7333
7334    /**
7335     * @return Returns a reference to <code>this</code> for easy method chaining
7336     */
7337    public DetailComponent setUdi(List<Reference> theUdi) {
7338      this.udi = theUdi;
7339      return this;
7340    }
7341
7342    public boolean hasUdi() {
7343      if (this.udi == null)
7344        return false;
7345      for (Reference item : this.udi)
7346        if (!item.isEmpty())
7347          return true;
7348      return false;
7349    }
7350
7351    public Reference addUdi() { // 3
7352      Reference t = new Reference();
7353      if (this.udi == null)
7354        this.udi = new ArrayList<Reference>();
7355      this.udi.add(t);
7356      return t;
7357    }
7358
7359    public DetailComponent addUdi(Reference t) { // 3
7360      if (t == null)
7361        return this;
7362      if (this.udi == null)
7363        this.udi = new ArrayList<Reference>();
7364      this.udi.add(t);
7365      return this;
7366    }
7367
7368    /**
7369     * @return The first repetition of repeating field {@link #udi}, creating it if
7370     *         it does not already exist
7371     */
7372    public Reference getUdiFirstRep() {
7373      if (getUdi().isEmpty()) {
7374        addUdi();
7375      }
7376      return getUdi().get(0);
7377    }
7378
7379    /**
7380     * @return {@link #noteNumber} (The numbers associated with notes below which
7381     *         apply to the adjudication of this item.)
7382     */
7383    public List<PositiveIntType> getNoteNumber() {
7384      if (this.noteNumber == null)
7385        this.noteNumber = new ArrayList<PositiveIntType>();
7386      return this.noteNumber;
7387    }
7388
7389    /**
7390     * @return Returns a reference to <code>this</code> for easy method chaining
7391     */
7392    public DetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
7393      this.noteNumber = theNoteNumber;
7394      return this;
7395    }
7396
7397    public boolean hasNoteNumber() {
7398      if (this.noteNumber == null)
7399        return false;
7400      for (PositiveIntType item : this.noteNumber)
7401        if (!item.isEmpty())
7402          return true;
7403      return false;
7404    }
7405
7406    /**
7407     * @return {@link #noteNumber} (The numbers associated with notes below which
7408     *         apply to the adjudication of this item.)
7409     */
7410    public PositiveIntType addNoteNumberElement() {// 2
7411      PositiveIntType t = new PositiveIntType();
7412      if (this.noteNumber == null)
7413        this.noteNumber = new ArrayList<PositiveIntType>();
7414      this.noteNumber.add(t);
7415      return t;
7416    }
7417
7418    /**
7419     * @param value {@link #noteNumber} (The numbers associated with notes below
7420     *              which apply to the adjudication of this item.)
7421     */
7422    public DetailComponent addNoteNumber(int value) { // 1
7423      PositiveIntType t = new PositiveIntType();
7424      t.setValue(value);
7425      if (this.noteNumber == null)
7426        this.noteNumber = new ArrayList<PositiveIntType>();
7427      this.noteNumber.add(t);
7428      return this;
7429    }
7430
7431    /**
7432     * @param value {@link #noteNumber} (The numbers associated with notes below
7433     *              which apply to the adjudication of this item.)
7434     */
7435    public boolean hasNoteNumber(int value) {
7436      if (this.noteNumber == null)
7437        return false;
7438      for (PositiveIntType v : this.noteNumber)
7439        if (v.getValue().equals(value)) // positiveInt
7440          return true;
7441      return false;
7442    }
7443
7444    /**
7445     * @return {@link #adjudication} (The adjudication results.)
7446     */
7447    public List<AdjudicationComponent> getAdjudication() {
7448      if (this.adjudication == null)
7449        this.adjudication = new ArrayList<AdjudicationComponent>();
7450      return this.adjudication;
7451    }
7452
7453    /**
7454     * @return Returns a reference to <code>this</code> for easy method chaining
7455     */
7456    public DetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
7457      this.adjudication = theAdjudication;
7458      return this;
7459    }
7460
7461    public boolean hasAdjudication() {
7462      if (this.adjudication == null)
7463        return false;
7464      for (AdjudicationComponent item : this.adjudication)
7465        if (!item.isEmpty())
7466          return true;
7467      return false;
7468    }
7469
7470    public AdjudicationComponent addAdjudication() { // 3
7471      AdjudicationComponent t = new AdjudicationComponent();
7472      if (this.adjudication == null)
7473        this.adjudication = new ArrayList<AdjudicationComponent>();
7474      this.adjudication.add(t);
7475      return t;
7476    }
7477
7478    public DetailComponent addAdjudication(AdjudicationComponent t) { // 3
7479      if (t == null)
7480        return this;
7481      if (this.adjudication == null)
7482        this.adjudication = new ArrayList<AdjudicationComponent>();
7483      this.adjudication.add(t);
7484      return this;
7485    }
7486
7487    /**
7488     * @return The first repetition of repeating field {@link #adjudication},
7489     *         creating it if it does not already exist
7490     */
7491    public AdjudicationComponent getAdjudicationFirstRep() {
7492      if (getAdjudication().isEmpty()) {
7493        addAdjudication();
7494      }
7495      return getAdjudication().get(0);
7496    }
7497
7498    /**
7499     * @return {@link #subDetail} (Third-tier of goods and services.)
7500     */
7501    public List<SubDetailComponent> getSubDetail() {
7502      if (this.subDetail == null)
7503        this.subDetail = new ArrayList<SubDetailComponent>();
7504      return this.subDetail;
7505    }
7506
7507    /**
7508     * @return Returns a reference to <code>this</code> for easy method chaining
7509     */
7510    public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) {
7511      this.subDetail = theSubDetail;
7512      return this;
7513    }
7514
7515    public boolean hasSubDetail() {
7516      if (this.subDetail == null)
7517        return false;
7518      for (SubDetailComponent item : this.subDetail)
7519        if (!item.isEmpty())
7520          return true;
7521      return false;
7522    }
7523
7524    public SubDetailComponent addSubDetail() { // 3
7525      SubDetailComponent t = new SubDetailComponent();
7526      if (this.subDetail == null)
7527        this.subDetail = new ArrayList<SubDetailComponent>();
7528      this.subDetail.add(t);
7529      return t;
7530    }
7531
7532    public DetailComponent addSubDetail(SubDetailComponent t) { // 3
7533      if (t == null)
7534        return this;
7535      if (this.subDetail == null)
7536        this.subDetail = new ArrayList<SubDetailComponent>();
7537      this.subDetail.add(t);
7538      return this;
7539    }
7540
7541    /**
7542     * @return The first repetition of repeating field {@link #subDetail}, creating
7543     *         it if it does not already exist
7544     */
7545    public SubDetailComponent getSubDetailFirstRep() {
7546      if (getSubDetail().isEmpty()) {
7547        addSubDetail();
7548      }
7549      return getSubDetail().get(0);
7550    }
7551
7552    protected void listChildren(List<Property> children) {
7553      super.listChildren(children);
7554      children.add(new Property("sequence", "positiveInt",
7555          "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
7556          0, 1, sequence));
7557      children.add(new Property("revenue", "CodeableConcept",
7558          "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
7559      children.add(new Property("category", "CodeableConcept",
7560          "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
7561          category));
7562      children.add(new Property("productOrService", "CodeableConcept",
7563          "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.",
7564          0, 1, productOrService));
7565      children.add(new Property("modifier", "CodeableConcept",
7566          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
7567          java.lang.Integer.MAX_VALUE, modifier));
7568      children.add(new Property("programCode", "CodeableConcept",
7569          "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
7570      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
7571          1, quantity));
7572      children.add(new Property("unitPrice", "Money",
7573          "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.",
7574          0, 1, unitPrice));
7575      children.add(new Property("factor", "decimal",
7576          "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.",
7577          0, 1, factor));
7578      children.add(new Property("net", "Money",
7579          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
7580      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
7581          0, java.lang.Integer.MAX_VALUE, udi));
7582      children.add(new Property("noteNumber", "positiveInt",
7583          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
7584          java.lang.Integer.MAX_VALUE, noteNumber));
7585      children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.",
7586          0, java.lang.Integer.MAX_VALUE, adjudication));
7587      children.add(new Property("subDetail", "", "Third-tier of goods and services.", 0, java.lang.Integer.MAX_VALUE,
7588          subDetail));
7589    }
7590
7591    @Override
7592    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7593      switch (_hash) {
7594      case 1349547969:
7595        /* sequence */ return new Property("sequence", "positiveInt",
7596            "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
7597            0, 1, sequence);
7598      case 1099842588:
7599        /* revenue */ return new Property("revenue", "CodeableConcept",
7600            "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
7601      case 50511102:
7602        /* category */ return new Property("category", "CodeableConcept",
7603            "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
7604            category);
7605      case 1957227299:
7606        /* productOrService */ return new Property("productOrService", "CodeableConcept",
7607            "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.",
7608            0, 1, productOrService);
7609      case -615513385:
7610        /* modifier */ return new Property("modifier", "CodeableConcept",
7611            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
7612            java.lang.Integer.MAX_VALUE, modifier);
7613      case 1010065041:
7614        /* programCode */ return new Property("programCode", "CodeableConcept",
7615            "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
7616      case -1285004149:
7617        /* quantity */ return new Property("quantity", "SimpleQuantity",
7618            "The number of repetitions of a service or product.", 0, 1, quantity);
7619      case -486196699:
7620        /* unitPrice */ return new Property("unitPrice", "Money",
7621            "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.",
7622            0, 1, unitPrice);
7623      case -1282148017:
7624        /* factor */ return new Property("factor", "decimal",
7625            "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.",
7626            0, 1, factor);
7627      case 108957:
7628        /* net */ return new Property("net", "Money",
7629            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
7630      case 115642:
7631        /* udi */ return new Property("udi", "Reference(Device)",
7632            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
7633      case -1110033957:
7634        /* noteNumber */ return new Property("noteNumber", "positiveInt",
7635            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
7636            java.lang.Integer.MAX_VALUE, noteNumber);
7637      case -231349275:
7638        /* adjudication */ return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
7639            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
7640      case -828829007:
7641        /* subDetail */ return new Property("subDetail", "", "Third-tier of goods and services.", 0,
7642            java.lang.Integer.MAX_VALUE, subDetail);
7643      default:
7644        return super.getNamedProperty(_hash, _name, _checkValid);
7645      }
7646
7647    }
7648
7649    @Override
7650    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7651      switch (hash) {
7652      case 1349547969:
7653        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
7654      case 1099842588:
7655        /* revenue */ return this.revenue == null ? new Base[0] : new Base[] { this.revenue }; // CodeableConcept
7656      case 50511102:
7657        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
7658      case 1957227299:
7659        /* productOrService */ return this.productOrService == null ? new Base[0]
7660            : new Base[] { this.productOrService }; // CodeableConcept
7661      case -615513385:
7662        /* modifier */ return this.modifier == null ? new Base[0]
7663            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7664      case 1010065041:
7665        /* programCode */ return this.programCode == null ? new Base[0]
7666            : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
7667      case -1285004149:
7668        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
7669      case -486196699:
7670        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
7671      case -1282148017:
7672        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
7673      case 108957:
7674        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
7675      case 115642:
7676        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
7677      case -1110033957:
7678        /* noteNumber */ return this.noteNumber == null ? new Base[0]
7679            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
7680      case -231349275:
7681        /* adjudication */ return this.adjudication == null ? new Base[0]
7682            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
7683      case -828829007:
7684        /* subDetail */ return this.subDetail == null ? new Base[0]
7685            : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
7686      default:
7687        return super.getProperty(hash, name, checkValid);
7688      }
7689
7690    }
7691
7692    @Override
7693    public Base setProperty(int hash, String name, Base value) throws FHIRException {
7694      switch (hash) {
7695      case 1349547969: // sequence
7696        this.sequence = castToPositiveInt(value); // PositiveIntType
7697        return value;
7698      case 1099842588: // revenue
7699        this.revenue = castToCodeableConcept(value); // CodeableConcept
7700        return value;
7701      case 50511102: // category
7702        this.category = castToCodeableConcept(value); // CodeableConcept
7703        return value;
7704      case 1957227299: // productOrService
7705        this.productOrService = castToCodeableConcept(value); // CodeableConcept
7706        return value;
7707      case -615513385: // modifier
7708        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
7709        return value;
7710      case 1010065041: // programCode
7711        this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
7712        return value;
7713      case -1285004149: // quantity
7714        this.quantity = castToQuantity(value); // Quantity
7715        return value;
7716      case -486196699: // unitPrice
7717        this.unitPrice = castToMoney(value); // Money
7718        return value;
7719      case -1282148017: // factor
7720        this.factor = castToDecimal(value); // DecimalType
7721        return value;
7722      case 108957: // net
7723        this.net = castToMoney(value); // Money
7724        return value;
7725      case 115642: // udi
7726        this.getUdi().add(castToReference(value)); // Reference
7727        return value;
7728      case -1110033957: // noteNumber
7729        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
7730        return value;
7731      case -231349275: // adjudication
7732        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
7733        return value;
7734      case -828829007: // subDetail
7735        this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
7736        return value;
7737      default:
7738        return super.setProperty(hash, name, value);
7739      }
7740
7741    }
7742
7743    @Override
7744    public Base setProperty(String name, Base value) throws FHIRException {
7745      if (name.equals("sequence")) {
7746        this.sequence = castToPositiveInt(value); // PositiveIntType
7747      } else if (name.equals("revenue")) {
7748        this.revenue = castToCodeableConcept(value); // CodeableConcept
7749      } else if (name.equals("category")) {
7750        this.category = castToCodeableConcept(value); // CodeableConcept
7751      } else if (name.equals("productOrService")) {
7752        this.productOrService = castToCodeableConcept(value); // CodeableConcept
7753      } else if (name.equals("modifier")) {
7754        this.getModifier().add(castToCodeableConcept(value));
7755      } else if (name.equals("programCode")) {
7756        this.getProgramCode().add(castToCodeableConcept(value));
7757      } else if (name.equals("quantity")) {
7758        this.quantity = castToQuantity(value); // Quantity
7759      } else if (name.equals("unitPrice")) {
7760        this.unitPrice = castToMoney(value); // Money
7761      } else if (name.equals("factor")) {
7762        this.factor = castToDecimal(value); // DecimalType
7763      } else if (name.equals("net")) {
7764        this.net = castToMoney(value); // Money
7765      } else if (name.equals("udi")) {
7766        this.getUdi().add(castToReference(value));
7767      } else if (name.equals("noteNumber")) {
7768        this.getNoteNumber().add(castToPositiveInt(value));
7769      } else if (name.equals("adjudication")) {
7770        this.getAdjudication().add((AdjudicationComponent) value);
7771      } else if (name.equals("subDetail")) {
7772        this.getSubDetail().add((SubDetailComponent) value);
7773      } else
7774        return super.setProperty(name, value);
7775      return value;
7776    }
7777
7778  @Override
7779  public void removeChild(String name, Base value) throws FHIRException {
7780      if (name.equals("sequence")) {
7781        this.sequence = null;
7782      } else if (name.equals("revenue")) {
7783        this.revenue = null;
7784      } else if (name.equals("category")) {
7785        this.category = null;
7786      } else if (name.equals("productOrService")) {
7787        this.productOrService = null;
7788      } else if (name.equals("modifier")) {
7789        this.getModifier().remove(castToCodeableConcept(value));
7790      } else if (name.equals("programCode")) {
7791        this.getProgramCode().remove(castToCodeableConcept(value));
7792      } else if (name.equals("quantity")) {
7793        this.quantity = null;
7794      } else if (name.equals("unitPrice")) {
7795        this.unitPrice = null;
7796      } else if (name.equals("factor")) {
7797        this.factor = null;
7798      } else if (name.equals("net")) {
7799        this.net = null;
7800      } else if (name.equals("udi")) {
7801        this.getUdi().remove(castToReference(value));
7802      } else if (name.equals("noteNumber")) {
7803        this.getNoteNumber().remove(castToPositiveInt(value));
7804      } else if (name.equals("adjudication")) {
7805        this.getAdjudication().remove((AdjudicationComponent) value);
7806      } else if (name.equals("subDetail")) {
7807        this.getSubDetail().remove((SubDetailComponent) value);
7808      } else
7809        super.removeChild(name, value);
7810      
7811    }
7812
7813    @Override
7814    public Base makeProperty(int hash, String name) throws FHIRException {
7815      switch (hash) {
7816      case 1349547969:
7817        return getSequenceElement();
7818      case 1099842588:
7819        return getRevenue();
7820      case 50511102:
7821        return getCategory();
7822      case 1957227299:
7823        return getProductOrService();
7824      case -615513385:
7825        return addModifier();
7826      case 1010065041:
7827        return addProgramCode();
7828      case -1285004149:
7829        return getQuantity();
7830      case -486196699:
7831        return getUnitPrice();
7832      case -1282148017:
7833        return getFactorElement();
7834      case 108957:
7835        return getNet();
7836      case 115642:
7837        return addUdi();
7838      case -1110033957:
7839        return addNoteNumberElement();
7840      case -231349275:
7841        return addAdjudication();
7842      case -828829007:
7843        return addSubDetail();
7844      default:
7845        return super.makeProperty(hash, name);
7846      }
7847
7848    }
7849
7850    @Override
7851    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7852      switch (hash) {
7853      case 1349547969:
7854        /* sequence */ return new String[] { "positiveInt" };
7855      case 1099842588:
7856        /* revenue */ return new String[] { "CodeableConcept" };
7857      case 50511102:
7858        /* category */ return new String[] { "CodeableConcept" };
7859      case 1957227299:
7860        /* productOrService */ return new String[] { "CodeableConcept" };
7861      case -615513385:
7862        /* modifier */ return new String[] { "CodeableConcept" };
7863      case 1010065041:
7864        /* programCode */ return new String[] { "CodeableConcept" };
7865      case -1285004149:
7866        /* quantity */ return new String[] { "SimpleQuantity" };
7867      case -486196699:
7868        /* unitPrice */ return new String[] { "Money" };
7869      case -1282148017:
7870        /* factor */ return new String[] { "decimal" };
7871      case 108957:
7872        /* net */ return new String[] { "Money" };
7873      case 115642:
7874        /* udi */ return new String[] { "Reference" };
7875      case -1110033957:
7876        /* noteNumber */ return new String[] { "positiveInt" };
7877      case -231349275:
7878        /* adjudication */ return new String[] { "@ExplanationOfBenefit.item.adjudication" };
7879      case -828829007:
7880        /* subDetail */ return new String[] {};
7881      default:
7882        return super.getTypesForProperty(hash, name);
7883      }
7884
7885    }
7886
7887    @Override
7888    public Base addChild(String name) throws FHIRException {
7889      if (name.equals("sequence")) {
7890        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
7891      } else if (name.equals("revenue")) {
7892        this.revenue = new CodeableConcept();
7893        return this.revenue;
7894      } else if (name.equals("category")) {
7895        this.category = new CodeableConcept();
7896        return this.category;
7897      } else if (name.equals("productOrService")) {
7898        this.productOrService = new CodeableConcept();
7899        return this.productOrService;
7900      } else if (name.equals("modifier")) {
7901        return addModifier();
7902      } else if (name.equals("programCode")) {
7903        return addProgramCode();
7904      } else if (name.equals("quantity")) {
7905        this.quantity = new Quantity();
7906        return this.quantity;
7907      } else if (name.equals("unitPrice")) {
7908        this.unitPrice = new Money();
7909        return this.unitPrice;
7910      } else if (name.equals("factor")) {
7911        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
7912      } else if (name.equals("net")) {
7913        this.net = new Money();
7914        return this.net;
7915      } else if (name.equals("udi")) {
7916        return addUdi();
7917      } else if (name.equals("noteNumber")) {
7918        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
7919      } else if (name.equals("adjudication")) {
7920        return addAdjudication();
7921      } else if (name.equals("subDetail")) {
7922        return addSubDetail();
7923      } else
7924        return super.addChild(name);
7925    }
7926
7927    public DetailComponent copy() {
7928      DetailComponent dst = new DetailComponent();
7929      copyValues(dst);
7930      return dst;
7931    }
7932
7933    public void copyValues(DetailComponent dst) {
7934      super.copyValues(dst);
7935      dst.sequence = sequence == null ? null : sequence.copy();
7936      dst.revenue = revenue == null ? null : revenue.copy();
7937      dst.category = category == null ? null : category.copy();
7938      dst.productOrService = productOrService == null ? null : productOrService.copy();
7939      if (modifier != null) {
7940        dst.modifier = new ArrayList<CodeableConcept>();
7941        for (CodeableConcept i : modifier)
7942          dst.modifier.add(i.copy());
7943      }
7944      ;
7945      if (programCode != null) {
7946        dst.programCode = new ArrayList<CodeableConcept>();
7947        for (CodeableConcept i : programCode)
7948          dst.programCode.add(i.copy());
7949      }
7950      ;
7951      dst.quantity = quantity == null ? null : quantity.copy();
7952      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7953      dst.factor = factor == null ? null : factor.copy();
7954      dst.net = net == null ? null : net.copy();
7955      if (udi != null) {
7956        dst.udi = new ArrayList<Reference>();
7957        for (Reference i : udi)
7958          dst.udi.add(i.copy());
7959      }
7960      ;
7961      if (noteNumber != null) {
7962        dst.noteNumber = new ArrayList<PositiveIntType>();
7963        for (PositiveIntType i : noteNumber)
7964          dst.noteNumber.add(i.copy());
7965      }
7966      ;
7967      if (adjudication != null) {
7968        dst.adjudication = new ArrayList<AdjudicationComponent>();
7969        for (AdjudicationComponent i : adjudication)
7970          dst.adjudication.add(i.copy());
7971      }
7972      ;
7973      if (subDetail != null) {
7974        dst.subDetail = new ArrayList<SubDetailComponent>();
7975        for (SubDetailComponent i : subDetail)
7976          dst.subDetail.add(i.copy());
7977      }
7978      ;
7979    }
7980
7981    @Override
7982    public boolean equalsDeep(Base other_) {
7983      if (!super.equalsDeep(other_))
7984        return false;
7985      if (!(other_ instanceof DetailComponent))
7986        return false;
7987      DetailComponent o = (DetailComponent) other_;
7988      return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true)
7989          && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
7990          && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
7991          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
7992          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
7993          && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
7994          && compareDeep(subDetail, o.subDetail, true);
7995    }
7996
7997    @Override
7998    public boolean equalsShallow(Base other_) {
7999      if (!super.equalsShallow(other_))
8000        return false;
8001      if (!(other_ instanceof DetailComponent))
8002        return false;
8003      DetailComponent o = (DetailComponent) other_;
8004      return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true)
8005          && compareValues(noteNumber, o.noteNumber, true);
8006    }
8007
8008    public boolean isEmpty() {
8009      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category, productOrService,
8010          modifier, programCode, quantity, unitPrice, factor, net, udi, noteNumber, adjudication, subDetail);
8011    }
8012
8013    public String fhirType() {
8014      return "ExplanationOfBenefit.item.detail";
8015
8016    }
8017
8018  }
8019
8020  @Block()
8021  public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
8022    /**
8023     * A claim detail line. Either a simple (a product or service) or a 'group' of
8024     * sub-details which are simple items.
8025     */
8026    @Child(name = "sequence", type = {
8027        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
8028    @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.")
8029    protected PositiveIntType sequence;
8030
8031    /**
8032     * The type of revenue or cost center providing the product and/or service.
8033     */
8034    @Child(name = "revenue", type = {
8035        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
8036    @Description(shortDefinition = "Revenue or cost center code", formalDefinition = "The type of revenue or cost center providing the product and/or service.")
8037    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-revenue-center")
8038    protected CodeableConcept revenue;
8039
8040    /**
8041     * Code to identify the general type of benefits under which products and
8042     * services are provided.
8043     */
8044    @Child(name = "category", type = {
8045        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
8046    @Description(shortDefinition = "Benefit classification", formalDefinition = "Code to identify the general type of benefits under which products and services are provided.")
8047    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-benefitcategory")
8048    protected CodeableConcept category;
8049
8050    /**
8051     * When the value is a group code then this item collects a set of related claim
8052     * details, otherwise this contains the product, service, drug or other billing
8053     * code for the item.
8054     */
8055    @Child(name = "productOrService", type = {
8056        CodeableConcept.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
8057    @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.")
8058    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
8059    protected CodeableConcept productOrService;
8060
8061    /**
8062     * Item typification or modifiers codes to convey additional context for the
8063     * product or service.
8064     */
8065    @Child(name = "modifier", type = {
8066        CodeableConcept.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8067    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
8068    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
8069    protected List<CodeableConcept> modifier;
8070
8071    /**
8072     * Identifies the program under which this may be recovered.
8073     */
8074    @Child(name = "programCode", type = {
8075        CodeableConcept.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8076    @Description(shortDefinition = "Program the product or service is provided under", formalDefinition = "Identifies the program under which this may be recovered.")
8077    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-program-code")
8078    protected List<CodeableConcept> programCode;
8079
8080    /**
8081     * The number of repetitions of a service or product.
8082     */
8083    @Child(name = "quantity", type = { Quantity.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
8084    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
8085    protected Quantity quantity;
8086
8087    /**
8088     * If the item is not a group then this is the fee for the product or service,
8089     * otherwise this is the total of the fees for the details of the group.
8090     */
8091    @Child(name = "unitPrice", type = { Money.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
8092    @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.")
8093    protected Money unitPrice;
8094
8095    /**
8096     * A real number that represents a multiplier used in determining the overall
8097     * value of services delivered and/or goods received. The concept of a Factor
8098     * allows for a discount or surcharge multiplier to be applied to a monetary
8099     * amount.
8100     */
8101    @Child(name = "factor", type = {
8102        DecimalType.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
8103    @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.")
8104    protected DecimalType factor;
8105
8106    /**
8107     * The quantity times the unit price for an additional service or product or
8108     * charge.
8109     */
8110    @Child(name = "net", type = { Money.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
8111    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
8112    protected Money net;
8113
8114    /**
8115     * Unique Device Identifiers associated with this line item.
8116     */
8117    @Child(name = "udi", type = {
8118        Device.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8119    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
8120    protected List<Reference> udi;
8121    /**
8122     * The actual objects that are the target of the reference (Unique Device
8123     * Identifiers associated with this line item.)
8124     */
8125    protected List<Device> udiTarget;
8126
8127    /**
8128     * The numbers associated with notes below which apply to the adjudication of
8129     * this item.
8130     */
8131    @Child(name = "noteNumber", type = {
8132        PositiveIntType.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8133    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
8134    protected List<PositiveIntType> noteNumber;
8135
8136    /**
8137     * The adjudication results.
8138     */
8139    @Child(name = "adjudication", type = {
8140        AdjudicationComponent.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8141    @Description(shortDefinition = "Subdetail level adjudication details", formalDefinition = "The adjudication results.")
8142    protected List<AdjudicationComponent> adjudication;
8143
8144    private static final long serialVersionUID = -996156853L;
8145
8146    /**
8147     * Constructor
8148     */
8149    public SubDetailComponent() {
8150      super();
8151    }
8152
8153    /**
8154     * Constructor
8155     */
8156    public SubDetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
8157      super();
8158      this.sequence = sequence;
8159      this.productOrService = productOrService;
8160    }
8161
8162    /**
8163     * @return {@link #sequence} (A claim detail line. Either a simple (a product or
8164     *         service) or a 'group' of sub-details which are simple items.). This
8165     *         is the underlying object with id, value and extensions. The accessor
8166     *         "getSequence" gives direct access to the value
8167     */
8168    public PositiveIntType getSequenceElement() {
8169      if (this.sequence == null)
8170        if (Configuration.errorOnAutoCreate())
8171          throw new Error("Attempt to auto-create SubDetailComponent.sequence");
8172        else if (Configuration.doAutoCreate())
8173          this.sequence = new PositiveIntType(); // bb
8174      return this.sequence;
8175    }
8176
8177    public boolean hasSequenceElement() {
8178      return this.sequence != null && !this.sequence.isEmpty();
8179    }
8180
8181    public boolean hasSequence() {
8182      return this.sequence != null && !this.sequence.isEmpty();
8183    }
8184
8185    /**
8186     * @param value {@link #sequence} (A claim detail line. Either a simple (a
8187     *              product or service) or a 'group' of sub-details which are simple
8188     *              items.). This is the underlying object with id, value and
8189     *              extensions. The accessor "getSequence" gives direct access to
8190     *              the value
8191     */
8192    public SubDetailComponent setSequenceElement(PositiveIntType value) {
8193      this.sequence = value;
8194      return this;
8195    }
8196
8197    /**
8198     * @return A claim detail line. Either a simple (a product or service) or a
8199     *         'group' of sub-details which are simple items.
8200     */
8201    public int getSequence() {
8202      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
8203    }
8204
8205    /**
8206     * @param value A claim detail line. Either a simple (a product or service) or a
8207     *              'group' of sub-details which are simple items.
8208     */
8209    public SubDetailComponent setSequence(int value) {
8210      if (this.sequence == null)
8211        this.sequence = new PositiveIntType();
8212      this.sequence.setValue(value);
8213      return this;
8214    }
8215
8216    /**
8217     * @return {@link #revenue} (The type of revenue or cost center providing the
8218     *         product and/or service.)
8219     */
8220    public CodeableConcept getRevenue() {
8221      if (this.revenue == null)
8222        if (Configuration.errorOnAutoCreate())
8223          throw new Error("Attempt to auto-create SubDetailComponent.revenue");
8224        else if (Configuration.doAutoCreate())
8225          this.revenue = new CodeableConcept(); // cc
8226      return this.revenue;
8227    }
8228
8229    public boolean hasRevenue() {
8230      return this.revenue != null && !this.revenue.isEmpty();
8231    }
8232
8233    /**
8234     * @param value {@link #revenue} (The type of revenue or cost center providing
8235     *              the product and/or service.)
8236     */
8237    public SubDetailComponent setRevenue(CodeableConcept value) {
8238      this.revenue = value;
8239      return this;
8240    }
8241
8242    /**
8243     * @return {@link #category} (Code to identify the general type of benefits
8244     *         under which products and services are provided.)
8245     */
8246    public CodeableConcept getCategory() {
8247      if (this.category == null)
8248        if (Configuration.errorOnAutoCreate())
8249          throw new Error("Attempt to auto-create SubDetailComponent.category");
8250        else if (Configuration.doAutoCreate())
8251          this.category = new CodeableConcept(); // cc
8252      return this.category;
8253    }
8254
8255    public boolean hasCategory() {
8256      return this.category != null && !this.category.isEmpty();
8257    }
8258
8259    /**
8260     * @param value {@link #category} (Code to identify the general type of benefits
8261     *              under which products and services are provided.)
8262     */
8263    public SubDetailComponent setCategory(CodeableConcept value) {
8264      this.category = value;
8265      return this;
8266    }
8267
8268    /**
8269     * @return {@link #productOrService} (When the value is a group code then this
8270     *         item collects a set of related claim details, otherwise this contains
8271     *         the product, service, drug or other billing code for the item.)
8272     */
8273    public CodeableConcept getProductOrService() {
8274      if (this.productOrService == null)
8275        if (Configuration.errorOnAutoCreate())
8276          throw new Error("Attempt to auto-create SubDetailComponent.productOrService");
8277        else if (Configuration.doAutoCreate())
8278          this.productOrService = new CodeableConcept(); // cc
8279      return this.productOrService;
8280    }
8281
8282    public boolean hasProductOrService() {
8283      return this.productOrService != null && !this.productOrService.isEmpty();
8284    }
8285
8286    /**
8287     * @param value {@link #productOrService} (When the value is a group code then
8288     *              this item collects a set of related claim details, otherwise
8289     *              this contains the product, service, drug or other billing code
8290     *              for the item.)
8291     */
8292    public SubDetailComponent setProductOrService(CodeableConcept value) {
8293      this.productOrService = value;
8294      return this;
8295    }
8296
8297    /**
8298     * @return {@link #modifier} (Item typification or modifiers codes to convey
8299     *         additional context for the product or service.)
8300     */
8301    public List<CodeableConcept> getModifier() {
8302      if (this.modifier == null)
8303        this.modifier = new ArrayList<CodeableConcept>();
8304      return this.modifier;
8305    }
8306
8307    /**
8308     * @return Returns a reference to <code>this</code> for easy method chaining
8309     */
8310    public SubDetailComponent setModifier(List<CodeableConcept> theModifier) {
8311      this.modifier = theModifier;
8312      return this;
8313    }
8314
8315    public boolean hasModifier() {
8316      if (this.modifier == null)
8317        return false;
8318      for (CodeableConcept item : this.modifier)
8319        if (!item.isEmpty())
8320          return true;
8321      return false;
8322    }
8323
8324    public CodeableConcept addModifier() { // 3
8325      CodeableConcept t = new CodeableConcept();
8326      if (this.modifier == null)
8327        this.modifier = new ArrayList<CodeableConcept>();
8328      this.modifier.add(t);
8329      return t;
8330    }
8331
8332    public SubDetailComponent addModifier(CodeableConcept t) { // 3
8333      if (t == null)
8334        return this;
8335      if (this.modifier == null)
8336        this.modifier = new ArrayList<CodeableConcept>();
8337      this.modifier.add(t);
8338      return this;
8339    }
8340
8341    /**
8342     * @return The first repetition of repeating field {@link #modifier}, creating
8343     *         it if it does not already exist
8344     */
8345    public CodeableConcept getModifierFirstRep() {
8346      if (getModifier().isEmpty()) {
8347        addModifier();
8348      }
8349      return getModifier().get(0);
8350    }
8351
8352    /**
8353     * @return {@link #programCode} (Identifies the program under which this may be
8354     *         recovered.)
8355     */
8356    public List<CodeableConcept> getProgramCode() {
8357      if (this.programCode == null)
8358        this.programCode = new ArrayList<CodeableConcept>();
8359      return this.programCode;
8360    }
8361
8362    /**
8363     * @return Returns a reference to <code>this</code> for easy method chaining
8364     */
8365    public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) {
8366      this.programCode = theProgramCode;
8367      return this;
8368    }
8369
8370    public boolean hasProgramCode() {
8371      if (this.programCode == null)
8372        return false;
8373      for (CodeableConcept item : this.programCode)
8374        if (!item.isEmpty())
8375          return true;
8376      return false;
8377    }
8378
8379    public CodeableConcept addProgramCode() { // 3
8380      CodeableConcept t = new CodeableConcept();
8381      if (this.programCode == null)
8382        this.programCode = new ArrayList<CodeableConcept>();
8383      this.programCode.add(t);
8384      return t;
8385    }
8386
8387    public SubDetailComponent addProgramCode(CodeableConcept t) { // 3
8388      if (t == null)
8389        return this;
8390      if (this.programCode == null)
8391        this.programCode = new ArrayList<CodeableConcept>();
8392      this.programCode.add(t);
8393      return this;
8394    }
8395
8396    /**
8397     * @return The first repetition of repeating field {@link #programCode},
8398     *         creating it if it does not already exist
8399     */
8400    public CodeableConcept getProgramCodeFirstRep() {
8401      if (getProgramCode().isEmpty()) {
8402        addProgramCode();
8403      }
8404      return getProgramCode().get(0);
8405    }
8406
8407    /**
8408     * @return {@link #quantity} (The number of repetitions of a service or
8409     *         product.)
8410     */
8411    public Quantity getQuantity() {
8412      if (this.quantity == null)
8413        if (Configuration.errorOnAutoCreate())
8414          throw new Error("Attempt to auto-create SubDetailComponent.quantity");
8415        else if (Configuration.doAutoCreate())
8416          this.quantity = new Quantity(); // cc
8417      return this.quantity;
8418    }
8419
8420    public boolean hasQuantity() {
8421      return this.quantity != null && !this.quantity.isEmpty();
8422    }
8423
8424    /**
8425     * @param value {@link #quantity} (The number of repetitions of a service or
8426     *              product.)
8427     */
8428    public SubDetailComponent setQuantity(Quantity value) {
8429      this.quantity = value;
8430      return this;
8431    }
8432
8433    /**
8434     * @return {@link #unitPrice} (If the item is not a group then this is the fee
8435     *         for the product or service, otherwise this is the total of the fees
8436     *         for the details of the group.)
8437     */
8438    public Money getUnitPrice() {
8439      if (this.unitPrice == null)
8440        if (Configuration.errorOnAutoCreate())
8441          throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
8442        else if (Configuration.doAutoCreate())
8443          this.unitPrice = new Money(); // cc
8444      return this.unitPrice;
8445    }
8446
8447    public boolean hasUnitPrice() {
8448      return this.unitPrice != null && !this.unitPrice.isEmpty();
8449    }
8450
8451    /**
8452     * @param value {@link #unitPrice} (If the item is not a group then this is the
8453     *              fee for the product or service, otherwise this is the total of
8454     *              the fees for the details of the group.)
8455     */
8456    public SubDetailComponent setUnitPrice(Money value) {
8457      this.unitPrice = value;
8458      return this;
8459    }
8460
8461    /**
8462     * @return {@link #factor} (A real number that represents a multiplier used in
8463     *         determining the overall value of services delivered and/or goods
8464     *         received. The concept of a Factor allows for a discount or surcharge
8465     *         multiplier to be applied to a monetary amount.). This is the
8466     *         underlying object with id, value and extensions. The accessor
8467     *         "getFactor" gives direct access to the value
8468     */
8469    public DecimalType getFactorElement() {
8470      if (this.factor == null)
8471        if (Configuration.errorOnAutoCreate())
8472          throw new Error("Attempt to auto-create SubDetailComponent.factor");
8473        else if (Configuration.doAutoCreate())
8474          this.factor = new DecimalType(); // bb
8475      return this.factor;
8476    }
8477
8478    public boolean hasFactorElement() {
8479      return this.factor != null && !this.factor.isEmpty();
8480    }
8481
8482    public boolean hasFactor() {
8483      return this.factor != null && !this.factor.isEmpty();
8484    }
8485
8486    /**
8487     * @param value {@link #factor} (A real number that represents a multiplier used
8488     *              in determining the overall value of services delivered and/or
8489     *              goods received. The concept of a Factor allows for a discount or
8490     *              surcharge multiplier to be applied to a monetary amount.). This
8491     *              is the underlying object with id, value and extensions. The
8492     *              accessor "getFactor" gives direct access to the value
8493     */
8494    public SubDetailComponent setFactorElement(DecimalType value) {
8495      this.factor = value;
8496      return this;
8497    }
8498
8499    /**
8500     * @return A real number that represents a multiplier used in determining the
8501     *         overall value of services delivered and/or goods received. The
8502     *         concept of a Factor allows for a discount or surcharge multiplier to
8503     *         be applied to a monetary amount.
8504     */
8505    public BigDecimal getFactor() {
8506      return this.factor == null ? null : this.factor.getValue();
8507    }
8508
8509    /**
8510     * @param value A real number that represents a multiplier used in determining
8511     *              the overall value of services delivered and/or goods received.
8512     *              The concept of a Factor allows for a discount or surcharge
8513     *              multiplier to be applied to a monetary amount.
8514     */
8515    public SubDetailComponent setFactor(BigDecimal value) {
8516      if (value == null)
8517        this.factor = null;
8518      else {
8519        if (this.factor == null)
8520          this.factor = new DecimalType();
8521        this.factor.setValue(value);
8522      }
8523      return this;
8524    }
8525
8526    /**
8527     * @param value A real number that represents a multiplier used in determining
8528     *              the overall value of services delivered and/or goods received.
8529     *              The concept of a Factor allows for a discount or surcharge
8530     *              multiplier to be applied to a monetary amount.
8531     */
8532    public SubDetailComponent setFactor(long value) {
8533      this.factor = new DecimalType();
8534      this.factor.setValue(value);
8535      return this;
8536    }
8537
8538    /**
8539     * @param value A real number that represents a multiplier used in determining
8540     *              the overall value of services delivered and/or goods received.
8541     *              The concept of a Factor allows for a discount or surcharge
8542     *              multiplier to be applied to a monetary amount.
8543     */
8544    public SubDetailComponent setFactor(double value) {
8545      this.factor = new DecimalType();
8546      this.factor.setValue(value);
8547      return this;
8548    }
8549
8550    /**
8551     * @return {@link #net} (The quantity times the unit price for an additional
8552     *         service or product or charge.)
8553     */
8554    public Money getNet() {
8555      if (this.net == null)
8556        if (Configuration.errorOnAutoCreate())
8557          throw new Error("Attempt to auto-create SubDetailComponent.net");
8558        else if (Configuration.doAutoCreate())
8559          this.net = new Money(); // cc
8560      return this.net;
8561    }
8562
8563    public boolean hasNet() {
8564      return this.net != null && !this.net.isEmpty();
8565    }
8566
8567    /**
8568     * @param value {@link #net} (The quantity times the unit price for an
8569     *              additional service or product or charge.)
8570     */
8571    public SubDetailComponent setNet(Money value) {
8572      this.net = value;
8573      return this;
8574    }
8575
8576    /**
8577     * @return {@link #udi} (Unique Device Identifiers associated with this line
8578     *         item.)
8579     */
8580    public List<Reference> getUdi() {
8581      if (this.udi == null)
8582        this.udi = new ArrayList<Reference>();
8583      return this.udi;
8584    }
8585
8586    /**
8587     * @return Returns a reference to <code>this</code> for easy method chaining
8588     */
8589    public SubDetailComponent setUdi(List<Reference> theUdi) {
8590      this.udi = theUdi;
8591      return this;
8592    }
8593
8594    public boolean hasUdi() {
8595      if (this.udi == null)
8596        return false;
8597      for (Reference item : this.udi)
8598        if (!item.isEmpty())
8599          return true;
8600      return false;
8601    }
8602
8603    public Reference addUdi() { // 3
8604      Reference t = new Reference();
8605      if (this.udi == null)
8606        this.udi = new ArrayList<Reference>();
8607      this.udi.add(t);
8608      return t;
8609    }
8610
8611    public SubDetailComponent addUdi(Reference t) { // 3
8612      if (t == null)
8613        return this;
8614      if (this.udi == null)
8615        this.udi = new ArrayList<Reference>();
8616      this.udi.add(t);
8617      return this;
8618    }
8619
8620    /**
8621     * @return The first repetition of repeating field {@link #udi}, creating it if
8622     *         it does not already exist
8623     */
8624    public Reference getUdiFirstRep() {
8625      if (getUdi().isEmpty()) {
8626        addUdi();
8627      }
8628      return getUdi().get(0);
8629    }
8630
8631    /**
8632     * @return {@link #noteNumber} (The numbers associated with notes below which
8633     *         apply to the adjudication of this item.)
8634     */
8635    public List<PositiveIntType> getNoteNumber() {
8636      if (this.noteNumber == null)
8637        this.noteNumber = new ArrayList<PositiveIntType>();
8638      return this.noteNumber;
8639    }
8640
8641    /**
8642     * @return Returns a reference to <code>this</code> for easy method chaining
8643     */
8644    public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
8645      this.noteNumber = theNoteNumber;
8646      return this;
8647    }
8648
8649    public boolean hasNoteNumber() {
8650      if (this.noteNumber == null)
8651        return false;
8652      for (PositiveIntType item : this.noteNumber)
8653        if (!item.isEmpty())
8654          return true;
8655      return false;
8656    }
8657
8658    /**
8659     * @return {@link #noteNumber} (The numbers associated with notes below which
8660     *         apply to the adjudication of this item.)
8661     */
8662    public PositiveIntType addNoteNumberElement() {// 2
8663      PositiveIntType t = new PositiveIntType();
8664      if (this.noteNumber == null)
8665        this.noteNumber = new ArrayList<PositiveIntType>();
8666      this.noteNumber.add(t);
8667      return t;
8668    }
8669
8670    /**
8671     * @param value {@link #noteNumber} (The numbers associated with notes below
8672     *              which apply to the adjudication of this item.)
8673     */
8674    public SubDetailComponent addNoteNumber(int value) { // 1
8675      PositiveIntType t = new PositiveIntType();
8676      t.setValue(value);
8677      if (this.noteNumber == null)
8678        this.noteNumber = new ArrayList<PositiveIntType>();
8679      this.noteNumber.add(t);
8680      return this;
8681    }
8682
8683    /**
8684     * @param value {@link #noteNumber} (The numbers associated with notes below
8685     *              which apply to the adjudication of this item.)
8686     */
8687    public boolean hasNoteNumber(int value) {
8688      if (this.noteNumber == null)
8689        return false;
8690      for (PositiveIntType v : this.noteNumber)
8691        if (v.getValue().equals(value)) // positiveInt
8692          return true;
8693      return false;
8694    }
8695
8696    /**
8697     * @return {@link #adjudication} (The adjudication results.)
8698     */
8699    public List<AdjudicationComponent> getAdjudication() {
8700      if (this.adjudication == null)
8701        this.adjudication = new ArrayList<AdjudicationComponent>();
8702      return this.adjudication;
8703    }
8704
8705    /**
8706     * @return Returns a reference to <code>this</code> for easy method chaining
8707     */
8708    public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
8709      this.adjudication = theAdjudication;
8710      return this;
8711    }
8712
8713    public boolean hasAdjudication() {
8714      if (this.adjudication == null)
8715        return false;
8716      for (AdjudicationComponent item : this.adjudication)
8717        if (!item.isEmpty())
8718          return true;
8719      return false;
8720    }
8721
8722    public AdjudicationComponent addAdjudication() { // 3
8723      AdjudicationComponent t = new AdjudicationComponent();
8724      if (this.adjudication == null)
8725        this.adjudication = new ArrayList<AdjudicationComponent>();
8726      this.adjudication.add(t);
8727      return t;
8728    }
8729
8730    public SubDetailComponent addAdjudication(AdjudicationComponent t) { // 3
8731      if (t == null)
8732        return this;
8733      if (this.adjudication == null)
8734        this.adjudication = new ArrayList<AdjudicationComponent>();
8735      this.adjudication.add(t);
8736      return this;
8737    }
8738
8739    /**
8740     * @return The first repetition of repeating field {@link #adjudication},
8741     *         creating it if it does not already exist
8742     */
8743    public AdjudicationComponent getAdjudicationFirstRep() {
8744      if (getAdjudication().isEmpty()) {
8745        addAdjudication();
8746      }
8747      return getAdjudication().get(0);
8748    }
8749
8750    protected void listChildren(List<Property> children) {
8751      super.listChildren(children);
8752      children.add(new Property("sequence", "positiveInt",
8753          "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
8754          0, 1, sequence));
8755      children.add(new Property("revenue", "CodeableConcept",
8756          "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
8757      children.add(new Property("category", "CodeableConcept",
8758          "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
8759          category));
8760      children.add(new Property("productOrService", "CodeableConcept",
8761          "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.",
8762          0, 1, productOrService));
8763      children.add(new Property("modifier", "CodeableConcept",
8764          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
8765          java.lang.Integer.MAX_VALUE, modifier));
8766      children.add(new Property("programCode", "CodeableConcept",
8767          "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
8768      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
8769          1, quantity));
8770      children.add(new Property("unitPrice", "Money",
8771          "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.",
8772          0, 1, unitPrice));
8773      children.add(new Property("factor", "decimal",
8774          "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.",
8775          0, 1, factor));
8776      children.add(new Property("net", "Money",
8777          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
8778      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
8779          0, java.lang.Integer.MAX_VALUE, udi));
8780      children.add(new Property("noteNumber", "positiveInt",
8781          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
8782          java.lang.Integer.MAX_VALUE, noteNumber));
8783      children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.",
8784          0, java.lang.Integer.MAX_VALUE, adjudication));
8785    }
8786
8787    @Override
8788    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8789      switch (_hash) {
8790      case 1349547969:
8791        /* sequence */ return new Property("sequence", "positiveInt",
8792            "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
8793            0, 1, sequence);
8794      case 1099842588:
8795        /* revenue */ return new Property("revenue", "CodeableConcept",
8796            "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
8797      case 50511102:
8798        /* category */ return new Property("category", "CodeableConcept",
8799            "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
8800            category);
8801      case 1957227299:
8802        /* productOrService */ return new Property("productOrService", "CodeableConcept",
8803            "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.",
8804            0, 1, productOrService);
8805      case -615513385:
8806        /* modifier */ return new Property("modifier", "CodeableConcept",
8807            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
8808            java.lang.Integer.MAX_VALUE, modifier);
8809      case 1010065041:
8810        /* programCode */ return new Property("programCode", "CodeableConcept",
8811            "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
8812      case -1285004149:
8813        /* quantity */ return new Property("quantity", "SimpleQuantity",
8814            "The number of repetitions of a service or product.", 0, 1, quantity);
8815      case -486196699:
8816        /* unitPrice */ return new Property("unitPrice", "Money",
8817            "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.",
8818            0, 1, unitPrice);
8819      case -1282148017:
8820        /* factor */ return new Property("factor", "decimal",
8821            "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.",
8822            0, 1, factor);
8823      case 108957:
8824        /* net */ return new Property("net", "Money",
8825            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
8826      case 115642:
8827        /* udi */ return new Property("udi", "Reference(Device)",
8828            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
8829      case -1110033957:
8830        /* noteNumber */ return new Property("noteNumber", "positiveInt",
8831            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
8832            java.lang.Integer.MAX_VALUE, noteNumber);
8833      case -231349275:
8834        /* adjudication */ return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
8835            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
8836      default:
8837        return super.getNamedProperty(_hash, _name, _checkValid);
8838      }
8839
8840    }
8841
8842    @Override
8843    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8844      switch (hash) {
8845      case 1349547969:
8846        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
8847      case 1099842588:
8848        /* revenue */ return this.revenue == null ? new Base[0] : new Base[] { this.revenue }; // CodeableConcept
8849      case 50511102:
8850        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
8851      case 1957227299:
8852        /* productOrService */ return this.productOrService == null ? new Base[0]
8853            : new Base[] { this.productOrService }; // CodeableConcept
8854      case -615513385:
8855        /* modifier */ return this.modifier == null ? new Base[0]
8856            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
8857      case 1010065041:
8858        /* programCode */ return this.programCode == null ? new Base[0]
8859            : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
8860      case -1285004149:
8861        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
8862      case -486196699:
8863        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
8864      case -1282148017:
8865        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
8866      case 108957:
8867        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
8868      case 115642:
8869        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
8870      case -1110033957:
8871        /* noteNumber */ return this.noteNumber == null ? new Base[0]
8872            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
8873      case -231349275:
8874        /* adjudication */ return this.adjudication == null ? new Base[0]
8875            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
8876      default:
8877        return super.getProperty(hash, name, checkValid);
8878      }
8879
8880    }
8881
8882    @Override
8883    public Base setProperty(int hash, String name, Base value) throws FHIRException {
8884      switch (hash) {
8885      case 1349547969: // sequence
8886        this.sequence = castToPositiveInt(value); // PositiveIntType
8887        return value;
8888      case 1099842588: // revenue
8889        this.revenue = castToCodeableConcept(value); // CodeableConcept
8890        return value;
8891      case 50511102: // category
8892        this.category = castToCodeableConcept(value); // CodeableConcept
8893        return value;
8894      case 1957227299: // productOrService
8895        this.productOrService = castToCodeableConcept(value); // CodeableConcept
8896        return value;
8897      case -615513385: // modifier
8898        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
8899        return value;
8900      case 1010065041: // programCode
8901        this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
8902        return value;
8903      case -1285004149: // quantity
8904        this.quantity = castToQuantity(value); // Quantity
8905        return value;
8906      case -486196699: // unitPrice
8907        this.unitPrice = castToMoney(value); // Money
8908        return value;
8909      case -1282148017: // factor
8910        this.factor = castToDecimal(value); // DecimalType
8911        return value;
8912      case 108957: // net
8913        this.net = castToMoney(value); // Money
8914        return value;
8915      case 115642: // udi
8916        this.getUdi().add(castToReference(value)); // Reference
8917        return value;
8918      case -1110033957: // noteNumber
8919        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
8920        return value;
8921      case -231349275: // adjudication
8922        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
8923        return value;
8924      default:
8925        return super.setProperty(hash, name, value);
8926      }
8927
8928    }
8929
8930    @Override
8931    public Base setProperty(String name, Base value) throws FHIRException {
8932      if (name.equals("sequence")) {
8933        this.sequence = castToPositiveInt(value); // PositiveIntType
8934      } else if (name.equals("revenue")) {
8935        this.revenue = castToCodeableConcept(value); // CodeableConcept
8936      } else if (name.equals("category")) {
8937        this.category = castToCodeableConcept(value); // CodeableConcept
8938      } else if (name.equals("productOrService")) {
8939        this.productOrService = castToCodeableConcept(value); // CodeableConcept
8940      } else if (name.equals("modifier")) {
8941        this.getModifier().add(castToCodeableConcept(value));
8942      } else if (name.equals("programCode")) {
8943        this.getProgramCode().add(castToCodeableConcept(value));
8944      } else if (name.equals("quantity")) {
8945        this.quantity = castToQuantity(value); // Quantity
8946      } else if (name.equals("unitPrice")) {
8947        this.unitPrice = castToMoney(value); // Money
8948      } else if (name.equals("factor")) {
8949        this.factor = castToDecimal(value); // DecimalType
8950      } else if (name.equals("net")) {
8951        this.net = castToMoney(value); // Money
8952      } else if (name.equals("udi")) {
8953        this.getUdi().add(castToReference(value));
8954      } else if (name.equals("noteNumber")) {
8955        this.getNoteNumber().add(castToPositiveInt(value));
8956      } else if (name.equals("adjudication")) {
8957        this.getAdjudication().add((AdjudicationComponent) value);
8958      } else
8959        return super.setProperty(name, value);
8960      return value;
8961    }
8962
8963  @Override
8964  public void removeChild(String name, Base value) throws FHIRException {
8965      if (name.equals("sequence")) {
8966        this.sequence = null;
8967      } else if (name.equals("revenue")) {
8968        this.revenue = null;
8969      } else if (name.equals("category")) {
8970        this.category = null;
8971      } else if (name.equals("productOrService")) {
8972        this.productOrService = null;
8973      } else if (name.equals("modifier")) {
8974        this.getModifier().remove(castToCodeableConcept(value));
8975      } else if (name.equals("programCode")) {
8976        this.getProgramCode().remove(castToCodeableConcept(value));
8977      } else if (name.equals("quantity")) {
8978        this.quantity = null;
8979      } else if (name.equals("unitPrice")) {
8980        this.unitPrice = null;
8981      } else if (name.equals("factor")) {
8982        this.factor = null;
8983      } else if (name.equals("net")) {
8984        this.net = null;
8985      } else if (name.equals("udi")) {
8986        this.getUdi().remove(castToReference(value));
8987      } else if (name.equals("noteNumber")) {
8988        this.getNoteNumber().remove(castToPositiveInt(value));
8989      } else if (name.equals("adjudication")) {
8990        this.getAdjudication().remove((AdjudicationComponent) value);
8991      } else
8992        super.removeChild(name, value);
8993      
8994    }
8995
8996    @Override
8997    public Base makeProperty(int hash, String name) throws FHIRException {
8998      switch (hash) {
8999      case 1349547969:
9000        return getSequenceElement();
9001      case 1099842588:
9002        return getRevenue();
9003      case 50511102:
9004        return getCategory();
9005      case 1957227299:
9006        return getProductOrService();
9007      case -615513385:
9008        return addModifier();
9009      case 1010065041:
9010        return addProgramCode();
9011      case -1285004149:
9012        return getQuantity();
9013      case -486196699:
9014        return getUnitPrice();
9015      case -1282148017:
9016        return getFactorElement();
9017      case 108957:
9018        return getNet();
9019      case 115642:
9020        return addUdi();
9021      case -1110033957:
9022        return addNoteNumberElement();
9023      case -231349275:
9024        return addAdjudication();
9025      default:
9026        return super.makeProperty(hash, name);
9027      }
9028
9029    }
9030
9031    @Override
9032    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9033      switch (hash) {
9034      case 1349547969:
9035        /* sequence */ return new String[] { "positiveInt" };
9036      case 1099842588:
9037        /* revenue */ return new String[] { "CodeableConcept" };
9038      case 50511102:
9039        /* category */ return new String[] { "CodeableConcept" };
9040      case 1957227299:
9041        /* productOrService */ return new String[] { "CodeableConcept" };
9042      case -615513385:
9043        /* modifier */ return new String[] { "CodeableConcept" };
9044      case 1010065041:
9045        /* programCode */ return new String[] { "CodeableConcept" };
9046      case -1285004149:
9047        /* quantity */ return new String[] { "SimpleQuantity" };
9048      case -486196699:
9049        /* unitPrice */ return new String[] { "Money" };
9050      case -1282148017:
9051        /* factor */ return new String[] { "decimal" };
9052      case 108957:
9053        /* net */ return new String[] { "Money" };
9054      case 115642:
9055        /* udi */ return new String[] { "Reference" };
9056      case -1110033957:
9057        /* noteNumber */ return new String[] { "positiveInt" };
9058      case -231349275:
9059        /* adjudication */ return new String[] { "@ExplanationOfBenefit.item.adjudication" };
9060      default:
9061        return super.getTypesForProperty(hash, name);
9062      }
9063
9064    }
9065
9066    @Override
9067    public Base addChild(String name) throws FHIRException {
9068      if (name.equals("sequence")) {
9069        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.sequence");
9070      } else if (name.equals("revenue")) {
9071        this.revenue = new CodeableConcept();
9072        return this.revenue;
9073      } else if (name.equals("category")) {
9074        this.category = new CodeableConcept();
9075        return this.category;
9076      } else if (name.equals("productOrService")) {
9077        this.productOrService = new CodeableConcept();
9078        return this.productOrService;
9079      } else if (name.equals("modifier")) {
9080        return addModifier();
9081      } else if (name.equals("programCode")) {
9082        return addProgramCode();
9083      } else if (name.equals("quantity")) {
9084        this.quantity = new Quantity();
9085        return this.quantity;
9086      } else if (name.equals("unitPrice")) {
9087        this.unitPrice = new Money();
9088        return this.unitPrice;
9089      } else if (name.equals("factor")) {
9090        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
9091      } else if (name.equals("net")) {
9092        this.net = new Money();
9093        return this.net;
9094      } else if (name.equals("udi")) {
9095        return addUdi();
9096      } else if (name.equals("noteNumber")) {
9097        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
9098      } else if (name.equals("adjudication")) {
9099        return addAdjudication();
9100      } else
9101        return super.addChild(name);
9102    }
9103
9104    public SubDetailComponent copy() {
9105      SubDetailComponent dst = new SubDetailComponent();
9106      copyValues(dst);
9107      return dst;
9108    }
9109
9110    public void copyValues(SubDetailComponent dst) {
9111      super.copyValues(dst);
9112      dst.sequence = sequence == null ? null : sequence.copy();
9113      dst.revenue = revenue == null ? null : revenue.copy();
9114      dst.category = category == null ? null : category.copy();
9115      dst.productOrService = productOrService == null ? null : productOrService.copy();
9116      if (modifier != null) {
9117        dst.modifier = new ArrayList<CodeableConcept>();
9118        for (CodeableConcept i : modifier)
9119          dst.modifier.add(i.copy());
9120      }
9121      ;
9122      if (programCode != null) {
9123        dst.programCode = new ArrayList<CodeableConcept>();
9124        for (CodeableConcept i : programCode)
9125          dst.programCode.add(i.copy());
9126      }
9127      ;
9128      dst.quantity = quantity == null ? null : quantity.copy();
9129      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
9130      dst.factor = factor == null ? null : factor.copy();
9131      dst.net = net == null ? null : net.copy();
9132      if (udi != null) {
9133        dst.udi = new ArrayList<Reference>();
9134        for (Reference i : udi)
9135          dst.udi.add(i.copy());
9136      }
9137      ;
9138      if (noteNumber != null) {
9139        dst.noteNumber = new ArrayList<PositiveIntType>();
9140        for (PositiveIntType i : noteNumber)
9141          dst.noteNumber.add(i.copy());
9142      }
9143      ;
9144      if (adjudication != null) {
9145        dst.adjudication = new ArrayList<AdjudicationComponent>();
9146        for (AdjudicationComponent i : adjudication)
9147          dst.adjudication.add(i.copy());
9148      }
9149      ;
9150    }
9151
9152    @Override
9153    public boolean equalsDeep(Base other_) {
9154      if (!super.equalsDeep(other_))
9155        return false;
9156      if (!(other_ instanceof SubDetailComponent))
9157        return false;
9158      SubDetailComponent o = (SubDetailComponent) other_;
9159      return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true)
9160          && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
9161          && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
9162          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
9163          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
9164          && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true);
9165    }
9166
9167    @Override
9168    public boolean equalsShallow(Base other_) {
9169      if (!super.equalsShallow(other_))
9170        return false;
9171      if (!(other_ instanceof SubDetailComponent))
9172        return false;
9173      SubDetailComponent o = (SubDetailComponent) other_;
9174      return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true)
9175          && compareValues(noteNumber, o.noteNumber, true);
9176    }
9177
9178    public boolean isEmpty() {
9179      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category, productOrService,
9180          modifier, programCode, quantity, unitPrice, factor, net, udi, noteNumber, adjudication);
9181    }
9182
9183    public String fhirType() {
9184      return "ExplanationOfBenefit.item.detail.subDetail";
9185
9186    }
9187
9188  }
9189
9190  @Block()
9191  public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
9192    /**
9193     * Claim items which this service line is intended to replace.
9194     */
9195    @Child(name = "itemSequence", type = {
9196        PositiveIntType.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9197    @Description(shortDefinition = "Item sequence number", formalDefinition = "Claim items which this service line is intended to replace.")
9198    protected List<PositiveIntType> itemSequence;
9199
9200    /**
9201     * The sequence number of the details within the claim item which this line is
9202     * intended to replace.
9203     */
9204    @Child(name = "detailSequence", type = {
9205        PositiveIntType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9206    @Description(shortDefinition = "Detail sequence number", formalDefinition = "The sequence number of the details within the claim item which this line is intended to replace.")
9207    protected List<PositiveIntType> detailSequence;
9208
9209    /**
9210     * The sequence number of the sub-details woithin the details within the claim
9211     * item which this line is intended to replace.
9212     */
9213    @Child(name = "subDetailSequence", type = {
9214        PositiveIntType.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9215    @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.")
9216    protected List<PositiveIntType> subDetailSequence;
9217
9218    /**
9219     * The providers who are authorized for the services rendered to the patient.
9220     */
9221    @Child(name = "provider", type = { Practitioner.class, PractitionerRole.class,
9222        Organization.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9223    @Description(shortDefinition = "Authorized providers", formalDefinition = "The providers who are authorized for the services rendered to the patient.")
9224    protected List<Reference> provider;
9225    /**
9226     * The actual objects that are the target of the reference (The providers who
9227     * are authorized for the services rendered to the patient.)
9228     */
9229    protected List<Resource> providerTarget;
9230
9231    /**
9232     * When the value is a group code then this item collects a set of related claim
9233     * details, otherwise this contains the product, service, drug or other billing
9234     * code for the item.
9235     */
9236    @Child(name = "productOrService", type = {
9237        CodeableConcept.class }, order = 5, min = 1, max = 1, modifier = false, summary = false)
9238    @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.")
9239    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
9240    protected CodeableConcept productOrService;
9241
9242    /**
9243     * Item typification or modifiers codes to convey additional context for the
9244     * product or service.
9245     */
9246    @Child(name = "modifier", type = {
9247        CodeableConcept.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9248    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
9249    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
9250    protected List<CodeableConcept> modifier;
9251
9252    /**
9253     * Identifies the program under which this may be recovered.
9254     */
9255    @Child(name = "programCode", type = {
9256        CodeableConcept.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9257    @Description(shortDefinition = "Program the product or service is provided under", formalDefinition = "Identifies the program under which this may be recovered.")
9258    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-program-code")
9259    protected List<CodeableConcept> programCode;
9260
9261    /**
9262     * The date or dates when the service or product was supplied, performed or
9263     * completed.
9264     */
9265    @Child(name = "serviced", type = { DateType.class,
9266        Period.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
9267    @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.")
9268    protected Type serviced;
9269
9270    /**
9271     * Where the product or service was provided.
9272     */
9273    @Child(name = "location", type = { CodeableConcept.class, Address.class,
9274        Location.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
9275    @Description(shortDefinition = "Place of service or where product was supplied", formalDefinition = "Where the product or service was provided.")
9276    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-place")
9277    protected Type location;
9278
9279    /**
9280     * The number of repetitions of a service or product.
9281     */
9282    @Child(name = "quantity", type = {
9283        Quantity.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
9284    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
9285    protected Quantity quantity;
9286
9287    /**
9288     * If the item is not a group then this is the fee for the product or service,
9289     * otherwise this is the total of the fees for the details of the group.
9290     */
9291    @Child(name = "unitPrice", type = { Money.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
9292    @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.")
9293    protected Money unitPrice;
9294
9295    /**
9296     * A real number that represents a multiplier used in determining the overall
9297     * value of services delivered and/or goods received. The concept of a Factor
9298     * allows for a discount or surcharge multiplier to be applied to a monetary
9299     * amount.
9300     */
9301    @Child(name = "factor", type = {
9302        DecimalType.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
9303    @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.")
9304    protected DecimalType factor;
9305
9306    /**
9307     * The quantity times the unit price for an additional service or product or
9308     * charge.
9309     */
9310    @Child(name = "net", type = { Money.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
9311    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
9312    protected Money net;
9313
9314    /**
9315     * Physical service site on the patient (limb, tooth, etc.).
9316     */
9317    @Child(name = "bodySite", type = {
9318        CodeableConcept.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
9319    @Description(shortDefinition = "Anatomical location", formalDefinition = "Physical service site on the patient (limb, tooth, etc.).")
9320    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/tooth")
9321    protected CodeableConcept bodySite;
9322
9323    /**
9324     * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
9325     */
9326    @Child(name = "subSite", type = {
9327        CodeableConcept.class }, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9328    @Description(shortDefinition = "Anatomical sub-location", formalDefinition = "A region or surface of the bodySite, e.g. limb region or tooth surface(s).")
9329    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/surface")
9330    protected List<CodeableConcept> subSite;
9331
9332    /**
9333     * The numbers associated with notes below which apply to the adjudication of
9334     * this item.
9335     */
9336    @Child(name = "noteNumber", type = {
9337        PositiveIntType.class }, order = 16, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9338    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
9339    protected List<PositiveIntType> noteNumber;
9340
9341    /**
9342     * The adjudication results.
9343     */
9344    @Child(name = "adjudication", type = {
9345        AdjudicationComponent.class }, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9346    @Description(shortDefinition = "Added items adjudication", formalDefinition = "The adjudication results.")
9347    protected List<AdjudicationComponent> adjudication;
9348
9349    /**
9350     * The second-tier service adjudications for payor added services.
9351     */
9352    @Child(name = "detail", type = {}, order = 18, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
9353    @Description(shortDefinition = "Insurer added line items", formalDefinition = "The second-tier service adjudications for payor added services.")
9354    protected List<AddedItemDetailComponent> detail;
9355
9356    private static final long serialVersionUID = -206524210L;
9357
9358    /**
9359     * Constructor
9360     */
9361    public AddedItemComponent() {
9362      super();
9363    }
9364
9365    /**
9366     * Constructor
9367     */
9368    public AddedItemComponent(CodeableConcept productOrService) {
9369      super();
9370      this.productOrService = productOrService;
9371    }
9372
9373    /**
9374     * @return {@link #itemSequence} (Claim items which this service line is
9375     *         intended to replace.)
9376     */
9377    public List<PositiveIntType> getItemSequence() {
9378      if (this.itemSequence == null)
9379        this.itemSequence = new ArrayList<PositiveIntType>();
9380      return this.itemSequence;
9381    }
9382
9383    /**
9384     * @return Returns a reference to <code>this</code> for easy method chaining
9385     */
9386    public AddedItemComponent setItemSequence(List<PositiveIntType> theItemSequence) {
9387      this.itemSequence = theItemSequence;
9388      return this;
9389    }
9390
9391    public boolean hasItemSequence() {
9392      if (this.itemSequence == null)
9393        return false;
9394      for (PositiveIntType item : this.itemSequence)
9395        if (!item.isEmpty())
9396          return true;
9397      return false;
9398    }
9399
9400    /**
9401     * @return {@link #itemSequence} (Claim items which this service line is
9402     *         intended to replace.)
9403     */
9404    public PositiveIntType addItemSequenceElement() {// 2
9405      PositiveIntType t = new PositiveIntType();
9406      if (this.itemSequence == null)
9407        this.itemSequence = new ArrayList<PositiveIntType>();
9408      this.itemSequence.add(t);
9409      return t;
9410    }
9411
9412    /**
9413     * @param value {@link #itemSequence} (Claim items which this service line is
9414     *              intended to replace.)
9415     */
9416    public AddedItemComponent addItemSequence(int value) { // 1
9417      PositiveIntType t = new PositiveIntType();
9418      t.setValue(value);
9419      if (this.itemSequence == null)
9420        this.itemSequence = new ArrayList<PositiveIntType>();
9421      this.itemSequence.add(t);
9422      return this;
9423    }
9424
9425    /**
9426     * @param value {@link #itemSequence} (Claim items which this service line is
9427     *              intended to replace.)
9428     */
9429    public boolean hasItemSequence(int value) {
9430      if (this.itemSequence == null)
9431        return false;
9432      for (PositiveIntType v : this.itemSequence)
9433        if (v.getValue().equals(value)) // positiveInt
9434          return true;
9435      return false;
9436    }
9437
9438    /**
9439     * @return {@link #detailSequence} (The sequence number of the details within
9440     *         the claim item which this line is intended to replace.)
9441     */
9442    public List<PositiveIntType> getDetailSequence() {
9443      if (this.detailSequence == null)
9444        this.detailSequence = new ArrayList<PositiveIntType>();
9445      return this.detailSequence;
9446    }
9447
9448    /**
9449     * @return Returns a reference to <code>this</code> for easy method chaining
9450     */
9451    public AddedItemComponent setDetailSequence(List<PositiveIntType> theDetailSequence) {
9452      this.detailSequence = theDetailSequence;
9453      return this;
9454    }
9455
9456    public boolean hasDetailSequence() {
9457      if (this.detailSequence == null)
9458        return false;
9459      for (PositiveIntType item : this.detailSequence)
9460        if (!item.isEmpty())
9461          return true;
9462      return false;
9463    }
9464
9465    /**
9466     * @return {@link #detailSequence} (The sequence number of the details within
9467     *         the claim item which this line is intended to replace.)
9468     */
9469    public PositiveIntType addDetailSequenceElement() {// 2
9470      PositiveIntType t = new PositiveIntType();
9471      if (this.detailSequence == null)
9472        this.detailSequence = new ArrayList<PositiveIntType>();
9473      this.detailSequence.add(t);
9474      return t;
9475    }
9476
9477    /**
9478     * @param value {@link #detailSequence} (The sequence number of the details
9479     *              within the claim item which this line is intended to replace.)
9480     */
9481    public AddedItemComponent addDetailSequence(int value) { // 1
9482      PositiveIntType t = new PositiveIntType();
9483      t.setValue(value);
9484      if (this.detailSequence == null)
9485        this.detailSequence = new ArrayList<PositiveIntType>();
9486      this.detailSequence.add(t);
9487      return this;
9488    }
9489
9490    /**
9491     * @param value {@link #detailSequence} (The sequence number of the details
9492     *              within the claim item which this line is intended to replace.)
9493     */
9494    public boolean hasDetailSequence(int value) {
9495      if (this.detailSequence == null)
9496        return false;
9497      for (PositiveIntType v : this.detailSequence)
9498        if (v.getValue().equals(value)) // positiveInt
9499          return true;
9500      return false;
9501    }
9502
9503    /**
9504     * @return {@link #subDetailSequence} (The sequence number of the sub-details
9505     *         woithin the details within the claim item which this line is intended
9506     *         to replace.)
9507     */
9508    public List<PositiveIntType> getSubDetailSequence() {
9509      if (this.subDetailSequence == null)
9510        this.subDetailSequence = new ArrayList<PositiveIntType>();
9511      return this.subDetailSequence;
9512    }
9513
9514    /**
9515     * @return Returns a reference to <code>this</code> for easy method chaining
9516     */
9517    public AddedItemComponent setSubDetailSequence(List<PositiveIntType> theSubDetailSequence) {
9518      this.subDetailSequence = theSubDetailSequence;
9519      return this;
9520    }
9521
9522    public boolean hasSubDetailSequence() {
9523      if (this.subDetailSequence == null)
9524        return false;
9525      for (PositiveIntType item : this.subDetailSequence)
9526        if (!item.isEmpty())
9527          return true;
9528      return false;
9529    }
9530
9531    /**
9532     * @return {@link #subDetailSequence} (The sequence number of the sub-details
9533     *         woithin the details within the claim item which this line is intended
9534     *         to replace.)
9535     */
9536    public PositiveIntType addSubDetailSequenceElement() {// 2
9537      PositiveIntType t = new PositiveIntType();
9538      if (this.subDetailSequence == null)
9539        this.subDetailSequence = new ArrayList<PositiveIntType>();
9540      this.subDetailSequence.add(t);
9541      return t;
9542    }
9543
9544    /**
9545     * @param value {@link #subDetailSequence} (The sequence number of the
9546     *              sub-details woithin the details within the claim item which this
9547     *              line is intended to replace.)
9548     */
9549    public AddedItemComponent addSubDetailSequence(int value) { // 1
9550      PositiveIntType t = new PositiveIntType();
9551      t.setValue(value);
9552      if (this.subDetailSequence == null)
9553        this.subDetailSequence = new ArrayList<PositiveIntType>();
9554      this.subDetailSequence.add(t);
9555      return this;
9556    }
9557
9558    /**
9559     * @param value {@link #subDetailSequence} (The sequence number of the
9560     *              sub-details woithin the details within the claim item which this
9561     *              line is intended to replace.)
9562     */
9563    public boolean hasSubDetailSequence(int value) {
9564      if (this.subDetailSequence == null)
9565        return false;
9566      for (PositiveIntType v : this.subDetailSequence)
9567        if (v.getValue().equals(value)) // positiveInt
9568          return true;
9569      return false;
9570    }
9571
9572    /**
9573     * @return {@link #provider} (The providers who are authorized for the services
9574     *         rendered to the patient.)
9575     */
9576    public List<Reference> getProvider() {
9577      if (this.provider == null)
9578        this.provider = new ArrayList<Reference>();
9579      return this.provider;
9580    }
9581
9582    /**
9583     * @return Returns a reference to <code>this</code> for easy method chaining
9584     */
9585    public AddedItemComponent setProvider(List<Reference> theProvider) {
9586      this.provider = theProvider;
9587      return this;
9588    }
9589
9590    public boolean hasProvider() {
9591      if (this.provider == null)
9592        return false;
9593      for (Reference item : this.provider)
9594        if (!item.isEmpty())
9595          return true;
9596      return false;
9597    }
9598
9599    public Reference addProvider() { // 3
9600      Reference t = new Reference();
9601      if (this.provider == null)
9602        this.provider = new ArrayList<Reference>();
9603      this.provider.add(t);
9604      return t;
9605    }
9606
9607    public AddedItemComponent addProvider(Reference t) { // 3
9608      if (t == null)
9609        return this;
9610      if (this.provider == null)
9611        this.provider = new ArrayList<Reference>();
9612      this.provider.add(t);
9613      return this;
9614    }
9615
9616    /**
9617     * @return The first repetition of repeating field {@link #provider}, creating
9618     *         it if it does not already exist
9619     */
9620    public Reference getProviderFirstRep() {
9621      if (getProvider().isEmpty()) {
9622        addProvider();
9623      }
9624      return getProvider().get(0);
9625    }
9626
9627    /**
9628     * @return {@link #productOrService} (When the value is a group code then this
9629     *         item collects a set of related claim details, otherwise this contains
9630     *         the product, service, drug or other billing code for the item.)
9631     */
9632    public CodeableConcept getProductOrService() {
9633      if (this.productOrService == null)
9634        if (Configuration.errorOnAutoCreate())
9635          throw new Error("Attempt to auto-create AddedItemComponent.productOrService");
9636        else if (Configuration.doAutoCreate())
9637          this.productOrService = new CodeableConcept(); // cc
9638      return this.productOrService;
9639    }
9640
9641    public boolean hasProductOrService() {
9642      return this.productOrService != null && !this.productOrService.isEmpty();
9643    }
9644
9645    /**
9646     * @param value {@link #productOrService} (When the value is a group code then
9647     *              this item collects a set of related claim details, otherwise
9648     *              this contains the product, service, drug or other billing code
9649     *              for the item.)
9650     */
9651    public AddedItemComponent setProductOrService(CodeableConcept value) {
9652      this.productOrService = value;
9653      return this;
9654    }
9655
9656    /**
9657     * @return {@link #modifier} (Item typification or modifiers codes to convey
9658     *         additional context for the product or service.)
9659     */
9660    public List<CodeableConcept> getModifier() {
9661      if (this.modifier == null)
9662        this.modifier = new ArrayList<CodeableConcept>();
9663      return this.modifier;
9664    }
9665
9666    /**
9667     * @return Returns a reference to <code>this</code> for easy method chaining
9668     */
9669    public AddedItemComponent setModifier(List<CodeableConcept> theModifier) {
9670      this.modifier = theModifier;
9671      return this;
9672    }
9673
9674    public boolean hasModifier() {
9675      if (this.modifier == null)
9676        return false;
9677      for (CodeableConcept item : this.modifier)
9678        if (!item.isEmpty())
9679          return true;
9680      return false;
9681    }
9682
9683    public CodeableConcept addModifier() { // 3
9684      CodeableConcept t = new CodeableConcept();
9685      if (this.modifier == null)
9686        this.modifier = new ArrayList<CodeableConcept>();
9687      this.modifier.add(t);
9688      return t;
9689    }
9690
9691    public AddedItemComponent addModifier(CodeableConcept t) { // 3
9692      if (t == null)
9693        return this;
9694      if (this.modifier == null)
9695        this.modifier = new ArrayList<CodeableConcept>();
9696      this.modifier.add(t);
9697      return this;
9698    }
9699
9700    /**
9701     * @return The first repetition of repeating field {@link #modifier}, creating
9702     *         it if it does not already exist
9703     */
9704    public CodeableConcept getModifierFirstRep() {
9705      if (getModifier().isEmpty()) {
9706        addModifier();
9707      }
9708      return getModifier().get(0);
9709    }
9710
9711    /**
9712     * @return {@link #programCode} (Identifies the program under which this may be
9713     *         recovered.)
9714     */
9715    public List<CodeableConcept> getProgramCode() {
9716      if (this.programCode == null)
9717        this.programCode = new ArrayList<CodeableConcept>();
9718      return this.programCode;
9719    }
9720
9721    /**
9722     * @return Returns a reference to <code>this</code> for easy method chaining
9723     */
9724    public AddedItemComponent setProgramCode(List<CodeableConcept> theProgramCode) {
9725      this.programCode = theProgramCode;
9726      return this;
9727    }
9728
9729    public boolean hasProgramCode() {
9730      if (this.programCode == null)
9731        return false;
9732      for (CodeableConcept item : this.programCode)
9733        if (!item.isEmpty())
9734          return true;
9735      return false;
9736    }
9737
9738    public CodeableConcept addProgramCode() { // 3
9739      CodeableConcept t = new CodeableConcept();
9740      if (this.programCode == null)
9741        this.programCode = new ArrayList<CodeableConcept>();
9742      this.programCode.add(t);
9743      return t;
9744    }
9745
9746    public AddedItemComponent addProgramCode(CodeableConcept t) { // 3
9747      if (t == null)
9748        return this;
9749      if (this.programCode == null)
9750        this.programCode = new ArrayList<CodeableConcept>();
9751      this.programCode.add(t);
9752      return this;
9753    }
9754
9755    /**
9756     * @return The first repetition of repeating field {@link #programCode},
9757     *         creating it if it does not already exist
9758     */
9759    public CodeableConcept getProgramCodeFirstRep() {
9760      if (getProgramCode().isEmpty()) {
9761        addProgramCode();
9762      }
9763      return getProgramCode().get(0);
9764    }
9765
9766    /**
9767     * @return {@link #serviced} (The date or dates when the service or product was
9768     *         supplied, performed or completed.)
9769     */
9770    public Type getServiced() {
9771      return this.serviced;
9772    }
9773
9774    /**
9775     * @return {@link #serviced} (The date or dates when the service or product was
9776     *         supplied, performed or completed.)
9777     */
9778    public DateType getServicedDateType() throws FHIRException {
9779      if (this.serviced == null)
9780        this.serviced = new DateType();
9781      if (!(this.serviced instanceof DateType))
9782        throw new FHIRException("Type mismatch: the type DateType was expected, but "
9783            + this.serviced.getClass().getName() + " was encountered");
9784      return (DateType) this.serviced;
9785    }
9786
9787    public boolean hasServicedDateType() {
9788        return this.serviced instanceof DateType;
9789    }
9790
9791    /**
9792     * @return {@link #serviced} (The date or dates when the service or product was
9793     *         supplied, performed or completed.)
9794     */
9795    public Period getServicedPeriod() throws FHIRException {
9796      if (this.serviced == null)
9797        this.serviced = new Period();
9798      if (!(this.serviced instanceof Period))
9799        throw new FHIRException("Type mismatch: the type Period was expected, but " + this.serviced.getClass().getName()
9800            + " was encountered");
9801      return (Period) this.serviced;
9802    }
9803
9804    public boolean hasServicedPeriod() {
9805        return this.serviced instanceof Period;
9806    }
9807
9808    public boolean hasServiced() {
9809      return this.serviced != null && !this.serviced.isEmpty();
9810    }
9811
9812    /**
9813     * @param value {@link #serviced} (The date or dates when the service or product
9814     *              was supplied, performed or completed.)
9815     */
9816    public AddedItemComponent setServiced(Type value) {
9817      if (value != null && !(value instanceof DateType || value instanceof Period))
9818        throw new Error("Not the right type for ExplanationOfBenefit.addItem.serviced[x]: " + value.fhirType());
9819      this.serviced = value;
9820      return this;
9821    }
9822
9823    /**
9824     * @return {@link #location} (Where the product or service was provided.)
9825     */
9826    public Type getLocation() {
9827      return this.location;
9828    }
9829
9830    /**
9831     * @return {@link #location} (Where the product or service was provided.)
9832     */
9833    public CodeableConcept getLocationCodeableConcept() throws FHIRException {
9834      if (this.location == null)
9835        this.location = new CodeableConcept();
9836      if (!(this.location instanceof CodeableConcept))
9837        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
9838            + this.location.getClass().getName() + " was encountered");
9839      return (CodeableConcept) this.location;
9840    }
9841
9842    public boolean hasLocationCodeableConcept() {
9843        return this.location instanceof CodeableConcept;
9844    }
9845
9846    /**
9847     * @return {@link #location} (Where the product or service was provided.)
9848     */
9849    public Address getLocationAddress() throws FHIRException {
9850      if (this.location == null)
9851        this.location = new Address();
9852      if (!(this.location instanceof Address))
9853        throw new FHIRException("Type mismatch: the type Address was expected, but "
9854            + this.location.getClass().getName() + " was encountered");
9855      return (Address) this.location;
9856    }
9857
9858    public boolean hasLocationAddress() {
9859        return this.location instanceof Address;
9860    }
9861
9862    /**
9863     * @return {@link #location} (Where the product or service was provided.)
9864     */
9865    public Reference getLocationReference() throws FHIRException {
9866      if (this.location == null)
9867        this.location = new Reference();
9868      if (!(this.location instanceof Reference))
9869        throw new FHIRException("Type mismatch: the type Reference was expected, but "
9870            + this.location.getClass().getName() + " was encountered");
9871      return (Reference) this.location;
9872    }
9873
9874    public boolean hasLocationReference() {
9875        return this.location instanceof Reference;
9876    }
9877
9878    public boolean hasLocation() {
9879      return this.location != null && !this.location.isEmpty();
9880    }
9881
9882    /**
9883     * @param value {@link #location} (Where the product or service was provided.)
9884     */
9885    public AddedItemComponent setLocation(Type value) {
9886      if (value != null
9887          && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
9888        throw new Error("Not the right type for ExplanationOfBenefit.addItem.location[x]: " + value.fhirType());
9889      this.location = value;
9890      return this;
9891    }
9892
9893    /**
9894     * @return {@link #quantity} (The number of repetitions of a service or
9895     *         product.)
9896     */
9897    public Quantity getQuantity() {
9898      if (this.quantity == null)
9899        if (Configuration.errorOnAutoCreate())
9900          throw new Error("Attempt to auto-create AddedItemComponent.quantity");
9901        else if (Configuration.doAutoCreate())
9902          this.quantity = new Quantity(); // cc
9903      return this.quantity;
9904    }
9905
9906    public boolean hasQuantity() {
9907      return this.quantity != null && !this.quantity.isEmpty();
9908    }
9909
9910    /**
9911     * @param value {@link #quantity} (The number of repetitions of a service or
9912     *              product.)
9913     */
9914    public AddedItemComponent setQuantity(Quantity value) {
9915      this.quantity = value;
9916      return this;
9917    }
9918
9919    /**
9920     * @return {@link #unitPrice} (If the item is not a group then this is the fee
9921     *         for the product or service, otherwise this is the total of the fees
9922     *         for the details of the group.)
9923     */
9924    public Money getUnitPrice() {
9925      if (this.unitPrice == null)
9926        if (Configuration.errorOnAutoCreate())
9927          throw new Error("Attempt to auto-create AddedItemComponent.unitPrice");
9928        else if (Configuration.doAutoCreate())
9929          this.unitPrice = new Money(); // cc
9930      return this.unitPrice;
9931    }
9932
9933    public boolean hasUnitPrice() {
9934      return this.unitPrice != null && !this.unitPrice.isEmpty();
9935    }
9936
9937    /**
9938     * @param value {@link #unitPrice} (If the item is not a group then this is the
9939     *              fee for the product or service, otherwise this is the total of
9940     *              the fees for the details of the group.)
9941     */
9942    public AddedItemComponent setUnitPrice(Money value) {
9943      this.unitPrice = value;
9944      return this;
9945    }
9946
9947    /**
9948     * @return {@link #factor} (A real number that represents a multiplier used in
9949     *         determining the overall value of services delivered and/or goods
9950     *         received. The concept of a Factor allows for a discount or surcharge
9951     *         multiplier to be applied to a monetary amount.). This is the
9952     *         underlying object with id, value and extensions. The accessor
9953     *         "getFactor" gives direct access to the value
9954     */
9955    public DecimalType getFactorElement() {
9956      if (this.factor == null)
9957        if (Configuration.errorOnAutoCreate())
9958          throw new Error("Attempt to auto-create AddedItemComponent.factor");
9959        else if (Configuration.doAutoCreate())
9960          this.factor = new DecimalType(); // bb
9961      return this.factor;
9962    }
9963
9964    public boolean hasFactorElement() {
9965      return this.factor != null && !this.factor.isEmpty();
9966    }
9967
9968    public boolean hasFactor() {
9969      return this.factor != null && !this.factor.isEmpty();
9970    }
9971
9972    /**
9973     * @param value {@link #factor} (A real number that represents a multiplier used
9974     *              in determining the overall value of services delivered and/or
9975     *              goods received. The concept of a Factor allows for a discount or
9976     *              surcharge multiplier to be applied to a monetary amount.). This
9977     *              is the underlying object with id, value and extensions. The
9978     *              accessor "getFactor" gives direct access to the value
9979     */
9980    public AddedItemComponent setFactorElement(DecimalType value) {
9981      this.factor = value;
9982      return this;
9983    }
9984
9985    /**
9986     * @return A real number that represents a multiplier used in determining the
9987     *         overall value of services delivered and/or goods received. The
9988     *         concept of a Factor allows for a discount or surcharge multiplier to
9989     *         be applied to a monetary amount.
9990     */
9991    public BigDecimal getFactor() {
9992      return this.factor == null ? null : this.factor.getValue();
9993    }
9994
9995    /**
9996     * @param value A real number that represents a multiplier used in determining
9997     *              the overall value of services delivered and/or goods received.
9998     *              The concept of a Factor allows for a discount or surcharge
9999     *              multiplier to be applied to a monetary amount.
10000     */
10001    public AddedItemComponent setFactor(BigDecimal value) {
10002      if (value == null)
10003        this.factor = null;
10004      else {
10005        if (this.factor == null)
10006          this.factor = new DecimalType();
10007        this.factor.setValue(value);
10008      }
10009      return this;
10010    }
10011
10012    /**
10013     * @param value A real number that represents a multiplier used in determining
10014     *              the overall value of services delivered and/or goods received.
10015     *              The concept of a Factor allows for a discount or surcharge
10016     *              multiplier to be applied to a monetary amount.
10017     */
10018    public AddedItemComponent setFactor(long value) {
10019      this.factor = new DecimalType();
10020      this.factor.setValue(value);
10021      return this;
10022    }
10023
10024    /**
10025     * @param value A real number that represents a multiplier used in determining
10026     *              the overall value of services delivered and/or goods received.
10027     *              The concept of a Factor allows for a discount or surcharge
10028     *              multiplier to be applied to a monetary amount.
10029     */
10030    public AddedItemComponent setFactor(double value) {
10031      this.factor = new DecimalType();
10032      this.factor.setValue(value);
10033      return this;
10034    }
10035
10036    /**
10037     * @return {@link #net} (The quantity times the unit price for an additional
10038     *         service or product or charge.)
10039     */
10040    public Money getNet() {
10041      if (this.net == null)
10042        if (Configuration.errorOnAutoCreate())
10043          throw new Error("Attempt to auto-create AddedItemComponent.net");
10044        else if (Configuration.doAutoCreate())
10045          this.net = new Money(); // cc
10046      return this.net;
10047    }
10048
10049    public boolean hasNet() {
10050      return this.net != null && !this.net.isEmpty();
10051    }
10052
10053    /**
10054     * @param value {@link #net} (The quantity times the unit price for an
10055     *              additional service or product or charge.)
10056     */
10057    public AddedItemComponent setNet(Money value) {
10058      this.net = value;
10059      return this;
10060    }
10061
10062    /**
10063     * @return {@link #bodySite} (Physical service site on the patient (limb, tooth,
10064     *         etc.).)
10065     */
10066    public CodeableConcept getBodySite() {
10067      if (this.bodySite == null)
10068        if (Configuration.errorOnAutoCreate())
10069          throw new Error("Attempt to auto-create AddedItemComponent.bodySite");
10070        else if (Configuration.doAutoCreate())
10071          this.bodySite = new CodeableConcept(); // cc
10072      return this.bodySite;
10073    }
10074
10075    public boolean hasBodySite() {
10076      return this.bodySite != null && !this.bodySite.isEmpty();
10077    }
10078
10079    /**
10080     * @param value {@link #bodySite} (Physical service site on the patient (limb,
10081     *              tooth, etc.).)
10082     */
10083    public AddedItemComponent setBodySite(CodeableConcept value) {
10084      this.bodySite = value;
10085      return this;
10086    }
10087
10088    /**
10089     * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb
10090     *         region or tooth surface(s).)
10091     */
10092    public List<CodeableConcept> getSubSite() {
10093      if (this.subSite == null)
10094        this.subSite = new ArrayList<CodeableConcept>();
10095      return this.subSite;
10096    }
10097
10098    /**
10099     * @return Returns a reference to <code>this</code> for easy method chaining
10100     */
10101    public AddedItemComponent setSubSite(List<CodeableConcept> theSubSite) {
10102      this.subSite = theSubSite;
10103      return this;
10104    }
10105
10106    public boolean hasSubSite() {
10107      if (this.subSite == null)
10108        return false;
10109      for (CodeableConcept item : this.subSite)
10110        if (!item.isEmpty())
10111          return true;
10112      return false;
10113    }
10114
10115    public CodeableConcept addSubSite() { // 3
10116      CodeableConcept t = new CodeableConcept();
10117      if (this.subSite == null)
10118        this.subSite = new ArrayList<CodeableConcept>();
10119      this.subSite.add(t);
10120      return t;
10121    }
10122
10123    public AddedItemComponent addSubSite(CodeableConcept t) { // 3
10124      if (t == null)
10125        return this;
10126      if (this.subSite == null)
10127        this.subSite = new ArrayList<CodeableConcept>();
10128      this.subSite.add(t);
10129      return this;
10130    }
10131
10132    /**
10133     * @return The first repetition of repeating field {@link #subSite}, creating it
10134     *         if it does not already exist
10135     */
10136    public CodeableConcept getSubSiteFirstRep() {
10137      if (getSubSite().isEmpty()) {
10138        addSubSite();
10139      }
10140      return getSubSite().get(0);
10141    }
10142
10143    /**
10144     * @return {@link #noteNumber} (The numbers associated with notes below which
10145     *         apply to the adjudication of this item.)
10146     */
10147    public List<PositiveIntType> getNoteNumber() {
10148      if (this.noteNumber == null)
10149        this.noteNumber = new ArrayList<PositiveIntType>();
10150      return this.noteNumber;
10151    }
10152
10153    /**
10154     * @return Returns a reference to <code>this</code> for easy method chaining
10155     */
10156    public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
10157      this.noteNumber = theNoteNumber;
10158      return this;
10159    }
10160
10161    public boolean hasNoteNumber() {
10162      if (this.noteNumber == null)
10163        return false;
10164      for (PositiveIntType item : this.noteNumber)
10165        if (!item.isEmpty())
10166          return true;
10167      return false;
10168    }
10169
10170    /**
10171     * @return {@link #noteNumber} (The numbers associated with notes below which
10172     *         apply to the adjudication of this item.)
10173     */
10174    public PositiveIntType addNoteNumberElement() {// 2
10175      PositiveIntType t = new PositiveIntType();
10176      if (this.noteNumber == null)
10177        this.noteNumber = new ArrayList<PositiveIntType>();
10178      this.noteNumber.add(t);
10179      return t;
10180    }
10181
10182    /**
10183     * @param value {@link #noteNumber} (The numbers associated with notes below
10184     *              which apply to the adjudication of this item.)
10185     */
10186    public AddedItemComponent addNoteNumber(int value) { // 1
10187      PositiveIntType t = new PositiveIntType();
10188      t.setValue(value);
10189      if (this.noteNumber == null)
10190        this.noteNumber = new ArrayList<PositiveIntType>();
10191      this.noteNumber.add(t);
10192      return this;
10193    }
10194
10195    /**
10196     * @param value {@link #noteNumber} (The numbers associated with notes below
10197     *              which apply to the adjudication of this item.)
10198     */
10199    public boolean hasNoteNumber(int value) {
10200      if (this.noteNumber == null)
10201        return false;
10202      for (PositiveIntType v : this.noteNumber)
10203        if (v.getValue().equals(value)) // positiveInt
10204          return true;
10205      return false;
10206    }
10207
10208    /**
10209     * @return {@link #adjudication} (The adjudication results.)
10210     */
10211    public List<AdjudicationComponent> getAdjudication() {
10212      if (this.adjudication == null)
10213        this.adjudication = new ArrayList<AdjudicationComponent>();
10214      return this.adjudication;
10215    }
10216
10217    /**
10218     * @return Returns a reference to <code>this</code> for easy method chaining
10219     */
10220    public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
10221      this.adjudication = theAdjudication;
10222      return this;
10223    }
10224
10225    public boolean hasAdjudication() {
10226      if (this.adjudication == null)
10227        return false;
10228      for (AdjudicationComponent item : this.adjudication)
10229        if (!item.isEmpty())
10230          return true;
10231      return false;
10232    }
10233
10234    public AdjudicationComponent addAdjudication() { // 3
10235      AdjudicationComponent t = new AdjudicationComponent();
10236      if (this.adjudication == null)
10237        this.adjudication = new ArrayList<AdjudicationComponent>();
10238      this.adjudication.add(t);
10239      return t;
10240    }
10241
10242    public AddedItemComponent addAdjudication(AdjudicationComponent t) { // 3
10243      if (t == null)
10244        return this;
10245      if (this.adjudication == null)
10246        this.adjudication = new ArrayList<AdjudicationComponent>();
10247      this.adjudication.add(t);
10248      return this;
10249    }
10250
10251    /**
10252     * @return The first repetition of repeating field {@link #adjudication},
10253     *         creating it if it does not already exist
10254     */
10255    public AdjudicationComponent getAdjudicationFirstRep() {
10256      if (getAdjudication().isEmpty()) {
10257        addAdjudication();
10258      }
10259      return getAdjudication().get(0);
10260    }
10261
10262    /**
10263     * @return {@link #detail} (The second-tier service adjudications for payor
10264     *         added services.)
10265     */
10266    public List<AddedItemDetailComponent> getDetail() {
10267      if (this.detail == null)
10268        this.detail = new ArrayList<AddedItemDetailComponent>();
10269      return this.detail;
10270    }
10271
10272    /**
10273     * @return Returns a reference to <code>this</code> for easy method chaining
10274     */
10275    public AddedItemComponent setDetail(List<AddedItemDetailComponent> theDetail) {
10276      this.detail = theDetail;
10277      return this;
10278    }
10279
10280    public boolean hasDetail() {
10281      if (this.detail == null)
10282        return false;
10283      for (AddedItemDetailComponent item : this.detail)
10284        if (!item.isEmpty())
10285          return true;
10286      return false;
10287    }
10288
10289    public AddedItemDetailComponent addDetail() { // 3
10290      AddedItemDetailComponent t = new AddedItemDetailComponent();
10291      if (this.detail == null)
10292        this.detail = new ArrayList<AddedItemDetailComponent>();
10293      this.detail.add(t);
10294      return t;
10295    }
10296
10297    public AddedItemComponent addDetail(AddedItemDetailComponent t) { // 3
10298      if (t == null)
10299        return this;
10300      if (this.detail == null)
10301        this.detail = new ArrayList<AddedItemDetailComponent>();
10302      this.detail.add(t);
10303      return this;
10304    }
10305
10306    /**
10307     * @return The first repetition of repeating field {@link #detail}, creating it
10308     *         if it does not already exist
10309     */
10310    public AddedItemDetailComponent getDetailFirstRep() {
10311      if (getDetail().isEmpty()) {
10312        addDetail();
10313      }
10314      return getDetail().get(0);
10315    }
10316
10317    protected void listChildren(List<Property> children) {
10318      super.listChildren(children);
10319      children.add(new Property("itemSequence", "positiveInt",
10320          "Claim items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, itemSequence));
10321      children.add(new Property("detailSequence", "positiveInt",
10322          "The sequence number of the details within the claim item which this line is intended to replace.", 0,
10323          java.lang.Integer.MAX_VALUE, detailSequence));
10324      children.add(new Property("subDetailSequence", "positiveInt",
10325          "The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.",
10326          0, java.lang.Integer.MAX_VALUE, subDetailSequence));
10327      children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
10328          "The providers who are authorized for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE,
10329          provider));
10330      children.add(new Property("productOrService", "CodeableConcept",
10331          "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.",
10332          0, 1, productOrService));
10333      children.add(new Property("modifier", "CodeableConcept",
10334          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
10335          java.lang.Integer.MAX_VALUE, modifier));
10336      children.add(new Property("programCode", "CodeableConcept",
10337          "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
10338      children.add(new Property("serviced[x]", "date|Period",
10339          "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced));
10340      children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
10341          "Where the product or service was provided.", 0, 1, location));
10342      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
10343          1, quantity));
10344      children.add(new Property("unitPrice", "Money",
10345          "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.",
10346          0, 1, unitPrice));
10347      children.add(new Property("factor", "decimal",
10348          "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.",
10349          0, 1, factor));
10350      children.add(new Property("net", "Money",
10351          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
10352      children.add(new Property("bodySite", "CodeableConcept",
10353          "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
10354      children.add(new Property("subSite", "CodeableConcept",
10355          "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE,
10356          subSite));
10357      children.add(new Property("noteNumber", "positiveInt",
10358          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
10359          java.lang.Integer.MAX_VALUE, noteNumber));
10360      children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.",
10361          0, java.lang.Integer.MAX_VALUE, adjudication));
10362      children.add(new Property("detail", "", "The second-tier service adjudications for payor added services.", 0,
10363          java.lang.Integer.MAX_VALUE, detail));
10364    }
10365
10366    @Override
10367    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
10368      switch (_hash) {
10369      case 1977979892:
10370        /* itemSequence */ return new Property("itemSequence", "positiveInt",
10371            "Claim items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE,
10372            itemSequence);
10373      case 1321472818:
10374        /* detailSequence */ return new Property("detailSequence", "positiveInt",
10375            "The sequence number of the details within the claim item which this line is intended to replace.", 0,
10376            java.lang.Integer.MAX_VALUE, detailSequence);
10377      case -855462510:
10378        /* subDetailSequence */ return new Property("subDetailSequence", "positiveInt",
10379            "The sequence number of the sub-details woithin the details within the claim item which this line is intended to replace.",
10380            0, java.lang.Integer.MAX_VALUE, subDetailSequence);
10381      case -987494927:
10382        /* provider */ return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
10383            "The providers who are authorized for the services rendered to the patient.", 0,
10384            java.lang.Integer.MAX_VALUE, provider);
10385      case 1957227299:
10386        /* productOrService */ return new Property("productOrService", "CodeableConcept",
10387            "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.",
10388            0, 1, productOrService);
10389      case -615513385:
10390        /* modifier */ return new Property("modifier", "CodeableConcept",
10391            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
10392            java.lang.Integer.MAX_VALUE, modifier);
10393      case 1010065041:
10394        /* programCode */ return new Property("programCode", "CodeableConcept",
10395            "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
10396      case -1927922223:
10397        /* serviced[x] */ return new Property("serviced[x]", "date|Period",
10398            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
10399      case 1379209295:
10400        /* serviced */ return new Property("serviced[x]", "date|Period",
10401            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
10402      case 363246749:
10403        /* servicedDate */ return new Property("serviced[x]", "date|Period",
10404            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
10405      case 1534966512:
10406        /* servicedPeriod */ return new Property("serviced[x]", "date|Period",
10407            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
10408      case 552316075:
10409        /* location[x] */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
10410            "Where the product or service was provided.", 0, 1, location);
10411      case 1901043637:
10412        /* location */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
10413            "Where the product or service was provided.", 0, 1, location);
10414      case -1224800468:
10415        /* locationCodeableConcept */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
10416            "Where the product or service was provided.", 0, 1, location);
10417      case -1280020865:
10418        /* locationAddress */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
10419            "Where the product or service was provided.", 0, 1, location);
10420      case 755866390:
10421        /* locationReference */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
10422            "Where the product or service was provided.", 0, 1, location);
10423      case -1285004149:
10424        /* quantity */ return new Property("quantity", "SimpleQuantity",
10425            "The number of repetitions of a service or product.", 0, 1, quantity);
10426      case -486196699:
10427        /* unitPrice */ return new Property("unitPrice", "Money",
10428            "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.",
10429            0, 1, unitPrice);
10430      case -1282148017:
10431        /* factor */ return new Property("factor", "decimal",
10432            "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.",
10433            0, 1, factor);
10434      case 108957:
10435        /* net */ return new Property("net", "Money",
10436            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
10437      case 1702620169:
10438        /* bodySite */ return new Property("bodySite", "CodeableConcept",
10439            "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
10440      case -1868566105:
10441        /* subSite */ return new Property("subSite", "CodeableConcept",
10442            "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0,
10443            java.lang.Integer.MAX_VALUE, subSite);
10444      case -1110033957:
10445        /* noteNumber */ return new Property("noteNumber", "positiveInt",
10446            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
10447            java.lang.Integer.MAX_VALUE, noteNumber);
10448      case -231349275:
10449        /* adjudication */ return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
10450            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
10451      case -1335224239:
10452        /* detail */ return new Property("detail", "",
10453            "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail);
10454      default:
10455        return super.getNamedProperty(_hash, _name, _checkValid);
10456      }
10457
10458    }
10459
10460    @Override
10461    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10462      switch (hash) {
10463      case 1977979892:
10464        /* itemSequence */ return this.itemSequence == null ? new Base[0]
10465            : this.itemSequence.toArray(new Base[this.itemSequence.size()]); // PositiveIntType
10466      case 1321472818:
10467        /* detailSequence */ return this.detailSequence == null ? new Base[0]
10468            : this.detailSequence.toArray(new Base[this.detailSequence.size()]); // PositiveIntType
10469      case -855462510:
10470        /* subDetailSequence */ return this.subDetailSequence == null ? new Base[0]
10471            : this.subDetailSequence.toArray(new Base[this.subDetailSequence.size()]); // PositiveIntType
10472      case -987494927:
10473        /* provider */ return this.provider == null ? new Base[0]
10474            : this.provider.toArray(new Base[this.provider.size()]); // Reference
10475      case 1957227299:
10476        /* productOrService */ return this.productOrService == null ? new Base[0]
10477            : new Base[] { this.productOrService }; // CodeableConcept
10478      case -615513385:
10479        /* modifier */ return this.modifier == null ? new Base[0]
10480            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
10481      case 1010065041:
10482        /* programCode */ return this.programCode == null ? new Base[0]
10483            : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
10484      case 1379209295:
10485        /* serviced */ return this.serviced == null ? new Base[0] : new Base[] { this.serviced }; // Type
10486      case 1901043637:
10487        /* location */ return this.location == null ? new Base[0] : new Base[] { this.location }; // Type
10488      case -1285004149:
10489        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
10490      case -486196699:
10491        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
10492      case -1282148017:
10493        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
10494      case 108957:
10495        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
10496      case 1702620169:
10497        /* bodySite */ return this.bodySite == null ? new Base[0] : new Base[] { this.bodySite }; // CodeableConcept
10498      case -1868566105:
10499        /* subSite */ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
10500      case -1110033957:
10501        /* noteNumber */ return this.noteNumber == null ? new Base[0]
10502            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
10503      case -231349275:
10504        /* adjudication */ return this.adjudication == null ? new Base[0]
10505            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
10506      case -1335224239:
10507        /* detail */ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemDetailComponent
10508      default:
10509        return super.getProperty(hash, name, checkValid);
10510      }
10511
10512    }
10513
10514    @Override
10515    public Base setProperty(int hash, String name, Base value) throws FHIRException {
10516      switch (hash) {
10517      case 1977979892: // itemSequence
10518        this.getItemSequence().add(castToPositiveInt(value)); // PositiveIntType
10519        return value;
10520      case 1321472818: // detailSequence
10521        this.getDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
10522        return value;
10523      case -855462510: // subDetailSequence
10524        this.getSubDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
10525        return value;
10526      case -987494927: // provider
10527        this.getProvider().add(castToReference(value)); // Reference
10528        return value;
10529      case 1957227299: // productOrService
10530        this.productOrService = castToCodeableConcept(value); // CodeableConcept
10531        return value;
10532      case -615513385: // modifier
10533        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
10534        return value;
10535      case 1010065041: // programCode
10536        this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
10537        return value;
10538      case 1379209295: // serviced
10539        this.serviced = castToType(value); // Type
10540        return value;
10541      case 1901043637: // location
10542        this.location = castToType(value); // Type
10543        return value;
10544      case -1285004149: // quantity
10545        this.quantity = castToQuantity(value); // Quantity
10546        return value;
10547      case -486196699: // unitPrice
10548        this.unitPrice = castToMoney(value); // Money
10549        return value;
10550      case -1282148017: // factor
10551        this.factor = castToDecimal(value); // DecimalType
10552        return value;
10553      case 108957: // net
10554        this.net = castToMoney(value); // Money
10555        return value;
10556      case 1702620169: // bodySite
10557        this.bodySite = castToCodeableConcept(value); // CodeableConcept
10558        return value;
10559      case -1868566105: // subSite
10560        this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
10561        return value;
10562      case -1110033957: // noteNumber
10563        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
10564        return value;
10565      case -231349275: // adjudication
10566        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
10567        return value;
10568      case -1335224239: // detail
10569        this.getDetail().add((AddedItemDetailComponent) value); // AddedItemDetailComponent
10570        return value;
10571      default:
10572        return super.setProperty(hash, name, value);
10573      }
10574
10575    }
10576
10577    @Override
10578    public Base setProperty(String name, Base value) throws FHIRException {
10579      if (name.equals("itemSequence")) {
10580        this.getItemSequence().add(castToPositiveInt(value));
10581      } else if (name.equals("detailSequence")) {
10582        this.getDetailSequence().add(castToPositiveInt(value));
10583      } else if (name.equals("subDetailSequence")) {
10584        this.getSubDetailSequence().add(castToPositiveInt(value));
10585      } else if (name.equals("provider")) {
10586        this.getProvider().add(castToReference(value));
10587      } else if (name.equals("productOrService")) {
10588        this.productOrService = castToCodeableConcept(value); // CodeableConcept
10589      } else if (name.equals("modifier")) {
10590        this.getModifier().add(castToCodeableConcept(value));
10591      } else if (name.equals("programCode")) {
10592        this.getProgramCode().add(castToCodeableConcept(value));
10593      } else if (name.equals("serviced[x]")) {
10594        this.serviced = castToType(value); // Type
10595      } else if (name.equals("location[x]")) {
10596        this.location = castToType(value); // Type
10597      } else if (name.equals("quantity")) {
10598        this.quantity = castToQuantity(value); // Quantity
10599      } else if (name.equals("unitPrice")) {
10600        this.unitPrice = castToMoney(value); // Money
10601      } else if (name.equals("factor")) {
10602        this.factor = castToDecimal(value); // DecimalType
10603      } else if (name.equals("net")) {
10604        this.net = castToMoney(value); // Money
10605      } else if (name.equals("bodySite")) {
10606        this.bodySite = castToCodeableConcept(value); // CodeableConcept
10607      } else if (name.equals("subSite")) {
10608        this.getSubSite().add(castToCodeableConcept(value));
10609      } else if (name.equals("noteNumber")) {
10610        this.getNoteNumber().add(castToPositiveInt(value));
10611      } else if (name.equals("adjudication")) {
10612        this.getAdjudication().add((AdjudicationComponent) value);
10613      } else if (name.equals("detail")) {
10614        this.getDetail().add((AddedItemDetailComponent) value);
10615      } else
10616        return super.setProperty(name, value);
10617      return value;
10618    }
10619
10620  @Override
10621  public void removeChild(String name, Base value) throws FHIRException {
10622      if (name.equals("itemSequence")) {
10623        this.getItemSequence().remove(castToPositiveInt(value));
10624      } else if (name.equals("detailSequence")) {
10625        this.getDetailSequence().remove(castToPositiveInt(value));
10626      } else if (name.equals("subDetailSequence")) {
10627        this.getSubDetailSequence().remove(castToPositiveInt(value));
10628      } else if (name.equals("provider")) {
10629        this.getProvider().remove(castToReference(value));
10630      } else if (name.equals("productOrService")) {
10631        this.productOrService = null;
10632      } else if (name.equals("modifier")) {
10633        this.getModifier().remove(castToCodeableConcept(value));
10634      } else if (name.equals("programCode")) {
10635        this.getProgramCode().remove(castToCodeableConcept(value));
10636      } else if (name.equals("serviced[x]")) {
10637        this.serviced = null;
10638      } else if (name.equals("location[x]")) {
10639        this.location = null;
10640      } else if (name.equals("quantity")) {
10641        this.quantity = null;
10642      } else if (name.equals("unitPrice")) {
10643        this.unitPrice = null;
10644      } else if (name.equals("factor")) {
10645        this.factor = null;
10646      } else if (name.equals("net")) {
10647        this.net = null;
10648      } else if (name.equals("bodySite")) {
10649        this.bodySite = null;
10650      } else if (name.equals("subSite")) {
10651        this.getSubSite().remove(castToCodeableConcept(value));
10652      } else if (name.equals("noteNumber")) {
10653        this.getNoteNumber().remove(castToPositiveInt(value));
10654      } else if (name.equals("adjudication")) {
10655        this.getAdjudication().remove((AdjudicationComponent) value);
10656      } else if (name.equals("detail")) {
10657        this.getDetail().remove((AddedItemDetailComponent) value);
10658      } else
10659        super.removeChild(name, value);
10660      
10661    }
10662
10663    @Override
10664    public Base makeProperty(int hash, String name) throws FHIRException {
10665      switch (hash) {
10666      case 1977979892:
10667        return addItemSequenceElement();
10668      case 1321472818:
10669        return addDetailSequenceElement();
10670      case -855462510:
10671        return addSubDetailSequenceElement();
10672      case -987494927:
10673        return addProvider();
10674      case 1957227299:
10675        return getProductOrService();
10676      case -615513385:
10677        return addModifier();
10678      case 1010065041:
10679        return addProgramCode();
10680      case -1927922223:
10681        return getServiced();
10682      case 1379209295:
10683        return getServiced();
10684      case 552316075:
10685        return getLocation();
10686      case 1901043637:
10687        return getLocation();
10688      case -1285004149:
10689        return getQuantity();
10690      case -486196699:
10691        return getUnitPrice();
10692      case -1282148017:
10693        return getFactorElement();
10694      case 108957:
10695        return getNet();
10696      case 1702620169:
10697        return getBodySite();
10698      case -1868566105:
10699        return addSubSite();
10700      case -1110033957:
10701        return addNoteNumberElement();
10702      case -231349275:
10703        return addAdjudication();
10704      case -1335224239:
10705        return addDetail();
10706      default:
10707        return super.makeProperty(hash, name);
10708      }
10709
10710    }
10711
10712    @Override
10713    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10714      switch (hash) {
10715      case 1977979892:
10716        /* itemSequence */ return new String[] { "positiveInt" };
10717      case 1321472818:
10718        /* detailSequence */ return new String[] { "positiveInt" };
10719      case -855462510:
10720        /* subDetailSequence */ return new String[] { "positiveInt" };
10721      case -987494927:
10722        /* provider */ return new String[] { "Reference" };
10723      case 1957227299:
10724        /* productOrService */ return new String[] { "CodeableConcept" };
10725      case -615513385:
10726        /* modifier */ return new String[] { "CodeableConcept" };
10727      case 1010065041:
10728        /* programCode */ return new String[] { "CodeableConcept" };
10729      case 1379209295:
10730        /* serviced */ return new String[] { "date", "Period" };
10731      case 1901043637:
10732        /* location */ return new String[] { "CodeableConcept", "Address", "Reference" };
10733      case -1285004149:
10734        /* quantity */ return new String[] { "SimpleQuantity" };
10735      case -486196699:
10736        /* unitPrice */ return new String[] { "Money" };
10737      case -1282148017:
10738        /* factor */ return new String[] { "decimal" };
10739      case 108957:
10740        /* net */ return new String[] { "Money" };
10741      case 1702620169:
10742        /* bodySite */ return new String[] { "CodeableConcept" };
10743      case -1868566105:
10744        /* subSite */ return new String[] { "CodeableConcept" };
10745      case -1110033957:
10746        /* noteNumber */ return new String[] { "positiveInt" };
10747      case -231349275:
10748        /* adjudication */ return new String[] { "@ExplanationOfBenefit.item.adjudication" };
10749      case -1335224239:
10750        /* detail */ return new String[] {};
10751      default:
10752        return super.getTypesForProperty(hash, name);
10753      }
10754
10755    }
10756
10757    @Override
10758    public Base addChild(String name) throws FHIRException {
10759      if (name.equals("itemSequence")) {
10760        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.itemSequence");
10761      } else if (name.equals("detailSequence")) {
10762        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.detailSequence");
10763      } else if (name.equals("subDetailSequence")) {
10764        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.subDetailSequence");
10765      } else if (name.equals("provider")) {
10766        return addProvider();
10767      } else if (name.equals("productOrService")) {
10768        this.productOrService = new CodeableConcept();
10769        return this.productOrService;
10770      } else if (name.equals("modifier")) {
10771        return addModifier();
10772      } else if (name.equals("programCode")) {
10773        return addProgramCode();
10774      } else if (name.equals("servicedDate")) {
10775        this.serviced = new DateType();
10776        return this.serviced;
10777      } else if (name.equals("servicedPeriod")) {
10778        this.serviced = new Period();
10779        return this.serviced;
10780      } else if (name.equals("locationCodeableConcept")) {
10781        this.location = new CodeableConcept();
10782        return this.location;
10783      } else if (name.equals("locationAddress")) {
10784        this.location = new Address();
10785        return this.location;
10786      } else if (name.equals("locationReference")) {
10787        this.location = new Reference();
10788        return this.location;
10789      } else if (name.equals("quantity")) {
10790        this.quantity = new Quantity();
10791        return this.quantity;
10792      } else if (name.equals("unitPrice")) {
10793        this.unitPrice = new Money();
10794        return this.unitPrice;
10795      } else if (name.equals("factor")) {
10796        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
10797      } else if (name.equals("net")) {
10798        this.net = new Money();
10799        return this.net;
10800      } else if (name.equals("bodySite")) {
10801        this.bodySite = new CodeableConcept();
10802        return this.bodySite;
10803      } else if (name.equals("subSite")) {
10804        return addSubSite();
10805      } else if (name.equals("noteNumber")) {
10806        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
10807      } else if (name.equals("adjudication")) {
10808        return addAdjudication();
10809      } else if (name.equals("detail")) {
10810        return addDetail();
10811      } else
10812        return super.addChild(name);
10813    }
10814
10815    public AddedItemComponent copy() {
10816      AddedItemComponent dst = new AddedItemComponent();
10817      copyValues(dst);
10818      return dst;
10819    }
10820
10821    public void copyValues(AddedItemComponent dst) {
10822      super.copyValues(dst);
10823      if (itemSequence != null) {
10824        dst.itemSequence = new ArrayList<PositiveIntType>();
10825        for (PositiveIntType i : itemSequence)
10826          dst.itemSequence.add(i.copy());
10827      }
10828      ;
10829      if (detailSequence != null) {
10830        dst.detailSequence = new ArrayList<PositiveIntType>();
10831        for (PositiveIntType i : detailSequence)
10832          dst.detailSequence.add(i.copy());
10833      }
10834      ;
10835      if (subDetailSequence != null) {
10836        dst.subDetailSequence = new ArrayList<PositiveIntType>();
10837        for (PositiveIntType i : subDetailSequence)
10838          dst.subDetailSequence.add(i.copy());
10839      }
10840      ;
10841      if (provider != null) {
10842        dst.provider = new ArrayList<Reference>();
10843        for (Reference i : provider)
10844          dst.provider.add(i.copy());
10845      }
10846      ;
10847      dst.productOrService = productOrService == null ? null : productOrService.copy();
10848      if (modifier != null) {
10849        dst.modifier = new ArrayList<CodeableConcept>();
10850        for (CodeableConcept i : modifier)
10851          dst.modifier.add(i.copy());
10852      }
10853      ;
10854      if (programCode != null) {
10855        dst.programCode = new ArrayList<CodeableConcept>();
10856        for (CodeableConcept i : programCode)
10857          dst.programCode.add(i.copy());
10858      }
10859      ;
10860      dst.serviced = serviced == null ? null : serviced.copy();
10861      dst.location = location == null ? null : location.copy();
10862      dst.quantity = quantity == null ? null : quantity.copy();
10863      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
10864      dst.factor = factor == null ? null : factor.copy();
10865      dst.net = net == null ? null : net.copy();
10866      dst.bodySite = bodySite == null ? null : bodySite.copy();
10867      if (subSite != null) {
10868        dst.subSite = new ArrayList<CodeableConcept>();
10869        for (CodeableConcept i : subSite)
10870          dst.subSite.add(i.copy());
10871      }
10872      ;
10873      if (noteNumber != null) {
10874        dst.noteNumber = new ArrayList<PositiveIntType>();
10875        for (PositiveIntType i : noteNumber)
10876          dst.noteNumber.add(i.copy());
10877      }
10878      ;
10879      if (adjudication != null) {
10880        dst.adjudication = new ArrayList<AdjudicationComponent>();
10881        for (AdjudicationComponent i : adjudication)
10882          dst.adjudication.add(i.copy());
10883      }
10884      ;
10885      if (detail != null) {
10886        dst.detail = new ArrayList<AddedItemDetailComponent>();
10887        for (AddedItemDetailComponent i : detail)
10888          dst.detail.add(i.copy());
10889      }
10890      ;
10891    }
10892
10893    @Override
10894    public boolean equalsDeep(Base other_) {
10895      if (!super.equalsDeep(other_))
10896        return false;
10897      if (!(other_ instanceof AddedItemComponent))
10898        return false;
10899      AddedItemComponent o = (AddedItemComponent) other_;
10900      return compareDeep(itemSequence, o.itemSequence, true) && compareDeep(detailSequence, o.detailSequence, true)
10901          && compareDeep(subDetailSequence, o.subDetailSequence, true) && compareDeep(provider, o.provider, true)
10902          && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
10903          && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true)
10904          && compareDeep(location, o.location, true) && compareDeep(quantity, o.quantity, true)
10905          && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
10906          && compareDeep(net, o.net, true) && compareDeep(bodySite, o.bodySite, true)
10907          && compareDeep(subSite, o.subSite, true) && compareDeep(noteNumber, o.noteNumber, true)
10908          && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true);
10909    }
10910
10911    @Override
10912    public boolean equalsShallow(Base other_) {
10913      if (!super.equalsShallow(other_))
10914        return false;
10915      if (!(other_ instanceof AddedItemComponent))
10916        return false;
10917      AddedItemComponent o = (AddedItemComponent) other_;
10918      return compareValues(itemSequence, o.itemSequence, true) && compareValues(detailSequence, o.detailSequence, true)
10919          && compareValues(subDetailSequence, o.subDetailSequence, true) && compareValues(factor, o.factor, true)
10920          && compareValues(noteNumber, o.noteNumber, true);
10921    }
10922
10923    public boolean isEmpty() {
10924      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(itemSequence, detailSequence, subDetailSequence,
10925          provider, productOrService, modifier, programCode, serviced, location, quantity, unitPrice, factor, net,
10926          bodySite, subSite, noteNumber, adjudication, detail);
10927    }
10928
10929    public String fhirType() {
10930      return "ExplanationOfBenefit.addItem";
10931
10932    }
10933
10934  }
10935
10936  @Block()
10937  public static class AddedItemDetailComponent extends BackboneElement implements IBaseBackboneElement {
10938    /**
10939     * When the value is a group code then this item collects a set of related claim
10940     * details, otherwise this contains the product, service, drug or other billing
10941     * code for the item.
10942     */
10943    @Child(name = "productOrService", type = {
10944        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
10945    @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.")
10946    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
10947    protected CodeableConcept productOrService;
10948
10949    /**
10950     * Item typification or modifiers codes to convey additional context for the
10951     * product or service.
10952     */
10953    @Child(name = "modifier", type = {
10954        CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
10955    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
10956    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
10957    protected List<CodeableConcept> modifier;
10958
10959    /**
10960     * The number of repetitions of a service or product.
10961     */
10962    @Child(name = "quantity", type = { Quantity.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
10963    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
10964    protected Quantity quantity;
10965
10966    /**
10967     * If the item is not a group then this is the fee for the product or service,
10968     * otherwise this is the total of the fees for the details of the group.
10969     */
10970    @Child(name = "unitPrice", type = { Money.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
10971    @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.")
10972    protected Money unitPrice;
10973
10974    /**
10975     * A real number that represents a multiplier used in determining the overall
10976     * value of services delivered and/or goods received. The concept of a Factor
10977     * allows for a discount or surcharge multiplier to be applied to a monetary
10978     * amount.
10979     */
10980    @Child(name = "factor", type = {
10981        DecimalType.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
10982    @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.")
10983    protected DecimalType factor;
10984
10985    /**
10986     * The quantity times the unit price for an additional service or product or
10987     * charge.
10988     */
10989    @Child(name = "net", type = { Money.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
10990    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
10991    protected Money net;
10992
10993    /**
10994     * The numbers associated with notes below which apply to the adjudication of
10995     * this item.
10996     */
10997    @Child(name = "noteNumber", type = {
10998        PositiveIntType.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
10999    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
11000    protected List<PositiveIntType> noteNumber;
11001
11002    /**
11003     * The adjudication results.
11004     */
11005    @Child(name = "adjudication", type = {
11006        AdjudicationComponent.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11007    @Description(shortDefinition = "Added items adjudication", formalDefinition = "The adjudication results.")
11008    protected List<AdjudicationComponent> adjudication;
11009
11010    /**
11011     * The third-tier service adjudications for payor added services.
11012     */
11013    @Child(name = "subDetail", type = {}, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11014    @Description(shortDefinition = "Insurer added line items", formalDefinition = "The third-tier service adjudications for payor added services.")
11015    protected List<AddedItemDetailSubDetailComponent> subDetail;
11016
11017    private static final long serialVersionUID = 295910869L;
11018
11019    /**
11020     * Constructor
11021     */
11022    public AddedItemDetailComponent() {
11023      super();
11024    }
11025
11026    /**
11027     * Constructor
11028     */
11029    public AddedItemDetailComponent(CodeableConcept productOrService) {
11030      super();
11031      this.productOrService = productOrService;
11032    }
11033
11034    /**
11035     * @return {@link #productOrService} (When the value is a group code then this
11036     *         item collects a set of related claim details, otherwise this contains
11037     *         the product, service, drug or other billing code for the item.)
11038     */
11039    public CodeableConcept getProductOrService() {
11040      if (this.productOrService == null)
11041        if (Configuration.errorOnAutoCreate())
11042          throw new Error("Attempt to auto-create AddedItemDetailComponent.productOrService");
11043        else if (Configuration.doAutoCreate())
11044          this.productOrService = new CodeableConcept(); // cc
11045      return this.productOrService;
11046    }
11047
11048    public boolean hasProductOrService() {
11049      return this.productOrService != null && !this.productOrService.isEmpty();
11050    }
11051
11052    /**
11053     * @param value {@link #productOrService} (When the value is a group code then
11054     *              this item collects a set of related claim details, otherwise
11055     *              this contains the product, service, drug or other billing code
11056     *              for the item.)
11057     */
11058    public AddedItemDetailComponent setProductOrService(CodeableConcept value) {
11059      this.productOrService = value;
11060      return this;
11061    }
11062
11063    /**
11064     * @return {@link #modifier} (Item typification or modifiers codes to convey
11065     *         additional context for the product or service.)
11066     */
11067    public List<CodeableConcept> getModifier() {
11068      if (this.modifier == null)
11069        this.modifier = new ArrayList<CodeableConcept>();
11070      return this.modifier;
11071    }
11072
11073    /**
11074     * @return Returns a reference to <code>this</code> for easy method chaining
11075     */
11076    public AddedItemDetailComponent setModifier(List<CodeableConcept> theModifier) {
11077      this.modifier = theModifier;
11078      return this;
11079    }
11080
11081    public boolean hasModifier() {
11082      if (this.modifier == null)
11083        return false;
11084      for (CodeableConcept item : this.modifier)
11085        if (!item.isEmpty())
11086          return true;
11087      return false;
11088    }
11089
11090    public CodeableConcept addModifier() { // 3
11091      CodeableConcept t = new CodeableConcept();
11092      if (this.modifier == null)
11093        this.modifier = new ArrayList<CodeableConcept>();
11094      this.modifier.add(t);
11095      return t;
11096    }
11097
11098    public AddedItemDetailComponent addModifier(CodeableConcept t) { // 3
11099      if (t == null)
11100        return this;
11101      if (this.modifier == null)
11102        this.modifier = new ArrayList<CodeableConcept>();
11103      this.modifier.add(t);
11104      return this;
11105    }
11106
11107    /**
11108     * @return The first repetition of repeating field {@link #modifier}, creating
11109     *         it if it does not already exist
11110     */
11111    public CodeableConcept getModifierFirstRep() {
11112      if (getModifier().isEmpty()) {
11113        addModifier();
11114      }
11115      return getModifier().get(0);
11116    }
11117
11118    /**
11119     * @return {@link #quantity} (The number of repetitions of a service or
11120     *         product.)
11121     */
11122    public Quantity getQuantity() {
11123      if (this.quantity == null)
11124        if (Configuration.errorOnAutoCreate())
11125          throw new Error("Attempt to auto-create AddedItemDetailComponent.quantity");
11126        else if (Configuration.doAutoCreate())
11127          this.quantity = new Quantity(); // cc
11128      return this.quantity;
11129    }
11130
11131    public boolean hasQuantity() {
11132      return this.quantity != null && !this.quantity.isEmpty();
11133    }
11134
11135    /**
11136     * @param value {@link #quantity} (The number of repetitions of a service or
11137     *              product.)
11138     */
11139    public AddedItemDetailComponent setQuantity(Quantity value) {
11140      this.quantity = value;
11141      return this;
11142    }
11143
11144    /**
11145     * @return {@link #unitPrice} (If the item is not a group then this is the fee
11146     *         for the product or service, otherwise this is the total of the fees
11147     *         for the details of the group.)
11148     */
11149    public Money getUnitPrice() {
11150      if (this.unitPrice == null)
11151        if (Configuration.errorOnAutoCreate())
11152          throw new Error("Attempt to auto-create AddedItemDetailComponent.unitPrice");
11153        else if (Configuration.doAutoCreate())
11154          this.unitPrice = new Money(); // cc
11155      return this.unitPrice;
11156    }
11157
11158    public boolean hasUnitPrice() {
11159      return this.unitPrice != null && !this.unitPrice.isEmpty();
11160    }
11161
11162    /**
11163     * @param value {@link #unitPrice} (If the item is not a group then this is the
11164     *              fee for the product or service, otherwise this is the total of
11165     *              the fees for the details of the group.)
11166     */
11167    public AddedItemDetailComponent setUnitPrice(Money value) {
11168      this.unitPrice = value;
11169      return this;
11170    }
11171
11172    /**
11173     * @return {@link #factor} (A real number that represents a multiplier used in
11174     *         determining the overall value of services delivered and/or goods
11175     *         received. The concept of a Factor allows for a discount or surcharge
11176     *         multiplier to be applied to a monetary amount.). This is the
11177     *         underlying object with id, value and extensions. The accessor
11178     *         "getFactor" gives direct access to the value
11179     */
11180    public DecimalType getFactorElement() {
11181      if (this.factor == null)
11182        if (Configuration.errorOnAutoCreate())
11183          throw new Error("Attempt to auto-create AddedItemDetailComponent.factor");
11184        else if (Configuration.doAutoCreate())
11185          this.factor = new DecimalType(); // bb
11186      return this.factor;
11187    }
11188
11189    public boolean hasFactorElement() {
11190      return this.factor != null && !this.factor.isEmpty();
11191    }
11192
11193    public boolean hasFactor() {
11194      return this.factor != null && !this.factor.isEmpty();
11195    }
11196
11197    /**
11198     * @param value {@link #factor} (A real number that represents a multiplier used
11199     *              in determining the overall value of services delivered and/or
11200     *              goods received. The concept of a Factor allows for a discount or
11201     *              surcharge multiplier to be applied to a monetary amount.). This
11202     *              is the underlying object with id, value and extensions. The
11203     *              accessor "getFactor" gives direct access to the value
11204     */
11205    public AddedItemDetailComponent setFactorElement(DecimalType value) {
11206      this.factor = value;
11207      return this;
11208    }
11209
11210    /**
11211     * @return A real number that represents a multiplier used in determining the
11212     *         overall value of services delivered and/or goods received. The
11213     *         concept of a Factor allows for a discount or surcharge multiplier to
11214     *         be applied to a monetary amount.
11215     */
11216    public BigDecimal getFactor() {
11217      return this.factor == null ? null : this.factor.getValue();
11218    }
11219
11220    /**
11221     * @param value A real number that represents a multiplier used in determining
11222     *              the overall value of services delivered and/or goods received.
11223     *              The concept of a Factor allows for a discount or surcharge
11224     *              multiplier to be applied to a monetary amount.
11225     */
11226    public AddedItemDetailComponent setFactor(BigDecimal value) {
11227      if (value == null)
11228        this.factor = null;
11229      else {
11230        if (this.factor == null)
11231          this.factor = new DecimalType();
11232        this.factor.setValue(value);
11233      }
11234      return this;
11235    }
11236
11237    /**
11238     * @param value A real number that represents a multiplier used in determining
11239     *              the overall value of services delivered and/or goods received.
11240     *              The concept of a Factor allows for a discount or surcharge
11241     *              multiplier to be applied to a monetary amount.
11242     */
11243    public AddedItemDetailComponent setFactor(long value) {
11244      this.factor = new DecimalType();
11245      this.factor.setValue(value);
11246      return this;
11247    }
11248
11249    /**
11250     * @param value A real number that represents a multiplier used in determining
11251     *              the overall value of services delivered and/or goods received.
11252     *              The concept of a Factor allows for a discount or surcharge
11253     *              multiplier to be applied to a monetary amount.
11254     */
11255    public AddedItemDetailComponent setFactor(double value) {
11256      this.factor = new DecimalType();
11257      this.factor.setValue(value);
11258      return this;
11259    }
11260
11261    /**
11262     * @return {@link #net} (The quantity times the unit price for an additional
11263     *         service or product or charge.)
11264     */
11265    public Money getNet() {
11266      if (this.net == null)
11267        if (Configuration.errorOnAutoCreate())
11268          throw new Error("Attempt to auto-create AddedItemDetailComponent.net");
11269        else if (Configuration.doAutoCreate())
11270          this.net = new Money(); // cc
11271      return this.net;
11272    }
11273
11274    public boolean hasNet() {
11275      return this.net != null && !this.net.isEmpty();
11276    }
11277
11278    /**
11279     * @param value {@link #net} (The quantity times the unit price for an
11280     *              additional service or product or charge.)
11281     */
11282    public AddedItemDetailComponent setNet(Money value) {
11283      this.net = value;
11284      return this;
11285    }
11286
11287    /**
11288     * @return {@link #noteNumber} (The numbers associated with notes below which
11289     *         apply to the adjudication of this item.)
11290     */
11291    public List<PositiveIntType> getNoteNumber() {
11292      if (this.noteNumber == null)
11293        this.noteNumber = new ArrayList<PositiveIntType>();
11294      return this.noteNumber;
11295    }
11296
11297    /**
11298     * @return Returns a reference to <code>this</code> for easy method chaining
11299     */
11300    public AddedItemDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
11301      this.noteNumber = theNoteNumber;
11302      return this;
11303    }
11304
11305    public boolean hasNoteNumber() {
11306      if (this.noteNumber == null)
11307        return false;
11308      for (PositiveIntType item : this.noteNumber)
11309        if (!item.isEmpty())
11310          return true;
11311      return false;
11312    }
11313
11314    /**
11315     * @return {@link #noteNumber} (The numbers associated with notes below which
11316     *         apply to the adjudication of this item.)
11317     */
11318    public PositiveIntType addNoteNumberElement() {// 2
11319      PositiveIntType t = new PositiveIntType();
11320      if (this.noteNumber == null)
11321        this.noteNumber = new ArrayList<PositiveIntType>();
11322      this.noteNumber.add(t);
11323      return t;
11324    }
11325
11326    /**
11327     * @param value {@link #noteNumber} (The numbers associated with notes below
11328     *              which apply to the adjudication of this item.)
11329     */
11330    public AddedItemDetailComponent addNoteNumber(int value) { // 1
11331      PositiveIntType t = new PositiveIntType();
11332      t.setValue(value);
11333      if (this.noteNumber == null)
11334        this.noteNumber = new ArrayList<PositiveIntType>();
11335      this.noteNumber.add(t);
11336      return this;
11337    }
11338
11339    /**
11340     * @param value {@link #noteNumber} (The numbers associated with notes below
11341     *              which apply to the adjudication of this item.)
11342     */
11343    public boolean hasNoteNumber(int value) {
11344      if (this.noteNumber == null)
11345        return false;
11346      for (PositiveIntType v : this.noteNumber)
11347        if (v.getValue().equals(value)) // positiveInt
11348          return true;
11349      return false;
11350    }
11351
11352    /**
11353     * @return {@link #adjudication} (The adjudication results.)
11354     */
11355    public List<AdjudicationComponent> getAdjudication() {
11356      if (this.adjudication == null)
11357        this.adjudication = new ArrayList<AdjudicationComponent>();
11358      return this.adjudication;
11359    }
11360
11361    /**
11362     * @return Returns a reference to <code>this</code> for easy method chaining
11363     */
11364    public AddedItemDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
11365      this.adjudication = theAdjudication;
11366      return this;
11367    }
11368
11369    public boolean hasAdjudication() {
11370      if (this.adjudication == null)
11371        return false;
11372      for (AdjudicationComponent item : this.adjudication)
11373        if (!item.isEmpty())
11374          return true;
11375      return false;
11376    }
11377
11378    public AdjudicationComponent addAdjudication() { // 3
11379      AdjudicationComponent t = new AdjudicationComponent();
11380      if (this.adjudication == null)
11381        this.adjudication = new ArrayList<AdjudicationComponent>();
11382      this.adjudication.add(t);
11383      return t;
11384    }
11385
11386    public AddedItemDetailComponent addAdjudication(AdjudicationComponent t) { // 3
11387      if (t == null)
11388        return this;
11389      if (this.adjudication == null)
11390        this.adjudication = new ArrayList<AdjudicationComponent>();
11391      this.adjudication.add(t);
11392      return this;
11393    }
11394
11395    /**
11396     * @return The first repetition of repeating field {@link #adjudication},
11397     *         creating it if it does not already exist
11398     */
11399    public AdjudicationComponent getAdjudicationFirstRep() {
11400      if (getAdjudication().isEmpty()) {
11401        addAdjudication();
11402      }
11403      return getAdjudication().get(0);
11404    }
11405
11406    /**
11407     * @return {@link #subDetail} (The third-tier service adjudications for payor
11408     *         added services.)
11409     */
11410    public List<AddedItemDetailSubDetailComponent> getSubDetail() {
11411      if (this.subDetail == null)
11412        this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
11413      return this.subDetail;
11414    }
11415
11416    /**
11417     * @return Returns a reference to <code>this</code> for easy method chaining
11418     */
11419    public AddedItemDetailComponent setSubDetail(List<AddedItemDetailSubDetailComponent> theSubDetail) {
11420      this.subDetail = theSubDetail;
11421      return this;
11422    }
11423
11424    public boolean hasSubDetail() {
11425      if (this.subDetail == null)
11426        return false;
11427      for (AddedItemDetailSubDetailComponent item : this.subDetail)
11428        if (!item.isEmpty())
11429          return true;
11430      return false;
11431    }
11432
11433    public AddedItemDetailSubDetailComponent addSubDetail() { // 3
11434      AddedItemDetailSubDetailComponent t = new AddedItemDetailSubDetailComponent();
11435      if (this.subDetail == null)
11436        this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
11437      this.subDetail.add(t);
11438      return t;
11439    }
11440
11441    public AddedItemDetailComponent addSubDetail(AddedItemDetailSubDetailComponent t) { // 3
11442      if (t == null)
11443        return this;
11444      if (this.subDetail == null)
11445        this.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
11446      this.subDetail.add(t);
11447      return this;
11448    }
11449
11450    /**
11451     * @return The first repetition of repeating field {@link #subDetail}, creating
11452     *         it if it does not already exist
11453     */
11454    public AddedItemDetailSubDetailComponent getSubDetailFirstRep() {
11455      if (getSubDetail().isEmpty()) {
11456        addSubDetail();
11457      }
11458      return getSubDetail().get(0);
11459    }
11460
11461    protected void listChildren(List<Property> children) {
11462      super.listChildren(children);
11463      children.add(new Property("productOrService", "CodeableConcept",
11464          "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.",
11465          0, 1, productOrService));
11466      children.add(new Property("modifier", "CodeableConcept",
11467          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
11468          java.lang.Integer.MAX_VALUE, modifier));
11469      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
11470          1, quantity));
11471      children.add(new Property("unitPrice", "Money",
11472          "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.",
11473          0, 1, unitPrice));
11474      children.add(new Property("factor", "decimal",
11475          "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.",
11476          0, 1, factor));
11477      children.add(new Property("net", "Money",
11478          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
11479      children.add(new Property("noteNumber", "positiveInt",
11480          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
11481          java.lang.Integer.MAX_VALUE, noteNumber));
11482      children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.",
11483          0, java.lang.Integer.MAX_VALUE, adjudication));
11484      children.add(new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0,
11485          java.lang.Integer.MAX_VALUE, subDetail));
11486    }
11487
11488    @Override
11489    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
11490      switch (_hash) {
11491      case 1957227299:
11492        /* productOrService */ return new Property("productOrService", "CodeableConcept",
11493            "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.",
11494            0, 1, productOrService);
11495      case -615513385:
11496        /* modifier */ return new Property("modifier", "CodeableConcept",
11497            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
11498            java.lang.Integer.MAX_VALUE, modifier);
11499      case -1285004149:
11500        /* quantity */ return new Property("quantity", "SimpleQuantity",
11501            "The number of repetitions of a service or product.", 0, 1, quantity);
11502      case -486196699:
11503        /* unitPrice */ return new Property("unitPrice", "Money",
11504            "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.",
11505            0, 1, unitPrice);
11506      case -1282148017:
11507        /* factor */ return new Property("factor", "decimal",
11508            "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.",
11509            0, 1, factor);
11510      case 108957:
11511        /* net */ return new Property("net", "Money",
11512            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
11513      case -1110033957:
11514        /* noteNumber */ return new Property("noteNumber", "positiveInt",
11515            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
11516            java.lang.Integer.MAX_VALUE, noteNumber);
11517      case -231349275:
11518        /* adjudication */ return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
11519            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
11520      case -828829007:
11521        /* subDetail */ return new Property("subDetail", "",
11522            "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE,
11523            subDetail);
11524      default:
11525        return super.getNamedProperty(_hash, _name, _checkValid);
11526      }
11527
11528    }
11529
11530    @Override
11531    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
11532      switch (hash) {
11533      case 1957227299:
11534        /* productOrService */ return this.productOrService == null ? new Base[0]
11535            : new Base[] { this.productOrService }; // CodeableConcept
11536      case -615513385:
11537        /* modifier */ return this.modifier == null ? new Base[0]
11538            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
11539      case -1285004149:
11540        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
11541      case -486196699:
11542        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
11543      case -1282148017:
11544        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
11545      case 108957:
11546        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
11547      case -1110033957:
11548        /* noteNumber */ return this.noteNumber == null ? new Base[0]
11549            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
11550      case -231349275:
11551        /* adjudication */ return this.adjudication == null ? new Base[0]
11552            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
11553      case -828829007:
11554        /* subDetail */ return this.subDetail == null ? new Base[0]
11555            : this.subDetail.toArray(new Base[this.subDetail.size()]); // AddedItemDetailSubDetailComponent
11556      default:
11557        return super.getProperty(hash, name, checkValid);
11558      }
11559
11560    }
11561
11562    @Override
11563    public Base setProperty(int hash, String name, Base value) throws FHIRException {
11564      switch (hash) {
11565      case 1957227299: // productOrService
11566        this.productOrService = castToCodeableConcept(value); // CodeableConcept
11567        return value;
11568      case -615513385: // modifier
11569        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
11570        return value;
11571      case -1285004149: // quantity
11572        this.quantity = castToQuantity(value); // Quantity
11573        return value;
11574      case -486196699: // unitPrice
11575        this.unitPrice = castToMoney(value); // Money
11576        return value;
11577      case -1282148017: // factor
11578        this.factor = castToDecimal(value); // DecimalType
11579        return value;
11580      case 108957: // net
11581        this.net = castToMoney(value); // Money
11582        return value;
11583      case -1110033957: // noteNumber
11584        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
11585        return value;
11586      case -231349275: // adjudication
11587        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
11588        return value;
11589      case -828829007: // subDetail
11590        this.getSubDetail().add((AddedItemDetailSubDetailComponent) value); // AddedItemDetailSubDetailComponent
11591        return value;
11592      default:
11593        return super.setProperty(hash, name, value);
11594      }
11595
11596    }
11597
11598    @Override
11599    public Base setProperty(String name, Base value) throws FHIRException {
11600      if (name.equals("productOrService")) {
11601        this.productOrService = castToCodeableConcept(value); // CodeableConcept
11602      } else if (name.equals("modifier")) {
11603        this.getModifier().add(castToCodeableConcept(value));
11604      } else if (name.equals("quantity")) {
11605        this.quantity = castToQuantity(value); // Quantity
11606      } else if (name.equals("unitPrice")) {
11607        this.unitPrice = castToMoney(value); // Money
11608      } else if (name.equals("factor")) {
11609        this.factor = castToDecimal(value); // DecimalType
11610      } else if (name.equals("net")) {
11611        this.net = castToMoney(value); // Money
11612      } else if (name.equals("noteNumber")) {
11613        this.getNoteNumber().add(castToPositiveInt(value));
11614      } else if (name.equals("adjudication")) {
11615        this.getAdjudication().add((AdjudicationComponent) value);
11616      } else if (name.equals("subDetail")) {
11617        this.getSubDetail().add((AddedItemDetailSubDetailComponent) value);
11618      } else
11619        return super.setProperty(name, value);
11620      return value;
11621    }
11622
11623  @Override
11624  public void removeChild(String name, Base value) throws FHIRException {
11625      if (name.equals("productOrService")) {
11626        this.productOrService = null;
11627      } else if (name.equals("modifier")) {
11628        this.getModifier().remove(castToCodeableConcept(value));
11629      } else if (name.equals("quantity")) {
11630        this.quantity = null;
11631      } else if (name.equals("unitPrice")) {
11632        this.unitPrice = null;
11633      } else if (name.equals("factor")) {
11634        this.factor = null;
11635      } else if (name.equals("net")) {
11636        this.net = null;
11637      } else if (name.equals("noteNumber")) {
11638        this.getNoteNumber().remove(castToPositiveInt(value));
11639      } else if (name.equals("adjudication")) {
11640        this.getAdjudication().remove((AdjudicationComponent) value);
11641      } else if (name.equals("subDetail")) {
11642        this.getSubDetail().remove((AddedItemDetailSubDetailComponent) value);
11643      } else
11644        super.removeChild(name, value);
11645      
11646    }
11647
11648    @Override
11649    public Base makeProperty(int hash, String name) throws FHIRException {
11650      switch (hash) {
11651      case 1957227299:
11652        return getProductOrService();
11653      case -615513385:
11654        return addModifier();
11655      case -1285004149:
11656        return getQuantity();
11657      case -486196699:
11658        return getUnitPrice();
11659      case -1282148017:
11660        return getFactorElement();
11661      case 108957:
11662        return getNet();
11663      case -1110033957:
11664        return addNoteNumberElement();
11665      case -231349275:
11666        return addAdjudication();
11667      case -828829007:
11668        return addSubDetail();
11669      default:
11670        return super.makeProperty(hash, name);
11671      }
11672
11673    }
11674
11675    @Override
11676    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
11677      switch (hash) {
11678      case 1957227299:
11679        /* productOrService */ return new String[] { "CodeableConcept" };
11680      case -615513385:
11681        /* modifier */ return new String[] { "CodeableConcept" };
11682      case -1285004149:
11683        /* quantity */ return new String[] { "SimpleQuantity" };
11684      case -486196699:
11685        /* unitPrice */ return new String[] { "Money" };
11686      case -1282148017:
11687        /* factor */ return new String[] { "decimal" };
11688      case 108957:
11689        /* net */ return new String[] { "Money" };
11690      case -1110033957:
11691        /* noteNumber */ return new String[] { "positiveInt" };
11692      case -231349275:
11693        /* adjudication */ return new String[] { "@ExplanationOfBenefit.item.adjudication" };
11694      case -828829007:
11695        /* subDetail */ return new String[] {};
11696      default:
11697        return super.getTypesForProperty(hash, name);
11698      }
11699
11700    }
11701
11702    @Override
11703    public Base addChild(String name) throws FHIRException {
11704      if (name.equals("productOrService")) {
11705        this.productOrService = new CodeableConcept();
11706        return this.productOrService;
11707      } else if (name.equals("modifier")) {
11708        return addModifier();
11709      } else if (name.equals("quantity")) {
11710        this.quantity = new Quantity();
11711        return this.quantity;
11712      } else if (name.equals("unitPrice")) {
11713        this.unitPrice = new Money();
11714        return this.unitPrice;
11715      } else if (name.equals("factor")) {
11716        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
11717      } else if (name.equals("net")) {
11718        this.net = new Money();
11719        return this.net;
11720      } else if (name.equals("noteNumber")) {
11721        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
11722      } else if (name.equals("adjudication")) {
11723        return addAdjudication();
11724      } else if (name.equals("subDetail")) {
11725        return addSubDetail();
11726      } else
11727        return super.addChild(name);
11728    }
11729
11730    public AddedItemDetailComponent copy() {
11731      AddedItemDetailComponent dst = new AddedItemDetailComponent();
11732      copyValues(dst);
11733      return dst;
11734    }
11735
11736    public void copyValues(AddedItemDetailComponent dst) {
11737      super.copyValues(dst);
11738      dst.productOrService = productOrService == null ? null : productOrService.copy();
11739      if (modifier != null) {
11740        dst.modifier = new ArrayList<CodeableConcept>();
11741        for (CodeableConcept i : modifier)
11742          dst.modifier.add(i.copy());
11743      }
11744      ;
11745      dst.quantity = quantity == null ? null : quantity.copy();
11746      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
11747      dst.factor = factor == null ? null : factor.copy();
11748      dst.net = net == null ? null : net.copy();
11749      if (noteNumber != null) {
11750        dst.noteNumber = new ArrayList<PositiveIntType>();
11751        for (PositiveIntType i : noteNumber)
11752          dst.noteNumber.add(i.copy());
11753      }
11754      ;
11755      if (adjudication != null) {
11756        dst.adjudication = new ArrayList<AdjudicationComponent>();
11757        for (AdjudicationComponent i : adjudication)
11758          dst.adjudication.add(i.copy());
11759      }
11760      ;
11761      if (subDetail != null) {
11762        dst.subDetail = new ArrayList<AddedItemDetailSubDetailComponent>();
11763        for (AddedItemDetailSubDetailComponent i : subDetail)
11764          dst.subDetail.add(i.copy());
11765      }
11766      ;
11767    }
11768
11769    @Override
11770    public boolean equalsDeep(Base other_) {
11771      if (!super.equalsDeep(other_))
11772        return false;
11773      if (!(other_ instanceof AddedItemDetailComponent))
11774        return false;
11775      AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
11776      return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
11777          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
11778          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true)
11779          && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
11780          && compareDeep(subDetail, o.subDetail, true);
11781    }
11782
11783    @Override
11784    public boolean equalsShallow(Base other_) {
11785      if (!super.equalsShallow(other_))
11786        return false;
11787      if (!(other_ instanceof AddedItemDetailComponent))
11788        return false;
11789      AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
11790      return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
11791    }
11792
11793    public boolean isEmpty() {
11794      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier, quantity, unitPrice,
11795          factor, net, noteNumber, adjudication, subDetail);
11796    }
11797
11798    public String fhirType() {
11799      return "ExplanationOfBenefit.addItem.detail";
11800
11801    }
11802
11803  }
11804
11805  @Block()
11806  public static class AddedItemDetailSubDetailComponent extends BackboneElement implements IBaseBackboneElement {
11807    /**
11808     * When the value is a group code then this item collects a set of related claim
11809     * details, otherwise this contains the product, service, drug or other billing
11810     * code for the item.
11811     */
11812    @Child(name = "productOrService", type = {
11813        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
11814    @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.")
11815    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
11816    protected CodeableConcept productOrService;
11817
11818    /**
11819     * Item typification or modifiers codes to convey additional context for the
11820     * product or service.
11821     */
11822    @Child(name = "modifier", type = {
11823        CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11824    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
11825    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
11826    protected List<CodeableConcept> modifier;
11827
11828    /**
11829     * The number of repetitions of a service or product.
11830     */
11831    @Child(name = "quantity", type = { Quantity.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
11832    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
11833    protected Quantity quantity;
11834
11835    /**
11836     * If the item is not a group then this is the fee for the product or service,
11837     * otherwise this is the total of the fees for the details of the group.
11838     */
11839    @Child(name = "unitPrice", type = { Money.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
11840    @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.")
11841    protected Money unitPrice;
11842
11843    /**
11844     * A real number that represents a multiplier used in determining the overall
11845     * value of services delivered and/or goods received. The concept of a Factor
11846     * allows for a discount or surcharge multiplier to be applied to a monetary
11847     * amount.
11848     */
11849    @Child(name = "factor", type = {
11850        DecimalType.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
11851    @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.")
11852    protected DecimalType factor;
11853
11854    /**
11855     * The quantity times the unit price for an additional service or product or
11856     * charge.
11857     */
11858    @Child(name = "net", type = { Money.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
11859    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
11860    protected Money net;
11861
11862    /**
11863     * The numbers associated with notes below which apply to the adjudication of
11864     * this item.
11865     */
11866    @Child(name = "noteNumber", type = {
11867        PositiveIntType.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11868    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
11869    protected List<PositiveIntType> noteNumber;
11870
11871    /**
11872     * The adjudication results.
11873     */
11874    @Child(name = "adjudication", type = {
11875        AdjudicationComponent.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
11876    @Description(shortDefinition = "Added items adjudication", formalDefinition = "The adjudication results.")
11877    protected List<AdjudicationComponent> adjudication;
11878
11879    private static final long serialVersionUID = 1301363592L;
11880
11881    /**
11882     * Constructor
11883     */
11884    public AddedItemDetailSubDetailComponent() {
11885      super();
11886    }
11887
11888    /**
11889     * Constructor
11890     */
11891    public AddedItemDetailSubDetailComponent(CodeableConcept productOrService) {
11892      super();
11893      this.productOrService = productOrService;
11894    }
11895
11896    /**
11897     * @return {@link #productOrService} (When the value is a group code then this
11898     *         item collects a set of related claim details, otherwise this contains
11899     *         the product, service, drug or other billing code for the item.)
11900     */
11901    public CodeableConcept getProductOrService() {
11902      if (this.productOrService == null)
11903        if (Configuration.errorOnAutoCreate())
11904          throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.productOrService");
11905        else if (Configuration.doAutoCreate())
11906          this.productOrService = new CodeableConcept(); // cc
11907      return this.productOrService;
11908    }
11909
11910    public boolean hasProductOrService() {
11911      return this.productOrService != null && !this.productOrService.isEmpty();
11912    }
11913
11914    /**
11915     * @param value {@link #productOrService} (When the value is a group code then
11916     *              this item collects a set of related claim details, otherwise
11917     *              this contains the product, service, drug or other billing code
11918     *              for the item.)
11919     */
11920    public AddedItemDetailSubDetailComponent setProductOrService(CodeableConcept value) {
11921      this.productOrService = value;
11922      return this;
11923    }
11924
11925    /**
11926     * @return {@link #modifier} (Item typification or modifiers codes to convey
11927     *         additional context for the product or service.)
11928     */
11929    public List<CodeableConcept> getModifier() {
11930      if (this.modifier == null)
11931        this.modifier = new ArrayList<CodeableConcept>();
11932      return this.modifier;
11933    }
11934
11935    /**
11936     * @return Returns a reference to <code>this</code> for easy method chaining
11937     */
11938    public AddedItemDetailSubDetailComponent setModifier(List<CodeableConcept> theModifier) {
11939      this.modifier = theModifier;
11940      return this;
11941    }
11942
11943    public boolean hasModifier() {
11944      if (this.modifier == null)
11945        return false;
11946      for (CodeableConcept item : this.modifier)
11947        if (!item.isEmpty())
11948          return true;
11949      return false;
11950    }
11951
11952    public CodeableConcept addModifier() { // 3
11953      CodeableConcept t = new CodeableConcept();
11954      if (this.modifier == null)
11955        this.modifier = new ArrayList<CodeableConcept>();
11956      this.modifier.add(t);
11957      return t;
11958    }
11959
11960    public AddedItemDetailSubDetailComponent addModifier(CodeableConcept t) { // 3
11961      if (t == null)
11962        return this;
11963      if (this.modifier == null)
11964        this.modifier = new ArrayList<CodeableConcept>();
11965      this.modifier.add(t);
11966      return this;
11967    }
11968
11969    /**
11970     * @return The first repetition of repeating field {@link #modifier}, creating
11971     *         it if it does not already exist
11972     */
11973    public CodeableConcept getModifierFirstRep() {
11974      if (getModifier().isEmpty()) {
11975        addModifier();
11976      }
11977      return getModifier().get(0);
11978    }
11979
11980    /**
11981     * @return {@link #quantity} (The number of repetitions of a service or
11982     *         product.)
11983     */
11984    public Quantity getQuantity() {
11985      if (this.quantity == null)
11986        if (Configuration.errorOnAutoCreate())
11987          throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.quantity");
11988        else if (Configuration.doAutoCreate())
11989          this.quantity = new Quantity(); // cc
11990      return this.quantity;
11991    }
11992
11993    public boolean hasQuantity() {
11994      return this.quantity != null && !this.quantity.isEmpty();
11995    }
11996
11997    /**
11998     * @param value {@link #quantity} (The number of repetitions of a service or
11999     *              product.)
12000     */
12001    public AddedItemDetailSubDetailComponent setQuantity(Quantity value) {
12002      this.quantity = value;
12003      return this;
12004    }
12005
12006    /**
12007     * @return {@link #unitPrice} (If the item is not a group then this is the fee
12008     *         for the product or service, otherwise this is the total of the fees
12009     *         for the details of the group.)
12010     */
12011    public Money getUnitPrice() {
12012      if (this.unitPrice == null)
12013        if (Configuration.errorOnAutoCreate())
12014          throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.unitPrice");
12015        else if (Configuration.doAutoCreate())
12016          this.unitPrice = new Money(); // cc
12017      return this.unitPrice;
12018    }
12019
12020    public boolean hasUnitPrice() {
12021      return this.unitPrice != null && !this.unitPrice.isEmpty();
12022    }
12023
12024    /**
12025     * @param value {@link #unitPrice} (If the item is not a group then this is the
12026     *              fee for the product or service, otherwise this is the total of
12027     *              the fees for the details of the group.)
12028     */
12029    public AddedItemDetailSubDetailComponent setUnitPrice(Money value) {
12030      this.unitPrice = value;
12031      return this;
12032    }
12033
12034    /**
12035     * @return {@link #factor} (A real number that represents a multiplier used in
12036     *         determining the overall value of services delivered and/or goods
12037     *         received. The concept of a Factor allows for a discount or surcharge
12038     *         multiplier to be applied to a monetary amount.). This is the
12039     *         underlying object with id, value and extensions. The accessor
12040     *         "getFactor" gives direct access to the value
12041     */
12042    public DecimalType getFactorElement() {
12043      if (this.factor == null)
12044        if (Configuration.errorOnAutoCreate())
12045          throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.factor");
12046        else if (Configuration.doAutoCreate())
12047          this.factor = new DecimalType(); // bb
12048      return this.factor;
12049    }
12050
12051    public boolean hasFactorElement() {
12052      return this.factor != null && !this.factor.isEmpty();
12053    }
12054
12055    public boolean hasFactor() {
12056      return this.factor != null && !this.factor.isEmpty();
12057    }
12058
12059    /**
12060     * @param value {@link #factor} (A real number that represents a multiplier used
12061     *              in determining the overall value of services delivered and/or
12062     *              goods received. The concept of a Factor allows for a discount or
12063     *              surcharge multiplier to be applied to a monetary amount.). This
12064     *              is the underlying object with id, value and extensions. The
12065     *              accessor "getFactor" gives direct access to the value
12066     */
12067    public AddedItemDetailSubDetailComponent setFactorElement(DecimalType value) {
12068      this.factor = value;
12069      return this;
12070    }
12071
12072    /**
12073     * @return A real number that represents a multiplier used in determining the
12074     *         overall value of services delivered and/or goods received. The
12075     *         concept of a Factor allows for a discount or surcharge multiplier to
12076     *         be applied to a monetary amount.
12077     */
12078    public BigDecimal getFactor() {
12079      return this.factor == null ? null : this.factor.getValue();
12080    }
12081
12082    /**
12083     * @param value A real number that represents a multiplier used in determining
12084     *              the overall value of services delivered and/or goods received.
12085     *              The concept of a Factor allows for a discount or surcharge
12086     *              multiplier to be applied to a monetary amount.
12087     */
12088    public AddedItemDetailSubDetailComponent setFactor(BigDecimal value) {
12089      if (value == null)
12090        this.factor = null;
12091      else {
12092        if (this.factor == null)
12093          this.factor = new DecimalType();
12094        this.factor.setValue(value);
12095      }
12096      return this;
12097    }
12098
12099    /**
12100     * @param value A real number that represents a multiplier used in determining
12101     *              the overall value of services delivered and/or goods received.
12102     *              The concept of a Factor allows for a discount or surcharge
12103     *              multiplier to be applied to a monetary amount.
12104     */
12105    public AddedItemDetailSubDetailComponent setFactor(long value) {
12106      this.factor = new DecimalType();
12107      this.factor.setValue(value);
12108      return this;
12109    }
12110
12111    /**
12112     * @param value A real number that represents a multiplier used in determining
12113     *              the overall value of services delivered and/or goods received.
12114     *              The concept of a Factor allows for a discount or surcharge
12115     *              multiplier to be applied to a monetary amount.
12116     */
12117    public AddedItemDetailSubDetailComponent setFactor(double value) {
12118      this.factor = new DecimalType();
12119      this.factor.setValue(value);
12120      return this;
12121    }
12122
12123    /**
12124     * @return {@link #net} (The quantity times the unit price for an additional
12125     *         service or product or charge.)
12126     */
12127    public Money getNet() {
12128      if (this.net == null)
12129        if (Configuration.errorOnAutoCreate())
12130          throw new Error("Attempt to auto-create AddedItemDetailSubDetailComponent.net");
12131        else if (Configuration.doAutoCreate())
12132          this.net = new Money(); // cc
12133      return this.net;
12134    }
12135
12136    public boolean hasNet() {
12137      return this.net != null && !this.net.isEmpty();
12138    }
12139
12140    /**
12141     * @param value {@link #net} (The quantity times the unit price for an
12142     *              additional service or product or charge.)
12143     */
12144    public AddedItemDetailSubDetailComponent setNet(Money value) {
12145      this.net = value;
12146      return this;
12147    }
12148
12149    /**
12150     * @return {@link #noteNumber} (The numbers associated with notes below which
12151     *         apply to the adjudication of this item.)
12152     */
12153    public List<PositiveIntType> getNoteNumber() {
12154      if (this.noteNumber == null)
12155        this.noteNumber = new ArrayList<PositiveIntType>();
12156      return this.noteNumber;
12157    }
12158
12159    /**
12160     * @return Returns a reference to <code>this</code> for easy method chaining
12161     */
12162    public AddedItemDetailSubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
12163      this.noteNumber = theNoteNumber;
12164      return this;
12165    }
12166
12167    public boolean hasNoteNumber() {
12168      if (this.noteNumber == null)
12169        return false;
12170      for (PositiveIntType item : this.noteNumber)
12171        if (!item.isEmpty())
12172          return true;
12173      return false;
12174    }
12175
12176    /**
12177     * @return {@link #noteNumber} (The numbers associated with notes below which
12178     *         apply to the adjudication of this item.)
12179     */
12180    public PositiveIntType addNoteNumberElement() {// 2
12181      PositiveIntType t = new PositiveIntType();
12182      if (this.noteNumber == null)
12183        this.noteNumber = new ArrayList<PositiveIntType>();
12184      this.noteNumber.add(t);
12185      return t;
12186    }
12187
12188    /**
12189     * @param value {@link #noteNumber} (The numbers associated with notes below
12190     *              which apply to the adjudication of this item.)
12191     */
12192    public AddedItemDetailSubDetailComponent addNoteNumber(int value) { // 1
12193      PositiveIntType t = new PositiveIntType();
12194      t.setValue(value);
12195      if (this.noteNumber == null)
12196        this.noteNumber = new ArrayList<PositiveIntType>();
12197      this.noteNumber.add(t);
12198      return this;
12199    }
12200
12201    /**
12202     * @param value {@link #noteNumber} (The numbers associated with notes below
12203     *              which apply to the adjudication of this item.)
12204     */
12205    public boolean hasNoteNumber(int value) {
12206      if (this.noteNumber == null)
12207        return false;
12208      for (PositiveIntType v : this.noteNumber)
12209        if (v.getValue().equals(value)) // positiveInt
12210          return true;
12211      return false;
12212    }
12213
12214    /**
12215     * @return {@link #adjudication} (The adjudication results.)
12216     */
12217    public List<AdjudicationComponent> getAdjudication() {
12218      if (this.adjudication == null)
12219        this.adjudication = new ArrayList<AdjudicationComponent>();
12220      return this.adjudication;
12221    }
12222
12223    /**
12224     * @return Returns a reference to <code>this</code> for easy method chaining
12225     */
12226    public AddedItemDetailSubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
12227      this.adjudication = theAdjudication;
12228      return this;
12229    }
12230
12231    public boolean hasAdjudication() {
12232      if (this.adjudication == null)
12233        return false;
12234      for (AdjudicationComponent item : this.adjudication)
12235        if (!item.isEmpty())
12236          return true;
12237      return false;
12238    }
12239
12240    public AdjudicationComponent addAdjudication() { // 3
12241      AdjudicationComponent t = new AdjudicationComponent();
12242      if (this.adjudication == null)
12243        this.adjudication = new ArrayList<AdjudicationComponent>();
12244      this.adjudication.add(t);
12245      return t;
12246    }
12247
12248    public AddedItemDetailSubDetailComponent addAdjudication(AdjudicationComponent t) { // 3
12249      if (t == null)
12250        return this;
12251      if (this.adjudication == null)
12252        this.adjudication = new ArrayList<AdjudicationComponent>();
12253      this.adjudication.add(t);
12254      return this;
12255    }
12256
12257    /**
12258     * @return The first repetition of repeating field {@link #adjudication},
12259     *         creating it if it does not already exist
12260     */
12261    public AdjudicationComponent getAdjudicationFirstRep() {
12262      if (getAdjudication().isEmpty()) {
12263        addAdjudication();
12264      }
12265      return getAdjudication().get(0);
12266    }
12267
12268    protected void listChildren(List<Property> children) {
12269      super.listChildren(children);
12270      children.add(new Property("productOrService", "CodeableConcept",
12271          "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.",
12272          0, 1, productOrService));
12273      children.add(new Property("modifier", "CodeableConcept",
12274          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
12275          java.lang.Integer.MAX_VALUE, modifier));
12276      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
12277          1, quantity));
12278      children.add(new Property("unitPrice", "Money",
12279          "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.",
12280          0, 1, unitPrice));
12281      children.add(new Property("factor", "decimal",
12282          "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.",
12283          0, 1, factor));
12284      children.add(new Property("net", "Money",
12285          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
12286      children.add(new Property("noteNumber", "positiveInt",
12287          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
12288          java.lang.Integer.MAX_VALUE, noteNumber));
12289      children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication", "The adjudication results.",
12290          0, java.lang.Integer.MAX_VALUE, adjudication));
12291    }
12292
12293    @Override
12294    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
12295      switch (_hash) {
12296      case 1957227299:
12297        /* productOrService */ return new Property("productOrService", "CodeableConcept",
12298            "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.",
12299            0, 1, productOrService);
12300      case -615513385:
12301        /* modifier */ return new Property("modifier", "CodeableConcept",
12302            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
12303            java.lang.Integer.MAX_VALUE, modifier);
12304      case -1285004149:
12305        /* quantity */ return new Property("quantity", "SimpleQuantity",
12306            "The number of repetitions of a service or product.", 0, 1, quantity);
12307      case -486196699:
12308        /* unitPrice */ return new Property("unitPrice", "Money",
12309            "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.",
12310            0, 1, unitPrice);
12311      case -1282148017:
12312        /* factor */ return new Property("factor", "decimal",
12313            "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.",
12314            0, 1, factor);
12315      case 108957:
12316        /* net */ return new Property("net", "Money",
12317            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
12318      case -1110033957:
12319        /* noteNumber */ return new Property("noteNumber", "positiveInt",
12320            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
12321            java.lang.Integer.MAX_VALUE, noteNumber);
12322      case -231349275:
12323        /* adjudication */ return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
12324            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
12325      default:
12326        return super.getNamedProperty(_hash, _name, _checkValid);
12327      }
12328
12329    }
12330
12331    @Override
12332    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
12333      switch (hash) {
12334      case 1957227299:
12335        /* productOrService */ return this.productOrService == null ? new Base[0]
12336            : new Base[] { this.productOrService }; // CodeableConcept
12337      case -615513385:
12338        /* modifier */ return this.modifier == null ? new Base[0]
12339            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
12340      case -1285004149:
12341        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
12342      case -486196699:
12343        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
12344      case -1282148017:
12345        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
12346      case 108957:
12347        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
12348      case -1110033957:
12349        /* noteNumber */ return this.noteNumber == null ? new Base[0]
12350            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
12351      case -231349275:
12352        /* adjudication */ return this.adjudication == null ? new Base[0]
12353            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
12354      default:
12355        return super.getProperty(hash, name, checkValid);
12356      }
12357
12358    }
12359
12360    @Override
12361    public Base setProperty(int hash, String name, Base value) throws FHIRException {
12362      switch (hash) {
12363      case 1957227299: // productOrService
12364        this.productOrService = castToCodeableConcept(value); // CodeableConcept
12365        return value;
12366      case -615513385: // modifier
12367        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
12368        return value;
12369      case -1285004149: // quantity
12370        this.quantity = castToQuantity(value); // Quantity
12371        return value;
12372      case -486196699: // unitPrice
12373        this.unitPrice = castToMoney(value); // Money
12374        return value;
12375      case -1282148017: // factor
12376        this.factor = castToDecimal(value); // DecimalType
12377        return value;
12378      case 108957: // net
12379        this.net = castToMoney(value); // Money
12380        return value;
12381      case -1110033957: // noteNumber
12382        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
12383        return value;
12384      case -231349275: // adjudication
12385        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
12386        return value;
12387      default:
12388        return super.setProperty(hash, name, value);
12389      }
12390
12391    }
12392
12393    @Override
12394    public Base setProperty(String name, Base value) throws FHIRException {
12395      if (name.equals("productOrService")) {
12396        this.productOrService = castToCodeableConcept(value); // CodeableConcept
12397      } else if (name.equals("modifier")) {
12398        this.getModifier().add(castToCodeableConcept(value));
12399      } else if (name.equals("quantity")) {
12400        this.quantity = castToQuantity(value); // Quantity
12401      } else if (name.equals("unitPrice")) {
12402        this.unitPrice = castToMoney(value); // Money
12403      } else if (name.equals("factor")) {
12404        this.factor = castToDecimal(value); // DecimalType
12405      } else if (name.equals("net")) {
12406        this.net = castToMoney(value); // Money
12407      } else if (name.equals("noteNumber")) {
12408        this.getNoteNumber().add(castToPositiveInt(value));
12409      } else if (name.equals("adjudication")) {
12410        this.getAdjudication().add((AdjudicationComponent) value);
12411      } else
12412        return super.setProperty(name, value);
12413      return value;
12414    }
12415
12416  @Override
12417  public void removeChild(String name, Base value) throws FHIRException {
12418      if (name.equals("productOrService")) {
12419        this.productOrService = null;
12420      } else if (name.equals("modifier")) {
12421        this.getModifier().remove(castToCodeableConcept(value));
12422      } else if (name.equals("quantity")) {
12423        this.quantity = null;
12424      } else if (name.equals("unitPrice")) {
12425        this.unitPrice = null;
12426      } else if (name.equals("factor")) {
12427        this.factor = null;
12428      } else if (name.equals("net")) {
12429        this.net = null;
12430      } else if (name.equals("noteNumber")) {
12431        this.getNoteNumber().remove(castToPositiveInt(value));
12432      } else if (name.equals("adjudication")) {
12433        this.getAdjudication().remove((AdjudicationComponent) value);
12434      } else
12435        super.removeChild(name, value);
12436      
12437    }
12438
12439    @Override
12440    public Base makeProperty(int hash, String name) throws FHIRException {
12441      switch (hash) {
12442      case 1957227299:
12443        return getProductOrService();
12444      case -615513385:
12445        return addModifier();
12446      case -1285004149:
12447        return getQuantity();
12448      case -486196699:
12449        return getUnitPrice();
12450      case -1282148017:
12451        return getFactorElement();
12452      case 108957:
12453        return getNet();
12454      case -1110033957:
12455        return addNoteNumberElement();
12456      case -231349275:
12457        return addAdjudication();
12458      default:
12459        return super.makeProperty(hash, name);
12460      }
12461
12462    }
12463
12464    @Override
12465    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12466      switch (hash) {
12467      case 1957227299:
12468        /* productOrService */ return new String[] { "CodeableConcept" };
12469      case -615513385:
12470        /* modifier */ return new String[] { "CodeableConcept" };
12471      case -1285004149:
12472        /* quantity */ return new String[] { "SimpleQuantity" };
12473      case -486196699:
12474        /* unitPrice */ return new String[] { "Money" };
12475      case -1282148017:
12476        /* factor */ return new String[] { "decimal" };
12477      case 108957:
12478        /* net */ return new String[] { "Money" };
12479      case -1110033957:
12480        /* noteNumber */ return new String[] { "positiveInt" };
12481      case -231349275:
12482        /* adjudication */ return new String[] { "@ExplanationOfBenefit.item.adjudication" };
12483      default:
12484        return super.getTypesForProperty(hash, name);
12485      }
12486
12487    }
12488
12489    @Override
12490    public Base addChild(String name) throws FHIRException {
12491      if (name.equals("productOrService")) {
12492        this.productOrService = new CodeableConcept();
12493        return this.productOrService;
12494      } else if (name.equals("modifier")) {
12495        return addModifier();
12496      } else if (name.equals("quantity")) {
12497        this.quantity = new Quantity();
12498        return this.quantity;
12499      } else if (name.equals("unitPrice")) {
12500        this.unitPrice = new Money();
12501        return this.unitPrice;
12502      } else if (name.equals("factor")) {
12503        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.factor");
12504      } else if (name.equals("net")) {
12505        this.net = new Money();
12506        return this.net;
12507      } else if (name.equals("noteNumber")) {
12508        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.noteNumber");
12509      } else if (name.equals("adjudication")) {
12510        return addAdjudication();
12511      } else
12512        return super.addChild(name);
12513    }
12514
12515    public AddedItemDetailSubDetailComponent copy() {
12516      AddedItemDetailSubDetailComponent dst = new AddedItemDetailSubDetailComponent();
12517      copyValues(dst);
12518      return dst;
12519    }
12520
12521    public void copyValues(AddedItemDetailSubDetailComponent dst) {
12522      super.copyValues(dst);
12523      dst.productOrService = productOrService == null ? null : productOrService.copy();
12524      if (modifier != null) {
12525        dst.modifier = new ArrayList<CodeableConcept>();
12526        for (CodeableConcept i : modifier)
12527          dst.modifier.add(i.copy());
12528      }
12529      ;
12530      dst.quantity = quantity == null ? null : quantity.copy();
12531      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
12532      dst.factor = factor == null ? null : factor.copy();
12533      dst.net = net == null ? null : net.copy();
12534      if (noteNumber != null) {
12535        dst.noteNumber = new ArrayList<PositiveIntType>();
12536        for (PositiveIntType i : noteNumber)
12537          dst.noteNumber.add(i.copy());
12538      }
12539      ;
12540      if (adjudication != null) {
12541        dst.adjudication = new ArrayList<AdjudicationComponent>();
12542        for (AdjudicationComponent i : adjudication)
12543          dst.adjudication.add(i.copy());
12544      }
12545      ;
12546    }
12547
12548    @Override
12549    public boolean equalsDeep(Base other_) {
12550      if (!super.equalsDeep(other_))
12551        return false;
12552      if (!(other_ instanceof AddedItemDetailSubDetailComponent))
12553        return false;
12554      AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
12555      return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
12556          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
12557          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true)
12558          && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true);
12559    }
12560
12561    @Override
12562    public boolean equalsShallow(Base other_) {
12563      if (!super.equalsShallow(other_))
12564        return false;
12565      if (!(other_ instanceof AddedItemDetailSubDetailComponent))
12566        return false;
12567      AddedItemDetailSubDetailComponent o = (AddedItemDetailSubDetailComponent) other_;
12568      return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
12569    }
12570
12571    public boolean isEmpty() {
12572      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier, quantity, unitPrice,
12573          factor, net, noteNumber, adjudication);
12574    }
12575
12576    public String fhirType() {
12577      return "ExplanationOfBenefit.addItem.detail.subDetail";
12578
12579    }
12580
12581  }
12582
12583  @Block()
12584  public static class TotalComponent extends BackboneElement implements IBaseBackboneElement {
12585    /**
12586     * A code to indicate the information type of this adjudication record.
12587     * Information types may include: the value submitted, maximum values or
12588     * percentages allowed or payable under the plan, amounts that the patient is
12589     * responsible for in aggregate or pertaining to this item, amounts paid by
12590     * other coverages, and the benefit payable for this item.
12591     */
12592    @Child(name = "category", type = {
12593        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
12594    @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.")
12595    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/adjudication")
12596    protected CodeableConcept category;
12597
12598    /**
12599     * Monetary total amount associated with the category.
12600     */
12601    @Child(name = "amount", type = { Money.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
12602    @Description(shortDefinition = "Financial total for the category", formalDefinition = "Monetary total amount associated with the category.")
12603    protected Money amount;
12604
12605    private static final long serialVersionUID = 2012310309L;
12606
12607    /**
12608     * Constructor
12609     */
12610    public TotalComponent() {
12611      super();
12612    }
12613
12614    /**
12615     * Constructor
12616     */
12617    public TotalComponent(CodeableConcept category, Money amount) {
12618      super();
12619      this.category = category;
12620      this.amount = amount;
12621    }
12622
12623    /**
12624     * @return {@link #category} (A code to indicate the information type of this
12625     *         adjudication record. Information types may include: the value
12626     *         submitted, maximum values or percentages allowed or payable under the
12627     *         plan, amounts that the patient is responsible for in aggregate or
12628     *         pertaining to this item, amounts paid by other coverages, and the
12629     *         benefit payable for this item.)
12630     */
12631    public CodeableConcept getCategory() {
12632      if (this.category == null)
12633        if (Configuration.errorOnAutoCreate())
12634          throw new Error("Attempt to auto-create TotalComponent.category");
12635        else if (Configuration.doAutoCreate())
12636          this.category = new CodeableConcept(); // cc
12637      return this.category;
12638    }
12639
12640    public boolean hasCategory() {
12641      return this.category != null && !this.category.isEmpty();
12642    }
12643
12644    /**
12645     * @param value {@link #category} (A code to indicate the information type of
12646     *              this adjudication record. Information types may include: the
12647     *              value submitted, maximum values or percentages allowed or
12648     *              payable under the plan, amounts that the patient is responsible
12649     *              for in aggregate or pertaining to this item, amounts paid by
12650     *              other coverages, and the benefit payable for this item.)
12651     */
12652    public TotalComponent setCategory(CodeableConcept value) {
12653      this.category = value;
12654      return this;
12655    }
12656
12657    /**
12658     * @return {@link #amount} (Monetary total amount associated with the category.)
12659     */
12660    public Money getAmount() {
12661      if (this.amount == null)
12662        if (Configuration.errorOnAutoCreate())
12663          throw new Error("Attempt to auto-create TotalComponent.amount");
12664        else if (Configuration.doAutoCreate())
12665          this.amount = new Money(); // cc
12666      return this.amount;
12667    }
12668
12669    public boolean hasAmount() {
12670      return this.amount != null && !this.amount.isEmpty();
12671    }
12672
12673    /**
12674     * @param value {@link #amount} (Monetary total amount associated with the
12675     *              category.)
12676     */
12677    public TotalComponent setAmount(Money value) {
12678      this.amount = value;
12679      return this;
12680    }
12681
12682    protected void listChildren(List<Property> children) {
12683      super.listChildren(children);
12684      children.add(new Property("category", "CodeableConcept",
12685          "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.",
12686          0, 1, category));
12687      children
12688          .add(new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount));
12689    }
12690
12691    @Override
12692    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
12693      switch (_hash) {
12694      case 50511102:
12695        /* category */ return new Property("category", "CodeableConcept",
12696            "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.",
12697            0, 1, category);
12698      case -1413853096:
12699        /* amount */ return new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1,
12700            amount);
12701      default:
12702        return super.getNamedProperty(_hash, _name, _checkValid);
12703      }
12704
12705    }
12706
12707    @Override
12708    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
12709      switch (hash) {
12710      case 50511102:
12711        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
12712      case -1413853096:
12713        /* amount */ return this.amount == null ? new Base[0] : new Base[] { this.amount }; // Money
12714      default:
12715        return super.getProperty(hash, name, checkValid);
12716      }
12717
12718    }
12719
12720    @Override
12721    public Base setProperty(int hash, String name, Base value) throws FHIRException {
12722      switch (hash) {
12723      case 50511102: // category
12724        this.category = castToCodeableConcept(value); // CodeableConcept
12725        return value;
12726      case -1413853096: // amount
12727        this.amount = castToMoney(value); // Money
12728        return value;
12729      default:
12730        return super.setProperty(hash, name, value);
12731      }
12732
12733    }
12734
12735    @Override
12736    public Base setProperty(String name, Base value) throws FHIRException {
12737      if (name.equals("category")) {
12738        this.category = castToCodeableConcept(value); // CodeableConcept
12739      } else if (name.equals("amount")) {
12740        this.amount = castToMoney(value); // Money
12741      } else
12742        return super.setProperty(name, value);
12743      return value;
12744    }
12745
12746  @Override
12747  public void removeChild(String name, Base value) throws FHIRException {
12748      if (name.equals("category")) {
12749        this.category = null;
12750      } else if (name.equals("amount")) {
12751        this.amount = null;
12752      } else
12753        super.removeChild(name, value);
12754      
12755    }
12756
12757    @Override
12758    public Base makeProperty(int hash, String name) throws FHIRException {
12759      switch (hash) {
12760      case 50511102:
12761        return getCategory();
12762      case -1413853096:
12763        return getAmount();
12764      default:
12765        return super.makeProperty(hash, name);
12766      }
12767
12768    }
12769
12770    @Override
12771    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
12772      switch (hash) {
12773      case 50511102:
12774        /* category */ return new String[] { "CodeableConcept" };
12775      case -1413853096:
12776        /* amount */ return new String[] { "Money" };
12777      default:
12778        return super.getTypesForProperty(hash, name);
12779      }
12780
12781    }
12782
12783    @Override
12784    public Base addChild(String name) throws FHIRException {
12785      if (name.equals("category")) {
12786        this.category = new CodeableConcept();
12787        return this.category;
12788      } else if (name.equals("amount")) {
12789        this.amount = new Money();
12790        return this.amount;
12791      } else
12792        return super.addChild(name);
12793    }
12794
12795    public TotalComponent copy() {
12796      TotalComponent dst = new TotalComponent();
12797      copyValues(dst);
12798      return dst;
12799    }
12800
12801    public void copyValues(TotalComponent dst) {
12802      super.copyValues(dst);
12803      dst.category = category == null ? null : category.copy();
12804      dst.amount = amount == null ? null : amount.copy();
12805    }
12806
12807    @Override
12808    public boolean equalsDeep(Base other_) {
12809      if (!super.equalsDeep(other_))
12810        return false;
12811      if (!(other_ instanceof TotalComponent))
12812        return false;
12813      TotalComponent o = (TotalComponent) other_;
12814      return compareDeep(category, o.category, true) && compareDeep(amount, o.amount, true);
12815    }
12816
12817    @Override
12818    public boolean equalsShallow(Base other_) {
12819      if (!super.equalsShallow(other_))
12820        return false;
12821      if (!(other_ instanceof TotalComponent))
12822        return false;
12823      TotalComponent o = (TotalComponent) other_;
12824      return true;
12825    }
12826
12827    public boolean isEmpty() {
12828      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, amount);
12829    }
12830
12831    public String fhirType() {
12832      return "ExplanationOfBenefit.total";
12833
12834    }
12835
12836  }
12837
12838  @Block()
12839  public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
12840    /**
12841     * Whether this represents partial or complete payment of the benefits payable.
12842     */
12843    @Child(name = "type", type = {
12844        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
12845    @Description(shortDefinition = "Partial or complete payment", formalDefinition = "Whether this represents partial or complete payment of the benefits payable.")
12846    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-paymenttype")
12847    protected CodeableConcept type;
12848
12849    /**
12850     * Total amount of all adjustments to this payment included in this transaction
12851     * which are not related to this claim's adjudication.
12852     */
12853    @Child(name = "adjustment", type = { Money.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
12854    @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.")
12855    protected Money adjustment;
12856
12857    /**
12858     * Reason for the payment adjustment.
12859     */
12860    @Child(name = "adjustmentReason", type = {
12861        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
12862    @Description(shortDefinition = "Explanation for the variance", formalDefinition = "Reason for the payment adjustment.")
12863    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
12864    protected CodeableConcept adjustmentReason;
12865
12866    /**
12867     * Estimated date the payment will be issued or the actual issue date of
12868     * payment.
12869     */
12870    @Child(name = "date", type = { DateType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
12871    @Description(shortDefinition = "Expected date of payment", formalDefinition = "Estimated date the payment will be issued or the actual issue date of payment.")
12872    protected DateType date;
12873
12874    /**
12875     * Benefits payable less any payment adjustment.
12876     */
12877    @Child(name = "amount", type = { Money.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
12878    @Description(shortDefinition = "Payable amount after adjustment", formalDefinition = "Benefits payable less any payment adjustment.")
12879    protected Money amount;
12880
12881    /**
12882     * Issuer's unique identifier for the payment instrument.
12883     */
12884    @Child(name = "identifier", type = {
12885        Identifier.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
12886    @Description(shortDefinition = "Business identifier for the payment", formalDefinition = "Issuer's unique identifier for the payment instrument.")
12887    protected Identifier identifier;
12888
12889    private static final long serialVersionUID = 1539906026L;
12890
12891    /**
12892     * Constructor
12893     */
12894    public PaymentComponent() {
12895      super();
12896    }
12897
12898    /**
12899     * @return {@link #type} (Whether this represents partial or complete payment of
12900     *         the benefits payable.)
12901     */
12902    public CodeableConcept getType() {
12903      if (this.type == null)
12904        if (Configuration.errorOnAutoCreate())
12905          throw new Error("Attempt to auto-create PaymentComponent.type");
12906        else if (Configuration.doAutoCreate())
12907          this.type = new CodeableConcept(); // cc
12908      return this.type;
12909    }
12910
12911    public boolean hasType() {
12912      return this.type != null && !this.type.isEmpty();
12913    }
12914
12915    /**
12916     * @param value {@link #type} (Whether this represents partial or complete
12917     *              payment of the benefits payable.)
12918     */
12919    public PaymentComponent setType(CodeableConcept value) {
12920      this.type = value;
12921      return this;
12922    }
12923
12924    /**
12925     * @return {@link #adjustment} (Total amount of all adjustments to this payment
12926     *         included in this transaction which are not related to this claim's
12927     *         adjudication.)
12928     */
12929    public Money getAdjustment() {
12930      if (this.adjustment == null)
12931        if (Configuration.errorOnAutoCreate())
12932          throw new Error("Attempt to auto-create PaymentComponent.adjustment");
12933        else if (Configuration.doAutoCreate())
12934          this.adjustment = new Money(); // cc
12935      return this.adjustment;
12936    }
12937
12938    public boolean hasAdjustment() {
12939      return this.adjustment != null && !this.adjustment.isEmpty();
12940    }
12941
12942    /**
12943     * @param value {@link #adjustment} (Total amount of all adjustments to this
12944     *              payment included in this transaction which are not related to
12945     *              this claim's adjudication.)
12946     */
12947    public PaymentComponent setAdjustment(Money value) {
12948      this.adjustment = value;
12949      return this;
12950    }
12951
12952    /**
12953     * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
12954     */
12955    public CodeableConcept getAdjustmentReason() {
12956      if (this.adjustmentReason == null)
12957        if (Configuration.errorOnAutoCreate())
12958          throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
12959        else if (Configuration.doAutoCreate())
12960          this.adjustmentReason = new CodeableConcept(); // cc
12961      return this.adjustmentReason;
12962    }
12963
12964    public boolean hasAdjustmentReason() {
12965      return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
12966    }
12967
12968    /**
12969     * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
12970     */
12971    public PaymentComponent setAdjustmentReason(CodeableConcept value) {
12972      this.adjustmentReason = value;
12973      return this;
12974    }
12975
12976    /**
12977     * @return {@link #date} (Estimated date the payment will be issued or the
12978     *         actual issue date of payment.). This is the underlying object with
12979     *         id, value and extensions. The accessor "getDate" gives direct access
12980     *         to the value
12981     */
12982    public DateType getDateElement() {
12983      if (this.date == null)
12984        if (Configuration.errorOnAutoCreate())
12985          throw new Error("Attempt to auto-create PaymentComponent.date");
12986        else if (Configuration.doAutoCreate())
12987          this.date = new DateType(); // bb
12988      return this.date;
12989    }
12990
12991    public boolean hasDateElement() {
12992      return this.date != null && !this.date.isEmpty();
12993    }
12994
12995    public boolean hasDate() {
12996      return this.date != null && !this.date.isEmpty();
12997    }
12998
12999    /**
13000     * @param value {@link #date} (Estimated date the payment will be issued or the
13001     *              actual issue date of payment.). This is the underlying object
13002     *              with id, value and extensions. The accessor "getDate" gives
13003     *              direct access to the value
13004     */
13005    public PaymentComponent setDateElement(DateType value) {
13006      this.date = value;
13007      return this;
13008    }
13009
13010    /**
13011     * @return Estimated date the payment will be issued or the actual issue date of
13012     *         payment.
13013     */
13014    public Date getDate() {
13015      return this.date == null ? null : this.date.getValue();
13016    }
13017
13018    /**
13019     * @param value Estimated date the payment will be issued or the actual issue
13020     *              date of payment.
13021     */
13022    public PaymentComponent setDate(Date value) {
13023      if (value == null)
13024        this.date = null;
13025      else {
13026        if (this.date == null)
13027          this.date = new DateType();
13028        this.date.setValue(value);
13029      }
13030      return this;
13031    }
13032
13033    /**
13034     * @return {@link #amount} (Benefits payable less any payment adjustment.)
13035     */
13036    public Money getAmount() {
13037      if (this.amount == null)
13038        if (Configuration.errorOnAutoCreate())
13039          throw new Error("Attempt to auto-create PaymentComponent.amount");
13040        else if (Configuration.doAutoCreate())
13041          this.amount = new Money(); // cc
13042      return this.amount;
13043    }
13044
13045    public boolean hasAmount() {
13046      return this.amount != null && !this.amount.isEmpty();
13047    }
13048
13049    /**
13050     * @param value {@link #amount} (Benefits payable less any payment adjustment.)
13051     */
13052    public PaymentComponent setAmount(Money value) {
13053      this.amount = value;
13054      return this;
13055    }
13056
13057    /**
13058     * @return {@link #identifier} (Issuer's unique identifier for the payment
13059     *         instrument.)
13060     */
13061    public Identifier getIdentifier() {
13062      if (this.identifier == null)
13063        if (Configuration.errorOnAutoCreate())
13064          throw new Error("Attempt to auto-create PaymentComponent.identifier");
13065        else if (Configuration.doAutoCreate())
13066          this.identifier = new Identifier(); // cc
13067      return this.identifier;
13068    }
13069
13070    public boolean hasIdentifier() {
13071      return this.identifier != null && !this.identifier.isEmpty();
13072    }
13073
13074    /**
13075     * @param value {@link #identifier} (Issuer's unique identifier for the payment
13076     *              instrument.)
13077     */
13078    public PaymentComponent setIdentifier(Identifier value) {
13079      this.identifier = value;
13080      return this;
13081    }
13082
13083    protected void listChildren(List<Property> children) {
13084      super.listChildren(children);
13085      children.add(new Property("type", "CodeableConcept",
13086          "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type));
13087      children.add(new Property("adjustment", "Money",
13088          "Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.",
13089          0, 1, adjustment));
13090      children.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1,
13091          adjustmentReason));
13092      children.add(new Property("date", "date",
13093          "Estimated date the payment will be issued or the actual issue date of payment.", 0, 1, date));
13094      children.add(new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount));
13095      children.add(new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0,
13096          1, identifier));
13097    }
13098
13099    @Override
13100    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
13101      switch (_hash) {
13102      case 3575610:
13103        /* type */ return new Property("type", "CodeableConcept",
13104            "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type);
13105      case 1977085293:
13106        /* adjustment */ return new Property("adjustment", "Money",
13107            "Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.",
13108            0, 1, adjustment);
13109      case -1255938543:
13110        /* adjustmentReason */ return new Property("adjustmentReason", "CodeableConcept",
13111            "Reason for the payment adjustment.", 0, 1, adjustmentReason);
13112      case 3076014:
13113        /* date */ return new Property("date", "date",
13114            "Estimated date the payment will be issued or the actual issue date of payment.", 0, 1, date);
13115      case -1413853096:
13116        /* amount */ return new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1,
13117            amount);
13118      case -1618432855:
13119        /* identifier */ return new Property("identifier", "Identifier",
13120            "Issuer's unique identifier for the payment instrument.", 0, 1, identifier);
13121      default:
13122        return super.getNamedProperty(_hash, _name, _checkValid);
13123      }
13124
13125    }
13126
13127    @Override
13128    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
13129      switch (hash) {
13130      case 3575610:
13131        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
13132      case 1977085293:
13133        /* adjustment */ return this.adjustment == null ? new Base[0] : new Base[] { this.adjustment }; // Money
13134      case -1255938543:
13135        /* adjustmentReason */ return this.adjustmentReason == null ? new Base[0]
13136            : new Base[] { this.adjustmentReason }; // CodeableConcept
13137      case 3076014:
13138        /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateType
13139      case -1413853096:
13140        /* amount */ return this.amount == null ? new Base[0] : new Base[] { this.amount }; // Money
13141      case -1618432855:
13142        /* identifier */ return this.identifier == null ? new Base[0] : new Base[] { this.identifier }; // Identifier
13143      default:
13144        return super.getProperty(hash, name, checkValid);
13145      }
13146
13147    }
13148
13149    @Override
13150    public Base setProperty(int hash, String name, Base value) throws FHIRException {
13151      switch (hash) {
13152      case 3575610: // type
13153        this.type = castToCodeableConcept(value); // CodeableConcept
13154        return value;
13155      case 1977085293: // adjustment
13156        this.adjustment = castToMoney(value); // Money
13157        return value;
13158      case -1255938543: // adjustmentReason
13159        this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
13160        return value;
13161      case 3076014: // date
13162        this.date = castToDate(value); // DateType
13163        return value;
13164      case -1413853096: // amount
13165        this.amount = castToMoney(value); // Money
13166        return value;
13167      case -1618432855: // identifier
13168        this.identifier = castToIdentifier(value); // Identifier
13169        return value;
13170      default:
13171        return super.setProperty(hash, name, value);
13172      }
13173
13174    }
13175
13176    @Override
13177    public Base setProperty(String name, Base value) throws FHIRException {
13178      if (name.equals("type")) {
13179        this.type = castToCodeableConcept(value); // CodeableConcept
13180      } else if (name.equals("adjustment")) {
13181        this.adjustment = castToMoney(value); // Money
13182      } else if (name.equals("adjustmentReason")) {
13183        this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
13184      } else if (name.equals("date")) {
13185        this.date = castToDate(value); // DateType
13186      } else if (name.equals("amount")) {
13187        this.amount = castToMoney(value); // Money
13188      } else if (name.equals("identifier")) {
13189        this.identifier = castToIdentifier(value); // Identifier
13190      } else
13191        return super.setProperty(name, value);
13192      return value;
13193    }
13194
13195  @Override
13196  public void removeChild(String name, Base value) throws FHIRException {
13197      if (name.equals("type")) {
13198        this.type = null;
13199      } else if (name.equals("adjustment")) {
13200        this.adjustment = null;
13201      } else if (name.equals("adjustmentReason")) {
13202        this.adjustmentReason = null;
13203      } else if (name.equals("date")) {
13204        this.date = null;
13205      } else if (name.equals("amount")) {
13206        this.amount = null;
13207      } else if (name.equals("identifier")) {
13208        this.identifier = null;
13209      } else
13210        super.removeChild(name, value);
13211      
13212    }
13213
13214    @Override
13215    public Base makeProperty(int hash, String name) throws FHIRException {
13216      switch (hash) {
13217      case 3575610:
13218        return getType();
13219      case 1977085293:
13220        return getAdjustment();
13221      case -1255938543:
13222        return getAdjustmentReason();
13223      case 3076014:
13224        return getDateElement();
13225      case -1413853096:
13226        return getAmount();
13227      case -1618432855:
13228        return getIdentifier();
13229      default:
13230        return super.makeProperty(hash, name);
13231      }
13232
13233    }
13234
13235    @Override
13236    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
13237      switch (hash) {
13238      case 3575610:
13239        /* type */ return new String[] { "CodeableConcept" };
13240      case 1977085293:
13241        /* adjustment */ return new String[] { "Money" };
13242      case -1255938543:
13243        /* adjustmentReason */ return new String[] { "CodeableConcept" };
13244      case 3076014:
13245        /* date */ return new String[] { "date" };
13246      case -1413853096:
13247        /* amount */ return new String[] { "Money" };
13248      case -1618432855:
13249        /* identifier */ return new String[] { "Identifier" };
13250      default:
13251        return super.getTypesForProperty(hash, name);
13252      }
13253
13254    }
13255
13256    @Override
13257    public Base addChild(String name) throws FHIRException {
13258      if (name.equals("type")) {
13259        this.type = new CodeableConcept();
13260        return this.type;
13261      } else if (name.equals("adjustment")) {
13262        this.adjustment = new Money();
13263        return this.adjustment;
13264      } else if (name.equals("adjustmentReason")) {
13265        this.adjustmentReason = new CodeableConcept();
13266        return this.adjustmentReason;
13267      } else if (name.equals("date")) {
13268        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.date");
13269      } else if (name.equals("amount")) {
13270        this.amount = new Money();
13271        return this.amount;
13272      } else if (name.equals("identifier")) {
13273        this.identifier = new Identifier();
13274        return this.identifier;
13275      } else
13276        return super.addChild(name);
13277    }
13278
13279    public PaymentComponent copy() {
13280      PaymentComponent dst = new PaymentComponent();
13281      copyValues(dst);
13282      return dst;
13283    }
13284
13285    public void copyValues(PaymentComponent dst) {
13286      super.copyValues(dst);
13287      dst.type = type == null ? null : type.copy();
13288      dst.adjustment = adjustment == null ? null : adjustment.copy();
13289      dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
13290      dst.date = date == null ? null : date.copy();
13291      dst.amount = amount == null ? null : amount.copy();
13292      dst.identifier = identifier == null ? null : identifier.copy();
13293    }
13294
13295    @Override
13296    public boolean equalsDeep(Base other_) {
13297      if (!super.equalsDeep(other_))
13298        return false;
13299      if (!(other_ instanceof PaymentComponent))
13300        return false;
13301      PaymentComponent o = (PaymentComponent) other_;
13302      return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true)
13303          && compareDeep(adjustmentReason, o.adjustmentReason, true) && compareDeep(date, o.date, true)
13304          && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true);
13305    }
13306
13307    @Override
13308    public boolean equalsShallow(Base other_) {
13309      if (!super.equalsShallow(other_))
13310        return false;
13311      if (!(other_ instanceof PaymentComponent))
13312        return false;
13313      PaymentComponent o = (PaymentComponent) other_;
13314      return compareValues(date, o.date, true);
13315    }
13316
13317    public boolean isEmpty() {
13318      return super.isEmpty()
13319          && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason, date, amount, identifier);
13320    }
13321
13322    public String fhirType() {
13323      return "ExplanationOfBenefit.payment";
13324
13325    }
13326
13327  }
13328
13329  @Block()
13330  public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
13331    /**
13332     * A number to uniquely identify a note entry.
13333     */
13334    @Child(name = "number", type = {
13335        PositiveIntType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
13336    @Description(shortDefinition = "Note instance identifier", formalDefinition = "A number to uniquely identify a note entry.")
13337    protected PositiveIntType number;
13338
13339    /**
13340     * The business purpose of the note text.
13341     */
13342    @Child(name = "type", type = { CodeType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
13343    @Description(shortDefinition = "display | print | printoper", formalDefinition = "The business purpose of the note text.")
13344    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/note-type")
13345    protected Enumeration<NoteType> type;
13346
13347    /**
13348     * The explanation or description associated with the processing.
13349     */
13350    @Child(name = "text", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
13351    @Description(shortDefinition = "Note explanatory text", formalDefinition = "The explanation or description associated with the processing.")
13352    protected StringType text;
13353
13354    /**
13355     * A code to define the language used in the text of the note.
13356     */
13357    @Child(name = "language", type = {
13358        CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
13359    @Description(shortDefinition = "Language of the text", formalDefinition = "A code to define the language used in the text of the note.")
13360    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/languages")
13361    protected CodeableConcept language;
13362
13363    private static final long serialVersionUID = -385184277L;
13364
13365    /**
13366     * Constructor
13367     */
13368    public NoteComponent() {
13369      super();
13370    }
13371
13372    /**
13373     * @return {@link #number} (A number to uniquely identify a note entry.). This
13374     *         is the underlying object with id, value and extensions. The accessor
13375     *         "getNumber" gives direct access to the value
13376     */
13377    public PositiveIntType getNumberElement() {
13378      if (this.number == null)
13379        if (Configuration.errorOnAutoCreate())
13380          throw new Error("Attempt to auto-create NoteComponent.number");
13381        else if (Configuration.doAutoCreate())
13382          this.number = new PositiveIntType(); // bb
13383      return this.number;
13384    }
13385
13386    public boolean hasNumberElement() {
13387      return this.number != null && !this.number.isEmpty();
13388    }
13389
13390    public boolean hasNumber() {
13391      return this.number != null && !this.number.isEmpty();
13392    }
13393
13394    /**
13395     * @param value {@link #number} (A number to uniquely identify a note entry.).
13396     *              This is the underlying object with id, value and extensions. The
13397     *              accessor "getNumber" gives direct access to the value
13398     */
13399    public NoteComponent setNumberElement(PositiveIntType value) {
13400      this.number = value;
13401      return this;
13402    }
13403
13404    /**
13405     * @return A number to uniquely identify a note entry.
13406     */
13407    public int getNumber() {
13408      return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
13409    }
13410
13411    /**
13412     * @param value A number to uniquely identify a note entry.
13413     */
13414    public NoteComponent setNumber(int value) {
13415      if (this.number == null)
13416        this.number = new PositiveIntType();
13417      this.number.setValue(value);
13418      return this;
13419    }
13420
13421    /**
13422     * @return {@link #type} (The business purpose of the note text.). This is the
13423     *         underlying object with id, value and extensions. The accessor
13424     *         "getType" gives direct access to the value
13425     */
13426    public Enumeration<NoteType> getTypeElement() {
13427      if (this.type == null)
13428        if (Configuration.errorOnAutoCreate())
13429          throw new Error("Attempt to auto-create NoteComponent.type");
13430        else if (Configuration.doAutoCreate())
13431          this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory()); // bb
13432      return this.type;
13433    }
13434
13435    public boolean hasTypeElement() {
13436      return this.type != null && !this.type.isEmpty();
13437    }
13438
13439    public boolean hasType() {
13440      return this.type != null && !this.type.isEmpty();
13441    }
13442
13443    /**
13444     * @param value {@link #type} (The business purpose of the note text.). This is
13445     *              the underlying object with id, value and extensions. The
13446     *              accessor "getType" gives direct access to the value
13447     */
13448    public NoteComponent setTypeElement(Enumeration<NoteType> value) {
13449      this.type = value;
13450      return this;
13451    }
13452
13453    /**
13454     * @return The business purpose of the note text.
13455     */
13456    public NoteType getType() {
13457      return this.type == null ? null : this.type.getValue();
13458    }
13459
13460    /**
13461     * @param value The business purpose of the note text.
13462     */
13463    public NoteComponent setType(NoteType value) {
13464      if (value == null)
13465        this.type = null;
13466      else {
13467        if (this.type == null)
13468          this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory());
13469        this.type.setValue(value);
13470      }
13471      return this;
13472    }
13473
13474    /**
13475     * @return {@link #text} (The explanation or description associated with the
13476     *         processing.). This is the underlying object with id, value and
13477     *         extensions. The accessor "getText" gives direct access to the value
13478     */
13479    public StringType getTextElement() {
13480      if (this.text == null)
13481        if (Configuration.errorOnAutoCreate())
13482          throw new Error("Attempt to auto-create NoteComponent.text");
13483        else if (Configuration.doAutoCreate())
13484          this.text = new StringType(); // bb
13485      return this.text;
13486    }
13487
13488    public boolean hasTextElement() {
13489      return this.text != null && !this.text.isEmpty();
13490    }
13491
13492    public boolean hasText() {
13493      return this.text != null && !this.text.isEmpty();
13494    }
13495
13496    /**
13497     * @param value {@link #text} (The explanation or description associated with
13498     *              the processing.). This is the underlying object with id, value
13499     *              and extensions. The accessor "getText" gives direct access to
13500     *              the value
13501     */
13502    public NoteComponent setTextElement(StringType value) {
13503      this.text = value;
13504      return this;
13505    }
13506
13507    /**
13508     * @return The explanation or description associated with the processing.
13509     */
13510    public String getText() {
13511      return this.text == null ? null : this.text.getValue();
13512    }
13513
13514    /**
13515     * @param value The explanation or description associated with the processing.
13516     */
13517    public NoteComponent setText(String value) {
13518      if (Utilities.noString(value))
13519        this.text = null;
13520      else {
13521        if (this.text == null)
13522          this.text = new StringType();
13523        this.text.setValue(value);
13524      }
13525      return this;
13526    }
13527
13528    /**
13529     * @return {@link #language} (A code to define the language used in the text of
13530     *         the note.)
13531     */
13532    public CodeableConcept getLanguage() {
13533      if (this.language == null)
13534        if (Configuration.errorOnAutoCreate())
13535          throw new Error("Attempt to auto-create NoteComponent.language");
13536        else if (Configuration.doAutoCreate())
13537          this.language = new CodeableConcept(); // cc
13538      return this.language;
13539    }
13540
13541    public boolean hasLanguage() {
13542      return this.language != null && !this.language.isEmpty();
13543    }
13544
13545    /**
13546     * @param value {@link #language} (A code to define the language used in the
13547     *              text of the note.)
13548     */
13549    public NoteComponent setLanguage(CodeableConcept value) {
13550      this.language = value;
13551      return this;
13552    }
13553
13554    protected void listChildren(List<Property> children) {
13555      super.listChildren(children);
13556      children.add(new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number));
13557      children.add(new Property("type", "code", "The business purpose of the note text.", 0, 1, type));
13558      children.add(
13559          new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text));
13560      children.add(new Property("language", "CodeableConcept",
13561          "A code to define the language used in the text of the note.", 0, 1, language));
13562    }
13563
13564    @Override
13565    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
13566      switch (_hash) {
13567      case -1034364087:
13568        /* number */ return new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1,
13569            number);
13570      case 3575610:
13571        /* type */ return new Property("type", "code", "The business purpose of the note text.", 0, 1, type);
13572      case 3556653:
13573        /* text */ return new Property("text", "string",
13574            "The explanation or description associated with the processing.", 0, 1, text);
13575      case -1613589672:
13576        /* language */ return new Property("language", "CodeableConcept",
13577            "A code to define the language used in the text of the note.", 0, 1, language);
13578      default:
13579        return super.getNamedProperty(_hash, _name, _checkValid);
13580      }
13581
13582    }
13583
13584    @Override
13585    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
13586      switch (hash) {
13587      case -1034364087:
13588        /* number */ return this.number == null ? new Base[0] : new Base[] { this.number }; // PositiveIntType
13589      case 3575610:
13590        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // Enumeration<NoteType>
13591      case 3556653:
13592        /* text */ return this.text == null ? new Base[0] : new Base[] { this.text }; // StringType
13593      case -1613589672:
13594        /* language */ return this.language == null ? new Base[0] : new Base[] { this.language }; // CodeableConcept
13595      default:
13596        return super.getProperty(hash, name, checkValid);
13597      }
13598
13599    }
13600
13601    @Override
13602    public Base setProperty(int hash, String name, Base value) throws FHIRException {
13603      switch (hash) {
13604      case -1034364087: // number
13605        this.number = castToPositiveInt(value); // PositiveIntType
13606        return value;
13607      case 3575610: // type
13608        value = new NoteTypeEnumFactory().fromType(castToCode(value));
13609        this.type = (Enumeration) value; // Enumeration<NoteType>
13610        return value;
13611      case 3556653: // text
13612        this.text = castToString(value); // StringType
13613        return value;
13614      case -1613589672: // language
13615        this.language = castToCodeableConcept(value); // CodeableConcept
13616        return value;
13617      default:
13618        return super.setProperty(hash, name, value);
13619      }
13620
13621    }
13622
13623    @Override
13624    public Base setProperty(String name, Base value) throws FHIRException {
13625      if (name.equals("number")) {
13626        this.number = castToPositiveInt(value); // PositiveIntType
13627      } else if (name.equals("type")) {
13628        value = new NoteTypeEnumFactory().fromType(castToCode(value));
13629        this.type = (Enumeration) value; // Enumeration<NoteType>
13630      } else if (name.equals("text")) {
13631        this.text = castToString(value); // StringType
13632      } else if (name.equals("language")) {
13633        this.language = castToCodeableConcept(value); // CodeableConcept
13634      } else
13635        return super.setProperty(name, value);
13636      return value;
13637    }
13638
13639  @Override
13640  public void removeChild(String name, Base value) throws FHIRException {
13641      if (name.equals("number")) {
13642        this.number = null;
13643      } else if (name.equals("type")) {
13644        this.type = null;
13645      } else if (name.equals("text")) {
13646        this.text = null;
13647      } else if (name.equals("language")) {
13648        this.language = null;
13649      } else
13650        super.removeChild(name, value);
13651      
13652    }
13653
13654    @Override
13655    public Base makeProperty(int hash, String name) throws FHIRException {
13656      switch (hash) {
13657      case -1034364087:
13658        return getNumberElement();
13659      case 3575610:
13660        return getTypeElement();
13661      case 3556653:
13662        return getTextElement();
13663      case -1613589672:
13664        return getLanguage();
13665      default:
13666        return super.makeProperty(hash, name);
13667      }
13668
13669    }
13670
13671    @Override
13672    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
13673      switch (hash) {
13674      case -1034364087:
13675        /* number */ return new String[] { "positiveInt" };
13676      case 3575610:
13677        /* type */ return new String[] { "code" };
13678      case 3556653:
13679        /* text */ return new String[] { "string" };
13680      case -1613589672:
13681        /* language */ return new String[] { "CodeableConcept" };
13682      default:
13683        return super.getTypesForProperty(hash, name);
13684      }
13685
13686    }
13687
13688    @Override
13689    public Base addChild(String name) throws FHIRException {
13690      if (name.equals("number")) {
13691        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.number");
13692      } else if (name.equals("type")) {
13693        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.type");
13694      } else if (name.equals("text")) {
13695        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.text");
13696      } else if (name.equals("language")) {
13697        this.language = new CodeableConcept();
13698        return this.language;
13699      } else
13700        return super.addChild(name);
13701    }
13702
13703    public NoteComponent copy() {
13704      NoteComponent dst = new NoteComponent();
13705      copyValues(dst);
13706      return dst;
13707    }
13708
13709    public void copyValues(NoteComponent dst) {
13710      super.copyValues(dst);
13711      dst.number = number == null ? null : number.copy();
13712      dst.type = type == null ? null : type.copy();
13713      dst.text = text == null ? null : text.copy();
13714      dst.language = language == null ? null : language.copy();
13715    }
13716
13717    @Override
13718    public boolean equalsDeep(Base other_) {
13719      if (!super.equalsDeep(other_))
13720        return false;
13721      if (!(other_ instanceof NoteComponent))
13722        return false;
13723      NoteComponent o = (NoteComponent) other_;
13724      return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
13725          && compareDeep(language, o.language, true);
13726    }
13727
13728    @Override
13729    public boolean equalsShallow(Base other_) {
13730      if (!super.equalsShallow(other_))
13731        return false;
13732      if (!(other_ instanceof NoteComponent))
13733        return false;
13734      NoteComponent o = (NoteComponent) other_;
13735      return compareValues(number, o.number, true) && compareValues(type, o.type, true)
13736          && compareValues(text, o.text, true);
13737    }
13738
13739    public boolean isEmpty() {
13740      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language);
13741    }
13742
13743    public String fhirType() {
13744      return "ExplanationOfBenefit.processNote";
13745
13746    }
13747
13748  }
13749
13750  @Block()
13751  public static class BenefitBalanceComponent extends BackboneElement implements IBaseBackboneElement {
13752    /**
13753     * Code to identify the general type of benefits under which products and
13754     * services are provided.
13755     */
13756    @Child(name = "category", type = {
13757        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
13758    @Description(shortDefinition = "Benefit classification", formalDefinition = "Code to identify the general type of benefits under which products and services are provided.")
13759    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-benefitcategory")
13760    protected CodeableConcept category;
13761
13762    /**
13763     * True if the indicated class of service is excluded from the plan, missing or
13764     * False indicates the product or service is included in the coverage.
13765     */
13766    @Child(name = "excluded", type = {
13767        BooleanType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
13768    @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.")
13769    protected BooleanType excluded;
13770
13771    /**
13772     * A short name or tag for the benefit.
13773     */
13774    @Child(name = "name", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
13775    @Description(shortDefinition = "Short name for the benefit", formalDefinition = "A short name or tag for the benefit.")
13776    protected StringType name;
13777
13778    /**
13779     * A richer description of the benefit or services covered.
13780     */
13781    @Child(name = "description", type = {
13782        StringType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
13783    @Description(shortDefinition = "Description of the benefit or services covered", formalDefinition = "A richer description of the benefit or services covered.")
13784    protected StringType description;
13785
13786    /**
13787     * Is a flag to indicate whether the benefits refer to in-network providers or
13788     * out-of-network providers.
13789     */
13790    @Child(name = "network", type = {
13791        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
13792    @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.")
13793    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/benefit-network")
13794    protected CodeableConcept network;
13795
13796    /**
13797     * Indicates if the benefits apply to an individual or to the family.
13798     */
13799    @Child(name = "unit", type = {
13800        CodeableConcept.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
13801    @Description(shortDefinition = "Individual or family", formalDefinition = "Indicates if the benefits apply to an individual or to the family.")
13802    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/benefit-unit")
13803    protected CodeableConcept unit;
13804
13805    /**
13806     * The term or period of the values such as 'maximum lifetime benefit' or
13807     * 'maximum annual visits'.
13808     */
13809    @Child(name = "term", type = {
13810        CodeableConcept.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
13811    @Description(shortDefinition = "Annual or lifetime", formalDefinition = "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.")
13812    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/benefit-term")
13813    protected CodeableConcept term;
13814
13815    /**
13816     * Benefits Used to date.
13817     */
13818    @Child(name = "financial", type = {}, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
13819    @Description(shortDefinition = "Benefit Summary", formalDefinition = "Benefits Used to date.")
13820    protected List<BenefitComponent> financial;
13821
13822    private static final long serialVersionUID = -1889655824L;
13823
13824    /**
13825     * Constructor
13826     */
13827    public BenefitBalanceComponent() {
13828      super();
13829    }
13830
13831    /**
13832     * Constructor
13833     */
13834    public BenefitBalanceComponent(CodeableConcept category) {
13835      super();
13836      this.category = category;
13837    }
13838
13839    /**
13840     * @return {@link #category} (Code to identify the general type of benefits
13841     *         under which products and services are provided.)
13842     */
13843    public CodeableConcept getCategory() {
13844      if (this.category == null)
13845        if (Configuration.errorOnAutoCreate())
13846          throw new Error("Attempt to auto-create BenefitBalanceComponent.category");
13847        else if (Configuration.doAutoCreate())
13848          this.category = new CodeableConcept(); // cc
13849      return this.category;
13850    }
13851
13852    public boolean hasCategory() {
13853      return this.category != null && !this.category.isEmpty();
13854    }
13855
13856    /**
13857     * @param value {@link #category} (Code to identify the general type of benefits
13858     *              under which products and services are provided.)
13859     */
13860    public BenefitBalanceComponent setCategory(CodeableConcept value) {
13861      this.category = value;
13862      return this;
13863    }
13864
13865    /**
13866     * @return {@link #excluded} (True if the indicated class of service is excluded
13867     *         from the plan, missing or False indicates the product or service is
13868     *         included in the coverage.). This is the underlying object with id,
13869     *         value and extensions. The accessor "getExcluded" gives direct access
13870     *         to the value
13871     */
13872    public BooleanType getExcludedElement() {
13873      if (this.excluded == null)
13874        if (Configuration.errorOnAutoCreate())
13875          throw new Error("Attempt to auto-create BenefitBalanceComponent.excluded");
13876        else if (Configuration.doAutoCreate())
13877          this.excluded = new BooleanType(); // bb
13878      return this.excluded;
13879    }
13880
13881    public boolean hasExcludedElement() {
13882      return this.excluded != null && !this.excluded.isEmpty();
13883    }
13884
13885    public boolean hasExcluded() {
13886      return this.excluded != null && !this.excluded.isEmpty();
13887    }
13888
13889    /**
13890     * @param value {@link #excluded} (True if the indicated class of service is
13891     *              excluded from the plan, missing or False indicates the product
13892     *              or service is included in the coverage.). This is the underlying
13893     *              object with id, value and extensions. The accessor "getExcluded"
13894     *              gives direct access to the value
13895     */
13896    public BenefitBalanceComponent setExcludedElement(BooleanType value) {
13897      this.excluded = value;
13898      return this;
13899    }
13900
13901    /**
13902     * @return True if the indicated class of service is excluded from the plan,
13903     *         missing or False indicates the product or service is included in the
13904     *         coverage.
13905     */
13906    public boolean getExcluded() {
13907      return this.excluded == null || this.excluded.isEmpty() ? false : this.excluded.getValue();
13908    }
13909
13910    /**
13911     * @param value True if the indicated class of service is excluded from the
13912     *              plan, missing or False indicates the product or service is
13913     *              included in the coverage.
13914     */
13915    public BenefitBalanceComponent setExcluded(boolean value) {
13916      if (this.excluded == null)
13917        this.excluded = new BooleanType();
13918      this.excluded.setValue(value);
13919      return this;
13920    }
13921
13922    /**
13923     * @return {@link #name} (A short name or tag for the benefit.). This is the
13924     *         underlying object with id, value and extensions. The accessor
13925     *         "getName" gives direct access to the value
13926     */
13927    public StringType getNameElement() {
13928      if (this.name == null)
13929        if (Configuration.errorOnAutoCreate())
13930          throw new Error("Attempt to auto-create BenefitBalanceComponent.name");
13931        else if (Configuration.doAutoCreate())
13932          this.name = new StringType(); // bb
13933      return this.name;
13934    }
13935
13936    public boolean hasNameElement() {
13937      return this.name != null && !this.name.isEmpty();
13938    }
13939
13940    public boolean hasName() {
13941      return this.name != null && !this.name.isEmpty();
13942    }
13943
13944    /**
13945     * @param value {@link #name} (A short name or tag for the benefit.). This is
13946     *              the underlying object with id, value and extensions. The
13947     *              accessor "getName" gives direct access to the value
13948     */
13949    public BenefitBalanceComponent setNameElement(StringType value) {
13950      this.name = value;
13951      return this;
13952    }
13953
13954    /**
13955     * @return A short name or tag for the benefit.
13956     */
13957    public String getName() {
13958      return this.name == null ? null : this.name.getValue();
13959    }
13960
13961    /**
13962     * @param value A short name or tag for the benefit.
13963     */
13964    public BenefitBalanceComponent setName(String value) {
13965      if (Utilities.noString(value))
13966        this.name = null;
13967      else {
13968        if (this.name == null)
13969          this.name = new StringType();
13970        this.name.setValue(value);
13971      }
13972      return this;
13973    }
13974
13975    /**
13976     * @return {@link #description} (A richer description of the benefit or services
13977     *         covered.). This is the underlying object with id, value and
13978     *         extensions. The accessor "getDescription" gives direct access to the
13979     *         value
13980     */
13981    public StringType getDescriptionElement() {
13982      if (this.description == null)
13983        if (Configuration.errorOnAutoCreate())
13984          throw new Error("Attempt to auto-create BenefitBalanceComponent.description");
13985        else if (Configuration.doAutoCreate())
13986          this.description = new StringType(); // bb
13987      return this.description;
13988    }
13989
13990    public boolean hasDescriptionElement() {
13991      return this.description != null && !this.description.isEmpty();
13992    }
13993
13994    public boolean hasDescription() {
13995      return this.description != null && !this.description.isEmpty();
13996    }
13997
13998    /**
13999     * @param value {@link #description} (A richer description of the benefit or
14000     *              services covered.). This is the underlying object with id, value
14001     *              and extensions. The accessor "getDescription" gives direct
14002     *              access to the value
14003     */
14004    public BenefitBalanceComponent setDescriptionElement(StringType value) {
14005      this.description = value;
14006      return this;
14007    }
14008
14009    /**
14010     * @return A richer description of the benefit or services covered.
14011     */
14012    public String getDescription() {
14013      return this.description == null ? null : this.description.getValue();
14014    }
14015
14016    /**
14017     * @param value A richer description of the benefit or services covered.
14018     */
14019    public BenefitBalanceComponent setDescription(String value) {
14020      if (Utilities.noString(value))
14021        this.description = null;
14022      else {
14023        if (this.description == null)
14024          this.description = new StringType();
14025        this.description.setValue(value);
14026      }
14027      return this;
14028    }
14029
14030    /**
14031     * @return {@link #network} (Is a flag to indicate whether the benefits refer to
14032     *         in-network providers or out-of-network providers.)
14033     */
14034    public CodeableConcept getNetwork() {
14035      if (this.network == null)
14036        if (Configuration.errorOnAutoCreate())
14037          throw new Error("Attempt to auto-create BenefitBalanceComponent.network");
14038        else if (Configuration.doAutoCreate())
14039          this.network = new CodeableConcept(); // cc
14040      return this.network;
14041    }
14042
14043    public boolean hasNetwork() {
14044      return this.network != null && !this.network.isEmpty();
14045    }
14046
14047    /**
14048     * @param value {@link #network} (Is a flag to indicate whether the benefits
14049     *              refer to in-network providers or out-of-network providers.)
14050     */
14051    public BenefitBalanceComponent setNetwork(CodeableConcept value) {
14052      this.network = value;
14053      return this;
14054    }
14055
14056    /**
14057     * @return {@link #unit} (Indicates if the benefits apply to an individual or to
14058     *         the family.)
14059     */
14060    public CodeableConcept getUnit() {
14061      if (this.unit == null)
14062        if (Configuration.errorOnAutoCreate())
14063          throw new Error("Attempt to auto-create BenefitBalanceComponent.unit");
14064        else if (Configuration.doAutoCreate())
14065          this.unit = new CodeableConcept(); // cc
14066      return this.unit;
14067    }
14068
14069    public boolean hasUnit() {
14070      return this.unit != null && !this.unit.isEmpty();
14071    }
14072
14073    /**
14074     * @param value {@link #unit} (Indicates if the benefits apply to an individual
14075     *              or to the family.)
14076     */
14077    public BenefitBalanceComponent setUnit(CodeableConcept value) {
14078      this.unit = value;
14079      return this;
14080    }
14081
14082    /**
14083     * @return {@link #term} (The term or period of the values such as 'maximum
14084     *         lifetime benefit' or 'maximum annual visits'.)
14085     */
14086    public CodeableConcept getTerm() {
14087      if (this.term == null)
14088        if (Configuration.errorOnAutoCreate())
14089          throw new Error("Attempt to auto-create BenefitBalanceComponent.term");
14090        else if (Configuration.doAutoCreate())
14091          this.term = new CodeableConcept(); // cc
14092      return this.term;
14093    }
14094
14095    public boolean hasTerm() {
14096      return this.term != null && !this.term.isEmpty();
14097    }
14098
14099    /**
14100     * @param value {@link #term} (The term or period of the values such as 'maximum
14101     *              lifetime benefit' or 'maximum annual visits'.)
14102     */
14103    public BenefitBalanceComponent setTerm(CodeableConcept value) {
14104      this.term = value;
14105      return this;
14106    }
14107
14108    /**
14109     * @return {@link #financial} (Benefits Used to date.)
14110     */
14111    public List<BenefitComponent> getFinancial() {
14112      if (this.financial == null)
14113        this.financial = new ArrayList<BenefitComponent>();
14114      return this.financial;
14115    }
14116
14117    /**
14118     * @return Returns a reference to <code>this</code> for easy method chaining
14119     */
14120    public BenefitBalanceComponent setFinancial(List<BenefitComponent> theFinancial) {
14121      this.financial = theFinancial;
14122      return this;
14123    }
14124
14125    public boolean hasFinancial() {
14126      if (this.financial == null)
14127        return false;
14128      for (BenefitComponent item : this.financial)
14129        if (!item.isEmpty())
14130          return true;
14131      return false;
14132    }
14133
14134    public BenefitComponent addFinancial() { // 3
14135      BenefitComponent t = new BenefitComponent();
14136      if (this.financial == null)
14137        this.financial = new ArrayList<BenefitComponent>();
14138      this.financial.add(t);
14139      return t;
14140    }
14141
14142    public BenefitBalanceComponent addFinancial(BenefitComponent t) { // 3
14143      if (t == null)
14144        return this;
14145      if (this.financial == null)
14146        this.financial = new ArrayList<BenefitComponent>();
14147      this.financial.add(t);
14148      return this;
14149    }
14150
14151    /**
14152     * @return The first repetition of repeating field {@link #financial}, creating
14153     *         it if it does not already exist
14154     */
14155    public BenefitComponent getFinancialFirstRep() {
14156      if (getFinancial().isEmpty()) {
14157        addFinancial();
14158      }
14159      return getFinancial().get(0);
14160    }
14161
14162    protected void listChildren(List<Property> children) {
14163      super.listChildren(children);
14164      children.add(new Property("category", "CodeableConcept",
14165          "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
14166          category));
14167      children.add(new Property("excluded", "boolean",
14168          "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.",
14169          0, 1, excluded));
14170      children.add(new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name));
14171      children.add(new Property("description", "string", "A richer description of the benefit or services covered.", 0,
14172          1, description));
14173      children.add(new Property("network", "CodeableConcept",
14174          "Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.", 0, 1,
14175          network));
14176      children.add(new Property("unit", "CodeableConcept",
14177          "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit));
14178      children.add(new Property("term", "CodeableConcept",
14179          "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.", 0, 1,
14180          term));
14181      children.add(new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE, financial));
14182    }
14183
14184    @Override
14185    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
14186      switch (_hash) {
14187      case 50511102:
14188        /* category */ return new Property("category", "CodeableConcept",
14189            "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
14190            category);
14191      case 1994055114:
14192        /* excluded */ return new Property("excluded", "boolean",
14193            "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.",
14194            0, 1, excluded);
14195      case 3373707:
14196        /* name */ return new Property("name", "string", "A short name or tag for the benefit.", 0, 1, name);
14197      case -1724546052:
14198        /* description */ return new Property("description", "string",
14199            "A richer description of the benefit or services covered.", 0, 1, description);
14200      case 1843485230:
14201        /* network */ return new Property("network", "CodeableConcept",
14202            "Is a flag to indicate whether the benefits refer to in-network providers or out-of-network providers.", 0,
14203            1, network);
14204      case 3594628:
14205        /* unit */ return new Property("unit", "CodeableConcept",
14206            "Indicates if the benefits apply to an individual or to the family.", 0, 1, unit);
14207      case 3556460:
14208        /* term */ return new Property("term", "CodeableConcept",
14209            "The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual visits'.", 0, 1,
14210            term);
14211      case 357555337:
14212        /* financial */ return new Property("financial", "", "Benefits Used to date.", 0, java.lang.Integer.MAX_VALUE,
14213            financial);
14214      default:
14215        return super.getNamedProperty(_hash, _name, _checkValid);
14216      }
14217
14218    }
14219
14220    @Override
14221    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
14222      switch (hash) {
14223      case 50511102:
14224        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
14225      case 1994055114:
14226        /* excluded */ return this.excluded == null ? new Base[0] : new Base[] { this.excluded }; // BooleanType
14227      case 3373707:
14228        /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // StringType
14229      case -1724546052:
14230        /* description */ return this.description == null ? new Base[0] : new Base[] { this.description }; // StringType
14231      case 1843485230:
14232        /* network */ return this.network == null ? new Base[0] : new Base[] { this.network }; // CodeableConcept
14233      case 3594628:
14234        /* unit */ return this.unit == null ? new Base[0] : new Base[] { this.unit }; // CodeableConcept
14235      case 3556460:
14236        /* term */ return this.term == null ? new Base[0] : new Base[] { this.term }; // CodeableConcept
14237      case 357555337:
14238        /* financial */ return this.financial == null ? new Base[0]
14239            : this.financial.toArray(new Base[this.financial.size()]); // BenefitComponent
14240      default:
14241        return super.getProperty(hash, name, checkValid);
14242      }
14243
14244    }
14245
14246    @Override
14247    public Base setProperty(int hash, String name, Base value) throws FHIRException {
14248      switch (hash) {
14249      case 50511102: // category
14250        this.category = castToCodeableConcept(value); // CodeableConcept
14251        return value;
14252      case 1994055114: // excluded
14253        this.excluded = castToBoolean(value); // BooleanType
14254        return value;
14255      case 3373707: // name
14256        this.name = castToString(value); // StringType
14257        return value;
14258      case -1724546052: // description
14259        this.description = castToString(value); // StringType
14260        return value;
14261      case 1843485230: // network
14262        this.network = castToCodeableConcept(value); // CodeableConcept
14263        return value;
14264      case 3594628: // unit
14265        this.unit = castToCodeableConcept(value); // CodeableConcept
14266        return value;
14267      case 3556460: // term
14268        this.term = castToCodeableConcept(value); // CodeableConcept
14269        return value;
14270      case 357555337: // financial
14271        this.getFinancial().add((BenefitComponent) value); // BenefitComponent
14272        return value;
14273      default:
14274        return super.setProperty(hash, name, value);
14275      }
14276
14277    }
14278
14279    @Override
14280    public Base setProperty(String name, Base value) throws FHIRException {
14281      if (name.equals("category")) {
14282        this.category = castToCodeableConcept(value); // CodeableConcept
14283      } else if (name.equals("excluded")) {
14284        this.excluded = castToBoolean(value); // BooleanType
14285      } else if (name.equals("name")) {
14286        this.name = castToString(value); // StringType
14287      } else if (name.equals("description")) {
14288        this.description = castToString(value); // StringType
14289      } else if (name.equals("network")) {
14290        this.network = castToCodeableConcept(value); // CodeableConcept
14291      } else if (name.equals("unit")) {
14292        this.unit = castToCodeableConcept(value); // CodeableConcept
14293      } else if (name.equals("term")) {
14294        this.term = castToCodeableConcept(value); // CodeableConcept
14295      } else if (name.equals("financial")) {
14296        this.getFinancial().add((BenefitComponent) value);
14297      } else
14298        return super.setProperty(name, value);
14299      return value;
14300    }
14301
14302  @Override
14303  public void removeChild(String name, Base value) throws FHIRException {
14304      if (name.equals("category")) {
14305        this.category = null;
14306      } else if (name.equals("excluded")) {
14307        this.excluded = null;
14308      } else if (name.equals("name")) {
14309        this.name = null;
14310      } else if (name.equals("description")) {
14311        this.description = null;
14312      } else if (name.equals("network")) {
14313        this.network = null;
14314      } else if (name.equals("unit")) {
14315        this.unit = null;
14316      } else if (name.equals("term")) {
14317        this.term = null;
14318      } else if (name.equals("financial")) {
14319        this.getFinancial().remove((BenefitComponent) value);
14320      } else
14321        super.removeChild(name, value);
14322      
14323    }
14324
14325    @Override
14326    public Base makeProperty(int hash, String name) throws FHIRException {
14327      switch (hash) {
14328      case 50511102:
14329        return getCategory();
14330      case 1994055114:
14331        return getExcludedElement();
14332      case 3373707:
14333        return getNameElement();
14334      case -1724546052:
14335        return getDescriptionElement();
14336      case 1843485230:
14337        return getNetwork();
14338      case 3594628:
14339        return getUnit();
14340      case 3556460:
14341        return getTerm();
14342      case 357555337:
14343        return addFinancial();
14344      default:
14345        return super.makeProperty(hash, name);
14346      }
14347
14348    }
14349
14350    @Override
14351    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
14352      switch (hash) {
14353      case 50511102:
14354        /* category */ return new String[] { "CodeableConcept" };
14355      case 1994055114:
14356        /* excluded */ return new String[] { "boolean" };
14357      case 3373707:
14358        /* name */ return new String[] { "string" };
14359      case -1724546052:
14360        /* description */ return new String[] { "string" };
14361      case 1843485230:
14362        /* network */ return new String[] { "CodeableConcept" };
14363      case 3594628:
14364        /* unit */ return new String[] { "CodeableConcept" };
14365      case 3556460:
14366        /* term */ return new String[] { "CodeableConcept" };
14367      case 357555337:
14368        /* financial */ return new String[] {};
14369      default:
14370        return super.getTypesForProperty(hash, name);
14371      }
14372
14373    }
14374
14375    @Override
14376    public Base addChild(String name) throws FHIRException {
14377      if (name.equals("category")) {
14378        this.category = new CodeableConcept();
14379        return this.category;
14380      } else if (name.equals("excluded")) {
14381        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.excluded");
14382      } else if (name.equals("name")) {
14383        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.name");
14384      } else if (name.equals("description")) {
14385        throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.description");
14386      } else if (name.equals("network")) {
14387        this.network = new CodeableConcept();
14388        return this.network;
14389      } else if (name.equals("unit")) {
14390        this.unit = new CodeableConcept();
14391        return this.unit;
14392      } else if (name.equals("term")) {
14393        this.term = new CodeableConcept();
14394        return this.term;
14395      } else if (name.equals("financial")) {
14396        return addFinancial();
14397      } else
14398        return super.addChild(name);
14399    }
14400
14401    public BenefitBalanceComponent copy() {
14402      BenefitBalanceComponent dst = new BenefitBalanceComponent();
14403      copyValues(dst);
14404      return dst;
14405    }
14406
14407    public void copyValues(BenefitBalanceComponent dst) {
14408      super.copyValues(dst);
14409      dst.category = category == null ? null : category.copy();
14410      dst.excluded = excluded == null ? null : excluded.copy();
14411      dst.name = name == null ? null : name.copy();
14412      dst.description = description == null ? null : description.copy();
14413      dst.network = network == null ? null : network.copy();
14414      dst.unit = unit == null ? null : unit.copy();
14415      dst.term = term == null ? null : term.copy();
14416      if (financial != null) {
14417        dst.financial = new ArrayList<BenefitComponent>();
14418        for (BenefitComponent i : financial)
14419          dst.financial.add(i.copy());
14420      }
14421      ;
14422    }
14423
14424    @Override
14425    public boolean equalsDeep(Base other_) {
14426      if (!super.equalsDeep(other_))
14427        return false;
14428      if (!(other_ instanceof BenefitBalanceComponent))
14429        return false;
14430      BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
14431      return compareDeep(category, o.category, true) && compareDeep(excluded, o.excluded, true)
14432          && compareDeep(name, o.name, true) && compareDeep(description, o.description, true)
14433          && compareDeep(network, o.network, true) && compareDeep(unit, o.unit, true) && compareDeep(term, o.term, true)
14434          && compareDeep(financial, o.financial, true);
14435    }
14436
14437    @Override
14438    public boolean equalsShallow(Base other_) {
14439      if (!super.equalsShallow(other_))
14440        return false;
14441      if (!(other_ instanceof BenefitBalanceComponent))
14442        return false;
14443      BenefitBalanceComponent o = (BenefitBalanceComponent) other_;
14444      return compareValues(excluded, o.excluded, true) && compareValues(name, o.name, true)
14445          && compareValues(description, o.description, true);
14446    }
14447
14448    public boolean isEmpty() {
14449      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, excluded, name, description, network,
14450          unit, term, financial);
14451    }
14452
14453    public String fhirType() {
14454      return "ExplanationOfBenefit.benefitBalance";
14455
14456    }
14457
14458  }
14459
14460  @Block()
14461  public static class BenefitComponent extends BackboneElement implements IBaseBackboneElement {
14462    /**
14463     * Classification of benefit being provided.
14464     */
14465    @Child(name = "type", type = {
14466        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
14467    @Description(shortDefinition = "Benefit classification", formalDefinition = "Classification of benefit being provided.")
14468    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/benefit-type")
14469    protected CodeableConcept type;
14470
14471    /**
14472     * The quantity of the benefit which is permitted under the coverage.
14473     */
14474    @Child(name = "allowed", type = { UnsignedIntType.class, StringType.class,
14475        Money.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
14476    @Description(shortDefinition = "Benefits allowed", formalDefinition = "The quantity of the benefit which is permitted under the coverage.")
14477    protected Type allowed;
14478
14479    /**
14480     * The quantity of the benefit which have been consumed to date.
14481     */
14482    @Child(name = "used", type = { UnsignedIntType.class,
14483        Money.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
14484    @Description(shortDefinition = "Benefits used", formalDefinition = "The quantity of the benefit which have been consumed to date.")
14485    protected Type used;
14486
14487    private static final long serialVersionUID = -1506285314L;
14488
14489    /**
14490     * Constructor
14491     */
14492    public BenefitComponent() {
14493      super();
14494    }
14495
14496    /**
14497     * Constructor
14498     */
14499    public BenefitComponent(CodeableConcept type) {
14500      super();
14501      this.type = type;
14502    }
14503
14504    /**
14505     * @return {@link #type} (Classification of benefit being provided.)
14506     */
14507    public CodeableConcept getType() {
14508      if (this.type == null)
14509        if (Configuration.errorOnAutoCreate())
14510          throw new Error("Attempt to auto-create BenefitComponent.type");
14511        else if (Configuration.doAutoCreate())
14512          this.type = new CodeableConcept(); // cc
14513      return this.type;
14514    }
14515
14516    public boolean hasType() {
14517      return this.type != null && !this.type.isEmpty();
14518    }
14519
14520    /**
14521     * @param value {@link #type} (Classification of benefit being provided.)
14522     */
14523    public BenefitComponent setType(CodeableConcept value) {
14524      this.type = value;
14525      return this;
14526    }
14527
14528    /**
14529     * @return {@link #allowed} (The quantity of the benefit which is permitted
14530     *         under the coverage.)
14531     */
14532    public Type getAllowed() {
14533      return this.allowed;
14534    }
14535
14536    /**
14537     * @return {@link #allowed} (The quantity of the benefit which is permitted
14538     *         under the coverage.)
14539     */
14540    public UnsignedIntType getAllowedUnsignedIntType() throws FHIRException {
14541      if (this.allowed == null)
14542        this.allowed = new UnsignedIntType();
14543      if (!(this.allowed instanceof UnsignedIntType))
14544        throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "
14545            + this.allowed.getClass().getName() + " was encountered");
14546      return (UnsignedIntType) this.allowed;
14547    }
14548
14549    public boolean hasAllowedUnsignedIntType() {
14550        return this.allowed instanceof UnsignedIntType;
14551    }
14552
14553    /**
14554     * @return {@link #allowed} (The quantity of the benefit which is permitted
14555     *         under the coverage.)
14556     */
14557    public StringType getAllowedStringType() throws FHIRException {
14558      if (this.allowed == null)
14559        this.allowed = new StringType();
14560      if (!(this.allowed instanceof StringType))
14561        throw new FHIRException("Type mismatch: the type StringType was expected, but "
14562            + this.allowed.getClass().getName() + " was encountered");
14563      return (StringType) this.allowed;
14564    }
14565
14566    public boolean hasAllowedStringType() {
14567        return this.allowed instanceof StringType;
14568    }
14569
14570    /**
14571     * @return {@link #allowed} (The quantity of the benefit which is permitted
14572     *         under the coverage.)
14573     */
14574    public Money getAllowedMoney() throws FHIRException {
14575      if (this.allowed == null)
14576        this.allowed = new Money();
14577      if (!(this.allowed instanceof Money))
14578        throw new FHIRException("Type mismatch: the type Money was expected, but " + this.allowed.getClass().getName()
14579            + " was encountered");
14580      return (Money) this.allowed;
14581    }
14582
14583    public boolean hasAllowedMoney() {
14584        return this.allowed instanceof Money;
14585    }
14586
14587    public boolean hasAllowed() {
14588      return this.allowed != null && !this.allowed.isEmpty();
14589    }
14590
14591    /**
14592     * @param value {@link #allowed} (The quantity of the benefit which is permitted
14593     *              under the coverage.)
14594     */
14595    public BenefitComponent setAllowed(Type value) {
14596      if (value != null && !(value instanceof UnsignedIntType || value instanceof StringType || value instanceof Money))
14597        throw new Error(
14598            "Not the right type for ExplanationOfBenefit.benefitBalance.financial.allowed[x]: " + value.fhirType());
14599      this.allowed = value;
14600      return this;
14601    }
14602
14603    /**
14604     * @return {@link #used} (The quantity of the benefit which have been consumed
14605     *         to date.)
14606     */
14607    public Type getUsed() {
14608      return this.used;
14609    }
14610
14611    /**
14612     * @return {@link #used} (The quantity of the benefit which have been consumed
14613     *         to date.)
14614     */
14615    public UnsignedIntType getUsedUnsignedIntType() throws FHIRException {
14616      if (this.used == null)
14617        this.used = new UnsignedIntType();
14618      if (!(this.used instanceof UnsignedIntType))
14619        throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "
14620            + this.used.getClass().getName() + " was encountered");
14621      return (UnsignedIntType) this.used;
14622    }
14623
14624    public boolean hasUsedUnsignedIntType() {
14625        return this.used instanceof UnsignedIntType;
14626    }
14627
14628    /**
14629     * @return {@link #used} (The quantity of the benefit which have been consumed
14630     *         to date.)
14631     */
14632    public Money getUsedMoney() throws FHIRException {
14633      if (this.used == null)
14634        this.used = new Money();
14635      if (!(this.used instanceof Money))
14636        throw new FHIRException(
14637            "Type mismatch: the type Money was expected, but " + this.used.getClass().getName() + " was encountered");
14638      return (Money) this.used;
14639    }
14640
14641    public boolean hasUsedMoney() {
14642        return this.used instanceof Money;
14643    }
14644
14645    public boolean hasUsed() {
14646      return this.used != null && !this.used.isEmpty();
14647    }
14648
14649    /**
14650     * @param value {@link #used} (The quantity of the benefit which have been
14651     *              consumed to date.)
14652     */
14653    public BenefitComponent setUsed(Type value) {
14654      if (value != null && !(value instanceof UnsignedIntType || value instanceof Money))
14655        throw new Error(
14656            "Not the right type for ExplanationOfBenefit.benefitBalance.financial.used[x]: " + value.fhirType());
14657      this.used = value;
14658      return this;
14659    }
14660
14661    protected void listChildren(List<Property> children) {
14662      super.listChildren(children);
14663      children.add(new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1, type));
14664      children.add(new Property("allowed[x]", "unsignedInt|string|Money",
14665          "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed));
14666      children.add(new Property("used[x]", "unsignedInt|Money",
14667          "The quantity of the benefit which have been consumed to date.", 0, 1, used));
14668    }
14669
14670    @Override
14671    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
14672      switch (_hash) {
14673      case 3575610:
14674        /* type */ return new Property("type", "CodeableConcept", "Classification of benefit being provided.", 0, 1,
14675            type);
14676      case -1336663592:
14677        /* allowed[x] */ return new Property("allowed[x]", "unsignedInt|string|Money",
14678            "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
14679      case -911343192:
14680        /* allowed */ return new Property("allowed[x]", "unsignedInt|string|Money",
14681            "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
14682      case 1668802034:
14683        /* allowedUnsignedInt */ return new Property("allowed[x]", "unsignedInt|string|Money",
14684            "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
14685      case -2135265319:
14686        /* allowedString */ return new Property("allowed[x]", "unsignedInt|string|Money",
14687            "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
14688      case -351668232:
14689        /* allowedMoney */ return new Property("allowed[x]", "unsignedInt|string|Money",
14690            "The quantity of the benefit which is permitted under the coverage.", 0, 1, allowed);
14691      case -147553373:
14692        /* used[x] */ return new Property("used[x]", "unsignedInt|Money",
14693            "The quantity of the benefit which have been consumed to date.", 0, 1, used);
14694      case 3599293:
14695        /* used */ return new Property("used[x]", "unsignedInt|Money",
14696            "The quantity of the benefit which have been consumed to date.", 0, 1, used);
14697      case 1252740285:
14698        /* usedUnsignedInt */ return new Property("used[x]", "unsignedInt|Money",
14699            "The quantity of the benefit which have been consumed to date.", 0, 1, used);
14700      case -78048509:
14701        /* usedMoney */ return new Property("used[x]", "unsignedInt|Money",
14702            "The quantity of the benefit which have been consumed to date.", 0, 1, used);
14703      default:
14704        return super.getNamedProperty(_hash, _name, _checkValid);
14705      }
14706
14707    }
14708
14709    @Override
14710    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
14711      switch (hash) {
14712      case 3575610:
14713        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
14714      case -911343192:
14715        /* allowed */ return this.allowed == null ? new Base[0] : new Base[] { this.allowed }; // Type
14716      case 3599293:
14717        /* used */ return this.used == null ? new Base[0] : new Base[] { this.used }; // Type
14718      default:
14719        return super.getProperty(hash, name, checkValid);
14720      }
14721
14722    }
14723
14724    @Override
14725    public Base setProperty(int hash, String name, Base value) throws FHIRException {
14726      switch (hash) {
14727      case 3575610: // type
14728        this.type = castToCodeableConcept(value); // CodeableConcept
14729        return value;
14730      case -911343192: // allowed
14731        this.allowed = castToType(value); // Type
14732        return value;
14733      case 3599293: // used
14734        this.used = castToType(value); // Type
14735        return value;
14736      default:
14737        return super.setProperty(hash, name, value);
14738      }
14739
14740    }
14741
14742    @Override
14743    public Base setProperty(String name, Base value) throws FHIRException {
14744      if (name.equals("type")) {
14745        this.type = castToCodeableConcept(value); // CodeableConcept
14746      } else if (name.equals("allowed[x]")) {
14747        this.allowed = castToType(value); // Type
14748      } else if (name.equals("used[x]")) {
14749        this.used = castToType(value); // Type
14750      } else
14751        return super.setProperty(name, value);
14752      return value;
14753    }
14754
14755  @Override
14756  public void removeChild(String name, Base value) throws FHIRException {
14757      if (name.equals("type")) {
14758        this.type = null;
14759      } else if (name.equals("allowed[x]")) {
14760        this.allowed = null;
14761      } else if (name.equals("used[x]")) {
14762        this.used = null;
14763      } else
14764        super.removeChild(name, value);
14765      
14766    }
14767
14768    @Override
14769    public Base makeProperty(int hash, String name) throws FHIRException {
14770      switch (hash) {
14771      case 3575610:
14772        return getType();
14773      case -1336663592:
14774        return getAllowed();
14775      case -911343192:
14776        return getAllowed();
14777      case -147553373:
14778        return getUsed();
14779      case 3599293:
14780        return getUsed();
14781      default:
14782        return super.makeProperty(hash, name);
14783      }
14784
14785    }
14786
14787    @Override
14788    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
14789      switch (hash) {
14790      case 3575610:
14791        /* type */ return new String[] { "CodeableConcept" };
14792      case -911343192:
14793        /* allowed */ return new String[] { "unsignedInt", "string", "Money" };
14794      case 3599293:
14795        /* used */ return new String[] { "unsignedInt", "Money" };
14796      default:
14797        return super.getTypesForProperty(hash, name);
14798      }
14799
14800    }
14801
14802    @Override
14803    public Base addChild(String name) throws FHIRException {
14804      if (name.equals("type")) {
14805        this.type = new CodeableConcept();
14806        return this.type;
14807      } else if (name.equals("allowedUnsignedInt")) {
14808        this.allowed = new UnsignedIntType();
14809        return this.allowed;
14810      } else if (name.equals("allowedString")) {
14811        this.allowed = new StringType();
14812        return this.allowed;
14813      } else if (name.equals("allowedMoney")) {
14814        this.allowed = new Money();
14815        return this.allowed;
14816      } else if (name.equals("usedUnsignedInt")) {
14817        this.used = new UnsignedIntType();
14818        return this.used;
14819      } else if (name.equals("usedMoney")) {
14820        this.used = new Money();
14821        return this.used;
14822      } else
14823        return super.addChild(name);
14824    }
14825
14826    public BenefitComponent copy() {
14827      BenefitComponent dst = new BenefitComponent();
14828      copyValues(dst);
14829      return dst;
14830    }
14831
14832    public void copyValues(BenefitComponent dst) {
14833      super.copyValues(dst);
14834      dst.type = type == null ? null : type.copy();
14835      dst.allowed = allowed == null ? null : allowed.copy();
14836      dst.used = used == null ? null : used.copy();
14837    }
14838
14839    @Override
14840    public boolean equalsDeep(Base other_) {
14841      if (!super.equalsDeep(other_))
14842        return false;
14843      if (!(other_ instanceof BenefitComponent))
14844        return false;
14845      BenefitComponent o = (BenefitComponent) other_;
14846      return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true)
14847          && compareDeep(used, o.used, true);
14848    }
14849
14850    @Override
14851    public boolean equalsShallow(Base other_) {
14852      if (!super.equalsShallow(other_))
14853        return false;
14854      if (!(other_ instanceof BenefitComponent))
14855        return false;
14856      BenefitComponent o = (BenefitComponent) other_;
14857      return true;
14858    }
14859
14860    public boolean isEmpty() {
14861      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed, used);
14862    }
14863
14864    public String fhirType() {
14865      return "ExplanationOfBenefit.benefitBalance.financial";
14866
14867    }
14868
14869  }
14870
14871  /**
14872   * A unique identifier assigned to this explanation of benefit.
14873   */
14874  @Child(name = "identifier", type = {
14875      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
14876  @Description(shortDefinition = "Business Identifier for the resource", formalDefinition = "A unique identifier assigned to this explanation of benefit.")
14877  protected List<Identifier> identifier;
14878
14879  /**
14880   * The status of the resource instance.
14881   */
14882  @Child(name = "status", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = true, summary = true)
14883  @Description(shortDefinition = "active | cancelled | draft | entered-in-error", formalDefinition = "The status of the resource instance.")
14884  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/explanationofbenefit-status")
14885  protected Enumeration<ExplanationOfBenefitStatus> status;
14886
14887  /**
14888   * The category of claim, e.g. oral, pharmacy, vision, institutional,
14889   * professional.
14890   */
14891  @Child(name = "type", type = { CodeableConcept.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
14892  @Description(shortDefinition = "Category or discipline", formalDefinition = "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.")
14893  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-type")
14894  protected CodeableConcept type;
14895
14896  /**
14897   * A finer grained suite of claim type codes which may convey additional
14898   * information such as Inpatient vs Outpatient and/or a specialty service.
14899   */
14900  @Child(name = "subType", type = {
14901      CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
14902  @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.")
14903  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-subtype")
14904  protected CodeableConcept subType;
14905
14906  /**
14907   * A code to indicate whether the nature of the request is: to request
14908   * adjudication of products and services previously rendered; or requesting
14909   * authorization and adjudication for provision in the future; or requesting the
14910   * non-binding adjudication of the listed products and services which could be
14911   * provided in the future.
14912   */
14913  @Child(name = "use", type = { CodeType.class }, order = 4, min = 1, max = 1, modifier = false, summary = true)
14914  @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.")
14915  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-use")
14916  protected Enumeration<Use> use;
14917
14918  /**
14919   * The party to whom the professional services and/or products have been
14920   * supplied or are being considered and for whom actual for forecast
14921   * reimbursement is sought.
14922   */
14923  @Child(name = "patient", type = { Patient.class }, order = 5, min = 1, max = 1, modifier = false, summary = true)
14924  @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.")
14925  protected Reference patient;
14926
14927  /**
14928   * The actual object that is the target of the reference (The party to whom the
14929   * professional services and/or products have been supplied or are being
14930   * considered and for whom actual for forecast reimbursement is sought.)
14931   */
14932  protected Patient patientTarget;
14933
14934  /**
14935   * The period for which charges are being submitted.
14936   */
14937  @Child(name = "billablePeriod", type = {
14938      Period.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
14939  @Description(shortDefinition = "Relevant time frame for the claim", formalDefinition = "The period for which charges are being submitted.")
14940  protected Period billablePeriod;
14941
14942  /**
14943   * The date this resource was created.
14944   */
14945  @Child(name = "created", type = { DateTimeType.class }, order = 7, min = 1, max = 1, modifier = false, summary = true)
14946  @Description(shortDefinition = "Response creation date", formalDefinition = "The date this resource was created.")
14947  protected DateTimeType created;
14948
14949  /**
14950   * Individual who created the claim, predetermination or preauthorization.
14951   */
14952  @Child(name = "enterer", type = { Practitioner.class,
14953      PractitionerRole.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
14954  @Description(shortDefinition = "Author of the claim", formalDefinition = "Individual who created the claim, predetermination or preauthorization.")
14955  protected Reference enterer;
14956
14957  /**
14958   * The actual object that is the target of the reference (Individual who created
14959   * the claim, predetermination or preauthorization.)
14960   */
14961  protected Resource entererTarget;
14962
14963  /**
14964   * The party responsible for authorization, adjudication and reimbursement.
14965   */
14966  @Child(name = "insurer", type = { Organization.class }, order = 9, min = 1, max = 1, modifier = false, summary = true)
14967  @Description(shortDefinition = "Party responsible for reimbursement", formalDefinition = "The party responsible for authorization, adjudication and reimbursement.")
14968  protected Reference insurer;
14969
14970  /**
14971   * The actual object that is the target of the reference (The party responsible
14972   * for authorization, adjudication and reimbursement.)
14973   */
14974  protected Organization insurerTarget;
14975
14976  /**
14977   * The provider which is responsible for the claim, predetermination or
14978   * preauthorization.
14979   */
14980  @Child(name = "provider", type = { Practitioner.class, PractitionerRole.class,
14981      Organization.class }, order = 10, min = 1, max = 1, modifier = false, summary = true)
14982  @Description(shortDefinition = "Party responsible for the claim", formalDefinition = "The provider which is responsible for the claim, predetermination or preauthorization.")
14983  protected Reference provider;
14984
14985  /**
14986   * The actual object that is the target of the reference (The provider which is
14987   * responsible for the claim, predetermination or preauthorization.)
14988   */
14989  protected Resource providerTarget;
14990
14991  /**
14992   * The provider-required urgency of processing the request. Typical values
14993   * include: stat, routine deferred.
14994   */
14995  @Child(name = "priority", type = {
14996      CodeableConcept.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
14997  @Description(shortDefinition = "Desired processing urgency", formalDefinition = "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.")
14998  protected CodeableConcept priority;
14999
15000  /**
15001   * A code to indicate whether and for whom funds are to be reserved for future
15002   * claims.
15003   */
15004  @Child(name = "fundsReserveRequested", type = {
15005      CodeableConcept.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
15006  @Description(shortDefinition = "For whom to reserve funds", formalDefinition = "A code to indicate whether and for whom funds are to be reserved for future claims.")
15007  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/fundsreserve")
15008  protected CodeableConcept fundsReserveRequested;
15009
15010  /**
15011   * A code, used only on a response to a preauthorization, to indicate whether
15012   * the benefits payable have been reserved and for whom.
15013   */
15014  @Child(name = "fundsReserve", type = {
15015      CodeableConcept.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
15016  @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.")
15017  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/fundsreserve")
15018  protected CodeableConcept fundsReserve;
15019
15020  /**
15021   * Other claims which are related to this claim such as prior submissions or
15022   * claims for related services or for the same event.
15023   */
15024  @Child(name = "related", type = {}, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15025  @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.")
15026  protected List<RelatedClaimComponent> related;
15027
15028  /**
15029   * Prescription to support the dispensing of pharmacy, device or vision
15030   * products.
15031   */
15032  @Child(name = "prescription", type = { MedicationRequest.class,
15033      VisionPrescription.class }, order = 15, min = 0, max = 1, modifier = false, summary = false)
15034  @Description(shortDefinition = "Prescription authorizing services or products", formalDefinition = "Prescription to support the dispensing of pharmacy, device or vision products.")
15035  protected Reference prescription;
15036
15037  /**
15038   * The actual object that is the target of the reference (Prescription to
15039   * support the dispensing of pharmacy, device or vision products.)
15040   */
15041  protected Resource prescriptionTarget;
15042
15043  /**
15044   * Original prescription which has been superseded by this prescription to
15045   * support the dispensing of pharmacy services, medications or products.
15046   */
15047  @Child(name = "originalPrescription", type = {
15048      MedicationRequest.class }, order = 16, min = 0, max = 1, modifier = false, summary = false)
15049  @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.")
15050  protected Reference originalPrescription;
15051
15052  /**
15053   * The actual object that is the target of the reference (Original prescription
15054   * which has been superseded by this prescription to support the dispensing of
15055   * pharmacy services, medications or products.)
15056   */
15057  protected MedicationRequest originalPrescriptionTarget;
15058
15059  /**
15060   * The party to be reimbursed for cost of the products and services according to
15061   * the terms of the policy.
15062   */
15063  @Child(name = "payee", type = {}, order = 17, min = 0, max = 1, modifier = false, summary = false)
15064  @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.")
15065  protected PayeeComponent payee;
15066
15067  /**
15068   * A reference to a referral resource.
15069   */
15070  @Child(name = "referral", type = {
15071      ServiceRequest.class }, order = 18, min = 0, max = 1, modifier = false, summary = false)
15072  @Description(shortDefinition = "Treatment Referral", formalDefinition = "A reference to a referral resource.")
15073  protected Reference referral;
15074
15075  /**
15076   * The actual object that is the target of the reference (A reference to a
15077   * referral resource.)
15078   */
15079  protected ServiceRequest referralTarget;
15080
15081  /**
15082   * Facility where the services were provided.
15083   */
15084  @Child(name = "facility", type = { Location.class }, order = 19, min = 0, max = 1, modifier = false, summary = false)
15085  @Description(shortDefinition = "Servicing Facility", formalDefinition = "Facility where the services were provided.")
15086  protected Reference facility;
15087
15088  /**
15089   * The actual object that is the target of the reference (Facility where the
15090   * services were provided.)
15091   */
15092  protected Location facilityTarget;
15093
15094  /**
15095   * The business identifier for the instance of the adjudication request: claim
15096   * predetermination or preauthorization.
15097   */
15098  @Child(name = "claim", type = { Claim.class }, order = 20, min = 0, max = 1, modifier = false, summary = false)
15099  @Description(shortDefinition = "Claim reference", formalDefinition = "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.")
15100  protected Reference claim;
15101
15102  /**
15103   * The actual object that is the target of the reference (The business
15104   * identifier for the instance of the adjudication request: claim
15105   * predetermination or preauthorization.)
15106   */
15107  protected Claim claimTarget;
15108
15109  /**
15110   * The business identifier for the instance of the adjudication response: claim,
15111   * predetermination or preauthorization response.
15112   */
15113  @Child(name = "claimResponse", type = {
15114      ClaimResponse.class }, order = 21, min = 0, max = 1, modifier = false, summary = false)
15115  @Description(shortDefinition = "Claim response reference", formalDefinition = "The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.")
15116  protected Reference claimResponse;
15117
15118  /**
15119   * The actual object that is the target of the reference (The business
15120   * identifier for the instance of the adjudication response: claim,
15121   * predetermination or preauthorization response.)
15122   */
15123  protected ClaimResponse claimResponseTarget;
15124
15125  /**
15126   * The outcome of the claim, predetermination, or preauthorization processing.
15127   */
15128  @Child(name = "outcome", type = { CodeType.class }, order = 22, min = 1, max = 1, modifier = false, summary = true)
15129  @Description(shortDefinition = "queued | complete | error | partial", formalDefinition = "The outcome of the claim, predetermination, or preauthorization processing.")
15130  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/remittance-outcome")
15131  protected Enumeration<RemittanceOutcome> outcome;
15132
15133  /**
15134   * A human readable description of the status of the adjudication.
15135   */
15136  @Child(name = "disposition", type = {
15137      StringType.class }, order = 23, min = 0, max = 1, modifier = false, summary = false)
15138  @Description(shortDefinition = "Disposition Message", formalDefinition = "A human readable description of the status of the adjudication.")
15139  protected StringType disposition;
15140
15141  /**
15142   * Reference from the Insurer which is used in later communications which refers
15143   * to this adjudication.
15144   */
15145  @Child(name = "preAuthRef", type = {
15146      StringType.class }, order = 24, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15147  @Description(shortDefinition = "Preauthorization reference", formalDefinition = "Reference from the Insurer which is used in later communications which refers to this adjudication.")
15148  protected List<StringType> preAuthRef;
15149
15150  /**
15151   * The timeframe during which the supplied preauthorization reference may be
15152   * quoted on claims to obtain the adjudication as provided.
15153   */
15154  @Child(name = "preAuthRefPeriod", type = {
15155      Period.class }, order = 25, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15156  @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.")
15157  protected List<Period> preAuthRefPeriod;
15158
15159  /**
15160   * The members of the team who provided the products and services.
15161   */
15162  @Child(name = "careTeam", type = {}, order = 26, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15163  @Description(shortDefinition = "Care Team members", formalDefinition = "The members of the team who provided the products and services.")
15164  protected List<CareTeamComponent> careTeam;
15165
15166  /**
15167   * Additional information codes regarding exceptions, special considerations,
15168   * the condition, situation, prior or concurrent issues.
15169   */
15170  @Child(name = "supportingInfo", type = {}, order = 27, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15171  @Description(shortDefinition = "Supporting information", formalDefinition = "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.")
15172  protected List<SupportingInformationComponent> supportingInfo;
15173
15174  /**
15175   * Information about diagnoses relevant to the claim items.
15176   */
15177  @Child(name = "diagnosis", type = {}, order = 28, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15178  @Description(shortDefinition = "Pertinent diagnosis information", formalDefinition = "Information about diagnoses relevant to the claim items.")
15179  protected List<DiagnosisComponent> diagnosis;
15180
15181  /**
15182   * Procedures performed on the patient relevant to the billing items with the
15183   * claim.
15184   */
15185  @Child(name = "procedure", type = {}, order = 29, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15186  @Description(shortDefinition = "Clinical procedures performed", formalDefinition = "Procedures performed on the patient relevant to the billing items with the claim.")
15187  protected List<ProcedureComponent> procedure;
15188
15189  /**
15190   * This indicates the relative order of a series of EOBs related to different
15191   * coverages for the same suite of services.
15192   */
15193  @Child(name = "precedence", type = {
15194      PositiveIntType.class }, order = 30, min = 0, max = 1, modifier = false, summary = false)
15195  @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.")
15196  protected PositiveIntType precedence;
15197
15198  /**
15199   * Financial instruments for reimbursement for the health care products and
15200   * services specified on the claim.
15201   */
15202  @Child(name = "insurance", type = {}, order = 31, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
15203  @Description(shortDefinition = "Patient insurance information", formalDefinition = "Financial instruments for reimbursement for the health care products and services specified on the claim.")
15204  protected List<InsuranceComponent> insurance;
15205
15206  /**
15207   * Details of a accident which resulted in injuries which required the products
15208   * and services listed in the claim.
15209   */
15210  @Child(name = "accident", type = {}, order = 32, min = 0, max = 1, modifier = false, summary = false)
15211  @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.")
15212  protected AccidentComponent accident;
15213
15214  /**
15215   * A claim line. Either a simple (a product or service) or a 'group' of details
15216   * which can also be a simple items or groups of sub-details.
15217   */
15218  @Child(name = "item", type = {}, order = 33, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15219  @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.")
15220  protected List<ItemComponent> item;
15221
15222  /**
15223   * The first-tier service adjudications for payor added product or service
15224   * lines.
15225   */
15226  @Child(name = "addItem", type = {}, order = 34, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15227  @Description(shortDefinition = "Insurer added line items", formalDefinition = "The first-tier service adjudications for payor added product or service lines.")
15228  protected List<AddedItemComponent> addItem;
15229
15230  /**
15231   * The adjudication results which are presented at the header level rather than
15232   * at the line-item or add-item levels.
15233   */
15234  @Child(name = "adjudication", type = {
15235      AdjudicationComponent.class }, order = 35, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15236  @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.")
15237  protected List<AdjudicationComponent> adjudication;
15238
15239  /**
15240   * Categorized monetary totals for the adjudication.
15241   */
15242  @Child(name = "total", type = {}, order = 36, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
15243  @Description(shortDefinition = "Adjudication totals", formalDefinition = "Categorized monetary totals for the adjudication.")
15244  protected List<TotalComponent> total;
15245
15246  /**
15247   * Payment details for the adjudication of the claim.
15248   */
15249  @Child(name = "payment", type = {}, order = 37, min = 0, max = 1, modifier = false, summary = false)
15250  @Description(shortDefinition = "Payment Details", formalDefinition = "Payment details for the adjudication of the claim.")
15251  protected PaymentComponent payment;
15252
15253  /**
15254   * A code for the form to be used for printing the content.
15255   */
15256  @Child(name = "formCode", type = {
15257      CodeableConcept.class }, order = 38, min = 0, max = 1, modifier = false, summary = false)
15258  @Description(shortDefinition = "Printed form identifier", formalDefinition = "A code for the form to be used for printing the content.")
15259  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/forms")
15260  protected CodeableConcept formCode;
15261
15262  /**
15263   * The actual form, by reference or inclusion, for printing the content or an
15264   * EOB.
15265   */
15266  @Child(name = "form", type = { Attachment.class }, order = 39, min = 0, max = 1, modifier = false, summary = false)
15267  @Description(shortDefinition = "Printed reference or actual form", formalDefinition = "The actual form, by reference or inclusion, for printing the content or an EOB.")
15268  protected Attachment form;
15269
15270  /**
15271   * A note that describes or explains adjudication results in a human readable
15272   * form.
15273   */
15274  @Child(name = "processNote", type = {}, order = 40, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15275  @Description(shortDefinition = "Note concerning adjudication", formalDefinition = "A note that describes or explains adjudication results in a human readable form.")
15276  protected List<NoteComponent> processNote;
15277
15278  /**
15279   * The term of the benefits documented in this response.
15280   */
15281  @Child(name = "benefitPeriod", type = {
15282      Period.class }, order = 41, min = 0, max = 1, modifier = false, summary = false)
15283  @Description(shortDefinition = "When the benefits are applicable", formalDefinition = "The term of the benefits documented in this response.")
15284  protected Period benefitPeriod;
15285
15286  /**
15287   * Balance by Benefit Category.
15288   */
15289  @Child(name = "benefitBalance", type = {}, order = 42, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
15290  @Description(shortDefinition = "Balance by Benefit Category", formalDefinition = "Balance by Benefit Category.")
15291  protected List<BenefitBalanceComponent> benefitBalance;
15292
15293  private static final long serialVersionUID = -1515422099L;
15294
15295  /**
15296   * Constructor
15297   */
15298  public ExplanationOfBenefit() {
15299    super();
15300  }
15301
15302  /**
15303   * Constructor
15304   */
15305  public ExplanationOfBenefit(Enumeration<ExplanationOfBenefitStatus> status, CodeableConcept type,
15306      Enumeration<Use> use, Reference patient, DateTimeType created, Reference insurer, Reference provider,
15307      Enumeration<RemittanceOutcome> outcome) {
15308    super();
15309    this.status = status;
15310    this.type = type;
15311    this.use = use;
15312    this.patient = patient;
15313    this.created = created;
15314    this.insurer = insurer;
15315    this.provider = provider;
15316    this.outcome = outcome;
15317  }
15318
15319  /**
15320   * @return {@link #identifier} (A unique identifier assigned to this explanation
15321   *         of benefit.)
15322   */
15323  public List<Identifier> getIdentifier() {
15324    if (this.identifier == null)
15325      this.identifier = new ArrayList<Identifier>();
15326    return this.identifier;
15327  }
15328
15329  /**
15330   * @return Returns a reference to <code>this</code> for easy method chaining
15331   */
15332  public ExplanationOfBenefit setIdentifier(List<Identifier> theIdentifier) {
15333    this.identifier = theIdentifier;
15334    return this;
15335  }
15336
15337  public boolean hasIdentifier() {
15338    if (this.identifier == null)
15339      return false;
15340    for (Identifier item : this.identifier)
15341      if (!item.isEmpty())
15342        return true;
15343    return false;
15344  }
15345
15346  public Identifier addIdentifier() { // 3
15347    Identifier t = new Identifier();
15348    if (this.identifier == null)
15349      this.identifier = new ArrayList<Identifier>();
15350    this.identifier.add(t);
15351    return t;
15352  }
15353
15354  public ExplanationOfBenefit addIdentifier(Identifier t) { // 3
15355    if (t == null)
15356      return this;
15357    if (this.identifier == null)
15358      this.identifier = new ArrayList<Identifier>();
15359    this.identifier.add(t);
15360    return this;
15361  }
15362
15363  /**
15364   * @return The first repetition of repeating field {@link #identifier}, creating
15365   *         it if it does not already exist
15366   */
15367  public Identifier getIdentifierFirstRep() {
15368    if (getIdentifier().isEmpty()) {
15369      addIdentifier();
15370    }
15371    return getIdentifier().get(0);
15372  }
15373
15374  /**
15375   * @return {@link #status} (The status of the resource instance.). This is the
15376   *         underlying object with id, value and extensions. The accessor
15377   *         "getStatus" gives direct access to the value
15378   */
15379  public Enumeration<ExplanationOfBenefitStatus> getStatusElement() {
15380    if (this.status == null)
15381      if (Configuration.errorOnAutoCreate())
15382        throw new Error("Attempt to auto-create ExplanationOfBenefit.status");
15383      else if (Configuration.doAutoCreate())
15384        this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory()); // bb
15385    return this.status;
15386  }
15387
15388  public boolean hasStatusElement() {
15389    return this.status != null && !this.status.isEmpty();
15390  }
15391
15392  public boolean hasStatus() {
15393    return this.status != null && !this.status.isEmpty();
15394  }
15395
15396  /**
15397   * @param value {@link #status} (The status of the resource instance.). This is
15398   *              the underlying object with id, value and extensions. The
15399   *              accessor "getStatus" gives direct access to the value
15400   */
15401  public ExplanationOfBenefit setStatusElement(Enumeration<ExplanationOfBenefitStatus> value) {
15402    this.status = value;
15403    return this;
15404  }
15405
15406  /**
15407   * @return The status of the resource instance.
15408   */
15409  public ExplanationOfBenefitStatus getStatus() {
15410    return this.status == null ? null : this.status.getValue();
15411  }
15412
15413  /**
15414   * @param value The status of the resource instance.
15415   */
15416  public ExplanationOfBenefit setStatus(ExplanationOfBenefitStatus value) {
15417    if (this.status == null)
15418      this.status = new Enumeration<ExplanationOfBenefitStatus>(new ExplanationOfBenefitStatusEnumFactory());
15419    this.status.setValue(value);
15420    return this;
15421  }
15422
15423  /**
15424   * @return {@link #type} (The category of claim, e.g. oral, pharmacy, vision,
15425   *         institutional, professional.)
15426   */
15427  public CodeableConcept getType() {
15428    if (this.type == null)
15429      if (Configuration.errorOnAutoCreate())
15430        throw new Error("Attempt to auto-create ExplanationOfBenefit.type");
15431      else if (Configuration.doAutoCreate())
15432        this.type = new CodeableConcept(); // cc
15433    return this.type;
15434  }
15435
15436  public boolean hasType() {
15437    return this.type != null && !this.type.isEmpty();
15438  }
15439
15440  /**
15441   * @param value {@link #type} (The category of claim, e.g. oral, pharmacy,
15442   *              vision, institutional, professional.)
15443   */
15444  public ExplanationOfBenefit setType(CodeableConcept value) {
15445    this.type = value;
15446    return this;
15447  }
15448
15449  /**
15450   * @return {@link #subType} (A finer grained suite of claim type codes which may
15451   *         convey additional information such as Inpatient vs Outpatient and/or
15452   *         a specialty service.)
15453   */
15454  public CodeableConcept getSubType() {
15455    if (this.subType == null)
15456      if (Configuration.errorOnAutoCreate())
15457        throw new Error("Attempt to auto-create ExplanationOfBenefit.subType");
15458      else if (Configuration.doAutoCreate())
15459        this.subType = new CodeableConcept(); // cc
15460    return this.subType;
15461  }
15462
15463  public boolean hasSubType() {
15464    return this.subType != null && !this.subType.isEmpty();
15465  }
15466
15467  /**
15468   * @param value {@link #subType} (A finer grained suite of claim type codes
15469   *              which may convey additional information such as Inpatient vs
15470   *              Outpatient and/or a specialty service.)
15471   */
15472  public ExplanationOfBenefit setSubType(CodeableConcept value) {
15473    this.subType = value;
15474    return this;
15475  }
15476
15477  /**
15478   * @return {@link #use} (A code to indicate whether the nature of the request
15479   *         is: to request adjudication of products and services previously
15480   *         rendered; or requesting authorization and adjudication for provision
15481   *         in the future; or requesting the non-binding adjudication of the
15482   *         listed products and services which could be provided in the future.).
15483   *         This is the underlying object with id, value and extensions. The
15484   *         accessor "getUse" gives direct access to the value
15485   */
15486  public Enumeration<Use> getUseElement() {
15487    if (this.use == null)
15488      if (Configuration.errorOnAutoCreate())
15489        throw new Error("Attempt to auto-create ExplanationOfBenefit.use");
15490      else if (Configuration.doAutoCreate())
15491        this.use = new Enumeration<Use>(new UseEnumFactory()); // bb
15492    return this.use;
15493  }
15494
15495  public boolean hasUseElement() {
15496    return this.use != null && !this.use.isEmpty();
15497  }
15498
15499  public boolean hasUse() {
15500    return this.use != null && !this.use.isEmpty();
15501  }
15502
15503  /**
15504   * @param value {@link #use} (A code to indicate whether the nature of the
15505   *              request is: to request adjudication of products and services
15506   *              previously rendered; or requesting authorization and
15507   *              adjudication for provision in the future; or requesting the
15508   *              non-binding adjudication of the listed products and services
15509   *              which could be provided in the future.). This is the underlying
15510   *              object with id, value and extensions. The accessor "getUse"
15511   *              gives direct access to the value
15512   */
15513  public ExplanationOfBenefit setUseElement(Enumeration<Use> value) {
15514    this.use = value;
15515    return this;
15516  }
15517
15518  /**
15519   * @return A code to indicate whether the nature of the request is: to request
15520   *         adjudication of products and services previously rendered; or
15521   *         requesting authorization and adjudication for provision in the
15522   *         future; or requesting the non-binding adjudication of the listed
15523   *         products and services which could be provided in the future.
15524   */
15525  public Use getUse() {
15526    return this.use == null ? null : this.use.getValue();
15527  }
15528
15529  /**
15530   * @param value A code to indicate whether the nature of the request is: to
15531   *              request adjudication of products and services previously
15532   *              rendered; or requesting authorization and adjudication for
15533   *              provision in the future; or requesting the non-binding
15534   *              adjudication of the listed products and services which could be
15535   *              provided in the future.
15536   */
15537  public ExplanationOfBenefit setUse(Use value) {
15538    if (this.use == null)
15539      this.use = new Enumeration<Use>(new UseEnumFactory());
15540    this.use.setValue(value);
15541    return this;
15542  }
15543
15544  /**
15545   * @return {@link #patient} (The party to whom the professional services and/or
15546   *         products have been supplied or are being considered and for whom
15547   *         actual for forecast reimbursement is sought.)
15548   */
15549  public Reference getPatient() {
15550    if (this.patient == null)
15551      if (Configuration.errorOnAutoCreate())
15552        throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
15553      else if (Configuration.doAutoCreate())
15554        this.patient = new Reference(); // cc
15555    return this.patient;
15556  }
15557
15558  public boolean hasPatient() {
15559    return this.patient != null && !this.patient.isEmpty();
15560  }
15561
15562  /**
15563   * @param value {@link #patient} (The party to whom the professional services
15564   *              and/or products have been supplied or are being considered and
15565   *              for whom actual for forecast reimbursement is sought.)
15566   */
15567  public ExplanationOfBenefit setPatient(Reference value) {
15568    this.patient = value;
15569    return this;
15570  }
15571
15572  /**
15573   * @return {@link #patient} The actual object that is the target of the
15574   *         reference. The reference library doesn't populate this, but you can
15575   *         use it to hold the resource if you resolve it. (The party to whom the
15576   *         professional services and/or products have been supplied or are being
15577   *         considered and for whom actual for forecast reimbursement is sought.)
15578   */
15579  public Patient getPatientTarget() {
15580    if (this.patientTarget == null)
15581      if (Configuration.errorOnAutoCreate())
15582        throw new Error("Attempt to auto-create ExplanationOfBenefit.patient");
15583      else if (Configuration.doAutoCreate())
15584        this.patientTarget = new Patient(); // aa
15585    return this.patientTarget;
15586  }
15587
15588  /**
15589   * @param value {@link #patient} The actual object that is the target of the
15590   *              reference. The reference library doesn't use these, but you can
15591   *              use it to hold the resource if you resolve it. (The party to
15592   *              whom the professional services and/or products have been
15593   *              supplied or are being considered and for whom actual for
15594   *              forecast reimbursement is sought.)
15595   */
15596  public ExplanationOfBenefit setPatientTarget(Patient value) {
15597    this.patientTarget = value;
15598    return this;
15599  }
15600
15601  /**
15602   * @return {@link #billablePeriod} (The period for which charges are being
15603   *         submitted.)
15604   */
15605  public Period getBillablePeriod() {
15606    if (this.billablePeriod == null)
15607      if (Configuration.errorOnAutoCreate())
15608        throw new Error("Attempt to auto-create ExplanationOfBenefit.billablePeriod");
15609      else if (Configuration.doAutoCreate())
15610        this.billablePeriod = new Period(); // cc
15611    return this.billablePeriod;
15612  }
15613
15614  public boolean hasBillablePeriod() {
15615    return this.billablePeriod != null && !this.billablePeriod.isEmpty();
15616  }
15617
15618  /**
15619   * @param value {@link #billablePeriod} (The period for which charges are being
15620   *              submitted.)
15621   */
15622  public ExplanationOfBenefit setBillablePeriod(Period value) {
15623    this.billablePeriod = value;
15624    return this;
15625  }
15626
15627  /**
15628   * @return {@link #created} (The date this resource was created.). This is the
15629   *         underlying object with id, value and extensions. The accessor
15630   *         "getCreated" gives direct access to the value
15631   */
15632  public DateTimeType getCreatedElement() {
15633    if (this.created == null)
15634      if (Configuration.errorOnAutoCreate())
15635        throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
15636      else if (Configuration.doAutoCreate())
15637        this.created = new DateTimeType(); // bb
15638    return this.created;
15639  }
15640
15641  public boolean hasCreatedElement() {
15642    return this.created != null && !this.created.isEmpty();
15643  }
15644
15645  public boolean hasCreated() {
15646    return this.created != null && !this.created.isEmpty();
15647  }
15648
15649  /**
15650   * @param value {@link #created} (The date this resource was created.). This is
15651   *              the underlying object with id, value and extensions. The
15652   *              accessor "getCreated" gives direct access to the value
15653   */
15654  public ExplanationOfBenefit setCreatedElement(DateTimeType value) {
15655    this.created = value;
15656    return this;
15657  }
15658
15659  /**
15660   * @return The date this resource was created.
15661   */
15662  public Date getCreated() {
15663    return this.created == null ? null : this.created.getValue();
15664  }
15665
15666  /**
15667   * @param value The date this resource was created.
15668   */
15669  public ExplanationOfBenefit setCreated(Date value) {
15670    if (this.created == null)
15671      this.created = new DateTimeType();
15672    this.created.setValue(value);
15673    return this;
15674  }
15675
15676  /**
15677   * @return {@link #enterer} (Individual who created the claim, predetermination
15678   *         or preauthorization.)
15679   */
15680  public Reference getEnterer() {
15681    if (this.enterer == null)
15682      if (Configuration.errorOnAutoCreate())
15683        throw new Error("Attempt to auto-create ExplanationOfBenefit.enterer");
15684      else if (Configuration.doAutoCreate())
15685        this.enterer = new Reference(); // cc
15686    return this.enterer;
15687  }
15688
15689  public boolean hasEnterer() {
15690    return this.enterer != null && !this.enterer.isEmpty();
15691  }
15692
15693  /**
15694   * @param value {@link #enterer} (Individual who created the claim,
15695   *              predetermination or preauthorization.)
15696   */
15697  public ExplanationOfBenefit setEnterer(Reference value) {
15698    this.enterer = value;
15699    return this;
15700  }
15701
15702  /**
15703   * @return {@link #enterer} The actual object that is the target of the
15704   *         reference. The reference library doesn't populate this, but you can
15705   *         use it to hold the resource if you resolve it. (Individual who
15706   *         created the claim, predetermination or preauthorization.)
15707   */
15708  public Resource getEntererTarget() {
15709    return this.entererTarget;
15710  }
15711
15712  /**
15713   * @param value {@link #enterer} The actual object that is the target of the
15714   *              reference. The reference library doesn't use these, but you can
15715   *              use it to hold the resource if you resolve it. (Individual who
15716   *              created the claim, predetermination or preauthorization.)
15717   */
15718  public ExplanationOfBenefit setEntererTarget(Resource value) {
15719    this.entererTarget = value;
15720    return this;
15721  }
15722
15723  /**
15724   * @return {@link #insurer} (The party responsible for authorization,
15725   *         adjudication and reimbursement.)
15726   */
15727  public Reference getInsurer() {
15728    if (this.insurer == null)
15729      if (Configuration.errorOnAutoCreate())
15730        throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
15731      else if (Configuration.doAutoCreate())
15732        this.insurer = new Reference(); // cc
15733    return this.insurer;
15734  }
15735
15736  public boolean hasInsurer() {
15737    return this.insurer != null && !this.insurer.isEmpty();
15738  }
15739
15740  /**
15741   * @param value {@link #insurer} (The party responsible for authorization,
15742   *              adjudication and reimbursement.)
15743   */
15744  public ExplanationOfBenefit setInsurer(Reference value) {
15745    this.insurer = value;
15746    return this;
15747  }
15748
15749  /**
15750   * @return {@link #insurer} The actual object that is the target of the
15751   *         reference. The reference library doesn't populate this, but you can
15752   *         use it to hold the resource if you resolve it. (The party responsible
15753   *         for authorization, adjudication and reimbursement.)
15754   */
15755  public Organization getInsurerTarget() {
15756    if (this.insurerTarget == null)
15757      if (Configuration.errorOnAutoCreate())
15758        throw new Error("Attempt to auto-create ExplanationOfBenefit.insurer");
15759      else if (Configuration.doAutoCreate())
15760        this.insurerTarget = new Organization(); // aa
15761    return this.insurerTarget;
15762  }
15763
15764  /**
15765   * @param value {@link #insurer} The actual object that is the target of the
15766   *              reference. The reference library doesn't use these, but you can
15767   *              use it to hold the resource if you resolve it. (The party
15768   *              responsible for authorization, adjudication and reimbursement.)
15769   */
15770  public ExplanationOfBenefit setInsurerTarget(Organization value) {
15771    this.insurerTarget = value;
15772    return this;
15773  }
15774
15775  /**
15776   * @return {@link #provider} (The provider which is responsible for the claim,
15777   *         predetermination or preauthorization.)
15778   */
15779  public Reference getProvider() {
15780    if (this.provider == null)
15781      if (Configuration.errorOnAutoCreate())
15782        throw new Error("Attempt to auto-create ExplanationOfBenefit.provider");
15783      else if (Configuration.doAutoCreate())
15784        this.provider = new Reference(); // cc
15785    return this.provider;
15786  }
15787
15788  public boolean hasProvider() {
15789    return this.provider != null && !this.provider.isEmpty();
15790  }
15791
15792  /**
15793   * @param value {@link #provider} (The provider which is responsible for the
15794   *              claim, predetermination or preauthorization.)
15795   */
15796  public ExplanationOfBenefit setProvider(Reference value) {
15797    this.provider = value;
15798    return this;
15799  }
15800
15801  /**
15802   * @return {@link #provider} 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. (The provider which is
15805   *         responsible for the claim, predetermination or preauthorization.)
15806   */
15807  public Resource getProviderTarget() {
15808    return this.providerTarget;
15809  }
15810
15811  /**
15812   * @param value {@link #provider} The actual object that is the target of the
15813   *              reference. The reference library doesn't use these, but you can
15814   *              use it to hold the resource if you resolve it. (The provider
15815   *              which is responsible for the claim, predetermination or
15816   *              preauthorization.)
15817   */
15818  public ExplanationOfBenefit setProviderTarget(Resource value) {
15819    this.providerTarget = value;
15820    return this;
15821  }
15822
15823  /**
15824   * @return {@link #priority} (The provider-required urgency of processing the
15825   *         request. Typical values include: stat, routine deferred.)
15826   */
15827  public CodeableConcept getPriority() {
15828    if (this.priority == null)
15829      if (Configuration.errorOnAutoCreate())
15830        throw new Error("Attempt to auto-create ExplanationOfBenefit.priority");
15831      else if (Configuration.doAutoCreate())
15832        this.priority = new CodeableConcept(); // cc
15833    return this.priority;
15834  }
15835
15836  public boolean hasPriority() {
15837    return this.priority != null && !this.priority.isEmpty();
15838  }
15839
15840  /**
15841   * @param value {@link #priority} (The provider-required urgency of processing
15842   *              the request. Typical values include: stat, routine deferred.)
15843   */
15844  public ExplanationOfBenefit setPriority(CodeableConcept value) {
15845    this.priority = value;
15846    return this;
15847  }
15848
15849  /**
15850   * @return {@link #fundsReserveRequested} (A code to indicate whether and for
15851   *         whom funds are to be reserved for future claims.)
15852   */
15853  public CodeableConcept getFundsReserveRequested() {
15854    if (this.fundsReserveRequested == null)
15855      if (Configuration.errorOnAutoCreate())
15856        throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserveRequested");
15857      else if (Configuration.doAutoCreate())
15858        this.fundsReserveRequested = new CodeableConcept(); // cc
15859    return this.fundsReserveRequested;
15860  }
15861
15862  public boolean hasFundsReserveRequested() {
15863    return this.fundsReserveRequested != null && !this.fundsReserveRequested.isEmpty();
15864  }
15865
15866  /**
15867   * @param value {@link #fundsReserveRequested} (A code to indicate whether and
15868   *              for whom funds are to be reserved for future claims.)
15869   */
15870  public ExplanationOfBenefit setFundsReserveRequested(CodeableConcept value) {
15871    this.fundsReserveRequested = value;
15872    return this;
15873  }
15874
15875  /**
15876   * @return {@link #fundsReserve} (A code, used only on a response to a
15877   *         preauthorization, to indicate whether the benefits payable have been
15878   *         reserved and for whom.)
15879   */
15880  public CodeableConcept getFundsReserve() {
15881    if (this.fundsReserve == null)
15882      if (Configuration.errorOnAutoCreate())
15883        throw new Error("Attempt to auto-create ExplanationOfBenefit.fundsReserve");
15884      else if (Configuration.doAutoCreate())
15885        this.fundsReserve = new CodeableConcept(); // cc
15886    return this.fundsReserve;
15887  }
15888
15889  public boolean hasFundsReserve() {
15890    return this.fundsReserve != null && !this.fundsReserve.isEmpty();
15891  }
15892
15893  /**
15894   * @param value {@link #fundsReserve} (A code, used only on a response to a
15895   *              preauthorization, to indicate whether the benefits payable have
15896   *              been reserved and for whom.)
15897   */
15898  public ExplanationOfBenefit setFundsReserve(CodeableConcept value) {
15899    this.fundsReserve = value;
15900    return this;
15901  }
15902
15903  /**
15904   * @return {@link #related} (Other claims which are related to this claim such
15905   *         as prior submissions or claims for related services or for the same
15906   *         event.)
15907   */
15908  public List<RelatedClaimComponent> getRelated() {
15909    if (this.related == null)
15910      this.related = new ArrayList<RelatedClaimComponent>();
15911    return this.related;
15912  }
15913
15914  /**
15915   * @return Returns a reference to <code>this</code> for easy method chaining
15916   */
15917  public ExplanationOfBenefit setRelated(List<RelatedClaimComponent> theRelated) {
15918    this.related = theRelated;
15919    return this;
15920  }
15921
15922  public boolean hasRelated() {
15923    if (this.related == null)
15924      return false;
15925    for (RelatedClaimComponent item : this.related)
15926      if (!item.isEmpty())
15927        return true;
15928    return false;
15929  }
15930
15931  public RelatedClaimComponent addRelated() { // 3
15932    RelatedClaimComponent t = new RelatedClaimComponent();
15933    if (this.related == null)
15934      this.related = new ArrayList<RelatedClaimComponent>();
15935    this.related.add(t);
15936    return t;
15937  }
15938
15939  public ExplanationOfBenefit addRelated(RelatedClaimComponent t) { // 3
15940    if (t == null)
15941      return this;
15942    if (this.related == null)
15943      this.related = new ArrayList<RelatedClaimComponent>();
15944    this.related.add(t);
15945    return this;
15946  }
15947
15948  /**
15949   * @return The first repetition of repeating field {@link #related}, creating it
15950   *         if it does not already exist
15951   */
15952  public RelatedClaimComponent getRelatedFirstRep() {
15953    if (getRelated().isEmpty()) {
15954      addRelated();
15955    }
15956    return getRelated().get(0);
15957  }
15958
15959  /**
15960   * @return {@link #prescription} (Prescription to support the dispensing of
15961   *         pharmacy, device or vision products.)
15962   */
15963  public Reference getPrescription() {
15964    if (this.prescription == null)
15965      if (Configuration.errorOnAutoCreate())
15966        throw new Error("Attempt to auto-create ExplanationOfBenefit.prescription");
15967      else if (Configuration.doAutoCreate())
15968        this.prescription = new Reference(); // cc
15969    return this.prescription;
15970  }
15971
15972  public boolean hasPrescription() {
15973    return this.prescription != null && !this.prescription.isEmpty();
15974  }
15975
15976  /**
15977   * @param value {@link #prescription} (Prescription to support the dispensing of
15978   *              pharmacy, device or vision products.)
15979   */
15980  public ExplanationOfBenefit setPrescription(Reference value) {
15981    this.prescription = value;
15982    return this;
15983  }
15984
15985  /**
15986   * @return {@link #prescription} The actual object that is the target of the
15987   *         reference. The reference library doesn't populate this, but you can
15988   *         use it to hold the resource if you resolve it. (Prescription to
15989   *         support the dispensing of pharmacy, device or vision products.)
15990   */
15991  public Resource getPrescriptionTarget() {
15992    return this.prescriptionTarget;
15993  }
15994
15995  /**
15996   * @param value {@link #prescription} The actual object that is the target of
15997   *              the reference. The reference library doesn't use these, but you
15998   *              can use it to hold the resource if you resolve it. (Prescription
15999   *              to support the dispensing of pharmacy, device or vision
16000   *              products.)
16001   */
16002  public ExplanationOfBenefit setPrescriptionTarget(Resource value) {
16003    this.prescriptionTarget = value;
16004    return this;
16005  }
16006
16007  /**
16008   * @return {@link #originalPrescription} (Original prescription which has been
16009   *         superseded by this prescription to support the dispensing of pharmacy
16010   *         services, medications or products.)
16011   */
16012  public Reference getOriginalPrescription() {
16013    if (this.originalPrescription == null)
16014      if (Configuration.errorOnAutoCreate())
16015        throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
16016      else if (Configuration.doAutoCreate())
16017        this.originalPrescription = new Reference(); // cc
16018    return this.originalPrescription;
16019  }
16020
16021  public boolean hasOriginalPrescription() {
16022    return this.originalPrescription != null && !this.originalPrescription.isEmpty();
16023  }
16024
16025  /**
16026   * @param value {@link #originalPrescription} (Original prescription which has
16027   *              been superseded by this prescription to support the dispensing
16028   *              of pharmacy services, medications or products.)
16029   */
16030  public ExplanationOfBenefit setOriginalPrescription(Reference value) {
16031    this.originalPrescription = value;
16032    return this;
16033  }
16034
16035  /**
16036   * @return {@link #originalPrescription} The actual object that is the target of
16037   *         the reference. The reference library doesn't populate this, but you
16038   *         can use it to hold the resource if you resolve it. (Original
16039   *         prescription which has been superseded by this prescription to
16040   *         support the dispensing of pharmacy services, medications or
16041   *         products.)
16042   */
16043  public MedicationRequest getOriginalPrescriptionTarget() {
16044    if (this.originalPrescriptionTarget == null)
16045      if (Configuration.errorOnAutoCreate())
16046        throw new Error("Attempt to auto-create ExplanationOfBenefit.originalPrescription");
16047      else if (Configuration.doAutoCreate())
16048        this.originalPrescriptionTarget = new MedicationRequest(); // aa
16049    return this.originalPrescriptionTarget;
16050  }
16051
16052  /**
16053   * @param value {@link #originalPrescription} The actual object that is the
16054   *              target of the reference. The reference library doesn't use
16055   *              these, but you can use it to hold the resource if you resolve
16056   *              it. (Original prescription which has been superseded by this
16057   *              prescription to support the dispensing of pharmacy services,
16058   *              medications or products.)
16059   */
16060  public ExplanationOfBenefit setOriginalPrescriptionTarget(MedicationRequest value) {
16061    this.originalPrescriptionTarget = value;
16062    return this;
16063  }
16064
16065  /**
16066   * @return {@link #payee} (The party to be reimbursed for cost of the products
16067   *         and services according to the terms of the policy.)
16068   */
16069  public PayeeComponent getPayee() {
16070    if (this.payee == null)
16071      if (Configuration.errorOnAutoCreate())
16072        throw new Error("Attempt to auto-create ExplanationOfBenefit.payee");
16073      else if (Configuration.doAutoCreate())
16074        this.payee = new PayeeComponent(); // cc
16075    return this.payee;
16076  }
16077
16078  public boolean hasPayee() {
16079    return this.payee != null && !this.payee.isEmpty();
16080  }
16081
16082  /**
16083   * @param value {@link #payee} (The party to be reimbursed for cost of the
16084   *              products and services according to the terms of the policy.)
16085   */
16086  public ExplanationOfBenefit setPayee(PayeeComponent value) {
16087    this.payee = value;
16088    return this;
16089  }
16090
16091  /**
16092   * @return {@link #referral} (A reference to a referral resource.)
16093   */
16094  public Reference getReferral() {
16095    if (this.referral == null)
16096      if (Configuration.errorOnAutoCreate())
16097        throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
16098      else if (Configuration.doAutoCreate())
16099        this.referral = new Reference(); // cc
16100    return this.referral;
16101  }
16102
16103  public boolean hasReferral() {
16104    return this.referral != null && !this.referral.isEmpty();
16105  }
16106
16107  /**
16108   * @param value {@link #referral} (A reference to a referral resource.)
16109   */
16110  public ExplanationOfBenefit setReferral(Reference value) {
16111    this.referral = value;
16112    return this;
16113  }
16114
16115  /**
16116   * @return {@link #referral} The actual object that is the target of the
16117   *         reference. The reference library doesn't populate this, but you can
16118   *         use it to hold the resource if you resolve it. (A reference to a
16119   *         referral resource.)
16120   */
16121  public ServiceRequest getReferralTarget() {
16122    if (this.referralTarget == null)
16123      if (Configuration.errorOnAutoCreate())
16124        throw new Error("Attempt to auto-create ExplanationOfBenefit.referral");
16125      else if (Configuration.doAutoCreate())
16126        this.referralTarget = new ServiceRequest(); // aa
16127    return this.referralTarget;
16128  }
16129
16130  /**
16131   * @param value {@link #referral} The actual object that is the target of the
16132   *              reference. The reference library doesn't use these, but you can
16133   *              use it to hold the resource if you resolve it. (A reference to a
16134   *              referral resource.)
16135   */
16136  public ExplanationOfBenefit setReferralTarget(ServiceRequest value) {
16137    this.referralTarget = value;
16138    return this;
16139  }
16140
16141  /**
16142   * @return {@link #facility} (Facility where the services were provided.)
16143   */
16144  public Reference getFacility() {
16145    if (this.facility == null)
16146      if (Configuration.errorOnAutoCreate())
16147        throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
16148      else if (Configuration.doAutoCreate())
16149        this.facility = new Reference(); // cc
16150    return this.facility;
16151  }
16152
16153  public boolean hasFacility() {
16154    return this.facility != null && !this.facility.isEmpty();
16155  }
16156
16157  /**
16158   * @param value {@link #facility} (Facility where the services were provided.)
16159   */
16160  public ExplanationOfBenefit setFacility(Reference value) {
16161    this.facility = value;
16162    return this;
16163  }
16164
16165  /**
16166   * @return {@link #facility} The actual object that is the target of the
16167   *         reference. The reference library doesn't populate this, but you can
16168   *         use it to hold the resource if you resolve it. (Facility where the
16169   *         services were provided.)
16170   */
16171  public Location getFacilityTarget() {
16172    if (this.facilityTarget == null)
16173      if (Configuration.errorOnAutoCreate())
16174        throw new Error("Attempt to auto-create ExplanationOfBenefit.facility");
16175      else if (Configuration.doAutoCreate())
16176        this.facilityTarget = new Location(); // aa
16177    return this.facilityTarget;
16178  }
16179
16180  /**
16181   * @param value {@link #facility} The actual object that is the target of the
16182   *              reference. The reference library doesn't use these, but you can
16183   *              use it to hold the resource if you resolve it. (Facility where
16184   *              the services were provided.)
16185   */
16186  public ExplanationOfBenefit setFacilityTarget(Location value) {
16187    this.facilityTarget = value;
16188    return this;
16189  }
16190
16191  /**
16192   * @return {@link #claim} (The business identifier for the instance of the
16193   *         adjudication request: claim predetermination or preauthorization.)
16194   */
16195  public Reference getClaim() {
16196    if (this.claim == null)
16197      if (Configuration.errorOnAutoCreate())
16198        throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
16199      else if (Configuration.doAutoCreate())
16200        this.claim = new Reference(); // cc
16201    return this.claim;
16202  }
16203
16204  public boolean hasClaim() {
16205    return this.claim != null && !this.claim.isEmpty();
16206  }
16207
16208  /**
16209   * @param value {@link #claim} (The business identifier for the instance of the
16210   *              adjudication request: claim predetermination or
16211   *              preauthorization.)
16212   */
16213  public ExplanationOfBenefit setClaim(Reference value) {
16214    this.claim = value;
16215    return this;
16216  }
16217
16218  /**
16219   * @return {@link #claim} The actual object that is the target of the reference.
16220   *         The reference library doesn't populate this, but you can use it to
16221   *         hold the resource if you resolve it. (The business identifier for the
16222   *         instance of the adjudication request: claim predetermination or
16223   *         preauthorization.)
16224   */
16225  public Claim getClaimTarget() {
16226    if (this.claimTarget == null)
16227      if (Configuration.errorOnAutoCreate())
16228        throw new Error("Attempt to auto-create ExplanationOfBenefit.claim");
16229      else if (Configuration.doAutoCreate())
16230        this.claimTarget = new Claim(); // aa
16231    return this.claimTarget;
16232  }
16233
16234  /**
16235   * @param value {@link #claim} The actual object that is the target of the
16236   *              reference. The reference library doesn't use these, but you can
16237   *              use it to hold the resource if you resolve it. (The business
16238   *              identifier for the instance of the adjudication request: claim
16239   *              predetermination or preauthorization.)
16240   */
16241  public ExplanationOfBenefit setClaimTarget(Claim value) {
16242    this.claimTarget = value;
16243    return this;
16244  }
16245
16246  /**
16247   * @return {@link #claimResponse} (The business identifier for the instance of
16248   *         the adjudication response: claim, predetermination or
16249   *         preauthorization response.)
16250   */
16251  public Reference getClaimResponse() {
16252    if (this.claimResponse == null)
16253      if (Configuration.errorOnAutoCreate())
16254        throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
16255      else if (Configuration.doAutoCreate())
16256        this.claimResponse = new Reference(); // cc
16257    return this.claimResponse;
16258  }
16259
16260  public boolean hasClaimResponse() {
16261    return this.claimResponse != null && !this.claimResponse.isEmpty();
16262  }
16263
16264  /**
16265   * @param value {@link #claimResponse} (The business identifier for the instance
16266   *              of the adjudication response: claim, predetermination or
16267   *              preauthorization response.)
16268   */
16269  public ExplanationOfBenefit setClaimResponse(Reference value) {
16270    this.claimResponse = value;
16271    return this;
16272  }
16273
16274  /**
16275   * @return {@link #claimResponse} The actual object that is the target of the
16276   *         reference. The reference library doesn't populate this, but you can
16277   *         use it to hold the resource if you resolve it. (The business
16278   *         identifier for the instance of the adjudication response: claim,
16279   *         predetermination or preauthorization response.)
16280   */
16281  public ClaimResponse getClaimResponseTarget() {
16282    if (this.claimResponseTarget == null)
16283      if (Configuration.errorOnAutoCreate())
16284        throw new Error("Attempt to auto-create ExplanationOfBenefit.claimResponse");
16285      else if (Configuration.doAutoCreate())
16286        this.claimResponseTarget = new ClaimResponse(); // aa
16287    return this.claimResponseTarget;
16288  }
16289
16290  /**
16291   * @param value {@link #claimResponse} The actual object that is the target of
16292   *              the reference. The reference library doesn't use these, but you
16293   *              can use it to hold the resource if you resolve it. (The business
16294   *              identifier for the instance of the adjudication response: claim,
16295   *              predetermination or preauthorization response.)
16296   */
16297  public ExplanationOfBenefit setClaimResponseTarget(ClaimResponse value) {
16298    this.claimResponseTarget = value;
16299    return this;
16300  }
16301
16302  /**
16303   * @return {@link #outcome} (The outcome of the claim, predetermination, or
16304   *         preauthorization processing.). This is the underlying object with id,
16305   *         value and extensions. The accessor "getOutcome" gives direct access
16306   *         to the value
16307   */
16308  public Enumeration<RemittanceOutcome> getOutcomeElement() {
16309    if (this.outcome == null)
16310      if (Configuration.errorOnAutoCreate())
16311        throw new Error("Attempt to auto-create ExplanationOfBenefit.outcome");
16312      else if (Configuration.doAutoCreate())
16313        this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory()); // bb
16314    return this.outcome;
16315  }
16316
16317  public boolean hasOutcomeElement() {
16318    return this.outcome != null && !this.outcome.isEmpty();
16319  }
16320
16321  public boolean hasOutcome() {
16322    return this.outcome != null && !this.outcome.isEmpty();
16323  }
16324
16325  /**
16326   * @param value {@link #outcome} (The outcome of the claim, predetermination, or
16327   *              preauthorization processing.). This is the underlying object
16328   *              with id, value and extensions. The accessor "getOutcome" gives
16329   *              direct access to the value
16330   */
16331  public ExplanationOfBenefit setOutcomeElement(Enumeration<RemittanceOutcome> value) {
16332    this.outcome = value;
16333    return this;
16334  }
16335
16336  /**
16337   * @return The outcome of the claim, predetermination, or preauthorization
16338   *         processing.
16339   */
16340  public RemittanceOutcome getOutcome() {
16341    return this.outcome == null ? null : this.outcome.getValue();
16342  }
16343
16344  /**
16345   * @param value The outcome of the claim, predetermination, or preauthorization
16346   *              processing.
16347   */
16348  public ExplanationOfBenefit setOutcome(RemittanceOutcome value) {
16349    if (this.outcome == null)
16350      this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory());
16351    this.outcome.setValue(value);
16352    return this;
16353  }
16354
16355  /**
16356   * @return {@link #disposition} (A human readable description of the status of
16357   *         the adjudication.). This is the underlying object with id, value and
16358   *         extensions. The accessor "getDisposition" gives direct access to the
16359   *         value
16360   */
16361  public StringType getDispositionElement() {
16362    if (this.disposition == null)
16363      if (Configuration.errorOnAutoCreate())
16364        throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
16365      else if (Configuration.doAutoCreate())
16366        this.disposition = new StringType(); // bb
16367    return this.disposition;
16368  }
16369
16370  public boolean hasDispositionElement() {
16371    return this.disposition != null && !this.disposition.isEmpty();
16372  }
16373
16374  public boolean hasDisposition() {
16375    return this.disposition != null && !this.disposition.isEmpty();
16376  }
16377
16378  /**
16379   * @param value {@link #disposition} (A human readable description of the status
16380   *              of the adjudication.). This is the underlying object with id,
16381   *              value and extensions. The accessor "getDisposition" gives direct
16382   *              access to the value
16383   */
16384  public ExplanationOfBenefit setDispositionElement(StringType value) {
16385    this.disposition = value;
16386    return this;
16387  }
16388
16389  /**
16390   * @return A human readable description of the status of the adjudication.
16391   */
16392  public String getDisposition() {
16393    return this.disposition == null ? null : this.disposition.getValue();
16394  }
16395
16396  /**
16397   * @param value A human readable description of the status of the adjudication.
16398   */
16399  public ExplanationOfBenefit setDisposition(String value) {
16400    if (Utilities.noString(value))
16401      this.disposition = null;
16402    else {
16403      if (this.disposition == null)
16404        this.disposition = new StringType();
16405      this.disposition.setValue(value);
16406    }
16407    return this;
16408  }
16409
16410  /**
16411   * @return {@link #preAuthRef} (Reference from the Insurer which is used in
16412   *         later communications which refers to this adjudication.)
16413   */
16414  public List<StringType> getPreAuthRef() {
16415    if (this.preAuthRef == null)
16416      this.preAuthRef = new ArrayList<StringType>();
16417    return this.preAuthRef;
16418  }
16419
16420  /**
16421   * @return Returns a reference to <code>this</code> for easy method chaining
16422   */
16423  public ExplanationOfBenefit setPreAuthRef(List<StringType> thePreAuthRef) {
16424    this.preAuthRef = thePreAuthRef;
16425    return this;
16426  }
16427
16428  public boolean hasPreAuthRef() {
16429    if (this.preAuthRef == null)
16430      return false;
16431    for (StringType item : this.preAuthRef)
16432      if (!item.isEmpty())
16433        return true;
16434    return false;
16435  }
16436
16437  /**
16438   * @return {@link #preAuthRef} (Reference from the Insurer which is used in
16439   *         later communications which refers to this adjudication.)
16440   */
16441  public StringType addPreAuthRefElement() {// 2
16442    StringType t = new StringType();
16443    if (this.preAuthRef == null)
16444      this.preAuthRef = new ArrayList<StringType>();
16445    this.preAuthRef.add(t);
16446    return t;
16447  }
16448
16449  /**
16450   * @param value {@link #preAuthRef} (Reference from the Insurer which is used in
16451   *              later communications which refers to this adjudication.)
16452   */
16453  public ExplanationOfBenefit addPreAuthRef(String value) { // 1
16454    StringType t = new StringType();
16455    t.setValue(value);
16456    if (this.preAuthRef == null)
16457      this.preAuthRef = new ArrayList<StringType>();
16458    this.preAuthRef.add(t);
16459    return this;
16460  }
16461
16462  /**
16463   * @param value {@link #preAuthRef} (Reference from the Insurer which is used in
16464   *              later communications which refers to this adjudication.)
16465   */
16466  public boolean hasPreAuthRef(String value) {
16467    if (this.preAuthRef == null)
16468      return false;
16469    for (StringType v : this.preAuthRef)
16470      if (v.getValue().equals(value)) // string
16471        return true;
16472    return false;
16473  }
16474
16475  /**
16476   * @return {@link #preAuthRefPeriod} (The timeframe during which the supplied
16477   *         preauthorization reference may be quoted on claims to obtain the
16478   *         adjudication as provided.)
16479   */
16480  public List<Period> getPreAuthRefPeriod() {
16481    if (this.preAuthRefPeriod == null)
16482      this.preAuthRefPeriod = new ArrayList<Period>();
16483    return this.preAuthRefPeriod;
16484  }
16485
16486  /**
16487   * @return Returns a reference to <code>this</code> for easy method chaining
16488   */
16489  public ExplanationOfBenefit setPreAuthRefPeriod(List<Period> thePreAuthRefPeriod) {
16490    this.preAuthRefPeriod = thePreAuthRefPeriod;
16491    return this;
16492  }
16493
16494  public boolean hasPreAuthRefPeriod() {
16495    if (this.preAuthRefPeriod == null)
16496      return false;
16497    for (Period item : this.preAuthRefPeriod)
16498      if (!item.isEmpty())
16499        return true;
16500    return false;
16501  }
16502
16503  public Period addPreAuthRefPeriod() { // 3
16504    Period t = new Period();
16505    if (this.preAuthRefPeriod == null)
16506      this.preAuthRefPeriod = new ArrayList<Period>();
16507    this.preAuthRefPeriod.add(t);
16508    return t;
16509  }
16510
16511  public ExplanationOfBenefit addPreAuthRefPeriod(Period t) { // 3
16512    if (t == null)
16513      return this;
16514    if (this.preAuthRefPeriod == null)
16515      this.preAuthRefPeriod = new ArrayList<Period>();
16516    this.preAuthRefPeriod.add(t);
16517    return this;
16518  }
16519
16520  /**
16521   * @return The first repetition of repeating field {@link #preAuthRefPeriod},
16522   *         creating it if it does not already exist
16523   */
16524  public Period getPreAuthRefPeriodFirstRep() {
16525    if (getPreAuthRefPeriod().isEmpty()) {
16526      addPreAuthRefPeriod();
16527    }
16528    return getPreAuthRefPeriod().get(0);
16529  }
16530
16531  /**
16532   * @return {@link #careTeam} (The members of the team who provided the products
16533   *         and services.)
16534   */
16535  public List<CareTeamComponent> getCareTeam() {
16536    if (this.careTeam == null)
16537      this.careTeam = new ArrayList<CareTeamComponent>();
16538    return this.careTeam;
16539  }
16540
16541  /**
16542   * @return Returns a reference to <code>this</code> for easy method chaining
16543   */
16544  public ExplanationOfBenefit setCareTeam(List<CareTeamComponent> theCareTeam) {
16545    this.careTeam = theCareTeam;
16546    return this;
16547  }
16548
16549  public boolean hasCareTeam() {
16550    if (this.careTeam == null)
16551      return false;
16552    for (CareTeamComponent item : this.careTeam)
16553      if (!item.isEmpty())
16554        return true;
16555    return false;
16556  }
16557
16558  public CareTeamComponent addCareTeam() { // 3
16559    CareTeamComponent t = new CareTeamComponent();
16560    if (this.careTeam == null)
16561      this.careTeam = new ArrayList<CareTeamComponent>();
16562    this.careTeam.add(t);
16563    return t;
16564  }
16565
16566  public ExplanationOfBenefit addCareTeam(CareTeamComponent t) { // 3
16567    if (t == null)
16568      return this;
16569    if (this.careTeam == null)
16570      this.careTeam = new ArrayList<CareTeamComponent>();
16571    this.careTeam.add(t);
16572    return this;
16573  }
16574
16575  /**
16576   * @return The first repetition of repeating field {@link #careTeam}, creating
16577   *         it if it does not already exist
16578   */
16579  public CareTeamComponent getCareTeamFirstRep() {
16580    if (getCareTeam().isEmpty()) {
16581      addCareTeam();
16582    }
16583    return getCareTeam().get(0);
16584  }
16585
16586  /**
16587   * @return {@link #supportingInfo} (Additional information codes regarding
16588   *         exceptions, special considerations, the condition, situation, prior
16589   *         or concurrent issues.)
16590   */
16591  public List<SupportingInformationComponent> getSupportingInfo() {
16592    if (this.supportingInfo == null)
16593      this.supportingInfo = new ArrayList<SupportingInformationComponent>();
16594    return this.supportingInfo;
16595  }
16596
16597  /**
16598   * @return Returns a reference to <code>this</code> for easy method chaining
16599   */
16600  public ExplanationOfBenefit setSupportingInfo(List<SupportingInformationComponent> theSupportingInfo) {
16601    this.supportingInfo = theSupportingInfo;
16602    return this;
16603  }
16604
16605  public boolean hasSupportingInfo() {
16606    if (this.supportingInfo == null)
16607      return false;
16608    for (SupportingInformationComponent item : this.supportingInfo)
16609      if (!item.isEmpty())
16610        return true;
16611    return false;
16612  }
16613
16614  public SupportingInformationComponent addSupportingInfo() { // 3
16615    SupportingInformationComponent t = new SupportingInformationComponent();
16616    if (this.supportingInfo == null)
16617      this.supportingInfo = new ArrayList<SupportingInformationComponent>();
16618    this.supportingInfo.add(t);
16619    return t;
16620  }
16621
16622  public ExplanationOfBenefit addSupportingInfo(SupportingInformationComponent t) { // 3
16623    if (t == null)
16624      return this;
16625    if (this.supportingInfo == null)
16626      this.supportingInfo = new ArrayList<SupportingInformationComponent>();
16627    this.supportingInfo.add(t);
16628    return this;
16629  }
16630
16631  /**
16632   * @return The first repetition of repeating field {@link #supportingInfo},
16633   *         creating it if it does not already exist
16634   */
16635  public SupportingInformationComponent getSupportingInfoFirstRep() {
16636    if (getSupportingInfo().isEmpty()) {
16637      addSupportingInfo();
16638    }
16639    return getSupportingInfo().get(0);
16640  }
16641
16642  /**
16643   * @return {@link #diagnosis} (Information about diagnoses relevant to the claim
16644   *         items.)
16645   */
16646  public List<DiagnosisComponent> getDiagnosis() {
16647    if (this.diagnosis == null)
16648      this.diagnosis = new ArrayList<DiagnosisComponent>();
16649    return this.diagnosis;
16650  }
16651
16652  /**
16653   * @return Returns a reference to <code>this</code> for easy method chaining
16654   */
16655  public ExplanationOfBenefit setDiagnosis(List<DiagnosisComponent> theDiagnosis) {
16656    this.diagnosis = theDiagnosis;
16657    return this;
16658  }
16659
16660  public boolean hasDiagnosis() {
16661    if (this.diagnosis == null)
16662      return false;
16663    for (DiagnosisComponent item : this.diagnosis)
16664      if (!item.isEmpty())
16665        return true;
16666    return false;
16667  }
16668
16669  public DiagnosisComponent addDiagnosis() { // 3
16670    DiagnosisComponent t = new DiagnosisComponent();
16671    if (this.diagnosis == null)
16672      this.diagnosis = new ArrayList<DiagnosisComponent>();
16673    this.diagnosis.add(t);
16674    return t;
16675  }
16676
16677  public ExplanationOfBenefit addDiagnosis(DiagnosisComponent t) { // 3
16678    if (t == null)
16679      return this;
16680    if (this.diagnosis == null)
16681      this.diagnosis = new ArrayList<DiagnosisComponent>();
16682    this.diagnosis.add(t);
16683    return this;
16684  }
16685
16686  /**
16687   * @return The first repetition of repeating field {@link #diagnosis}, creating
16688   *         it if it does not already exist
16689   */
16690  public DiagnosisComponent getDiagnosisFirstRep() {
16691    if (getDiagnosis().isEmpty()) {
16692      addDiagnosis();
16693    }
16694    return getDiagnosis().get(0);
16695  }
16696
16697  /**
16698   * @return {@link #procedure} (Procedures performed on the patient relevant to
16699   *         the billing items with the claim.)
16700   */
16701  public List<ProcedureComponent> getProcedure() {
16702    if (this.procedure == null)
16703      this.procedure = new ArrayList<ProcedureComponent>();
16704    return this.procedure;
16705  }
16706
16707  /**
16708   * @return Returns a reference to <code>this</code> for easy method chaining
16709   */
16710  public ExplanationOfBenefit setProcedure(List<ProcedureComponent> theProcedure) {
16711    this.procedure = theProcedure;
16712    return this;
16713  }
16714
16715  public boolean hasProcedure() {
16716    if (this.procedure == null)
16717      return false;
16718    for (ProcedureComponent item : this.procedure)
16719      if (!item.isEmpty())
16720        return true;
16721    return false;
16722  }
16723
16724  public ProcedureComponent addProcedure() { // 3
16725    ProcedureComponent t = new ProcedureComponent();
16726    if (this.procedure == null)
16727      this.procedure = new ArrayList<ProcedureComponent>();
16728    this.procedure.add(t);
16729    return t;
16730  }
16731
16732  public ExplanationOfBenefit addProcedure(ProcedureComponent t) { // 3
16733    if (t == null)
16734      return this;
16735    if (this.procedure == null)
16736      this.procedure = new ArrayList<ProcedureComponent>();
16737    this.procedure.add(t);
16738    return this;
16739  }
16740
16741  /**
16742   * @return The first repetition of repeating field {@link #procedure}, creating
16743   *         it if it does not already exist
16744   */
16745  public ProcedureComponent getProcedureFirstRep() {
16746    if (getProcedure().isEmpty()) {
16747      addProcedure();
16748    }
16749    return getProcedure().get(0);
16750  }
16751
16752  /**
16753   * @return {@link #precedence} (This indicates the relative order of a series of
16754   *         EOBs related to different coverages for the same suite of services.).
16755   *         This is the underlying object with id, value and extensions. The
16756   *         accessor "getPrecedence" gives direct access to the value
16757   */
16758  public PositiveIntType getPrecedenceElement() {
16759    if (this.precedence == null)
16760      if (Configuration.errorOnAutoCreate())
16761        throw new Error("Attempt to auto-create ExplanationOfBenefit.precedence");
16762      else if (Configuration.doAutoCreate())
16763        this.precedence = new PositiveIntType(); // bb
16764    return this.precedence;
16765  }
16766
16767  public boolean hasPrecedenceElement() {
16768    return this.precedence != null && !this.precedence.isEmpty();
16769  }
16770
16771  public boolean hasPrecedence() {
16772    return this.precedence != null && !this.precedence.isEmpty();
16773  }
16774
16775  /**
16776   * @param value {@link #precedence} (This indicates the relative order of a
16777   *              series of EOBs related to different coverages for the same suite
16778   *              of services.). This is the underlying object with id, value and
16779   *              extensions. The accessor "getPrecedence" gives direct access to
16780   *              the value
16781   */
16782  public ExplanationOfBenefit setPrecedenceElement(PositiveIntType value) {
16783    this.precedence = value;
16784    return this;
16785  }
16786
16787  /**
16788   * @return This indicates the relative order of a series of EOBs related to
16789   *         different coverages for the same suite of services.
16790   */
16791  public int getPrecedence() {
16792    return this.precedence == null || this.precedence.isEmpty() ? 0 : this.precedence.getValue();
16793  }
16794
16795  /**
16796   * @param value This indicates the relative order of a series of EOBs related to
16797   *              different coverages for the same suite of services.
16798   */
16799  public ExplanationOfBenefit setPrecedence(int value) {
16800    if (this.precedence == null)
16801      this.precedence = new PositiveIntType();
16802    this.precedence.setValue(value);
16803    return this;
16804  }
16805
16806  /**
16807   * @return {@link #insurance} (Financial instruments for reimbursement for the
16808   *         health care products and services specified on the claim.)
16809   */
16810  public List<InsuranceComponent> getInsurance() {
16811    if (this.insurance == null)
16812      this.insurance = new ArrayList<InsuranceComponent>();
16813    return this.insurance;
16814  }
16815
16816  /**
16817   * @return Returns a reference to <code>this</code> for easy method chaining
16818   */
16819  public ExplanationOfBenefit setInsurance(List<InsuranceComponent> theInsurance) {
16820    this.insurance = theInsurance;
16821    return this;
16822  }
16823
16824  public boolean hasInsurance() {
16825    if (this.insurance == null)
16826      return false;
16827    for (InsuranceComponent item : this.insurance)
16828      if (!item.isEmpty())
16829        return true;
16830    return false;
16831  }
16832
16833  public InsuranceComponent addInsurance() { // 3
16834    InsuranceComponent t = new InsuranceComponent();
16835    if (this.insurance == null)
16836      this.insurance = new ArrayList<InsuranceComponent>();
16837    this.insurance.add(t);
16838    return t;
16839  }
16840
16841  public ExplanationOfBenefit addInsurance(InsuranceComponent t) { // 3
16842    if (t == null)
16843      return this;
16844    if (this.insurance == null)
16845      this.insurance = new ArrayList<InsuranceComponent>();
16846    this.insurance.add(t);
16847    return this;
16848  }
16849
16850  /**
16851   * @return The first repetition of repeating field {@link #insurance}, creating
16852   *         it if it does not already exist
16853   */
16854  public InsuranceComponent getInsuranceFirstRep() {
16855    if (getInsurance().isEmpty()) {
16856      addInsurance();
16857    }
16858    return getInsurance().get(0);
16859  }
16860
16861  /**
16862   * @return {@link #accident} (Details of a accident which resulted in injuries
16863   *         which required the products and services listed in the claim.)
16864   */
16865  public AccidentComponent getAccident() {
16866    if (this.accident == null)
16867      if (Configuration.errorOnAutoCreate())
16868        throw new Error("Attempt to auto-create ExplanationOfBenefit.accident");
16869      else if (Configuration.doAutoCreate())
16870        this.accident = new AccidentComponent(); // cc
16871    return this.accident;
16872  }
16873
16874  public boolean hasAccident() {
16875    return this.accident != null && !this.accident.isEmpty();
16876  }
16877
16878  /**
16879   * @param value {@link #accident} (Details of a accident which resulted in
16880   *              injuries which required the products and services listed in the
16881   *              claim.)
16882   */
16883  public ExplanationOfBenefit setAccident(AccidentComponent value) {
16884    this.accident = value;
16885    return this;
16886  }
16887
16888  /**
16889   * @return {@link #item} (A claim line. Either a simple (a product or service)
16890   *         or a 'group' of details which can also be a simple items or groups of
16891   *         sub-details.)
16892   */
16893  public List<ItemComponent> getItem() {
16894    if (this.item == null)
16895      this.item = new ArrayList<ItemComponent>();
16896    return this.item;
16897  }
16898
16899  /**
16900   * @return Returns a reference to <code>this</code> for easy method chaining
16901   */
16902  public ExplanationOfBenefit setItem(List<ItemComponent> theItem) {
16903    this.item = theItem;
16904    return this;
16905  }
16906
16907  public boolean hasItem() {
16908    if (this.item == null)
16909      return false;
16910    for (ItemComponent item : this.item)
16911      if (!item.isEmpty())
16912        return true;
16913    return false;
16914  }
16915
16916  public ItemComponent addItem() { // 3
16917    ItemComponent t = new ItemComponent();
16918    if (this.item == null)
16919      this.item = new ArrayList<ItemComponent>();
16920    this.item.add(t);
16921    return t;
16922  }
16923
16924  public ExplanationOfBenefit addItem(ItemComponent t) { // 3
16925    if (t == null)
16926      return this;
16927    if (this.item == null)
16928      this.item = new ArrayList<ItemComponent>();
16929    this.item.add(t);
16930    return this;
16931  }
16932
16933  /**
16934   * @return The first repetition of repeating field {@link #item}, creating it if
16935   *         it does not already exist
16936   */
16937  public ItemComponent getItemFirstRep() {
16938    if (getItem().isEmpty()) {
16939      addItem();
16940    }
16941    return getItem().get(0);
16942  }
16943
16944  /**
16945   * @return {@link #addItem} (The first-tier service adjudications for payor
16946   *         added product or service lines.)
16947   */
16948  public List<AddedItemComponent> getAddItem() {
16949    if (this.addItem == null)
16950      this.addItem = new ArrayList<AddedItemComponent>();
16951    return this.addItem;
16952  }
16953
16954  /**
16955   * @return Returns a reference to <code>this</code> for easy method chaining
16956   */
16957  public ExplanationOfBenefit setAddItem(List<AddedItemComponent> theAddItem) {
16958    this.addItem = theAddItem;
16959    return this;
16960  }
16961
16962  public boolean hasAddItem() {
16963    if (this.addItem == null)
16964      return false;
16965    for (AddedItemComponent item : this.addItem)
16966      if (!item.isEmpty())
16967        return true;
16968    return false;
16969  }
16970
16971  public AddedItemComponent addAddItem() { // 3
16972    AddedItemComponent t = new AddedItemComponent();
16973    if (this.addItem == null)
16974      this.addItem = new ArrayList<AddedItemComponent>();
16975    this.addItem.add(t);
16976    return t;
16977  }
16978
16979  public ExplanationOfBenefit addAddItem(AddedItemComponent t) { // 3
16980    if (t == null)
16981      return this;
16982    if (this.addItem == null)
16983      this.addItem = new ArrayList<AddedItemComponent>();
16984    this.addItem.add(t);
16985    return this;
16986  }
16987
16988  /**
16989   * @return The first repetition of repeating field {@link #addItem}, creating it
16990   *         if it does not already exist
16991   */
16992  public AddedItemComponent getAddItemFirstRep() {
16993    if (getAddItem().isEmpty()) {
16994      addAddItem();
16995    }
16996    return getAddItem().get(0);
16997  }
16998
16999  /**
17000   * @return {@link #adjudication} (The adjudication results which are presented
17001   *         at the header level rather than at the line-item or add-item levels.)
17002   */
17003  public List<AdjudicationComponent> getAdjudication() {
17004    if (this.adjudication == null)
17005      this.adjudication = new ArrayList<AdjudicationComponent>();
17006    return this.adjudication;
17007  }
17008
17009  /**
17010   * @return Returns a reference to <code>this</code> for easy method chaining
17011   */
17012  public ExplanationOfBenefit setAdjudication(List<AdjudicationComponent> theAdjudication) {
17013    this.adjudication = theAdjudication;
17014    return this;
17015  }
17016
17017  public boolean hasAdjudication() {
17018    if (this.adjudication == null)
17019      return false;
17020    for (AdjudicationComponent item : this.adjudication)
17021      if (!item.isEmpty())
17022        return true;
17023    return false;
17024  }
17025
17026  public AdjudicationComponent addAdjudication() { // 3
17027    AdjudicationComponent t = new AdjudicationComponent();
17028    if (this.adjudication == null)
17029      this.adjudication = new ArrayList<AdjudicationComponent>();
17030    this.adjudication.add(t);
17031    return t;
17032  }
17033
17034  public ExplanationOfBenefit addAdjudication(AdjudicationComponent t) { // 3
17035    if (t == null)
17036      return this;
17037    if (this.adjudication == null)
17038      this.adjudication = new ArrayList<AdjudicationComponent>();
17039    this.adjudication.add(t);
17040    return this;
17041  }
17042
17043  /**
17044   * @return The first repetition of repeating field {@link #adjudication},
17045   *         creating it if it does not already exist
17046   */
17047  public AdjudicationComponent getAdjudicationFirstRep() {
17048    if (getAdjudication().isEmpty()) {
17049      addAdjudication();
17050    }
17051    return getAdjudication().get(0);
17052  }
17053
17054  /**
17055   * @return {@link #total} (Categorized monetary totals for the adjudication.)
17056   */
17057  public List<TotalComponent> getTotal() {
17058    if (this.total == null)
17059      this.total = new ArrayList<TotalComponent>();
17060    return this.total;
17061  }
17062
17063  /**
17064   * @return Returns a reference to <code>this</code> for easy method chaining
17065   */
17066  public ExplanationOfBenefit setTotal(List<TotalComponent> theTotal) {
17067    this.total = theTotal;
17068    return this;
17069  }
17070
17071  public boolean hasTotal() {
17072    if (this.total == null)
17073      return false;
17074    for (TotalComponent item : this.total)
17075      if (!item.isEmpty())
17076        return true;
17077    return false;
17078  }
17079
17080  public TotalComponent addTotal() { // 3
17081    TotalComponent t = new TotalComponent();
17082    if (this.total == null)
17083      this.total = new ArrayList<TotalComponent>();
17084    this.total.add(t);
17085    return t;
17086  }
17087
17088  public ExplanationOfBenefit addTotal(TotalComponent t) { // 3
17089    if (t == null)
17090      return this;
17091    if (this.total == null)
17092      this.total = new ArrayList<TotalComponent>();
17093    this.total.add(t);
17094    return this;
17095  }
17096
17097  /**
17098   * @return The first repetition of repeating field {@link #total}, creating it
17099   *         if it does not already exist
17100   */
17101  public TotalComponent getTotalFirstRep() {
17102    if (getTotal().isEmpty()) {
17103      addTotal();
17104    }
17105    return getTotal().get(0);
17106  }
17107
17108  /**
17109   * @return {@link #payment} (Payment details for the adjudication of the claim.)
17110   */
17111  public PaymentComponent getPayment() {
17112    if (this.payment == null)
17113      if (Configuration.errorOnAutoCreate())
17114        throw new Error("Attempt to auto-create ExplanationOfBenefit.payment");
17115      else if (Configuration.doAutoCreate())
17116        this.payment = new PaymentComponent(); // cc
17117    return this.payment;
17118  }
17119
17120  public boolean hasPayment() {
17121    return this.payment != null && !this.payment.isEmpty();
17122  }
17123
17124  /**
17125   * @param value {@link #payment} (Payment details for the adjudication of the
17126   *              claim.)
17127   */
17128  public ExplanationOfBenefit setPayment(PaymentComponent value) {
17129    this.payment = value;
17130    return this;
17131  }
17132
17133  /**
17134   * @return {@link #formCode} (A code for the form to be used for printing the
17135   *         content.)
17136   */
17137  public CodeableConcept getFormCode() {
17138    if (this.formCode == null)
17139      if (Configuration.errorOnAutoCreate())
17140        throw new Error("Attempt to auto-create ExplanationOfBenefit.formCode");
17141      else if (Configuration.doAutoCreate())
17142        this.formCode = new CodeableConcept(); // cc
17143    return this.formCode;
17144  }
17145
17146  public boolean hasFormCode() {
17147    return this.formCode != null && !this.formCode.isEmpty();
17148  }
17149
17150  /**
17151   * @param value {@link #formCode} (A code for the form to be used for printing
17152   *              the content.)
17153   */
17154  public ExplanationOfBenefit setFormCode(CodeableConcept value) {
17155    this.formCode = value;
17156    return this;
17157  }
17158
17159  /**
17160   * @return {@link #form} (The actual form, by reference or inclusion, for
17161   *         printing the content or an EOB.)
17162   */
17163  public Attachment getForm() {
17164    if (this.form == null)
17165      if (Configuration.errorOnAutoCreate())
17166        throw new Error("Attempt to auto-create ExplanationOfBenefit.form");
17167      else if (Configuration.doAutoCreate())
17168        this.form = new Attachment(); // cc
17169    return this.form;
17170  }
17171
17172  public boolean hasForm() {
17173    return this.form != null && !this.form.isEmpty();
17174  }
17175
17176  /**
17177   * @param value {@link #form} (The actual form, by reference or inclusion, for
17178   *              printing the content or an EOB.)
17179   */
17180  public ExplanationOfBenefit setForm(Attachment value) {
17181    this.form = value;
17182    return this;
17183  }
17184
17185  /**
17186   * @return {@link #processNote} (A note that describes or explains adjudication
17187   *         results in a human readable form.)
17188   */
17189  public List<NoteComponent> getProcessNote() {
17190    if (this.processNote == null)
17191      this.processNote = new ArrayList<NoteComponent>();
17192    return this.processNote;
17193  }
17194
17195  /**
17196   * @return Returns a reference to <code>this</code> for easy method chaining
17197   */
17198  public ExplanationOfBenefit setProcessNote(List<NoteComponent> theProcessNote) {
17199    this.processNote = theProcessNote;
17200    return this;
17201  }
17202
17203  public boolean hasProcessNote() {
17204    if (this.processNote == null)
17205      return false;
17206    for (NoteComponent item : this.processNote)
17207      if (!item.isEmpty())
17208        return true;
17209    return false;
17210  }
17211
17212  public NoteComponent addProcessNote() { // 3
17213    NoteComponent t = new NoteComponent();
17214    if (this.processNote == null)
17215      this.processNote = new ArrayList<NoteComponent>();
17216    this.processNote.add(t);
17217    return t;
17218  }
17219
17220  public ExplanationOfBenefit addProcessNote(NoteComponent t) { // 3
17221    if (t == null)
17222      return this;
17223    if (this.processNote == null)
17224      this.processNote = new ArrayList<NoteComponent>();
17225    this.processNote.add(t);
17226    return this;
17227  }
17228
17229  /**
17230   * @return The first repetition of repeating field {@link #processNote},
17231   *         creating it if it does not already exist
17232   */
17233  public NoteComponent getProcessNoteFirstRep() {
17234    if (getProcessNote().isEmpty()) {
17235      addProcessNote();
17236    }
17237    return getProcessNote().get(0);
17238  }
17239
17240  /**
17241   * @return {@link #benefitPeriod} (The term of the benefits documented in this
17242   *         response.)
17243   */
17244  public Period getBenefitPeriod() {
17245    if (this.benefitPeriod == null)
17246      if (Configuration.errorOnAutoCreate())
17247        throw new Error("Attempt to auto-create ExplanationOfBenefit.benefitPeriod");
17248      else if (Configuration.doAutoCreate())
17249        this.benefitPeriod = new Period(); // cc
17250    return this.benefitPeriod;
17251  }
17252
17253  public boolean hasBenefitPeriod() {
17254    return this.benefitPeriod != null && !this.benefitPeriod.isEmpty();
17255  }
17256
17257  /**
17258   * @param value {@link #benefitPeriod} (The term of the benefits documented in
17259   *              this response.)
17260   */
17261  public ExplanationOfBenefit setBenefitPeriod(Period value) {
17262    this.benefitPeriod = value;
17263    return this;
17264  }
17265
17266  /**
17267   * @return {@link #benefitBalance} (Balance by Benefit Category.)
17268   */
17269  public List<BenefitBalanceComponent> getBenefitBalance() {
17270    if (this.benefitBalance == null)
17271      this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
17272    return this.benefitBalance;
17273  }
17274
17275  /**
17276   * @return Returns a reference to <code>this</code> for easy method chaining
17277   */
17278  public ExplanationOfBenefit setBenefitBalance(List<BenefitBalanceComponent> theBenefitBalance) {
17279    this.benefitBalance = theBenefitBalance;
17280    return this;
17281  }
17282
17283  public boolean hasBenefitBalance() {
17284    if (this.benefitBalance == null)
17285      return false;
17286    for (BenefitBalanceComponent item : this.benefitBalance)
17287      if (!item.isEmpty())
17288        return true;
17289    return false;
17290  }
17291
17292  public BenefitBalanceComponent addBenefitBalance() { // 3
17293    BenefitBalanceComponent t = new BenefitBalanceComponent();
17294    if (this.benefitBalance == null)
17295      this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
17296    this.benefitBalance.add(t);
17297    return t;
17298  }
17299
17300  public ExplanationOfBenefit addBenefitBalance(BenefitBalanceComponent t) { // 3
17301    if (t == null)
17302      return this;
17303    if (this.benefitBalance == null)
17304      this.benefitBalance = new ArrayList<BenefitBalanceComponent>();
17305    this.benefitBalance.add(t);
17306    return this;
17307  }
17308
17309  /**
17310   * @return The first repetition of repeating field {@link #benefitBalance},
17311   *         creating it if it does not already exist
17312   */
17313  public BenefitBalanceComponent getBenefitBalanceFirstRep() {
17314    if (getBenefitBalance().isEmpty()) {
17315      addBenefitBalance();
17316    }
17317    return getBenefitBalance().get(0);
17318  }
17319
17320  protected void listChildren(List<Property> children) {
17321    super.listChildren(children);
17322    children.add(new Property("identifier", "Identifier",
17323        "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier));
17324    children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
17325    children.add(new Property("type", "CodeableConcept",
17326        "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type));
17327    children.add(new Property("subType", "CodeableConcept",
17328        "A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.",
17329        0, 1, subType));
17330    children.add(new Property("use", "code",
17331        "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.",
17332        0, 1, use));
17333    children.add(new Property("patient", "Reference(Patient)",
17334        "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.",
17335        0, 1, patient));
17336    children.add(new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1,
17337        billablePeriod));
17338    children.add(new Property("created", "dateTime", "The date this resource was created.", 0, 1, created));
17339    children.add(new Property("enterer", "Reference(Practitioner|PractitionerRole)",
17340        "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer));
17341    children.add(new Property("insurer", "Reference(Organization)",
17342        "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer));
17343    children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
17344        "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider));
17345    children.add(new Property("priority", "CodeableConcept",
17346        "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.", 0,
17347        1, priority));
17348    children.add(new Property("fundsReserveRequested", "CodeableConcept",
17349        "A code to indicate whether and for whom funds are to be reserved for future claims.", 0, 1,
17350        fundsReserveRequested));
17351    children.add(new Property("fundsReserve", "CodeableConcept",
17352        "A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.",
17353        0, 1, fundsReserve));
17354    children.add(new Property("related", "",
17355        "Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.",
17356        0, java.lang.Integer.MAX_VALUE, related));
17357    children.add(new Property("prescription", "Reference(MedicationRequest|VisionPrescription)",
17358        "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription));
17359    children.add(new Property("originalPrescription", "Reference(MedicationRequest)",
17360        "Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.",
17361        0, 1, originalPrescription));
17362    children.add(new Property("payee", "",
17363        "The party to be reimbursed for cost of the products and services according to the terms of the policy.", 0, 1,
17364        payee));
17365    children.add(
17366        new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral));
17367    children.add(
17368        new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility));
17369    children.add(new Property("claim", "Reference(Claim)",
17370        "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.",
17371        0, 1, claim));
17372    children.add(new Property("claimResponse", "Reference(ClaimResponse)",
17373        "The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.",
17374        0, 1, claimResponse));
17375    children.add(new Property("outcome", "code",
17376        "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome));
17377    children.add(new Property("disposition", "string",
17378        "A human readable description of the status of the adjudication.", 0, 1, disposition));
17379    children.add(new Property("preAuthRef", "string",
17380        "Reference from the Insurer which is used in later communications which refers to this adjudication.", 0,
17381        java.lang.Integer.MAX_VALUE, preAuthRef));
17382    children.add(new Property("preAuthRefPeriod", "Period",
17383        "The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.",
17384        0, java.lang.Integer.MAX_VALUE, preAuthRefPeriod));
17385    children.add(new Property("careTeam", "", "The members of the team who provided the products and services.", 0,
17386        java.lang.Integer.MAX_VALUE, careTeam));
17387    children.add(new Property("supportingInfo", "",
17388        "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.",
17389        0, java.lang.Integer.MAX_VALUE, supportingInfo));
17390    children.add(new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0,
17391        java.lang.Integer.MAX_VALUE, diagnosis));
17392    children.add(new Property("procedure", "",
17393        "Procedures performed on the patient relevant to the billing items with the claim.", 0,
17394        java.lang.Integer.MAX_VALUE, procedure));
17395    children.add(new Property("precedence", "positiveInt",
17396        "This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.",
17397        0, 1, precedence));
17398    children.add(new Property("insurance", "",
17399        "Financial instruments for reimbursement for the health care products and services specified on the claim.", 0,
17400        java.lang.Integer.MAX_VALUE, insurance));
17401    children.add(new Property("accident", "",
17402        "Details of a accident which resulted in injuries which required the products and services listed in the claim.",
17403        0, 1, accident));
17404    children.add(new Property("item", "",
17405        "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.",
17406        0, java.lang.Integer.MAX_VALUE, item));
17407    children.add(
17408        new Property("addItem", "", "The first-tier service adjudications for payor added product or service lines.", 0,
17409            java.lang.Integer.MAX_VALUE, addItem));
17410    children.add(new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
17411        "The adjudication results which are presented at the header level rather than at the line-item or add-item levels.",
17412        0, java.lang.Integer.MAX_VALUE, adjudication));
17413    children.add(new Property("total", "", "Categorized monetary totals for the adjudication.", 0,
17414        java.lang.Integer.MAX_VALUE, total));
17415    children.add(new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment));
17416    children.add(new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.",
17417        0, 1, formCode));
17418    children.add(new Property("form", "Attachment",
17419        "The actual form, by reference or inclusion, for printing the content or an EOB.", 0, 1, form));
17420    children.add(new Property("processNote", "",
17421        "A note that describes or explains adjudication results in a human readable form.", 0,
17422        java.lang.Integer.MAX_VALUE, processNote));
17423    children.add(new Property("benefitPeriod", "Period", "The term of the benefits documented in this response.", 0, 1,
17424        benefitPeriod));
17425    children.add(new Property("benefitBalance", "", "Balance by Benefit Category.", 0, java.lang.Integer.MAX_VALUE,
17426        benefitBalance));
17427  }
17428
17429  @Override
17430  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
17431    switch (_hash) {
17432    case -1618432855:
17433      /* identifier */ return new Property("identifier", "Identifier",
17434          "A unique identifier assigned to this explanation of benefit.", 0, java.lang.Integer.MAX_VALUE, identifier);
17435    case -892481550:
17436      /* status */ return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
17437    case 3575610:
17438      /* type */ return new Property("type", "CodeableConcept",
17439          "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type);
17440    case -1868521062:
17441      /* subType */ return new Property("subType", "CodeableConcept",
17442          "A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.",
17443          0, 1, subType);
17444    case 116103:
17445      /* use */ return new Property("use", "code",
17446          "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.",
17447          0, 1, use);
17448    case -791418107:
17449      /* patient */ return new Property("patient", "Reference(Patient)",
17450          "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.",
17451          0, 1, patient);
17452    case -332066046:
17453      /* billablePeriod */ return new Property("billablePeriod", "Period",
17454          "The period for which charges are being submitted.", 0, 1, billablePeriod);
17455    case 1028554472:
17456      /* created */ return new Property("created", "dateTime", "The date this resource was created.", 0, 1, created);
17457    case -1591951995:
17458      /* enterer */ return new Property("enterer", "Reference(Practitioner|PractitionerRole)",
17459          "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer);
17460    case 1957615864:
17461      /* insurer */ return new Property("insurer", "Reference(Organization)",
17462          "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer);
17463    case -987494927:
17464      /* provider */ return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
17465          "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider);
17466    case -1165461084:
17467      /* priority */ return new Property("priority", "CodeableConcept",
17468          "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.", 0,
17469          1, priority);
17470    case -1688904576:
17471      /* fundsReserveRequested */ return new Property("fundsReserveRequested", "CodeableConcept",
17472          "A code to indicate whether and for whom funds are to be reserved for future claims.", 0, 1,
17473          fundsReserveRequested);
17474    case 1314609806:
17475      /* fundsReserve */ return new Property("fundsReserve", "CodeableConcept",
17476          "A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.",
17477          0, 1, fundsReserve);
17478    case 1090493483:
17479      /* related */ return new Property("related", "",
17480          "Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.",
17481          0, java.lang.Integer.MAX_VALUE, related);
17482    case 460301338:
17483      /* prescription */ return new Property("prescription", "Reference(MedicationRequest|VisionPrescription)",
17484          "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription);
17485    case -1814015861:
17486      /* originalPrescription */ return new Property("originalPrescription", "Reference(MedicationRequest)",
17487          "Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.",
17488          0, 1, originalPrescription);
17489    case 106443592:
17490      /* payee */ return new Property("payee", "",
17491          "The party to be reimbursed for cost of the products and services according to the terms of the policy.", 0,
17492          1, payee);
17493    case -722568291:
17494      /* referral */ return new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.",
17495          0, 1, referral);
17496    case 501116579:
17497      /* facility */ return new Property("facility", "Reference(Location)",
17498          "Facility where the services were provided.", 0, 1, facility);
17499    case 94742588:
17500      /* claim */ return new Property("claim", "Reference(Claim)",
17501          "The business identifier for the instance of the adjudication request: claim predetermination or preauthorization.",
17502          0, 1, claim);
17503    case 689513629:
17504      /* claimResponse */ return new Property("claimResponse", "Reference(ClaimResponse)",
17505          "The business identifier for the instance of the adjudication response: claim, predetermination or preauthorization response.",
17506          0, 1, claimResponse);
17507    case -1106507950:
17508      /* outcome */ return new Property("outcome", "code",
17509          "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome);
17510    case 583380919:
17511      /* disposition */ return new Property("disposition", "string",
17512          "A human readable description of the status of the adjudication.", 0, 1, disposition);
17513    case 522246568:
17514      /* preAuthRef */ return new Property("preAuthRef", "string",
17515          "Reference from the Insurer which is used in later communications which refers to this adjudication.", 0,
17516          java.lang.Integer.MAX_VALUE, preAuthRef);
17517    case -1262920311:
17518      /* preAuthRefPeriod */ return new Property("preAuthRefPeriod", "Period",
17519          "The timeframe during which the supplied preauthorization reference may be quoted on claims to obtain the adjudication as provided.",
17520          0, java.lang.Integer.MAX_VALUE, preAuthRefPeriod);
17521    case -7323378:
17522      /* careTeam */ return new Property("careTeam", "",
17523          "The members of the team who provided the products and services.", 0, java.lang.Integer.MAX_VALUE, careTeam);
17524    case 1922406657:
17525      /* supportingInfo */ return new Property("supportingInfo", "",
17526          "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.",
17527          0, java.lang.Integer.MAX_VALUE, supportingInfo);
17528    case 1196993265:
17529      /* diagnosis */ return new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.",
17530          0, java.lang.Integer.MAX_VALUE, diagnosis);
17531    case -1095204141:
17532      /* procedure */ return new Property("procedure", "",
17533          "Procedures performed on the patient relevant to the billing items with the claim.", 0,
17534          java.lang.Integer.MAX_VALUE, procedure);
17535    case 159695370:
17536      /* precedence */ return new Property("precedence", "positiveInt",
17537          "This indicates the relative order of a series of EOBs related to different coverages for the same suite of services.",
17538          0, 1, precedence);
17539    case 73049818:
17540      /* insurance */ return new Property("insurance", "",
17541          "Financial instruments for reimbursement for the health care products and services specified on the claim.",
17542          0, java.lang.Integer.MAX_VALUE, insurance);
17543    case -2143202801:
17544      /* accident */ return new Property("accident", "",
17545          "Details of a accident which resulted in injuries which required the products and services listed in the claim.",
17546          0, 1, accident);
17547    case 3242771:
17548      /* item */ return new Property("item", "",
17549          "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.",
17550          0, java.lang.Integer.MAX_VALUE, item);
17551    case -1148899500:
17552      /* addItem */ return new Property("addItem", "",
17553          "The first-tier service adjudications for payor added product or service lines.", 0,
17554          java.lang.Integer.MAX_VALUE, addItem);
17555    case -231349275:
17556      /* adjudication */ return new Property("adjudication", "@ExplanationOfBenefit.item.adjudication",
17557          "The adjudication results which are presented at the header level rather than at the line-item or add-item levels.",
17558          0, java.lang.Integer.MAX_VALUE, adjudication);
17559    case 110549828:
17560      /* total */ return new Property("total", "", "Categorized monetary totals for the adjudication.", 0,
17561          java.lang.Integer.MAX_VALUE, total);
17562    case -786681338:
17563      /* payment */ return new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1,
17564          payment);
17565    case 473181393:
17566      /* formCode */ return new Property("formCode", "CodeableConcept",
17567          "A code for the form to be used for printing the content.", 0, 1, formCode);
17568    case 3148996:
17569      /* form */ return new Property("form", "Attachment",
17570          "The actual form, by reference or inclusion, for printing the content or an EOB.", 0, 1, form);
17571    case 202339073:
17572      /* processNote */ return new Property("processNote", "",
17573          "A note that describes or explains adjudication results in a human readable form.", 0,
17574          java.lang.Integer.MAX_VALUE, processNote);
17575    case -407369416:
17576      /* benefitPeriod */ return new Property("benefitPeriod", "Period",
17577          "The term of the benefits documented in this response.", 0, 1, benefitPeriod);
17578    case 596003397:
17579      /* benefitBalance */ return new Property("benefitBalance", "", "Balance by Benefit Category.", 0,
17580          java.lang.Integer.MAX_VALUE, benefitBalance);
17581    default:
17582      return super.getNamedProperty(_hash, _name, _checkValid);
17583    }
17584
17585  }
17586
17587  @Override
17588  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
17589    switch (hash) {
17590    case -1618432855:
17591      /* identifier */ return this.identifier == null ? new Base[0]
17592          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
17593    case -892481550:
17594      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<ExplanationOfBenefitStatus>
17595    case 3575610:
17596      /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
17597    case -1868521062:
17598      /* subType */ return this.subType == null ? new Base[0] : new Base[] { this.subType }; // CodeableConcept
17599    case 116103:
17600      /* use */ return this.use == null ? new Base[0] : new Base[] { this.use }; // Enumeration<Use>
17601    case -791418107:
17602      /* patient */ return this.patient == null ? new Base[0] : new Base[] { this.patient }; // Reference
17603    case -332066046:
17604      /* billablePeriod */ return this.billablePeriod == null ? new Base[0] : new Base[] { this.billablePeriod }; // Period
17605    case 1028554472:
17606      /* created */ return this.created == null ? new Base[0] : new Base[] { this.created }; // DateTimeType
17607    case -1591951995:
17608      /* enterer */ return this.enterer == null ? new Base[0] : new Base[] { this.enterer }; // Reference
17609    case 1957615864:
17610      /* insurer */ return this.insurer == null ? new Base[0] : new Base[] { this.insurer }; // Reference
17611    case -987494927:
17612      /* provider */ return this.provider == null ? new Base[0] : new Base[] { this.provider }; // Reference
17613    case -1165461084:
17614      /* priority */ return this.priority == null ? new Base[0] : new Base[] { this.priority }; // CodeableConcept
17615    case -1688904576:
17616      /* fundsReserveRequested */ return this.fundsReserveRequested == null ? new Base[0]
17617          : new Base[] { this.fundsReserveRequested }; // CodeableConcept
17618    case 1314609806:
17619      /* fundsReserve */ return this.fundsReserve == null ? new Base[0] : new Base[] { this.fundsReserve }; // CodeableConcept
17620    case 1090493483:
17621      /* related */ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimComponent
17622    case 460301338:
17623      /* prescription */ return this.prescription == null ? new Base[0] : new Base[] { this.prescription }; // Reference
17624    case -1814015861:
17625      /* originalPrescription */ return this.originalPrescription == null ? new Base[0]
17626          : new Base[] { this.originalPrescription }; // Reference
17627    case 106443592:
17628      /* payee */ return this.payee == null ? new Base[0] : new Base[] { this.payee }; // PayeeComponent
17629    case -722568291:
17630      /* referral */ return this.referral == null ? new Base[0] : new Base[] { this.referral }; // Reference
17631    case 501116579:
17632      /* facility */ return this.facility == null ? new Base[0] : new Base[] { this.facility }; // Reference
17633    case 94742588:
17634      /* claim */ return this.claim == null ? new Base[0] : new Base[] { this.claim }; // Reference
17635    case 689513629:
17636      /* claimResponse */ return this.claimResponse == null ? new Base[0] : new Base[] { this.claimResponse }; // Reference
17637    case -1106507950:
17638      /* outcome */ return this.outcome == null ? new Base[0] : new Base[] { this.outcome }; // Enumeration<RemittanceOutcome>
17639    case 583380919:
17640      /* disposition */ return this.disposition == null ? new Base[0] : new Base[] { this.disposition }; // StringType
17641    case 522246568:
17642      /* preAuthRef */ return this.preAuthRef == null ? new Base[0]
17643          : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
17644    case -1262920311:
17645      /* preAuthRefPeriod */ return this.preAuthRefPeriod == null ? new Base[0]
17646          : this.preAuthRefPeriod.toArray(new Base[this.preAuthRefPeriod.size()]); // Period
17647    case -7323378:
17648      /* careTeam */ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // CareTeamComponent
17649    case 1922406657:
17650      /* supportingInfo */ return this.supportingInfo == null ? new Base[0]
17651          : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // SupportingInformationComponent
17652    case 1196993265:
17653      /* diagnosis */ return this.diagnosis == null ? new Base[0]
17654          : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
17655    case -1095204141:
17656      /* procedure */ return this.procedure == null ? new Base[0]
17657          : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
17658    case 159695370:
17659      /* precedence */ return this.precedence == null ? new Base[0] : new Base[] { this.precedence }; // PositiveIntType
17660    case 73049818:
17661      /* insurance */ return this.insurance == null ? new Base[0]
17662          : this.insurance.toArray(new Base[this.insurance.size()]); // InsuranceComponent
17663    case -2143202801:
17664      /* accident */ return this.accident == null ? new Base[0] : new Base[] { this.accident }; // AccidentComponent
17665    case 3242771:
17666      /* item */ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
17667    case -1148899500:
17668      /* addItem */ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
17669    case -231349275:
17670      /* adjudication */ return this.adjudication == null ? new Base[0]
17671          : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
17672    case 110549828:
17673      /* total */ return this.total == null ? new Base[0] : this.total.toArray(new Base[this.total.size()]); // TotalComponent
17674    case -786681338:
17675      /* payment */ return this.payment == null ? new Base[0] : new Base[] { this.payment }; // PaymentComponent
17676    case 473181393:
17677      /* formCode */ return this.formCode == null ? new Base[0] : new Base[] { this.formCode }; // CodeableConcept
17678    case 3148996:
17679      /* form */ return this.form == null ? new Base[0] : new Base[] { this.form }; // Attachment
17680    case 202339073:
17681      /* processNote */ return this.processNote == null ? new Base[0]
17682          : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
17683    case -407369416:
17684      /* benefitPeriod */ return this.benefitPeriod == null ? new Base[0] : new Base[] { this.benefitPeriod }; // Period
17685    case 596003397:
17686      /* benefitBalance */ return this.benefitBalance == null ? new Base[0]
17687          : this.benefitBalance.toArray(new Base[this.benefitBalance.size()]); // BenefitBalanceComponent
17688    default:
17689      return super.getProperty(hash, name, checkValid);
17690    }
17691
17692  }
17693
17694  @Override
17695  public Base setProperty(int hash, String name, Base value) throws FHIRException {
17696    switch (hash) {
17697    case -1618432855: // identifier
17698      this.getIdentifier().add(castToIdentifier(value)); // Identifier
17699      return value;
17700    case -892481550: // status
17701      value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
17702      this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
17703      return value;
17704    case 3575610: // type
17705      this.type = castToCodeableConcept(value); // CodeableConcept
17706      return value;
17707    case -1868521062: // subType
17708      this.subType = castToCodeableConcept(value); // CodeableConcept
17709      return value;
17710    case 116103: // use
17711      value = new UseEnumFactory().fromType(castToCode(value));
17712      this.use = (Enumeration) value; // Enumeration<Use>
17713      return value;
17714    case -791418107: // patient
17715      this.patient = castToReference(value); // Reference
17716      return value;
17717    case -332066046: // billablePeriod
17718      this.billablePeriod = castToPeriod(value); // Period
17719      return value;
17720    case 1028554472: // created
17721      this.created = castToDateTime(value); // DateTimeType
17722      return value;
17723    case -1591951995: // enterer
17724      this.enterer = castToReference(value); // Reference
17725      return value;
17726    case 1957615864: // insurer
17727      this.insurer = castToReference(value); // Reference
17728      return value;
17729    case -987494927: // provider
17730      this.provider = castToReference(value); // Reference
17731      return value;
17732    case -1165461084: // priority
17733      this.priority = castToCodeableConcept(value); // CodeableConcept
17734      return value;
17735    case -1688904576: // fundsReserveRequested
17736      this.fundsReserveRequested = castToCodeableConcept(value); // CodeableConcept
17737      return value;
17738    case 1314609806: // fundsReserve
17739      this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
17740      return value;
17741    case 1090493483: // related
17742      this.getRelated().add((RelatedClaimComponent) value); // RelatedClaimComponent
17743      return value;
17744    case 460301338: // prescription
17745      this.prescription = castToReference(value); // Reference
17746      return value;
17747    case -1814015861: // originalPrescription
17748      this.originalPrescription = castToReference(value); // Reference
17749      return value;
17750    case 106443592: // payee
17751      this.payee = (PayeeComponent) value; // PayeeComponent
17752      return value;
17753    case -722568291: // referral
17754      this.referral = castToReference(value); // Reference
17755      return value;
17756    case 501116579: // facility
17757      this.facility = castToReference(value); // Reference
17758      return value;
17759    case 94742588: // claim
17760      this.claim = castToReference(value); // Reference
17761      return value;
17762    case 689513629: // claimResponse
17763      this.claimResponse = castToReference(value); // Reference
17764      return value;
17765    case -1106507950: // outcome
17766      value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
17767      this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
17768      return value;
17769    case 583380919: // disposition
17770      this.disposition = castToString(value); // StringType
17771      return value;
17772    case 522246568: // preAuthRef
17773      this.getPreAuthRef().add(castToString(value)); // StringType
17774      return value;
17775    case -1262920311: // preAuthRefPeriod
17776      this.getPreAuthRefPeriod().add(castToPeriod(value)); // Period
17777      return value;
17778    case -7323378: // careTeam
17779      this.getCareTeam().add((CareTeamComponent) value); // CareTeamComponent
17780      return value;
17781    case 1922406657: // supportingInfo
17782      this.getSupportingInfo().add((SupportingInformationComponent) value); // SupportingInformationComponent
17783      return value;
17784    case 1196993265: // diagnosis
17785      this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
17786      return value;
17787    case -1095204141: // procedure
17788      this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
17789      return value;
17790    case 159695370: // precedence
17791      this.precedence = castToPositiveInt(value); // PositiveIntType
17792      return value;
17793    case 73049818: // insurance
17794      this.getInsurance().add((InsuranceComponent) value); // InsuranceComponent
17795      return value;
17796    case -2143202801: // accident
17797      this.accident = (AccidentComponent) value; // AccidentComponent
17798      return value;
17799    case 3242771: // item
17800      this.getItem().add((ItemComponent) value); // ItemComponent
17801      return value;
17802    case -1148899500: // addItem
17803      this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
17804      return value;
17805    case -231349275: // adjudication
17806      this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
17807      return value;
17808    case 110549828: // total
17809      this.getTotal().add((TotalComponent) value); // TotalComponent
17810      return value;
17811    case -786681338: // payment
17812      this.payment = (PaymentComponent) value; // PaymentComponent
17813      return value;
17814    case 473181393: // formCode
17815      this.formCode = castToCodeableConcept(value); // CodeableConcept
17816      return value;
17817    case 3148996: // form
17818      this.form = castToAttachment(value); // Attachment
17819      return value;
17820    case 202339073: // processNote
17821      this.getProcessNote().add((NoteComponent) value); // NoteComponent
17822      return value;
17823    case -407369416: // benefitPeriod
17824      this.benefitPeriod = castToPeriod(value); // Period
17825      return value;
17826    case 596003397: // benefitBalance
17827      this.getBenefitBalance().add((BenefitBalanceComponent) value); // BenefitBalanceComponent
17828      return value;
17829    default:
17830      return super.setProperty(hash, name, value);
17831    }
17832
17833  }
17834
17835  @Override
17836  public Base setProperty(String name, Base value) throws FHIRException {
17837    if (name.equals("identifier")) {
17838      this.getIdentifier().add(castToIdentifier(value));
17839    } else if (name.equals("status")) {
17840      value = new ExplanationOfBenefitStatusEnumFactory().fromType(castToCode(value));
17841      this.status = (Enumeration) value; // Enumeration<ExplanationOfBenefitStatus>
17842    } else if (name.equals("type")) {
17843      this.type = castToCodeableConcept(value); // CodeableConcept
17844    } else if (name.equals("subType")) {
17845      this.subType = castToCodeableConcept(value); // CodeableConcept
17846    } else if (name.equals("use")) {
17847      value = new UseEnumFactory().fromType(castToCode(value));
17848      this.use = (Enumeration) value; // Enumeration<Use>
17849    } else if (name.equals("patient")) {
17850      this.patient = castToReference(value); // Reference
17851    } else if (name.equals("billablePeriod")) {
17852      this.billablePeriod = castToPeriod(value); // Period
17853    } else if (name.equals("created")) {
17854      this.created = castToDateTime(value); // DateTimeType
17855    } else if (name.equals("enterer")) {
17856      this.enterer = castToReference(value); // Reference
17857    } else if (name.equals("insurer")) {
17858      this.insurer = castToReference(value); // Reference
17859    } else if (name.equals("provider")) {
17860      this.provider = castToReference(value); // Reference
17861    } else if (name.equals("priority")) {
17862      this.priority = castToCodeableConcept(value); // CodeableConcept
17863    } else if (name.equals("fundsReserveRequested")) {
17864      this.fundsReserveRequested = castToCodeableConcept(value); // CodeableConcept
17865    } else if (name.equals("fundsReserve")) {
17866      this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
17867    } else if (name.equals("related")) {
17868      this.getRelated().add((RelatedClaimComponent) value);
17869    } else if (name.equals("prescription")) {
17870      this.prescription = castToReference(value); // Reference
17871    } else if (name.equals("originalPrescription")) {
17872      this.originalPrescription = castToReference(value); // Reference
17873    } else if (name.equals("payee")) {
17874      this.payee = (PayeeComponent) value; // PayeeComponent
17875    } else if (name.equals("referral")) {
17876      this.referral = castToReference(value); // Reference
17877    } else if (name.equals("facility")) {
17878      this.facility = castToReference(value); // Reference
17879    } else if (name.equals("claim")) {
17880      this.claim = castToReference(value); // Reference
17881    } else if (name.equals("claimResponse")) {
17882      this.claimResponse = castToReference(value); // Reference
17883    } else if (name.equals("outcome")) {
17884      value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
17885      this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
17886    } else if (name.equals("disposition")) {
17887      this.disposition = castToString(value); // StringType
17888    } else if (name.equals("preAuthRef")) {
17889      this.getPreAuthRef().add(castToString(value));
17890    } else if (name.equals("preAuthRefPeriod")) {
17891      this.getPreAuthRefPeriod().add(castToPeriod(value));
17892    } else if (name.equals("careTeam")) {
17893      this.getCareTeam().add((CareTeamComponent) value);
17894    } else if (name.equals("supportingInfo")) {
17895      this.getSupportingInfo().add((SupportingInformationComponent) value);
17896    } else if (name.equals("diagnosis")) {
17897      this.getDiagnosis().add((DiagnosisComponent) value);
17898    } else if (name.equals("procedure")) {
17899      this.getProcedure().add((ProcedureComponent) value);
17900    } else if (name.equals("precedence")) {
17901      this.precedence = castToPositiveInt(value); // PositiveIntType
17902    } else if (name.equals("insurance")) {
17903      this.getInsurance().add((InsuranceComponent) value);
17904    } else if (name.equals("accident")) {
17905      this.accident = (AccidentComponent) value; // AccidentComponent
17906    } else if (name.equals("item")) {
17907      this.getItem().add((ItemComponent) value);
17908    } else if (name.equals("addItem")) {
17909      this.getAddItem().add((AddedItemComponent) value);
17910    } else if (name.equals("adjudication")) {
17911      this.getAdjudication().add((AdjudicationComponent) value);
17912    } else if (name.equals("total")) {
17913      this.getTotal().add((TotalComponent) value);
17914    } else if (name.equals("payment")) {
17915      this.payment = (PaymentComponent) value; // PaymentComponent
17916    } else if (name.equals("formCode")) {
17917      this.formCode = castToCodeableConcept(value); // CodeableConcept
17918    } else if (name.equals("form")) {
17919      this.form = castToAttachment(value); // Attachment
17920    } else if (name.equals("processNote")) {
17921      this.getProcessNote().add((NoteComponent) value);
17922    } else if (name.equals("benefitPeriod")) {
17923      this.benefitPeriod = castToPeriod(value); // Period
17924    } else if (name.equals("benefitBalance")) {
17925      this.getBenefitBalance().add((BenefitBalanceComponent) value);
17926    } else
17927      return super.setProperty(name, value);
17928    return value;
17929  }
17930
17931  @Override
17932  public void removeChild(String name, Base value) throws FHIRException {
17933    if (name.equals("identifier")) {
17934      this.getIdentifier().remove(castToIdentifier(value));
17935    } else if (name.equals("status")) {
17936      this.status = null;
17937    } else if (name.equals("type")) {
17938      this.type = null;
17939    } else if (name.equals("subType")) {
17940      this.subType = null;
17941    } else if (name.equals("use")) {
17942      this.use = null;
17943    } else if (name.equals("patient")) {
17944      this.patient = null;
17945    } else if (name.equals("billablePeriod")) {
17946      this.billablePeriod = null;
17947    } else if (name.equals("created")) {
17948      this.created = null;
17949    } else if (name.equals("enterer")) {
17950      this.enterer = null;
17951    } else if (name.equals("insurer")) {
17952      this.insurer = null;
17953    } else if (name.equals("provider")) {
17954      this.provider = null;
17955    } else if (name.equals("priority")) {
17956      this.priority = null;
17957    } else if (name.equals("fundsReserveRequested")) {
17958      this.fundsReserveRequested = null;
17959    } else if (name.equals("fundsReserve")) {
17960      this.fundsReserve = null;
17961    } else if (name.equals("related")) {
17962      this.getRelated().remove((RelatedClaimComponent) value);
17963    } else if (name.equals("prescription")) {
17964      this.prescription = null;
17965    } else if (name.equals("originalPrescription")) {
17966      this.originalPrescription = null;
17967    } else if (name.equals("payee")) {
17968      this.payee = (PayeeComponent) value; // PayeeComponent
17969    } else if (name.equals("referral")) {
17970      this.referral = null;
17971    } else if (name.equals("facility")) {
17972      this.facility = null;
17973    } else if (name.equals("claim")) {
17974      this.claim = null;
17975    } else if (name.equals("claimResponse")) {
17976      this.claimResponse = null;
17977    } else if (name.equals("outcome")) {
17978      this.outcome = null;
17979    } else if (name.equals("disposition")) {
17980      this.disposition = null;
17981    } else if (name.equals("preAuthRef")) {
17982      this.getPreAuthRef().remove(castToString(value));
17983    } else if (name.equals("preAuthRefPeriod")) {
17984      this.getPreAuthRefPeriod().remove(castToPeriod(value));
17985    } else if (name.equals("careTeam")) {
17986      this.getCareTeam().remove((CareTeamComponent) value);
17987    } else if (name.equals("supportingInfo")) {
17988      this.getSupportingInfo().remove((SupportingInformationComponent) value);
17989    } else if (name.equals("diagnosis")) {
17990      this.getDiagnosis().remove((DiagnosisComponent) value);
17991    } else if (name.equals("procedure")) {
17992      this.getProcedure().remove((ProcedureComponent) value);
17993    } else if (name.equals("precedence")) {
17994      this.precedence = null;
17995    } else if (name.equals("insurance")) {
17996      this.getInsurance().remove((InsuranceComponent) value);
17997    } else if (name.equals("accident")) {
17998      this.accident = (AccidentComponent) value; // AccidentComponent
17999    } else if (name.equals("item")) {
18000      this.getItem().remove((ItemComponent) value);
18001    } else if (name.equals("addItem")) {
18002      this.getAddItem().remove((AddedItemComponent) value);
18003    } else if (name.equals("adjudication")) {
18004      this.getAdjudication().remove((AdjudicationComponent) value);
18005    } else if (name.equals("total")) {
18006      this.getTotal().remove((TotalComponent) value);
18007    } else if (name.equals("payment")) {
18008      this.payment = (PaymentComponent) value; // PaymentComponent
18009    } else if (name.equals("formCode")) {
18010      this.formCode = null;
18011    } else if (name.equals("form")) {
18012      this.form = null;
18013    } else if (name.equals("processNote")) {
18014      this.getProcessNote().remove((NoteComponent) value);
18015    } else if (name.equals("benefitPeriod")) {
18016      this.benefitPeriod = null;
18017    } else if (name.equals("benefitBalance")) {
18018      this.getBenefitBalance().remove((BenefitBalanceComponent) value);
18019    } else
18020      super.removeChild(name, value);
18021    
18022  }
18023
18024  @Override
18025  public Base makeProperty(int hash, String name) throws FHIRException {
18026    switch (hash) {
18027    case -1618432855:
18028      return addIdentifier();
18029    case -892481550:
18030      return getStatusElement();
18031    case 3575610:
18032      return getType();
18033    case -1868521062:
18034      return getSubType();
18035    case 116103:
18036      return getUseElement();
18037    case -791418107:
18038      return getPatient();
18039    case -332066046:
18040      return getBillablePeriod();
18041    case 1028554472:
18042      return getCreatedElement();
18043    case -1591951995:
18044      return getEnterer();
18045    case 1957615864:
18046      return getInsurer();
18047    case -987494927:
18048      return getProvider();
18049    case -1165461084:
18050      return getPriority();
18051    case -1688904576:
18052      return getFundsReserveRequested();
18053    case 1314609806:
18054      return getFundsReserve();
18055    case 1090493483:
18056      return addRelated();
18057    case 460301338:
18058      return getPrescription();
18059    case -1814015861:
18060      return getOriginalPrescription();
18061    case 106443592:
18062      return getPayee();
18063    case -722568291:
18064      return getReferral();
18065    case 501116579:
18066      return getFacility();
18067    case 94742588:
18068      return getClaim();
18069    case 689513629:
18070      return getClaimResponse();
18071    case -1106507950:
18072      return getOutcomeElement();
18073    case 583380919:
18074      return getDispositionElement();
18075    case 522246568:
18076      return addPreAuthRefElement();
18077    case -1262920311:
18078      return addPreAuthRefPeriod();
18079    case -7323378:
18080      return addCareTeam();
18081    case 1922406657:
18082      return addSupportingInfo();
18083    case 1196993265:
18084      return addDiagnosis();
18085    case -1095204141:
18086      return addProcedure();
18087    case 159695370:
18088      return getPrecedenceElement();
18089    case 73049818:
18090      return addInsurance();
18091    case -2143202801:
18092      return getAccident();
18093    case 3242771:
18094      return addItem();
18095    case -1148899500:
18096      return addAddItem();
18097    case -231349275:
18098      return addAdjudication();
18099    case 110549828:
18100      return addTotal();
18101    case -786681338:
18102      return getPayment();
18103    case 473181393:
18104      return getFormCode();
18105    case 3148996:
18106      return getForm();
18107    case 202339073:
18108      return addProcessNote();
18109    case -407369416:
18110      return getBenefitPeriod();
18111    case 596003397:
18112      return addBenefitBalance();
18113    default:
18114      return super.makeProperty(hash, name);
18115    }
18116
18117  }
18118
18119  @Override
18120  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
18121    switch (hash) {
18122    case -1618432855:
18123      /* identifier */ return new String[] { "Identifier" };
18124    case -892481550:
18125      /* status */ return new String[] { "code" };
18126    case 3575610:
18127      /* type */ return new String[] { "CodeableConcept" };
18128    case -1868521062:
18129      /* subType */ return new String[] { "CodeableConcept" };
18130    case 116103:
18131      /* use */ return new String[] { "code" };
18132    case -791418107:
18133      /* patient */ return new String[] { "Reference" };
18134    case -332066046:
18135      /* billablePeriod */ return new String[] { "Period" };
18136    case 1028554472:
18137      /* created */ return new String[] { "dateTime" };
18138    case -1591951995:
18139      /* enterer */ return new String[] { "Reference" };
18140    case 1957615864:
18141      /* insurer */ return new String[] { "Reference" };
18142    case -987494927:
18143      /* provider */ return new String[] { "Reference" };
18144    case -1165461084:
18145      /* priority */ return new String[] { "CodeableConcept" };
18146    case -1688904576:
18147      /* fundsReserveRequested */ return new String[] { "CodeableConcept" };
18148    case 1314609806:
18149      /* fundsReserve */ return new String[] { "CodeableConcept" };
18150    case 1090493483:
18151      /* related */ return new String[] {};
18152    case 460301338:
18153      /* prescription */ return new String[] { "Reference" };
18154    case -1814015861:
18155      /* originalPrescription */ return new String[] { "Reference" };
18156    case 106443592:
18157      /* payee */ return new String[] {};
18158    case -722568291:
18159      /* referral */ return new String[] { "Reference" };
18160    case 501116579:
18161      /* facility */ return new String[] { "Reference" };
18162    case 94742588:
18163      /* claim */ return new String[] { "Reference" };
18164    case 689513629:
18165      /* claimResponse */ return new String[] { "Reference" };
18166    case -1106507950:
18167      /* outcome */ return new String[] { "code" };
18168    case 583380919:
18169      /* disposition */ return new String[] { "string" };
18170    case 522246568:
18171      /* preAuthRef */ return new String[] { "string" };
18172    case -1262920311:
18173      /* preAuthRefPeriod */ return new String[] { "Period" };
18174    case -7323378:
18175      /* careTeam */ return new String[] {};
18176    case 1922406657:
18177      /* supportingInfo */ return new String[] {};
18178    case 1196993265:
18179      /* diagnosis */ return new String[] {};
18180    case -1095204141:
18181      /* procedure */ return new String[] {};
18182    case 159695370:
18183      /* precedence */ return new String[] { "positiveInt" };
18184    case 73049818:
18185      /* insurance */ return new String[] {};
18186    case -2143202801:
18187      /* accident */ return new String[] {};
18188    case 3242771:
18189      /* item */ return new String[] {};
18190    case -1148899500:
18191      /* addItem */ return new String[] {};
18192    case -231349275:
18193      /* adjudication */ return new String[] { "@ExplanationOfBenefit.item.adjudication" };
18194    case 110549828:
18195      /* total */ return new String[] {};
18196    case -786681338:
18197      /* payment */ return new String[] {};
18198    case 473181393:
18199      /* formCode */ return new String[] { "CodeableConcept" };
18200    case 3148996:
18201      /* form */ return new String[] { "Attachment" };
18202    case 202339073:
18203      /* processNote */ return new String[] {};
18204    case -407369416:
18205      /* benefitPeriod */ return new String[] { "Period" };
18206    case 596003397:
18207      /* benefitBalance */ return new String[] {};
18208    default:
18209      return super.getTypesForProperty(hash, name);
18210    }
18211
18212  }
18213
18214  @Override
18215  public Base addChild(String name) throws FHIRException {
18216    if (name.equals("identifier")) {
18217      return addIdentifier();
18218    } else if (name.equals("status")) {
18219      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.status");
18220    } else if (name.equals("type")) {
18221      this.type = new CodeableConcept();
18222      return this.type;
18223    } else if (name.equals("subType")) {
18224      this.subType = new CodeableConcept();
18225      return this.subType;
18226    } else if (name.equals("use")) {
18227      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.use");
18228    } else if (name.equals("patient")) {
18229      this.patient = new Reference();
18230      return this.patient;
18231    } else if (name.equals("billablePeriod")) {
18232      this.billablePeriod = new Period();
18233      return this.billablePeriod;
18234    } else if (name.equals("created")) {
18235      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.created");
18236    } else if (name.equals("enterer")) {
18237      this.enterer = new Reference();
18238      return this.enterer;
18239    } else if (name.equals("insurer")) {
18240      this.insurer = new Reference();
18241      return this.insurer;
18242    } else if (name.equals("provider")) {
18243      this.provider = new Reference();
18244      return this.provider;
18245    } else if (name.equals("priority")) {
18246      this.priority = new CodeableConcept();
18247      return this.priority;
18248    } else if (name.equals("fundsReserveRequested")) {
18249      this.fundsReserveRequested = new CodeableConcept();
18250      return this.fundsReserveRequested;
18251    } else if (name.equals("fundsReserve")) {
18252      this.fundsReserve = new CodeableConcept();
18253      return this.fundsReserve;
18254    } else if (name.equals("related")) {
18255      return addRelated();
18256    } else if (name.equals("prescription")) {
18257      this.prescription = new Reference();
18258      return this.prescription;
18259    } else if (name.equals("originalPrescription")) {
18260      this.originalPrescription = new Reference();
18261      return this.originalPrescription;
18262    } else if (name.equals("payee")) {
18263      this.payee = new PayeeComponent();
18264      return this.payee;
18265    } else if (name.equals("referral")) {
18266      this.referral = new Reference();
18267      return this.referral;
18268    } else if (name.equals("facility")) {
18269      this.facility = new Reference();
18270      return this.facility;
18271    } else if (name.equals("claim")) {
18272      this.claim = new Reference();
18273      return this.claim;
18274    } else if (name.equals("claimResponse")) {
18275      this.claimResponse = new Reference();
18276      return this.claimResponse;
18277    } else if (name.equals("outcome")) {
18278      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.outcome");
18279    } else if (name.equals("disposition")) {
18280      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.disposition");
18281    } else if (name.equals("preAuthRef")) {
18282      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.preAuthRef");
18283    } else if (name.equals("preAuthRefPeriod")) {
18284      return addPreAuthRefPeriod();
18285    } else if (name.equals("careTeam")) {
18286      return addCareTeam();
18287    } else if (name.equals("supportingInfo")) {
18288      return addSupportingInfo();
18289    } else if (name.equals("diagnosis")) {
18290      return addDiagnosis();
18291    } else if (name.equals("procedure")) {
18292      return addProcedure();
18293    } else if (name.equals("precedence")) {
18294      throw new FHIRException("Cannot call addChild on a singleton property ExplanationOfBenefit.precedence");
18295    } else if (name.equals("insurance")) {
18296      return addInsurance();
18297    } else if (name.equals("accident")) {
18298      this.accident = new AccidentComponent();
18299      return this.accident;
18300    } else if (name.equals("item")) {
18301      return addItem();
18302    } else if (name.equals("addItem")) {
18303      return addAddItem();
18304    } else if (name.equals("adjudication")) {
18305      return addAdjudication();
18306    } else if (name.equals("total")) {
18307      return addTotal();
18308    } else if (name.equals("payment")) {
18309      this.payment = new PaymentComponent();
18310      return this.payment;
18311    } else if (name.equals("formCode")) {
18312      this.formCode = new CodeableConcept();
18313      return this.formCode;
18314    } else if (name.equals("form")) {
18315      this.form = new Attachment();
18316      return this.form;
18317    } else if (name.equals("processNote")) {
18318      return addProcessNote();
18319    } else if (name.equals("benefitPeriod")) {
18320      this.benefitPeriod = new Period();
18321      return this.benefitPeriod;
18322    } else if (name.equals("benefitBalance")) {
18323      return addBenefitBalance();
18324    } else
18325      return super.addChild(name);
18326  }
18327
18328  public String fhirType() {
18329    return "ExplanationOfBenefit";
18330
18331  }
18332
18333  public ExplanationOfBenefit copy() {
18334    ExplanationOfBenefit dst = new ExplanationOfBenefit();
18335    copyValues(dst);
18336    return dst;
18337  }
18338
18339  public void copyValues(ExplanationOfBenefit dst) {
18340    super.copyValues(dst);
18341    if (identifier != null) {
18342      dst.identifier = new ArrayList<Identifier>();
18343      for (Identifier i : identifier)
18344        dst.identifier.add(i.copy());
18345    }
18346    ;
18347    dst.status = status == null ? null : status.copy();
18348    dst.type = type == null ? null : type.copy();
18349    dst.subType = subType == null ? null : subType.copy();
18350    dst.use = use == null ? null : use.copy();
18351    dst.patient = patient == null ? null : patient.copy();
18352    dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
18353    dst.created = created == null ? null : created.copy();
18354    dst.enterer = enterer == null ? null : enterer.copy();
18355    dst.insurer = insurer == null ? null : insurer.copy();
18356    dst.provider = provider == null ? null : provider.copy();
18357    dst.priority = priority == null ? null : priority.copy();
18358    dst.fundsReserveRequested = fundsReserveRequested == null ? null : fundsReserveRequested.copy();
18359    dst.fundsReserve = fundsReserve == null ? null : fundsReserve.copy();
18360    if (related != null) {
18361      dst.related = new ArrayList<RelatedClaimComponent>();
18362      for (RelatedClaimComponent i : related)
18363        dst.related.add(i.copy());
18364    }
18365    ;
18366    dst.prescription = prescription == null ? null : prescription.copy();
18367    dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
18368    dst.payee = payee == null ? null : payee.copy();
18369    dst.referral = referral == null ? null : referral.copy();
18370    dst.facility = facility == null ? null : facility.copy();
18371    dst.claim = claim == null ? null : claim.copy();
18372    dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
18373    dst.outcome = outcome == null ? null : outcome.copy();
18374    dst.disposition = disposition == null ? null : disposition.copy();
18375    if (preAuthRef != null) {
18376      dst.preAuthRef = new ArrayList<StringType>();
18377      for (StringType i : preAuthRef)
18378        dst.preAuthRef.add(i.copy());
18379    }
18380    ;
18381    if (preAuthRefPeriod != null) {
18382      dst.preAuthRefPeriod = new ArrayList<Period>();
18383      for (Period i : preAuthRefPeriod)
18384        dst.preAuthRefPeriod.add(i.copy());
18385    }
18386    ;
18387    if (careTeam != null) {
18388      dst.careTeam = new ArrayList<CareTeamComponent>();
18389      for (CareTeamComponent i : careTeam)
18390        dst.careTeam.add(i.copy());
18391    }
18392    ;
18393    if (supportingInfo != null) {
18394      dst.supportingInfo = new ArrayList<SupportingInformationComponent>();
18395      for (SupportingInformationComponent i : supportingInfo)
18396        dst.supportingInfo.add(i.copy());
18397    }
18398    ;
18399    if (diagnosis != null) {
18400      dst.diagnosis = new ArrayList<DiagnosisComponent>();
18401      for (DiagnosisComponent i : diagnosis)
18402        dst.diagnosis.add(i.copy());
18403    }
18404    ;
18405    if (procedure != null) {
18406      dst.procedure = new ArrayList<ProcedureComponent>();
18407      for (ProcedureComponent i : procedure)
18408        dst.procedure.add(i.copy());
18409    }
18410    ;
18411    dst.precedence = precedence == null ? null : precedence.copy();
18412    if (insurance != null) {
18413      dst.insurance = new ArrayList<InsuranceComponent>();
18414      for (InsuranceComponent i : insurance)
18415        dst.insurance.add(i.copy());
18416    }
18417    ;
18418    dst.accident = accident == null ? null : accident.copy();
18419    if (item != null) {
18420      dst.item = new ArrayList<ItemComponent>();
18421      for (ItemComponent i : item)
18422        dst.item.add(i.copy());
18423    }
18424    ;
18425    if (addItem != null) {
18426      dst.addItem = new ArrayList<AddedItemComponent>();
18427      for (AddedItemComponent i : addItem)
18428        dst.addItem.add(i.copy());
18429    }
18430    ;
18431    if (adjudication != null) {
18432      dst.adjudication = new ArrayList<AdjudicationComponent>();
18433      for (AdjudicationComponent i : adjudication)
18434        dst.adjudication.add(i.copy());
18435    }
18436    ;
18437    if (total != null) {
18438      dst.total = new ArrayList<TotalComponent>();
18439      for (TotalComponent i : total)
18440        dst.total.add(i.copy());
18441    }
18442    ;
18443    dst.payment = payment == null ? null : payment.copy();
18444    dst.formCode = formCode == null ? null : formCode.copy();
18445    dst.form = form == null ? null : form.copy();
18446    if (processNote != null) {
18447      dst.processNote = new ArrayList<NoteComponent>();
18448      for (NoteComponent i : processNote)
18449        dst.processNote.add(i.copy());
18450    }
18451    ;
18452    dst.benefitPeriod = benefitPeriod == null ? null : benefitPeriod.copy();
18453    if (benefitBalance != null) {
18454      dst.benefitBalance = new ArrayList<BenefitBalanceComponent>();
18455      for (BenefitBalanceComponent i : benefitBalance)
18456        dst.benefitBalance.add(i.copy());
18457    }
18458    ;
18459  }
18460
18461  protected ExplanationOfBenefit typedCopy() {
18462    return copy();
18463  }
18464
18465  @Override
18466  public boolean equalsDeep(Base other_) {
18467    if (!super.equalsDeep(other_))
18468      return false;
18469    if (!(other_ instanceof ExplanationOfBenefit))
18470      return false;
18471    ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
18472    return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true)
18473        && compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true) && compareDeep(use, o.use, true)
18474        && compareDeep(patient, o.patient, true) && compareDeep(billablePeriod, o.billablePeriod, true)
18475        && compareDeep(created, o.created, true) && compareDeep(enterer, o.enterer, true)
18476        && compareDeep(insurer, o.insurer, true) && compareDeep(provider, o.provider, true)
18477        && compareDeep(priority, o.priority, true) && compareDeep(fundsReserveRequested, o.fundsReserveRequested, true)
18478        && compareDeep(fundsReserve, o.fundsReserve, true) && compareDeep(related, o.related, true)
18479        && compareDeep(prescription, o.prescription, true)
18480        && compareDeep(originalPrescription, o.originalPrescription, true) && compareDeep(payee, o.payee, true)
18481        && compareDeep(referral, o.referral, true) && compareDeep(facility, o.facility, true)
18482        && compareDeep(claim, o.claim, true) && compareDeep(claimResponse, o.claimResponse, true)
18483        && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true)
18484        && compareDeep(preAuthRef, o.preAuthRef, true) && compareDeep(preAuthRefPeriod, o.preAuthRefPeriod, true)
18485        && compareDeep(careTeam, o.careTeam, true) && compareDeep(supportingInfo, o.supportingInfo, true)
18486        && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true)
18487        && compareDeep(precedence, o.precedence, true) && compareDeep(insurance, o.insurance, true)
18488        && compareDeep(accident, o.accident, true) && compareDeep(item, o.item, true)
18489        && compareDeep(addItem, o.addItem, true) && compareDeep(adjudication, o.adjudication, true)
18490        && compareDeep(total, o.total, true) && compareDeep(payment, o.payment, true)
18491        && compareDeep(formCode, o.formCode, true) && compareDeep(form, o.form, true)
18492        && compareDeep(processNote, o.processNote, true) && compareDeep(benefitPeriod, o.benefitPeriod, true)
18493        && compareDeep(benefitBalance, o.benefitBalance, true);
18494  }
18495
18496  @Override
18497  public boolean equalsShallow(Base other_) {
18498    if (!super.equalsShallow(other_))
18499      return false;
18500    if (!(other_ instanceof ExplanationOfBenefit))
18501      return false;
18502    ExplanationOfBenefit o = (ExplanationOfBenefit) other_;
18503    return compareValues(status, o.status, true) && compareValues(use, o.use, true)
18504        && compareValues(created, o.created, true) && compareValues(outcome, o.outcome, true)
18505        && compareValues(disposition, o.disposition, true) && compareValues(preAuthRef, o.preAuthRef, true)
18506        && compareValues(precedence, o.precedence, true);
18507  }
18508
18509  public boolean isEmpty() {
18510    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type, subType, use, patient,
18511        billablePeriod, created, enterer, insurer, provider, priority, fundsReserveRequested, fundsReserve, related,
18512        prescription, originalPrescription, payee, referral, facility, claim, claimResponse, outcome, disposition,
18513        preAuthRef, preAuthRefPeriod, careTeam, supportingInfo, diagnosis, procedure, precedence, insurance, accident,
18514        item, addItem, adjudication, total, payment, formCode, form, processNote, benefitPeriod, benefitBalance);
18515  }
18516
18517  @Override
18518  public ResourceType getResourceType() {
18519    return ResourceType.ExplanationOfBenefit;
18520  }
18521
18522  /**
18523   * Search parameter: <b>coverage</b>
18524   * <p>
18525   * Description: <b>The plan under which the claim was adjudicated</b><br>
18526   * Type: <b>reference</b><br>
18527   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
18528   * </p>
18529   */
18530  @SearchParamDefinition(name = "coverage", path = "ExplanationOfBenefit.insurance.coverage", description = "The plan under which the claim was adjudicated", type = "reference", target = {
18531      Coverage.class })
18532  public static final String SP_COVERAGE = "coverage";
18533  /**
18534   * <b>Fluent Client</b> search parameter constant for <b>coverage</b>
18535   * <p>
18536   * Description: <b>The plan under which the claim was adjudicated</b><br>
18537   * Type: <b>reference</b><br>
18538   * Path: <b>ExplanationOfBenefit.insurance.coverage</b><br>
18539   * </p>
18540   */
18541  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COVERAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18542      SP_COVERAGE);
18543
18544  /**
18545   * Constant for fluent queries to be used to add include statements. Specifies
18546   * the path value of "<b>ExplanationOfBenefit:coverage</b>".
18547   */
18548  public static final ca.uhn.fhir.model.api.Include INCLUDE_COVERAGE = new ca.uhn.fhir.model.api.Include(
18549      "ExplanationOfBenefit:coverage").toLocked();
18550
18551  /**
18552   * Search parameter: <b>care-team</b>
18553   * <p>
18554   * Description: <b>Member of the CareTeam</b><br>
18555   * Type: <b>reference</b><br>
18556   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
18557   * </p>
18558   */
18559  @SearchParamDefinition(name = "care-team", path = "ExplanationOfBenefit.careTeam.provider", description = "Member of the CareTeam", type = "reference", providesMembershipIn = {
18560      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Organization.class,
18561          Practitioner.class, PractitionerRole.class })
18562  public static final String SP_CARE_TEAM = "care-team";
18563  /**
18564   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
18565   * <p>
18566   * Description: <b>Member of the CareTeam</b><br>
18567   * Type: <b>reference</b><br>
18568   * Path: <b>ExplanationOfBenefit.careTeam.provider</b><br>
18569   * </p>
18570   */
18571  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18572      SP_CARE_TEAM);
18573
18574  /**
18575   * Constant for fluent queries to be used to add include statements. Specifies
18576   * the path value of "<b>ExplanationOfBenefit:care-team</b>".
18577   */
18578  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include(
18579      "ExplanationOfBenefit:care-team").toLocked();
18580
18581  /**
18582   * Search parameter: <b>identifier</b>
18583   * <p>
18584   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
18585   * Type: <b>token</b><br>
18586   * Path: <b>ExplanationOfBenefit.identifier</b><br>
18587   * </p>
18588   */
18589  @SearchParamDefinition(name = "identifier", path = "ExplanationOfBenefit.identifier", description = "The business identifier of the Explanation of Benefit", type = "token")
18590  public static final String SP_IDENTIFIER = "identifier";
18591  /**
18592   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
18593   * <p>
18594   * Description: <b>The business identifier of the Explanation of Benefit</b><br>
18595   * Type: <b>token</b><br>
18596   * Path: <b>ExplanationOfBenefit.identifier</b><br>
18597   * </p>
18598   */
18599  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
18600      SP_IDENTIFIER);
18601
18602  /**
18603   * Search parameter: <b>created</b>
18604   * <p>
18605   * Description: <b>The creation date for the EOB</b><br>
18606   * Type: <b>date</b><br>
18607   * Path: <b>ExplanationOfBenefit.created</b><br>
18608   * </p>
18609   */
18610  @SearchParamDefinition(name = "created", path = "ExplanationOfBenefit.created", description = "The creation date for the EOB", type = "date")
18611  public static final String SP_CREATED = "created";
18612  /**
18613   * <b>Fluent Client</b> search parameter constant for <b>created</b>
18614   * <p>
18615   * Description: <b>The creation date for the EOB</b><br>
18616   * Type: <b>date</b><br>
18617   * Path: <b>ExplanationOfBenefit.created</b><br>
18618   * </p>
18619   */
18620  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(
18621      SP_CREATED);
18622
18623  /**
18624   * Search parameter: <b>encounter</b>
18625   * <p>
18626   * Description: <b>Encounters associated with a billed line item</b><br>
18627   * Type: <b>reference</b><br>
18628   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
18629   * </p>
18630   */
18631  @SearchParamDefinition(name = "encounter", path = "ExplanationOfBenefit.item.encounter", description = "Encounters associated with a billed line item", type = "reference", providesMembershipIn = {
18632      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Encounter") }, target = { Encounter.class })
18633  public static final String SP_ENCOUNTER = "encounter";
18634  /**
18635   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
18636   * <p>
18637   * Description: <b>Encounters associated with a billed line item</b><br>
18638   * Type: <b>reference</b><br>
18639   * Path: <b>ExplanationOfBenefit.item.encounter</b><br>
18640   * </p>
18641   */
18642  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18643      SP_ENCOUNTER);
18644
18645  /**
18646   * Constant for fluent queries to be used to add include statements. Specifies
18647   * the path value of "<b>ExplanationOfBenefit:encounter</b>".
18648   */
18649  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include(
18650      "ExplanationOfBenefit:encounter").toLocked();
18651
18652  /**
18653   * Search parameter: <b>payee</b>
18654   * <p>
18655   * Description: <b>The party receiving any payment for the Claim</b><br>
18656   * Type: <b>reference</b><br>
18657   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
18658   * </p>
18659   */
18660  @SearchParamDefinition(name = "payee", path = "ExplanationOfBenefit.payee.party", description = "The party receiving any payment for the Claim", type = "reference", providesMembershipIn = {
18661      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient"),
18662      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner"),
18663      @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { Organization.class,
18664          Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class })
18665  public static final String SP_PAYEE = "payee";
18666  /**
18667   * <b>Fluent Client</b> search parameter constant for <b>payee</b>
18668   * <p>
18669   * Description: <b>The party receiving any payment for the Claim</b><br>
18670   * Type: <b>reference</b><br>
18671   * Path: <b>ExplanationOfBenefit.payee.party</b><br>
18672   * </p>
18673   */
18674  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18675      SP_PAYEE);
18676
18677  /**
18678   * Constant for fluent queries to be used to add include statements. Specifies
18679   * the path value of "<b>ExplanationOfBenefit:payee</b>".
18680   */
18681  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYEE = new ca.uhn.fhir.model.api.Include(
18682      "ExplanationOfBenefit:payee").toLocked();
18683
18684  /**
18685   * Search parameter: <b>disposition</b>
18686   * <p>
18687   * Description: <b>The contents of the disposition message</b><br>
18688   * Type: <b>string</b><br>
18689   * Path: <b>ExplanationOfBenefit.disposition</b><br>
18690   * </p>
18691   */
18692  @SearchParamDefinition(name = "disposition", path = "ExplanationOfBenefit.disposition", description = "The contents of the disposition message", type = "string")
18693  public static final String SP_DISPOSITION = "disposition";
18694  /**
18695   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
18696   * <p>
18697   * Description: <b>The contents of the disposition message</b><br>
18698   * Type: <b>string</b><br>
18699   * Path: <b>ExplanationOfBenefit.disposition</b><br>
18700   * </p>
18701   */
18702  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(
18703      SP_DISPOSITION);
18704
18705  /**
18706   * Search parameter: <b>provider</b>
18707   * <p>
18708   * Description: <b>The reference to the provider</b><br>
18709   * Type: <b>reference</b><br>
18710   * Path: <b>ExplanationOfBenefit.provider</b><br>
18711   * </p>
18712   */
18713  @SearchParamDefinition(name = "provider", path = "ExplanationOfBenefit.provider", description = "The reference to the provider", type = "reference", providesMembershipIn = {
18714      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Organization.class,
18715          Practitioner.class, PractitionerRole.class })
18716  public static final String SP_PROVIDER = "provider";
18717  /**
18718   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
18719   * <p>
18720   * Description: <b>The reference to the provider</b><br>
18721   * Type: <b>reference</b><br>
18722   * Path: <b>ExplanationOfBenefit.provider</b><br>
18723   * </p>
18724   */
18725  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18726      SP_PROVIDER);
18727
18728  /**
18729   * Constant for fluent queries to be used to add include statements. Specifies
18730   * the path value of "<b>ExplanationOfBenefit:provider</b>".
18731   */
18732  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include(
18733      "ExplanationOfBenefit:provider").toLocked();
18734
18735  /**
18736   * Search parameter: <b>patient</b>
18737   * <p>
18738   * Description: <b>The reference to the patient</b><br>
18739   * Type: <b>reference</b><br>
18740   * Path: <b>ExplanationOfBenefit.patient</b><br>
18741   * </p>
18742   */
18743  @SearchParamDefinition(name = "patient", path = "ExplanationOfBenefit.patient", description = "The reference to the patient", type = "reference", providesMembershipIn = {
18744      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Patient.class })
18745  public static final String SP_PATIENT = "patient";
18746  /**
18747   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
18748   * <p>
18749   * Description: <b>The reference to the patient</b><br>
18750   * Type: <b>reference</b><br>
18751   * Path: <b>ExplanationOfBenefit.patient</b><br>
18752   * </p>
18753   */
18754  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18755      SP_PATIENT);
18756
18757  /**
18758   * Constant for fluent queries to be used to add include statements. Specifies
18759   * the path value of "<b>ExplanationOfBenefit:patient</b>".
18760   */
18761  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
18762      "ExplanationOfBenefit:patient").toLocked();
18763
18764  /**
18765   * Search parameter: <b>detail-udi</b>
18766   * <p>
18767   * Description: <b>UDI associated with a line item detail product or
18768   * service</b><br>
18769   * Type: <b>reference</b><br>
18770   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
18771   * </p>
18772   */
18773  @SearchParamDefinition(name = "detail-udi", path = "ExplanationOfBenefit.item.detail.udi", description = "UDI associated with a line item detail product or service", type = "reference", providesMembershipIn = {
18774      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device") }, target = { Device.class })
18775  public static final String SP_DETAIL_UDI = "detail-udi";
18776  /**
18777   * <b>Fluent Client</b> search parameter constant for <b>detail-udi</b>
18778   * <p>
18779   * Description: <b>UDI associated with a line item detail product or
18780   * service</b><br>
18781   * Type: <b>reference</b><br>
18782   * Path: <b>ExplanationOfBenefit.item.detail.udi</b><br>
18783   * </p>
18784   */
18785  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18786      SP_DETAIL_UDI);
18787
18788  /**
18789   * Constant for fluent queries to be used to add include statements. Specifies
18790   * the path value of "<b>ExplanationOfBenefit:detail-udi</b>".
18791   */
18792  public static final ca.uhn.fhir.model.api.Include INCLUDE_DETAIL_UDI = new ca.uhn.fhir.model.api.Include(
18793      "ExplanationOfBenefit:detail-udi").toLocked();
18794
18795  /**
18796   * Search parameter: <b>claim</b>
18797   * <p>
18798   * Description: <b>The reference to the claim</b><br>
18799   * Type: <b>reference</b><br>
18800   * Path: <b>ExplanationOfBenefit.claim</b><br>
18801   * </p>
18802   */
18803  @SearchParamDefinition(name = "claim", path = "ExplanationOfBenefit.claim", description = "The reference to the claim", type = "reference", target = {
18804      Claim.class })
18805  public static final String SP_CLAIM = "claim";
18806  /**
18807   * <b>Fluent Client</b> search parameter constant for <b>claim</b>
18808   * <p>
18809   * Description: <b>The reference to the claim</b><br>
18810   * Type: <b>reference</b><br>
18811   * Path: <b>ExplanationOfBenefit.claim</b><br>
18812   * </p>
18813   */
18814  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CLAIM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18815      SP_CLAIM);
18816
18817  /**
18818   * Constant for fluent queries to be used to add include statements. Specifies
18819   * the path value of "<b>ExplanationOfBenefit:claim</b>".
18820   */
18821  public static final ca.uhn.fhir.model.api.Include INCLUDE_CLAIM = new ca.uhn.fhir.model.api.Include(
18822      "ExplanationOfBenefit:claim").toLocked();
18823
18824  /**
18825   * Search parameter: <b>enterer</b>
18826   * <p>
18827   * Description: <b>The party responsible for the entry of the Claim</b><br>
18828   * Type: <b>reference</b><br>
18829   * Path: <b>ExplanationOfBenefit.enterer</b><br>
18830   * </p>
18831   */
18832  @SearchParamDefinition(name = "enterer", path = "ExplanationOfBenefit.enterer", description = "The party responsible for the entry of the Claim", type = "reference", providesMembershipIn = {
18833      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Practitioner.class,
18834          PractitionerRole.class })
18835  public static final String SP_ENTERER = "enterer";
18836  /**
18837   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
18838   * <p>
18839   * Description: <b>The party responsible for the entry of the Claim</b><br>
18840   * Type: <b>reference</b><br>
18841   * Path: <b>ExplanationOfBenefit.enterer</b><br>
18842   * </p>
18843   */
18844  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18845      SP_ENTERER);
18846
18847  /**
18848   * Constant for fluent queries to be used to add include statements. Specifies
18849   * the path value of "<b>ExplanationOfBenefit:enterer</b>".
18850   */
18851  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include(
18852      "ExplanationOfBenefit:enterer").toLocked();
18853
18854  /**
18855   * Search parameter: <b>procedure-udi</b>
18856   * <p>
18857   * Description: <b>UDI associated with a procedure</b><br>
18858   * Type: <b>reference</b><br>
18859   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
18860   * </p>
18861   */
18862  @SearchParamDefinition(name = "procedure-udi", path = "ExplanationOfBenefit.procedure.udi", description = "UDI associated with a procedure", type = "reference", providesMembershipIn = {
18863      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device") }, target = { Device.class })
18864  public static final String SP_PROCEDURE_UDI = "procedure-udi";
18865  /**
18866   * <b>Fluent Client</b> search parameter constant for <b>procedure-udi</b>
18867   * <p>
18868   * Description: <b>UDI associated with a procedure</b><br>
18869   * Type: <b>reference</b><br>
18870   * Path: <b>ExplanationOfBenefit.procedure.udi</b><br>
18871   * </p>
18872   */
18873  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROCEDURE_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18874      SP_PROCEDURE_UDI);
18875
18876  /**
18877   * Constant for fluent queries to be used to add include statements. Specifies
18878   * the path value of "<b>ExplanationOfBenefit:procedure-udi</b>".
18879   */
18880  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROCEDURE_UDI = new ca.uhn.fhir.model.api.Include(
18881      "ExplanationOfBenefit:procedure-udi").toLocked();
18882
18883  /**
18884   * Search parameter: <b>subdetail-udi</b>
18885   * <p>
18886   * Description: <b>UDI associated with a line item detail subdetail product or
18887   * service</b><br>
18888   * Type: <b>reference</b><br>
18889   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
18890   * </p>
18891   */
18892  @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 = {
18893      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device") }, target = { Device.class })
18894  public static final String SP_SUBDETAIL_UDI = "subdetail-udi";
18895  /**
18896   * <b>Fluent Client</b> search parameter constant for <b>subdetail-udi</b>
18897   * <p>
18898   * Description: <b>UDI associated with a line item detail subdetail product or
18899   * service</b><br>
18900   * Type: <b>reference</b><br>
18901   * Path: <b>ExplanationOfBenefit.item.detail.subDetail.udi</b><br>
18902   * </p>
18903   */
18904  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBDETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18905      SP_SUBDETAIL_UDI);
18906
18907  /**
18908   * Constant for fluent queries to be used to add include statements. Specifies
18909   * the path value of "<b>ExplanationOfBenefit:subdetail-udi</b>".
18910   */
18911  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBDETAIL_UDI = new ca.uhn.fhir.model.api.Include(
18912      "ExplanationOfBenefit:subdetail-udi").toLocked();
18913
18914  /**
18915   * Search parameter: <b>facility</b>
18916   * <p>
18917   * Description: <b>Facility responsible for the goods and services</b><br>
18918   * Type: <b>reference</b><br>
18919   * Path: <b>ExplanationOfBenefit.facility</b><br>
18920   * </p>
18921   */
18922  @SearchParamDefinition(name = "facility", path = "ExplanationOfBenefit.facility", description = "Facility responsible for the goods and services", type = "reference", target = {
18923      Location.class })
18924  public static final String SP_FACILITY = "facility";
18925  /**
18926   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
18927   * <p>
18928   * Description: <b>Facility responsible for the goods and services</b><br>
18929   * Type: <b>reference</b><br>
18930   * Path: <b>ExplanationOfBenefit.facility</b><br>
18931   * </p>
18932   */
18933  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18934      SP_FACILITY);
18935
18936  /**
18937   * Constant for fluent queries to be used to add include statements. Specifies
18938   * the path value of "<b>ExplanationOfBenefit:facility</b>".
18939   */
18940  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include(
18941      "ExplanationOfBenefit:facility").toLocked();
18942
18943  /**
18944   * Search parameter: <b>item-udi</b>
18945   * <p>
18946   * Description: <b>UDI associated with a line item product or service</b><br>
18947   * Type: <b>reference</b><br>
18948   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
18949   * </p>
18950   */
18951  @SearchParamDefinition(name = "item-udi", path = "ExplanationOfBenefit.item.udi", description = "UDI associated with a line item product or service", type = "reference", providesMembershipIn = {
18952      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device") }, target = { Device.class })
18953  public static final String SP_ITEM_UDI = "item-udi";
18954  /**
18955   * <b>Fluent Client</b> search parameter constant for <b>item-udi</b>
18956   * <p>
18957   * Description: <b>UDI associated with a line item product or service</b><br>
18958   * Type: <b>reference</b><br>
18959   * Path: <b>ExplanationOfBenefit.item.udi</b><br>
18960   * </p>
18961   */
18962  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
18963      SP_ITEM_UDI);
18964
18965  /**
18966   * Constant for fluent queries to be used to add include statements. Specifies
18967   * the path value of "<b>ExplanationOfBenefit:item-udi</b>".
18968   */
18969  public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM_UDI = new ca.uhn.fhir.model.api.Include(
18970      "ExplanationOfBenefit:item-udi").toLocked();
18971
18972  /**
18973   * Search parameter: <b>status</b>
18974   * <p>
18975   * Description: <b>Status of the instance</b><br>
18976   * Type: <b>token</b><br>
18977   * Path: <b>ExplanationOfBenefit.status</b><br>
18978   * </p>
18979   */
18980  @SearchParamDefinition(name = "status", path = "ExplanationOfBenefit.status", description = "Status of the instance", type = "token")
18981  public static final String SP_STATUS = "status";
18982  /**
18983   * <b>Fluent Client</b> search parameter constant for <b>status</b>
18984   * <p>
18985   * Description: <b>Status of the instance</b><br>
18986   * Type: <b>token</b><br>
18987   * Path: <b>ExplanationOfBenefit.status</b><br>
18988   * </p>
18989   */
18990  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
18991      SP_STATUS);
18992
18993}