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.utilities.Utilities;
042
043import ca.uhn.fhir.model.api.annotation.Block;
044import ca.uhn.fhir.model.api.annotation.Child;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.ResourceDef;
047import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
048
049/**
050 * A provider issued list of professional services and products which have been
051 * provided, or are to be provided, to a patient which is sent to an insurer for
052 * reimbursement.
053 */
054@ResourceDef(name = "Claim", profile = "http://hl7.org/fhir/StructureDefinition/Claim")
055public class Claim extends DomainResource {
056
057  public enum ClaimStatus {
058    /**
059     * The instance is currently in-force.
060     */
061    ACTIVE,
062    /**
063     * The instance is withdrawn, rescinded or reversed.
064     */
065    CANCELLED,
066    /**
067     * A new instance the contents of which is not complete.
068     */
069    DRAFT,
070    /**
071     * The instance was entered in error.
072     */
073    ENTEREDINERROR,
074    /**
075     * added to help the parsers with the generic types
076     */
077    NULL;
078
079    public static ClaimStatus fromCode(String codeString) throws FHIRException {
080      if (codeString == null || "".equals(codeString))
081        return null;
082      if ("active".equals(codeString))
083        return ACTIVE;
084      if ("cancelled".equals(codeString))
085        return CANCELLED;
086      if ("draft".equals(codeString))
087        return DRAFT;
088      if ("entered-in-error".equals(codeString))
089        return ENTEREDINERROR;
090      if (Configuration.isAcceptInvalidEnums())
091        return null;
092      else
093        throw new FHIRException("Unknown ClaimStatus code '" + codeString + "'");
094    }
095
096    public String toCode() {
097      switch (this) {
098      case ACTIVE:
099        return "active";
100      case CANCELLED:
101        return "cancelled";
102      case DRAFT:
103        return "draft";
104      case ENTEREDINERROR:
105        return "entered-in-error";
106      case NULL:
107        return null;
108      default:
109        return "?";
110      }
111    }
112
113    public String getSystem() {
114      switch (this) {
115      case ACTIVE:
116        return "http://hl7.org/fhir/fm-status";
117      case CANCELLED:
118        return "http://hl7.org/fhir/fm-status";
119      case DRAFT:
120        return "http://hl7.org/fhir/fm-status";
121      case ENTEREDINERROR:
122        return "http://hl7.org/fhir/fm-status";
123      case NULL:
124        return null;
125      default:
126        return "?";
127      }
128    }
129
130    public String getDefinition() {
131      switch (this) {
132      case ACTIVE:
133        return "The instance is currently in-force.";
134      case CANCELLED:
135        return "The instance is withdrawn, rescinded or reversed.";
136      case DRAFT:
137        return "A new instance the contents of which is not complete.";
138      case ENTEREDINERROR:
139        return "The instance was entered in error.";
140      case NULL:
141        return null;
142      default:
143        return "?";
144      }
145    }
146
147    public String getDisplay() {
148      switch (this) {
149      case ACTIVE:
150        return "Active";
151      case CANCELLED:
152        return "Cancelled";
153      case DRAFT:
154        return "Draft";
155      case ENTEREDINERROR:
156        return "Entered in Error";
157      case NULL:
158        return null;
159      default:
160        return "?";
161      }
162    }
163  }
164
165  public static class ClaimStatusEnumFactory implements EnumFactory<ClaimStatus> {
166    public ClaimStatus fromCode(String codeString) throws IllegalArgumentException {
167      if (codeString == null || "".equals(codeString))
168        if (codeString == null || "".equals(codeString))
169          return null;
170      if ("active".equals(codeString))
171        return ClaimStatus.ACTIVE;
172      if ("cancelled".equals(codeString))
173        return ClaimStatus.CANCELLED;
174      if ("draft".equals(codeString))
175        return ClaimStatus.DRAFT;
176      if ("entered-in-error".equals(codeString))
177        return ClaimStatus.ENTEREDINERROR;
178      throw new IllegalArgumentException("Unknown ClaimStatus code '" + codeString + "'");
179    }
180
181    public Enumeration<ClaimStatus> fromType(PrimitiveType<?> code) throws FHIRException {
182      if (code == null)
183        return null;
184      if (code.isEmpty())
185        return new Enumeration<ClaimStatus>(this, ClaimStatus.NULL, code);
186      String codeString = code.asStringValue();
187      if (codeString == null || "".equals(codeString))
188        return new Enumeration<ClaimStatus>(this, ClaimStatus.NULL, code);
189      if ("active".equals(codeString))
190        return new Enumeration<ClaimStatus>(this, ClaimStatus.ACTIVE, code);
191      if ("cancelled".equals(codeString))
192        return new Enumeration<ClaimStatus>(this, ClaimStatus.CANCELLED, code);
193      if ("draft".equals(codeString))
194        return new Enumeration<ClaimStatus>(this, ClaimStatus.DRAFT, code);
195      if ("entered-in-error".equals(codeString))
196        return new Enumeration<ClaimStatus>(this, ClaimStatus.ENTEREDINERROR, code);
197      throw new FHIRException("Unknown ClaimStatus code '" + codeString + "'");
198    }
199
200    public String toCode(ClaimStatus code) {
201      if (code == ClaimStatus.ACTIVE)
202        return "active";
203      if (code == ClaimStatus.CANCELLED)
204        return "cancelled";
205      if (code == ClaimStatus.DRAFT)
206        return "draft";
207      if (code == ClaimStatus.ENTEREDINERROR)
208        return "entered-in-error";
209      return "?";
210    }
211
212    public String toSystem(ClaimStatus code) {
213      return code.getSystem();
214    }
215  }
216
217  public enum Use {
218    /**
219     * The treatment is complete and this represents a Claim for the services.
220     */
221    CLAIM,
222    /**
223     * The treatment is proposed and this represents a Pre-authorization for the
224     * services.
225     */
226    PREAUTHORIZATION,
227    /**
228     * The treatment is proposed and this represents a Pre-determination for the
229     * services.
230     */
231    PREDETERMINATION,
232    /**
233     * added to help the parsers with the generic types
234     */
235    NULL;
236
237    public static Use fromCode(String codeString) throws FHIRException {
238      if (codeString == null || "".equals(codeString))
239        return null;
240      if ("claim".equals(codeString))
241        return CLAIM;
242      if ("preauthorization".equals(codeString))
243        return PREAUTHORIZATION;
244      if ("predetermination".equals(codeString))
245        return PREDETERMINATION;
246      if (Configuration.isAcceptInvalidEnums())
247        return null;
248      else
249        throw new FHIRException("Unknown Use code '" + codeString + "'");
250    }
251
252    public String toCode() {
253      switch (this) {
254      case CLAIM:
255        return "claim";
256      case PREAUTHORIZATION:
257        return "preauthorization";
258      case PREDETERMINATION:
259        return "predetermination";
260      case NULL:
261        return null;
262      default:
263        return "?";
264      }
265    }
266
267    public String getSystem() {
268      switch (this) {
269      case CLAIM:
270        return "http://hl7.org/fhir/claim-use";
271      case PREAUTHORIZATION:
272        return "http://hl7.org/fhir/claim-use";
273      case PREDETERMINATION:
274        return "http://hl7.org/fhir/claim-use";
275      case NULL:
276        return null;
277      default:
278        return "?";
279      }
280    }
281
282    public String getDefinition() {
283      switch (this) {
284      case CLAIM:
285        return "The treatment is complete and this represents a Claim for the services.";
286      case PREAUTHORIZATION:
287        return "The treatment is proposed and this represents a Pre-authorization for the services.";
288      case PREDETERMINATION:
289        return "The treatment is proposed and this represents a Pre-determination for the services.";
290      case NULL:
291        return null;
292      default:
293        return "?";
294      }
295    }
296
297    public String getDisplay() {
298      switch (this) {
299      case CLAIM:
300        return "Claim";
301      case PREAUTHORIZATION:
302        return "Preauthorization";
303      case PREDETERMINATION:
304        return "Predetermination";
305      case NULL:
306        return null;
307      default:
308        return "?";
309      }
310    }
311  }
312
313  public static class UseEnumFactory implements EnumFactory<Use> {
314    public Use fromCode(String codeString) throws IllegalArgumentException {
315      if (codeString == null || "".equals(codeString))
316        if (codeString == null || "".equals(codeString))
317          return null;
318      if ("claim".equals(codeString))
319        return Use.CLAIM;
320      if ("preauthorization".equals(codeString))
321        return Use.PREAUTHORIZATION;
322      if ("predetermination".equals(codeString))
323        return Use.PREDETERMINATION;
324      throw new IllegalArgumentException("Unknown Use code '" + codeString + "'");
325    }
326
327    public Enumeration<Use> fromType(PrimitiveType<?> code) throws FHIRException {
328      if (code == null)
329        return null;
330      if (code.isEmpty())
331        return new Enumeration<Use>(this, Use.NULL, code);
332      String codeString = code.asStringValue();
333      if (codeString == null || "".equals(codeString))
334        return new Enumeration<Use>(this, Use.NULL, code);
335      if ("claim".equals(codeString))
336        return new Enumeration<Use>(this, Use.CLAIM, code);
337      if ("preauthorization".equals(codeString))
338        return new Enumeration<Use>(this, Use.PREAUTHORIZATION, code);
339      if ("predetermination".equals(codeString))
340        return new Enumeration<Use>(this, Use.PREDETERMINATION, code);
341      throw new FHIRException("Unknown Use code '" + codeString + "'");
342    }
343
344    public String toCode(Use code) {
345      if (code == Use.CLAIM)
346        return "claim";
347      if (code == Use.PREAUTHORIZATION)
348        return "preauthorization";
349      if (code == Use.PREDETERMINATION)
350        return "predetermination";
351      return "?";
352    }
353
354    public String toSystem(Use code) {
355      return code.getSystem();
356    }
357  }
358
359  @Block()
360  public static class RelatedClaimComponent extends BackboneElement implements IBaseBackboneElement {
361    /**
362     * Reference to a related claim.
363     */
364    @Child(name = "claim", type = { Claim.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
365    @Description(shortDefinition = "Reference to the related claim", formalDefinition = "Reference to a related claim.")
366    protected Reference claim;
367
368    /**
369     * The actual object that is the target of the reference (Reference to a related
370     * claim.)
371     */
372    protected Claim claimTarget;
373
374    /**
375     * A code to convey how the claims are related.
376     */
377    @Child(name = "relationship", type = {
378        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
379    @Description(shortDefinition = "How the reference claim is related", formalDefinition = "A code to convey how the claims are related.")
380    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/related-claim-relationship")
381    protected CodeableConcept relationship;
382
383    /**
384     * An alternate organizational reference to the case or file to which this
385     * particular claim pertains.
386     */
387    @Child(name = "reference", type = {
388        Identifier.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
389    @Description(shortDefinition = "File or case reference", formalDefinition = "An alternate organizational reference to the case or file to which this particular claim pertains.")
390    protected Identifier reference;
391
392    private static final long serialVersionUID = -379338905L;
393
394    /**
395     * Constructor
396     */
397    public RelatedClaimComponent() {
398      super();
399    }
400
401    /**
402     * @return {@link #claim} (Reference to a related claim.)
403     */
404    public Reference getClaim() {
405      if (this.claim == null)
406        if (Configuration.errorOnAutoCreate())
407          throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
408        else if (Configuration.doAutoCreate())
409          this.claim = new Reference(); // cc
410      return this.claim;
411    }
412
413    public boolean hasClaim() {
414      return this.claim != null && !this.claim.isEmpty();
415    }
416
417    /**
418     * @param value {@link #claim} (Reference to a related claim.)
419     */
420    public RelatedClaimComponent setClaim(Reference value) {
421      this.claim = value;
422      return this;
423    }
424
425    /**
426     * @return {@link #claim} The actual object that is the target of the reference.
427     *         The reference library doesn't populate this, but you can use it to
428     *         hold the resource if you resolve it. (Reference to a related claim.)
429     */
430    public Claim getClaimTarget() {
431      if (this.claimTarget == null)
432        if (Configuration.errorOnAutoCreate())
433          throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
434        else if (Configuration.doAutoCreate())
435          this.claimTarget = new Claim(); // aa
436      return this.claimTarget;
437    }
438
439    /**
440     * @param value {@link #claim} The actual object that is the target of the
441     *              reference. The reference library doesn't use these, but you can
442     *              use it to hold the resource if you resolve it. (Reference to a
443     *              related claim.)
444     */
445    public RelatedClaimComponent setClaimTarget(Claim value) {
446      this.claimTarget = value;
447      return this;
448    }
449
450    /**
451     * @return {@link #relationship} (A code to convey how the claims are related.)
452     */
453    public CodeableConcept getRelationship() {
454      if (this.relationship == null)
455        if (Configuration.errorOnAutoCreate())
456          throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
457        else if (Configuration.doAutoCreate())
458          this.relationship = new CodeableConcept(); // cc
459      return this.relationship;
460    }
461
462    public boolean hasRelationship() {
463      return this.relationship != null && !this.relationship.isEmpty();
464    }
465
466    /**
467     * @param value {@link #relationship} (A code to convey how the claims are
468     *              related.)
469     */
470    public RelatedClaimComponent setRelationship(CodeableConcept value) {
471      this.relationship = value;
472      return this;
473    }
474
475    /**
476     * @return {@link #reference} (An alternate organizational reference to the case
477     *         or file to which this particular claim pertains.)
478     */
479    public Identifier getReference() {
480      if (this.reference == null)
481        if (Configuration.errorOnAutoCreate())
482          throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
483        else if (Configuration.doAutoCreate())
484          this.reference = new Identifier(); // cc
485      return this.reference;
486    }
487
488    public boolean hasReference() {
489      return this.reference != null && !this.reference.isEmpty();
490    }
491
492    /**
493     * @param value {@link #reference} (An alternate organizational reference to the
494     *              case or file to which this particular claim pertains.)
495     */
496    public RelatedClaimComponent setReference(Identifier value) {
497      this.reference = value;
498      return this;
499    }
500
501    protected void listChildren(List<Property> children) {
502      super.listChildren(children);
503      children.add(new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim));
504      children.add(new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1,
505          relationship));
506      children.add(new Property("reference", "Identifier",
507          "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1,
508          reference));
509    }
510
511    @Override
512    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
513      switch (_hash) {
514      case 94742588:
515        /* claim */ return new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim);
516      case -261851592:
517        /* relationship */ return new Property("relationship", "CodeableConcept",
518            "A code to convey how the claims are related.", 0, 1, relationship);
519      case -925155509:
520        /* reference */ return new Property("reference", "Identifier",
521            "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1,
522            reference);
523      default:
524        return super.getNamedProperty(_hash, _name, _checkValid);
525      }
526
527    }
528
529    @Override
530    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
531      switch (hash) {
532      case 94742588:
533        /* claim */ return this.claim == null ? new Base[0] : new Base[] { this.claim }; // Reference
534      case -261851592:
535        /* relationship */ return this.relationship == null ? new Base[0] : new Base[] { this.relationship }; // CodeableConcept
536      case -925155509:
537        /* reference */ return this.reference == null ? new Base[0] : new Base[] { this.reference }; // Identifier
538      default:
539        return super.getProperty(hash, name, checkValid);
540      }
541
542    }
543
544    @Override
545    public Base setProperty(int hash, String name, Base value) throws FHIRException {
546      switch (hash) {
547      case 94742588: // claim
548        this.claim = castToReference(value); // Reference
549        return value;
550      case -261851592: // relationship
551        this.relationship = castToCodeableConcept(value); // CodeableConcept
552        return value;
553      case -925155509: // reference
554        this.reference = castToIdentifier(value); // Identifier
555        return value;
556      default:
557        return super.setProperty(hash, name, value);
558      }
559
560    }
561
562    @Override
563    public Base setProperty(String name, Base value) throws FHIRException {
564      if (name.equals("claim")) {
565        this.claim = castToReference(value); // Reference
566      } else if (name.equals("relationship")) {
567        this.relationship = castToCodeableConcept(value); // CodeableConcept
568      } else if (name.equals("reference")) {
569        this.reference = castToIdentifier(value); // Identifier
570      } else
571        return super.setProperty(name, value);
572      return value;
573    }
574
575    @Override
576    public Base makeProperty(int hash, String name) throws FHIRException {
577      switch (hash) {
578      case 94742588:
579        return getClaim();
580      case -261851592:
581        return getRelationship();
582      case -925155509:
583        return getReference();
584      default:
585        return super.makeProperty(hash, name);
586      }
587
588    }
589
590    @Override
591    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
592      switch (hash) {
593      case 94742588:
594        /* claim */ return new String[] { "Reference" };
595      case -261851592:
596        /* relationship */ return new String[] { "CodeableConcept" };
597      case -925155509:
598        /* reference */ return new String[] { "Identifier" };
599      default:
600        return super.getTypesForProperty(hash, name);
601      }
602
603    }
604
605    @Override
606    public Base addChild(String name) throws FHIRException {
607      if (name.equals("claim")) {
608        this.claim = new Reference();
609        return this.claim;
610      } else if (name.equals("relationship")) {
611        this.relationship = new CodeableConcept();
612        return this.relationship;
613      } else if (name.equals("reference")) {
614        this.reference = new Identifier();
615        return this.reference;
616      } else
617        return super.addChild(name);
618    }
619
620    public RelatedClaimComponent copy() {
621      RelatedClaimComponent dst = new RelatedClaimComponent();
622      copyValues(dst);
623      return dst;
624    }
625
626    public void copyValues(RelatedClaimComponent dst) {
627      super.copyValues(dst);
628      dst.claim = claim == null ? null : claim.copy();
629      dst.relationship = relationship == null ? null : relationship.copy();
630      dst.reference = reference == null ? null : reference.copy();
631    }
632
633    @Override
634    public boolean equalsDeep(Base other_) {
635      if (!super.equalsDeep(other_))
636        return false;
637      if (!(other_ instanceof RelatedClaimComponent))
638        return false;
639      RelatedClaimComponent o = (RelatedClaimComponent) other_;
640      return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true)
641          && compareDeep(reference, o.reference, true);
642    }
643
644    @Override
645    public boolean equalsShallow(Base other_) {
646      if (!super.equalsShallow(other_))
647        return false;
648      if (!(other_ instanceof RelatedClaimComponent))
649        return false;
650      RelatedClaimComponent o = (RelatedClaimComponent) other_;
651      return true;
652    }
653
654    public boolean isEmpty() {
655      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference);
656    }
657
658    public String fhirType() {
659      return "Claim.related";
660
661    }
662
663  }
664
665  @Block()
666  public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
667    /**
668     * Type of Party to be reimbursed: subscriber, provider, other.
669     */
670    @Child(name = "type", type = {
671        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
672    @Description(shortDefinition = "Category of recipient", formalDefinition = "Type of Party to be reimbursed: subscriber, provider, other.")
673    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/payeetype")
674    protected CodeableConcept type;
675
676    /**
677     * Reference to the individual or organization to whom any payment will be made.
678     */
679    @Child(name = "party", type = { Practitioner.class, PractitionerRole.class, Organization.class, Patient.class,
680        RelatedPerson.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
681    @Description(shortDefinition = "Recipient reference", formalDefinition = "Reference to the individual or organization to whom any payment will be made.")
682    protected Reference party;
683
684    /**
685     * The actual object that is the target of the reference (Reference to the
686     * individual or organization to whom any payment will be made.)
687     */
688    protected Resource partyTarget;
689
690    private static final long serialVersionUID = 1609484699L;
691
692    /**
693     * Constructor
694     */
695    public PayeeComponent() {
696      super();
697    }
698
699    /**
700     * Constructor
701     */
702    public PayeeComponent(CodeableConcept type) {
703      super();
704      this.type = type;
705    }
706
707    /**
708     * @return {@link #type} (Type of Party to be reimbursed: subscriber, provider,
709     *         other.)
710     */
711    public CodeableConcept getType() {
712      if (this.type == null)
713        if (Configuration.errorOnAutoCreate())
714          throw new Error("Attempt to auto-create PayeeComponent.type");
715        else if (Configuration.doAutoCreate())
716          this.type = new CodeableConcept(); // cc
717      return this.type;
718    }
719
720    public boolean hasType() {
721      return this.type != null && !this.type.isEmpty();
722    }
723
724    /**
725     * @param value {@link #type} (Type of Party to be reimbursed: subscriber,
726     *              provider, other.)
727     */
728    public PayeeComponent setType(CodeableConcept value) {
729      this.type = value;
730      return this;
731    }
732
733    /**
734     * @return {@link #party} (Reference to the individual or organization to whom
735     *         any payment will be made.)
736     */
737    public Reference getParty() {
738      if (this.party == null)
739        if (Configuration.errorOnAutoCreate())
740          throw new Error("Attempt to auto-create PayeeComponent.party");
741        else if (Configuration.doAutoCreate())
742          this.party = new Reference(); // cc
743      return this.party;
744    }
745
746    public boolean hasParty() {
747      return this.party != null && !this.party.isEmpty();
748    }
749
750    /**
751     * @param value {@link #party} (Reference to the individual or organization to
752     *              whom any payment will be made.)
753     */
754    public PayeeComponent setParty(Reference value) {
755      this.party = value;
756      return this;
757    }
758
759    /**
760     * @return {@link #party} The actual object that is the target of the reference.
761     *         The reference library doesn't populate this, but you can use it to
762     *         hold the resource if you resolve it. (Reference to the individual or
763     *         organization to whom any payment will be made.)
764     */
765    public Resource getPartyTarget() {
766      return this.partyTarget;
767    }
768
769    /**
770     * @param value {@link #party} The actual object that is the target of the
771     *              reference. The reference library doesn't use these, but you can
772     *              use it to hold the resource if you resolve it. (Reference to the
773     *              individual or organization to whom any payment will be made.)
774     */
775    public PayeeComponent setPartyTarget(Resource value) {
776      this.partyTarget = value;
777      return this;
778    }
779
780    protected void listChildren(List<Property> children) {
781      super.listChildren(children);
782      children.add(new Property("type", "CodeableConcept",
783          "Type of Party to be reimbursed: subscriber, provider, other.", 0, 1, type));
784      children.add(new Property("party", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)",
785          "Reference to the individual or organization to whom any payment will be made.", 0, 1, party));
786    }
787
788    @Override
789    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
790      switch (_hash) {
791      case 3575610:
792        /* type */ return new Property("type", "CodeableConcept",
793            "Type of Party to be reimbursed: subscriber, provider, other.", 0, 1, type);
794      case 106437350:
795        /* party */ return new Property("party",
796            "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)",
797            "Reference to the individual or organization to whom any payment will be made.", 0, 1, party);
798      default:
799        return super.getNamedProperty(_hash, _name, _checkValid);
800      }
801
802    }
803
804    @Override
805    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
806      switch (hash) {
807      case 3575610:
808        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
809      case 106437350:
810        /* party */ return this.party == null ? new Base[0] : new Base[] { this.party }; // Reference
811      default:
812        return super.getProperty(hash, name, checkValid);
813      }
814
815    }
816
817    @Override
818    public Base setProperty(int hash, String name, Base value) throws FHIRException {
819      switch (hash) {
820      case 3575610: // type
821        this.type = castToCodeableConcept(value); // CodeableConcept
822        return value;
823      case 106437350: // party
824        this.party = castToReference(value); // Reference
825        return value;
826      default:
827        return super.setProperty(hash, name, value);
828      }
829
830    }
831
832    @Override
833    public Base setProperty(String name, Base value) throws FHIRException {
834      if (name.equals("type")) {
835        this.type = castToCodeableConcept(value); // CodeableConcept
836      } else if (name.equals("party")) {
837        this.party = castToReference(value); // Reference
838      } else
839        return super.setProperty(name, value);
840      return value;
841    }
842
843    @Override
844    public Base makeProperty(int hash, String name) throws FHIRException {
845      switch (hash) {
846      case 3575610:
847        return getType();
848      case 106437350:
849        return getParty();
850      default:
851        return super.makeProperty(hash, name);
852      }
853
854    }
855
856    @Override
857    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
858      switch (hash) {
859      case 3575610:
860        /* type */ return new String[] { "CodeableConcept" };
861      case 106437350:
862        /* party */ return new String[] { "Reference" };
863      default:
864        return super.getTypesForProperty(hash, name);
865      }
866
867    }
868
869    @Override
870    public Base addChild(String name) throws FHIRException {
871      if (name.equals("type")) {
872        this.type = new CodeableConcept();
873        return this.type;
874      } else if (name.equals("party")) {
875        this.party = new Reference();
876        return this.party;
877      } else
878        return super.addChild(name);
879    }
880
881    public PayeeComponent copy() {
882      PayeeComponent dst = new PayeeComponent();
883      copyValues(dst);
884      return dst;
885    }
886
887    public void copyValues(PayeeComponent dst) {
888      super.copyValues(dst);
889      dst.type = type == null ? null : type.copy();
890      dst.party = party == null ? null : party.copy();
891    }
892
893    @Override
894    public boolean equalsDeep(Base other_) {
895      if (!super.equalsDeep(other_))
896        return false;
897      if (!(other_ instanceof PayeeComponent))
898        return false;
899      PayeeComponent o = (PayeeComponent) other_;
900      return compareDeep(type, o.type, true) && compareDeep(party, o.party, true);
901    }
902
903    @Override
904    public boolean equalsShallow(Base other_) {
905      if (!super.equalsShallow(other_))
906        return false;
907      if (!(other_ instanceof PayeeComponent))
908        return false;
909      PayeeComponent o = (PayeeComponent) other_;
910      return true;
911    }
912
913    public boolean isEmpty() {
914      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party);
915    }
916
917    public String fhirType() {
918      return "Claim.payee";
919
920    }
921
922  }
923
924  @Block()
925  public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
926    /**
927     * A number to uniquely identify care team entries.
928     */
929    @Child(name = "sequence", type = {
930        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
931    @Description(shortDefinition = "Order of care team", formalDefinition = "A number to uniquely identify care team entries.")
932    protected PositiveIntType sequence;
933
934    /**
935     * Member of the team who provided the product or service.
936     */
937    @Child(name = "provider", type = { Practitioner.class, PractitionerRole.class,
938        Organization.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
939    @Description(shortDefinition = "Practitioner or organization", formalDefinition = "Member of the team who provided the product or service.")
940    protected Reference provider;
941
942    /**
943     * The actual object that is the target of the reference (Member of the team who
944     * provided the product or service.)
945     */
946    protected Resource providerTarget;
947
948    /**
949     * The party who is billing and/or responsible for the claimed products or
950     * services.
951     */
952    @Child(name = "responsible", type = {
953        BooleanType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
954    @Description(shortDefinition = "Indicator of the lead practitioner", formalDefinition = "The party who is billing and/or responsible for the claimed products or services.")
955    protected BooleanType responsible;
956
957    /**
958     * The lead, assisting or supervising practitioner and their discipline if a
959     * multidisciplinary team.
960     */
961    @Child(name = "role", type = {
962        CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
963    @Description(shortDefinition = "Function within the team", formalDefinition = "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.")
964    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-careteamrole")
965    protected CodeableConcept role;
966
967    /**
968     * The qualification of the practitioner which is applicable for this service.
969     */
970    @Child(name = "qualification", type = {
971        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
972    @Description(shortDefinition = "Practitioner credential or specialization", formalDefinition = "The qualification of the practitioner which is applicable for this service.")
973    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/provider-qualification")
974    protected CodeableConcept qualification;
975
976    private static final long serialVersionUID = 1758966968L;
977
978    /**
979     * Constructor
980     */
981    public CareTeamComponent() {
982      super();
983    }
984
985    /**
986     * Constructor
987     */
988    public CareTeamComponent(PositiveIntType sequence, Reference provider) {
989      super();
990      this.sequence = sequence;
991      this.provider = provider;
992    }
993
994    /**
995     * @return {@link #sequence} (A number to uniquely identify care team entries.).
996     *         This is the underlying object with id, value and extensions. The
997     *         accessor "getSequence" gives direct access to the value
998     */
999    public PositiveIntType getSequenceElement() {
1000      if (this.sequence == null)
1001        if (Configuration.errorOnAutoCreate())
1002          throw new Error("Attempt to auto-create CareTeamComponent.sequence");
1003        else if (Configuration.doAutoCreate())
1004          this.sequence = new PositiveIntType(); // bb
1005      return this.sequence;
1006    }
1007
1008    public boolean hasSequenceElement() {
1009      return this.sequence != null && !this.sequence.isEmpty();
1010    }
1011
1012    public boolean hasSequence() {
1013      return this.sequence != null && !this.sequence.isEmpty();
1014    }
1015
1016    /**
1017     * @param value {@link #sequence} (A number to uniquely identify care team
1018     *              entries.). This is the underlying object with id, value and
1019     *              extensions. The accessor "getSequence" gives direct access to
1020     *              the value
1021     */
1022    public CareTeamComponent setSequenceElement(PositiveIntType value) {
1023      this.sequence = value;
1024      return this;
1025    }
1026
1027    /**
1028     * @return A number to uniquely identify care team entries.
1029     */
1030    public int getSequence() {
1031      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1032    }
1033
1034    /**
1035     * @param value A number to uniquely identify care team entries.
1036     */
1037    public CareTeamComponent setSequence(int value) {
1038      if (this.sequence == null)
1039        this.sequence = new PositiveIntType();
1040      this.sequence.setValue(value);
1041      return this;
1042    }
1043
1044    /**
1045     * @return {@link #provider} (Member of the team who provided the product or
1046     *         service.)
1047     */
1048    public Reference getProvider() {
1049      if (this.provider == null)
1050        if (Configuration.errorOnAutoCreate())
1051          throw new Error("Attempt to auto-create CareTeamComponent.provider");
1052        else if (Configuration.doAutoCreate())
1053          this.provider = new Reference(); // cc
1054      return this.provider;
1055    }
1056
1057    public boolean hasProvider() {
1058      return this.provider != null && !this.provider.isEmpty();
1059    }
1060
1061    /**
1062     * @param value {@link #provider} (Member of the team who provided the product
1063     *              or service.)
1064     */
1065    public CareTeamComponent setProvider(Reference value) {
1066      this.provider = value;
1067      return this;
1068    }
1069
1070    /**
1071     * @return {@link #provider} The actual object that is the target of the
1072     *         reference. The reference library doesn't populate this, but you can
1073     *         use it to hold the resource if you resolve it. (Member of the team
1074     *         who provided the product or service.)
1075     */
1076    public Resource getProviderTarget() {
1077      return this.providerTarget;
1078    }
1079
1080    /**
1081     * @param value {@link #provider} The actual object that is the target of the
1082     *              reference. The reference library doesn't use these, but you can
1083     *              use it to hold the resource if you resolve it. (Member of the
1084     *              team who provided the product or service.)
1085     */
1086    public CareTeamComponent setProviderTarget(Resource value) {
1087      this.providerTarget = value;
1088      return this;
1089    }
1090
1091    /**
1092     * @return {@link #responsible} (The party who is billing and/or responsible for
1093     *         the claimed products or services.). This is the underlying object
1094     *         with id, value and extensions. The accessor "getResponsible" gives
1095     *         direct access to the value
1096     */
1097    public BooleanType getResponsibleElement() {
1098      if (this.responsible == null)
1099        if (Configuration.errorOnAutoCreate())
1100          throw new Error("Attempt to auto-create CareTeamComponent.responsible");
1101        else if (Configuration.doAutoCreate())
1102          this.responsible = new BooleanType(); // bb
1103      return this.responsible;
1104    }
1105
1106    public boolean hasResponsibleElement() {
1107      return this.responsible != null && !this.responsible.isEmpty();
1108    }
1109
1110    public boolean hasResponsible() {
1111      return this.responsible != null && !this.responsible.isEmpty();
1112    }
1113
1114    /**
1115     * @param value {@link #responsible} (The party who is billing and/or
1116     *              responsible for the claimed products or services.). This is the
1117     *              underlying object with id, value and extensions. The accessor
1118     *              "getResponsible" gives direct access to the value
1119     */
1120    public CareTeamComponent setResponsibleElement(BooleanType value) {
1121      this.responsible = value;
1122      return this;
1123    }
1124
1125    /**
1126     * @return The party who is billing and/or responsible for the claimed products
1127     *         or services.
1128     */
1129    public boolean getResponsible() {
1130      return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
1131    }
1132
1133    /**
1134     * @param value The party who is billing and/or responsible for the claimed
1135     *              products or services.
1136     */
1137    public CareTeamComponent setResponsible(boolean value) {
1138      if (this.responsible == null)
1139        this.responsible = new BooleanType();
1140      this.responsible.setValue(value);
1141      return this;
1142    }
1143
1144    /**
1145     * @return {@link #role} (The lead, assisting or supervising practitioner and
1146     *         their discipline if a multidisciplinary team.)
1147     */
1148    public CodeableConcept getRole() {
1149      if (this.role == null)
1150        if (Configuration.errorOnAutoCreate())
1151          throw new Error("Attempt to auto-create CareTeamComponent.role");
1152        else if (Configuration.doAutoCreate())
1153          this.role = new CodeableConcept(); // cc
1154      return this.role;
1155    }
1156
1157    public boolean hasRole() {
1158      return this.role != null && !this.role.isEmpty();
1159    }
1160
1161    /**
1162     * @param value {@link #role} (The lead, assisting or supervising practitioner
1163     *              and their discipline if a multidisciplinary team.)
1164     */
1165    public CareTeamComponent setRole(CodeableConcept value) {
1166      this.role = value;
1167      return this;
1168    }
1169
1170    /**
1171     * @return {@link #qualification} (The qualification of the practitioner which
1172     *         is applicable for this service.)
1173     */
1174    public CodeableConcept getQualification() {
1175      if (this.qualification == null)
1176        if (Configuration.errorOnAutoCreate())
1177          throw new Error("Attempt to auto-create CareTeamComponent.qualification");
1178        else if (Configuration.doAutoCreate())
1179          this.qualification = new CodeableConcept(); // cc
1180      return this.qualification;
1181    }
1182
1183    public boolean hasQualification() {
1184      return this.qualification != null && !this.qualification.isEmpty();
1185    }
1186
1187    /**
1188     * @param value {@link #qualification} (The qualification of the practitioner
1189     *              which is applicable for this service.)
1190     */
1191    public CareTeamComponent setQualification(CodeableConcept value) {
1192      this.qualification = value;
1193      return this;
1194    }
1195
1196    protected void listChildren(List<Property> children) {
1197      super.listChildren(children);
1198      children.add(
1199          new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence));
1200      children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
1201          "Member of the team who provided the product or service.", 0, 1, provider));
1202      children.add(new Property("responsible", "boolean",
1203          "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible));
1204      children.add(new Property("role", "CodeableConcept",
1205          "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1,
1206          role));
1207      children.add(new Property("qualification", "CodeableConcept",
1208          "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification));
1209    }
1210
1211    @Override
1212    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1213      switch (_hash) {
1214      case 1349547969:
1215        /* sequence */ return new Property("sequence", "positiveInt",
1216            "A number to uniquely identify care team entries.", 0, 1, sequence);
1217      case -987494927:
1218        /* provider */ return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
1219            "Member of the team who provided the product or service.", 0, 1, provider);
1220      case 1847674614:
1221        /* responsible */ return new Property("responsible", "boolean",
1222            "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible);
1223      case 3506294:
1224        /* role */ return new Property("role", "CodeableConcept",
1225            "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1,
1226            role);
1227      case -631333393:
1228        /* qualification */ return new Property("qualification", "CodeableConcept",
1229            "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification);
1230      default:
1231        return super.getNamedProperty(_hash, _name, _checkValid);
1232      }
1233
1234    }
1235
1236    @Override
1237    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1238      switch (hash) {
1239      case 1349547969:
1240        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
1241      case -987494927:
1242        /* provider */ return this.provider == null ? new Base[0] : new Base[] { this.provider }; // Reference
1243      case 1847674614:
1244        /* responsible */ return this.responsible == null ? new Base[0] : new Base[] { this.responsible }; // BooleanType
1245      case 3506294:
1246        /* role */ return this.role == null ? new Base[0] : new Base[] { this.role }; // CodeableConcept
1247      case -631333393:
1248        /* qualification */ return this.qualification == null ? new Base[0] : new Base[] { this.qualification }; // CodeableConcept
1249      default:
1250        return super.getProperty(hash, name, checkValid);
1251      }
1252
1253    }
1254
1255    @Override
1256    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1257      switch (hash) {
1258      case 1349547969: // sequence
1259        this.sequence = castToPositiveInt(value); // PositiveIntType
1260        return value;
1261      case -987494927: // provider
1262        this.provider = castToReference(value); // Reference
1263        return value;
1264      case 1847674614: // responsible
1265        this.responsible = castToBoolean(value); // BooleanType
1266        return value;
1267      case 3506294: // role
1268        this.role = castToCodeableConcept(value); // CodeableConcept
1269        return value;
1270      case -631333393: // qualification
1271        this.qualification = castToCodeableConcept(value); // CodeableConcept
1272        return value;
1273      default:
1274        return super.setProperty(hash, name, value);
1275      }
1276
1277    }
1278
1279    @Override
1280    public Base setProperty(String name, Base value) throws FHIRException {
1281      if (name.equals("sequence")) {
1282        this.sequence = castToPositiveInt(value); // PositiveIntType
1283      } else if (name.equals("provider")) {
1284        this.provider = castToReference(value); // Reference
1285      } else if (name.equals("responsible")) {
1286        this.responsible = castToBoolean(value); // BooleanType
1287      } else if (name.equals("role")) {
1288        this.role = castToCodeableConcept(value); // CodeableConcept
1289      } else if (name.equals("qualification")) {
1290        this.qualification = castToCodeableConcept(value); // CodeableConcept
1291      } else
1292        return super.setProperty(name, value);
1293      return value;
1294    }
1295
1296    @Override
1297    public Base makeProperty(int hash, String name) throws FHIRException {
1298      switch (hash) {
1299      case 1349547969:
1300        return getSequenceElement();
1301      case -987494927:
1302        return getProvider();
1303      case 1847674614:
1304        return getResponsibleElement();
1305      case 3506294:
1306        return getRole();
1307      case -631333393:
1308        return getQualification();
1309      default:
1310        return super.makeProperty(hash, name);
1311      }
1312
1313    }
1314
1315    @Override
1316    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1317      switch (hash) {
1318      case 1349547969:
1319        /* sequence */ return new String[] { "positiveInt" };
1320      case -987494927:
1321        /* provider */ return new String[] { "Reference" };
1322      case 1847674614:
1323        /* responsible */ return new String[] { "boolean" };
1324      case 3506294:
1325        /* role */ return new String[] { "CodeableConcept" };
1326      case -631333393:
1327        /* qualification */ return new String[] { "CodeableConcept" };
1328      default:
1329        return super.getTypesForProperty(hash, name);
1330      }
1331
1332    }
1333
1334    @Override
1335    public Base addChild(String name) throws FHIRException {
1336      if (name.equals("sequence")) {
1337        throw new FHIRException("Cannot call addChild on a singleton property Claim.sequence");
1338      } else if (name.equals("provider")) {
1339        this.provider = new Reference();
1340        return this.provider;
1341      } else if (name.equals("responsible")) {
1342        throw new FHIRException("Cannot call addChild on a singleton property Claim.responsible");
1343      } else if (name.equals("role")) {
1344        this.role = new CodeableConcept();
1345        return this.role;
1346      } else if (name.equals("qualification")) {
1347        this.qualification = new CodeableConcept();
1348        return this.qualification;
1349      } else
1350        return super.addChild(name);
1351    }
1352
1353    public CareTeamComponent copy() {
1354      CareTeamComponent dst = new CareTeamComponent();
1355      copyValues(dst);
1356      return dst;
1357    }
1358
1359    public void copyValues(CareTeamComponent dst) {
1360      super.copyValues(dst);
1361      dst.sequence = sequence == null ? null : sequence.copy();
1362      dst.provider = provider == null ? null : provider.copy();
1363      dst.responsible = responsible == null ? null : responsible.copy();
1364      dst.role = role == null ? null : role.copy();
1365      dst.qualification = qualification == null ? null : qualification.copy();
1366    }
1367
1368    @Override
1369    public boolean equalsDeep(Base other_) {
1370      if (!super.equalsDeep(other_))
1371        return false;
1372      if (!(other_ instanceof CareTeamComponent))
1373        return false;
1374      CareTeamComponent o = (CareTeamComponent) other_;
1375      return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true)
1376          && compareDeep(responsible, o.responsible, true) && compareDeep(role, o.role, true)
1377          && compareDeep(qualification, o.qualification, true);
1378    }
1379
1380    @Override
1381    public boolean equalsShallow(Base other_) {
1382      if (!super.equalsShallow(other_))
1383        return false;
1384      if (!(other_ instanceof CareTeamComponent))
1385        return false;
1386      CareTeamComponent o = (CareTeamComponent) other_;
1387      return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true);
1388    }
1389
1390    public boolean isEmpty() {
1391      return super.isEmpty()
1392          && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible, role, qualification);
1393    }
1394
1395    public String fhirType() {
1396      return "Claim.careTeam";
1397
1398    }
1399
1400  }
1401
1402  @Block()
1403  public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
1404    /**
1405     * A number to uniquely identify supporting information entries.
1406     */
1407    @Child(name = "sequence", type = {
1408        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
1409    @Description(shortDefinition = "Information instance identifier", formalDefinition = "A number to uniquely identify supporting information entries.")
1410    protected PositiveIntType sequence;
1411
1412    /**
1413     * The general class of the information supplied: information; exception;
1414     * accident, employment; onset, etc.
1415     */
1416    @Child(name = "category", type = {
1417        CodeableConcept.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
1418    @Description(shortDefinition = "Classification of the supplied information", formalDefinition = "The general class of the information supplied: information; exception; accident, employment; onset, etc.")
1419    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-informationcategory")
1420    protected CodeableConcept category;
1421
1422    /**
1423     * System and code pertaining to the specific information regarding special
1424     * conditions relating to the setting, treatment or patient for which care is
1425     * sought.
1426     */
1427    @Child(name = "code", type = {
1428        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
1429    @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.")
1430    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-exception")
1431    protected CodeableConcept code;
1432
1433    /**
1434     * The date when or period to which this information refers.
1435     */
1436    @Child(name = "timing", type = { DateType.class,
1437        Period.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
1438    @Description(shortDefinition = "When it occurred", formalDefinition = "The date when or period to which this information refers.")
1439    protected Type timing;
1440
1441    /**
1442     * Additional data or information such as resources, documents, images etc.
1443     * including references to the data or the actual inclusion of the data.
1444     */
1445    @Child(name = "value", type = { BooleanType.class, StringType.class, Quantity.class, Attachment.class,
1446        Reference.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
1447    @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.")
1448    protected Type value;
1449
1450    /**
1451     * Provides the reason in the situation where a reason code is required in
1452     * addition to the content.
1453     */
1454    @Child(name = "reason", type = {
1455        CodeableConcept.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
1456    @Description(shortDefinition = "Explanation for the information", formalDefinition = "Provides the reason in the situation where a reason code is required in addition to the content.")
1457    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/missing-tooth-reason")
1458    protected CodeableConcept reason;
1459
1460    private static final long serialVersionUID = -518630232L;
1461
1462    /**
1463     * Constructor
1464     */
1465    public SupportingInformationComponent() {
1466      super();
1467    }
1468
1469    /**
1470     * Constructor
1471     */
1472    public SupportingInformationComponent(PositiveIntType sequence, CodeableConcept category) {
1473      super();
1474      this.sequence = sequence;
1475      this.category = category;
1476    }
1477
1478    /**
1479     * @return {@link #sequence} (A number to uniquely identify supporting
1480     *         information entries.). This is the underlying object with id, value
1481     *         and extensions. The accessor "getSequence" gives direct access to the
1482     *         value
1483     */
1484    public PositiveIntType getSequenceElement() {
1485      if (this.sequence == null)
1486        if (Configuration.errorOnAutoCreate())
1487          throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
1488        else if (Configuration.doAutoCreate())
1489          this.sequence = new PositiveIntType(); // bb
1490      return this.sequence;
1491    }
1492
1493    public boolean hasSequenceElement() {
1494      return this.sequence != null && !this.sequence.isEmpty();
1495    }
1496
1497    public boolean hasSequence() {
1498      return this.sequence != null && !this.sequence.isEmpty();
1499    }
1500
1501    /**
1502     * @param value {@link #sequence} (A number to uniquely identify supporting
1503     *              information entries.). This is the underlying object with id,
1504     *              value and extensions. The accessor "getSequence" gives direct
1505     *              access to the value
1506     */
1507    public SupportingInformationComponent setSequenceElement(PositiveIntType value) {
1508      this.sequence = value;
1509      return this;
1510    }
1511
1512    /**
1513     * @return A number to uniquely identify supporting information entries.
1514     */
1515    public int getSequence() {
1516      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1517    }
1518
1519    /**
1520     * @param value A number to uniquely identify supporting information entries.
1521     */
1522    public SupportingInformationComponent setSequence(int value) {
1523      if (this.sequence == null)
1524        this.sequence = new PositiveIntType();
1525      this.sequence.setValue(value);
1526      return this;
1527    }
1528
1529    /**
1530     * @return {@link #category} (The general class of the information supplied:
1531     *         information; exception; accident, employment; onset, etc.)
1532     */
1533    public CodeableConcept getCategory() {
1534      if (this.category == null)
1535        if (Configuration.errorOnAutoCreate())
1536          throw new Error("Attempt to auto-create SupportingInformationComponent.category");
1537        else if (Configuration.doAutoCreate())
1538          this.category = new CodeableConcept(); // cc
1539      return this.category;
1540    }
1541
1542    public boolean hasCategory() {
1543      return this.category != null && !this.category.isEmpty();
1544    }
1545
1546    /**
1547     * @param value {@link #category} (The general class of the information
1548     *              supplied: information; exception; accident, employment; onset,
1549     *              etc.)
1550     */
1551    public SupportingInformationComponent setCategory(CodeableConcept value) {
1552      this.category = value;
1553      return this;
1554    }
1555
1556    /**
1557     * @return {@link #code} (System and code pertaining to the specific information
1558     *         regarding special conditions relating to the setting, treatment or
1559     *         patient for which care is sought.)
1560     */
1561    public CodeableConcept getCode() {
1562      if (this.code == null)
1563        if (Configuration.errorOnAutoCreate())
1564          throw new Error("Attempt to auto-create SupportingInformationComponent.code");
1565        else if (Configuration.doAutoCreate())
1566          this.code = new CodeableConcept(); // cc
1567      return this.code;
1568    }
1569
1570    public boolean hasCode() {
1571      return this.code != null && !this.code.isEmpty();
1572    }
1573
1574    /**
1575     * @param value {@link #code} (System and code pertaining to the specific
1576     *              information regarding special conditions relating to the
1577     *              setting, treatment or patient for which care is sought.)
1578     */
1579    public SupportingInformationComponent setCode(CodeableConcept value) {
1580      this.code = value;
1581      return this;
1582    }
1583
1584    /**
1585     * @return {@link #timing} (The date when or period to which this information
1586     *         refers.)
1587     */
1588    public Type getTiming() {
1589      return this.timing;
1590    }
1591
1592    /**
1593     * @return {@link #timing} (The date when or period to which this information
1594     *         refers.)
1595     */
1596    public DateType getTimingDateType() throws FHIRException {
1597      if (this.timing == null)
1598        this.timing = new DateType();
1599      if (!(this.timing instanceof DateType))
1600        throw new FHIRException("Type mismatch: the type DateType was expected, but " + this.timing.getClass().getName()
1601            + " was encountered");
1602      return (DateType) this.timing;
1603    }
1604
1605    public boolean hasTimingDateType() {
1606      return this != null && this.timing instanceof DateType;
1607    }
1608
1609    /**
1610     * @return {@link #timing} (The date when or period to which this information
1611     *         refers.)
1612     */
1613    public Period getTimingPeriod() throws FHIRException {
1614      if (this.timing == null)
1615        this.timing = new Period();
1616      if (!(this.timing instanceof Period))
1617        throw new FHIRException("Type mismatch: the type Period was expected, but " + this.timing.getClass().getName()
1618            + " was encountered");
1619      return (Period) this.timing;
1620    }
1621
1622    public boolean hasTimingPeriod() {
1623      return this != null && this.timing instanceof Period;
1624    }
1625
1626    public boolean hasTiming() {
1627      return this.timing != null && !this.timing.isEmpty();
1628    }
1629
1630    /**
1631     * @param value {@link #timing} (The date when or period to which this
1632     *              information refers.)
1633     */
1634    public SupportingInformationComponent setTiming(Type value) {
1635      if (value != null && !(value instanceof DateType || value instanceof Period))
1636        throw new Error("Not the right type for Claim.supportingInfo.timing[x]: " + value.fhirType());
1637      this.timing = value;
1638      return this;
1639    }
1640
1641    /**
1642     * @return {@link #value} (Additional data or information such as resources,
1643     *         documents, images etc. including references to the data or the actual
1644     *         inclusion of the data.)
1645     */
1646    public Type getValue() {
1647      return this.value;
1648    }
1649
1650    /**
1651     * @return {@link #value} (Additional data or information such as resources,
1652     *         documents, images etc. including references to the data or the actual
1653     *         inclusion of the data.)
1654     */
1655    public BooleanType getValueBooleanType() throws FHIRException {
1656      if (this.value == null)
1657        this.value = new BooleanType();
1658      if (!(this.value instanceof BooleanType))
1659        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "
1660            + this.value.getClass().getName() + " was encountered");
1661      return (BooleanType) this.value;
1662    }
1663
1664    public boolean hasValueBooleanType() {
1665      return this != null && this.value instanceof BooleanType;
1666    }
1667
1668    /**
1669     * @return {@link #value} (Additional data or information such as resources,
1670     *         documents, images etc. including references to the data or the actual
1671     *         inclusion of the data.)
1672     */
1673    public StringType getValueStringType() throws FHIRException {
1674      if (this.value == null)
1675        this.value = new StringType();
1676      if (!(this.value instanceof StringType))
1677        throw new FHIRException("Type mismatch: the type StringType was expected, but "
1678            + this.value.getClass().getName() + " was encountered");
1679      return (StringType) this.value;
1680    }
1681
1682    public boolean hasValueStringType() {
1683      return this != null && this.value instanceof StringType;
1684    }
1685
1686    /**
1687     * @return {@link #value} (Additional data or information such as resources,
1688     *         documents, images etc. including references to the data or the actual
1689     *         inclusion of the data.)
1690     */
1691    public Quantity getValueQuantity() throws FHIRException {
1692      if (this.value == null)
1693        this.value = new Quantity();
1694      if (!(this.value instanceof Quantity))
1695        throw new FHIRException("Type mismatch: the type Quantity was expected, but " + this.value.getClass().getName()
1696            + " was encountered");
1697      return (Quantity) this.value;
1698    }
1699
1700    public boolean hasValueQuantity() {
1701      return this != null && this.value instanceof Quantity;
1702    }
1703
1704    /**
1705     * @return {@link #value} (Additional data or information such as resources,
1706     *         documents, images etc. including references to the data or the actual
1707     *         inclusion of the data.)
1708     */
1709    public Attachment getValueAttachment() throws FHIRException {
1710      if (this.value == null)
1711        this.value = new Attachment();
1712      if (!(this.value instanceof Attachment))
1713        throw new FHIRException("Type mismatch: the type Attachment was expected, but "
1714            + this.value.getClass().getName() + " was encountered");
1715      return (Attachment) this.value;
1716    }
1717
1718    public boolean hasValueAttachment() {
1719      return this != null && this.value instanceof Attachment;
1720    }
1721
1722    /**
1723     * @return {@link #value} (Additional data or information such as resources,
1724     *         documents, images etc. including references to the data or the actual
1725     *         inclusion of the data.)
1726     */
1727    public Reference getValueReference() throws FHIRException {
1728      if (this.value == null)
1729        this.value = new Reference();
1730      if (!(this.value instanceof Reference))
1731        throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.value.getClass().getName()
1732            + " was encountered");
1733      return (Reference) this.value;
1734    }
1735
1736    public boolean hasValueReference() {
1737      return this != null && this.value instanceof Reference;
1738    }
1739
1740    public boolean hasValue() {
1741      return this.value != null && !this.value.isEmpty();
1742    }
1743
1744    /**
1745     * @param value {@link #value} (Additional data or information such as
1746     *              resources, documents, images etc. including references to the
1747     *              data or the actual inclusion of the data.)
1748     */
1749    public SupportingInformationComponent setValue(Type value) {
1750      if (value != null && !(value instanceof BooleanType || value instanceof StringType || value instanceof Quantity
1751          || value instanceof Attachment || value instanceof Reference))
1752        throw new Error("Not the right type for Claim.supportingInfo.value[x]: " + value.fhirType());
1753      this.value = value;
1754      return this;
1755    }
1756
1757    /**
1758     * @return {@link #reason} (Provides the reason in the situation where a reason
1759     *         code is required in addition to the content.)
1760     */
1761    public CodeableConcept getReason() {
1762      if (this.reason == null)
1763        if (Configuration.errorOnAutoCreate())
1764          throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1765        else if (Configuration.doAutoCreate())
1766          this.reason = new CodeableConcept(); // cc
1767      return this.reason;
1768    }
1769
1770    public boolean hasReason() {
1771      return this.reason != null && !this.reason.isEmpty();
1772    }
1773
1774    /**
1775     * @param value {@link #reason} (Provides the reason in the situation where a
1776     *              reason code is required in addition to the content.)
1777     */
1778    public SupportingInformationComponent setReason(CodeableConcept value) {
1779      this.reason = value;
1780      return this;
1781    }
1782
1783    protected void listChildren(List<Property> children) {
1784      super.listChildren(children);
1785      children.add(new Property("sequence", "positiveInt",
1786          "A number to uniquely identify supporting information entries.", 0, 1, sequence));
1787      children.add(new Property("category", "CodeableConcept",
1788          "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0,
1789          1, category));
1790      children.add(new Property("code", "CodeableConcept",
1791          "System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.",
1792          0, 1, code));
1793      children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.",
1794          0, 1, timing));
1795      children.add(new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1796          "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1797          0, 1, value));
1798      children.add(new Property("reason", "CodeableConcept",
1799          "Provides the reason in the situation where a reason code is required in addition to the content.", 0, 1,
1800          reason));
1801    }
1802
1803    @Override
1804    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1805      switch (_hash) {
1806      case 1349547969:
1807        /* sequence */ return new Property("sequence", "positiveInt",
1808            "A number to uniquely identify supporting information entries.", 0, 1, sequence);
1809      case 50511102:
1810        /* category */ return new Property("category", "CodeableConcept",
1811            "The general class of the information supplied: information; exception; accident, employment; onset, etc.",
1812            0, 1, category);
1813      case 3059181:
1814        /* code */ return new Property("code", "CodeableConcept",
1815            "System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.",
1816            0, 1, code);
1817      case 164632566:
1818        /* timing[x] */ return new Property("timing[x]", "date|Period",
1819            "The date when or period to which this information refers.", 0, 1, timing);
1820      case -873664438:
1821        /* timing */ return new Property("timing[x]", "date|Period",
1822            "The date when or period to which this information refers.", 0, 1, timing);
1823      case 807935768:
1824        /* timingDate */ return new Property("timing[x]", "date|Period",
1825            "The date when or period to which this information refers.", 0, 1, timing);
1826      case -615615829:
1827        /* timingPeriod */ return new Property("timing[x]", "date|Period",
1828            "The date when or period to which this information refers.", 0, 1, timing);
1829      case -1410166417:
1830        /* value[x] */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1831            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1832            0, 1, value);
1833      case 111972721:
1834        /* value */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1835            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1836            0, 1, value);
1837      case 733421943:
1838        /* valueBoolean */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1839            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1840            0, 1, value);
1841      case -1424603934:
1842        /* valueString */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1843            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1844            0, 1, value);
1845      case -2029823716:
1846        /* valueQuantity */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1847            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1848            0, 1, value);
1849      case -475566732:
1850        /* valueAttachment */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1851            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1852            0, 1, value);
1853      case 1755241690:
1854        /* valueReference */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1855            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1856            0, 1, value);
1857      case -934964668:
1858        /* reason */ return new Property("reason", "CodeableConcept",
1859            "Provides the reason in the situation where a reason code is required in addition to the content.", 0, 1,
1860            reason);
1861      default:
1862        return super.getNamedProperty(_hash, _name, _checkValid);
1863      }
1864
1865    }
1866
1867    @Override
1868    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1869      switch (hash) {
1870      case 1349547969:
1871        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
1872      case 50511102:
1873        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
1874      case 3059181:
1875        /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
1876      case -873664438:
1877        /* timing */ return this.timing == null ? new Base[0] : new Base[] { this.timing }; // Type
1878      case 111972721:
1879        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // Type
1880      case -934964668:
1881        /* reason */ return this.reason == null ? new Base[0] : new Base[] { this.reason }; // CodeableConcept
1882      default:
1883        return super.getProperty(hash, name, checkValid);
1884      }
1885
1886    }
1887
1888    @Override
1889    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1890      switch (hash) {
1891      case 1349547969: // sequence
1892        this.sequence = castToPositiveInt(value); // PositiveIntType
1893        return value;
1894      case 50511102: // category
1895        this.category = castToCodeableConcept(value); // CodeableConcept
1896        return value;
1897      case 3059181: // code
1898        this.code = castToCodeableConcept(value); // CodeableConcept
1899        return value;
1900      case -873664438: // timing
1901        this.timing = castToType(value); // Type
1902        return value;
1903      case 111972721: // value
1904        this.value = castToType(value); // Type
1905        return value;
1906      case -934964668: // reason
1907        this.reason = castToCodeableConcept(value); // CodeableConcept
1908        return value;
1909      default:
1910        return super.setProperty(hash, name, value);
1911      }
1912
1913    }
1914
1915    @Override
1916    public Base setProperty(String name, Base value) throws FHIRException {
1917      if (name.equals("sequence")) {
1918        this.sequence = castToPositiveInt(value); // PositiveIntType
1919      } else if (name.equals("category")) {
1920        this.category = castToCodeableConcept(value); // CodeableConcept
1921      } else if (name.equals("code")) {
1922        this.code = castToCodeableConcept(value); // CodeableConcept
1923      } else if (name.equals("timing[x]")) {
1924        this.timing = castToType(value); // Type
1925      } else if (name.equals("value[x]")) {
1926        this.value = castToType(value); // Type
1927      } else if (name.equals("reason")) {
1928        this.reason = castToCodeableConcept(value); // CodeableConcept
1929      } else
1930        return super.setProperty(name, value);
1931      return value;
1932    }
1933
1934    @Override
1935    public Base makeProperty(int hash, String name) throws FHIRException {
1936      switch (hash) {
1937      case 1349547969:
1938        return getSequenceElement();
1939      case 50511102:
1940        return getCategory();
1941      case 3059181:
1942        return getCode();
1943      case 164632566:
1944        return getTiming();
1945      case -873664438:
1946        return getTiming();
1947      case -1410166417:
1948        return getValue();
1949      case 111972721:
1950        return getValue();
1951      case -934964668:
1952        return getReason();
1953      default:
1954        return super.makeProperty(hash, name);
1955      }
1956
1957    }
1958
1959    @Override
1960    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1961      switch (hash) {
1962      case 1349547969:
1963        /* sequence */ return new String[] { "positiveInt" };
1964      case 50511102:
1965        /* category */ return new String[] { "CodeableConcept" };
1966      case 3059181:
1967        /* code */ return new String[] { "CodeableConcept" };
1968      case -873664438:
1969        /* timing */ return new String[] { "date", "Period" };
1970      case 111972721:
1971        /* value */ return new String[] { "boolean", "string", "Quantity", "Attachment", "Reference" };
1972      case -934964668:
1973        /* reason */ return new String[] { "CodeableConcept" };
1974      default:
1975        return super.getTypesForProperty(hash, name);
1976      }
1977
1978    }
1979
1980    @Override
1981    public Base addChild(String name) throws FHIRException {
1982      if (name.equals("sequence")) {
1983        throw new FHIRException("Cannot call addChild on a singleton property Claim.sequence");
1984      } else if (name.equals("category")) {
1985        this.category = new CodeableConcept();
1986        return this.category;
1987      } else if (name.equals("code")) {
1988        this.code = new CodeableConcept();
1989        return this.code;
1990      } else if (name.equals("timingDate")) {
1991        this.timing = new DateType();
1992        return this.timing;
1993      } else if (name.equals("timingPeriod")) {
1994        this.timing = new Period();
1995        return this.timing;
1996      } else if (name.equals("valueBoolean")) {
1997        this.value = new BooleanType();
1998        return this.value;
1999      } else if (name.equals("valueString")) {
2000        this.value = new StringType();
2001        return this.value;
2002      } else if (name.equals("valueQuantity")) {
2003        this.value = new Quantity();
2004        return this.value;
2005      } else if (name.equals("valueAttachment")) {
2006        this.value = new Attachment();
2007        return this.value;
2008      } else if (name.equals("valueReference")) {
2009        this.value = new Reference();
2010        return this.value;
2011      } else if (name.equals("reason")) {
2012        this.reason = new CodeableConcept();
2013        return this.reason;
2014      } else
2015        return super.addChild(name);
2016    }
2017
2018    public SupportingInformationComponent copy() {
2019      SupportingInformationComponent dst = new SupportingInformationComponent();
2020      copyValues(dst);
2021      return dst;
2022    }
2023
2024    public void copyValues(SupportingInformationComponent dst) {
2025      super.copyValues(dst);
2026      dst.sequence = sequence == null ? null : sequence.copy();
2027      dst.category = category == null ? null : category.copy();
2028      dst.code = code == null ? null : code.copy();
2029      dst.timing = timing == null ? null : timing.copy();
2030      dst.value = value == null ? null : value.copy();
2031      dst.reason = reason == null ? null : reason.copy();
2032    }
2033
2034    @Override
2035    public boolean equalsDeep(Base other_) {
2036      if (!super.equalsDeep(other_))
2037        return false;
2038      if (!(other_ instanceof SupportingInformationComponent))
2039        return false;
2040      SupportingInformationComponent o = (SupportingInformationComponent) other_;
2041      return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true)
2042          && compareDeep(code, o.code, true) && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true)
2043          && compareDeep(reason, o.reason, true);
2044    }
2045
2046    @Override
2047    public boolean equalsShallow(Base other_) {
2048      if (!super.equalsShallow(other_))
2049        return false;
2050      if (!(other_ instanceof SupportingInformationComponent))
2051        return false;
2052      SupportingInformationComponent o = (SupportingInformationComponent) other_;
2053      return compareValues(sequence, o.sequence, true);
2054    }
2055
2056    public boolean isEmpty() {
2057      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code, timing, value, reason);
2058    }
2059
2060    public String fhirType() {
2061      return "Claim.supportingInfo";
2062
2063    }
2064
2065  }
2066
2067  @Block()
2068  public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
2069    /**
2070     * A number to uniquely identify diagnosis entries.
2071     */
2072    @Child(name = "sequence", type = {
2073        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
2074    @Description(shortDefinition = "Diagnosis instance identifier", formalDefinition = "A number to uniquely identify diagnosis entries.")
2075    protected PositiveIntType sequence;
2076
2077    /**
2078     * The nature of illness or problem in a coded form or as a reference to an
2079     * external defined Condition.
2080     */
2081    @Child(name = "diagnosis", type = { CodeableConcept.class,
2082        Condition.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
2083    @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.")
2084    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/icd-10")
2085    protected Type diagnosis;
2086
2087    /**
2088     * When the condition was observed or the relative ranking.
2089     */
2090    @Child(name = "type", type = {
2091        CodeableConcept.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2092    @Description(shortDefinition = "Timing or nature of the diagnosis", formalDefinition = "When the condition was observed or the relative ranking.")
2093    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-diagnosistype")
2094    protected List<CodeableConcept> type;
2095
2096    /**
2097     * Indication of whether the diagnosis was present on admission to a facility.
2098     */
2099    @Child(name = "onAdmission", type = {
2100        CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
2101    @Description(shortDefinition = "Present on admission", formalDefinition = "Indication of whether the diagnosis was present on admission to a facility.")
2102    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-diagnosis-on-admission")
2103    protected CodeableConcept onAdmission;
2104
2105    /**
2106     * A package billing code or bundle code used to group products and services to
2107     * a particular health condition (such as heart attack) which is based on a
2108     * predetermined grouping code system.
2109     */
2110    @Child(name = "packageCode", type = {
2111        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
2112    @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.")
2113    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
2114    protected CodeableConcept packageCode;
2115
2116    private static final long serialVersionUID = 2120593974L;
2117
2118    /**
2119     * Constructor
2120     */
2121    public DiagnosisComponent() {
2122      super();
2123    }
2124
2125    /**
2126     * Constructor
2127     */
2128    public DiagnosisComponent(PositiveIntType sequence, Type diagnosis) {
2129      super();
2130      this.sequence = sequence;
2131      this.diagnosis = diagnosis;
2132    }
2133
2134    /**
2135     * @return {@link #sequence} (A number to uniquely identify diagnosis entries.).
2136     *         This is the underlying object with id, value and extensions. The
2137     *         accessor "getSequence" gives direct access to the value
2138     */
2139    public PositiveIntType getSequenceElement() {
2140      if (this.sequence == null)
2141        if (Configuration.errorOnAutoCreate())
2142          throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
2143        else if (Configuration.doAutoCreate())
2144          this.sequence = new PositiveIntType(); // bb
2145      return this.sequence;
2146    }
2147
2148    public boolean hasSequenceElement() {
2149      return this.sequence != null && !this.sequence.isEmpty();
2150    }
2151
2152    public boolean hasSequence() {
2153      return this.sequence != null && !this.sequence.isEmpty();
2154    }
2155
2156    /**
2157     * @param value {@link #sequence} (A number to uniquely identify diagnosis
2158     *              entries.). This is the underlying object with id, value and
2159     *              extensions. The accessor "getSequence" gives direct access to
2160     *              the value
2161     */
2162    public DiagnosisComponent setSequenceElement(PositiveIntType value) {
2163      this.sequence = value;
2164      return this;
2165    }
2166
2167    /**
2168     * @return A number to uniquely identify diagnosis entries.
2169     */
2170    public int getSequence() {
2171      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2172    }
2173
2174    /**
2175     * @param value A number to uniquely identify diagnosis entries.
2176     */
2177    public DiagnosisComponent setSequence(int value) {
2178      if (this.sequence == null)
2179        this.sequence = new PositiveIntType();
2180      this.sequence.setValue(value);
2181      return this;
2182    }
2183
2184    /**
2185     * @return {@link #diagnosis} (The nature of illness or problem in a coded form
2186     *         or as a reference to an external defined Condition.)
2187     */
2188    public Type getDiagnosis() {
2189      return this.diagnosis;
2190    }
2191
2192    /**
2193     * @return {@link #diagnosis} (The nature of illness or problem in a coded form
2194     *         or as a reference to an external defined Condition.)
2195     */
2196    public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException {
2197      if (this.diagnosis == null)
2198        this.diagnosis = new CodeableConcept();
2199      if (!(this.diagnosis instanceof CodeableConcept))
2200        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
2201            + this.diagnosis.getClass().getName() + " was encountered");
2202      return (CodeableConcept) this.diagnosis;
2203    }
2204
2205    public boolean hasDiagnosisCodeableConcept() {
2206      return this != null && this.diagnosis instanceof CodeableConcept;
2207    }
2208
2209    /**
2210     * @return {@link #diagnosis} (The nature of illness or problem in a coded form
2211     *         or as a reference to an external defined Condition.)
2212     */
2213    public Reference getDiagnosisReference() throws FHIRException {
2214      if (this.diagnosis == null)
2215        this.diagnosis = new Reference();
2216      if (!(this.diagnosis instanceof Reference))
2217        throw new FHIRException("Type mismatch: the type Reference was expected, but "
2218            + this.diagnosis.getClass().getName() + " was encountered");
2219      return (Reference) this.diagnosis;
2220    }
2221
2222    public boolean hasDiagnosisReference() {
2223      return this != null && this.diagnosis instanceof Reference;
2224    }
2225
2226    public boolean hasDiagnosis() {
2227      return this.diagnosis != null && !this.diagnosis.isEmpty();
2228    }
2229
2230    /**
2231     * @param value {@link #diagnosis} (The nature of illness or problem in a coded
2232     *              form or as a reference to an external defined Condition.)
2233     */
2234    public DiagnosisComponent setDiagnosis(Type value) {
2235      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2236        throw new Error("Not the right type for Claim.diagnosis.diagnosis[x]: " + value.fhirType());
2237      this.diagnosis = value;
2238      return this;
2239    }
2240
2241    /**
2242     * @return {@link #type} (When the condition was observed or the relative
2243     *         ranking.)
2244     */
2245    public List<CodeableConcept> getType() {
2246      if (this.type == null)
2247        this.type = new ArrayList<CodeableConcept>();
2248      return this.type;
2249    }
2250
2251    /**
2252     * @return Returns a reference to <code>this</code> for easy method chaining
2253     */
2254    public DiagnosisComponent setType(List<CodeableConcept> theType) {
2255      this.type = theType;
2256      return this;
2257    }
2258
2259    public boolean hasType() {
2260      if (this.type == null)
2261        return false;
2262      for (CodeableConcept item : this.type)
2263        if (!item.isEmpty())
2264          return true;
2265      return false;
2266    }
2267
2268    public CodeableConcept addType() { // 3
2269      CodeableConcept t = new CodeableConcept();
2270      if (this.type == null)
2271        this.type = new ArrayList<CodeableConcept>();
2272      this.type.add(t);
2273      return t;
2274    }
2275
2276    public DiagnosisComponent addType(CodeableConcept t) { // 3
2277      if (t == null)
2278        return this;
2279      if (this.type == null)
2280        this.type = new ArrayList<CodeableConcept>();
2281      this.type.add(t);
2282      return this;
2283    }
2284
2285    /**
2286     * @return The first repetition of repeating field {@link #type}, creating it if
2287     *         it does not already exist
2288     */
2289    public CodeableConcept getTypeFirstRep() {
2290      if (getType().isEmpty()) {
2291        addType();
2292      }
2293      return getType().get(0);
2294    }
2295
2296    /**
2297     * @return {@link #onAdmission} (Indication of whether the diagnosis was present
2298     *         on admission to a facility.)
2299     */
2300    public CodeableConcept getOnAdmission() {
2301      if (this.onAdmission == null)
2302        if (Configuration.errorOnAutoCreate())
2303          throw new Error("Attempt to auto-create DiagnosisComponent.onAdmission");
2304        else if (Configuration.doAutoCreate())
2305          this.onAdmission = new CodeableConcept(); // cc
2306      return this.onAdmission;
2307    }
2308
2309    public boolean hasOnAdmission() {
2310      return this.onAdmission != null && !this.onAdmission.isEmpty();
2311    }
2312
2313    /**
2314     * @param value {@link #onAdmission} (Indication of whether the diagnosis was
2315     *              present on admission to a facility.)
2316     */
2317    public DiagnosisComponent setOnAdmission(CodeableConcept value) {
2318      this.onAdmission = value;
2319      return this;
2320    }
2321
2322    /**
2323     * @return {@link #packageCode} (A package billing code or bundle code used to
2324     *         group products and services to a particular health condition (such as
2325     *         heart attack) which is based on a predetermined grouping code
2326     *         system.)
2327     */
2328    public CodeableConcept getPackageCode() {
2329      if (this.packageCode == null)
2330        if (Configuration.errorOnAutoCreate())
2331          throw new Error("Attempt to auto-create DiagnosisComponent.packageCode");
2332        else if (Configuration.doAutoCreate())
2333          this.packageCode = new CodeableConcept(); // cc
2334      return this.packageCode;
2335    }
2336
2337    public boolean hasPackageCode() {
2338      return this.packageCode != null && !this.packageCode.isEmpty();
2339    }
2340
2341    /**
2342     * @param value {@link #packageCode} (A package billing code or bundle code used
2343     *              to group products and services to a particular health condition
2344     *              (such as heart attack) which is based on a predetermined
2345     *              grouping code system.)
2346     */
2347    public DiagnosisComponent setPackageCode(CodeableConcept value) {
2348      this.packageCode = value;
2349      return this;
2350    }
2351
2352    protected void listChildren(List<Property> children) {
2353      super.listChildren(children);
2354      children.add(
2355          new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence));
2356      children.add(new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2357          "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1,
2358          diagnosis));
2359      children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.",
2360          0, java.lang.Integer.MAX_VALUE, type));
2361      children.add(new Property("onAdmission", "CodeableConcept",
2362          "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission));
2363      children.add(new Property("packageCode", "CodeableConcept",
2364          "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.",
2365          0, 1, packageCode));
2366    }
2367
2368    @Override
2369    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2370      switch (_hash) {
2371      case 1349547969:
2372        /* sequence */ return new Property("sequence", "positiveInt",
2373            "A number to uniquely identify diagnosis entries.", 0, 1, sequence);
2374      case -1487009809:
2375        /* diagnosis[x] */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2376            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2377            1, diagnosis);
2378      case 1196993265:
2379        /* diagnosis */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2380            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2381            1, diagnosis);
2382      case 277781616:
2383        /* diagnosisCodeableConcept */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2384            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2385            1, diagnosis);
2386      case 2050454362:
2387        /* diagnosisReference */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2388            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2389            1, diagnosis);
2390      case 3575610:
2391        /* type */ return new Property("type", "CodeableConcept",
2392            "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2393      case -3386134:
2394        /* onAdmission */ return new Property("onAdmission", "CodeableConcept",
2395            "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission);
2396      case 908444499:
2397        /* packageCode */ return new Property("packageCode", "CodeableConcept",
2398            "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.",
2399            0, 1, packageCode);
2400      default:
2401        return super.getNamedProperty(_hash, _name, _checkValid);
2402      }
2403
2404    }
2405
2406    @Override
2407    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2408      switch (hash) {
2409      case 1349547969:
2410        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
2411      case 1196993265:
2412        /* diagnosis */ return this.diagnosis == null ? new Base[0] : new Base[] { this.diagnosis }; // Type
2413      case 3575610:
2414        /* type */ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2415      case -3386134:
2416        /* onAdmission */ return this.onAdmission == null ? new Base[0] : new Base[] { this.onAdmission }; // CodeableConcept
2417      case 908444499:
2418        /* packageCode */ return this.packageCode == null ? new Base[0] : new Base[] { this.packageCode }; // CodeableConcept
2419      default:
2420        return super.getProperty(hash, name, checkValid);
2421      }
2422
2423    }
2424
2425    @Override
2426    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2427      switch (hash) {
2428      case 1349547969: // sequence
2429        this.sequence = castToPositiveInt(value); // PositiveIntType
2430        return value;
2431      case 1196993265: // diagnosis
2432        this.diagnosis = castToType(value); // Type
2433        return value;
2434      case 3575610: // type
2435        this.getType().add(castToCodeableConcept(value)); // CodeableConcept
2436        return value;
2437      case -3386134: // onAdmission
2438        this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2439        return value;
2440      case 908444499: // packageCode
2441        this.packageCode = castToCodeableConcept(value); // CodeableConcept
2442        return value;
2443      default:
2444        return super.setProperty(hash, name, value);
2445      }
2446
2447    }
2448
2449    @Override
2450    public Base setProperty(String name, Base value) throws FHIRException {
2451      if (name.equals("sequence")) {
2452        this.sequence = castToPositiveInt(value); // PositiveIntType
2453      } else if (name.equals("diagnosis[x]")) {
2454        this.diagnosis = castToType(value); // Type
2455      } else if (name.equals("type")) {
2456        this.getType().add(castToCodeableConcept(value));
2457      } else if (name.equals("onAdmission")) {
2458        this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2459      } else if (name.equals("packageCode")) {
2460        this.packageCode = castToCodeableConcept(value); // CodeableConcept
2461      } else
2462        return super.setProperty(name, value);
2463      return value;
2464    }
2465
2466    @Override
2467    public Base makeProperty(int hash, String name) throws FHIRException {
2468      switch (hash) {
2469      case 1349547969:
2470        return getSequenceElement();
2471      case -1487009809:
2472        return getDiagnosis();
2473      case 1196993265:
2474        return getDiagnosis();
2475      case 3575610:
2476        return addType();
2477      case -3386134:
2478        return getOnAdmission();
2479      case 908444499:
2480        return getPackageCode();
2481      default:
2482        return super.makeProperty(hash, name);
2483      }
2484
2485    }
2486
2487    @Override
2488    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2489      switch (hash) {
2490      case 1349547969:
2491        /* sequence */ return new String[] { "positiveInt" };
2492      case 1196993265:
2493        /* diagnosis */ return new String[] { "CodeableConcept", "Reference" };
2494      case 3575610:
2495        /* type */ return new String[] { "CodeableConcept" };
2496      case -3386134:
2497        /* onAdmission */ return new String[] { "CodeableConcept" };
2498      case 908444499:
2499        /* packageCode */ return new String[] { "CodeableConcept" };
2500      default:
2501        return super.getTypesForProperty(hash, name);
2502      }
2503
2504    }
2505
2506    @Override
2507    public Base addChild(String name) throws FHIRException {
2508      if (name.equals("sequence")) {
2509        throw new FHIRException("Cannot call addChild on a singleton property Claim.sequence");
2510      } else if (name.equals("diagnosisCodeableConcept")) {
2511        this.diagnosis = new CodeableConcept();
2512        return this.diagnosis;
2513      } else if (name.equals("diagnosisReference")) {
2514        this.diagnosis = new Reference();
2515        return this.diagnosis;
2516      } else if (name.equals("type")) {
2517        return addType();
2518      } else if (name.equals("onAdmission")) {
2519        this.onAdmission = new CodeableConcept();
2520        return this.onAdmission;
2521      } else if (name.equals("packageCode")) {
2522        this.packageCode = new CodeableConcept();
2523        return this.packageCode;
2524      } else
2525        return super.addChild(name);
2526    }
2527
2528    public DiagnosisComponent copy() {
2529      DiagnosisComponent dst = new DiagnosisComponent();
2530      copyValues(dst);
2531      return dst;
2532    }
2533
2534    public void copyValues(DiagnosisComponent dst) {
2535      super.copyValues(dst);
2536      dst.sequence = sequence == null ? null : sequence.copy();
2537      dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
2538      if (type != null) {
2539        dst.type = new ArrayList<CodeableConcept>();
2540        for (CodeableConcept i : type)
2541          dst.type.add(i.copy());
2542      }
2543      ;
2544      dst.onAdmission = onAdmission == null ? null : onAdmission.copy();
2545      dst.packageCode = packageCode == null ? null : packageCode.copy();
2546    }
2547
2548    @Override
2549    public boolean equalsDeep(Base other_) {
2550      if (!super.equalsDeep(other_))
2551        return false;
2552      if (!(other_ instanceof DiagnosisComponent))
2553        return false;
2554      DiagnosisComponent o = (DiagnosisComponent) other_;
2555      return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true)
2556          && compareDeep(type, o.type, true) && compareDeep(onAdmission, o.onAdmission, true)
2557          && compareDeep(packageCode, o.packageCode, true);
2558    }
2559
2560    @Override
2561    public boolean equalsShallow(Base other_) {
2562      if (!super.equalsShallow(other_))
2563        return false;
2564      if (!(other_ instanceof DiagnosisComponent))
2565        return false;
2566      DiagnosisComponent o = (DiagnosisComponent) other_;
2567      return compareValues(sequence, o.sequence, true);
2568    }
2569
2570    public boolean isEmpty() {
2571      return super.isEmpty()
2572          && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type, onAdmission, packageCode);
2573    }
2574
2575    public String fhirType() {
2576      return "Claim.diagnosis";
2577
2578    }
2579
2580  }
2581
2582  @Block()
2583  public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
2584    /**
2585     * A number to uniquely identify procedure entries.
2586     */
2587    @Child(name = "sequence", type = {
2588        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
2589    @Description(shortDefinition = "Procedure instance identifier", formalDefinition = "A number to uniquely identify procedure entries.")
2590    protected PositiveIntType sequence;
2591
2592    /**
2593     * When the condition was observed or the relative ranking.
2594     */
2595    @Child(name = "type", type = {
2596        CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2597    @Description(shortDefinition = "Category of Procedure", formalDefinition = "When the condition was observed or the relative ranking.")
2598    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-procedure-type")
2599    protected List<CodeableConcept> type;
2600
2601    /**
2602     * Date and optionally time the procedure was performed.
2603     */
2604    @Child(name = "date", type = { DateTimeType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
2605    @Description(shortDefinition = "When the procedure was performed", formalDefinition = "Date and optionally time the procedure was performed.")
2606    protected DateTimeType date;
2607
2608    /**
2609     * The code or reference to a Procedure resource which identifies the clinical
2610     * intervention performed.
2611     */
2612    @Child(name = "procedure", type = { CodeableConcept.class,
2613        Procedure.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
2614    @Description(shortDefinition = "Specific clinical procedure", formalDefinition = "The code or reference to a Procedure resource which identifies the clinical intervention performed.")
2615    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/icd-10-procedures")
2616    protected Type procedure;
2617
2618    /**
2619     * Unique Device Identifiers associated with this line item.
2620     */
2621    @Child(name = "udi", type = {
2622        Device.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2623    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
2624    protected List<Reference> udi;
2625    /**
2626     * The actual objects that are the target of the reference (Unique Device
2627     * Identifiers associated with this line item.)
2628     */
2629    protected List<Device> udiTarget;
2630
2631    private static final long serialVersionUID = 935341852L;
2632
2633    /**
2634     * Constructor
2635     */
2636    public ProcedureComponent() {
2637      super();
2638    }
2639
2640    /**
2641     * Constructor
2642     */
2643    public ProcedureComponent(PositiveIntType sequence, Type procedure) {
2644      super();
2645      this.sequence = sequence;
2646      this.procedure = procedure;
2647    }
2648
2649    /**
2650     * @return {@link #sequence} (A number to uniquely identify procedure entries.).
2651     *         This is the underlying object with id, value and extensions. The
2652     *         accessor "getSequence" gives direct access to the value
2653     */
2654    public PositiveIntType getSequenceElement() {
2655      if (this.sequence == null)
2656        if (Configuration.errorOnAutoCreate())
2657          throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2658        else if (Configuration.doAutoCreate())
2659          this.sequence = new PositiveIntType(); // bb
2660      return this.sequence;
2661    }
2662
2663    public boolean hasSequenceElement() {
2664      return this.sequence != null && !this.sequence.isEmpty();
2665    }
2666
2667    public boolean hasSequence() {
2668      return this.sequence != null && !this.sequence.isEmpty();
2669    }
2670
2671    /**
2672     * @param value {@link #sequence} (A number to uniquely identify procedure
2673     *              entries.). This is the underlying object with id, value and
2674     *              extensions. The accessor "getSequence" gives direct access to
2675     *              the value
2676     */
2677    public ProcedureComponent setSequenceElement(PositiveIntType value) {
2678      this.sequence = value;
2679      return this;
2680    }
2681
2682    /**
2683     * @return A number to uniquely identify procedure entries.
2684     */
2685    public int getSequence() {
2686      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2687    }
2688
2689    /**
2690     * @param value A number to uniquely identify procedure entries.
2691     */
2692    public ProcedureComponent setSequence(int value) {
2693      if (this.sequence == null)
2694        this.sequence = new PositiveIntType();
2695      this.sequence.setValue(value);
2696      return this;
2697    }
2698
2699    /**
2700     * @return {@link #type} (When the condition was observed or the relative
2701     *         ranking.)
2702     */
2703    public List<CodeableConcept> getType() {
2704      if (this.type == null)
2705        this.type = new ArrayList<CodeableConcept>();
2706      return this.type;
2707    }
2708
2709    /**
2710     * @return Returns a reference to <code>this</code> for easy method chaining
2711     */
2712    public ProcedureComponent setType(List<CodeableConcept> theType) {
2713      this.type = theType;
2714      return this;
2715    }
2716
2717    public boolean hasType() {
2718      if (this.type == null)
2719        return false;
2720      for (CodeableConcept item : this.type)
2721        if (!item.isEmpty())
2722          return true;
2723      return false;
2724    }
2725
2726    public CodeableConcept addType() { // 3
2727      CodeableConcept t = new CodeableConcept();
2728      if (this.type == null)
2729        this.type = new ArrayList<CodeableConcept>();
2730      this.type.add(t);
2731      return t;
2732    }
2733
2734    public ProcedureComponent addType(CodeableConcept t) { // 3
2735      if (t == null)
2736        return this;
2737      if (this.type == null)
2738        this.type = new ArrayList<CodeableConcept>();
2739      this.type.add(t);
2740      return this;
2741    }
2742
2743    /**
2744     * @return The first repetition of repeating field {@link #type}, creating it if
2745     *         it does not already exist
2746     */
2747    public CodeableConcept getTypeFirstRep() {
2748      if (getType().isEmpty()) {
2749        addType();
2750      }
2751      return getType().get(0);
2752    }
2753
2754    /**
2755     * @return {@link #date} (Date and optionally time the procedure was
2756     *         performed.). This is the underlying object with id, value and
2757     *         extensions. The accessor "getDate" gives direct access to the value
2758     */
2759    public DateTimeType getDateElement() {
2760      if (this.date == null)
2761        if (Configuration.errorOnAutoCreate())
2762          throw new Error("Attempt to auto-create ProcedureComponent.date");
2763        else if (Configuration.doAutoCreate())
2764          this.date = new DateTimeType(); // bb
2765      return this.date;
2766    }
2767
2768    public boolean hasDateElement() {
2769      return this.date != null && !this.date.isEmpty();
2770    }
2771
2772    public boolean hasDate() {
2773      return this.date != null && !this.date.isEmpty();
2774    }
2775
2776    /**
2777     * @param value {@link #date} (Date and optionally time the procedure was
2778     *              performed.). This is the underlying object with id, value and
2779     *              extensions. The accessor "getDate" gives direct access to the
2780     *              value
2781     */
2782    public ProcedureComponent setDateElement(DateTimeType value) {
2783      this.date = value;
2784      return this;
2785    }
2786
2787    /**
2788     * @return Date and optionally time the procedure was performed.
2789     */
2790    public Date getDate() {
2791      return this.date == null ? null : this.date.getValue();
2792    }
2793
2794    /**
2795     * @param value Date and optionally time the procedure was performed.
2796     */
2797    public ProcedureComponent setDate(Date value) {
2798      if (value == null)
2799        this.date = null;
2800      else {
2801        if (this.date == null)
2802          this.date = new DateTimeType();
2803        this.date.setValue(value);
2804      }
2805      return this;
2806    }
2807
2808    /**
2809     * @return {@link #procedure} (The code or reference to a Procedure resource
2810     *         which identifies the clinical intervention performed.)
2811     */
2812    public Type getProcedure() {
2813      return this.procedure;
2814    }
2815
2816    /**
2817     * @return {@link #procedure} (The code or reference to a Procedure resource
2818     *         which identifies the clinical intervention performed.)
2819     */
2820    public CodeableConcept getProcedureCodeableConcept() throws FHIRException {
2821      if (this.procedure == null)
2822        this.procedure = new CodeableConcept();
2823      if (!(this.procedure instanceof CodeableConcept))
2824        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
2825            + this.procedure.getClass().getName() + " was encountered");
2826      return (CodeableConcept) this.procedure;
2827    }
2828
2829    public boolean hasProcedureCodeableConcept() {
2830      return this != null && this.procedure instanceof CodeableConcept;
2831    }
2832
2833    /**
2834     * @return {@link #procedure} (The code or reference to a Procedure resource
2835     *         which identifies the clinical intervention performed.)
2836     */
2837    public Reference getProcedureReference() throws FHIRException {
2838      if (this.procedure == null)
2839        this.procedure = new Reference();
2840      if (!(this.procedure instanceof Reference))
2841        throw new FHIRException("Type mismatch: the type Reference was expected, but "
2842            + this.procedure.getClass().getName() + " was encountered");
2843      return (Reference) this.procedure;
2844    }
2845
2846    public boolean hasProcedureReference() {
2847      return this != null && this.procedure instanceof Reference;
2848    }
2849
2850    public boolean hasProcedure() {
2851      return this.procedure != null && !this.procedure.isEmpty();
2852    }
2853
2854    /**
2855     * @param value {@link #procedure} (The code or reference to a Procedure
2856     *              resource which identifies the clinical intervention performed.)
2857     */
2858    public ProcedureComponent setProcedure(Type value) {
2859      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2860        throw new Error("Not the right type for Claim.procedure.procedure[x]: " + value.fhirType());
2861      this.procedure = value;
2862      return this;
2863    }
2864
2865    /**
2866     * @return {@link #udi} (Unique Device Identifiers associated with this line
2867     *         item.)
2868     */
2869    public List<Reference> getUdi() {
2870      if (this.udi == null)
2871        this.udi = new ArrayList<Reference>();
2872      return this.udi;
2873    }
2874
2875    /**
2876     * @return Returns a reference to <code>this</code> for easy method chaining
2877     */
2878    public ProcedureComponent setUdi(List<Reference> theUdi) {
2879      this.udi = theUdi;
2880      return this;
2881    }
2882
2883    public boolean hasUdi() {
2884      if (this.udi == null)
2885        return false;
2886      for (Reference item : this.udi)
2887        if (!item.isEmpty())
2888          return true;
2889      return false;
2890    }
2891
2892    public Reference addUdi() { // 3
2893      Reference t = new Reference();
2894      if (this.udi == null)
2895        this.udi = new ArrayList<Reference>();
2896      this.udi.add(t);
2897      return t;
2898    }
2899
2900    public ProcedureComponent addUdi(Reference t) { // 3
2901      if (t == null)
2902        return this;
2903      if (this.udi == null)
2904        this.udi = new ArrayList<Reference>();
2905      this.udi.add(t);
2906      return this;
2907    }
2908
2909    /**
2910     * @return The first repetition of repeating field {@link #udi}, creating it if
2911     *         it does not already exist
2912     */
2913    public Reference getUdiFirstRep() {
2914      if (getUdi().isEmpty()) {
2915        addUdi();
2916      }
2917      return getUdi().get(0);
2918    }
2919
2920    /**
2921     * @deprecated Use Reference#setResource(IBaseResource) instead
2922     */
2923    @Deprecated
2924    public List<Device> getUdiTarget() {
2925      if (this.udiTarget == null)
2926        this.udiTarget = new ArrayList<Device>();
2927      return this.udiTarget;
2928    }
2929
2930    /**
2931     * @deprecated Use Reference#setResource(IBaseResource) instead
2932     */
2933    @Deprecated
2934    public Device addUdiTarget() {
2935      Device r = new Device();
2936      if (this.udiTarget == null)
2937        this.udiTarget = new ArrayList<Device>();
2938      this.udiTarget.add(r);
2939      return r;
2940    }
2941
2942    protected void listChildren(List<Property> children) {
2943      super.listChildren(children);
2944      children.add(
2945          new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence));
2946      children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.",
2947          0, java.lang.Integer.MAX_VALUE, type));
2948      children
2949          .add(new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date));
2950      children.add(new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
2951          "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
2952          procedure));
2953      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
2954          0, java.lang.Integer.MAX_VALUE, udi));
2955    }
2956
2957    @Override
2958    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2959      switch (_hash) {
2960      case 1349547969:
2961        /* sequence */ return new Property("sequence", "positiveInt",
2962            "A number to uniquely identify procedure entries.", 0, 1, sequence);
2963      case 3575610:
2964        /* type */ return new Property("type", "CodeableConcept",
2965            "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2966      case 3076014:
2967        /* date */ return new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0,
2968            1, date);
2969      case 1640074445:
2970        /* procedure[x] */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
2971            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
2972            procedure);
2973      case -1095204141:
2974        /* procedure */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
2975            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
2976            procedure);
2977      case -1284783026:
2978        /* procedureCodeableConcept */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
2979            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
2980            procedure);
2981      case 881809848:
2982        /* procedureReference */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
2983            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
2984            procedure);
2985      case 115642:
2986        /* udi */ return new Property("udi", "Reference(Device)",
2987            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
2988      default:
2989        return super.getNamedProperty(_hash, _name, _checkValid);
2990      }
2991
2992    }
2993
2994    @Override
2995    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2996      switch (hash) {
2997      case 1349547969:
2998        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
2999      case 3575610:
3000        /* type */ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
3001      case 3076014:
3002        /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateTimeType
3003      case -1095204141:
3004        /* procedure */ return this.procedure == null ? new Base[0] : new Base[] { this.procedure }; // Type
3005      case 115642:
3006        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
3007      default:
3008        return super.getProperty(hash, name, checkValid);
3009      }
3010
3011    }
3012
3013    @Override
3014    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3015      switch (hash) {
3016      case 1349547969: // sequence
3017        this.sequence = castToPositiveInt(value); // PositiveIntType
3018        return value;
3019      case 3575610: // type
3020        this.getType().add(castToCodeableConcept(value)); // CodeableConcept
3021        return value;
3022      case 3076014: // date
3023        this.date = castToDateTime(value); // DateTimeType
3024        return value;
3025      case -1095204141: // procedure
3026        this.procedure = castToType(value); // Type
3027        return value;
3028      case 115642: // udi
3029        this.getUdi().add(castToReference(value)); // Reference
3030        return value;
3031      default:
3032        return super.setProperty(hash, name, value);
3033      }
3034
3035    }
3036
3037    @Override
3038    public Base setProperty(String name, Base value) throws FHIRException {
3039      if (name.equals("sequence")) {
3040        this.sequence = castToPositiveInt(value); // PositiveIntType
3041      } else if (name.equals("type")) {
3042        this.getType().add(castToCodeableConcept(value));
3043      } else if (name.equals("date")) {
3044        this.date = castToDateTime(value); // DateTimeType
3045      } else if (name.equals("procedure[x]")) {
3046        this.procedure = castToType(value); // Type
3047      } else if (name.equals("udi")) {
3048        this.getUdi().add(castToReference(value));
3049      } else
3050        return super.setProperty(name, value);
3051      return value;
3052    }
3053
3054    @Override
3055    public Base makeProperty(int hash, String name) throws FHIRException {
3056      switch (hash) {
3057      case 1349547969:
3058        return getSequenceElement();
3059      case 3575610:
3060        return addType();
3061      case 3076014:
3062        return getDateElement();
3063      case 1640074445:
3064        return getProcedure();
3065      case -1095204141:
3066        return getProcedure();
3067      case 115642:
3068        return addUdi();
3069      default:
3070        return super.makeProperty(hash, name);
3071      }
3072
3073    }
3074
3075    @Override
3076    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3077      switch (hash) {
3078      case 1349547969:
3079        /* sequence */ return new String[] { "positiveInt" };
3080      case 3575610:
3081        /* type */ return new String[] { "CodeableConcept" };
3082      case 3076014:
3083        /* date */ return new String[] { "dateTime" };
3084      case -1095204141:
3085        /* procedure */ return new String[] { "CodeableConcept", "Reference" };
3086      case 115642:
3087        /* udi */ return new String[] { "Reference" };
3088      default:
3089        return super.getTypesForProperty(hash, name);
3090      }
3091
3092    }
3093
3094    @Override
3095    public Base addChild(String name) throws FHIRException {
3096      if (name.equals("sequence")) {
3097        throw new FHIRException("Cannot call addChild on a singleton property Claim.sequence");
3098      } else if (name.equals("type")) {
3099        return addType();
3100      } else if (name.equals("date")) {
3101        throw new FHIRException("Cannot call addChild on a singleton property Claim.date");
3102      } else if (name.equals("procedureCodeableConcept")) {
3103        this.procedure = new CodeableConcept();
3104        return this.procedure;
3105      } else if (name.equals("procedureReference")) {
3106        this.procedure = new Reference();
3107        return this.procedure;
3108      } else if (name.equals("udi")) {
3109        return addUdi();
3110      } else
3111        return super.addChild(name);
3112    }
3113
3114    public ProcedureComponent copy() {
3115      ProcedureComponent dst = new ProcedureComponent();
3116      copyValues(dst);
3117      return dst;
3118    }
3119
3120    public void copyValues(ProcedureComponent dst) {
3121      super.copyValues(dst);
3122      dst.sequence = sequence == null ? null : sequence.copy();
3123      if (type != null) {
3124        dst.type = new ArrayList<CodeableConcept>();
3125        for (CodeableConcept i : type)
3126          dst.type.add(i.copy());
3127      }
3128      ;
3129      dst.date = date == null ? null : date.copy();
3130      dst.procedure = procedure == null ? null : procedure.copy();
3131      if (udi != null) {
3132        dst.udi = new ArrayList<Reference>();
3133        for (Reference i : udi)
3134          dst.udi.add(i.copy());
3135      }
3136      ;
3137    }
3138
3139    @Override
3140    public boolean equalsDeep(Base other_) {
3141      if (!super.equalsDeep(other_))
3142        return false;
3143      if (!(other_ instanceof ProcedureComponent))
3144        return false;
3145      ProcedureComponent o = (ProcedureComponent) other_;
3146      return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true)
3147          && compareDeep(date, o.date, true) && compareDeep(procedure, o.procedure, true)
3148          && compareDeep(udi, o.udi, true);
3149    }
3150
3151    @Override
3152    public boolean equalsShallow(Base other_) {
3153      if (!super.equalsShallow(other_))
3154        return false;
3155      if (!(other_ instanceof ProcedureComponent))
3156        return false;
3157      ProcedureComponent o = (ProcedureComponent) other_;
3158      return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
3159    }
3160
3161    public boolean isEmpty() {
3162      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, date, procedure, udi);
3163    }
3164
3165    public String fhirType() {
3166      return "Claim.procedure";
3167
3168    }
3169
3170  }
3171
3172  @Block()
3173  public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
3174    /**
3175     * A number to uniquely identify insurance entries and provide a sequence of
3176     * coverages to convey coordination of benefit order.
3177     */
3178    @Child(name = "sequence", type = {
3179        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
3180    @Description(shortDefinition = "Insurance instance identifier", formalDefinition = "A number to uniquely identify insurance entries and provide a sequence of coverages to convey coordination of benefit order.")
3181    protected PositiveIntType sequence;
3182
3183    /**
3184     * A flag to indicate that this Coverage is to be used for adjudication of this
3185     * claim when set to true.
3186     */
3187    @Child(name = "focal", type = { BooleanType.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
3188    @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.")
3189    protected BooleanType focal;
3190
3191    /**
3192     * The business identifier to be used when the claim is sent for adjudication
3193     * against this insurance policy.
3194     */
3195    @Child(name = "identifier", type = {
3196        Identifier.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
3197    @Description(shortDefinition = "Pre-assigned Claim number", formalDefinition = "The business identifier to be used when the claim is sent for adjudication against this insurance policy.")
3198    protected Identifier identifier;
3199
3200    /**
3201     * Reference to the insurance card level information contained in the Coverage
3202     * resource. The coverage issuing insurer will use these details to locate the
3203     * patient's actual coverage within the insurer's information system.
3204     */
3205    @Child(name = "coverage", type = { Coverage.class }, order = 4, min = 1, max = 1, modifier = false, summary = true)
3206    @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.")
3207    protected Reference coverage;
3208
3209    /**
3210     * The actual object that is the target of the reference (Reference to the
3211     * insurance card level information contained in the Coverage resource. The
3212     * coverage issuing insurer will use these details to locate the patient's
3213     * actual coverage within the insurer's information system.)
3214     */
3215    protected Coverage coverageTarget;
3216
3217    /**
3218     * A business agreement number established between the provider and the insurer
3219     * for special business processing purposes.
3220     */
3221    @Child(name = "businessArrangement", type = {
3222        StringType.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
3223    @Description(shortDefinition = "Additional provider contract number", formalDefinition = "A business agreement number established between the provider and the insurer for special business processing purposes.")
3224    protected StringType businessArrangement;
3225
3226    /**
3227     * Reference numbers previously provided by the insurer to the provider to be
3228     * quoted on subsequent claims containing services or products related to the
3229     * prior authorization.
3230     */
3231    @Child(name = "preAuthRef", type = {
3232        StringType.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3233    @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.")
3234    protected List<StringType> preAuthRef;
3235
3236    /**
3237     * The result of the adjudication of the line items for the Coverage specified
3238     * in this insurance.
3239     */
3240    @Child(name = "claimResponse", type = {
3241        ClaimResponse.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
3242    @Description(shortDefinition = "Adjudication results", formalDefinition = "The result of the adjudication of the line items for the Coverage specified in this insurance.")
3243    protected Reference claimResponse;
3244
3245    /**
3246     * The actual object that is the target of the reference (The result of the
3247     * adjudication of the line items for the Coverage specified in this insurance.)
3248     */
3249    protected ClaimResponse claimResponseTarget;
3250
3251    private static final long serialVersionUID = -1711744215L;
3252
3253    /**
3254     * Constructor
3255     */
3256    public InsuranceComponent() {
3257      super();
3258    }
3259
3260    /**
3261     * Constructor
3262     */
3263    public InsuranceComponent(PositiveIntType sequence, BooleanType focal, Reference coverage) {
3264      super();
3265      this.sequence = sequence;
3266      this.focal = focal;
3267      this.coverage = coverage;
3268    }
3269
3270    /**
3271     * @return {@link #sequence} (A number to uniquely identify insurance entries
3272     *         and provide a sequence of coverages to convey coordination of benefit
3273     *         order.). This is the underlying object with id, value and extensions.
3274     *         The accessor "getSequence" gives direct access to the value
3275     */
3276    public PositiveIntType getSequenceElement() {
3277      if (this.sequence == null)
3278        if (Configuration.errorOnAutoCreate())
3279          throw new Error("Attempt to auto-create InsuranceComponent.sequence");
3280        else if (Configuration.doAutoCreate())
3281          this.sequence = new PositiveIntType(); // bb
3282      return this.sequence;
3283    }
3284
3285    public boolean hasSequenceElement() {
3286      return this.sequence != null && !this.sequence.isEmpty();
3287    }
3288
3289    public boolean hasSequence() {
3290      return this.sequence != null && !this.sequence.isEmpty();
3291    }
3292
3293    /**
3294     * @param value {@link #sequence} (A number to uniquely identify insurance
3295     *              entries and provide a sequence of coverages to convey
3296     *              coordination of benefit order.). This is the underlying object
3297     *              with id, value and extensions. The accessor "getSequence" gives
3298     *              direct access to the value
3299     */
3300    public InsuranceComponent setSequenceElement(PositiveIntType value) {
3301      this.sequence = value;
3302      return this;
3303    }
3304
3305    /**
3306     * @return A number to uniquely identify insurance entries and provide a
3307     *         sequence of coverages to convey coordination of benefit order.
3308     */
3309    public int getSequence() {
3310      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3311    }
3312
3313    /**
3314     * @param value A number to uniquely identify insurance entries and provide a
3315     *              sequence of coverages to convey coordination of benefit order.
3316     */
3317    public InsuranceComponent setSequence(int value) {
3318      if (this.sequence == null)
3319        this.sequence = new PositiveIntType();
3320      this.sequence.setValue(value);
3321      return this;
3322    }
3323
3324    /**
3325     * @return {@link #focal} (A flag to indicate that this Coverage is to be used
3326     *         for adjudication of this claim when set to true.). This is the
3327     *         underlying object with id, value and extensions. The accessor
3328     *         "getFocal" gives direct access to the value
3329     */
3330    public BooleanType getFocalElement() {
3331      if (this.focal == null)
3332        if (Configuration.errorOnAutoCreate())
3333          throw new Error("Attempt to auto-create InsuranceComponent.focal");
3334        else if (Configuration.doAutoCreate())
3335          this.focal = new BooleanType(); // bb
3336      return this.focal;
3337    }
3338
3339    public boolean hasFocalElement() {
3340      return this.focal != null && !this.focal.isEmpty();
3341    }
3342
3343    public boolean hasFocal() {
3344      return this.focal != null && !this.focal.isEmpty();
3345    }
3346
3347    /**
3348     * @param value {@link #focal} (A flag to indicate that this Coverage is to be
3349     *              used for adjudication of this claim when set to true.). This is
3350     *              the underlying object with id, value and extensions. The
3351     *              accessor "getFocal" gives direct access to the value
3352     */
3353    public InsuranceComponent setFocalElement(BooleanType value) {
3354      this.focal = value;
3355      return this;
3356    }
3357
3358    /**
3359     * @return A flag to indicate that this Coverage is to be used for adjudication
3360     *         of this claim when set to true.
3361     */
3362    public boolean getFocal() {
3363      return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
3364    }
3365
3366    /**
3367     * @param value A flag to indicate that this Coverage is to be used for
3368     *              adjudication of this claim when set to true.
3369     */
3370    public InsuranceComponent setFocal(boolean value) {
3371      if (this.focal == null)
3372        this.focal = new BooleanType();
3373      this.focal.setValue(value);
3374      return this;
3375    }
3376
3377    /**
3378     * @return {@link #identifier} (The business identifier to be used when the
3379     *         claim is sent for adjudication against this insurance policy.)
3380     */
3381    public Identifier getIdentifier() {
3382      if (this.identifier == null)
3383        if (Configuration.errorOnAutoCreate())
3384          throw new Error("Attempt to auto-create InsuranceComponent.identifier");
3385        else if (Configuration.doAutoCreate())
3386          this.identifier = new Identifier(); // cc
3387      return this.identifier;
3388    }
3389
3390    public boolean hasIdentifier() {
3391      return this.identifier != null && !this.identifier.isEmpty();
3392    }
3393
3394    /**
3395     * @param value {@link #identifier} (The business identifier to be used when the
3396     *              claim is sent for adjudication against this insurance policy.)
3397     */
3398    public InsuranceComponent setIdentifier(Identifier value) {
3399      this.identifier = value;
3400      return this;
3401    }
3402
3403    /**
3404     * @return {@link #coverage} (Reference to the insurance card level information
3405     *         contained in the Coverage resource. The coverage issuing insurer will
3406     *         use these details to locate the patient's actual coverage within the
3407     *         insurer's information system.)
3408     */
3409    public Reference getCoverage() {
3410      if (this.coverage == null)
3411        if (Configuration.errorOnAutoCreate())
3412          throw new Error("Attempt to auto-create InsuranceComponent.coverage");
3413        else if (Configuration.doAutoCreate())
3414          this.coverage = new Reference(); // cc
3415      return this.coverage;
3416    }
3417
3418    public boolean hasCoverage() {
3419      return this.coverage != null && !this.coverage.isEmpty();
3420    }
3421
3422    /**
3423     * @param value {@link #coverage} (Reference to the insurance card level
3424     *              information contained in the Coverage resource. The coverage
3425     *              issuing insurer will use these details to locate the patient's
3426     *              actual coverage within the insurer's information system.)
3427     */
3428    public InsuranceComponent setCoverage(Reference value) {
3429      this.coverage = value;
3430      return this;
3431    }
3432
3433    /**
3434     * @return {@link #coverage} The actual object that is the target of the
3435     *         reference. The reference library doesn't populate this, but you can
3436     *         use it to hold the resource if you resolve it. (Reference to the
3437     *         insurance card level information contained in the Coverage resource.
3438     *         The coverage issuing insurer will use these details to locate the
3439     *         patient's actual coverage within the insurer's information system.)
3440     */
3441    public Coverage getCoverageTarget() {
3442      if (this.coverageTarget == null)
3443        if (Configuration.errorOnAutoCreate())
3444          throw new Error("Attempt to auto-create InsuranceComponent.coverage");
3445        else if (Configuration.doAutoCreate())
3446          this.coverageTarget = new Coverage(); // aa
3447      return this.coverageTarget;
3448    }
3449
3450    /**
3451     * @param value {@link #coverage} The actual object that is the target of the
3452     *              reference. The reference library doesn't use these, but you can
3453     *              use it to hold the resource if you resolve it. (Reference to the
3454     *              insurance card level information contained in the Coverage
3455     *              resource. The coverage issuing insurer will use these details to
3456     *              locate the patient's actual coverage within the insurer's
3457     *              information system.)
3458     */
3459    public InsuranceComponent setCoverageTarget(Coverage value) {
3460      this.coverageTarget = value;
3461      return this;
3462    }
3463
3464    /**
3465     * @return {@link #businessArrangement} (A business agreement number established
3466     *         between the provider and the insurer for special business processing
3467     *         purposes.). This is the underlying object with id, value and
3468     *         extensions. The accessor "getBusinessArrangement" gives direct access
3469     *         to the value
3470     */
3471    public StringType getBusinessArrangementElement() {
3472      if (this.businessArrangement == null)
3473        if (Configuration.errorOnAutoCreate())
3474          throw new Error("Attempt to auto-create InsuranceComponent.businessArrangement");
3475        else if (Configuration.doAutoCreate())
3476          this.businessArrangement = new StringType(); // bb
3477      return this.businessArrangement;
3478    }
3479
3480    public boolean hasBusinessArrangementElement() {
3481      return this.businessArrangement != null && !this.businessArrangement.isEmpty();
3482    }
3483
3484    public boolean hasBusinessArrangement() {
3485      return this.businessArrangement != null && !this.businessArrangement.isEmpty();
3486    }
3487
3488    /**
3489     * @param value {@link #businessArrangement} (A business agreement number
3490     *              established between the provider and the insurer for special
3491     *              business processing purposes.). This is the underlying object
3492     *              with id, value and extensions. The accessor
3493     *              "getBusinessArrangement" gives direct access to the value
3494     */
3495    public InsuranceComponent setBusinessArrangementElement(StringType value) {
3496      this.businessArrangement = value;
3497      return this;
3498    }
3499
3500    /**
3501     * @return A business agreement number established between the provider and the
3502     *         insurer for special business processing purposes.
3503     */
3504    public String getBusinessArrangement() {
3505      return this.businessArrangement == null ? null : this.businessArrangement.getValue();
3506    }
3507
3508    /**
3509     * @param value A business agreement number established between the provider and
3510     *              the insurer for special business processing purposes.
3511     */
3512    public InsuranceComponent setBusinessArrangement(String value) {
3513      if (Utilities.noString(value))
3514        this.businessArrangement = null;
3515      else {
3516        if (this.businessArrangement == null)
3517          this.businessArrangement = new StringType();
3518        this.businessArrangement.setValue(value);
3519      }
3520      return this;
3521    }
3522
3523    /**
3524     * @return {@link #preAuthRef} (Reference numbers previously provided by the
3525     *         insurer to the provider to be quoted on subsequent claims containing
3526     *         services or products related to the prior authorization.)
3527     */
3528    public List<StringType> getPreAuthRef() {
3529      if (this.preAuthRef == null)
3530        this.preAuthRef = new ArrayList<StringType>();
3531      return this.preAuthRef;
3532    }
3533
3534    /**
3535     * @return Returns a reference to <code>this</code> for easy method chaining
3536     */
3537    public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) {
3538      this.preAuthRef = thePreAuthRef;
3539      return this;
3540    }
3541
3542    public boolean hasPreAuthRef() {
3543      if (this.preAuthRef == null)
3544        return false;
3545      for (StringType item : this.preAuthRef)
3546        if (!item.isEmpty())
3547          return true;
3548      return false;
3549    }
3550
3551    /**
3552     * @return {@link #preAuthRef} (Reference numbers previously provided by the
3553     *         insurer to the provider to be quoted on subsequent claims containing
3554     *         services or products related to the prior authorization.)
3555     */
3556    public StringType addPreAuthRefElement() {// 2
3557      StringType t = new StringType();
3558      if (this.preAuthRef == null)
3559        this.preAuthRef = new ArrayList<StringType>();
3560      this.preAuthRef.add(t);
3561      return t;
3562    }
3563
3564    /**
3565     * @param value {@link #preAuthRef} (Reference numbers previously provided by
3566     *              the insurer to the provider to be quoted on subsequent claims
3567     *              containing services or products related to the prior
3568     *              authorization.)
3569     */
3570    public InsuranceComponent addPreAuthRef(String value) { // 1
3571      StringType t = new StringType();
3572      t.setValue(value);
3573      if (this.preAuthRef == null)
3574        this.preAuthRef = new ArrayList<StringType>();
3575      this.preAuthRef.add(t);
3576      return this;
3577    }
3578
3579    /**
3580     * @param value {@link #preAuthRef} (Reference numbers previously provided by
3581     *              the insurer to the provider to be quoted on subsequent claims
3582     *              containing services or products related to the prior
3583     *              authorization.)
3584     */
3585    public boolean hasPreAuthRef(String value) {
3586      if (this.preAuthRef == null)
3587        return false;
3588      for (StringType v : this.preAuthRef)
3589        if (v.getValue().equals(value)) // string
3590          return true;
3591      return false;
3592    }
3593
3594    /**
3595     * @return {@link #claimResponse} (The result of the adjudication of the line
3596     *         items for the Coverage specified in this insurance.)
3597     */
3598    public Reference getClaimResponse() {
3599      if (this.claimResponse == null)
3600        if (Configuration.errorOnAutoCreate())
3601          throw new Error("Attempt to auto-create InsuranceComponent.claimResponse");
3602        else if (Configuration.doAutoCreate())
3603          this.claimResponse = new Reference(); // cc
3604      return this.claimResponse;
3605    }
3606
3607    public boolean hasClaimResponse() {
3608      return this.claimResponse != null && !this.claimResponse.isEmpty();
3609    }
3610
3611    /**
3612     * @param value {@link #claimResponse} (The result of the adjudication of the
3613     *              line items for the Coverage specified in this insurance.)
3614     */
3615    public InsuranceComponent setClaimResponse(Reference value) {
3616      this.claimResponse = value;
3617      return this;
3618    }
3619
3620    /**
3621     * @return {@link #claimResponse} The actual object that is the target of the
3622     *         reference. The reference library doesn't populate this, but you can
3623     *         use it to hold the resource if you resolve it. (The result of the
3624     *         adjudication of the line items for the Coverage specified in this
3625     *         insurance.)
3626     */
3627    public ClaimResponse getClaimResponseTarget() {
3628      if (this.claimResponseTarget == null)
3629        if (Configuration.errorOnAutoCreate())
3630          throw new Error("Attempt to auto-create InsuranceComponent.claimResponse");
3631        else if (Configuration.doAutoCreate())
3632          this.claimResponseTarget = new ClaimResponse(); // aa
3633      return this.claimResponseTarget;
3634    }
3635
3636    /**
3637     * @param value {@link #claimResponse} The actual object that is the target of
3638     *              the reference. The reference library doesn't use these, but you
3639     *              can use it to hold the resource if you resolve it. (The result
3640     *              of the adjudication of the line items for the Coverage specified
3641     *              in this insurance.)
3642     */
3643    public InsuranceComponent setClaimResponseTarget(ClaimResponse value) {
3644      this.claimResponseTarget = value;
3645      return this;
3646    }
3647
3648    protected void listChildren(List<Property> children) {
3649      super.listChildren(children);
3650      children.add(new Property("sequence", "positiveInt",
3651          "A number to uniquely identify insurance entries and provide a sequence of coverages to convey coordination of benefit order.",
3652          0, 1, sequence));
3653      children.add(new Property("focal", "boolean",
3654          "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.", 0, 1,
3655          focal));
3656      children.add(new Property("identifier", "Identifier",
3657          "The business identifier to be used when the claim is sent for adjudication against this insurance policy.",
3658          0, 1, identifier));
3659      children.add(new Property("coverage", "Reference(Coverage)",
3660          "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.",
3661          0, 1, coverage));
3662      children.add(new Property("businessArrangement", "string",
3663          "A business agreement number established between the provider and the insurer for special business processing purposes.",
3664          0, 1, businessArrangement));
3665      children.add(new Property("preAuthRef", "string",
3666          "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.",
3667          0, java.lang.Integer.MAX_VALUE, preAuthRef));
3668      children.add(new Property("claimResponse", "Reference(ClaimResponse)",
3669          "The result of the adjudication of the line items for the Coverage specified in this insurance.", 0, 1,
3670          claimResponse));
3671    }
3672
3673    @Override
3674    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3675      switch (_hash) {
3676      case 1349547969:
3677        /* sequence */ return new Property("sequence", "positiveInt",
3678            "A number to uniquely identify insurance entries and provide a sequence of coverages to convey coordination of benefit order.",
3679            0, 1, sequence);
3680      case 97604197:
3681        /* focal */ return new Property("focal", "boolean",
3682            "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.", 0,
3683            1, focal);
3684      case -1618432855:
3685        /* identifier */ return new Property("identifier", "Identifier",
3686            "The business identifier to be used when the claim is sent for adjudication against this insurance policy.",
3687            0, 1, identifier);
3688      case -351767064:
3689        /* coverage */ return new Property("coverage", "Reference(Coverage)",
3690            "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.",
3691            0, 1, coverage);
3692      case 259920682:
3693        /* businessArrangement */ return new Property("businessArrangement", "string",
3694            "A business agreement number established between the provider and the insurer for special business processing purposes.",
3695            0, 1, businessArrangement);
3696      case 522246568:
3697        /* preAuthRef */ return new Property("preAuthRef", "string",
3698            "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.",
3699            0, java.lang.Integer.MAX_VALUE, preAuthRef);
3700      case 689513629:
3701        /* claimResponse */ return new Property("claimResponse", "Reference(ClaimResponse)",
3702            "The result of the adjudication of the line items for the Coverage specified in this insurance.", 0, 1,
3703            claimResponse);
3704      default:
3705        return super.getNamedProperty(_hash, _name, _checkValid);
3706      }
3707
3708    }
3709
3710    @Override
3711    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3712      switch (hash) {
3713      case 1349547969:
3714        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
3715      case 97604197:
3716        /* focal */ return this.focal == null ? new Base[0] : new Base[] { this.focal }; // BooleanType
3717      case -1618432855:
3718        /* identifier */ return this.identifier == null ? new Base[0] : new Base[] { this.identifier }; // Identifier
3719      case -351767064:
3720        /* coverage */ return this.coverage == null ? new Base[0] : new Base[] { this.coverage }; // Reference
3721      case 259920682:
3722        /* businessArrangement */ return this.businessArrangement == null ? new Base[0]
3723            : new Base[] { this.businessArrangement }; // StringType
3724      case 522246568:
3725        /* preAuthRef */ return this.preAuthRef == null ? new Base[0]
3726            : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
3727      case 689513629:
3728        /* claimResponse */ return this.claimResponse == null ? new Base[0] : new Base[] { this.claimResponse }; // Reference
3729      default:
3730        return super.getProperty(hash, name, checkValid);
3731      }
3732
3733    }
3734
3735    @Override
3736    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3737      switch (hash) {
3738      case 1349547969: // sequence
3739        this.sequence = castToPositiveInt(value); // PositiveIntType
3740        return value;
3741      case 97604197: // focal
3742        this.focal = castToBoolean(value); // BooleanType
3743        return value;
3744      case -1618432855: // identifier
3745        this.identifier = castToIdentifier(value); // Identifier
3746        return value;
3747      case -351767064: // coverage
3748        this.coverage = castToReference(value); // Reference
3749        return value;
3750      case 259920682: // businessArrangement
3751        this.businessArrangement = castToString(value); // StringType
3752        return value;
3753      case 522246568: // preAuthRef
3754        this.getPreAuthRef().add(castToString(value)); // StringType
3755        return value;
3756      case 689513629: // claimResponse
3757        this.claimResponse = castToReference(value); // Reference
3758        return value;
3759      default:
3760        return super.setProperty(hash, name, value);
3761      }
3762
3763    }
3764
3765    @Override
3766    public Base setProperty(String name, Base value) throws FHIRException {
3767      if (name.equals("sequence")) {
3768        this.sequence = castToPositiveInt(value); // PositiveIntType
3769      } else if (name.equals("focal")) {
3770        this.focal = castToBoolean(value); // BooleanType
3771      } else if (name.equals("identifier")) {
3772        this.identifier = castToIdentifier(value); // Identifier
3773      } else if (name.equals("coverage")) {
3774        this.coverage = castToReference(value); // Reference
3775      } else if (name.equals("businessArrangement")) {
3776        this.businessArrangement = castToString(value); // StringType
3777      } else if (name.equals("preAuthRef")) {
3778        this.getPreAuthRef().add(castToString(value));
3779      } else if (name.equals("claimResponse")) {
3780        this.claimResponse = castToReference(value); // Reference
3781      } else
3782        return super.setProperty(name, value);
3783      return value;
3784    }
3785
3786    @Override
3787    public Base makeProperty(int hash, String name) throws FHIRException {
3788      switch (hash) {
3789      case 1349547969:
3790        return getSequenceElement();
3791      case 97604197:
3792        return getFocalElement();
3793      case -1618432855:
3794        return getIdentifier();
3795      case -351767064:
3796        return getCoverage();
3797      case 259920682:
3798        return getBusinessArrangementElement();
3799      case 522246568:
3800        return addPreAuthRefElement();
3801      case 689513629:
3802        return getClaimResponse();
3803      default:
3804        return super.makeProperty(hash, name);
3805      }
3806
3807    }
3808
3809    @Override
3810    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3811      switch (hash) {
3812      case 1349547969:
3813        /* sequence */ return new String[] { "positiveInt" };
3814      case 97604197:
3815        /* focal */ return new String[] { "boolean" };
3816      case -1618432855:
3817        /* identifier */ return new String[] { "Identifier" };
3818      case -351767064:
3819        /* coverage */ return new String[] { "Reference" };
3820      case 259920682:
3821        /* businessArrangement */ return new String[] { "string" };
3822      case 522246568:
3823        /* preAuthRef */ return new String[] { "string" };
3824      case 689513629:
3825        /* claimResponse */ return new String[] { "Reference" };
3826      default:
3827        return super.getTypesForProperty(hash, name);
3828      }
3829
3830    }
3831
3832    @Override
3833    public Base addChild(String name) throws FHIRException {
3834      if (name.equals("sequence")) {
3835        throw new FHIRException("Cannot call addChild on a singleton property Claim.sequence");
3836      } else if (name.equals("focal")) {
3837        throw new FHIRException("Cannot call addChild on a singleton property Claim.focal");
3838      } else if (name.equals("identifier")) {
3839        this.identifier = new Identifier();
3840        return this.identifier;
3841      } else if (name.equals("coverage")) {
3842        this.coverage = new Reference();
3843        return this.coverage;
3844      } else if (name.equals("businessArrangement")) {
3845        throw new FHIRException("Cannot call addChild on a singleton property Claim.businessArrangement");
3846      } else if (name.equals("preAuthRef")) {
3847        throw new FHIRException("Cannot call addChild on a singleton property Claim.preAuthRef");
3848      } else if (name.equals("claimResponse")) {
3849        this.claimResponse = new Reference();
3850        return this.claimResponse;
3851      } else
3852        return super.addChild(name);
3853    }
3854
3855    public InsuranceComponent copy() {
3856      InsuranceComponent dst = new InsuranceComponent();
3857      copyValues(dst);
3858      return dst;
3859    }
3860
3861    public void copyValues(InsuranceComponent dst) {
3862      super.copyValues(dst);
3863      dst.sequence = sequence == null ? null : sequence.copy();
3864      dst.focal = focal == null ? null : focal.copy();
3865      dst.identifier = identifier == null ? null : identifier.copy();
3866      dst.coverage = coverage == null ? null : coverage.copy();
3867      dst.businessArrangement = businessArrangement == null ? null : businessArrangement.copy();
3868      if (preAuthRef != null) {
3869        dst.preAuthRef = new ArrayList<StringType>();
3870        for (StringType i : preAuthRef)
3871          dst.preAuthRef.add(i.copy());
3872      }
3873      ;
3874      dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
3875    }
3876
3877    @Override
3878    public boolean equalsDeep(Base other_) {
3879      if (!super.equalsDeep(other_))
3880        return false;
3881      if (!(other_ instanceof InsuranceComponent))
3882        return false;
3883      InsuranceComponent o = (InsuranceComponent) other_;
3884      return compareDeep(sequence, o.sequence, true) && compareDeep(focal, o.focal, true)
3885          && compareDeep(identifier, o.identifier, true) && compareDeep(coverage, o.coverage, true)
3886          && compareDeep(businessArrangement, o.businessArrangement, true)
3887          && compareDeep(preAuthRef, o.preAuthRef, true) && compareDeep(claimResponse, o.claimResponse, true);
3888    }
3889
3890    @Override
3891    public boolean equalsShallow(Base other_) {
3892      if (!super.equalsShallow(other_))
3893        return false;
3894      if (!(other_ instanceof InsuranceComponent))
3895        return false;
3896      InsuranceComponent o = (InsuranceComponent) other_;
3897      return compareValues(sequence, o.sequence, true) && compareValues(focal, o.focal, true)
3898          && compareValues(businessArrangement, o.businessArrangement, true)
3899          && compareValues(preAuthRef, o.preAuthRef, true);
3900    }
3901
3902    public boolean isEmpty() {
3903      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, focal, identifier, coverage,
3904          businessArrangement, preAuthRef, claimResponse);
3905    }
3906
3907    public String fhirType() {
3908      return "Claim.insurance";
3909
3910    }
3911
3912  }
3913
3914  @Block()
3915  public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
3916    /**
3917     * Date of an accident event related to the products and services contained in
3918     * the claim.
3919     */
3920    @Child(name = "date", type = { DateType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
3921    @Description(shortDefinition = "When the incident occurred", formalDefinition = "Date of an accident event  related to the products and services contained in the claim.")
3922    protected DateType date;
3923
3924    /**
3925     * The type or context of the accident event for the purposes of selection of
3926     * potential insurance coverages and determination of coordination between
3927     * insurers.
3928     */
3929    @Child(name = "type", type = {
3930        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
3931    @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.")
3932    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://terminology.hl7.org/ValueSet/v3-ActIncidentCode")
3933    protected CodeableConcept type;
3934
3935    /**
3936     * The physical location of the accident event.
3937     */
3938    @Child(name = "location", type = { Address.class,
3939        Location.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
3940    @Description(shortDefinition = "Where the event occurred", formalDefinition = "The physical location of the accident event.")
3941    protected Type location;
3942
3943    private static final long serialVersionUID = 622904984L;
3944
3945    /**
3946     * Constructor
3947     */
3948    public AccidentComponent() {
3949      super();
3950    }
3951
3952    /**
3953     * Constructor
3954     */
3955    public AccidentComponent(DateType date) {
3956      super();
3957      this.date = date;
3958    }
3959
3960    /**
3961     * @return {@link #date} (Date of an accident event related to the products and
3962     *         services contained in the claim.). This is the underlying object with
3963     *         id, value and extensions. The accessor "getDate" gives direct access
3964     *         to the value
3965     */
3966    public DateType getDateElement() {
3967      if (this.date == null)
3968        if (Configuration.errorOnAutoCreate())
3969          throw new Error("Attempt to auto-create AccidentComponent.date");
3970        else if (Configuration.doAutoCreate())
3971          this.date = new DateType(); // bb
3972      return this.date;
3973    }
3974
3975    public boolean hasDateElement() {
3976      return this.date != null && !this.date.isEmpty();
3977    }
3978
3979    public boolean hasDate() {
3980      return this.date != null && !this.date.isEmpty();
3981    }
3982
3983    /**
3984     * @param value {@link #date} (Date of an accident event related to the products
3985     *              and services contained in the claim.). This is the underlying
3986     *              object with id, value and extensions. The accessor "getDate"
3987     *              gives direct access to the value
3988     */
3989    public AccidentComponent setDateElement(DateType value) {
3990      this.date = value;
3991      return this;
3992    }
3993
3994    /**
3995     * @return Date of an accident event related to the products and services
3996     *         contained in the claim.
3997     */
3998    public Date getDate() {
3999      return this.date == null ? null : this.date.getValue();
4000    }
4001
4002    /**
4003     * @param value Date of an accident event related to the products and services
4004     *              contained in the claim.
4005     */
4006    public AccidentComponent setDate(Date value) {
4007      if (this.date == null)
4008        this.date = new DateType();
4009      this.date.setValue(value);
4010      return this;
4011    }
4012
4013    /**
4014     * @return {@link #type} (The type or context of the accident event for the
4015     *         purposes of selection of potential insurance coverages and
4016     *         determination of coordination between insurers.)
4017     */
4018    public CodeableConcept getType() {
4019      if (this.type == null)
4020        if (Configuration.errorOnAutoCreate())
4021          throw new Error("Attempt to auto-create AccidentComponent.type");
4022        else if (Configuration.doAutoCreate())
4023          this.type = new CodeableConcept(); // cc
4024      return this.type;
4025    }
4026
4027    public boolean hasType() {
4028      return this.type != null && !this.type.isEmpty();
4029    }
4030
4031    /**
4032     * @param value {@link #type} (The type or context of the accident event for the
4033     *              purposes of selection of potential insurance coverages and
4034     *              determination of coordination between insurers.)
4035     */
4036    public AccidentComponent setType(CodeableConcept value) {
4037      this.type = value;
4038      return this;
4039    }
4040
4041    /**
4042     * @return {@link #location} (The physical location of the accident event.)
4043     */
4044    public Type getLocation() {
4045      return this.location;
4046    }
4047
4048    /**
4049     * @return {@link #location} (The physical location of the accident event.)
4050     */
4051    public Address getLocationAddress() throws FHIRException {
4052      if (this.location == null)
4053        this.location = new Address();
4054      if (!(this.location instanceof Address))
4055        throw new FHIRException("Type mismatch: the type Address was expected, but "
4056            + this.location.getClass().getName() + " was encountered");
4057      return (Address) this.location;
4058    }
4059
4060    public boolean hasLocationAddress() {
4061      return this != null && this.location instanceof Address;
4062    }
4063
4064    /**
4065     * @return {@link #location} (The physical location of the accident event.)
4066     */
4067    public Reference getLocationReference() throws FHIRException {
4068      if (this.location == null)
4069        this.location = new Reference();
4070      if (!(this.location instanceof Reference))
4071        throw new FHIRException("Type mismatch: the type Reference was expected, but "
4072            + this.location.getClass().getName() + " was encountered");
4073      return (Reference) this.location;
4074    }
4075
4076    public boolean hasLocationReference() {
4077      return this != null && this.location instanceof Reference;
4078    }
4079
4080    public boolean hasLocation() {
4081      return this.location != null && !this.location.isEmpty();
4082    }
4083
4084    /**
4085     * @param value {@link #location} (The physical location of the accident event.)
4086     */
4087    public AccidentComponent setLocation(Type value) {
4088      if (value != null && !(value instanceof Address || value instanceof Reference))
4089        throw new Error("Not the right type for Claim.accident.location[x]: " + value.fhirType());
4090      this.location = value;
4091      return this;
4092    }
4093
4094    protected void listChildren(List<Property> children) {
4095      super.listChildren(children);
4096      children.add(new Property("date", "date",
4097          "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date));
4098      children.add(new Property("type", "CodeableConcept",
4099          "The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.",
4100          0, 1, type));
4101      children.add(new Property("location[x]", "Address|Reference(Location)",
4102          "The physical location of the accident event.", 0, 1, location));
4103    }
4104
4105    @Override
4106    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4107      switch (_hash) {
4108      case 3076014:
4109        /* date */ return new Property("date", "date",
4110            "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date);
4111      case 3575610:
4112        /* type */ return new Property("type", "CodeableConcept",
4113            "The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.",
4114            0, 1, type);
4115      case 552316075:
4116        /* location[x] */ return new Property("location[x]", "Address|Reference(Location)",
4117            "The physical location of the accident event.", 0, 1, location);
4118      case 1901043637:
4119        /* location */ return new Property("location[x]", "Address|Reference(Location)",
4120            "The physical location of the accident event.", 0, 1, location);
4121      case -1280020865:
4122        /* locationAddress */ return new Property("location[x]", "Address|Reference(Location)",
4123            "The physical location of the accident event.", 0, 1, location);
4124      case 755866390:
4125        /* locationReference */ return new Property("location[x]", "Address|Reference(Location)",
4126            "The physical location of the accident event.", 0, 1, location);
4127      default:
4128        return super.getNamedProperty(_hash, _name, _checkValid);
4129      }
4130
4131    }
4132
4133    @Override
4134    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4135      switch (hash) {
4136      case 3076014:
4137        /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateType
4138      case 3575610:
4139        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
4140      case 1901043637:
4141        /* location */ return this.location == null ? new Base[0] : new Base[] { this.location }; // Type
4142      default:
4143        return super.getProperty(hash, name, checkValid);
4144      }
4145
4146    }
4147
4148    @Override
4149    public Base setProperty(int hash, String name, Base value) throws FHIRException {
4150      switch (hash) {
4151      case 3076014: // date
4152        this.date = castToDate(value); // DateType
4153        return value;
4154      case 3575610: // type
4155        this.type = castToCodeableConcept(value); // CodeableConcept
4156        return value;
4157      case 1901043637: // location
4158        this.location = castToType(value); // Type
4159        return value;
4160      default:
4161        return super.setProperty(hash, name, value);
4162      }
4163
4164    }
4165
4166    @Override
4167    public Base setProperty(String name, Base value) throws FHIRException {
4168      if (name.equals("date")) {
4169        this.date = castToDate(value); // DateType
4170      } else if (name.equals("type")) {
4171        this.type = castToCodeableConcept(value); // CodeableConcept
4172      } else if (name.equals("location[x]")) {
4173        this.location = castToType(value); // Type
4174      } else
4175        return super.setProperty(name, value);
4176      return value;
4177    }
4178
4179    @Override
4180    public Base makeProperty(int hash, String name) throws FHIRException {
4181      switch (hash) {
4182      case 3076014:
4183        return getDateElement();
4184      case 3575610:
4185        return getType();
4186      case 552316075:
4187        return getLocation();
4188      case 1901043637:
4189        return getLocation();
4190      default:
4191        return super.makeProperty(hash, name);
4192      }
4193
4194    }
4195
4196    @Override
4197    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4198      switch (hash) {
4199      case 3076014:
4200        /* date */ return new String[] { "date" };
4201      case 3575610:
4202        /* type */ return new String[] { "CodeableConcept" };
4203      case 1901043637:
4204        /* location */ return new String[] { "Address", "Reference" };
4205      default:
4206        return super.getTypesForProperty(hash, name);
4207      }
4208
4209    }
4210
4211    @Override
4212    public Base addChild(String name) throws FHIRException {
4213      if (name.equals("date")) {
4214        throw new FHIRException("Cannot call addChild on a singleton property Claim.date");
4215      } else if (name.equals("type")) {
4216        this.type = new CodeableConcept();
4217        return this.type;
4218      } else if (name.equals("locationAddress")) {
4219        this.location = new Address();
4220        return this.location;
4221      } else if (name.equals("locationReference")) {
4222        this.location = new Reference();
4223        return this.location;
4224      } else
4225        return super.addChild(name);
4226    }
4227
4228    public AccidentComponent copy() {
4229      AccidentComponent dst = new AccidentComponent();
4230      copyValues(dst);
4231      return dst;
4232    }
4233
4234    public void copyValues(AccidentComponent dst) {
4235      super.copyValues(dst);
4236      dst.date = date == null ? null : date.copy();
4237      dst.type = type == null ? null : type.copy();
4238      dst.location = location == null ? null : location.copy();
4239    }
4240
4241    @Override
4242    public boolean equalsDeep(Base other_) {
4243      if (!super.equalsDeep(other_))
4244        return false;
4245      if (!(other_ instanceof AccidentComponent))
4246        return false;
4247      AccidentComponent o = (AccidentComponent) other_;
4248      return compareDeep(date, o.date, true) && compareDeep(type, o.type, true)
4249          && compareDeep(location, o.location, true);
4250    }
4251
4252    @Override
4253    public boolean equalsShallow(Base other_) {
4254      if (!super.equalsShallow(other_))
4255        return false;
4256      if (!(other_ instanceof AccidentComponent))
4257        return false;
4258      AccidentComponent o = (AccidentComponent) other_;
4259      return compareValues(date, o.date, true);
4260    }
4261
4262    public boolean isEmpty() {
4263      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
4264    }
4265
4266    public String fhirType() {
4267      return "Claim.accident";
4268
4269    }
4270
4271  }
4272
4273  @Block()
4274  public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
4275    /**
4276     * A number to uniquely identify item entries.
4277     */
4278    @Child(name = "sequence", type = {
4279        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
4280    @Description(shortDefinition = "Item instance identifier", formalDefinition = "A number to uniquely identify item entries.")
4281    protected PositiveIntType sequence;
4282
4283    /**
4284     * CareTeam members related to this service or product.
4285     */
4286    @Child(name = "careTeamSequence", type = {
4287        PositiveIntType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4288    @Description(shortDefinition = "Applicable careTeam members", formalDefinition = "CareTeam members related to this service or product.")
4289    protected List<PositiveIntType> careTeamSequence;
4290
4291    /**
4292     * Diagnosis applicable for this service or product.
4293     */
4294    @Child(name = "diagnosisSequence", type = {
4295        PositiveIntType.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4296    @Description(shortDefinition = "Applicable diagnoses", formalDefinition = "Diagnosis applicable for this service or product.")
4297    protected List<PositiveIntType> diagnosisSequence;
4298
4299    /**
4300     * Procedures applicable for this service or product.
4301     */
4302    @Child(name = "procedureSequence", type = {
4303        PositiveIntType.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4304    @Description(shortDefinition = "Applicable procedures", formalDefinition = "Procedures applicable for this service or product.")
4305    protected List<PositiveIntType> procedureSequence;
4306
4307    /**
4308     * Exceptions, special conditions and supporting information applicable for this
4309     * service or product.
4310     */
4311    @Child(name = "informationSequence", type = {
4312        PositiveIntType.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4313    @Description(shortDefinition = "Applicable exception and supporting information", formalDefinition = "Exceptions, special conditions and supporting information applicable for this service or product.")
4314    protected List<PositiveIntType> informationSequence;
4315
4316    /**
4317     * The type of revenue or cost center providing the product and/or service.
4318     */
4319    @Child(name = "revenue", type = {
4320        CodeableConcept.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
4321    @Description(shortDefinition = "Revenue or cost center code", formalDefinition = "The type of revenue or cost center providing the product and/or service.")
4322    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-revenue-center")
4323    protected CodeableConcept revenue;
4324
4325    /**
4326     * Code to identify the general type of benefits under which products and
4327     * services are provided.
4328     */
4329    @Child(name = "category", type = {
4330        CodeableConcept.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
4331    @Description(shortDefinition = "Benefit classification", formalDefinition = "Code to identify the general type of benefits under which products and services are provided.")
4332    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-benefitcategory")
4333    protected CodeableConcept category;
4334
4335    /**
4336     * When the value is a group code then this item collects a set of related claim
4337     * details, otherwise this contains the product, service, drug or other billing
4338     * code for the item.
4339     */
4340    @Child(name = "productOrService", type = {
4341        CodeableConcept.class }, order = 8, min = 1, max = 1, modifier = false, summary = false)
4342    @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.")
4343    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
4344    protected CodeableConcept productOrService;
4345
4346    /**
4347     * Item typification or modifiers codes to convey additional context for the
4348     * product or service.
4349     */
4350    @Child(name = "modifier", type = {
4351        CodeableConcept.class }, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4352    @Description(shortDefinition = "Product or service billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
4353    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
4354    protected List<CodeableConcept> modifier;
4355
4356    /**
4357     * Identifies the program under which this may be recovered.
4358     */
4359    @Child(name = "programCode", type = {
4360        CodeableConcept.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4361    @Description(shortDefinition = "Program the product or service is provided under", formalDefinition = "Identifies the program under which this may be recovered.")
4362    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-program-code")
4363    protected List<CodeableConcept> programCode;
4364
4365    /**
4366     * The date or dates when the service or product was supplied, performed or
4367     * completed.
4368     */
4369    @Child(name = "serviced", type = { DateType.class,
4370        Period.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
4371    @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.")
4372    protected Type serviced;
4373
4374    /**
4375     * Where the product or service was provided.
4376     */
4377    @Child(name = "location", type = { CodeableConcept.class, Address.class,
4378        Location.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
4379    @Description(shortDefinition = "Place of service or where product was supplied", formalDefinition = "Where the product or service was provided.")
4380    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-place")
4381    protected Type location;
4382
4383    /**
4384     * The number of repetitions of a service or product.
4385     */
4386    @Child(name = "quantity", type = {
4387        Quantity.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
4388    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
4389    protected Quantity quantity;
4390
4391    /**
4392     * If the item is not a group then this is the fee for the product or service,
4393     * otherwise this is the total of the fees for the details of the group.
4394     */
4395    @Child(name = "unitPrice", type = { Money.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
4396    @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.")
4397    protected Money unitPrice;
4398
4399    /**
4400     * A real number that represents a multiplier used in determining the overall
4401     * value of services delivered and/or goods received. The concept of a Factor
4402     * allows for a discount or surcharge multiplier to be applied to a monetary
4403     * amount.
4404     */
4405    @Child(name = "factor", type = {
4406        DecimalType.class }, order = 15, min = 0, max = 1, modifier = false, summary = false)
4407    @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.")
4408    protected DecimalType factor;
4409
4410    /**
4411     * The quantity times the unit price for an additional service or product or
4412     * charge.
4413     */
4414    @Child(name = "net", type = { Money.class }, order = 16, min = 0, max = 1, modifier = false, summary = false)
4415    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
4416    protected Money net;
4417
4418    /**
4419     * Unique Device Identifiers associated with this line item.
4420     */
4421    @Child(name = "udi", type = {
4422        Device.class }, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4423    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
4424    protected List<Reference> udi;
4425    /**
4426     * The actual objects that are the target of the reference (Unique Device
4427     * Identifiers associated with this line item.)
4428     */
4429    protected List<Device> udiTarget;
4430
4431    /**
4432     * Physical service site on the patient (limb, tooth, etc.).
4433     */
4434    @Child(name = "bodySite", type = {
4435        CodeableConcept.class }, order = 18, min = 0, max = 1, modifier = false, summary = false)
4436    @Description(shortDefinition = "Anatomical location", formalDefinition = "Physical service site on the patient (limb, tooth, etc.).")
4437    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/tooth")
4438    protected CodeableConcept bodySite;
4439
4440    /**
4441     * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
4442     */
4443    @Child(name = "subSite", type = {
4444        CodeableConcept.class }, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4445    @Description(shortDefinition = "Anatomical sub-location", formalDefinition = "A region or surface of the bodySite, e.g. limb region or tooth surface(s).")
4446    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/surface")
4447    protected List<CodeableConcept> subSite;
4448
4449    /**
4450     * The Encounters during which this Claim was created or to which the creation
4451     * of this record is tightly associated.
4452     */
4453    @Child(name = "encounter", type = {
4454        Encounter.class }, order = 20, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4455    @Description(shortDefinition = "Encounters related to this billed item", formalDefinition = "The Encounters during which this Claim was created or to which the creation of this record is tightly associated.")
4456    protected List<Reference> encounter;
4457    /**
4458     * The actual objects that are the target of the reference (The Encounters
4459     * during which this Claim was created or to which the creation of this record
4460     * is tightly associated.)
4461     */
4462    protected List<Encounter> encounterTarget;
4463
4464    /**
4465     * A claim detail line. Either a simple (a product or service) or a 'group' of
4466     * sub-details which are simple items.
4467     */
4468    @Child(name = "detail", type = {}, order = 21, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4469    @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.")
4470    protected List<DetailComponent> detail;
4471
4472    private static final long serialVersionUID = -329028323L;
4473
4474    /**
4475     * Constructor
4476     */
4477    public ItemComponent() {
4478      super();
4479    }
4480
4481    /**
4482     * Constructor
4483     */
4484    public ItemComponent(PositiveIntType sequence, CodeableConcept productOrService) {
4485      super();
4486      this.sequence = sequence;
4487      this.productOrService = productOrService;
4488    }
4489
4490    /**
4491     * @return {@link #sequence} (A number to uniquely identify item entries.). This
4492     *         is the underlying object with id, value and extensions. The accessor
4493     *         "getSequence" gives direct access to the value
4494     */
4495    public PositiveIntType getSequenceElement() {
4496      if (this.sequence == null)
4497        if (Configuration.errorOnAutoCreate())
4498          throw new Error("Attempt to auto-create ItemComponent.sequence");
4499        else if (Configuration.doAutoCreate())
4500          this.sequence = new PositiveIntType(); // bb
4501      return this.sequence;
4502    }
4503
4504    public boolean hasSequenceElement() {
4505      return this.sequence != null && !this.sequence.isEmpty();
4506    }
4507
4508    public boolean hasSequence() {
4509      return this.sequence != null && !this.sequence.isEmpty();
4510    }
4511
4512    /**
4513     * @param value {@link #sequence} (A number to uniquely identify item entries.).
4514     *              This is the underlying object with id, value and extensions. The
4515     *              accessor "getSequence" gives direct access to the value
4516     */
4517    public ItemComponent setSequenceElement(PositiveIntType value) {
4518      this.sequence = value;
4519      return this;
4520    }
4521
4522    /**
4523     * @return A number to uniquely identify item entries.
4524     */
4525    public int getSequence() {
4526      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
4527    }
4528
4529    /**
4530     * @param value A number to uniquely identify item entries.
4531     */
4532    public ItemComponent setSequence(int value) {
4533      if (this.sequence == null)
4534        this.sequence = new PositiveIntType();
4535      this.sequence.setValue(value);
4536      return this;
4537    }
4538
4539    /**
4540     * @return {@link #careTeamSequence} (CareTeam members related to this service
4541     *         or product.)
4542     */
4543    public List<PositiveIntType> getCareTeamSequence() {
4544      if (this.careTeamSequence == null)
4545        this.careTeamSequence = new ArrayList<PositiveIntType>();
4546      return this.careTeamSequence;
4547    }
4548
4549    /**
4550     * @return Returns a reference to <code>this</code> for easy method chaining
4551     */
4552    public ItemComponent setCareTeamSequence(List<PositiveIntType> theCareTeamSequence) {
4553      this.careTeamSequence = theCareTeamSequence;
4554      return this;
4555    }
4556
4557    public boolean hasCareTeamSequence() {
4558      if (this.careTeamSequence == null)
4559        return false;
4560      for (PositiveIntType item : this.careTeamSequence)
4561        if (!item.isEmpty())
4562          return true;
4563      return false;
4564    }
4565
4566    /**
4567     * @return {@link #careTeamSequence} (CareTeam members related to this service
4568     *         or product.)
4569     */
4570    public PositiveIntType addCareTeamSequenceElement() {// 2
4571      PositiveIntType t = new PositiveIntType();
4572      if (this.careTeamSequence == null)
4573        this.careTeamSequence = new ArrayList<PositiveIntType>();
4574      this.careTeamSequence.add(t);
4575      return t;
4576    }
4577
4578    /**
4579     * @param value {@link #careTeamSequence} (CareTeam members related to this
4580     *              service or product.)
4581     */
4582    public ItemComponent addCareTeamSequence(int value) { // 1
4583      PositiveIntType t = new PositiveIntType();
4584      t.setValue(value);
4585      if (this.careTeamSequence == null)
4586        this.careTeamSequence = new ArrayList<PositiveIntType>();
4587      this.careTeamSequence.add(t);
4588      return this;
4589    }
4590
4591    /**
4592     * @param value {@link #careTeamSequence} (CareTeam members related to this
4593     *              service or product.)
4594     */
4595    public boolean hasCareTeamSequence(int value) {
4596      if (this.careTeamSequence == null)
4597        return false;
4598      for (PositiveIntType v : this.careTeamSequence)
4599        if (v.getValue().equals(value)) // positiveInt
4600          return true;
4601      return false;
4602    }
4603
4604    /**
4605     * @return {@link #diagnosisSequence} (Diagnosis applicable for this service or
4606     *         product.)
4607     */
4608    public List<PositiveIntType> getDiagnosisSequence() {
4609      if (this.diagnosisSequence == null)
4610        this.diagnosisSequence = new ArrayList<PositiveIntType>();
4611      return this.diagnosisSequence;
4612    }
4613
4614    /**
4615     * @return Returns a reference to <code>this</code> for easy method chaining
4616     */
4617    public ItemComponent setDiagnosisSequence(List<PositiveIntType> theDiagnosisSequence) {
4618      this.diagnosisSequence = theDiagnosisSequence;
4619      return this;
4620    }
4621
4622    public boolean hasDiagnosisSequence() {
4623      if (this.diagnosisSequence == null)
4624        return false;
4625      for (PositiveIntType item : this.diagnosisSequence)
4626        if (!item.isEmpty())
4627          return true;
4628      return false;
4629    }
4630
4631    /**
4632     * @return {@link #diagnosisSequence} (Diagnosis applicable for this service or
4633     *         product.)
4634     */
4635    public PositiveIntType addDiagnosisSequenceElement() {// 2
4636      PositiveIntType t = new PositiveIntType();
4637      if (this.diagnosisSequence == null)
4638        this.diagnosisSequence = new ArrayList<PositiveIntType>();
4639      this.diagnosisSequence.add(t);
4640      return t;
4641    }
4642
4643    /**
4644     * @param value {@link #diagnosisSequence} (Diagnosis applicable for this
4645     *              service or product.)
4646     */
4647    public ItemComponent addDiagnosisSequence(int value) { // 1
4648      PositiveIntType t = new PositiveIntType();
4649      t.setValue(value);
4650      if (this.diagnosisSequence == null)
4651        this.diagnosisSequence = new ArrayList<PositiveIntType>();
4652      this.diagnosisSequence.add(t);
4653      return this;
4654    }
4655
4656    /**
4657     * @param value {@link #diagnosisSequence} (Diagnosis applicable for this
4658     *              service or product.)
4659     */
4660    public boolean hasDiagnosisSequence(int value) {
4661      if (this.diagnosisSequence == null)
4662        return false;
4663      for (PositiveIntType v : this.diagnosisSequence)
4664        if (v.getValue().equals(value)) // positiveInt
4665          return true;
4666      return false;
4667    }
4668
4669    /**
4670     * @return {@link #procedureSequence} (Procedures applicable for this service or
4671     *         product.)
4672     */
4673    public List<PositiveIntType> getProcedureSequence() {
4674      if (this.procedureSequence == null)
4675        this.procedureSequence = new ArrayList<PositiveIntType>();
4676      return this.procedureSequence;
4677    }
4678
4679    /**
4680     * @return Returns a reference to <code>this</code> for easy method chaining
4681     */
4682    public ItemComponent setProcedureSequence(List<PositiveIntType> theProcedureSequence) {
4683      this.procedureSequence = theProcedureSequence;
4684      return this;
4685    }
4686
4687    public boolean hasProcedureSequence() {
4688      if (this.procedureSequence == null)
4689        return false;
4690      for (PositiveIntType item : this.procedureSequence)
4691        if (!item.isEmpty())
4692          return true;
4693      return false;
4694    }
4695
4696    /**
4697     * @return {@link #procedureSequence} (Procedures applicable for this service or
4698     *         product.)
4699     */
4700    public PositiveIntType addProcedureSequenceElement() {// 2
4701      PositiveIntType t = new PositiveIntType();
4702      if (this.procedureSequence == null)
4703        this.procedureSequence = new ArrayList<PositiveIntType>();
4704      this.procedureSequence.add(t);
4705      return t;
4706    }
4707
4708    /**
4709     * @param value {@link #procedureSequence} (Procedures applicable for this
4710     *              service or product.)
4711     */
4712    public ItemComponent addProcedureSequence(int value) { // 1
4713      PositiveIntType t = new PositiveIntType();
4714      t.setValue(value);
4715      if (this.procedureSequence == null)
4716        this.procedureSequence = new ArrayList<PositiveIntType>();
4717      this.procedureSequence.add(t);
4718      return this;
4719    }
4720
4721    /**
4722     * @param value {@link #procedureSequence} (Procedures applicable for this
4723     *              service or product.)
4724     */
4725    public boolean hasProcedureSequence(int value) {
4726      if (this.procedureSequence == null)
4727        return false;
4728      for (PositiveIntType v : this.procedureSequence)
4729        if (v.getValue().equals(value)) // positiveInt
4730          return true;
4731      return false;
4732    }
4733
4734    /**
4735     * @return {@link #informationSequence} (Exceptions, special conditions and
4736     *         supporting information applicable for this service or product.)
4737     */
4738    public List<PositiveIntType> getInformationSequence() {
4739      if (this.informationSequence == null)
4740        this.informationSequence = new ArrayList<PositiveIntType>();
4741      return this.informationSequence;
4742    }
4743
4744    /**
4745     * @return Returns a reference to <code>this</code> for easy method chaining
4746     */
4747    public ItemComponent setInformationSequence(List<PositiveIntType> theInformationSequence) {
4748      this.informationSequence = theInformationSequence;
4749      return this;
4750    }
4751
4752    public boolean hasInformationSequence() {
4753      if (this.informationSequence == null)
4754        return false;
4755      for (PositiveIntType item : this.informationSequence)
4756        if (!item.isEmpty())
4757          return true;
4758      return false;
4759    }
4760
4761    /**
4762     * @return {@link #informationSequence} (Exceptions, special conditions and
4763     *         supporting information applicable for this service or product.)
4764     */
4765    public PositiveIntType addInformationSequenceElement() {// 2
4766      PositiveIntType t = new PositiveIntType();
4767      if (this.informationSequence == null)
4768        this.informationSequence = new ArrayList<PositiveIntType>();
4769      this.informationSequence.add(t);
4770      return t;
4771    }
4772
4773    /**
4774     * @param value {@link #informationSequence} (Exceptions, special conditions and
4775     *              supporting information applicable for this service or product.)
4776     */
4777    public ItemComponent addInformationSequence(int value) { // 1
4778      PositiveIntType t = new PositiveIntType();
4779      t.setValue(value);
4780      if (this.informationSequence == null)
4781        this.informationSequence = new ArrayList<PositiveIntType>();
4782      this.informationSequence.add(t);
4783      return this;
4784    }
4785
4786    /**
4787     * @param value {@link #informationSequence} (Exceptions, special conditions and
4788     *              supporting information applicable for this service or product.)
4789     */
4790    public boolean hasInformationSequence(int value) {
4791      if (this.informationSequence == null)
4792        return false;
4793      for (PositiveIntType v : this.informationSequence)
4794        if (v.getValue().equals(value)) // positiveInt
4795          return true;
4796      return false;
4797    }
4798
4799    /**
4800     * @return {@link #revenue} (The type of revenue or cost center providing the
4801     *         product and/or service.)
4802     */
4803    public CodeableConcept getRevenue() {
4804      if (this.revenue == null)
4805        if (Configuration.errorOnAutoCreate())
4806          throw new Error("Attempt to auto-create ItemComponent.revenue");
4807        else if (Configuration.doAutoCreate())
4808          this.revenue = new CodeableConcept(); // cc
4809      return this.revenue;
4810    }
4811
4812    public boolean hasRevenue() {
4813      return this.revenue != null && !this.revenue.isEmpty();
4814    }
4815
4816    /**
4817     * @param value {@link #revenue} (The type of revenue or cost center providing
4818     *              the product and/or service.)
4819     */
4820    public ItemComponent setRevenue(CodeableConcept value) {
4821      this.revenue = value;
4822      return this;
4823    }
4824
4825    /**
4826     * @return {@link #category} (Code to identify the general type of benefits
4827     *         under which products and services are provided.)
4828     */
4829    public CodeableConcept getCategory() {
4830      if (this.category == null)
4831        if (Configuration.errorOnAutoCreate())
4832          throw new Error("Attempt to auto-create ItemComponent.category");
4833        else if (Configuration.doAutoCreate())
4834          this.category = new CodeableConcept(); // cc
4835      return this.category;
4836    }
4837
4838    public boolean hasCategory() {
4839      return this.category != null && !this.category.isEmpty();
4840    }
4841
4842    /**
4843     * @param value {@link #category} (Code to identify the general type of benefits
4844     *              under which products and services are provided.)
4845     */
4846    public ItemComponent setCategory(CodeableConcept value) {
4847      this.category = value;
4848      return this;
4849    }
4850
4851    /**
4852     * @return {@link #productOrService} (When the value is a group code then this
4853     *         item collects a set of related claim details, otherwise this contains
4854     *         the product, service, drug or other billing code for the item.)
4855     */
4856    public CodeableConcept getProductOrService() {
4857      if (this.productOrService == null)
4858        if (Configuration.errorOnAutoCreate())
4859          throw new Error("Attempt to auto-create ItemComponent.productOrService");
4860        else if (Configuration.doAutoCreate())
4861          this.productOrService = new CodeableConcept(); // cc
4862      return this.productOrService;
4863    }
4864
4865    public boolean hasProductOrService() {
4866      return this.productOrService != null && !this.productOrService.isEmpty();
4867    }
4868
4869    /**
4870     * @param value {@link #productOrService} (When the value is a group code then
4871     *              this item collects a set of related claim details, otherwise
4872     *              this contains the product, service, drug or other billing code
4873     *              for the item.)
4874     */
4875    public ItemComponent setProductOrService(CodeableConcept value) {
4876      this.productOrService = value;
4877      return this;
4878    }
4879
4880    /**
4881     * @return {@link #modifier} (Item typification or modifiers codes to convey
4882     *         additional context for the product or service.)
4883     */
4884    public List<CodeableConcept> getModifier() {
4885      if (this.modifier == null)
4886        this.modifier = new ArrayList<CodeableConcept>();
4887      return this.modifier;
4888    }
4889
4890    /**
4891     * @return Returns a reference to <code>this</code> for easy method chaining
4892     */
4893    public ItemComponent setModifier(List<CodeableConcept> theModifier) {
4894      this.modifier = theModifier;
4895      return this;
4896    }
4897
4898    public boolean hasModifier() {
4899      if (this.modifier == null)
4900        return false;
4901      for (CodeableConcept item : this.modifier)
4902        if (!item.isEmpty())
4903          return true;
4904      return false;
4905    }
4906
4907    public CodeableConcept addModifier() { // 3
4908      CodeableConcept t = new CodeableConcept();
4909      if (this.modifier == null)
4910        this.modifier = new ArrayList<CodeableConcept>();
4911      this.modifier.add(t);
4912      return t;
4913    }
4914
4915    public ItemComponent addModifier(CodeableConcept t) { // 3
4916      if (t == null)
4917        return this;
4918      if (this.modifier == null)
4919        this.modifier = new ArrayList<CodeableConcept>();
4920      this.modifier.add(t);
4921      return this;
4922    }
4923
4924    /**
4925     * @return The first repetition of repeating field {@link #modifier}, creating
4926     *         it if it does not already exist
4927     */
4928    public CodeableConcept getModifierFirstRep() {
4929      if (getModifier().isEmpty()) {
4930        addModifier();
4931      }
4932      return getModifier().get(0);
4933    }
4934
4935    /**
4936     * @return {@link #programCode} (Identifies the program under which this may be
4937     *         recovered.)
4938     */
4939    public List<CodeableConcept> getProgramCode() {
4940      if (this.programCode == null)
4941        this.programCode = new ArrayList<CodeableConcept>();
4942      return this.programCode;
4943    }
4944
4945    /**
4946     * @return Returns a reference to <code>this</code> for easy method chaining
4947     */
4948    public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) {
4949      this.programCode = theProgramCode;
4950      return this;
4951    }
4952
4953    public boolean hasProgramCode() {
4954      if (this.programCode == null)
4955        return false;
4956      for (CodeableConcept item : this.programCode)
4957        if (!item.isEmpty())
4958          return true;
4959      return false;
4960    }
4961
4962    public CodeableConcept addProgramCode() { // 3
4963      CodeableConcept t = new CodeableConcept();
4964      if (this.programCode == null)
4965        this.programCode = new ArrayList<CodeableConcept>();
4966      this.programCode.add(t);
4967      return t;
4968    }
4969
4970    public ItemComponent addProgramCode(CodeableConcept t) { // 3
4971      if (t == null)
4972        return this;
4973      if (this.programCode == null)
4974        this.programCode = new ArrayList<CodeableConcept>();
4975      this.programCode.add(t);
4976      return this;
4977    }
4978
4979    /**
4980     * @return The first repetition of repeating field {@link #programCode},
4981     *         creating it if it does not already exist
4982     */
4983    public CodeableConcept getProgramCodeFirstRep() {
4984      if (getProgramCode().isEmpty()) {
4985        addProgramCode();
4986      }
4987      return getProgramCode().get(0);
4988    }
4989
4990    /**
4991     * @return {@link #serviced} (The date or dates when the service or product was
4992     *         supplied, performed or completed.)
4993     */
4994    public Type getServiced() {
4995      return this.serviced;
4996    }
4997
4998    /**
4999     * @return {@link #serviced} (The date or dates when the service or product was
5000     *         supplied, performed or completed.)
5001     */
5002    public DateType getServicedDateType() throws FHIRException {
5003      if (this.serviced == null)
5004        this.serviced = new DateType();
5005      if (!(this.serviced instanceof DateType))
5006        throw new FHIRException("Type mismatch: the type DateType was expected, but "
5007            + this.serviced.getClass().getName() + " was encountered");
5008      return (DateType) this.serviced;
5009    }
5010
5011    public boolean hasServicedDateType() {
5012      return this != null && this.serviced instanceof DateType;
5013    }
5014
5015    /**
5016     * @return {@link #serviced} (The date or dates when the service or product was
5017     *         supplied, performed or completed.)
5018     */
5019    public Period getServicedPeriod() throws FHIRException {
5020      if (this.serviced == null)
5021        this.serviced = new Period();
5022      if (!(this.serviced instanceof Period))
5023        throw new FHIRException("Type mismatch: the type Period was expected, but " + this.serviced.getClass().getName()
5024            + " was encountered");
5025      return (Period) this.serviced;
5026    }
5027
5028    public boolean hasServicedPeriod() {
5029      return this != null && this.serviced instanceof Period;
5030    }
5031
5032    public boolean hasServiced() {
5033      return this.serviced != null && !this.serviced.isEmpty();
5034    }
5035
5036    /**
5037     * @param value {@link #serviced} (The date or dates when the service or product
5038     *              was supplied, performed or completed.)
5039     */
5040    public ItemComponent setServiced(Type value) {
5041      if (value != null && !(value instanceof DateType || value instanceof Period))
5042        throw new Error("Not the right type for Claim.item.serviced[x]: " + value.fhirType());
5043      this.serviced = value;
5044      return this;
5045    }
5046
5047    /**
5048     * @return {@link #location} (Where the product or service was provided.)
5049     */
5050    public Type getLocation() {
5051      return this.location;
5052    }
5053
5054    /**
5055     * @return {@link #location} (Where the product or service was provided.)
5056     */
5057    public CodeableConcept getLocationCodeableConcept() throws FHIRException {
5058      if (this.location == null)
5059        this.location = new CodeableConcept();
5060      if (!(this.location instanceof CodeableConcept))
5061        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
5062            + this.location.getClass().getName() + " was encountered");
5063      return (CodeableConcept) this.location;
5064    }
5065
5066    public boolean hasLocationCodeableConcept() {
5067      return this != null && this.location instanceof CodeableConcept;
5068    }
5069
5070    /**
5071     * @return {@link #location} (Where the product or service was provided.)
5072     */
5073    public Address getLocationAddress() throws FHIRException {
5074      if (this.location == null)
5075        this.location = new Address();
5076      if (!(this.location instanceof Address))
5077        throw new FHIRException("Type mismatch: the type Address was expected, but "
5078            + this.location.getClass().getName() + " was encountered");
5079      return (Address) this.location;
5080    }
5081
5082    public boolean hasLocationAddress() {
5083      return this != null && this.location instanceof Address;
5084    }
5085
5086    /**
5087     * @return {@link #location} (Where the product or service was provided.)
5088     */
5089    public Reference getLocationReference() throws FHIRException {
5090      if (this.location == null)
5091        this.location = new Reference();
5092      if (!(this.location instanceof Reference))
5093        throw new FHIRException("Type mismatch: the type Reference was expected, but "
5094            + this.location.getClass().getName() + " was encountered");
5095      return (Reference) this.location;
5096    }
5097
5098    public boolean hasLocationReference() {
5099      return this != null && this.location instanceof Reference;
5100    }
5101
5102    public boolean hasLocation() {
5103      return this.location != null && !this.location.isEmpty();
5104    }
5105
5106    /**
5107     * @param value {@link #location} (Where the product or service was provided.)
5108     */
5109    public ItemComponent setLocation(Type value) {
5110      if (value != null
5111          && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
5112        throw new Error("Not the right type for Claim.item.location[x]: " + value.fhirType());
5113      this.location = value;
5114      return this;
5115    }
5116
5117    /**
5118     * @return {@link #quantity} (The number of repetitions of a service or
5119     *         product.)
5120     */
5121    public Quantity getQuantity() {
5122      if (this.quantity == null)
5123        if (Configuration.errorOnAutoCreate())
5124          throw new Error("Attempt to auto-create ItemComponent.quantity");
5125        else if (Configuration.doAutoCreate())
5126          this.quantity = new Quantity(); // cc
5127      return this.quantity;
5128    }
5129
5130    public boolean hasQuantity() {
5131      return this.quantity != null && !this.quantity.isEmpty();
5132    }
5133
5134    /**
5135     * @param value {@link #quantity} (The number of repetitions of a service or
5136     *              product.)
5137     */
5138    public ItemComponent setQuantity(Quantity value) {
5139      this.quantity = value;
5140      return this;
5141    }
5142
5143    /**
5144     * @return {@link #unitPrice} (If the item is not a group then this is the fee
5145     *         for the product or service, otherwise this is the total of the fees
5146     *         for the details of the group.)
5147     */
5148    public Money getUnitPrice() {
5149      if (this.unitPrice == null)
5150        if (Configuration.errorOnAutoCreate())
5151          throw new Error("Attempt to auto-create ItemComponent.unitPrice");
5152        else if (Configuration.doAutoCreate())
5153          this.unitPrice = new Money(); // cc
5154      return this.unitPrice;
5155    }
5156
5157    public boolean hasUnitPrice() {
5158      return this.unitPrice != null && !this.unitPrice.isEmpty();
5159    }
5160
5161    /**
5162     * @param value {@link #unitPrice} (If the item is not a group then this is the
5163     *              fee for the product or service, otherwise this is the total of
5164     *              the fees for the details of the group.)
5165     */
5166    public ItemComponent setUnitPrice(Money value) {
5167      this.unitPrice = value;
5168      return this;
5169    }
5170
5171    /**
5172     * @return {@link #factor} (A real number that represents a multiplier used in
5173     *         determining the overall value of services delivered and/or goods
5174     *         received. The concept of a Factor allows for a discount or surcharge
5175     *         multiplier to be applied to a monetary amount.). This is the
5176     *         underlying object with id, value and extensions. The accessor
5177     *         "getFactor" gives direct access to the value
5178     */
5179    public DecimalType getFactorElement() {
5180      if (this.factor == null)
5181        if (Configuration.errorOnAutoCreate())
5182          throw new Error("Attempt to auto-create ItemComponent.factor");
5183        else if (Configuration.doAutoCreate())
5184          this.factor = new DecimalType(); // bb
5185      return this.factor;
5186    }
5187
5188    public boolean hasFactorElement() {
5189      return this.factor != null && !this.factor.isEmpty();
5190    }
5191
5192    public boolean hasFactor() {
5193      return this.factor != null && !this.factor.isEmpty();
5194    }
5195
5196    /**
5197     * @param value {@link #factor} (A real number that represents a multiplier used
5198     *              in determining the overall value of services delivered and/or
5199     *              goods received. The concept of a Factor allows for a discount or
5200     *              surcharge multiplier to be applied to a monetary amount.). This
5201     *              is the underlying object with id, value and extensions. The
5202     *              accessor "getFactor" gives direct access to the value
5203     */
5204    public ItemComponent setFactorElement(DecimalType value) {
5205      this.factor = value;
5206      return this;
5207    }
5208
5209    /**
5210     * @return A real number that represents a multiplier used in determining the
5211     *         overall value of services delivered and/or goods received. The
5212     *         concept of a Factor allows for a discount or surcharge multiplier to
5213     *         be applied to a monetary amount.
5214     */
5215    public BigDecimal getFactor() {
5216      return this.factor == null ? null : this.factor.getValue();
5217    }
5218
5219    /**
5220     * @param value A real number that represents a multiplier used in determining
5221     *              the overall value of services delivered and/or goods received.
5222     *              The concept of a Factor allows for a discount or surcharge
5223     *              multiplier to be applied to a monetary amount.
5224     */
5225    public ItemComponent setFactor(BigDecimal value) {
5226      if (value == null)
5227        this.factor = null;
5228      else {
5229        if (this.factor == null)
5230          this.factor = new DecimalType();
5231        this.factor.setValue(value);
5232      }
5233      return this;
5234    }
5235
5236    /**
5237     * @param value A real number that represents a multiplier used in determining
5238     *              the overall value of services delivered and/or goods received.
5239     *              The concept of a Factor allows for a discount or surcharge
5240     *              multiplier to be applied to a monetary amount.
5241     */
5242    public ItemComponent setFactor(long value) {
5243      this.factor = new DecimalType();
5244      this.factor.setValue(value);
5245      return this;
5246    }
5247
5248    /**
5249     * @param value A real number that represents a multiplier used in determining
5250     *              the overall value of services delivered and/or goods received.
5251     *              The concept of a Factor allows for a discount or surcharge
5252     *              multiplier to be applied to a monetary amount.
5253     */
5254    public ItemComponent setFactor(double value) {
5255      this.factor = new DecimalType();
5256      this.factor.setValue(value);
5257      return this;
5258    }
5259
5260    /**
5261     * @return {@link #net} (The quantity times the unit price for an additional
5262     *         service or product or charge.)
5263     */
5264    public Money getNet() {
5265      if (this.net == null)
5266        if (Configuration.errorOnAutoCreate())
5267          throw new Error("Attempt to auto-create ItemComponent.net");
5268        else if (Configuration.doAutoCreate())
5269          this.net = new Money(); // cc
5270      return this.net;
5271    }
5272
5273    public boolean hasNet() {
5274      return this.net != null && !this.net.isEmpty();
5275    }
5276
5277    /**
5278     * @param value {@link #net} (The quantity times the unit price for an
5279     *              additional service or product or charge.)
5280     */
5281    public ItemComponent setNet(Money value) {
5282      this.net = value;
5283      return this;
5284    }
5285
5286    /**
5287     * @return {@link #udi} (Unique Device Identifiers associated with this line
5288     *         item.)
5289     */
5290    public List<Reference> getUdi() {
5291      if (this.udi == null)
5292        this.udi = new ArrayList<Reference>();
5293      return this.udi;
5294    }
5295
5296    /**
5297     * @return Returns a reference to <code>this</code> for easy method chaining
5298     */
5299    public ItemComponent setUdi(List<Reference> theUdi) {
5300      this.udi = theUdi;
5301      return this;
5302    }
5303
5304    public boolean hasUdi() {
5305      if (this.udi == null)
5306        return false;
5307      for (Reference item : this.udi)
5308        if (!item.isEmpty())
5309          return true;
5310      return false;
5311    }
5312
5313    public Reference addUdi() { // 3
5314      Reference t = new Reference();
5315      if (this.udi == null)
5316        this.udi = new ArrayList<Reference>();
5317      this.udi.add(t);
5318      return t;
5319    }
5320
5321    public ItemComponent addUdi(Reference t) { // 3
5322      if (t == null)
5323        return this;
5324      if (this.udi == null)
5325        this.udi = new ArrayList<Reference>();
5326      this.udi.add(t);
5327      return this;
5328    }
5329
5330    /**
5331     * @return The first repetition of repeating field {@link #udi}, creating it if
5332     *         it does not already exist
5333     */
5334    public Reference getUdiFirstRep() {
5335      if (getUdi().isEmpty()) {
5336        addUdi();
5337      }
5338      return getUdi().get(0);
5339    }
5340
5341    /**
5342     * @deprecated Use Reference#setResource(IBaseResource) instead
5343     */
5344    @Deprecated
5345    public List<Device> getUdiTarget() {
5346      if (this.udiTarget == null)
5347        this.udiTarget = new ArrayList<Device>();
5348      return this.udiTarget;
5349    }
5350
5351    /**
5352     * @deprecated Use Reference#setResource(IBaseResource) instead
5353     */
5354    @Deprecated
5355    public Device addUdiTarget() {
5356      Device r = new Device();
5357      if (this.udiTarget == null)
5358        this.udiTarget = new ArrayList<Device>();
5359      this.udiTarget.add(r);
5360      return r;
5361    }
5362
5363    /**
5364     * @return {@link #bodySite} (Physical service site on the patient (limb, tooth,
5365     *         etc.).)
5366     */
5367    public CodeableConcept getBodySite() {
5368      if (this.bodySite == null)
5369        if (Configuration.errorOnAutoCreate())
5370          throw new Error("Attempt to auto-create ItemComponent.bodySite");
5371        else if (Configuration.doAutoCreate())
5372          this.bodySite = new CodeableConcept(); // cc
5373      return this.bodySite;
5374    }
5375
5376    public boolean hasBodySite() {
5377      return this.bodySite != null && !this.bodySite.isEmpty();
5378    }
5379
5380    /**
5381     * @param value {@link #bodySite} (Physical service site on the patient (limb,
5382     *              tooth, etc.).)
5383     */
5384    public ItemComponent setBodySite(CodeableConcept value) {
5385      this.bodySite = value;
5386      return this;
5387    }
5388
5389    /**
5390     * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb
5391     *         region or tooth surface(s).)
5392     */
5393    public List<CodeableConcept> getSubSite() {
5394      if (this.subSite == null)
5395        this.subSite = new ArrayList<CodeableConcept>();
5396      return this.subSite;
5397    }
5398
5399    /**
5400     * @return Returns a reference to <code>this</code> for easy method chaining
5401     */
5402    public ItemComponent setSubSite(List<CodeableConcept> theSubSite) {
5403      this.subSite = theSubSite;
5404      return this;
5405    }
5406
5407    public boolean hasSubSite() {
5408      if (this.subSite == null)
5409        return false;
5410      for (CodeableConcept item : this.subSite)
5411        if (!item.isEmpty())
5412          return true;
5413      return false;
5414    }
5415
5416    public CodeableConcept addSubSite() { // 3
5417      CodeableConcept t = new CodeableConcept();
5418      if (this.subSite == null)
5419        this.subSite = new ArrayList<CodeableConcept>();
5420      this.subSite.add(t);
5421      return t;
5422    }
5423
5424    public ItemComponent addSubSite(CodeableConcept t) { // 3
5425      if (t == null)
5426        return this;
5427      if (this.subSite == null)
5428        this.subSite = new ArrayList<CodeableConcept>();
5429      this.subSite.add(t);
5430      return this;
5431    }
5432
5433    /**
5434     * @return The first repetition of repeating field {@link #subSite}, creating it
5435     *         if it does not already exist
5436     */
5437    public CodeableConcept getSubSiteFirstRep() {
5438      if (getSubSite().isEmpty()) {
5439        addSubSite();
5440      }
5441      return getSubSite().get(0);
5442    }
5443
5444    /**
5445     * @return {@link #encounter} (The Encounters during which this Claim was
5446     *         created or to which the creation of this record is tightly
5447     *         associated.)
5448     */
5449    public List<Reference> getEncounter() {
5450      if (this.encounter == null)
5451        this.encounter = new ArrayList<Reference>();
5452      return this.encounter;
5453    }
5454
5455    /**
5456     * @return Returns a reference to <code>this</code> for easy method chaining
5457     */
5458    public ItemComponent setEncounter(List<Reference> theEncounter) {
5459      this.encounter = theEncounter;
5460      return this;
5461    }
5462
5463    public boolean hasEncounter() {
5464      if (this.encounter == null)
5465        return false;
5466      for (Reference item : this.encounter)
5467        if (!item.isEmpty())
5468          return true;
5469      return false;
5470    }
5471
5472    public Reference addEncounter() { // 3
5473      Reference t = new Reference();
5474      if (this.encounter == null)
5475        this.encounter = new ArrayList<Reference>();
5476      this.encounter.add(t);
5477      return t;
5478    }
5479
5480    public ItemComponent addEncounter(Reference t) { // 3
5481      if (t == null)
5482        return this;
5483      if (this.encounter == null)
5484        this.encounter = new ArrayList<Reference>();
5485      this.encounter.add(t);
5486      return this;
5487    }
5488
5489    /**
5490     * @return The first repetition of repeating field {@link #encounter}, creating
5491     *         it if it does not already exist
5492     */
5493    public Reference getEncounterFirstRep() {
5494      if (getEncounter().isEmpty()) {
5495        addEncounter();
5496      }
5497      return getEncounter().get(0);
5498    }
5499
5500    /**
5501     * @deprecated Use Reference#setResource(IBaseResource) instead
5502     */
5503    @Deprecated
5504    public List<Encounter> getEncounterTarget() {
5505      if (this.encounterTarget == null)
5506        this.encounterTarget = new ArrayList<Encounter>();
5507      return this.encounterTarget;
5508    }
5509
5510    /**
5511     * @deprecated Use Reference#setResource(IBaseResource) instead
5512     */
5513    @Deprecated
5514    public Encounter addEncounterTarget() {
5515      Encounter r = new Encounter();
5516      if (this.encounterTarget == null)
5517        this.encounterTarget = new ArrayList<Encounter>();
5518      this.encounterTarget.add(r);
5519      return r;
5520    }
5521
5522    /**
5523     * @return {@link #detail} (A claim detail line. Either a simple (a product or
5524     *         service) or a 'group' of sub-details which are simple items.)
5525     */
5526    public List<DetailComponent> getDetail() {
5527      if (this.detail == null)
5528        this.detail = new ArrayList<DetailComponent>();
5529      return this.detail;
5530    }
5531
5532    /**
5533     * @return Returns a reference to <code>this</code> for easy method chaining
5534     */
5535    public ItemComponent setDetail(List<DetailComponent> theDetail) {
5536      this.detail = theDetail;
5537      return this;
5538    }
5539
5540    public boolean hasDetail() {
5541      if (this.detail == null)
5542        return false;
5543      for (DetailComponent item : this.detail)
5544        if (!item.isEmpty())
5545          return true;
5546      return false;
5547    }
5548
5549    public DetailComponent addDetail() { // 3
5550      DetailComponent t = new DetailComponent();
5551      if (this.detail == null)
5552        this.detail = new ArrayList<DetailComponent>();
5553      this.detail.add(t);
5554      return t;
5555    }
5556
5557    public ItemComponent addDetail(DetailComponent t) { // 3
5558      if (t == null)
5559        return this;
5560      if (this.detail == null)
5561        this.detail = new ArrayList<DetailComponent>();
5562      this.detail.add(t);
5563      return this;
5564    }
5565
5566    /**
5567     * @return The first repetition of repeating field {@link #detail}, creating it
5568     *         if it does not already exist
5569     */
5570    public DetailComponent getDetailFirstRep() {
5571      if (getDetail().isEmpty()) {
5572        addDetail();
5573      }
5574      return getDetail().get(0);
5575    }
5576
5577    protected void listChildren(List<Property> children) {
5578      super.listChildren(children);
5579      children
5580          .add(new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence));
5581      children.add(new Property("careTeamSequence", "positiveInt",
5582          "CareTeam members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence));
5583      children.add(new Property("diagnosisSequence", "positiveInt", "Diagnosis applicable for this service or product.",
5584          0, java.lang.Integer.MAX_VALUE, diagnosisSequence));
5585      children.add(new Property("procedureSequence", "positiveInt",
5586          "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence));
5587      children.add(new Property("informationSequence", "positiveInt",
5588          "Exceptions, special conditions and supporting information applicable for this service or product.", 0,
5589          java.lang.Integer.MAX_VALUE, informationSequence));
5590      children.add(new Property("revenue", "CodeableConcept",
5591          "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
5592      children.add(new Property("category", "CodeableConcept",
5593          "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
5594          category));
5595      children.add(new Property("productOrService", "CodeableConcept",
5596          "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.",
5597          0, 1, productOrService));
5598      children.add(new Property("modifier", "CodeableConcept",
5599          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
5600          java.lang.Integer.MAX_VALUE, modifier));
5601      children.add(new Property("programCode", "CodeableConcept",
5602          "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
5603      children.add(new Property("serviced[x]", "date|Period",
5604          "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced));
5605      children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5606          "Where the product or service was provided.", 0, 1, location));
5607      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
5608          1, quantity));
5609      children.add(new Property("unitPrice", "Money",
5610          "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.",
5611          0, 1, unitPrice));
5612      children.add(new Property("factor", "decimal",
5613          "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.",
5614          0, 1, factor));
5615      children.add(new Property("net", "Money",
5616          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
5617      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
5618          0, java.lang.Integer.MAX_VALUE, udi));
5619      children.add(new Property("bodySite", "CodeableConcept",
5620          "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
5621      children.add(new Property("subSite", "CodeableConcept",
5622          "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE,
5623          subSite));
5624      children.add(new Property("encounter", "Reference(Encounter)",
5625          "The Encounters during which this Claim was created or to which the creation of this record is tightly associated.",
5626          0, java.lang.Integer.MAX_VALUE, encounter));
5627      children.add(new Property("detail", "",
5628          "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
5629          0, java.lang.Integer.MAX_VALUE, detail));
5630    }
5631
5632    @Override
5633    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5634      switch (_hash) {
5635      case 1349547969:
5636        /* sequence */ return new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0,
5637            1, sequence);
5638      case 1070083823:
5639        /* careTeamSequence */ return new Property("careTeamSequence", "positiveInt",
5640            "CareTeam members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence);
5641      case -909769262:
5642        /* diagnosisSequence */ return new Property("diagnosisSequence", "positiveInt",
5643            "Diagnosis applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence);
5644      case -808920140:
5645        /* procedureSequence */ return new Property("procedureSequence", "positiveInt",
5646            "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence);
5647      case -702585587:
5648        /* informationSequence */ return new Property("informationSequence", "positiveInt",
5649            "Exceptions, special conditions and supporting information applicable for this service or product.", 0,
5650            java.lang.Integer.MAX_VALUE, informationSequence);
5651      case 1099842588:
5652        /* revenue */ return new Property("revenue", "CodeableConcept",
5653            "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
5654      case 50511102:
5655        /* category */ return new Property("category", "CodeableConcept",
5656            "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
5657            category);
5658      case 1957227299:
5659        /* productOrService */ return new Property("productOrService", "CodeableConcept",
5660            "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.",
5661            0, 1, productOrService);
5662      case -615513385:
5663        /* modifier */ return new Property("modifier", "CodeableConcept",
5664            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
5665            java.lang.Integer.MAX_VALUE, modifier);
5666      case 1010065041:
5667        /* programCode */ return new Property("programCode", "CodeableConcept",
5668            "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
5669      case -1927922223:
5670        /* serviced[x] */ return new Property("serviced[x]", "date|Period",
5671            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5672      case 1379209295:
5673        /* serviced */ return new Property("serviced[x]", "date|Period",
5674            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5675      case 363246749:
5676        /* servicedDate */ return new Property("serviced[x]", "date|Period",
5677            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5678      case 1534966512:
5679        /* servicedPeriod */ return new Property("serviced[x]", "date|Period",
5680            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5681      case 552316075:
5682        /* location[x] */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5683            "Where the product or service was provided.", 0, 1, location);
5684      case 1901043637:
5685        /* location */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5686            "Where the product or service was provided.", 0, 1, location);
5687      case -1224800468:
5688        /* locationCodeableConcept */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5689            "Where the product or service was provided.", 0, 1, location);
5690      case -1280020865:
5691        /* locationAddress */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5692            "Where the product or service was provided.", 0, 1, location);
5693      case 755866390:
5694        /* locationReference */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5695            "Where the product or service was provided.", 0, 1, location);
5696      case -1285004149:
5697        /* quantity */ return new Property("quantity", "SimpleQuantity",
5698            "The number of repetitions of a service or product.", 0, 1, quantity);
5699      case -486196699:
5700        /* unitPrice */ return new Property("unitPrice", "Money",
5701            "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.",
5702            0, 1, unitPrice);
5703      case -1282148017:
5704        /* factor */ return new Property("factor", "decimal",
5705            "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.",
5706            0, 1, factor);
5707      case 108957:
5708        /* net */ return new Property("net", "Money",
5709            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
5710      case 115642:
5711        /* udi */ return new Property("udi", "Reference(Device)",
5712            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
5713      case 1702620169:
5714        /* bodySite */ return new Property("bodySite", "CodeableConcept",
5715            "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
5716      case -1868566105:
5717        /* subSite */ return new Property("subSite", "CodeableConcept",
5718            "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0,
5719            java.lang.Integer.MAX_VALUE, subSite);
5720      case 1524132147:
5721        /* encounter */ return new Property("encounter", "Reference(Encounter)",
5722            "The Encounters during which this Claim was created or to which the creation of this record is tightly associated.",
5723            0, java.lang.Integer.MAX_VALUE, encounter);
5724      case -1335224239:
5725        /* detail */ return new Property("detail", "",
5726            "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
5727            0, java.lang.Integer.MAX_VALUE, detail);
5728      default:
5729        return super.getNamedProperty(_hash, _name, _checkValid);
5730      }
5731
5732    }
5733
5734    @Override
5735    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5736      switch (hash) {
5737      case 1349547969:
5738        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
5739      case 1070083823:
5740        /* careTeamSequence */ return this.careTeamSequence == null ? new Base[0]
5741            : this.careTeamSequence.toArray(new Base[this.careTeamSequence.size()]); // PositiveIntType
5742      case -909769262:
5743        /* diagnosisSequence */ return this.diagnosisSequence == null ? new Base[0]
5744            : this.diagnosisSequence.toArray(new Base[this.diagnosisSequence.size()]); // PositiveIntType
5745      case -808920140:
5746        /* procedureSequence */ return this.procedureSequence == null ? new Base[0]
5747            : this.procedureSequence.toArray(new Base[this.procedureSequence.size()]); // PositiveIntType
5748      case -702585587:
5749        /* informationSequence */ return this.informationSequence == null ? new Base[0]
5750            : this.informationSequence.toArray(new Base[this.informationSequence.size()]); // PositiveIntType
5751      case 1099842588:
5752        /* revenue */ return this.revenue == null ? new Base[0] : new Base[] { this.revenue }; // CodeableConcept
5753      case 50511102:
5754        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
5755      case 1957227299:
5756        /* productOrService */ return this.productOrService == null ? new Base[0]
5757            : new Base[] { this.productOrService }; // CodeableConcept
5758      case -615513385:
5759        /* modifier */ return this.modifier == null ? new Base[0]
5760            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
5761      case 1010065041:
5762        /* programCode */ return this.programCode == null ? new Base[0]
5763            : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
5764      case 1379209295:
5765        /* serviced */ return this.serviced == null ? new Base[0] : new Base[] { this.serviced }; // Type
5766      case 1901043637:
5767        /* location */ return this.location == null ? new Base[0] : new Base[] { this.location }; // Type
5768      case -1285004149:
5769        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
5770      case -486196699:
5771        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
5772      case -1282148017:
5773        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
5774      case 108957:
5775        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
5776      case 115642:
5777        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
5778      case 1702620169:
5779        /* bodySite */ return this.bodySite == null ? new Base[0] : new Base[] { this.bodySite }; // CodeableConcept
5780      case -1868566105:
5781        /* subSite */ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
5782      case 1524132147:
5783        /* encounter */ return this.encounter == null ? new Base[0]
5784            : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
5785      case -1335224239:
5786        /* detail */ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
5787      default:
5788        return super.getProperty(hash, name, checkValid);
5789      }
5790
5791    }
5792
5793    @Override
5794    public Base setProperty(int hash, String name, Base value) throws FHIRException {
5795      switch (hash) {
5796      case 1349547969: // sequence
5797        this.sequence = castToPositiveInt(value); // PositiveIntType
5798        return value;
5799      case 1070083823: // careTeamSequence
5800        this.getCareTeamSequence().add(castToPositiveInt(value)); // PositiveIntType
5801        return value;
5802      case -909769262: // diagnosisSequence
5803        this.getDiagnosisSequence().add(castToPositiveInt(value)); // PositiveIntType
5804        return value;
5805      case -808920140: // procedureSequence
5806        this.getProcedureSequence().add(castToPositiveInt(value)); // PositiveIntType
5807        return value;
5808      case -702585587: // informationSequence
5809        this.getInformationSequence().add(castToPositiveInt(value)); // PositiveIntType
5810        return value;
5811      case 1099842588: // revenue
5812        this.revenue = castToCodeableConcept(value); // CodeableConcept
5813        return value;
5814      case 50511102: // category
5815        this.category = castToCodeableConcept(value); // CodeableConcept
5816        return value;
5817      case 1957227299: // productOrService
5818        this.productOrService = castToCodeableConcept(value); // CodeableConcept
5819        return value;
5820      case -615513385: // modifier
5821        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
5822        return value;
5823      case 1010065041: // programCode
5824        this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
5825        return value;
5826      case 1379209295: // serviced
5827        this.serviced = castToType(value); // Type
5828        return value;
5829      case 1901043637: // location
5830        this.location = castToType(value); // Type
5831        return value;
5832      case -1285004149: // quantity
5833        this.quantity = castToQuantity(value); // Quantity
5834        return value;
5835      case -486196699: // unitPrice
5836        this.unitPrice = castToMoney(value); // Money
5837        return value;
5838      case -1282148017: // factor
5839        this.factor = castToDecimal(value); // DecimalType
5840        return value;
5841      case 108957: // net
5842        this.net = castToMoney(value); // Money
5843        return value;
5844      case 115642: // udi
5845        this.getUdi().add(castToReference(value)); // Reference
5846        return value;
5847      case 1702620169: // bodySite
5848        this.bodySite = castToCodeableConcept(value); // CodeableConcept
5849        return value;
5850      case -1868566105: // subSite
5851        this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
5852        return value;
5853      case 1524132147: // encounter
5854        this.getEncounter().add(castToReference(value)); // Reference
5855        return value;
5856      case -1335224239: // detail
5857        this.getDetail().add((DetailComponent) value); // DetailComponent
5858        return value;
5859      default:
5860        return super.setProperty(hash, name, value);
5861      }
5862
5863    }
5864
5865    @Override
5866    public Base setProperty(String name, Base value) throws FHIRException {
5867      if (name.equals("sequence")) {
5868        this.sequence = castToPositiveInt(value); // PositiveIntType
5869      } else if (name.equals("careTeamSequence")) {
5870        this.getCareTeamSequence().add(castToPositiveInt(value));
5871      } else if (name.equals("diagnosisSequence")) {
5872        this.getDiagnosisSequence().add(castToPositiveInt(value));
5873      } else if (name.equals("procedureSequence")) {
5874        this.getProcedureSequence().add(castToPositiveInt(value));
5875      } else if (name.equals("informationSequence")) {
5876        this.getInformationSequence().add(castToPositiveInt(value));
5877      } else if (name.equals("revenue")) {
5878        this.revenue = castToCodeableConcept(value); // CodeableConcept
5879      } else if (name.equals("category")) {
5880        this.category = castToCodeableConcept(value); // CodeableConcept
5881      } else if (name.equals("productOrService")) {
5882        this.productOrService = castToCodeableConcept(value); // CodeableConcept
5883      } else if (name.equals("modifier")) {
5884        this.getModifier().add(castToCodeableConcept(value));
5885      } else if (name.equals("programCode")) {
5886        this.getProgramCode().add(castToCodeableConcept(value));
5887      } else if (name.equals("serviced[x]")) {
5888        this.serviced = castToType(value); // Type
5889      } else if (name.equals("location[x]")) {
5890        this.location = castToType(value); // Type
5891      } else if (name.equals("quantity")) {
5892        this.quantity = castToQuantity(value); // Quantity
5893      } else if (name.equals("unitPrice")) {
5894        this.unitPrice = castToMoney(value); // Money
5895      } else if (name.equals("factor")) {
5896        this.factor = castToDecimal(value); // DecimalType
5897      } else if (name.equals("net")) {
5898        this.net = castToMoney(value); // Money
5899      } else if (name.equals("udi")) {
5900        this.getUdi().add(castToReference(value));
5901      } else if (name.equals("bodySite")) {
5902        this.bodySite = castToCodeableConcept(value); // CodeableConcept
5903      } else if (name.equals("subSite")) {
5904        this.getSubSite().add(castToCodeableConcept(value));
5905      } else if (name.equals("encounter")) {
5906        this.getEncounter().add(castToReference(value));
5907      } else if (name.equals("detail")) {
5908        this.getDetail().add((DetailComponent) value);
5909      } else
5910        return super.setProperty(name, value);
5911      return value;
5912    }
5913
5914    @Override
5915    public Base makeProperty(int hash, String name) throws FHIRException {
5916      switch (hash) {
5917      case 1349547969:
5918        return getSequenceElement();
5919      case 1070083823:
5920        return addCareTeamSequenceElement();
5921      case -909769262:
5922        return addDiagnosisSequenceElement();
5923      case -808920140:
5924        return addProcedureSequenceElement();
5925      case -702585587:
5926        return addInformationSequenceElement();
5927      case 1099842588:
5928        return getRevenue();
5929      case 50511102:
5930        return getCategory();
5931      case 1957227299:
5932        return getProductOrService();
5933      case -615513385:
5934        return addModifier();
5935      case 1010065041:
5936        return addProgramCode();
5937      case -1927922223:
5938        return getServiced();
5939      case 1379209295:
5940        return getServiced();
5941      case 552316075:
5942        return getLocation();
5943      case 1901043637:
5944        return getLocation();
5945      case -1285004149:
5946        return getQuantity();
5947      case -486196699:
5948        return getUnitPrice();
5949      case -1282148017:
5950        return getFactorElement();
5951      case 108957:
5952        return getNet();
5953      case 115642:
5954        return addUdi();
5955      case 1702620169:
5956        return getBodySite();
5957      case -1868566105:
5958        return addSubSite();
5959      case 1524132147:
5960        return addEncounter();
5961      case -1335224239:
5962        return addDetail();
5963      default:
5964        return super.makeProperty(hash, name);
5965      }
5966
5967    }
5968
5969    @Override
5970    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5971      switch (hash) {
5972      case 1349547969:
5973        /* sequence */ return new String[] { "positiveInt" };
5974      case 1070083823:
5975        /* careTeamSequence */ return new String[] { "positiveInt" };
5976      case -909769262:
5977        /* diagnosisSequence */ return new String[] { "positiveInt" };
5978      case -808920140:
5979        /* procedureSequence */ return new String[] { "positiveInt" };
5980      case -702585587:
5981        /* informationSequence */ return new String[] { "positiveInt" };
5982      case 1099842588:
5983        /* revenue */ return new String[] { "CodeableConcept" };
5984      case 50511102:
5985        /* category */ return new String[] { "CodeableConcept" };
5986      case 1957227299:
5987        /* productOrService */ return new String[] { "CodeableConcept" };
5988      case -615513385:
5989        /* modifier */ return new String[] { "CodeableConcept" };
5990      case 1010065041:
5991        /* programCode */ return new String[] { "CodeableConcept" };
5992      case 1379209295:
5993        /* serviced */ return new String[] { "date", "Period" };
5994      case 1901043637:
5995        /* location */ return new String[] { "CodeableConcept", "Address", "Reference" };
5996      case -1285004149:
5997        /* quantity */ return new String[] { "SimpleQuantity" };
5998      case -486196699:
5999        /* unitPrice */ return new String[] { "Money" };
6000      case -1282148017:
6001        /* factor */ return new String[] { "decimal" };
6002      case 108957:
6003        /* net */ return new String[] { "Money" };
6004      case 115642:
6005        /* udi */ return new String[] { "Reference" };
6006      case 1702620169:
6007        /* bodySite */ return new String[] { "CodeableConcept" };
6008      case -1868566105:
6009        /* subSite */ return new String[] { "CodeableConcept" };
6010      case 1524132147:
6011        /* encounter */ return new String[] { "Reference" };
6012      case -1335224239:
6013        /* detail */ return new String[] {};
6014      default:
6015        return super.getTypesForProperty(hash, name);
6016      }
6017
6018    }
6019
6020    @Override
6021    public Base addChild(String name) throws FHIRException {
6022      if (name.equals("sequence")) {
6023        throw new FHIRException("Cannot call addChild on a singleton property Claim.sequence");
6024      } else if (name.equals("careTeamSequence")) {
6025        throw new FHIRException("Cannot call addChild on a singleton property Claim.careTeamSequence");
6026      } else if (name.equals("diagnosisSequence")) {
6027        throw new FHIRException("Cannot call addChild on a singleton property Claim.diagnosisSequence");
6028      } else if (name.equals("procedureSequence")) {
6029        throw new FHIRException("Cannot call addChild on a singleton property Claim.procedureSequence");
6030      } else if (name.equals("informationSequence")) {
6031        throw new FHIRException("Cannot call addChild on a singleton property Claim.informationSequence");
6032      } else if (name.equals("revenue")) {
6033        this.revenue = new CodeableConcept();
6034        return this.revenue;
6035      } else if (name.equals("category")) {
6036        this.category = new CodeableConcept();
6037        return this.category;
6038      } else if (name.equals("productOrService")) {
6039        this.productOrService = new CodeableConcept();
6040        return this.productOrService;
6041      } else if (name.equals("modifier")) {
6042        return addModifier();
6043      } else if (name.equals("programCode")) {
6044        return addProgramCode();
6045      } else if (name.equals("servicedDate")) {
6046        this.serviced = new DateType();
6047        return this.serviced;
6048      } else if (name.equals("servicedPeriod")) {
6049        this.serviced = new Period();
6050        return this.serviced;
6051      } else if (name.equals("locationCodeableConcept")) {
6052        this.location = new CodeableConcept();
6053        return this.location;
6054      } else if (name.equals("locationAddress")) {
6055        this.location = new Address();
6056        return this.location;
6057      } else if (name.equals("locationReference")) {
6058        this.location = new Reference();
6059        return this.location;
6060      } else if (name.equals("quantity")) {
6061        this.quantity = new Quantity();
6062        return this.quantity;
6063      } else if (name.equals("unitPrice")) {
6064        this.unitPrice = new Money();
6065        return this.unitPrice;
6066      } else if (name.equals("factor")) {
6067        throw new FHIRException("Cannot call addChild on a singleton property Claim.factor");
6068      } else if (name.equals("net")) {
6069        this.net = new Money();
6070        return this.net;
6071      } else if (name.equals("udi")) {
6072        return addUdi();
6073      } else if (name.equals("bodySite")) {
6074        this.bodySite = new CodeableConcept();
6075        return this.bodySite;
6076      } else if (name.equals("subSite")) {
6077        return addSubSite();
6078      } else if (name.equals("encounter")) {
6079        return addEncounter();
6080      } else if (name.equals("detail")) {
6081        return addDetail();
6082      } else
6083        return super.addChild(name);
6084    }
6085
6086    public ItemComponent copy() {
6087      ItemComponent dst = new ItemComponent();
6088      copyValues(dst);
6089      return dst;
6090    }
6091
6092    public void copyValues(ItemComponent dst) {
6093      super.copyValues(dst);
6094      dst.sequence = sequence == null ? null : sequence.copy();
6095      if (careTeamSequence != null) {
6096        dst.careTeamSequence = new ArrayList<PositiveIntType>();
6097        for (PositiveIntType i : careTeamSequence)
6098          dst.careTeamSequence.add(i.copy());
6099      }
6100      ;
6101      if (diagnosisSequence != null) {
6102        dst.diagnosisSequence = new ArrayList<PositiveIntType>();
6103        for (PositiveIntType i : diagnosisSequence)
6104          dst.diagnosisSequence.add(i.copy());
6105      }
6106      ;
6107      if (procedureSequence != null) {
6108        dst.procedureSequence = new ArrayList<PositiveIntType>();
6109        for (PositiveIntType i : procedureSequence)
6110          dst.procedureSequence.add(i.copy());
6111      }
6112      ;
6113      if (informationSequence != null) {
6114        dst.informationSequence = new ArrayList<PositiveIntType>();
6115        for (PositiveIntType i : informationSequence)
6116          dst.informationSequence.add(i.copy());
6117      }
6118      ;
6119      dst.revenue = revenue == null ? null : revenue.copy();
6120      dst.category = category == null ? null : category.copy();
6121      dst.productOrService = productOrService == null ? null : productOrService.copy();
6122      if (modifier != null) {
6123        dst.modifier = new ArrayList<CodeableConcept>();
6124        for (CodeableConcept i : modifier)
6125          dst.modifier.add(i.copy());
6126      }
6127      ;
6128      if (programCode != null) {
6129        dst.programCode = new ArrayList<CodeableConcept>();
6130        for (CodeableConcept i : programCode)
6131          dst.programCode.add(i.copy());
6132      }
6133      ;
6134      dst.serviced = serviced == null ? null : serviced.copy();
6135      dst.location = location == null ? null : location.copy();
6136      dst.quantity = quantity == null ? null : quantity.copy();
6137      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6138      dst.factor = factor == null ? null : factor.copy();
6139      dst.net = net == null ? null : net.copy();
6140      if (udi != null) {
6141        dst.udi = new ArrayList<Reference>();
6142        for (Reference i : udi)
6143          dst.udi.add(i.copy());
6144      }
6145      ;
6146      dst.bodySite = bodySite == null ? null : bodySite.copy();
6147      if (subSite != null) {
6148        dst.subSite = new ArrayList<CodeableConcept>();
6149        for (CodeableConcept i : subSite)
6150          dst.subSite.add(i.copy());
6151      }
6152      ;
6153      if (encounter != null) {
6154        dst.encounter = new ArrayList<Reference>();
6155        for (Reference i : encounter)
6156          dst.encounter.add(i.copy());
6157      }
6158      ;
6159      if (detail != null) {
6160        dst.detail = new ArrayList<DetailComponent>();
6161        for (DetailComponent i : detail)
6162          dst.detail.add(i.copy());
6163      }
6164      ;
6165    }
6166
6167    @Override
6168    public boolean equalsDeep(Base other_) {
6169      if (!super.equalsDeep(other_))
6170        return false;
6171      if (!(other_ instanceof ItemComponent))
6172        return false;
6173      ItemComponent o = (ItemComponent) other_;
6174      return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamSequence, o.careTeamSequence, true)
6175          && compareDeep(diagnosisSequence, o.diagnosisSequence, true)
6176          && compareDeep(procedureSequence, o.procedureSequence, true)
6177          && compareDeep(informationSequence, o.informationSequence, true) && compareDeep(revenue, o.revenue, true)
6178          && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
6179          && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
6180          && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
6181          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
6182          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
6183          && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true)
6184          && compareDeep(encounter, o.encounter, true) && compareDeep(detail, o.detail, true);
6185    }
6186
6187    @Override
6188    public boolean equalsShallow(Base other_) {
6189      if (!super.equalsShallow(other_))
6190        return false;
6191      if (!(other_ instanceof ItemComponent))
6192        return false;
6193      ItemComponent o = (ItemComponent) other_;
6194      return compareValues(sequence, o.sequence, true) && compareValues(careTeamSequence, o.careTeamSequence, true)
6195          && compareValues(diagnosisSequence, o.diagnosisSequence, true)
6196          && compareValues(procedureSequence, o.procedureSequence, true)
6197          && compareValues(informationSequence, o.informationSequence, true) && compareValues(factor, o.factor, true);
6198    }
6199
6200    public boolean isEmpty() {
6201      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamSequence, diagnosisSequence,
6202          procedureSequence, informationSequence, revenue, category, productOrService, modifier, programCode, serviced,
6203          location, quantity, unitPrice, factor, net, udi, bodySite, subSite, encounter, detail);
6204    }
6205
6206    public String fhirType() {
6207      return "Claim.item";
6208
6209    }
6210
6211  }
6212
6213  @Block()
6214  public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
6215    /**
6216     * A number to uniquely identify item entries.
6217     */
6218    @Child(name = "sequence", type = {
6219        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
6220    @Description(shortDefinition = "Item instance identifier", formalDefinition = "A number to uniquely identify item entries.")
6221    protected PositiveIntType sequence;
6222
6223    /**
6224     * The type of revenue or cost center providing the product and/or service.
6225     */
6226    @Child(name = "revenue", type = {
6227        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
6228    @Description(shortDefinition = "Revenue or cost center code", formalDefinition = "The type of revenue or cost center providing the product and/or service.")
6229    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-revenue-center")
6230    protected CodeableConcept revenue;
6231
6232    /**
6233     * Code to identify the general type of benefits under which products and
6234     * services are provided.
6235     */
6236    @Child(name = "category", type = {
6237        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
6238    @Description(shortDefinition = "Benefit classification", formalDefinition = "Code to identify the general type of benefits under which products and services are provided.")
6239    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-benefitcategory")
6240    protected CodeableConcept category;
6241
6242    /**
6243     * When the value is a group code then this item collects a set of related claim
6244     * details, otherwise this contains the product, service, drug or other billing
6245     * code for the item.
6246     */
6247    @Child(name = "productOrService", type = {
6248        CodeableConcept.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
6249    @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.")
6250    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
6251    protected CodeableConcept productOrService;
6252
6253    /**
6254     * Item typification or modifiers codes to convey additional context for the
6255     * product or service.
6256     */
6257    @Child(name = "modifier", type = {
6258        CodeableConcept.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6259    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
6260    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
6261    protected List<CodeableConcept> modifier;
6262
6263    /**
6264     * Identifies the program under which this may be recovered.
6265     */
6266    @Child(name = "programCode", type = {
6267        CodeableConcept.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6268    @Description(shortDefinition = "Program the product or service is provided under", formalDefinition = "Identifies the program under which this may be recovered.")
6269    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-program-code")
6270    protected List<CodeableConcept> programCode;
6271
6272    /**
6273     * The number of repetitions of a service or product.
6274     */
6275    @Child(name = "quantity", type = { Quantity.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
6276    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
6277    protected Quantity quantity;
6278
6279    /**
6280     * If the item is not a group then this is the fee for the product or service,
6281     * otherwise this is the total of the fees for the details of the group.
6282     */
6283    @Child(name = "unitPrice", type = { Money.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
6284    @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.")
6285    protected Money unitPrice;
6286
6287    /**
6288     * A real number that represents a multiplier used in determining the overall
6289     * value of services delivered and/or goods received. The concept of a Factor
6290     * allows for a discount or surcharge multiplier to be applied to a monetary
6291     * amount.
6292     */
6293    @Child(name = "factor", type = {
6294        DecimalType.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
6295    @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.")
6296    protected DecimalType factor;
6297
6298    /**
6299     * The quantity times the unit price for an additional service or product or
6300     * charge.
6301     */
6302    @Child(name = "net", type = { Money.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
6303    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
6304    protected Money net;
6305
6306    /**
6307     * Unique Device Identifiers associated with this line item.
6308     */
6309    @Child(name = "udi", type = {
6310        Device.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6311    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
6312    protected List<Reference> udi;
6313    /**
6314     * The actual objects that are the target of the reference (Unique Device
6315     * Identifiers associated with this line item.)
6316     */
6317    protected List<Device> udiTarget;
6318
6319    /**
6320     * A claim detail line. Either a simple (a product or service) or a 'group' of
6321     * sub-details which are simple items.
6322     */
6323    @Child(name = "subDetail", type = {}, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6324    @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.")
6325    protected List<SubDetailComponent> subDetail;
6326
6327    private static final long serialVersionUID = -1245004924L;
6328
6329    /**
6330     * Constructor
6331     */
6332    public DetailComponent() {
6333      super();
6334    }
6335
6336    /**
6337     * Constructor
6338     */
6339    public DetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
6340      super();
6341      this.sequence = sequence;
6342      this.productOrService = productOrService;
6343    }
6344
6345    /**
6346     * @return {@link #sequence} (A number to uniquely identify item entries.). This
6347     *         is the underlying object with id, value and extensions. The accessor
6348     *         "getSequence" gives direct access to the value
6349     */
6350    public PositiveIntType getSequenceElement() {
6351      if (this.sequence == null)
6352        if (Configuration.errorOnAutoCreate())
6353          throw new Error("Attempt to auto-create DetailComponent.sequence");
6354        else if (Configuration.doAutoCreate())
6355          this.sequence = new PositiveIntType(); // bb
6356      return this.sequence;
6357    }
6358
6359    public boolean hasSequenceElement() {
6360      return this.sequence != null && !this.sequence.isEmpty();
6361    }
6362
6363    public boolean hasSequence() {
6364      return this.sequence != null && !this.sequence.isEmpty();
6365    }
6366
6367    /**
6368     * @param value {@link #sequence} (A number to uniquely identify item entries.).
6369     *              This is the underlying object with id, value and extensions. The
6370     *              accessor "getSequence" gives direct access to the value
6371     */
6372    public DetailComponent setSequenceElement(PositiveIntType value) {
6373      this.sequence = value;
6374      return this;
6375    }
6376
6377    /**
6378     * @return A number to uniquely identify item entries.
6379     */
6380    public int getSequence() {
6381      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
6382    }
6383
6384    /**
6385     * @param value A number to uniquely identify item entries.
6386     */
6387    public DetailComponent setSequence(int value) {
6388      if (this.sequence == null)
6389        this.sequence = new PositiveIntType();
6390      this.sequence.setValue(value);
6391      return this;
6392    }
6393
6394    /**
6395     * @return {@link #revenue} (The type of revenue or cost center providing the
6396     *         product and/or service.)
6397     */
6398    public CodeableConcept getRevenue() {
6399      if (this.revenue == null)
6400        if (Configuration.errorOnAutoCreate())
6401          throw new Error("Attempt to auto-create DetailComponent.revenue");
6402        else if (Configuration.doAutoCreate())
6403          this.revenue = new CodeableConcept(); // cc
6404      return this.revenue;
6405    }
6406
6407    public boolean hasRevenue() {
6408      return this.revenue != null && !this.revenue.isEmpty();
6409    }
6410
6411    /**
6412     * @param value {@link #revenue} (The type of revenue or cost center providing
6413     *              the product and/or service.)
6414     */
6415    public DetailComponent setRevenue(CodeableConcept value) {
6416      this.revenue = value;
6417      return this;
6418    }
6419
6420    /**
6421     * @return {@link #category} (Code to identify the general type of benefits
6422     *         under which products and services are provided.)
6423     */
6424    public CodeableConcept getCategory() {
6425      if (this.category == null)
6426        if (Configuration.errorOnAutoCreate())
6427          throw new Error("Attempt to auto-create DetailComponent.category");
6428        else if (Configuration.doAutoCreate())
6429          this.category = new CodeableConcept(); // cc
6430      return this.category;
6431    }
6432
6433    public boolean hasCategory() {
6434      return this.category != null && !this.category.isEmpty();
6435    }
6436
6437    /**
6438     * @param value {@link #category} (Code to identify the general type of benefits
6439     *              under which products and services are provided.)
6440     */
6441    public DetailComponent setCategory(CodeableConcept value) {
6442      this.category = value;
6443      return this;
6444    }
6445
6446    /**
6447     * @return {@link #productOrService} (When the value is a group code then this
6448     *         item collects a set of related claim details, otherwise this contains
6449     *         the product, service, drug or other billing code for the item.)
6450     */
6451    public CodeableConcept getProductOrService() {
6452      if (this.productOrService == null)
6453        if (Configuration.errorOnAutoCreate())
6454          throw new Error("Attempt to auto-create DetailComponent.productOrService");
6455        else if (Configuration.doAutoCreate())
6456          this.productOrService = new CodeableConcept(); // cc
6457      return this.productOrService;
6458    }
6459
6460    public boolean hasProductOrService() {
6461      return this.productOrService != null && !this.productOrService.isEmpty();
6462    }
6463
6464    /**
6465     * @param value {@link #productOrService} (When the value is a group code then
6466     *              this item collects a set of related claim details, otherwise
6467     *              this contains the product, service, drug or other billing code
6468     *              for the item.)
6469     */
6470    public DetailComponent setProductOrService(CodeableConcept value) {
6471      this.productOrService = value;
6472      return this;
6473    }
6474
6475    /**
6476     * @return {@link #modifier} (Item typification or modifiers codes to convey
6477     *         additional context for the product or service.)
6478     */
6479    public List<CodeableConcept> getModifier() {
6480      if (this.modifier == null)
6481        this.modifier = new ArrayList<CodeableConcept>();
6482      return this.modifier;
6483    }
6484
6485    /**
6486     * @return Returns a reference to <code>this</code> for easy method chaining
6487     */
6488    public DetailComponent setModifier(List<CodeableConcept> theModifier) {
6489      this.modifier = theModifier;
6490      return this;
6491    }
6492
6493    public boolean hasModifier() {
6494      if (this.modifier == null)
6495        return false;
6496      for (CodeableConcept item : this.modifier)
6497        if (!item.isEmpty())
6498          return true;
6499      return false;
6500    }
6501
6502    public CodeableConcept addModifier() { // 3
6503      CodeableConcept t = new CodeableConcept();
6504      if (this.modifier == null)
6505        this.modifier = new ArrayList<CodeableConcept>();
6506      this.modifier.add(t);
6507      return t;
6508    }
6509
6510    public DetailComponent addModifier(CodeableConcept t) { // 3
6511      if (t == null)
6512        return this;
6513      if (this.modifier == null)
6514        this.modifier = new ArrayList<CodeableConcept>();
6515      this.modifier.add(t);
6516      return this;
6517    }
6518
6519    /**
6520     * @return The first repetition of repeating field {@link #modifier}, creating
6521     *         it if it does not already exist
6522     */
6523    public CodeableConcept getModifierFirstRep() {
6524      if (getModifier().isEmpty()) {
6525        addModifier();
6526      }
6527      return getModifier().get(0);
6528    }
6529
6530    /**
6531     * @return {@link #programCode} (Identifies the program under which this may be
6532     *         recovered.)
6533     */
6534    public List<CodeableConcept> getProgramCode() {
6535      if (this.programCode == null)
6536        this.programCode = new ArrayList<CodeableConcept>();
6537      return this.programCode;
6538    }
6539
6540    /**
6541     * @return Returns a reference to <code>this</code> for easy method chaining
6542     */
6543    public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) {
6544      this.programCode = theProgramCode;
6545      return this;
6546    }
6547
6548    public boolean hasProgramCode() {
6549      if (this.programCode == null)
6550        return false;
6551      for (CodeableConcept item : this.programCode)
6552        if (!item.isEmpty())
6553          return true;
6554      return false;
6555    }
6556
6557    public CodeableConcept addProgramCode() { // 3
6558      CodeableConcept t = new CodeableConcept();
6559      if (this.programCode == null)
6560        this.programCode = new ArrayList<CodeableConcept>();
6561      this.programCode.add(t);
6562      return t;
6563    }
6564
6565    public DetailComponent addProgramCode(CodeableConcept t) { // 3
6566      if (t == null)
6567        return this;
6568      if (this.programCode == null)
6569        this.programCode = new ArrayList<CodeableConcept>();
6570      this.programCode.add(t);
6571      return this;
6572    }
6573
6574    /**
6575     * @return The first repetition of repeating field {@link #programCode},
6576     *         creating it if it does not already exist
6577     */
6578    public CodeableConcept getProgramCodeFirstRep() {
6579      if (getProgramCode().isEmpty()) {
6580        addProgramCode();
6581      }
6582      return getProgramCode().get(0);
6583    }
6584
6585    /**
6586     * @return {@link #quantity} (The number of repetitions of a service or
6587     *         product.)
6588     */
6589    public Quantity getQuantity() {
6590      if (this.quantity == null)
6591        if (Configuration.errorOnAutoCreate())
6592          throw new Error("Attempt to auto-create DetailComponent.quantity");
6593        else if (Configuration.doAutoCreate())
6594          this.quantity = new Quantity(); // cc
6595      return this.quantity;
6596    }
6597
6598    public boolean hasQuantity() {
6599      return this.quantity != null && !this.quantity.isEmpty();
6600    }
6601
6602    /**
6603     * @param value {@link #quantity} (The number of repetitions of a service or
6604     *              product.)
6605     */
6606    public DetailComponent setQuantity(Quantity value) {
6607      this.quantity = value;
6608      return this;
6609    }
6610
6611    /**
6612     * @return {@link #unitPrice} (If the item is not a group then this is the fee
6613     *         for the product or service, otherwise this is the total of the fees
6614     *         for the details of the group.)
6615     */
6616    public Money getUnitPrice() {
6617      if (this.unitPrice == null)
6618        if (Configuration.errorOnAutoCreate())
6619          throw new Error("Attempt to auto-create DetailComponent.unitPrice");
6620        else if (Configuration.doAutoCreate())
6621          this.unitPrice = new Money(); // cc
6622      return this.unitPrice;
6623    }
6624
6625    public boolean hasUnitPrice() {
6626      return this.unitPrice != null && !this.unitPrice.isEmpty();
6627    }
6628
6629    /**
6630     * @param value {@link #unitPrice} (If the item is not a group then this is the
6631     *              fee for the product or service, otherwise this is the total of
6632     *              the fees for the details of the group.)
6633     */
6634    public DetailComponent setUnitPrice(Money value) {
6635      this.unitPrice = value;
6636      return this;
6637    }
6638
6639    /**
6640     * @return {@link #factor} (A real number that represents a multiplier used in
6641     *         determining the overall value of services delivered and/or goods
6642     *         received. The concept of a Factor allows for a discount or surcharge
6643     *         multiplier to be applied to a monetary amount.). This is the
6644     *         underlying object with id, value and extensions. The accessor
6645     *         "getFactor" gives direct access to the value
6646     */
6647    public DecimalType getFactorElement() {
6648      if (this.factor == null)
6649        if (Configuration.errorOnAutoCreate())
6650          throw new Error("Attempt to auto-create DetailComponent.factor");
6651        else if (Configuration.doAutoCreate())
6652          this.factor = new DecimalType(); // bb
6653      return this.factor;
6654    }
6655
6656    public boolean hasFactorElement() {
6657      return this.factor != null && !this.factor.isEmpty();
6658    }
6659
6660    public boolean hasFactor() {
6661      return this.factor != null && !this.factor.isEmpty();
6662    }
6663
6664    /**
6665     * @param value {@link #factor} (A real number that represents a multiplier used
6666     *              in determining the overall value of services delivered and/or
6667     *              goods received. The concept of a Factor allows for a discount or
6668     *              surcharge multiplier to be applied to a monetary amount.). This
6669     *              is the underlying object with id, value and extensions. The
6670     *              accessor "getFactor" gives direct access to the value
6671     */
6672    public DetailComponent setFactorElement(DecimalType value) {
6673      this.factor = value;
6674      return this;
6675    }
6676
6677    /**
6678     * @return A real number that represents a multiplier used in determining the
6679     *         overall value of services delivered and/or goods received. The
6680     *         concept of a Factor allows for a discount or surcharge multiplier to
6681     *         be applied to a monetary amount.
6682     */
6683    public BigDecimal getFactor() {
6684      return this.factor == null ? null : this.factor.getValue();
6685    }
6686
6687    /**
6688     * @param value A real number that represents a multiplier used in determining
6689     *              the overall value of services delivered and/or goods received.
6690     *              The concept of a Factor allows for a discount or surcharge
6691     *              multiplier to be applied to a monetary amount.
6692     */
6693    public DetailComponent setFactor(BigDecimal value) {
6694      if (value == null)
6695        this.factor = null;
6696      else {
6697        if (this.factor == null)
6698          this.factor = new DecimalType();
6699        this.factor.setValue(value);
6700      }
6701      return this;
6702    }
6703
6704    /**
6705     * @param value A real number that represents a multiplier used in determining
6706     *              the overall value of services delivered and/or goods received.
6707     *              The concept of a Factor allows for a discount or surcharge
6708     *              multiplier to be applied to a monetary amount.
6709     */
6710    public DetailComponent setFactor(long value) {
6711      this.factor = new DecimalType();
6712      this.factor.setValue(value);
6713      return this;
6714    }
6715
6716    /**
6717     * @param value A real number that represents a multiplier used in determining
6718     *              the overall value of services delivered and/or goods received.
6719     *              The concept of a Factor allows for a discount or surcharge
6720     *              multiplier to be applied to a monetary amount.
6721     */
6722    public DetailComponent setFactor(double value) {
6723      this.factor = new DecimalType();
6724      this.factor.setValue(value);
6725      return this;
6726    }
6727
6728    /**
6729     * @return {@link #net} (The quantity times the unit price for an additional
6730     *         service or product or charge.)
6731     */
6732    public Money getNet() {
6733      if (this.net == null)
6734        if (Configuration.errorOnAutoCreate())
6735          throw new Error("Attempt to auto-create DetailComponent.net");
6736        else if (Configuration.doAutoCreate())
6737          this.net = new Money(); // cc
6738      return this.net;
6739    }
6740
6741    public boolean hasNet() {
6742      return this.net != null && !this.net.isEmpty();
6743    }
6744
6745    /**
6746     * @param value {@link #net} (The quantity times the unit price for an
6747     *              additional service or product or charge.)
6748     */
6749    public DetailComponent setNet(Money value) {
6750      this.net = value;
6751      return this;
6752    }
6753
6754    /**
6755     * @return {@link #udi} (Unique Device Identifiers associated with this line
6756     *         item.)
6757     */
6758    public List<Reference> getUdi() {
6759      if (this.udi == null)
6760        this.udi = new ArrayList<Reference>();
6761      return this.udi;
6762    }
6763
6764    /**
6765     * @return Returns a reference to <code>this</code> for easy method chaining
6766     */
6767    public DetailComponent setUdi(List<Reference> theUdi) {
6768      this.udi = theUdi;
6769      return this;
6770    }
6771
6772    public boolean hasUdi() {
6773      if (this.udi == null)
6774        return false;
6775      for (Reference item : this.udi)
6776        if (!item.isEmpty())
6777          return true;
6778      return false;
6779    }
6780
6781    public Reference addUdi() { // 3
6782      Reference t = new Reference();
6783      if (this.udi == null)
6784        this.udi = new ArrayList<Reference>();
6785      this.udi.add(t);
6786      return t;
6787    }
6788
6789    public DetailComponent addUdi(Reference t) { // 3
6790      if (t == null)
6791        return this;
6792      if (this.udi == null)
6793        this.udi = new ArrayList<Reference>();
6794      this.udi.add(t);
6795      return this;
6796    }
6797
6798    /**
6799     * @return The first repetition of repeating field {@link #udi}, creating it if
6800     *         it does not already exist
6801     */
6802    public Reference getUdiFirstRep() {
6803      if (getUdi().isEmpty()) {
6804        addUdi();
6805      }
6806      return getUdi().get(0);
6807    }
6808
6809    /**
6810     * @deprecated Use Reference#setResource(IBaseResource) instead
6811     */
6812    @Deprecated
6813    public List<Device> getUdiTarget() {
6814      if (this.udiTarget == null)
6815        this.udiTarget = new ArrayList<Device>();
6816      return this.udiTarget;
6817    }
6818
6819    /**
6820     * @deprecated Use Reference#setResource(IBaseResource) instead
6821     */
6822    @Deprecated
6823    public Device addUdiTarget() {
6824      Device r = new Device();
6825      if (this.udiTarget == null)
6826        this.udiTarget = new ArrayList<Device>();
6827      this.udiTarget.add(r);
6828      return r;
6829    }
6830
6831    /**
6832     * @return {@link #subDetail} (A claim detail line. Either a simple (a product
6833     *         or service) or a 'group' of sub-details which are simple items.)
6834     */
6835    public List<SubDetailComponent> getSubDetail() {
6836      if (this.subDetail == null)
6837        this.subDetail = new ArrayList<SubDetailComponent>();
6838      return this.subDetail;
6839    }
6840
6841    /**
6842     * @return Returns a reference to <code>this</code> for easy method chaining
6843     */
6844    public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) {
6845      this.subDetail = theSubDetail;
6846      return this;
6847    }
6848
6849    public boolean hasSubDetail() {
6850      if (this.subDetail == null)
6851        return false;
6852      for (SubDetailComponent item : this.subDetail)
6853        if (!item.isEmpty())
6854          return true;
6855      return false;
6856    }
6857
6858    public SubDetailComponent addSubDetail() { // 3
6859      SubDetailComponent t = new SubDetailComponent();
6860      if (this.subDetail == null)
6861        this.subDetail = new ArrayList<SubDetailComponent>();
6862      this.subDetail.add(t);
6863      return t;
6864    }
6865
6866    public DetailComponent addSubDetail(SubDetailComponent t) { // 3
6867      if (t == null)
6868        return this;
6869      if (this.subDetail == null)
6870        this.subDetail = new ArrayList<SubDetailComponent>();
6871      this.subDetail.add(t);
6872      return this;
6873    }
6874
6875    /**
6876     * @return The first repetition of repeating field {@link #subDetail}, creating
6877     *         it if it does not already exist
6878     */
6879    public SubDetailComponent getSubDetailFirstRep() {
6880      if (getSubDetail().isEmpty()) {
6881        addSubDetail();
6882      }
6883      return getSubDetail().get(0);
6884    }
6885
6886    protected void listChildren(List<Property> children) {
6887      super.listChildren(children);
6888      children
6889          .add(new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence));
6890      children.add(new Property("revenue", "CodeableConcept",
6891          "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
6892      children.add(new Property("category", "CodeableConcept",
6893          "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
6894          category));
6895      children.add(new Property("productOrService", "CodeableConcept",
6896          "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.",
6897          0, 1, productOrService));
6898      children.add(new Property("modifier", "CodeableConcept",
6899          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
6900          java.lang.Integer.MAX_VALUE, modifier));
6901      children.add(new Property("programCode", "CodeableConcept",
6902          "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
6903      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
6904          1, quantity));
6905      children.add(new Property("unitPrice", "Money",
6906          "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.",
6907          0, 1, unitPrice));
6908      children.add(new Property("factor", "decimal",
6909          "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.",
6910          0, 1, factor));
6911      children.add(new Property("net", "Money",
6912          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
6913      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
6914          0, java.lang.Integer.MAX_VALUE, udi));
6915      children.add(new Property("subDetail", "",
6916          "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
6917          0, java.lang.Integer.MAX_VALUE, subDetail));
6918    }
6919
6920    @Override
6921    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6922      switch (_hash) {
6923      case 1349547969:
6924        /* sequence */ return new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0,
6925            1, sequence);
6926      case 1099842588:
6927        /* revenue */ return new Property("revenue", "CodeableConcept",
6928            "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
6929      case 50511102:
6930        /* category */ return new Property("category", "CodeableConcept",
6931            "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
6932            category);
6933      case 1957227299:
6934        /* productOrService */ return new Property("productOrService", "CodeableConcept",
6935            "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.",
6936            0, 1, productOrService);
6937      case -615513385:
6938        /* modifier */ return new Property("modifier", "CodeableConcept",
6939            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
6940            java.lang.Integer.MAX_VALUE, modifier);
6941      case 1010065041:
6942        /* programCode */ return new Property("programCode", "CodeableConcept",
6943            "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
6944      case -1285004149:
6945        /* quantity */ return new Property("quantity", "SimpleQuantity",
6946            "The number of repetitions of a service or product.", 0, 1, quantity);
6947      case -486196699:
6948        /* unitPrice */ return new Property("unitPrice", "Money",
6949            "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.",
6950            0, 1, unitPrice);
6951      case -1282148017:
6952        /* factor */ return new Property("factor", "decimal",
6953            "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.",
6954            0, 1, factor);
6955      case 108957:
6956        /* net */ return new Property("net", "Money",
6957            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
6958      case 115642:
6959        /* udi */ return new Property("udi", "Reference(Device)",
6960            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
6961      case -828829007:
6962        /* subDetail */ return new Property("subDetail", "",
6963            "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
6964            0, java.lang.Integer.MAX_VALUE, subDetail);
6965      default:
6966        return super.getNamedProperty(_hash, _name, _checkValid);
6967      }
6968
6969    }
6970
6971    @Override
6972    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6973      switch (hash) {
6974      case 1349547969:
6975        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
6976      case 1099842588:
6977        /* revenue */ return this.revenue == null ? new Base[0] : new Base[] { this.revenue }; // CodeableConcept
6978      case 50511102:
6979        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
6980      case 1957227299:
6981        /* productOrService */ return this.productOrService == null ? new Base[0]
6982            : new Base[] { this.productOrService }; // CodeableConcept
6983      case -615513385:
6984        /* modifier */ return this.modifier == null ? new Base[0]
6985            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
6986      case 1010065041:
6987        /* programCode */ return this.programCode == null ? new Base[0]
6988            : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
6989      case -1285004149:
6990        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
6991      case -486196699:
6992        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
6993      case -1282148017:
6994        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
6995      case 108957:
6996        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
6997      case 115642:
6998        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
6999      case -828829007:
7000        /* subDetail */ return this.subDetail == null ? new Base[0]
7001            : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
7002      default:
7003        return super.getProperty(hash, name, checkValid);
7004      }
7005
7006    }
7007
7008    @Override
7009    public Base setProperty(int hash, String name, Base value) throws FHIRException {
7010      switch (hash) {
7011      case 1349547969: // sequence
7012        this.sequence = castToPositiveInt(value); // PositiveIntType
7013        return value;
7014      case 1099842588: // revenue
7015        this.revenue = castToCodeableConcept(value); // CodeableConcept
7016        return value;
7017      case 50511102: // category
7018        this.category = castToCodeableConcept(value); // CodeableConcept
7019        return value;
7020      case 1957227299: // productOrService
7021        this.productOrService = castToCodeableConcept(value); // CodeableConcept
7022        return value;
7023      case -615513385: // modifier
7024        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
7025        return value;
7026      case 1010065041: // programCode
7027        this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
7028        return value;
7029      case -1285004149: // quantity
7030        this.quantity = castToQuantity(value); // Quantity
7031        return value;
7032      case -486196699: // unitPrice
7033        this.unitPrice = castToMoney(value); // Money
7034        return value;
7035      case -1282148017: // factor
7036        this.factor = castToDecimal(value); // DecimalType
7037        return value;
7038      case 108957: // net
7039        this.net = castToMoney(value); // Money
7040        return value;
7041      case 115642: // udi
7042        this.getUdi().add(castToReference(value)); // Reference
7043        return value;
7044      case -828829007: // subDetail
7045        this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
7046        return value;
7047      default:
7048        return super.setProperty(hash, name, value);
7049      }
7050
7051    }
7052
7053    @Override
7054    public Base setProperty(String name, Base value) throws FHIRException {
7055      if (name.equals("sequence")) {
7056        this.sequence = castToPositiveInt(value); // PositiveIntType
7057      } else if (name.equals("revenue")) {
7058        this.revenue = castToCodeableConcept(value); // CodeableConcept
7059      } else if (name.equals("category")) {
7060        this.category = castToCodeableConcept(value); // CodeableConcept
7061      } else if (name.equals("productOrService")) {
7062        this.productOrService = castToCodeableConcept(value); // CodeableConcept
7063      } else if (name.equals("modifier")) {
7064        this.getModifier().add(castToCodeableConcept(value));
7065      } else if (name.equals("programCode")) {
7066        this.getProgramCode().add(castToCodeableConcept(value));
7067      } else if (name.equals("quantity")) {
7068        this.quantity = castToQuantity(value); // Quantity
7069      } else if (name.equals("unitPrice")) {
7070        this.unitPrice = castToMoney(value); // Money
7071      } else if (name.equals("factor")) {
7072        this.factor = castToDecimal(value); // DecimalType
7073      } else if (name.equals("net")) {
7074        this.net = castToMoney(value); // Money
7075      } else if (name.equals("udi")) {
7076        this.getUdi().add(castToReference(value));
7077      } else if (name.equals("subDetail")) {
7078        this.getSubDetail().add((SubDetailComponent) value);
7079      } else
7080        return super.setProperty(name, value);
7081      return value;
7082    }
7083
7084    @Override
7085    public Base makeProperty(int hash, String name) throws FHIRException {
7086      switch (hash) {
7087      case 1349547969:
7088        return getSequenceElement();
7089      case 1099842588:
7090        return getRevenue();
7091      case 50511102:
7092        return getCategory();
7093      case 1957227299:
7094        return getProductOrService();
7095      case -615513385:
7096        return addModifier();
7097      case 1010065041:
7098        return addProgramCode();
7099      case -1285004149:
7100        return getQuantity();
7101      case -486196699:
7102        return getUnitPrice();
7103      case -1282148017:
7104        return getFactorElement();
7105      case 108957:
7106        return getNet();
7107      case 115642:
7108        return addUdi();
7109      case -828829007:
7110        return addSubDetail();
7111      default:
7112        return super.makeProperty(hash, name);
7113      }
7114
7115    }
7116
7117    @Override
7118    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7119      switch (hash) {
7120      case 1349547969:
7121        /* sequence */ return new String[] { "positiveInt" };
7122      case 1099842588:
7123        /* revenue */ return new String[] { "CodeableConcept" };
7124      case 50511102:
7125        /* category */ return new String[] { "CodeableConcept" };
7126      case 1957227299:
7127        /* productOrService */ return new String[] { "CodeableConcept" };
7128      case -615513385:
7129        /* modifier */ return new String[] { "CodeableConcept" };
7130      case 1010065041:
7131        /* programCode */ return new String[] { "CodeableConcept" };
7132      case -1285004149:
7133        /* quantity */ return new String[] { "SimpleQuantity" };
7134      case -486196699:
7135        /* unitPrice */ return new String[] { "Money" };
7136      case -1282148017:
7137        /* factor */ return new String[] { "decimal" };
7138      case 108957:
7139        /* net */ return new String[] { "Money" };
7140      case 115642:
7141        /* udi */ return new String[] { "Reference" };
7142      case -828829007:
7143        /* subDetail */ return new String[] {};
7144      default:
7145        return super.getTypesForProperty(hash, name);
7146      }
7147
7148    }
7149
7150    @Override
7151    public Base addChild(String name) throws FHIRException {
7152      if (name.equals("sequence")) {
7153        throw new FHIRException("Cannot call addChild on a singleton property Claim.sequence");
7154      } else if (name.equals("revenue")) {
7155        this.revenue = new CodeableConcept();
7156        return this.revenue;
7157      } else if (name.equals("category")) {
7158        this.category = new CodeableConcept();
7159        return this.category;
7160      } else if (name.equals("productOrService")) {
7161        this.productOrService = new CodeableConcept();
7162        return this.productOrService;
7163      } else if (name.equals("modifier")) {
7164        return addModifier();
7165      } else if (name.equals("programCode")) {
7166        return addProgramCode();
7167      } else if (name.equals("quantity")) {
7168        this.quantity = new Quantity();
7169        return this.quantity;
7170      } else if (name.equals("unitPrice")) {
7171        this.unitPrice = new Money();
7172        return this.unitPrice;
7173      } else if (name.equals("factor")) {
7174        throw new FHIRException("Cannot call addChild on a singleton property Claim.factor");
7175      } else if (name.equals("net")) {
7176        this.net = new Money();
7177        return this.net;
7178      } else if (name.equals("udi")) {
7179        return addUdi();
7180      } else if (name.equals("subDetail")) {
7181        return addSubDetail();
7182      } else
7183        return super.addChild(name);
7184    }
7185
7186    public DetailComponent copy() {
7187      DetailComponent dst = new DetailComponent();
7188      copyValues(dst);
7189      return dst;
7190    }
7191
7192    public void copyValues(DetailComponent dst) {
7193      super.copyValues(dst);
7194      dst.sequence = sequence == null ? null : sequence.copy();
7195      dst.revenue = revenue == null ? null : revenue.copy();
7196      dst.category = category == null ? null : category.copy();
7197      dst.productOrService = productOrService == null ? null : productOrService.copy();
7198      if (modifier != null) {
7199        dst.modifier = new ArrayList<CodeableConcept>();
7200        for (CodeableConcept i : modifier)
7201          dst.modifier.add(i.copy());
7202      }
7203      ;
7204      if (programCode != null) {
7205        dst.programCode = new ArrayList<CodeableConcept>();
7206        for (CodeableConcept i : programCode)
7207          dst.programCode.add(i.copy());
7208      }
7209      ;
7210      dst.quantity = quantity == null ? null : quantity.copy();
7211      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7212      dst.factor = factor == null ? null : factor.copy();
7213      dst.net = net == null ? null : net.copy();
7214      if (udi != null) {
7215        dst.udi = new ArrayList<Reference>();
7216        for (Reference i : udi)
7217          dst.udi.add(i.copy());
7218      }
7219      ;
7220      if (subDetail != null) {
7221        dst.subDetail = new ArrayList<SubDetailComponent>();
7222        for (SubDetailComponent i : subDetail)
7223          dst.subDetail.add(i.copy());
7224      }
7225      ;
7226    }
7227
7228    @Override
7229    public boolean equalsDeep(Base other_) {
7230      if (!super.equalsDeep(other_))
7231        return false;
7232      if (!(other_ instanceof DetailComponent))
7233        return false;
7234      DetailComponent o = (DetailComponent) other_;
7235      return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true)
7236          && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
7237          && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
7238          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
7239          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
7240          && compareDeep(subDetail, o.subDetail, true);
7241    }
7242
7243    @Override
7244    public boolean equalsShallow(Base other_) {
7245      if (!super.equalsShallow(other_))
7246        return false;
7247      if (!(other_ instanceof DetailComponent))
7248        return false;
7249      DetailComponent o = (DetailComponent) other_;
7250      return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true);
7251    }
7252
7253    public boolean isEmpty() {
7254      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category, productOrService,
7255          modifier, programCode, quantity, unitPrice, factor, net, udi, subDetail);
7256    }
7257
7258    public String fhirType() {
7259      return "Claim.item.detail";
7260
7261    }
7262
7263  }
7264
7265  @Block()
7266  public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
7267    /**
7268     * A number to uniquely identify item entries.
7269     */
7270    @Child(name = "sequence", type = {
7271        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
7272    @Description(shortDefinition = "Item instance identifier", formalDefinition = "A number to uniquely identify item entries.")
7273    protected PositiveIntType sequence;
7274
7275    /**
7276     * The type of revenue or cost center providing the product and/or service.
7277     */
7278    @Child(name = "revenue", type = {
7279        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
7280    @Description(shortDefinition = "Revenue or cost center code", formalDefinition = "The type of revenue or cost center providing the product and/or service.")
7281    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-revenue-center")
7282    protected CodeableConcept revenue;
7283
7284    /**
7285     * Code to identify the general type of benefits under which products and
7286     * services are provided.
7287     */
7288    @Child(name = "category", type = {
7289        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
7290    @Description(shortDefinition = "Benefit classification", formalDefinition = "Code to identify the general type of benefits under which products and services are provided.")
7291    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-benefitcategory")
7292    protected CodeableConcept category;
7293
7294    /**
7295     * When the value is a group code then this item collects a set of related claim
7296     * details, otherwise this contains the product, service, drug or other billing
7297     * code for the item.
7298     */
7299    @Child(name = "productOrService", type = {
7300        CodeableConcept.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
7301    @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.")
7302    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
7303    protected CodeableConcept productOrService;
7304
7305    /**
7306     * Item typification or modifiers codes to convey additional context for the
7307     * product or service.
7308     */
7309    @Child(name = "modifier", type = {
7310        CodeableConcept.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7311    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
7312    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
7313    protected List<CodeableConcept> modifier;
7314
7315    /**
7316     * Identifies the program under which this may be recovered.
7317     */
7318    @Child(name = "programCode", type = {
7319        CodeableConcept.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7320    @Description(shortDefinition = "Program the product or service is provided under", formalDefinition = "Identifies the program under which this may be recovered.")
7321    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-program-code")
7322    protected List<CodeableConcept> programCode;
7323
7324    /**
7325     * The number of repetitions of a service or product.
7326     */
7327    @Child(name = "quantity", type = { Quantity.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
7328    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
7329    protected Quantity quantity;
7330
7331    /**
7332     * If the item is not a group then this is the fee for the product or service,
7333     * otherwise this is the total of the fees for the details of the group.
7334     */
7335    @Child(name = "unitPrice", type = { Money.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
7336    @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.")
7337    protected Money unitPrice;
7338
7339    /**
7340     * A real number that represents a multiplier used in determining the overall
7341     * value of services delivered and/or goods received. The concept of a Factor
7342     * allows for a discount or surcharge multiplier to be applied to a monetary
7343     * amount.
7344     */
7345    @Child(name = "factor", type = {
7346        DecimalType.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
7347    @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.")
7348    protected DecimalType factor;
7349
7350    /**
7351     * The quantity times the unit price for an additional service or product or
7352     * charge.
7353     */
7354    @Child(name = "net", type = { Money.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
7355    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
7356    protected Money net;
7357
7358    /**
7359     * Unique Device Identifiers associated with this line item.
7360     */
7361    @Child(name = "udi", type = {
7362        Device.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7363    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
7364    protected List<Reference> udi;
7365    /**
7366     * The actual objects that are the target of the reference (Unique Device
7367     * Identifiers associated with this line item.)
7368     */
7369    protected List<Device> udiTarget;
7370
7371    private static final long serialVersionUID = 1133026301L;
7372
7373    /**
7374     * Constructor
7375     */
7376    public SubDetailComponent() {
7377      super();
7378    }
7379
7380    /**
7381     * Constructor
7382     */
7383    public SubDetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
7384      super();
7385      this.sequence = sequence;
7386      this.productOrService = productOrService;
7387    }
7388
7389    /**
7390     * @return {@link #sequence} (A number to uniquely identify item entries.). This
7391     *         is the underlying object with id, value and extensions. The accessor
7392     *         "getSequence" gives direct access to the value
7393     */
7394    public PositiveIntType getSequenceElement() {
7395      if (this.sequence == null)
7396        if (Configuration.errorOnAutoCreate())
7397          throw new Error("Attempt to auto-create SubDetailComponent.sequence");
7398        else if (Configuration.doAutoCreate())
7399          this.sequence = new PositiveIntType(); // bb
7400      return this.sequence;
7401    }
7402
7403    public boolean hasSequenceElement() {
7404      return this.sequence != null && !this.sequence.isEmpty();
7405    }
7406
7407    public boolean hasSequence() {
7408      return this.sequence != null && !this.sequence.isEmpty();
7409    }
7410
7411    /**
7412     * @param value {@link #sequence} (A number to uniquely identify item entries.).
7413     *              This is the underlying object with id, value and extensions. The
7414     *              accessor "getSequence" gives direct access to the value
7415     */
7416    public SubDetailComponent setSequenceElement(PositiveIntType value) {
7417      this.sequence = value;
7418      return this;
7419    }
7420
7421    /**
7422     * @return A number to uniquely identify item entries.
7423     */
7424    public int getSequence() {
7425      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
7426    }
7427
7428    /**
7429     * @param value A number to uniquely identify item entries.
7430     */
7431    public SubDetailComponent setSequence(int value) {
7432      if (this.sequence == null)
7433        this.sequence = new PositiveIntType();
7434      this.sequence.setValue(value);
7435      return this;
7436    }
7437
7438    /**
7439     * @return {@link #revenue} (The type of revenue or cost center providing the
7440     *         product and/or service.)
7441     */
7442    public CodeableConcept getRevenue() {
7443      if (this.revenue == null)
7444        if (Configuration.errorOnAutoCreate())
7445          throw new Error("Attempt to auto-create SubDetailComponent.revenue");
7446        else if (Configuration.doAutoCreate())
7447          this.revenue = new CodeableConcept(); // cc
7448      return this.revenue;
7449    }
7450
7451    public boolean hasRevenue() {
7452      return this.revenue != null && !this.revenue.isEmpty();
7453    }
7454
7455    /**
7456     * @param value {@link #revenue} (The type of revenue or cost center providing
7457     *              the product and/or service.)
7458     */
7459    public SubDetailComponent setRevenue(CodeableConcept value) {
7460      this.revenue = value;
7461      return this;
7462    }
7463
7464    /**
7465     * @return {@link #category} (Code to identify the general type of benefits
7466     *         under which products and services are provided.)
7467     */
7468    public CodeableConcept getCategory() {
7469      if (this.category == null)
7470        if (Configuration.errorOnAutoCreate())
7471          throw new Error("Attempt to auto-create SubDetailComponent.category");
7472        else if (Configuration.doAutoCreate())
7473          this.category = new CodeableConcept(); // cc
7474      return this.category;
7475    }
7476
7477    public boolean hasCategory() {
7478      return this.category != null && !this.category.isEmpty();
7479    }
7480
7481    /**
7482     * @param value {@link #category} (Code to identify the general type of benefits
7483     *              under which products and services are provided.)
7484     */
7485    public SubDetailComponent setCategory(CodeableConcept value) {
7486      this.category = value;
7487      return this;
7488    }
7489
7490    /**
7491     * @return {@link #productOrService} (When the value is a group code then this
7492     *         item collects a set of related claim details, otherwise this contains
7493     *         the product, service, drug or other billing code for the item.)
7494     */
7495    public CodeableConcept getProductOrService() {
7496      if (this.productOrService == null)
7497        if (Configuration.errorOnAutoCreate())
7498          throw new Error("Attempt to auto-create SubDetailComponent.productOrService");
7499        else if (Configuration.doAutoCreate())
7500          this.productOrService = new CodeableConcept(); // cc
7501      return this.productOrService;
7502    }
7503
7504    public boolean hasProductOrService() {
7505      return this.productOrService != null && !this.productOrService.isEmpty();
7506    }
7507
7508    /**
7509     * @param value {@link #productOrService} (When the value is a group code then
7510     *              this item collects a set of related claim details, otherwise
7511     *              this contains the product, service, drug or other billing code
7512     *              for the item.)
7513     */
7514    public SubDetailComponent setProductOrService(CodeableConcept value) {
7515      this.productOrService = value;
7516      return this;
7517    }
7518
7519    /**
7520     * @return {@link #modifier} (Item typification or modifiers codes to convey
7521     *         additional context for the product or service.)
7522     */
7523    public List<CodeableConcept> getModifier() {
7524      if (this.modifier == null)
7525        this.modifier = new ArrayList<CodeableConcept>();
7526      return this.modifier;
7527    }
7528
7529    /**
7530     * @return Returns a reference to <code>this</code> for easy method chaining
7531     */
7532    public SubDetailComponent setModifier(List<CodeableConcept> theModifier) {
7533      this.modifier = theModifier;
7534      return this;
7535    }
7536
7537    public boolean hasModifier() {
7538      if (this.modifier == null)
7539        return false;
7540      for (CodeableConcept item : this.modifier)
7541        if (!item.isEmpty())
7542          return true;
7543      return false;
7544    }
7545
7546    public CodeableConcept addModifier() { // 3
7547      CodeableConcept t = new CodeableConcept();
7548      if (this.modifier == null)
7549        this.modifier = new ArrayList<CodeableConcept>();
7550      this.modifier.add(t);
7551      return t;
7552    }
7553
7554    public SubDetailComponent addModifier(CodeableConcept t) { // 3
7555      if (t == null)
7556        return this;
7557      if (this.modifier == null)
7558        this.modifier = new ArrayList<CodeableConcept>();
7559      this.modifier.add(t);
7560      return this;
7561    }
7562
7563    /**
7564     * @return The first repetition of repeating field {@link #modifier}, creating
7565     *         it if it does not already exist
7566     */
7567    public CodeableConcept getModifierFirstRep() {
7568      if (getModifier().isEmpty()) {
7569        addModifier();
7570      }
7571      return getModifier().get(0);
7572    }
7573
7574    /**
7575     * @return {@link #programCode} (Identifies the program under which this may be
7576     *         recovered.)
7577     */
7578    public List<CodeableConcept> getProgramCode() {
7579      if (this.programCode == null)
7580        this.programCode = new ArrayList<CodeableConcept>();
7581      return this.programCode;
7582    }
7583
7584    /**
7585     * @return Returns a reference to <code>this</code> for easy method chaining
7586     */
7587    public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) {
7588      this.programCode = theProgramCode;
7589      return this;
7590    }
7591
7592    public boolean hasProgramCode() {
7593      if (this.programCode == null)
7594        return false;
7595      for (CodeableConcept item : this.programCode)
7596        if (!item.isEmpty())
7597          return true;
7598      return false;
7599    }
7600
7601    public CodeableConcept addProgramCode() { // 3
7602      CodeableConcept t = new CodeableConcept();
7603      if (this.programCode == null)
7604        this.programCode = new ArrayList<CodeableConcept>();
7605      this.programCode.add(t);
7606      return t;
7607    }
7608
7609    public SubDetailComponent addProgramCode(CodeableConcept t) { // 3
7610      if (t == null)
7611        return this;
7612      if (this.programCode == null)
7613        this.programCode = new ArrayList<CodeableConcept>();
7614      this.programCode.add(t);
7615      return this;
7616    }
7617
7618    /**
7619     * @return The first repetition of repeating field {@link #programCode},
7620     *         creating it if it does not already exist
7621     */
7622    public CodeableConcept getProgramCodeFirstRep() {
7623      if (getProgramCode().isEmpty()) {
7624        addProgramCode();
7625      }
7626      return getProgramCode().get(0);
7627    }
7628
7629    /**
7630     * @return {@link #quantity} (The number of repetitions of a service or
7631     *         product.)
7632     */
7633    public Quantity getQuantity() {
7634      if (this.quantity == null)
7635        if (Configuration.errorOnAutoCreate())
7636          throw new Error("Attempt to auto-create SubDetailComponent.quantity");
7637        else if (Configuration.doAutoCreate())
7638          this.quantity = new Quantity(); // cc
7639      return this.quantity;
7640    }
7641
7642    public boolean hasQuantity() {
7643      return this.quantity != null && !this.quantity.isEmpty();
7644    }
7645
7646    /**
7647     * @param value {@link #quantity} (The number of repetitions of a service or
7648     *              product.)
7649     */
7650    public SubDetailComponent setQuantity(Quantity value) {
7651      this.quantity = value;
7652      return this;
7653    }
7654
7655    /**
7656     * @return {@link #unitPrice} (If the item is not a group then this is the fee
7657     *         for the product or service, otherwise this is the total of the fees
7658     *         for the details of the group.)
7659     */
7660    public Money getUnitPrice() {
7661      if (this.unitPrice == null)
7662        if (Configuration.errorOnAutoCreate())
7663          throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
7664        else if (Configuration.doAutoCreate())
7665          this.unitPrice = new Money(); // cc
7666      return this.unitPrice;
7667    }
7668
7669    public boolean hasUnitPrice() {
7670      return this.unitPrice != null && !this.unitPrice.isEmpty();
7671    }
7672
7673    /**
7674     * @param value {@link #unitPrice} (If the item is not a group then this is the
7675     *              fee for the product or service, otherwise this is the total of
7676     *              the fees for the details of the group.)
7677     */
7678    public SubDetailComponent setUnitPrice(Money value) {
7679      this.unitPrice = value;
7680      return this;
7681    }
7682
7683    /**
7684     * @return {@link #factor} (A real number that represents a multiplier used in
7685     *         determining the overall value of services delivered and/or goods
7686     *         received. The concept of a Factor allows for a discount or surcharge
7687     *         multiplier to be applied to a monetary amount.). This is the
7688     *         underlying object with id, value and extensions. The accessor
7689     *         "getFactor" gives direct access to the value
7690     */
7691    public DecimalType getFactorElement() {
7692      if (this.factor == null)
7693        if (Configuration.errorOnAutoCreate())
7694          throw new Error("Attempt to auto-create SubDetailComponent.factor");
7695        else if (Configuration.doAutoCreate())
7696          this.factor = new DecimalType(); // bb
7697      return this.factor;
7698    }
7699
7700    public boolean hasFactorElement() {
7701      return this.factor != null && !this.factor.isEmpty();
7702    }
7703
7704    public boolean hasFactor() {
7705      return this.factor != null && !this.factor.isEmpty();
7706    }
7707
7708    /**
7709     * @param value {@link #factor} (A real number that represents a multiplier used
7710     *              in determining the overall value of services delivered and/or
7711     *              goods received. The concept of a Factor allows for a discount or
7712     *              surcharge multiplier to be applied to a monetary amount.). This
7713     *              is the underlying object with id, value and extensions. The
7714     *              accessor "getFactor" gives direct access to the value
7715     */
7716    public SubDetailComponent setFactorElement(DecimalType value) {
7717      this.factor = value;
7718      return this;
7719    }
7720
7721    /**
7722     * @return A real number that represents a multiplier used in determining the
7723     *         overall value of services delivered and/or goods received. The
7724     *         concept of a Factor allows for a discount or surcharge multiplier to
7725     *         be applied to a monetary amount.
7726     */
7727    public BigDecimal getFactor() {
7728      return this.factor == null ? null : this.factor.getValue();
7729    }
7730
7731    /**
7732     * @param value A real number that represents a multiplier used in determining
7733     *              the overall value of services delivered and/or goods received.
7734     *              The concept of a Factor allows for a discount or surcharge
7735     *              multiplier to be applied to a monetary amount.
7736     */
7737    public SubDetailComponent setFactor(BigDecimal value) {
7738      if (value == null)
7739        this.factor = null;
7740      else {
7741        if (this.factor == null)
7742          this.factor = new DecimalType();
7743        this.factor.setValue(value);
7744      }
7745      return this;
7746    }
7747
7748    /**
7749     * @param value A real number that represents a multiplier used in determining
7750     *              the overall value of services delivered and/or goods received.
7751     *              The concept of a Factor allows for a discount or surcharge
7752     *              multiplier to be applied to a monetary amount.
7753     */
7754    public SubDetailComponent setFactor(long value) {
7755      this.factor = new DecimalType();
7756      this.factor.setValue(value);
7757      return this;
7758    }
7759
7760    /**
7761     * @param value A real number that represents a multiplier used in determining
7762     *              the overall value of services delivered and/or goods received.
7763     *              The concept of a Factor allows for a discount or surcharge
7764     *              multiplier to be applied to a monetary amount.
7765     */
7766    public SubDetailComponent setFactor(double value) {
7767      this.factor = new DecimalType();
7768      this.factor.setValue(value);
7769      return this;
7770    }
7771
7772    /**
7773     * @return {@link #net} (The quantity times the unit price for an additional
7774     *         service or product or charge.)
7775     */
7776    public Money getNet() {
7777      if (this.net == null)
7778        if (Configuration.errorOnAutoCreate())
7779          throw new Error("Attempt to auto-create SubDetailComponent.net");
7780        else if (Configuration.doAutoCreate())
7781          this.net = new Money(); // cc
7782      return this.net;
7783    }
7784
7785    public boolean hasNet() {
7786      return this.net != null && !this.net.isEmpty();
7787    }
7788
7789    /**
7790     * @param value {@link #net} (The quantity times the unit price for an
7791     *              additional service or product or charge.)
7792     */
7793    public SubDetailComponent setNet(Money value) {
7794      this.net = value;
7795      return this;
7796    }
7797
7798    /**
7799     * @return {@link #udi} (Unique Device Identifiers associated with this line
7800     *         item.)
7801     */
7802    public List<Reference> getUdi() {
7803      if (this.udi == null)
7804        this.udi = new ArrayList<Reference>();
7805      return this.udi;
7806    }
7807
7808    /**
7809     * @return Returns a reference to <code>this</code> for easy method chaining
7810     */
7811    public SubDetailComponent setUdi(List<Reference> theUdi) {
7812      this.udi = theUdi;
7813      return this;
7814    }
7815
7816    public boolean hasUdi() {
7817      if (this.udi == null)
7818        return false;
7819      for (Reference item : this.udi)
7820        if (!item.isEmpty())
7821          return true;
7822      return false;
7823    }
7824
7825    public Reference addUdi() { // 3
7826      Reference t = new Reference();
7827      if (this.udi == null)
7828        this.udi = new ArrayList<Reference>();
7829      this.udi.add(t);
7830      return t;
7831    }
7832
7833    public SubDetailComponent addUdi(Reference t) { // 3
7834      if (t == null)
7835        return this;
7836      if (this.udi == null)
7837        this.udi = new ArrayList<Reference>();
7838      this.udi.add(t);
7839      return this;
7840    }
7841
7842    /**
7843     * @return The first repetition of repeating field {@link #udi}, creating it if
7844     *         it does not already exist
7845     */
7846    public Reference getUdiFirstRep() {
7847      if (getUdi().isEmpty()) {
7848        addUdi();
7849      }
7850      return getUdi().get(0);
7851    }
7852
7853    /**
7854     * @deprecated Use Reference#setResource(IBaseResource) instead
7855     */
7856    @Deprecated
7857    public List<Device> getUdiTarget() {
7858      if (this.udiTarget == null)
7859        this.udiTarget = new ArrayList<Device>();
7860      return this.udiTarget;
7861    }
7862
7863    /**
7864     * @deprecated Use Reference#setResource(IBaseResource) instead
7865     */
7866    @Deprecated
7867    public Device addUdiTarget() {
7868      Device r = new Device();
7869      if (this.udiTarget == null)
7870        this.udiTarget = new ArrayList<Device>();
7871      this.udiTarget.add(r);
7872      return r;
7873    }
7874
7875    protected void listChildren(List<Property> children) {
7876      super.listChildren(children);
7877      children
7878          .add(new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence));
7879      children.add(new Property("revenue", "CodeableConcept",
7880          "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
7881      children.add(new Property("category", "CodeableConcept",
7882          "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
7883          category));
7884      children.add(new Property("productOrService", "CodeableConcept",
7885          "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.",
7886          0, 1, productOrService));
7887      children.add(new Property("modifier", "CodeableConcept",
7888          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
7889          java.lang.Integer.MAX_VALUE, modifier));
7890      children.add(new Property("programCode", "CodeableConcept",
7891          "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
7892      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
7893          1, quantity));
7894      children.add(new Property("unitPrice", "Money",
7895          "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.",
7896          0, 1, unitPrice));
7897      children.add(new Property("factor", "decimal",
7898          "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.",
7899          0, 1, factor));
7900      children.add(new Property("net", "Money",
7901          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
7902      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
7903          0, java.lang.Integer.MAX_VALUE, udi));
7904    }
7905
7906    @Override
7907    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7908      switch (_hash) {
7909      case 1349547969:
7910        /* sequence */ return new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0,
7911            1, sequence);
7912      case 1099842588:
7913        /* revenue */ return new Property("revenue", "CodeableConcept",
7914            "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
7915      case 50511102:
7916        /* category */ return new Property("category", "CodeableConcept",
7917            "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
7918            category);
7919      case 1957227299:
7920        /* productOrService */ return new Property("productOrService", "CodeableConcept",
7921            "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.",
7922            0, 1, productOrService);
7923      case -615513385:
7924        /* modifier */ return new Property("modifier", "CodeableConcept",
7925            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
7926            java.lang.Integer.MAX_VALUE, modifier);
7927      case 1010065041:
7928        /* programCode */ return new Property("programCode", "CodeableConcept",
7929            "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
7930      case -1285004149:
7931        /* quantity */ return new Property("quantity", "SimpleQuantity",
7932            "The number of repetitions of a service or product.", 0, 1, quantity);
7933      case -486196699:
7934        /* unitPrice */ return new Property("unitPrice", "Money",
7935            "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.",
7936            0, 1, unitPrice);
7937      case -1282148017:
7938        /* factor */ return new Property("factor", "decimal",
7939            "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.",
7940            0, 1, factor);
7941      case 108957:
7942        /* net */ return new Property("net", "Money",
7943            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
7944      case 115642:
7945        /* udi */ return new Property("udi", "Reference(Device)",
7946            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
7947      default:
7948        return super.getNamedProperty(_hash, _name, _checkValid);
7949      }
7950
7951    }
7952
7953    @Override
7954    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7955      switch (hash) {
7956      case 1349547969:
7957        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
7958      case 1099842588:
7959        /* revenue */ return this.revenue == null ? new Base[0] : new Base[] { this.revenue }; // CodeableConcept
7960      case 50511102:
7961        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
7962      case 1957227299:
7963        /* productOrService */ return this.productOrService == null ? new Base[0]
7964            : new Base[] { this.productOrService }; // CodeableConcept
7965      case -615513385:
7966        /* modifier */ return this.modifier == null ? new Base[0]
7967            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7968      case 1010065041:
7969        /* programCode */ return this.programCode == null ? new Base[0]
7970            : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
7971      case -1285004149:
7972        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
7973      case -486196699:
7974        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
7975      case -1282148017:
7976        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
7977      case 108957:
7978        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
7979      case 115642:
7980        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
7981      default:
7982        return super.getProperty(hash, name, checkValid);
7983      }
7984
7985    }
7986
7987    @Override
7988    public Base setProperty(int hash, String name, Base value) throws FHIRException {
7989      switch (hash) {
7990      case 1349547969: // sequence
7991        this.sequence = castToPositiveInt(value); // PositiveIntType
7992        return value;
7993      case 1099842588: // revenue
7994        this.revenue = castToCodeableConcept(value); // CodeableConcept
7995        return value;
7996      case 50511102: // category
7997        this.category = castToCodeableConcept(value); // CodeableConcept
7998        return value;
7999      case 1957227299: // productOrService
8000        this.productOrService = castToCodeableConcept(value); // CodeableConcept
8001        return value;
8002      case -615513385: // modifier
8003        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
8004        return value;
8005      case 1010065041: // programCode
8006        this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
8007        return value;
8008      case -1285004149: // quantity
8009        this.quantity = castToQuantity(value); // Quantity
8010        return value;
8011      case -486196699: // unitPrice
8012        this.unitPrice = castToMoney(value); // Money
8013        return value;
8014      case -1282148017: // factor
8015        this.factor = castToDecimal(value); // DecimalType
8016        return value;
8017      case 108957: // net
8018        this.net = castToMoney(value); // Money
8019        return value;
8020      case 115642: // udi
8021        this.getUdi().add(castToReference(value)); // Reference
8022        return value;
8023      default:
8024        return super.setProperty(hash, name, value);
8025      }
8026
8027    }
8028
8029    @Override
8030    public Base setProperty(String name, Base value) throws FHIRException {
8031      if (name.equals("sequence")) {
8032        this.sequence = castToPositiveInt(value); // PositiveIntType
8033      } else if (name.equals("revenue")) {
8034        this.revenue = castToCodeableConcept(value); // CodeableConcept
8035      } else if (name.equals("category")) {
8036        this.category = castToCodeableConcept(value); // CodeableConcept
8037      } else if (name.equals("productOrService")) {
8038        this.productOrService = castToCodeableConcept(value); // CodeableConcept
8039      } else if (name.equals("modifier")) {
8040        this.getModifier().add(castToCodeableConcept(value));
8041      } else if (name.equals("programCode")) {
8042        this.getProgramCode().add(castToCodeableConcept(value));
8043      } else if (name.equals("quantity")) {
8044        this.quantity = castToQuantity(value); // Quantity
8045      } else if (name.equals("unitPrice")) {
8046        this.unitPrice = castToMoney(value); // Money
8047      } else if (name.equals("factor")) {
8048        this.factor = castToDecimal(value); // DecimalType
8049      } else if (name.equals("net")) {
8050        this.net = castToMoney(value); // Money
8051      } else if (name.equals("udi")) {
8052        this.getUdi().add(castToReference(value));
8053      } else
8054        return super.setProperty(name, value);
8055      return value;
8056    }
8057
8058    @Override
8059    public Base makeProperty(int hash, String name) throws FHIRException {
8060      switch (hash) {
8061      case 1349547969:
8062        return getSequenceElement();
8063      case 1099842588:
8064        return getRevenue();
8065      case 50511102:
8066        return getCategory();
8067      case 1957227299:
8068        return getProductOrService();
8069      case -615513385:
8070        return addModifier();
8071      case 1010065041:
8072        return addProgramCode();
8073      case -1285004149:
8074        return getQuantity();
8075      case -486196699:
8076        return getUnitPrice();
8077      case -1282148017:
8078        return getFactorElement();
8079      case 108957:
8080        return getNet();
8081      case 115642:
8082        return addUdi();
8083      default:
8084        return super.makeProperty(hash, name);
8085      }
8086
8087    }
8088
8089    @Override
8090    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8091      switch (hash) {
8092      case 1349547969:
8093        /* sequence */ return new String[] { "positiveInt" };
8094      case 1099842588:
8095        /* revenue */ return new String[] { "CodeableConcept" };
8096      case 50511102:
8097        /* category */ return new String[] { "CodeableConcept" };
8098      case 1957227299:
8099        /* productOrService */ return new String[] { "CodeableConcept" };
8100      case -615513385:
8101        /* modifier */ return new String[] { "CodeableConcept" };
8102      case 1010065041:
8103        /* programCode */ return new String[] { "CodeableConcept" };
8104      case -1285004149:
8105        /* quantity */ return new String[] { "SimpleQuantity" };
8106      case -486196699:
8107        /* unitPrice */ return new String[] { "Money" };
8108      case -1282148017:
8109        /* factor */ return new String[] { "decimal" };
8110      case 108957:
8111        /* net */ return new String[] { "Money" };
8112      case 115642:
8113        /* udi */ return new String[] { "Reference" };
8114      default:
8115        return super.getTypesForProperty(hash, name);
8116      }
8117
8118    }
8119
8120    @Override
8121    public Base addChild(String name) throws FHIRException {
8122      if (name.equals("sequence")) {
8123        throw new FHIRException("Cannot call addChild on a singleton property Claim.sequence");
8124      } else if (name.equals("revenue")) {
8125        this.revenue = new CodeableConcept();
8126        return this.revenue;
8127      } else if (name.equals("category")) {
8128        this.category = new CodeableConcept();
8129        return this.category;
8130      } else if (name.equals("productOrService")) {
8131        this.productOrService = new CodeableConcept();
8132        return this.productOrService;
8133      } else if (name.equals("modifier")) {
8134        return addModifier();
8135      } else if (name.equals("programCode")) {
8136        return addProgramCode();
8137      } else if (name.equals("quantity")) {
8138        this.quantity = new Quantity();
8139        return this.quantity;
8140      } else if (name.equals("unitPrice")) {
8141        this.unitPrice = new Money();
8142        return this.unitPrice;
8143      } else if (name.equals("factor")) {
8144        throw new FHIRException("Cannot call addChild on a singleton property Claim.factor");
8145      } else if (name.equals("net")) {
8146        this.net = new Money();
8147        return this.net;
8148      } else if (name.equals("udi")) {
8149        return addUdi();
8150      } else
8151        return super.addChild(name);
8152    }
8153
8154    public SubDetailComponent copy() {
8155      SubDetailComponent dst = new SubDetailComponent();
8156      copyValues(dst);
8157      return dst;
8158    }
8159
8160    public void copyValues(SubDetailComponent dst) {
8161      super.copyValues(dst);
8162      dst.sequence = sequence == null ? null : sequence.copy();
8163      dst.revenue = revenue == null ? null : revenue.copy();
8164      dst.category = category == null ? null : category.copy();
8165      dst.productOrService = productOrService == null ? null : productOrService.copy();
8166      if (modifier != null) {
8167        dst.modifier = new ArrayList<CodeableConcept>();
8168        for (CodeableConcept i : modifier)
8169          dst.modifier.add(i.copy());
8170      }
8171      ;
8172      if (programCode != null) {
8173        dst.programCode = new ArrayList<CodeableConcept>();
8174        for (CodeableConcept i : programCode)
8175          dst.programCode.add(i.copy());
8176      }
8177      ;
8178      dst.quantity = quantity == null ? null : quantity.copy();
8179      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
8180      dst.factor = factor == null ? null : factor.copy();
8181      dst.net = net == null ? null : net.copy();
8182      if (udi != null) {
8183        dst.udi = new ArrayList<Reference>();
8184        for (Reference i : udi)
8185          dst.udi.add(i.copy());
8186      }
8187      ;
8188    }
8189
8190    @Override
8191    public boolean equalsDeep(Base other_) {
8192      if (!super.equalsDeep(other_))
8193        return false;
8194      if (!(other_ instanceof SubDetailComponent))
8195        return false;
8196      SubDetailComponent o = (SubDetailComponent) other_;
8197      return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true)
8198          && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
8199          && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
8200          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
8201          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true);
8202    }
8203
8204    @Override
8205    public boolean equalsShallow(Base other_) {
8206      if (!super.equalsShallow(other_))
8207        return false;
8208      if (!(other_ instanceof SubDetailComponent))
8209        return false;
8210      SubDetailComponent o = (SubDetailComponent) other_;
8211      return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true);
8212    }
8213
8214    public boolean isEmpty() {
8215      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category, productOrService,
8216          modifier, programCode, quantity, unitPrice, factor, net, udi);
8217    }
8218
8219    public String fhirType() {
8220      return "Claim.item.detail.subDetail";
8221
8222    }
8223
8224  }
8225
8226  /**
8227   * A unique identifier assigned to this claim.
8228   */
8229  @Child(name = "identifier", type = {
8230      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8231  @Description(shortDefinition = "Business Identifier for claim", formalDefinition = "A unique identifier assigned to this claim.")
8232  protected List<Identifier> identifier;
8233
8234  /**
8235   * The status of the resource instance.
8236   */
8237  @Child(name = "status", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = true, summary = true)
8238  @Description(shortDefinition = "active | cancelled | draft | entered-in-error", formalDefinition = "The status of the resource instance.")
8239  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/fm-status")
8240  protected Enumeration<ClaimStatus> status;
8241
8242  /**
8243   * The category of claim, e.g. oral, pharmacy, vision, institutional,
8244   * professional.
8245   */
8246  @Child(name = "type", type = { CodeableConcept.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
8247  @Description(shortDefinition = "Category or discipline", formalDefinition = "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.")
8248  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-type")
8249  protected CodeableConcept type;
8250
8251  /**
8252   * A finer grained suite of claim type codes which may convey additional
8253   * information such as Inpatient vs Outpatient and/or a specialty service.
8254   */
8255  @Child(name = "subType", type = {
8256      CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
8257  @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.")
8258  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-subtype")
8259  protected CodeableConcept subType;
8260
8261  /**
8262   * A code to indicate whether the nature of the request is: to request
8263   * adjudication of products and services previously rendered; or requesting
8264   * authorization and adjudication for provision in the future; or requesting the
8265   * non-binding adjudication of the listed products and services which could be
8266   * provided in the future.
8267   */
8268  @Child(name = "use", type = { CodeType.class }, order = 4, min = 1, max = 1, modifier = false, summary = true)
8269  @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.")
8270  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-use")
8271  protected Enumeration<Use> use;
8272
8273  /**
8274   * The party to whom the professional services and/or products have been
8275   * supplied or are being considered and for whom actual or forecast
8276   * reimbursement is sought.
8277   */
8278  @Child(name = "patient", type = { Patient.class }, order = 5, min = 1, max = 1, modifier = false, summary = true)
8279  @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 or forecast reimbursement is sought.")
8280  protected Reference patient;
8281
8282  /**
8283   * The actual object that is the target of the reference (The party to whom the
8284   * professional services and/or products have been supplied or are being
8285   * considered and for whom actual or forecast reimbursement is sought.)
8286   */
8287  protected Patient patientTarget;
8288
8289  /**
8290   * The period for which charges are being submitted.
8291   */
8292  @Child(name = "billablePeriod", type = {
8293      Period.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
8294  @Description(shortDefinition = "Relevant time frame for the claim", formalDefinition = "The period for which charges are being submitted.")
8295  protected Period billablePeriod;
8296
8297  /**
8298   * The date this resource was created.
8299   */
8300  @Child(name = "created", type = { DateTimeType.class }, order = 7, min = 1, max = 1, modifier = false, summary = true)
8301  @Description(shortDefinition = "Resource creation date", formalDefinition = "The date this resource was created.")
8302  protected DateTimeType created;
8303
8304  /**
8305   * Individual who created the claim, predetermination or preauthorization.
8306   */
8307  @Child(name = "enterer", type = { Practitioner.class,
8308      PractitionerRole.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
8309  @Description(shortDefinition = "Author of the claim", formalDefinition = "Individual who created the claim, predetermination or preauthorization.")
8310  protected Reference enterer;
8311
8312  /**
8313   * The actual object that is the target of the reference (Individual who created
8314   * the claim, predetermination or preauthorization.)
8315   */
8316  protected Resource entererTarget;
8317
8318  /**
8319   * The Insurer who is target of the request.
8320   */
8321  @Child(name = "insurer", type = { Organization.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
8322  @Description(shortDefinition = "Target", formalDefinition = "The Insurer who is target of the request.")
8323  protected Reference insurer;
8324
8325  /**
8326   * The actual object that is the target of the reference (The Insurer who is
8327   * target of the request.)
8328   */
8329  protected Organization insurerTarget;
8330
8331  /**
8332   * The provider which is responsible for the claim, predetermination or
8333   * preauthorization.
8334   */
8335  @Child(name = "provider", type = { Practitioner.class, PractitionerRole.class,
8336      Organization.class }, order = 10, min = 1, max = 1, modifier = false, summary = true)
8337  @Description(shortDefinition = "Party responsible for the claim", formalDefinition = "The provider which is responsible for the claim, predetermination or preauthorization.")
8338  protected Reference provider;
8339
8340  /**
8341   * The actual object that is the target of the reference (The provider which is
8342   * responsible for the claim, predetermination or preauthorization.)
8343   */
8344  protected Resource providerTarget;
8345
8346  /**
8347   * The provider-required urgency of processing the request. Typical values
8348   * include: stat, routine deferred.
8349   */
8350  @Child(name = "priority", type = {
8351      CodeableConcept.class }, order = 11, min = 1, max = 1, modifier = false, summary = true)
8352  @Description(shortDefinition = "Desired processing ugency", formalDefinition = "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.")
8353  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/process-priority")
8354  protected CodeableConcept priority;
8355
8356  /**
8357   * A code to indicate whether and for whom funds are to be reserved for future
8358   * claims.
8359   */
8360  @Child(name = "fundsReserve", type = {
8361      CodeableConcept.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
8362  @Description(shortDefinition = "For whom to reserve funds", formalDefinition = "A code to indicate whether and for whom funds are to be reserved for future claims.")
8363  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/fundsreserve")
8364  protected CodeableConcept fundsReserve;
8365
8366  /**
8367   * Other claims which are related to this claim such as prior submissions or
8368   * claims for related services or for the same event.
8369   */
8370  @Child(name = "related", type = {}, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8371  @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.")
8372  protected List<RelatedClaimComponent> related;
8373
8374  /**
8375   * Prescription to support the dispensing of pharmacy, device or vision
8376   * products.
8377   */
8378  @Child(name = "prescription", type = { DeviceRequest.class, MedicationRequest.class,
8379      VisionPrescription.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
8380  @Description(shortDefinition = "Prescription authorizing services and products", formalDefinition = "Prescription to support the dispensing of pharmacy, device or vision products.")
8381  protected Reference prescription;
8382
8383  /**
8384   * The actual object that is the target of the reference (Prescription to
8385   * support the dispensing of pharmacy, device or vision products.)
8386   */
8387  protected Resource prescriptionTarget;
8388
8389  /**
8390   * Original prescription which has been superseded by this prescription to
8391   * support the dispensing of pharmacy services, medications or products.
8392   */
8393  @Child(name = "originalPrescription", type = { DeviceRequest.class, MedicationRequest.class,
8394      VisionPrescription.class }, order = 15, min = 0, max = 1, modifier = false, summary = false)
8395  @Description(shortDefinition = "Original prescription if superseded by fulfiller", formalDefinition = "Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.")
8396  protected Reference originalPrescription;
8397
8398  /**
8399   * The actual object that is the target of the reference (Original prescription
8400   * which has been superseded by this prescription to support the dispensing of
8401   * pharmacy services, medications or products.)
8402   */
8403  protected Resource originalPrescriptionTarget;
8404
8405  /**
8406   * The party to be reimbursed for cost of the products and services according to
8407   * the terms of the policy.
8408   */
8409  @Child(name = "payee", type = {}, order = 16, min = 0, max = 1, modifier = false, summary = false)
8410  @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.")
8411  protected PayeeComponent payee;
8412
8413  /**
8414   * A reference to a referral resource.
8415   */
8416  @Child(name = "referral", type = {
8417      ServiceRequest.class }, order = 17, min = 0, max = 1, modifier = false, summary = false)
8418  @Description(shortDefinition = "Treatment referral", formalDefinition = "A reference to a referral resource.")
8419  protected Reference referral;
8420
8421  /**
8422   * The actual object that is the target of the reference (A reference to a
8423   * referral resource.)
8424   */
8425  protected ServiceRequest referralTarget;
8426
8427  /**
8428   * Facility where the services were provided.
8429   */
8430  @Child(name = "facility", type = { Location.class }, order = 18, min = 0, max = 1, modifier = false, summary = false)
8431  @Description(shortDefinition = "Servicing facility", formalDefinition = "Facility where the services were provided.")
8432  protected Reference facility;
8433
8434  /**
8435   * The actual object that is the target of the reference (Facility where the
8436   * services were provided.)
8437   */
8438  protected Location facilityTarget;
8439
8440  /**
8441   * The members of the team who provided the products and services.
8442   */
8443  @Child(name = "careTeam", type = {}, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8444  @Description(shortDefinition = "Members of the care team", formalDefinition = "The members of the team who provided the products and services.")
8445  protected List<CareTeamComponent> careTeam;
8446
8447  /**
8448   * Additional information codes regarding exceptions, special considerations,
8449   * the condition, situation, prior or concurrent issues.
8450   */
8451  @Child(name = "supportingInfo", type = {}, order = 20, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8452  @Description(shortDefinition = "Supporting information", formalDefinition = "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.")
8453  protected List<SupportingInformationComponent> supportingInfo;
8454
8455  /**
8456   * Information about diagnoses relevant to the claim items.
8457   */
8458  @Child(name = "diagnosis", type = {}, order = 21, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8459  @Description(shortDefinition = "Pertinent diagnosis information", formalDefinition = "Information about diagnoses relevant to the claim items.")
8460  protected List<DiagnosisComponent> diagnosis;
8461
8462  /**
8463   * Procedures performed on the patient relevant to the billing items with the
8464   * claim.
8465   */
8466  @Child(name = "procedure", type = {}, order = 22, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8467  @Description(shortDefinition = "Clinical procedures performed", formalDefinition = "Procedures performed on the patient relevant to the billing items with the claim.")
8468  protected List<ProcedureComponent> procedure;
8469
8470  /**
8471   * Financial instruments for reimbursement for the health care products and
8472   * services specified on the claim.
8473   */
8474  @Child(name = "insurance", type = {}, order = 23, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
8475  @Description(shortDefinition = "Patient insurance information", formalDefinition = "Financial instruments for reimbursement for the health care products and services specified on the claim.")
8476  protected List<InsuranceComponent> insurance;
8477
8478  /**
8479   * Details of an accident which resulted in injuries which required the products
8480   * and services listed in the claim.
8481   */
8482  @Child(name = "accident", type = {}, order = 24, min = 0, max = 1, modifier = false, summary = false)
8483  @Description(shortDefinition = "Details of the event", formalDefinition = "Details of an accident which resulted in injuries which required the products and services listed in the claim.")
8484  protected AccidentComponent accident;
8485
8486  /**
8487   * A claim line. Either a simple product or service or a 'group' of details
8488   * which can each be a simple items or groups of sub-details.
8489   */
8490  @Child(name = "item", type = {}, order = 25, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8491  @Description(shortDefinition = "Product or service provided", formalDefinition = "A claim line. Either a simple  product or service or a 'group' of details which can each be a simple items or groups of sub-details.")
8492  protected List<ItemComponent> item;
8493
8494  /**
8495   * The total value of the all the items in the claim.
8496   */
8497  @Child(name = "total", type = { Money.class }, order = 26, min = 0, max = 1, modifier = false, summary = false)
8498  @Description(shortDefinition = "Total claim cost", formalDefinition = "The total value of the all the items in the claim.")
8499  protected Money total;
8500
8501  private static final long serialVersionUID = -80376108L;
8502
8503  /**
8504   * Constructor
8505   */
8506  public Claim() {
8507    super();
8508  }
8509
8510  /**
8511   * Constructor
8512   */
8513  public Claim(Enumeration<ClaimStatus> status, CodeableConcept type, Enumeration<Use> use, Reference patient,
8514      DateTimeType created, Reference provider, CodeableConcept priority) {
8515    super();
8516    this.status = status;
8517    this.type = type;
8518    this.use = use;
8519    this.patient = patient;
8520    this.created = created;
8521    this.provider = provider;
8522    this.priority = priority;
8523  }
8524
8525  /**
8526   * @return {@link #identifier} (A unique identifier assigned to this claim.)
8527   */
8528  public List<Identifier> getIdentifier() {
8529    if (this.identifier == null)
8530      this.identifier = new ArrayList<Identifier>();
8531    return this.identifier;
8532  }
8533
8534  /**
8535   * @return Returns a reference to <code>this</code> for easy method chaining
8536   */
8537  public Claim setIdentifier(List<Identifier> theIdentifier) {
8538    this.identifier = theIdentifier;
8539    return this;
8540  }
8541
8542  public boolean hasIdentifier() {
8543    if (this.identifier == null)
8544      return false;
8545    for (Identifier item : this.identifier)
8546      if (!item.isEmpty())
8547        return true;
8548    return false;
8549  }
8550
8551  public Identifier addIdentifier() { // 3
8552    Identifier t = new Identifier();
8553    if (this.identifier == null)
8554      this.identifier = new ArrayList<Identifier>();
8555    this.identifier.add(t);
8556    return t;
8557  }
8558
8559  public Claim addIdentifier(Identifier t) { // 3
8560    if (t == null)
8561      return this;
8562    if (this.identifier == null)
8563      this.identifier = new ArrayList<Identifier>();
8564    this.identifier.add(t);
8565    return this;
8566  }
8567
8568  /**
8569   * @return The first repetition of repeating field {@link #identifier}, creating
8570   *         it if it does not already exist
8571   */
8572  public Identifier getIdentifierFirstRep() {
8573    if (getIdentifier().isEmpty()) {
8574      addIdentifier();
8575    }
8576    return getIdentifier().get(0);
8577  }
8578
8579  /**
8580   * @return {@link #status} (The status of the resource instance.). This is the
8581   *         underlying object with id, value and extensions. The accessor
8582   *         "getStatus" gives direct access to the value
8583   */
8584  public Enumeration<ClaimStatus> getStatusElement() {
8585    if (this.status == null)
8586      if (Configuration.errorOnAutoCreate())
8587        throw new Error("Attempt to auto-create Claim.status");
8588      else if (Configuration.doAutoCreate())
8589        this.status = new Enumeration<ClaimStatus>(new ClaimStatusEnumFactory()); // bb
8590    return this.status;
8591  }
8592
8593  public boolean hasStatusElement() {
8594    return this.status != null && !this.status.isEmpty();
8595  }
8596
8597  public boolean hasStatus() {
8598    return this.status != null && !this.status.isEmpty();
8599  }
8600
8601  /**
8602   * @param value {@link #status} (The status of the resource instance.). This is
8603   *              the underlying object with id, value and extensions. The
8604   *              accessor "getStatus" gives direct access to the value
8605   */
8606  public Claim setStatusElement(Enumeration<ClaimStatus> value) {
8607    this.status = value;
8608    return this;
8609  }
8610
8611  /**
8612   * @return The status of the resource instance.
8613   */
8614  public ClaimStatus getStatus() {
8615    return this.status == null ? null : this.status.getValue();
8616  }
8617
8618  /**
8619   * @param value The status of the resource instance.
8620   */
8621  public Claim setStatus(ClaimStatus value) {
8622    if (this.status == null)
8623      this.status = new Enumeration<ClaimStatus>(new ClaimStatusEnumFactory());
8624    this.status.setValue(value);
8625    return this;
8626  }
8627
8628  /**
8629   * @return {@link #type} (The category of claim, e.g. oral, pharmacy, vision,
8630   *         institutional, professional.)
8631   */
8632  public CodeableConcept getType() {
8633    if (this.type == null)
8634      if (Configuration.errorOnAutoCreate())
8635        throw new Error("Attempt to auto-create Claim.type");
8636      else if (Configuration.doAutoCreate())
8637        this.type = new CodeableConcept(); // cc
8638    return this.type;
8639  }
8640
8641  public boolean hasType() {
8642    return this.type != null && !this.type.isEmpty();
8643  }
8644
8645  /**
8646   * @param value {@link #type} (The category of claim, e.g. oral, pharmacy,
8647   *              vision, institutional, professional.)
8648   */
8649  public Claim setType(CodeableConcept value) {
8650    this.type = value;
8651    return this;
8652  }
8653
8654  /**
8655   * @return {@link #subType} (A finer grained suite of claim type codes which may
8656   *         convey additional information such as Inpatient vs Outpatient and/or
8657   *         a specialty service.)
8658   */
8659  public CodeableConcept getSubType() {
8660    if (this.subType == null)
8661      if (Configuration.errorOnAutoCreate())
8662        throw new Error("Attempt to auto-create Claim.subType");
8663      else if (Configuration.doAutoCreate())
8664        this.subType = new CodeableConcept(); // cc
8665    return this.subType;
8666  }
8667
8668  public boolean hasSubType() {
8669    return this.subType != null && !this.subType.isEmpty();
8670  }
8671
8672  /**
8673   * @param value {@link #subType} (A finer grained suite of claim type codes
8674   *              which may convey additional information such as Inpatient vs
8675   *              Outpatient and/or a specialty service.)
8676   */
8677  public Claim setSubType(CodeableConcept value) {
8678    this.subType = value;
8679    return this;
8680  }
8681
8682  /**
8683   * @return {@link #use} (A code to indicate whether the nature of the request
8684   *         is: to request adjudication of products and services previously
8685   *         rendered; or requesting authorization and adjudication for provision
8686   *         in the future; or requesting the non-binding adjudication of the
8687   *         listed products and services which could be provided in the future.).
8688   *         This is the underlying object with id, value and extensions. The
8689   *         accessor "getUse" gives direct access to the value
8690   */
8691  public Enumeration<Use> getUseElement() {
8692    if (this.use == null)
8693      if (Configuration.errorOnAutoCreate())
8694        throw new Error("Attempt to auto-create Claim.use");
8695      else if (Configuration.doAutoCreate())
8696        this.use = new Enumeration<Use>(new UseEnumFactory()); // bb
8697    return this.use;
8698  }
8699
8700  public boolean hasUseElement() {
8701    return this.use != null && !this.use.isEmpty();
8702  }
8703
8704  public boolean hasUse() {
8705    return this.use != null && !this.use.isEmpty();
8706  }
8707
8708  /**
8709   * @param value {@link #use} (A code to indicate whether the nature of the
8710   *              request is: to request adjudication of products and services
8711   *              previously rendered; or requesting authorization and
8712   *              adjudication for provision in the future; or requesting the
8713   *              non-binding adjudication of the listed products and services
8714   *              which could be provided in the future.). This is the underlying
8715   *              object with id, value and extensions. The accessor "getUse"
8716   *              gives direct access to the value
8717   */
8718  public Claim setUseElement(Enumeration<Use> value) {
8719    this.use = value;
8720    return this;
8721  }
8722
8723  /**
8724   * @return A code to indicate whether the nature of the request is: to request
8725   *         adjudication of products and services previously rendered; or
8726   *         requesting authorization and adjudication for provision in the
8727   *         future; or requesting the non-binding adjudication of the listed
8728   *         products and services which could be provided in the future.
8729   */
8730  public Use getUse() {
8731    return this.use == null ? null : this.use.getValue();
8732  }
8733
8734  /**
8735   * @param value A code to indicate whether the nature of the request is: to
8736   *              request adjudication of products and services previously
8737   *              rendered; or requesting authorization and adjudication for
8738   *              provision in the future; or requesting the non-binding
8739   *              adjudication of the listed products and services which could be
8740   *              provided in the future.
8741   */
8742  public Claim setUse(Use value) {
8743    if (this.use == null)
8744      this.use = new Enumeration<Use>(new UseEnumFactory());
8745    this.use.setValue(value);
8746    return this;
8747  }
8748
8749  /**
8750   * @return {@link #patient} (The party to whom the professional services and/or
8751   *         products have been supplied or are being considered and for whom
8752   *         actual or forecast reimbursement is sought.)
8753   */
8754  public Reference getPatient() {
8755    if (this.patient == null)
8756      if (Configuration.errorOnAutoCreate())
8757        throw new Error("Attempt to auto-create Claim.patient");
8758      else if (Configuration.doAutoCreate())
8759        this.patient = new Reference(); // cc
8760    return this.patient;
8761  }
8762
8763  public boolean hasPatient() {
8764    return this.patient != null && !this.patient.isEmpty();
8765  }
8766
8767  /**
8768   * @param value {@link #patient} (The party to whom the professional services
8769   *              and/or products have been supplied or are being considered and
8770   *              for whom actual or forecast reimbursement is sought.)
8771   */
8772  public Claim setPatient(Reference value) {
8773    this.patient = value;
8774    return this;
8775  }
8776
8777  /**
8778   * @return {@link #patient} The actual object that is the target of the
8779   *         reference. The reference library doesn't populate this, but you can
8780   *         use it to hold the resource if you resolve it. (The party to whom the
8781   *         professional services and/or products have been supplied or are being
8782   *         considered and for whom actual or forecast reimbursement is sought.)
8783   */
8784  public Patient getPatientTarget() {
8785    if (this.patientTarget == null)
8786      if (Configuration.errorOnAutoCreate())
8787        throw new Error("Attempt to auto-create Claim.patient");
8788      else if (Configuration.doAutoCreate())
8789        this.patientTarget = new Patient(); // aa
8790    return this.patientTarget;
8791  }
8792
8793  /**
8794   * @param value {@link #patient} The actual object that is the target of the
8795   *              reference. The reference library doesn't use these, but you can
8796   *              use it to hold the resource if you resolve it. (The party to
8797   *              whom the professional services and/or products have been
8798   *              supplied or are being considered and for whom actual or forecast
8799   *              reimbursement is sought.)
8800   */
8801  public Claim setPatientTarget(Patient value) {
8802    this.patientTarget = value;
8803    return this;
8804  }
8805
8806  /**
8807   * @return {@link #billablePeriod} (The period for which charges are being
8808   *         submitted.)
8809   */
8810  public Period getBillablePeriod() {
8811    if (this.billablePeriod == null)
8812      if (Configuration.errorOnAutoCreate())
8813        throw new Error("Attempt to auto-create Claim.billablePeriod");
8814      else if (Configuration.doAutoCreate())
8815        this.billablePeriod = new Period(); // cc
8816    return this.billablePeriod;
8817  }
8818
8819  public boolean hasBillablePeriod() {
8820    return this.billablePeriod != null && !this.billablePeriod.isEmpty();
8821  }
8822
8823  /**
8824   * @param value {@link #billablePeriod} (The period for which charges are being
8825   *              submitted.)
8826   */
8827  public Claim setBillablePeriod(Period value) {
8828    this.billablePeriod = value;
8829    return this;
8830  }
8831
8832  /**
8833   * @return {@link #created} (The date this resource was created.). This is the
8834   *         underlying object with id, value and extensions. The accessor
8835   *         "getCreated" gives direct access to the value
8836   */
8837  public DateTimeType getCreatedElement() {
8838    if (this.created == null)
8839      if (Configuration.errorOnAutoCreate())
8840        throw new Error("Attempt to auto-create Claim.created");
8841      else if (Configuration.doAutoCreate())
8842        this.created = new DateTimeType(); // bb
8843    return this.created;
8844  }
8845
8846  public boolean hasCreatedElement() {
8847    return this.created != null && !this.created.isEmpty();
8848  }
8849
8850  public boolean hasCreated() {
8851    return this.created != null && !this.created.isEmpty();
8852  }
8853
8854  /**
8855   * @param value {@link #created} (The date this resource was created.). This is
8856   *              the underlying object with id, value and extensions. The
8857   *              accessor "getCreated" gives direct access to the value
8858   */
8859  public Claim setCreatedElement(DateTimeType value) {
8860    this.created = value;
8861    return this;
8862  }
8863
8864  /**
8865   * @return The date this resource was created.
8866   */
8867  public Date getCreated() {
8868    return this.created == null ? null : this.created.getValue();
8869  }
8870
8871  /**
8872   * @param value The date this resource was created.
8873   */
8874  public Claim setCreated(Date value) {
8875    if (this.created == null)
8876      this.created = new DateTimeType();
8877    this.created.setValue(value);
8878    return this;
8879  }
8880
8881  /**
8882   * @return {@link #enterer} (Individual who created the claim, predetermination
8883   *         or preauthorization.)
8884   */
8885  public Reference getEnterer() {
8886    if (this.enterer == null)
8887      if (Configuration.errorOnAutoCreate())
8888        throw new Error("Attempt to auto-create Claim.enterer");
8889      else if (Configuration.doAutoCreate())
8890        this.enterer = new Reference(); // cc
8891    return this.enterer;
8892  }
8893
8894  public boolean hasEnterer() {
8895    return this.enterer != null && !this.enterer.isEmpty();
8896  }
8897
8898  /**
8899   * @param value {@link #enterer} (Individual who created the claim,
8900   *              predetermination or preauthorization.)
8901   */
8902  public Claim setEnterer(Reference value) {
8903    this.enterer = value;
8904    return this;
8905  }
8906
8907  /**
8908   * @return {@link #enterer} The actual object that is the target of the
8909   *         reference. The reference library doesn't populate this, but you can
8910   *         use it to hold the resource if you resolve it. (Individual who
8911   *         created the claim, predetermination or preauthorization.)
8912   */
8913  public Resource getEntererTarget() {
8914    return this.entererTarget;
8915  }
8916
8917  /**
8918   * @param value {@link #enterer} The actual object that is the target of the
8919   *              reference. The reference library doesn't use these, but you can
8920   *              use it to hold the resource if you resolve it. (Individual who
8921   *              created the claim, predetermination or preauthorization.)
8922   */
8923  public Claim setEntererTarget(Resource value) {
8924    this.entererTarget = value;
8925    return this;
8926  }
8927
8928  /**
8929   * @return {@link #insurer} (The Insurer who is target of the request.)
8930   */
8931  public Reference getInsurer() {
8932    if (this.insurer == null)
8933      if (Configuration.errorOnAutoCreate())
8934        throw new Error("Attempt to auto-create Claim.insurer");
8935      else if (Configuration.doAutoCreate())
8936        this.insurer = new Reference(); // cc
8937    return this.insurer;
8938  }
8939
8940  public boolean hasInsurer() {
8941    return this.insurer != null && !this.insurer.isEmpty();
8942  }
8943
8944  /**
8945   * @param value {@link #insurer} (The Insurer who is target of the request.)
8946   */
8947  public Claim setInsurer(Reference value) {
8948    this.insurer = value;
8949    return this;
8950  }
8951
8952  /**
8953   * @return {@link #insurer} The actual object that is the target of the
8954   *         reference. The reference library doesn't populate this, but you can
8955   *         use it to hold the resource if you resolve it. (The Insurer who is
8956   *         target of the request.)
8957   */
8958  public Organization getInsurerTarget() {
8959    if (this.insurerTarget == null)
8960      if (Configuration.errorOnAutoCreate())
8961        throw new Error("Attempt to auto-create Claim.insurer");
8962      else if (Configuration.doAutoCreate())
8963        this.insurerTarget = new Organization(); // aa
8964    return this.insurerTarget;
8965  }
8966
8967  /**
8968   * @param value {@link #insurer} The actual object that is the target of the
8969   *              reference. The reference library doesn't use these, but you can
8970   *              use it to hold the resource if you resolve it. (The Insurer who
8971   *              is target of the request.)
8972   */
8973  public Claim setInsurerTarget(Organization value) {
8974    this.insurerTarget = value;
8975    return this;
8976  }
8977
8978  /**
8979   * @return {@link #provider} (The provider which is responsible for the claim,
8980   *         predetermination or preauthorization.)
8981   */
8982  public Reference getProvider() {
8983    if (this.provider == null)
8984      if (Configuration.errorOnAutoCreate())
8985        throw new Error("Attempt to auto-create Claim.provider");
8986      else if (Configuration.doAutoCreate())
8987        this.provider = new Reference(); // cc
8988    return this.provider;
8989  }
8990
8991  public boolean hasProvider() {
8992    return this.provider != null && !this.provider.isEmpty();
8993  }
8994
8995  /**
8996   * @param value {@link #provider} (The provider which is responsible for the
8997   *              claim, predetermination or preauthorization.)
8998   */
8999  public Claim setProvider(Reference value) {
9000    this.provider = value;
9001    return this;
9002  }
9003
9004  /**
9005   * @return {@link #provider} The actual object that is the target of the
9006   *         reference. The reference library doesn't populate this, but you can
9007   *         use it to hold the resource if you resolve it. (The provider which is
9008   *         responsible for the claim, predetermination or preauthorization.)
9009   */
9010  public Resource getProviderTarget() {
9011    return this.providerTarget;
9012  }
9013
9014  /**
9015   * @param value {@link #provider} The actual object that is the target of the
9016   *              reference. The reference library doesn't use these, but you can
9017   *              use it to hold the resource if you resolve it. (The provider
9018   *              which is responsible for the claim, predetermination or
9019   *              preauthorization.)
9020   */
9021  public Claim setProviderTarget(Resource value) {
9022    this.providerTarget = value;
9023    return this;
9024  }
9025
9026  /**
9027   * @return {@link #priority} (The provider-required urgency of processing the
9028   *         request. Typical values include: stat, routine deferred.)
9029   */
9030  public CodeableConcept getPriority() {
9031    if (this.priority == null)
9032      if (Configuration.errorOnAutoCreate())
9033        throw new Error("Attempt to auto-create Claim.priority");
9034      else if (Configuration.doAutoCreate())
9035        this.priority = new CodeableConcept(); // cc
9036    return this.priority;
9037  }
9038
9039  public boolean hasPriority() {
9040    return this.priority != null && !this.priority.isEmpty();
9041  }
9042
9043  /**
9044   * @param value {@link #priority} (The provider-required urgency of processing
9045   *              the request. Typical values include: stat, routine deferred.)
9046   */
9047  public Claim setPriority(CodeableConcept value) {
9048    this.priority = value;
9049    return this;
9050  }
9051
9052  /**
9053   * @return {@link #fundsReserve} (A code to indicate whether and for whom funds
9054   *         are to be reserved for future claims.)
9055   */
9056  public CodeableConcept getFundsReserve() {
9057    if (this.fundsReserve == null)
9058      if (Configuration.errorOnAutoCreate())
9059        throw new Error("Attempt to auto-create Claim.fundsReserve");
9060      else if (Configuration.doAutoCreate())
9061        this.fundsReserve = new CodeableConcept(); // cc
9062    return this.fundsReserve;
9063  }
9064
9065  public boolean hasFundsReserve() {
9066    return this.fundsReserve != null && !this.fundsReserve.isEmpty();
9067  }
9068
9069  /**
9070   * @param value {@link #fundsReserve} (A code to indicate whether and for whom
9071   *              funds are to be reserved for future claims.)
9072   */
9073  public Claim setFundsReserve(CodeableConcept value) {
9074    this.fundsReserve = value;
9075    return this;
9076  }
9077
9078  /**
9079   * @return {@link #related} (Other claims which are related to this claim such
9080   *         as prior submissions or claims for related services or for the same
9081   *         event.)
9082   */
9083  public List<RelatedClaimComponent> getRelated() {
9084    if (this.related == null)
9085      this.related = new ArrayList<RelatedClaimComponent>();
9086    return this.related;
9087  }
9088
9089  /**
9090   * @return Returns a reference to <code>this</code> for easy method chaining
9091   */
9092  public Claim setRelated(List<RelatedClaimComponent> theRelated) {
9093    this.related = theRelated;
9094    return this;
9095  }
9096
9097  public boolean hasRelated() {
9098    if (this.related == null)
9099      return false;
9100    for (RelatedClaimComponent item : this.related)
9101      if (!item.isEmpty())
9102        return true;
9103    return false;
9104  }
9105
9106  public RelatedClaimComponent addRelated() { // 3
9107    RelatedClaimComponent t = new RelatedClaimComponent();
9108    if (this.related == null)
9109      this.related = new ArrayList<RelatedClaimComponent>();
9110    this.related.add(t);
9111    return t;
9112  }
9113
9114  public Claim addRelated(RelatedClaimComponent t) { // 3
9115    if (t == null)
9116      return this;
9117    if (this.related == null)
9118      this.related = new ArrayList<RelatedClaimComponent>();
9119    this.related.add(t);
9120    return this;
9121  }
9122
9123  /**
9124   * @return The first repetition of repeating field {@link #related}, creating it
9125   *         if it does not already exist
9126   */
9127  public RelatedClaimComponent getRelatedFirstRep() {
9128    if (getRelated().isEmpty()) {
9129      addRelated();
9130    }
9131    return getRelated().get(0);
9132  }
9133
9134  /**
9135   * @return {@link #prescription} (Prescription to support the dispensing of
9136   *         pharmacy, device or vision products.)
9137   */
9138  public Reference getPrescription() {
9139    if (this.prescription == null)
9140      if (Configuration.errorOnAutoCreate())
9141        throw new Error("Attempt to auto-create Claim.prescription");
9142      else if (Configuration.doAutoCreate())
9143        this.prescription = new Reference(); // cc
9144    return this.prescription;
9145  }
9146
9147  public boolean hasPrescription() {
9148    return this.prescription != null && !this.prescription.isEmpty();
9149  }
9150
9151  /**
9152   * @param value {@link #prescription} (Prescription to support the dispensing of
9153   *              pharmacy, device or vision products.)
9154   */
9155  public Claim setPrescription(Reference value) {
9156    this.prescription = value;
9157    return this;
9158  }
9159
9160  /**
9161   * @return {@link #prescription} The actual object that is the target of the
9162   *         reference. The reference library doesn't populate this, but you can
9163   *         use it to hold the resource if you resolve it. (Prescription to
9164   *         support the dispensing of pharmacy, device or vision products.)
9165   */
9166  public Resource getPrescriptionTarget() {
9167    return this.prescriptionTarget;
9168  }
9169
9170  /**
9171   * @param value {@link #prescription} The actual object that is the target of
9172   *              the reference. The reference library doesn't use these, but you
9173   *              can use it to hold the resource if you resolve it. (Prescription
9174   *              to support the dispensing of pharmacy, device or vision
9175   *              products.)
9176   */
9177  public Claim setPrescriptionTarget(Resource value) {
9178    this.prescriptionTarget = value;
9179    return this;
9180  }
9181
9182  /**
9183   * @return {@link #originalPrescription} (Original prescription which has been
9184   *         superseded by this prescription to support the dispensing of pharmacy
9185   *         services, medications or products.)
9186   */
9187  public Reference getOriginalPrescription() {
9188    if (this.originalPrescription == null)
9189      if (Configuration.errorOnAutoCreate())
9190        throw new Error("Attempt to auto-create Claim.originalPrescription");
9191      else if (Configuration.doAutoCreate())
9192        this.originalPrescription = new Reference(); // cc
9193    return this.originalPrescription;
9194  }
9195
9196  public boolean hasOriginalPrescription() {
9197    return this.originalPrescription != null && !this.originalPrescription.isEmpty();
9198  }
9199
9200  /**
9201   * @param value {@link #originalPrescription} (Original prescription which has
9202   *              been superseded by this prescription to support the dispensing
9203   *              of pharmacy services, medications or products.)
9204   */
9205  public Claim setOriginalPrescription(Reference value) {
9206    this.originalPrescription = value;
9207    return this;
9208  }
9209
9210  /**
9211   * @return {@link #originalPrescription} The actual object that is the target of
9212   *         the reference. The reference library doesn't populate this, but you
9213   *         can use it to hold the resource if you resolve it. (Original
9214   *         prescription which has been superseded by this prescription to
9215   *         support the dispensing of pharmacy services, medications or
9216   *         products.)
9217   */
9218  public Resource getOriginalPrescriptionTarget() {
9219    return this.originalPrescriptionTarget;
9220  }
9221
9222  /**
9223   * @param value {@link #originalPrescription} The actual object that is the
9224   *              target of the reference. The reference library doesn't use
9225   *              these, but you can use it to hold the resource if you resolve
9226   *              it. (Original prescription which has been superseded by this
9227   *              prescription to support the dispensing of pharmacy services,
9228   *              medications or products.)
9229   */
9230  public Claim setOriginalPrescriptionTarget(Resource value) {
9231    this.originalPrescriptionTarget = value;
9232    return this;
9233  }
9234
9235  /**
9236   * @return {@link #payee} (The party to be reimbursed for cost of the products
9237   *         and services according to the terms of the policy.)
9238   */
9239  public PayeeComponent getPayee() {
9240    if (this.payee == null)
9241      if (Configuration.errorOnAutoCreate())
9242        throw new Error("Attempt to auto-create Claim.payee");
9243      else if (Configuration.doAutoCreate())
9244        this.payee = new PayeeComponent(); // cc
9245    return this.payee;
9246  }
9247
9248  public boolean hasPayee() {
9249    return this.payee != null && !this.payee.isEmpty();
9250  }
9251
9252  /**
9253   * @param value {@link #payee} (The party to be reimbursed for cost of the
9254   *              products and services according to the terms of the policy.)
9255   */
9256  public Claim setPayee(PayeeComponent value) {
9257    this.payee = value;
9258    return this;
9259  }
9260
9261  /**
9262   * @return {@link #referral} (A reference to a referral resource.)
9263   */
9264  public Reference getReferral() {
9265    if (this.referral == null)
9266      if (Configuration.errorOnAutoCreate())
9267        throw new Error("Attempt to auto-create Claim.referral");
9268      else if (Configuration.doAutoCreate())
9269        this.referral = new Reference(); // cc
9270    return this.referral;
9271  }
9272
9273  public boolean hasReferral() {
9274    return this.referral != null && !this.referral.isEmpty();
9275  }
9276
9277  /**
9278   * @param value {@link #referral} (A reference to a referral resource.)
9279   */
9280  public Claim setReferral(Reference value) {
9281    this.referral = value;
9282    return this;
9283  }
9284
9285  /**
9286   * @return {@link #referral} The actual object that is the target of the
9287   *         reference. The reference library doesn't populate this, but you can
9288   *         use it to hold the resource if you resolve it. (A reference to a
9289   *         referral resource.)
9290   */
9291  public ServiceRequest getReferralTarget() {
9292    if (this.referralTarget == null)
9293      if (Configuration.errorOnAutoCreate())
9294        throw new Error("Attempt to auto-create Claim.referral");
9295      else if (Configuration.doAutoCreate())
9296        this.referralTarget = new ServiceRequest(); // aa
9297    return this.referralTarget;
9298  }
9299
9300  /**
9301   * @param value {@link #referral} The actual object that is the target of the
9302   *              reference. The reference library doesn't use these, but you can
9303   *              use it to hold the resource if you resolve it. (A reference to a
9304   *              referral resource.)
9305   */
9306  public Claim setReferralTarget(ServiceRequest value) {
9307    this.referralTarget = value;
9308    return this;
9309  }
9310
9311  /**
9312   * @return {@link #facility} (Facility where the services were provided.)
9313   */
9314  public Reference getFacility() {
9315    if (this.facility == null)
9316      if (Configuration.errorOnAutoCreate())
9317        throw new Error("Attempt to auto-create Claim.facility");
9318      else if (Configuration.doAutoCreate())
9319        this.facility = new Reference(); // cc
9320    return this.facility;
9321  }
9322
9323  public boolean hasFacility() {
9324    return this.facility != null && !this.facility.isEmpty();
9325  }
9326
9327  /**
9328   * @param value {@link #facility} (Facility where the services were provided.)
9329   */
9330  public Claim setFacility(Reference value) {
9331    this.facility = value;
9332    return this;
9333  }
9334
9335  /**
9336   * @return {@link #facility} The actual object that is the target of the
9337   *         reference. The reference library doesn't populate this, but you can
9338   *         use it to hold the resource if you resolve it. (Facility where the
9339   *         services were provided.)
9340   */
9341  public Location getFacilityTarget() {
9342    if (this.facilityTarget == null)
9343      if (Configuration.errorOnAutoCreate())
9344        throw new Error("Attempt to auto-create Claim.facility");
9345      else if (Configuration.doAutoCreate())
9346        this.facilityTarget = new Location(); // aa
9347    return this.facilityTarget;
9348  }
9349
9350  /**
9351   * @param value {@link #facility} The actual object that is the target of the
9352   *              reference. The reference library doesn't use these, but you can
9353   *              use it to hold the resource if you resolve it. (Facility where
9354   *              the services were provided.)
9355   */
9356  public Claim setFacilityTarget(Location value) {
9357    this.facilityTarget = value;
9358    return this;
9359  }
9360
9361  /**
9362   * @return {@link #careTeam} (The members of the team who provided the products
9363   *         and services.)
9364   */
9365  public List<CareTeamComponent> getCareTeam() {
9366    if (this.careTeam == null)
9367      this.careTeam = new ArrayList<CareTeamComponent>();
9368    return this.careTeam;
9369  }
9370
9371  /**
9372   * @return Returns a reference to <code>this</code> for easy method chaining
9373   */
9374  public Claim setCareTeam(List<CareTeamComponent> theCareTeam) {
9375    this.careTeam = theCareTeam;
9376    return this;
9377  }
9378
9379  public boolean hasCareTeam() {
9380    if (this.careTeam == null)
9381      return false;
9382    for (CareTeamComponent item : this.careTeam)
9383      if (!item.isEmpty())
9384        return true;
9385    return false;
9386  }
9387
9388  public CareTeamComponent addCareTeam() { // 3
9389    CareTeamComponent t = new CareTeamComponent();
9390    if (this.careTeam == null)
9391      this.careTeam = new ArrayList<CareTeamComponent>();
9392    this.careTeam.add(t);
9393    return t;
9394  }
9395
9396  public Claim addCareTeam(CareTeamComponent t) { // 3
9397    if (t == null)
9398      return this;
9399    if (this.careTeam == null)
9400      this.careTeam = new ArrayList<CareTeamComponent>();
9401    this.careTeam.add(t);
9402    return this;
9403  }
9404
9405  /**
9406   * @return The first repetition of repeating field {@link #careTeam}, creating
9407   *         it if it does not already exist
9408   */
9409  public CareTeamComponent getCareTeamFirstRep() {
9410    if (getCareTeam().isEmpty()) {
9411      addCareTeam();
9412    }
9413    return getCareTeam().get(0);
9414  }
9415
9416  /**
9417   * @return {@link #supportingInfo} (Additional information codes regarding
9418   *         exceptions, special considerations, the condition, situation, prior
9419   *         or concurrent issues.)
9420   */
9421  public List<SupportingInformationComponent> getSupportingInfo() {
9422    if (this.supportingInfo == null)
9423      this.supportingInfo = new ArrayList<SupportingInformationComponent>();
9424    return this.supportingInfo;
9425  }
9426
9427  /**
9428   * @return Returns a reference to <code>this</code> for easy method chaining
9429   */
9430  public Claim setSupportingInfo(List<SupportingInformationComponent> theSupportingInfo) {
9431    this.supportingInfo = theSupportingInfo;
9432    return this;
9433  }
9434
9435  public boolean hasSupportingInfo() {
9436    if (this.supportingInfo == null)
9437      return false;
9438    for (SupportingInformationComponent item : this.supportingInfo)
9439      if (!item.isEmpty())
9440        return true;
9441    return false;
9442  }
9443
9444  public SupportingInformationComponent addSupportingInfo() { // 3
9445    SupportingInformationComponent t = new SupportingInformationComponent();
9446    if (this.supportingInfo == null)
9447      this.supportingInfo = new ArrayList<SupportingInformationComponent>();
9448    this.supportingInfo.add(t);
9449    return t;
9450  }
9451
9452  public Claim addSupportingInfo(SupportingInformationComponent t) { // 3
9453    if (t == null)
9454      return this;
9455    if (this.supportingInfo == null)
9456      this.supportingInfo = new ArrayList<SupportingInformationComponent>();
9457    this.supportingInfo.add(t);
9458    return this;
9459  }
9460
9461  /**
9462   * @return The first repetition of repeating field {@link #supportingInfo},
9463   *         creating it if it does not already exist
9464   */
9465  public SupportingInformationComponent getSupportingInfoFirstRep() {
9466    if (getSupportingInfo().isEmpty()) {
9467      addSupportingInfo();
9468    }
9469    return getSupportingInfo().get(0);
9470  }
9471
9472  /**
9473   * @return {@link #diagnosis} (Information about diagnoses relevant to the claim
9474   *         items.)
9475   */
9476  public List<DiagnosisComponent> getDiagnosis() {
9477    if (this.diagnosis == null)
9478      this.diagnosis = new ArrayList<DiagnosisComponent>();
9479    return this.diagnosis;
9480  }
9481
9482  /**
9483   * @return Returns a reference to <code>this</code> for easy method chaining
9484   */
9485  public Claim setDiagnosis(List<DiagnosisComponent> theDiagnosis) {
9486    this.diagnosis = theDiagnosis;
9487    return this;
9488  }
9489
9490  public boolean hasDiagnosis() {
9491    if (this.diagnosis == null)
9492      return false;
9493    for (DiagnosisComponent item : this.diagnosis)
9494      if (!item.isEmpty())
9495        return true;
9496    return false;
9497  }
9498
9499  public DiagnosisComponent addDiagnosis() { // 3
9500    DiagnosisComponent t = new DiagnosisComponent();
9501    if (this.diagnosis == null)
9502      this.diagnosis = new ArrayList<DiagnosisComponent>();
9503    this.diagnosis.add(t);
9504    return t;
9505  }
9506
9507  public Claim addDiagnosis(DiagnosisComponent t) { // 3
9508    if (t == null)
9509      return this;
9510    if (this.diagnosis == null)
9511      this.diagnosis = new ArrayList<DiagnosisComponent>();
9512    this.diagnosis.add(t);
9513    return this;
9514  }
9515
9516  /**
9517   * @return The first repetition of repeating field {@link #diagnosis}, creating
9518   *         it if it does not already exist
9519   */
9520  public DiagnosisComponent getDiagnosisFirstRep() {
9521    if (getDiagnosis().isEmpty()) {
9522      addDiagnosis();
9523    }
9524    return getDiagnosis().get(0);
9525  }
9526
9527  /**
9528   * @return {@link #procedure} (Procedures performed on the patient relevant to
9529   *         the billing items with the claim.)
9530   */
9531  public List<ProcedureComponent> getProcedure() {
9532    if (this.procedure == null)
9533      this.procedure = new ArrayList<ProcedureComponent>();
9534    return this.procedure;
9535  }
9536
9537  /**
9538   * @return Returns a reference to <code>this</code> for easy method chaining
9539   */
9540  public Claim setProcedure(List<ProcedureComponent> theProcedure) {
9541    this.procedure = theProcedure;
9542    return this;
9543  }
9544
9545  public boolean hasProcedure() {
9546    if (this.procedure == null)
9547      return false;
9548    for (ProcedureComponent item : this.procedure)
9549      if (!item.isEmpty())
9550        return true;
9551    return false;
9552  }
9553
9554  public ProcedureComponent addProcedure() { // 3
9555    ProcedureComponent t = new ProcedureComponent();
9556    if (this.procedure == null)
9557      this.procedure = new ArrayList<ProcedureComponent>();
9558    this.procedure.add(t);
9559    return t;
9560  }
9561
9562  public Claim addProcedure(ProcedureComponent t) { // 3
9563    if (t == null)
9564      return this;
9565    if (this.procedure == null)
9566      this.procedure = new ArrayList<ProcedureComponent>();
9567    this.procedure.add(t);
9568    return this;
9569  }
9570
9571  /**
9572   * @return The first repetition of repeating field {@link #procedure}, creating
9573   *         it if it does not already exist
9574   */
9575  public ProcedureComponent getProcedureFirstRep() {
9576    if (getProcedure().isEmpty()) {
9577      addProcedure();
9578    }
9579    return getProcedure().get(0);
9580  }
9581
9582  /**
9583   * @return {@link #insurance} (Financial instruments for reimbursement for the
9584   *         health care products and services specified on the claim.)
9585   */
9586  public List<InsuranceComponent> getInsurance() {
9587    if (this.insurance == null)
9588      this.insurance = new ArrayList<InsuranceComponent>();
9589    return this.insurance;
9590  }
9591
9592  /**
9593   * @return Returns a reference to <code>this</code> for easy method chaining
9594   */
9595  public Claim setInsurance(List<InsuranceComponent> theInsurance) {
9596    this.insurance = theInsurance;
9597    return this;
9598  }
9599
9600  public boolean hasInsurance() {
9601    if (this.insurance == null)
9602      return false;
9603    for (InsuranceComponent item : this.insurance)
9604      if (!item.isEmpty())
9605        return true;
9606    return false;
9607  }
9608
9609  public InsuranceComponent addInsurance() { // 3
9610    InsuranceComponent t = new InsuranceComponent();
9611    if (this.insurance == null)
9612      this.insurance = new ArrayList<InsuranceComponent>();
9613    this.insurance.add(t);
9614    return t;
9615  }
9616
9617  public Claim addInsurance(InsuranceComponent t) { // 3
9618    if (t == null)
9619      return this;
9620    if (this.insurance == null)
9621      this.insurance = new ArrayList<InsuranceComponent>();
9622    this.insurance.add(t);
9623    return this;
9624  }
9625
9626  /**
9627   * @return The first repetition of repeating field {@link #insurance}, creating
9628   *         it if it does not already exist
9629   */
9630  public InsuranceComponent getInsuranceFirstRep() {
9631    if (getInsurance().isEmpty()) {
9632      addInsurance();
9633    }
9634    return getInsurance().get(0);
9635  }
9636
9637  /**
9638   * @return {@link #accident} (Details of an accident which resulted in injuries
9639   *         which required the products and services listed in the claim.)
9640   */
9641  public AccidentComponent getAccident() {
9642    if (this.accident == null)
9643      if (Configuration.errorOnAutoCreate())
9644        throw new Error("Attempt to auto-create Claim.accident");
9645      else if (Configuration.doAutoCreate())
9646        this.accident = new AccidentComponent(); // cc
9647    return this.accident;
9648  }
9649
9650  public boolean hasAccident() {
9651    return this.accident != null && !this.accident.isEmpty();
9652  }
9653
9654  /**
9655   * @param value {@link #accident} (Details of an accident which resulted in
9656   *              injuries which required the products and services listed in the
9657   *              claim.)
9658   */
9659  public Claim setAccident(AccidentComponent value) {
9660    this.accident = value;
9661    return this;
9662  }
9663
9664  /**
9665   * @return {@link #item} (A claim line. Either a simple product or service or a
9666   *         'group' of details which can each be a simple items or groups of
9667   *         sub-details.)
9668   */
9669  public List<ItemComponent> getItem() {
9670    if (this.item == null)
9671      this.item = new ArrayList<ItemComponent>();
9672    return this.item;
9673  }
9674
9675  /**
9676   * @return Returns a reference to <code>this</code> for easy method chaining
9677   */
9678  public Claim setItem(List<ItemComponent> theItem) {
9679    this.item = theItem;
9680    return this;
9681  }
9682
9683  public boolean hasItem() {
9684    if (this.item == null)
9685      return false;
9686    for (ItemComponent item : this.item)
9687      if (!item.isEmpty())
9688        return true;
9689    return false;
9690  }
9691
9692  public ItemComponent addItem() { // 3
9693    ItemComponent t = new ItemComponent();
9694    if (this.item == null)
9695      this.item = new ArrayList<ItemComponent>();
9696    this.item.add(t);
9697    return t;
9698  }
9699
9700  public Claim addItem(ItemComponent t) { // 3
9701    if (t == null)
9702      return this;
9703    if (this.item == null)
9704      this.item = new ArrayList<ItemComponent>();
9705    this.item.add(t);
9706    return this;
9707  }
9708
9709  /**
9710   * @return The first repetition of repeating field {@link #item}, creating it if
9711   *         it does not already exist
9712   */
9713  public ItemComponent getItemFirstRep() {
9714    if (getItem().isEmpty()) {
9715      addItem();
9716    }
9717    return getItem().get(0);
9718  }
9719
9720  /**
9721   * @return {@link #total} (The total value of the all the items in the claim.)
9722   */
9723  public Money getTotal() {
9724    if (this.total == null)
9725      if (Configuration.errorOnAutoCreate())
9726        throw new Error("Attempt to auto-create Claim.total");
9727      else if (Configuration.doAutoCreate())
9728        this.total = new Money(); // cc
9729    return this.total;
9730  }
9731
9732  public boolean hasTotal() {
9733    return this.total != null && !this.total.isEmpty();
9734  }
9735
9736  /**
9737   * @param value {@link #total} (The total value of the all the items in the
9738   *              claim.)
9739   */
9740  public Claim setTotal(Money value) {
9741    this.total = value;
9742    return this;
9743  }
9744
9745  protected void listChildren(List<Property> children) {
9746    super.listChildren(children);
9747    children.add(new Property("identifier", "Identifier", "A unique identifier assigned to this claim.", 0,
9748        java.lang.Integer.MAX_VALUE, identifier));
9749    children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
9750    children.add(new Property("type", "CodeableConcept",
9751        "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type));
9752    children.add(new Property("subType", "CodeableConcept",
9753        "A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.",
9754        0, 1, subType));
9755    children.add(new Property("use", "code",
9756        "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.",
9757        0, 1, use));
9758    children.add(new Property("patient", "Reference(Patient)",
9759        "The party to whom the professional services and/or products have been supplied or are being considered and for whom actual or forecast reimbursement is sought.",
9760        0, 1, patient));
9761    children.add(new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1,
9762        billablePeriod));
9763    children.add(new Property("created", "dateTime", "The date this resource was created.", 0, 1, created));
9764    children.add(new Property("enterer", "Reference(Practitioner|PractitionerRole)",
9765        "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer));
9766    children.add(
9767        new Property("insurer", "Reference(Organization)", "The Insurer who is target of the request.", 0, 1, insurer));
9768    children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
9769        "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider));
9770    children.add(new Property("priority", "CodeableConcept",
9771        "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.", 0,
9772        1, priority));
9773    children.add(new Property("fundsReserve", "CodeableConcept",
9774        "A code to indicate whether and for whom funds are to be reserved for future claims.", 0, 1, fundsReserve));
9775    children.add(new Property("related", "",
9776        "Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.",
9777        0, java.lang.Integer.MAX_VALUE, related));
9778    children.add(new Property("prescription", "Reference(DeviceRequest|MedicationRequest|VisionPrescription)",
9779        "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription));
9780    children.add(new Property("originalPrescription", "Reference(DeviceRequest|MedicationRequest|VisionPrescription)",
9781        "Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.",
9782        0, 1, originalPrescription));
9783    children.add(new Property("payee", "",
9784        "The party to be reimbursed for cost of the pro