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.NULL)
202           return null;
203       if (code == ClaimStatus.ACTIVE)
204        return "active";
205      if (code == ClaimStatus.CANCELLED)
206        return "cancelled";
207      if (code == ClaimStatus.DRAFT)
208        return "draft";
209      if (code == ClaimStatus.ENTEREDINERROR)
210        return "entered-in-error";
211      return "?";
212   }
213
214    public String toSystem(ClaimStatus code) {
215      return code.getSystem();
216    }
217  }
218
219  public enum Use {
220    /**
221     * The treatment is complete and this represents a Claim for the services.
222     */
223    CLAIM,
224    /**
225     * The treatment is proposed and this represents a Pre-authorization for the
226     * services.
227     */
228    PREAUTHORIZATION,
229    /**
230     * The treatment is proposed and this represents a Pre-determination for the
231     * services.
232     */
233    PREDETERMINATION,
234    /**
235     * added to help the parsers with the generic types
236     */
237    NULL;
238
239    public static Use fromCode(String codeString) throws FHIRException {
240      if (codeString == null || "".equals(codeString))
241        return null;
242      if ("claim".equals(codeString))
243        return CLAIM;
244      if ("preauthorization".equals(codeString))
245        return PREAUTHORIZATION;
246      if ("predetermination".equals(codeString))
247        return PREDETERMINATION;
248      if (Configuration.isAcceptInvalidEnums())
249        return null;
250      else
251        throw new FHIRException("Unknown Use code '" + codeString + "'");
252    }
253
254    public String toCode() {
255      switch (this) {
256      case CLAIM:
257        return "claim";
258      case PREAUTHORIZATION:
259        return "preauthorization";
260      case PREDETERMINATION:
261        return "predetermination";
262      case NULL:
263        return null;
264      default:
265        return "?";
266      }
267    }
268
269    public String getSystem() {
270      switch (this) {
271      case CLAIM:
272        return "http://hl7.org/fhir/claim-use";
273      case PREAUTHORIZATION:
274        return "http://hl7.org/fhir/claim-use";
275      case PREDETERMINATION:
276        return "http://hl7.org/fhir/claim-use";
277      case NULL:
278        return null;
279      default:
280        return "?";
281      }
282    }
283
284    public String getDefinition() {
285      switch (this) {
286      case CLAIM:
287        return "The treatment is complete and this represents a Claim for the services.";
288      case PREAUTHORIZATION:
289        return "The treatment is proposed and this represents a Pre-authorization for the services.";
290      case PREDETERMINATION:
291        return "The treatment is proposed and this represents a Pre-determination for the services.";
292      case NULL:
293        return null;
294      default:
295        return "?";
296      }
297    }
298
299    public String getDisplay() {
300      switch (this) {
301      case CLAIM:
302        return "Claim";
303      case PREAUTHORIZATION:
304        return "Preauthorization";
305      case PREDETERMINATION:
306        return "Predetermination";
307      case NULL:
308        return null;
309      default:
310        return "?";
311      }
312    }
313  }
314
315  public static class UseEnumFactory implements EnumFactory<Use> {
316    public Use fromCode(String codeString) throws IllegalArgumentException {
317      if (codeString == null || "".equals(codeString))
318        if (codeString == null || "".equals(codeString))
319          return null;
320      if ("claim".equals(codeString))
321        return Use.CLAIM;
322      if ("preauthorization".equals(codeString))
323        return Use.PREAUTHORIZATION;
324      if ("predetermination".equals(codeString))
325        return Use.PREDETERMINATION;
326      throw new IllegalArgumentException("Unknown Use code '" + codeString + "'");
327    }
328
329    public Enumeration<Use> fromType(PrimitiveType<?> code) throws FHIRException {
330      if (code == null)
331        return null;
332      if (code.isEmpty())
333        return new Enumeration<Use>(this, Use.NULL, code);
334      String codeString = code.asStringValue();
335      if (codeString == null || "".equals(codeString))
336        return new Enumeration<Use>(this, Use.NULL, code);
337      if ("claim".equals(codeString))
338        return new Enumeration<Use>(this, Use.CLAIM, code);
339      if ("preauthorization".equals(codeString))
340        return new Enumeration<Use>(this, Use.PREAUTHORIZATION, code);
341      if ("predetermination".equals(codeString))
342        return new Enumeration<Use>(this, Use.PREDETERMINATION, code);
343      throw new FHIRException("Unknown Use code '" + codeString + "'");
344    }
345
346    public String toCode(Use code) {
347       if (code == Use.NULL)
348           return null;
349       if (code == Use.CLAIM)
350        return "claim";
351      if (code == Use.PREAUTHORIZATION)
352        return "preauthorization";
353      if (code == Use.PREDETERMINATION)
354        return "predetermination";
355      return "?";
356   }
357
358    public String toSystem(Use code) {
359      return code.getSystem();
360    }
361  }
362
363  @Block()
364  public static class RelatedClaimComponent extends BackboneElement implements IBaseBackboneElement {
365    /**
366     * Reference to a related claim.
367     */
368    @Child(name = "claim", type = { Claim.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
369    @Description(shortDefinition = "Reference to the related claim", formalDefinition = "Reference to a related claim.")
370    protected Reference claim;
371
372    /**
373     * The actual object that is the target of the reference (Reference to a related
374     * claim.)
375     */
376    protected Claim claimTarget;
377
378    /**
379     * A code to convey how the claims are related.
380     */
381    @Child(name = "relationship", type = {
382        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
383    @Description(shortDefinition = "How the reference claim is related", formalDefinition = "A code to convey how the claims are related.")
384    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/related-claim-relationship")
385    protected CodeableConcept relationship;
386
387    /**
388     * An alternate organizational reference to the case or file to which this
389     * particular claim pertains.
390     */
391    @Child(name = "reference", type = {
392        Identifier.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
393    @Description(shortDefinition = "File or case reference", formalDefinition = "An alternate organizational reference to the case or file to which this particular claim pertains.")
394    protected Identifier reference;
395
396    private static final long serialVersionUID = -379338905L;
397
398    /**
399     * Constructor
400     */
401    public RelatedClaimComponent() {
402      super();
403    }
404
405    /**
406     * @return {@link #claim} (Reference to a related claim.)
407     */
408    public Reference getClaim() {
409      if (this.claim == null)
410        if (Configuration.errorOnAutoCreate())
411          throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
412        else if (Configuration.doAutoCreate())
413          this.claim = new Reference(); // cc
414      return this.claim;
415    }
416
417    public boolean hasClaim() {
418      return this.claim != null && !this.claim.isEmpty();
419    }
420
421    /**
422     * @param value {@link #claim} (Reference to a related claim.)
423     */
424    public RelatedClaimComponent setClaim(Reference value) {
425      this.claim = value;
426      return this;
427    }
428
429    /**
430     * @return {@link #claim} The actual object that is the target of the reference.
431     *         The reference library doesn't populate this, but you can use it to
432     *         hold the resource if you resolve it. (Reference to a related claim.)
433     */
434    public Claim getClaimTarget() {
435      if (this.claimTarget == null)
436        if (Configuration.errorOnAutoCreate())
437          throw new Error("Attempt to auto-create RelatedClaimComponent.claim");
438        else if (Configuration.doAutoCreate())
439          this.claimTarget = new Claim(); // aa
440      return this.claimTarget;
441    }
442
443    /**
444     * @param value {@link #claim} The actual object that is the target of the
445     *              reference. The reference library doesn't use these, but you can
446     *              use it to hold the resource if you resolve it. (Reference to a
447     *              related claim.)
448     */
449    public RelatedClaimComponent setClaimTarget(Claim value) {
450      this.claimTarget = value;
451      return this;
452    }
453
454    /**
455     * @return {@link #relationship} (A code to convey how the claims are related.)
456     */
457    public CodeableConcept getRelationship() {
458      if (this.relationship == null)
459        if (Configuration.errorOnAutoCreate())
460          throw new Error("Attempt to auto-create RelatedClaimComponent.relationship");
461        else if (Configuration.doAutoCreate())
462          this.relationship = new CodeableConcept(); // cc
463      return this.relationship;
464    }
465
466    public boolean hasRelationship() {
467      return this.relationship != null && !this.relationship.isEmpty();
468    }
469
470    /**
471     * @param value {@link #relationship} (A code to convey how the claims are
472     *              related.)
473     */
474    public RelatedClaimComponent setRelationship(CodeableConcept value) {
475      this.relationship = value;
476      return this;
477    }
478
479    /**
480     * @return {@link #reference} (An alternate organizational reference to the case
481     *         or file to which this particular claim pertains.)
482     */
483    public Identifier getReference() {
484      if (this.reference == null)
485        if (Configuration.errorOnAutoCreate())
486          throw new Error("Attempt to auto-create RelatedClaimComponent.reference");
487        else if (Configuration.doAutoCreate())
488          this.reference = new Identifier(); // cc
489      return this.reference;
490    }
491
492    public boolean hasReference() {
493      return this.reference != null && !this.reference.isEmpty();
494    }
495
496    /**
497     * @param value {@link #reference} (An alternate organizational reference to the
498     *              case or file to which this particular claim pertains.)
499     */
500    public RelatedClaimComponent setReference(Identifier value) {
501      this.reference = value;
502      return this;
503    }
504
505    protected void listChildren(List<Property> children) {
506      super.listChildren(children);
507      children.add(new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim));
508      children.add(new Property("relationship", "CodeableConcept", "A code to convey how the claims are related.", 0, 1,
509          relationship));
510      children.add(new Property("reference", "Identifier",
511          "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1,
512          reference));
513    }
514
515    @Override
516    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
517      switch (_hash) {
518      case 94742588:
519        /* claim */ return new Property("claim", "Reference(Claim)", "Reference to a related claim.", 0, 1, claim);
520      case -261851592:
521        /* relationship */ return new Property("relationship", "CodeableConcept",
522            "A code to convey how the claims are related.", 0, 1, relationship);
523      case -925155509:
524        /* reference */ return new Property("reference", "Identifier",
525            "An alternate organizational reference to the case or file to which this particular claim pertains.", 0, 1,
526            reference);
527      default:
528        return super.getNamedProperty(_hash, _name, _checkValid);
529      }
530
531    }
532
533    @Override
534    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
535      switch (hash) {
536      case 94742588:
537        /* claim */ return this.claim == null ? new Base[0] : new Base[] { this.claim }; // Reference
538      case -261851592:
539        /* relationship */ return this.relationship == null ? new Base[0] : new Base[] { this.relationship }; // CodeableConcept
540      case -925155509:
541        /* reference */ return this.reference == null ? new Base[0] : new Base[] { this.reference }; // Identifier
542      default:
543        return super.getProperty(hash, name, checkValid);
544      }
545
546    }
547
548    @Override
549    public Base setProperty(int hash, String name, Base value) throws FHIRException {
550      switch (hash) {
551      case 94742588: // claim
552        this.claim = castToReference(value); // Reference
553        return value;
554      case -261851592: // relationship
555        this.relationship = castToCodeableConcept(value); // CodeableConcept
556        return value;
557      case -925155509: // reference
558        this.reference = castToIdentifier(value); // Identifier
559        return value;
560      default:
561        return super.setProperty(hash, name, value);
562      }
563
564    }
565
566    @Override
567    public Base setProperty(String name, Base value) throws FHIRException {
568      if (name.equals("claim")) {
569        this.claim = castToReference(value); // Reference
570      } else if (name.equals("relationship")) {
571        this.relationship = castToCodeableConcept(value); // CodeableConcept
572      } else if (name.equals("reference")) {
573        this.reference = castToIdentifier(value); // Identifier
574      } else
575        return super.setProperty(name, value);
576      return value;
577    }
578
579  @Override
580  public void removeChild(String name, Base value) throws FHIRException {
581      if (name.equals("claim")) {
582        this.claim = null;
583      } else if (name.equals("relationship")) {
584        this.relationship = null;
585      } else if (name.equals("reference")) {
586        this.reference = null;
587      } else
588        super.removeChild(name, value);
589      
590    }
591
592    @Override
593    public Base makeProperty(int hash, String name) throws FHIRException {
594      switch (hash) {
595      case 94742588:
596        return getClaim();
597      case -261851592:
598        return getRelationship();
599      case -925155509:
600        return getReference();
601      default:
602        return super.makeProperty(hash, name);
603      }
604
605    }
606
607    @Override
608    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
609      switch (hash) {
610      case 94742588:
611        /* claim */ return new String[] { "Reference" };
612      case -261851592:
613        /* relationship */ return new String[] { "CodeableConcept" };
614      case -925155509:
615        /* reference */ return new String[] { "Identifier" };
616      default:
617        return super.getTypesForProperty(hash, name);
618      }
619
620    }
621
622    @Override
623    public Base addChild(String name) throws FHIRException {
624      if (name.equals("claim")) {
625        this.claim = new Reference();
626        return this.claim;
627      } else if (name.equals("relationship")) {
628        this.relationship = new CodeableConcept();
629        return this.relationship;
630      } else if (name.equals("reference")) {
631        this.reference = new Identifier();
632        return this.reference;
633      } else
634        return super.addChild(name);
635    }
636
637    public RelatedClaimComponent copy() {
638      RelatedClaimComponent dst = new RelatedClaimComponent();
639      copyValues(dst);
640      return dst;
641    }
642
643    public void copyValues(RelatedClaimComponent dst) {
644      super.copyValues(dst);
645      dst.claim = claim == null ? null : claim.copy();
646      dst.relationship = relationship == null ? null : relationship.copy();
647      dst.reference = reference == null ? null : reference.copy();
648    }
649
650    @Override
651    public boolean equalsDeep(Base other_) {
652      if (!super.equalsDeep(other_))
653        return false;
654      if (!(other_ instanceof RelatedClaimComponent))
655        return false;
656      RelatedClaimComponent o = (RelatedClaimComponent) other_;
657      return compareDeep(claim, o.claim, true) && compareDeep(relationship, o.relationship, true)
658          && compareDeep(reference, o.reference, true);
659    }
660
661    @Override
662    public boolean equalsShallow(Base other_) {
663      if (!super.equalsShallow(other_))
664        return false;
665      if (!(other_ instanceof RelatedClaimComponent))
666        return false;
667      RelatedClaimComponent o = (RelatedClaimComponent) other_;
668      return true;
669    }
670
671    public boolean isEmpty() {
672      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(claim, relationship, reference);
673    }
674
675    public String fhirType() {
676      return "Claim.related";
677
678    }
679
680  }
681
682  @Block()
683  public static class PayeeComponent extends BackboneElement implements IBaseBackboneElement {
684    /**
685     * Type of Party to be reimbursed: subscriber, provider, other.
686     */
687    @Child(name = "type", type = {
688        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
689    @Description(shortDefinition = "Category of recipient", formalDefinition = "Type of Party to be reimbursed: subscriber, provider, other.")
690    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/payeetype")
691    protected CodeableConcept type;
692
693    /**
694     * Reference to the individual or organization to whom any payment will be made.
695     */
696    @Child(name = "party", type = { Practitioner.class, PractitionerRole.class, Organization.class, Patient.class,
697        RelatedPerson.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
698    @Description(shortDefinition = "Recipient reference", formalDefinition = "Reference to the individual or organization to whom any payment will be made.")
699    protected Reference party;
700
701    /**
702     * The actual object that is the target of the reference (Reference to the
703     * individual or organization to whom any payment will be made.)
704     */
705    protected Resource partyTarget;
706
707    private static final long serialVersionUID = 1609484699L;
708
709    /**
710     * Constructor
711     */
712    public PayeeComponent() {
713      super();
714    }
715
716    /**
717     * Constructor
718     */
719    public PayeeComponent(CodeableConcept type) {
720      super();
721      this.type = type;
722    }
723
724    /**
725     * @return {@link #type} (Type of Party to be reimbursed: subscriber, provider,
726     *         other.)
727     */
728    public CodeableConcept getType() {
729      if (this.type == null)
730        if (Configuration.errorOnAutoCreate())
731          throw new Error("Attempt to auto-create PayeeComponent.type");
732        else if (Configuration.doAutoCreate())
733          this.type = new CodeableConcept(); // cc
734      return this.type;
735    }
736
737    public boolean hasType() {
738      return this.type != null && !this.type.isEmpty();
739    }
740
741    /**
742     * @param value {@link #type} (Type of Party to be reimbursed: subscriber,
743     *              provider, other.)
744     */
745    public PayeeComponent setType(CodeableConcept value) {
746      this.type = value;
747      return this;
748    }
749
750    /**
751     * @return {@link #party} (Reference to the individual or organization to whom
752     *         any payment will be made.)
753     */
754    public Reference getParty() {
755      if (this.party == null)
756        if (Configuration.errorOnAutoCreate())
757          throw new Error("Attempt to auto-create PayeeComponent.party");
758        else if (Configuration.doAutoCreate())
759          this.party = new Reference(); // cc
760      return this.party;
761    }
762
763    public boolean hasParty() {
764      return this.party != null && !this.party.isEmpty();
765    }
766
767    /**
768     * @param value {@link #party} (Reference to the individual or organization to
769     *              whom any payment will be made.)
770     */
771    public PayeeComponent setParty(Reference value) {
772      this.party = value;
773      return this;
774    }
775
776    /**
777     * @return {@link #party} The actual object that is the target of the reference.
778     *         The reference library doesn't populate this, but you can use it to
779     *         hold the resource if you resolve it. (Reference to the individual or
780     *         organization to whom any payment will be made.)
781     */
782    public Resource getPartyTarget() {
783      return this.partyTarget;
784    }
785
786    /**
787     * @param value {@link #party} The actual object that is the target of the
788     *              reference. The reference library doesn't use these, but you can
789     *              use it to hold the resource if you resolve it. (Reference to the
790     *              individual or organization to whom any payment will be made.)
791     */
792    public PayeeComponent setPartyTarget(Resource value) {
793      this.partyTarget = value;
794      return this;
795    }
796
797    protected void listChildren(List<Property> children) {
798      super.listChildren(children);
799      children.add(new Property("type", "CodeableConcept",
800          "Type of Party to be reimbursed: subscriber, provider, other.", 0, 1, type));
801      children.add(new Property("party", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)",
802          "Reference to the individual or organization to whom any payment will be made.", 0, 1, party));
803    }
804
805    @Override
806    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
807      switch (_hash) {
808      case 3575610:
809        /* type */ return new Property("type", "CodeableConcept",
810            "Type of Party to be reimbursed: subscriber, provider, other.", 0, 1, type);
811      case 106437350:
812        /* party */ return new Property("party",
813            "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson)",
814            "Reference to the individual or organization to whom any payment will be made.", 0, 1, party);
815      default:
816        return super.getNamedProperty(_hash, _name, _checkValid);
817      }
818
819    }
820
821    @Override
822    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
823      switch (hash) {
824      case 3575610:
825        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
826      case 106437350:
827        /* party */ return this.party == null ? new Base[0] : new Base[] { this.party }; // Reference
828      default:
829        return super.getProperty(hash, name, checkValid);
830      }
831
832    }
833
834    @Override
835    public Base setProperty(int hash, String name, Base value) throws FHIRException {
836      switch (hash) {
837      case 3575610: // type
838        this.type = castToCodeableConcept(value); // CodeableConcept
839        return value;
840      case 106437350: // party
841        this.party = castToReference(value); // Reference
842        return value;
843      default:
844        return super.setProperty(hash, name, value);
845      }
846
847    }
848
849    @Override
850    public Base setProperty(String name, Base value) throws FHIRException {
851      if (name.equals("type")) {
852        this.type = castToCodeableConcept(value); // CodeableConcept
853      } else if (name.equals("party")) {
854        this.party = castToReference(value); // Reference
855      } else
856        return super.setProperty(name, value);
857      return value;
858    }
859
860  @Override
861  public void removeChild(String name, Base value) throws FHIRException {
862      if (name.equals("type")) {
863        this.type = null;
864      } else if (name.equals("party")) {
865        this.party = null;
866      } else
867        super.removeChild(name, value);
868      
869    }
870
871    @Override
872    public Base makeProperty(int hash, String name) throws FHIRException {
873      switch (hash) {
874      case 3575610:
875        return getType();
876      case 106437350:
877        return getParty();
878      default:
879        return super.makeProperty(hash, name);
880      }
881
882    }
883
884    @Override
885    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
886      switch (hash) {
887      case 3575610:
888        /* type */ return new String[] { "CodeableConcept" };
889      case 106437350:
890        /* party */ return new String[] { "Reference" };
891      default:
892        return super.getTypesForProperty(hash, name);
893      }
894
895    }
896
897    @Override
898    public Base addChild(String name) throws FHIRException {
899      if (name.equals("type")) {
900        this.type = new CodeableConcept();
901        return this.type;
902      } else if (name.equals("party")) {
903        this.party = new Reference();
904        return this.party;
905      } else
906        return super.addChild(name);
907    }
908
909    public PayeeComponent copy() {
910      PayeeComponent dst = new PayeeComponent();
911      copyValues(dst);
912      return dst;
913    }
914
915    public void copyValues(PayeeComponent dst) {
916      super.copyValues(dst);
917      dst.type = type == null ? null : type.copy();
918      dst.party = party == null ? null : party.copy();
919    }
920
921    @Override
922    public boolean equalsDeep(Base other_) {
923      if (!super.equalsDeep(other_))
924        return false;
925      if (!(other_ instanceof PayeeComponent))
926        return false;
927      PayeeComponent o = (PayeeComponent) other_;
928      return compareDeep(type, o.type, true) && compareDeep(party, o.party, true);
929    }
930
931    @Override
932    public boolean equalsShallow(Base other_) {
933      if (!super.equalsShallow(other_))
934        return false;
935      if (!(other_ instanceof PayeeComponent))
936        return false;
937      PayeeComponent o = (PayeeComponent) other_;
938      return true;
939    }
940
941    public boolean isEmpty() {
942      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, party);
943    }
944
945    public String fhirType() {
946      return "Claim.payee";
947
948    }
949
950  }
951
952  @Block()
953  public static class CareTeamComponent extends BackboneElement implements IBaseBackboneElement {
954    /**
955     * A number to uniquely identify care team entries.
956     */
957    @Child(name = "sequence", type = {
958        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
959    @Description(shortDefinition = "Order of care team", formalDefinition = "A number to uniquely identify care team entries.")
960    protected PositiveIntType sequence;
961
962    /**
963     * Member of the team who provided the product or service.
964     */
965    @Child(name = "provider", type = { Practitioner.class, PractitionerRole.class,
966        Organization.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
967    @Description(shortDefinition = "Practitioner or organization", formalDefinition = "Member of the team who provided the product or service.")
968    protected Reference provider;
969
970    /**
971     * The actual object that is the target of the reference (Member of the team who
972     * provided the product or service.)
973     */
974    protected Resource providerTarget;
975
976    /**
977     * The party who is billing and/or responsible for the claimed products or
978     * services.
979     */
980    @Child(name = "responsible", type = {
981        BooleanType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
982    @Description(shortDefinition = "Indicator of the lead practitioner", formalDefinition = "The party who is billing and/or responsible for the claimed products or services.")
983    protected BooleanType responsible;
984
985    /**
986     * The lead, assisting or supervising practitioner and their discipline if a
987     * multidisciplinary team.
988     */
989    @Child(name = "role", type = {
990        CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
991    @Description(shortDefinition = "Function within the team", formalDefinition = "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.")
992    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-careteamrole")
993    protected CodeableConcept role;
994
995    /**
996     * The qualification of the practitioner which is applicable for this service.
997     */
998    @Child(name = "qualification", type = {
999        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
1000    @Description(shortDefinition = "Practitioner credential or specialization", formalDefinition = "The qualification of the practitioner which is applicable for this service.")
1001    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/provider-qualification")
1002    protected CodeableConcept qualification;
1003
1004    private static final long serialVersionUID = 1758966968L;
1005
1006    /**
1007     * Constructor
1008     */
1009    public CareTeamComponent() {
1010      super();
1011    }
1012
1013    /**
1014     * Constructor
1015     */
1016    public CareTeamComponent(PositiveIntType sequence, Reference provider) {
1017      super();
1018      this.sequence = sequence;
1019      this.provider = provider;
1020    }
1021
1022    /**
1023     * @return {@link #sequence} (A number to uniquely identify care team entries.).
1024     *         This is the underlying object with id, value and extensions. The
1025     *         accessor "getSequence" gives direct access to the value
1026     */
1027    public PositiveIntType getSequenceElement() {
1028      if (this.sequence == null)
1029        if (Configuration.errorOnAutoCreate())
1030          throw new Error("Attempt to auto-create CareTeamComponent.sequence");
1031        else if (Configuration.doAutoCreate())
1032          this.sequence = new PositiveIntType(); // bb
1033      return this.sequence;
1034    }
1035
1036    public boolean hasSequenceElement() {
1037      return this.sequence != null && !this.sequence.isEmpty();
1038    }
1039
1040    public boolean hasSequence() {
1041      return this.sequence != null && !this.sequence.isEmpty();
1042    }
1043
1044    /**
1045     * @param value {@link #sequence} (A number to uniquely identify care team
1046     *              entries.). This is the underlying object with id, value and
1047     *              extensions. The accessor "getSequence" gives direct access to
1048     *              the value
1049     */
1050    public CareTeamComponent setSequenceElement(PositiveIntType value) {
1051      this.sequence = value;
1052      return this;
1053    }
1054
1055    /**
1056     * @return A number to uniquely identify care team entries.
1057     */
1058    public int getSequence() {
1059      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1060    }
1061
1062    /**
1063     * @param value A number to uniquely identify care team entries.
1064     */
1065    public CareTeamComponent setSequence(int value) {
1066      if (this.sequence == null)
1067        this.sequence = new PositiveIntType();
1068      this.sequence.setValue(value);
1069      return this;
1070    }
1071
1072    /**
1073     * @return {@link #provider} (Member of the team who provided the product or
1074     *         service.)
1075     */
1076    public Reference getProvider() {
1077      if (this.provider == null)
1078        if (Configuration.errorOnAutoCreate())
1079          throw new Error("Attempt to auto-create CareTeamComponent.provider");
1080        else if (Configuration.doAutoCreate())
1081          this.provider = new Reference(); // cc
1082      return this.provider;
1083    }
1084
1085    public boolean hasProvider() {
1086      return this.provider != null && !this.provider.isEmpty();
1087    }
1088
1089    /**
1090     * @param value {@link #provider} (Member of the team who provided the product
1091     *              or service.)
1092     */
1093    public CareTeamComponent setProvider(Reference value) {
1094      this.provider = value;
1095      return this;
1096    }
1097
1098    /**
1099     * @return {@link #provider} The actual object that is the target of the
1100     *         reference. The reference library doesn't populate this, but you can
1101     *         use it to hold the resource if you resolve it. (Member of the team
1102     *         who provided the product or service.)
1103     */
1104    public Resource getProviderTarget() {
1105      return this.providerTarget;
1106    }
1107
1108    /**
1109     * @param value {@link #provider} The actual object that is the target of the
1110     *              reference. The reference library doesn't use these, but you can
1111     *              use it to hold the resource if you resolve it. (Member of the
1112     *              team who provided the product or service.)
1113     */
1114    public CareTeamComponent setProviderTarget(Resource value) {
1115      this.providerTarget = value;
1116      return this;
1117    }
1118
1119    /**
1120     * @return {@link #responsible} (The party who is billing and/or responsible for
1121     *         the claimed products or services.). This is the underlying object
1122     *         with id, value and extensions. The accessor "getResponsible" gives
1123     *         direct access to the value
1124     */
1125    public BooleanType getResponsibleElement() {
1126      if (this.responsible == null)
1127        if (Configuration.errorOnAutoCreate())
1128          throw new Error("Attempt to auto-create CareTeamComponent.responsible");
1129        else if (Configuration.doAutoCreate())
1130          this.responsible = new BooleanType(); // bb
1131      return this.responsible;
1132    }
1133
1134    public boolean hasResponsibleElement() {
1135      return this.responsible != null && !this.responsible.isEmpty();
1136    }
1137
1138    public boolean hasResponsible() {
1139      return this.responsible != null && !this.responsible.isEmpty();
1140    }
1141
1142    /**
1143     * @param value {@link #responsible} (The party who is billing and/or
1144     *              responsible for the claimed products or services.). This is the
1145     *              underlying object with id, value and extensions. The accessor
1146     *              "getResponsible" gives direct access to the value
1147     */
1148    public CareTeamComponent setResponsibleElement(BooleanType value) {
1149      this.responsible = value;
1150      return this;
1151    }
1152
1153    /**
1154     * @return The party who is billing and/or responsible for the claimed products
1155     *         or services.
1156     */
1157    public boolean getResponsible() {
1158      return this.responsible == null || this.responsible.isEmpty() ? false : this.responsible.getValue();
1159    }
1160
1161    /**
1162     * @param value The party who is billing and/or responsible for the claimed
1163     *              products or services.
1164     */
1165    public CareTeamComponent setResponsible(boolean value) {
1166      if (this.responsible == null)
1167        this.responsible = new BooleanType();
1168      this.responsible.setValue(value);
1169      return this;
1170    }
1171
1172    /**
1173     * @return {@link #role} (The lead, assisting or supervising practitioner and
1174     *         their discipline if a multidisciplinary team.)
1175     */
1176    public CodeableConcept getRole() {
1177      if (this.role == null)
1178        if (Configuration.errorOnAutoCreate())
1179          throw new Error("Attempt to auto-create CareTeamComponent.role");
1180        else if (Configuration.doAutoCreate())
1181          this.role = new CodeableConcept(); // cc
1182      return this.role;
1183    }
1184
1185    public boolean hasRole() {
1186      return this.role != null && !this.role.isEmpty();
1187    }
1188
1189    /**
1190     * @param value {@link #role} (The lead, assisting or supervising practitioner
1191     *              and their discipline if a multidisciplinary team.)
1192     */
1193    public CareTeamComponent setRole(CodeableConcept value) {
1194      this.role = value;
1195      return this;
1196    }
1197
1198    /**
1199     * @return {@link #qualification} (The qualification of the practitioner which
1200     *         is applicable for this service.)
1201     */
1202    public CodeableConcept getQualification() {
1203      if (this.qualification == null)
1204        if (Configuration.errorOnAutoCreate())
1205          throw new Error("Attempt to auto-create CareTeamComponent.qualification");
1206        else if (Configuration.doAutoCreate())
1207          this.qualification = new CodeableConcept(); // cc
1208      return this.qualification;
1209    }
1210
1211    public boolean hasQualification() {
1212      return this.qualification != null && !this.qualification.isEmpty();
1213    }
1214
1215    /**
1216     * @param value {@link #qualification} (The qualification of the practitioner
1217     *              which is applicable for this service.)
1218     */
1219    public CareTeamComponent setQualification(CodeableConcept value) {
1220      this.qualification = value;
1221      return this;
1222    }
1223
1224    protected void listChildren(List<Property> children) {
1225      super.listChildren(children);
1226      children.add(
1227          new Property("sequence", "positiveInt", "A number to uniquely identify care team entries.", 0, 1, sequence));
1228      children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
1229          "Member of the team who provided the product or service.", 0, 1, provider));
1230      children.add(new Property("responsible", "boolean",
1231          "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible));
1232      children.add(new Property("role", "CodeableConcept",
1233          "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1,
1234          role));
1235      children.add(new Property("qualification", "CodeableConcept",
1236          "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification));
1237    }
1238
1239    @Override
1240    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1241      switch (_hash) {
1242      case 1349547969:
1243        /* sequence */ return new Property("sequence", "positiveInt",
1244            "A number to uniquely identify care team entries.", 0, 1, sequence);
1245      case -987494927:
1246        /* provider */ return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
1247            "Member of the team who provided the product or service.", 0, 1, provider);
1248      case 1847674614:
1249        /* responsible */ return new Property("responsible", "boolean",
1250            "The party who is billing and/or responsible for the claimed products or services.", 0, 1, responsible);
1251      case 3506294:
1252        /* role */ return new Property("role", "CodeableConcept",
1253            "The lead, assisting or supervising practitioner and their discipline if a multidisciplinary team.", 0, 1,
1254            role);
1255      case -631333393:
1256        /* qualification */ return new Property("qualification", "CodeableConcept",
1257            "The qualification of the practitioner which is applicable for this service.", 0, 1, qualification);
1258      default:
1259        return super.getNamedProperty(_hash, _name, _checkValid);
1260      }
1261
1262    }
1263
1264    @Override
1265    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1266      switch (hash) {
1267      case 1349547969:
1268        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
1269      case -987494927:
1270        /* provider */ return this.provider == null ? new Base[0] : new Base[] { this.provider }; // Reference
1271      case 1847674614:
1272        /* responsible */ return this.responsible == null ? new Base[0] : new Base[] { this.responsible }; // BooleanType
1273      case 3506294:
1274        /* role */ return this.role == null ? new Base[0] : new Base[] { this.role }; // CodeableConcept
1275      case -631333393:
1276        /* qualification */ return this.qualification == null ? new Base[0] : new Base[] { this.qualification }; // CodeableConcept
1277      default:
1278        return super.getProperty(hash, name, checkValid);
1279      }
1280
1281    }
1282
1283    @Override
1284    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1285      switch (hash) {
1286      case 1349547969: // sequence
1287        this.sequence = castToPositiveInt(value); // PositiveIntType
1288        return value;
1289      case -987494927: // provider
1290        this.provider = castToReference(value); // Reference
1291        return value;
1292      case 1847674614: // responsible
1293        this.responsible = castToBoolean(value); // BooleanType
1294        return value;
1295      case 3506294: // role
1296        this.role = castToCodeableConcept(value); // CodeableConcept
1297        return value;
1298      case -631333393: // qualification
1299        this.qualification = castToCodeableConcept(value); // CodeableConcept
1300        return value;
1301      default:
1302        return super.setProperty(hash, name, value);
1303      }
1304
1305    }
1306
1307    @Override
1308    public Base setProperty(String name, Base value) throws FHIRException {
1309      if (name.equals("sequence")) {
1310        this.sequence = castToPositiveInt(value); // PositiveIntType
1311      } else if (name.equals("provider")) {
1312        this.provider = castToReference(value); // Reference
1313      } else if (name.equals("responsible")) {
1314        this.responsible = castToBoolean(value); // BooleanType
1315      } else if (name.equals("role")) {
1316        this.role = castToCodeableConcept(value); // CodeableConcept
1317      } else if (name.equals("qualification")) {
1318        this.qualification = castToCodeableConcept(value); // CodeableConcept
1319      } else
1320        return super.setProperty(name, value);
1321      return value;
1322    }
1323
1324  @Override
1325  public void removeChild(String name, Base value) throws FHIRException {
1326      if (name.equals("sequence")) {
1327        this.sequence = null;
1328      } else if (name.equals("provider")) {
1329        this.provider = null;
1330      } else if (name.equals("responsible")) {
1331        this.responsible = null;
1332      } else if (name.equals("role")) {
1333        this.role = null;
1334      } else if (name.equals("qualification")) {
1335        this.qualification = null;
1336      } else
1337        super.removeChild(name, value);
1338      
1339    }
1340
1341    @Override
1342    public Base makeProperty(int hash, String name) throws FHIRException {
1343      switch (hash) {
1344      case 1349547969:
1345        return getSequenceElement();
1346      case -987494927:
1347        return getProvider();
1348      case 1847674614:
1349        return getResponsibleElement();
1350      case 3506294:
1351        return getRole();
1352      case -631333393:
1353        return getQualification();
1354      default:
1355        return super.makeProperty(hash, name);
1356      }
1357
1358    }
1359
1360    @Override
1361    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1362      switch (hash) {
1363      case 1349547969:
1364        /* sequence */ return new String[] { "positiveInt" };
1365      case -987494927:
1366        /* provider */ return new String[] { "Reference" };
1367      case 1847674614:
1368        /* responsible */ return new String[] { "boolean" };
1369      case 3506294:
1370        /* role */ return new String[] { "CodeableConcept" };
1371      case -631333393:
1372        /* qualification */ return new String[] { "CodeableConcept" };
1373      default:
1374        return super.getTypesForProperty(hash, name);
1375      }
1376
1377    }
1378
1379    @Override
1380    public Base addChild(String name) throws FHIRException {
1381      if (name.equals("sequence")) {
1382        throw new FHIRException("Cannot call addChild on a singleton property Claim.sequence");
1383      } else if (name.equals("provider")) {
1384        this.provider = new Reference();
1385        return this.provider;
1386      } else if (name.equals("responsible")) {
1387        throw new FHIRException("Cannot call addChild on a singleton property Claim.responsible");
1388      } else if (name.equals("role")) {
1389        this.role = new CodeableConcept();
1390        return this.role;
1391      } else if (name.equals("qualification")) {
1392        this.qualification = new CodeableConcept();
1393        return this.qualification;
1394      } else
1395        return super.addChild(name);
1396    }
1397
1398    public CareTeamComponent copy() {
1399      CareTeamComponent dst = new CareTeamComponent();
1400      copyValues(dst);
1401      return dst;
1402    }
1403
1404    public void copyValues(CareTeamComponent dst) {
1405      super.copyValues(dst);
1406      dst.sequence = sequence == null ? null : sequence.copy();
1407      dst.provider = provider == null ? null : provider.copy();
1408      dst.responsible = responsible == null ? null : responsible.copy();
1409      dst.role = role == null ? null : role.copy();
1410      dst.qualification = qualification == null ? null : qualification.copy();
1411    }
1412
1413    @Override
1414    public boolean equalsDeep(Base other_) {
1415      if (!super.equalsDeep(other_))
1416        return false;
1417      if (!(other_ instanceof CareTeamComponent))
1418        return false;
1419      CareTeamComponent o = (CareTeamComponent) other_;
1420      return compareDeep(sequence, o.sequence, true) && compareDeep(provider, o.provider, true)
1421          && compareDeep(responsible, o.responsible, true) && compareDeep(role, o.role, true)
1422          && compareDeep(qualification, o.qualification, true);
1423    }
1424
1425    @Override
1426    public boolean equalsShallow(Base other_) {
1427      if (!super.equalsShallow(other_))
1428        return false;
1429      if (!(other_ instanceof CareTeamComponent))
1430        return false;
1431      CareTeamComponent o = (CareTeamComponent) other_;
1432      return compareValues(sequence, o.sequence, true) && compareValues(responsible, o.responsible, true);
1433    }
1434
1435    public boolean isEmpty() {
1436      return super.isEmpty()
1437          && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, provider, responsible, role, qualification);
1438    }
1439
1440    public String fhirType() {
1441      return "Claim.careTeam";
1442
1443    }
1444
1445  }
1446
1447  @Block()
1448  public static class SupportingInformationComponent extends BackboneElement implements IBaseBackboneElement {
1449    /**
1450     * A number to uniquely identify supporting information entries.
1451     */
1452    @Child(name = "sequence", type = {
1453        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
1454    @Description(shortDefinition = "Information instance identifier", formalDefinition = "A number to uniquely identify supporting information entries.")
1455    protected PositiveIntType sequence;
1456
1457    /**
1458     * The general class of the information supplied: information; exception;
1459     * accident, employment; onset, etc.
1460     */
1461    @Child(name = "category", type = {
1462        CodeableConcept.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
1463    @Description(shortDefinition = "Classification of the supplied information", formalDefinition = "The general class of the information supplied: information; exception; accident, employment; onset, etc.")
1464    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-informationcategory")
1465    protected CodeableConcept category;
1466
1467    /**
1468     * System and code pertaining to the specific information regarding special
1469     * conditions relating to the setting, treatment or patient for which care is
1470     * sought.
1471     */
1472    @Child(name = "code", type = {
1473        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
1474    @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.")
1475    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-exception")
1476    protected CodeableConcept code;
1477
1478    /**
1479     * The date when or period to which this information refers.
1480     */
1481    @Child(name = "timing", type = { DateType.class,
1482        Period.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
1483    @Description(shortDefinition = "When it occurred", formalDefinition = "The date when or period to which this information refers.")
1484    protected Type timing;
1485
1486    /**
1487     * Additional data or information such as resources, documents, images etc.
1488     * including references to the data or the actual inclusion of the data.
1489     */
1490    @Child(name = "value", type = { BooleanType.class, StringType.class, Quantity.class, Attachment.class,
1491        Reference.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
1492    @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.")
1493    protected Type value;
1494
1495    /**
1496     * Provides the reason in the situation where a reason code is required in
1497     * addition to the content.
1498     */
1499    @Child(name = "reason", type = {
1500        CodeableConcept.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
1501    @Description(shortDefinition = "Explanation for the information", formalDefinition = "Provides the reason in the situation where a reason code is required in addition to the content.")
1502    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/missing-tooth-reason")
1503    protected CodeableConcept reason;
1504
1505    private static final long serialVersionUID = -518630232L;
1506
1507    /**
1508     * Constructor
1509     */
1510    public SupportingInformationComponent() {
1511      super();
1512    }
1513
1514    /**
1515     * Constructor
1516     */
1517    public SupportingInformationComponent(PositiveIntType sequence, CodeableConcept category) {
1518      super();
1519      this.sequence = sequence;
1520      this.category = category;
1521    }
1522
1523    /**
1524     * @return {@link #sequence} (A number to uniquely identify supporting
1525     *         information entries.). This is the underlying object with id, value
1526     *         and extensions. The accessor "getSequence" gives direct access to the
1527     *         value
1528     */
1529    public PositiveIntType getSequenceElement() {
1530      if (this.sequence == null)
1531        if (Configuration.errorOnAutoCreate())
1532          throw new Error("Attempt to auto-create SupportingInformationComponent.sequence");
1533        else if (Configuration.doAutoCreate())
1534          this.sequence = new PositiveIntType(); // bb
1535      return this.sequence;
1536    }
1537
1538    public boolean hasSequenceElement() {
1539      return this.sequence != null && !this.sequence.isEmpty();
1540    }
1541
1542    public boolean hasSequence() {
1543      return this.sequence != null && !this.sequence.isEmpty();
1544    }
1545
1546    /**
1547     * @param value {@link #sequence} (A number to uniquely identify supporting
1548     *              information entries.). This is the underlying object with id,
1549     *              value and extensions. The accessor "getSequence" gives direct
1550     *              access to the value
1551     */
1552    public SupportingInformationComponent setSequenceElement(PositiveIntType value) {
1553      this.sequence = value;
1554      return this;
1555    }
1556
1557    /**
1558     * @return A number to uniquely identify supporting information entries.
1559     */
1560    public int getSequence() {
1561      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
1562    }
1563
1564    /**
1565     * @param value A number to uniquely identify supporting information entries.
1566     */
1567    public SupportingInformationComponent setSequence(int value) {
1568      if (this.sequence == null)
1569        this.sequence = new PositiveIntType();
1570      this.sequence.setValue(value);
1571      return this;
1572    }
1573
1574    /**
1575     * @return {@link #category} (The general class of the information supplied:
1576     *         information; exception; accident, employment; onset, etc.)
1577     */
1578    public CodeableConcept getCategory() {
1579      if (this.category == null)
1580        if (Configuration.errorOnAutoCreate())
1581          throw new Error("Attempt to auto-create SupportingInformationComponent.category");
1582        else if (Configuration.doAutoCreate())
1583          this.category = new CodeableConcept(); // cc
1584      return this.category;
1585    }
1586
1587    public boolean hasCategory() {
1588      return this.category != null && !this.category.isEmpty();
1589    }
1590
1591    /**
1592     * @param value {@link #category} (The general class of the information
1593     *              supplied: information; exception; accident, employment; onset,
1594     *              etc.)
1595     */
1596    public SupportingInformationComponent setCategory(CodeableConcept value) {
1597      this.category = value;
1598      return this;
1599    }
1600
1601    /**
1602     * @return {@link #code} (System and code pertaining to the specific information
1603     *         regarding special conditions relating to the setting, treatment or
1604     *         patient for which care is sought.)
1605     */
1606    public CodeableConcept getCode() {
1607      if (this.code == null)
1608        if (Configuration.errorOnAutoCreate())
1609          throw new Error("Attempt to auto-create SupportingInformationComponent.code");
1610        else if (Configuration.doAutoCreate())
1611          this.code = new CodeableConcept(); // cc
1612      return this.code;
1613    }
1614
1615    public boolean hasCode() {
1616      return this.code != null && !this.code.isEmpty();
1617    }
1618
1619    /**
1620     * @param value {@link #code} (System and code pertaining to the specific
1621     *              information regarding special conditions relating to the
1622     *              setting, treatment or patient for which care is sought.)
1623     */
1624    public SupportingInformationComponent setCode(CodeableConcept value) {
1625      this.code = value;
1626      return this;
1627    }
1628
1629    /**
1630     * @return {@link #timing} (The date when or period to which this information
1631     *         refers.)
1632     */
1633    public Type getTiming() {
1634      return this.timing;
1635    }
1636
1637    /**
1638     * @return {@link #timing} (The date when or period to which this information
1639     *         refers.)
1640     */
1641    public DateType getTimingDateType() throws FHIRException {
1642      if (this.timing == null)
1643        this.timing = new DateType();
1644      if (!(this.timing instanceof DateType))
1645        throw new FHIRException("Type mismatch: the type DateType was expected, but " + this.timing.getClass().getName()
1646            + " was encountered");
1647      return (DateType) this.timing;
1648    }
1649
1650    public boolean hasTimingDateType() {
1651      return this.timing instanceof DateType;
1652    }
1653
1654    /**
1655     * @return {@link #timing} (The date when or period to which this information
1656     *         refers.)
1657     */
1658    public Period getTimingPeriod() throws FHIRException {
1659      if (this.timing == null)
1660        this.timing = new Period();
1661      if (!(this.timing instanceof Period))
1662        throw new FHIRException("Type mismatch: the type Period was expected, but " + this.timing.getClass().getName()
1663            + " was encountered");
1664      return (Period) this.timing;
1665    }
1666
1667    public boolean hasTimingPeriod() {
1668      return this.timing instanceof Period;
1669    }
1670
1671    public boolean hasTiming() {
1672      return this.timing != null && !this.timing.isEmpty();
1673    }
1674
1675    /**
1676     * @param value {@link #timing} (The date when or period to which this
1677     *              information refers.)
1678     */
1679    public SupportingInformationComponent setTiming(Type value) {
1680      if (value != null && !(value instanceof DateType || value instanceof Period))
1681        throw new Error("Not the right type for Claim.supportingInfo.timing[x]: " + value.fhirType());
1682      this.timing = value;
1683      return this;
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 Type getValue() {
1692      return this.value;
1693    }
1694
1695    /**
1696     * @return {@link #value} (Additional data or information such as resources,
1697     *         documents, images etc. including references to the data or the actual
1698     *         inclusion of the data.)
1699     */
1700    public BooleanType getValueBooleanType() throws FHIRException {
1701      if (this.value == null)
1702        this.value = new BooleanType();
1703      if (!(this.value instanceof BooleanType))
1704        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "
1705            + this.value.getClass().getName() + " was encountered");
1706      return (BooleanType) this.value;
1707    }
1708
1709    public boolean hasValueBooleanType() {
1710      return this.value instanceof BooleanType;
1711    }
1712
1713    /**
1714     * @return {@link #value} (Additional data or information such as resources,
1715     *         documents, images etc. including references to the data or the actual
1716     *         inclusion of the data.)
1717     */
1718    public StringType getValueStringType() throws FHIRException {
1719      if (this.value == null)
1720        this.value = new StringType();
1721      if (!(this.value instanceof StringType))
1722        throw new FHIRException("Type mismatch: the type StringType was expected, but "
1723            + this.value.getClass().getName() + " was encountered");
1724      return (StringType) this.value;
1725    }
1726
1727    public boolean hasValueStringType() {
1728      return this.value instanceof StringType;
1729    }
1730
1731    /**
1732     * @return {@link #value} (Additional data or information such as resources,
1733     *         documents, images etc. including references to the data or the actual
1734     *         inclusion of the data.)
1735     */
1736    public Quantity getValueQuantity() throws FHIRException {
1737      if (this.value == null)
1738        this.value = new Quantity();
1739      if (!(this.value instanceof Quantity))
1740        throw new FHIRException("Type mismatch: the type Quantity was expected, but " + this.value.getClass().getName()
1741            + " was encountered");
1742      return (Quantity) this.value;
1743    }
1744
1745    public boolean hasValueQuantity() {
1746      return this.value instanceof Quantity;
1747    }
1748
1749    /**
1750     * @return {@link #value} (Additional data or information such as resources,
1751     *         documents, images etc. including references to the data or the actual
1752     *         inclusion of the data.)
1753     */
1754    public Attachment getValueAttachment() throws FHIRException {
1755      if (this.value == null)
1756        this.value = new Attachment();
1757      if (!(this.value instanceof Attachment))
1758        throw new FHIRException("Type mismatch: the type Attachment was expected, but "
1759            + this.value.getClass().getName() + " was encountered");
1760      return (Attachment) this.value;
1761    }
1762
1763    public boolean hasValueAttachment() {
1764      return this.value instanceof Attachment;
1765    }
1766
1767    /**
1768     * @return {@link #value} (Additional data or information such as resources,
1769     *         documents, images etc. including references to the data or the actual
1770     *         inclusion of the data.)
1771     */
1772    public Reference getValueReference() throws FHIRException {
1773      if (this.value == null)
1774        this.value = new Reference();
1775      if (!(this.value instanceof Reference))
1776        throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.value.getClass().getName()
1777            + " was encountered");
1778      return (Reference) this.value;
1779    }
1780
1781    public boolean hasValueReference() {
1782      return this.value instanceof Reference;
1783    }
1784
1785    public boolean hasValue() {
1786      return this.value != null && !this.value.isEmpty();
1787    }
1788
1789    /**
1790     * @param value {@link #value} (Additional data or information such as
1791     *              resources, documents, images etc. including references to the
1792     *              data or the actual inclusion of the data.)
1793     */
1794    public SupportingInformationComponent setValue(Type value) {
1795      if (value != null && !(value instanceof BooleanType || value instanceof StringType || value instanceof Quantity
1796          || value instanceof Attachment || value instanceof Reference))
1797        throw new Error("Not the right type for Claim.supportingInfo.value[x]: " + value.fhirType());
1798      this.value = value;
1799      return this;
1800    }
1801
1802    /**
1803     * @return {@link #reason} (Provides the reason in the situation where a reason
1804     *         code is required in addition to the content.)
1805     */
1806    public CodeableConcept getReason() {
1807      if (this.reason == null)
1808        if (Configuration.errorOnAutoCreate())
1809          throw new Error("Attempt to auto-create SupportingInformationComponent.reason");
1810        else if (Configuration.doAutoCreate())
1811          this.reason = new CodeableConcept(); // cc
1812      return this.reason;
1813    }
1814
1815    public boolean hasReason() {
1816      return this.reason != null && !this.reason.isEmpty();
1817    }
1818
1819    /**
1820     * @param value {@link #reason} (Provides the reason in the situation where a
1821     *              reason code is required in addition to the content.)
1822     */
1823    public SupportingInformationComponent setReason(CodeableConcept value) {
1824      this.reason = value;
1825      return this;
1826    }
1827
1828    protected void listChildren(List<Property> children) {
1829      super.listChildren(children);
1830      children.add(new Property("sequence", "positiveInt",
1831          "A number to uniquely identify supporting information entries.", 0, 1, sequence));
1832      children.add(new Property("category", "CodeableConcept",
1833          "The general class of the information supplied: information; exception; accident, employment; onset, etc.", 0,
1834          1, category));
1835      children.add(new Property("code", "CodeableConcept",
1836          "System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.",
1837          0, 1, code));
1838      children.add(new Property("timing[x]", "date|Period", "The date when or period to which this information refers.",
1839          0, 1, timing));
1840      children.add(new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1841          "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1842          0, 1, value));
1843      children.add(new Property("reason", "CodeableConcept",
1844          "Provides the reason in the situation where a reason code is required in addition to the content.", 0, 1,
1845          reason));
1846    }
1847
1848    @Override
1849    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1850      switch (_hash) {
1851      case 1349547969:
1852        /* sequence */ return new Property("sequence", "positiveInt",
1853            "A number to uniquely identify supporting information entries.", 0, 1, sequence);
1854      case 50511102:
1855        /* category */ return new Property("category", "CodeableConcept",
1856            "The general class of the information supplied: information; exception; accident, employment; onset, etc.",
1857            0, 1, category);
1858      case 3059181:
1859        /* code */ return new Property("code", "CodeableConcept",
1860            "System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought.",
1861            0, 1, code);
1862      case 164632566:
1863        /* timing[x] */ return new Property("timing[x]", "date|Period",
1864            "The date when or period to which this information refers.", 0, 1, timing);
1865      case -873664438:
1866        /* timing */ return new Property("timing[x]", "date|Period",
1867            "The date when or period to which this information refers.", 0, 1, timing);
1868      case 807935768:
1869        /* timingDate */ return new Property("timing[x]", "date|Period",
1870            "The date when or period to which this information refers.", 0, 1, timing);
1871      case -615615829:
1872        /* timingPeriod */ return new Property("timing[x]", "date|Period",
1873            "The date when or period to which this information refers.", 0, 1, timing);
1874      case -1410166417:
1875        /* value[x] */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1876            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1877            0, 1, value);
1878      case 111972721:
1879        /* value */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1880            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1881            0, 1, value);
1882      case 733421943:
1883        /* valueBoolean */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1884            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1885            0, 1, value);
1886      case -1424603934:
1887        /* valueString */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1888            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1889            0, 1, value);
1890      case -2029823716:
1891        /* valueQuantity */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1892            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1893            0, 1, value);
1894      case -475566732:
1895        /* valueAttachment */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1896            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1897            0, 1, value);
1898      case 1755241690:
1899        /* valueReference */ return new Property("value[x]", "boolean|string|Quantity|Attachment|Reference(Any)",
1900            "Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.",
1901            0, 1, value);
1902      case -934964668:
1903        /* reason */ return new Property("reason", "CodeableConcept",
1904            "Provides the reason in the situation where a reason code is required in addition to the content.", 0, 1,
1905            reason);
1906      default:
1907        return super.getNamedProperty(_hash, _name, _checkValid);
1908      }
1909
1910    }
1911
1912    @Override
1913    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1914      switch (hash) {
1915      case 1349547969:
1916        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
1917      case 50511102:
1918        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
1919      case 3059181:
1920        /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
1921      case -873664438:
1922        /* timing */ return this.timing == null ? new Base[0] : new Base[] { this.timing }; // Type
1923      case 111972721:
1924        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // Type
1925      case -934964668:
1926        /* reason */ return this.reason == null ? new Base[0] : new Base[] { this.reason }; // CodeableConcept
1927      default:
1928        return super.getProperty(hash, name, checkValid);
1929      }
1930
1931    }
1932
1933    @Override
1934    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1935      switch (hash) {
1936      case 1349547969: // sequence
1937        this.sequence = castToPositiveInt(value); // PositiveIntType
1938        return value;
1939      case 50511102: // category
1940        this.category = castToCodeableConcept(value); // CodeableConcept
1941        return value;
1942      case 3059181: // code
1943        this.code = castToCodeableConcept(value); // CodeableConcept
1944        return value;
1945      case -873664438: // timing
1946        this.timing = castToType(value); // Type
1947        return value;
1948      case 111972721: // value
1949        this.value = castToType(value); // Type
1950        return value;
1951      case -934964668: // reason
1952        this.reason = castToCodeableConcept(value); // CodeableConcept
1953        return value;
1954      default:
1955        return super.setProperty(hash, name, value);
1956      }
1957
1958    }
1959
1960    @Override
1961    public Base setProperty(String name, Base value) throws FHIRException {
1962      if (name.equals("sequence")) {
1963        this.sequence = castToPositiveInt(value); // PositiveIntType
1964      } else if (name.equals("category")) {
1965        this.category = castToCodeableConcept(value); // CodeableConcept
1966      } else if (name.equals("code")) {
1967        this.code = castToCodeableConcept(value); // CodeableConcept
1968      } else if (name.equals("timing[x]")) {
1969        this.timing = castToType(value); // Type
1970      } else if (name.equals("value[x]")) {
1971        this.value = castToType(value); // Type
1972      } else if (name.equals("reason")) {
1973        this.reason = castToCodeableConcept(value); // CodeableConcept
1974      } else
1975        return super.setProperty(name, value);
1976      return value;
1977    }
1978
1979  @Override
1980  public void removeChild(String name, Base value) throws FHIRException {
1981      if (name.equals("sequence")) {
1982        this.sequence = null;
1983      } else if (name.equals("category")) {
1984        this.category = null;
1985      } else if (name.equals("code")) {
1986        this.code = null;
1987      } else if (name.equals("timing[x]")) {
1988        this.timing = null;
1989      } else if (name.equals("value[x]")) {
1990        this.value = null;
1991      } else if (name.equals("reason")) {
1992        this.reason = null;
1993      } else
1994        super.removeChild(name, value);
1995      
1996    }
1997
1998    @Override
1999    public Base makeProperty(int hash, String name) throws FHIRException {
2000      switch (hash) {
2001      case 1349547969:
2002        return getSequenceElement();
2003      case 50511102:
2004        return getCategory();
2005      case 3059181:
2006        return getCode();
2007      case 164632566:
2008        return getTiming();
2009      case -873664438:
2010        return getTiming();
2011      case -1410166417:
2012        return getValue();
2013      case 111972721:
2014        return getValue();
2015      case -934964668:
2016        return getReason();
2017      default:
2018        return super.makeProperty(hash, name);
2019      }
2020
2021    }
2022
2023    @Override
2024    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2025      switch (hash) {
2026      case 1349547969:
2027        /* sequence */ return new String[] { "positiveInt" };
2028      case 50511102:
2029        /* category */ return new String[] { "CodeableConcept" };
2030      case 3059181:
2031        /* code */ return new String[] { "CodeableConcept" };
2032      case -873664438:
2033        /* timing */ return new String[] { "date", "Period" };
2034      case 111972721:
2035        /* value */ return new String[] { "boolean", "string", "Quantity", "Attachment", "Reference" };
2036      case -934964668:
2037        /* reason */ return new String[] { "CodeableConcept" };
2038      default:
2039        return super.getTypesForProperty(hash, name);
2040      }
2041
2042    }
2043
2044    @Override
2045    public Base addChild(String name) throws FHIRException {
2046      if (name.equals("sequence")) {
2047        throw new FHIRException("Cannot call addChild on a singleton property Claim.sequence");
2048      } else if (name.equals("category")) {
2049        this.category = new CodeableConcept();
2050        return this.category;
2051      } else if (name.equals("code")) {
2052        this.code = new CodeableConcept();
2053        return this.code;
2054      } else if (name.equals("timingDate")) {
2055        this.timing = new DateType();
2056        return this.timing;
2057      } else if (name.equals("timingPeriod")) {
2058        this.timing = new Period();
2059        return this.timing;
2060      } else if (name.equals("valueBoolean")) {
2061        this.value = new BooleanType();
2062        return this.value;
2063      } else if (name.equals("valueString")) {
2064        this.value = new StringType();
2065        return this.value;
2066      } else if (name.equals("valueQuantity")) {
2067        this.value = new Quantity();
2068        return this.value;
2069      } else if (name.equals("valueAttachment")) {
2070        this.value = new Attachment();
2071        return this.value;
2072      } else if (name.equals("valueReference")) {
2073        this.value = new Reference();
2074        return this.value;
2075      } else if (name.equals("reason")) {
2076        this.reason = new CodeableConcept();
2077        return this.reason;
2078      } else
2079        return super.addChild(name);
2080    }
2081
2082    public SupportingInformationComponent copy() {
2083      SupportingInformationComponent dst = new SupportingInformationComponent();
2084      copyValues(dst);
2085      return dst;
2086    }
2087
2088    public void copyValues(SupportingInformationComponent dst) {
2089      super.copyValues(dst);
2090      dst.sequence = sequence == null ? null : sequence.copy();
2091      dst.category = category == null ? null : category.copy();
2092      dst.code = code == null ? null : code.copy();
2093      dst.timing = timing == null ? null : timing.copy();
2094      dst.value = value == null ? null : value.copy();
2095      dst.reason = reason == null ? null : reason.copy();
2096    }
2097
2098    @Override
2099    public boolean equalsDeep(Base other_) {
2100      if (!super.equalsDeep(other_))
2101        return false;
2102      if (!(other_ instanceof SupportingInformationComponent))
2103        return false;
2104      SupportingInformationComponent o = (SupportingInformationComponent) other_;
2105      return compareDeep(sequence, o.sequence, true) && compareDeep(category, o.category, true)
2106          && compareDeep(code, o.code, true) && compareDeep(timing, o.timing, true) && compareDeep(value, o.value, true)
2107          && compareDeep(reason, o.reason, true);
2108    }
2109
2110    @Override
2111    public boolean equalsShallow(Base other_) {
2112      if (!super.equalsShallow(other_))
2113        return false;
2114      if (!(other_ instanceof SupportingInformationComponent))
2115        return false;
2116      SupportingInformationComponent o = (SupportingInformationComponent) other_;
2117      return compareValues(sequence, o.sequence, true);
2118    }
2119
2120    public boolean isEmpty() {
2121      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, category, code, timing, value, reason);
2122    }
2123
2124    public String fhirType() {
2125      return "Claim.supportingInfo";
2126
2127    }
2128
2129  }
2130
2131  @Block()
2132  public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement {
2133    /**
2134     * A number to uniquely identify diagnosis entries.
2135     */
2136    @Child(name = "sequence", type = {
2137        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
2138    @Description(shortDefinition = "Diagnosis instance identifier", formalDefinition = "A number to uniquely identify diagnosis entries.")
2139    protected PositiveIntType sequence;
2140
2141    /**
2142     * The nature of illness or problem in a coded form or as a reference to an
2143     * external defined Condition.
2144     */
2145    @Child(name = "diagnosis", type = { CodeableConcept.class,
2146        Condition.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
2147    @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.")
2148    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/icd-10")
2149    protected Type diagnosis;
2150
2151    /**
2152     * When the condition was observed or the relative ranking.
2153     */
2154    @Child(name = "type", type = {
2155        CodeableConcept.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2156    @Description(shortDefinition = "Timing or nature of the diagnosis", formalDefinition = "When the condition was observed or the relative ranking.")
2157    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-diagnosistype")
2158    protected List<CodeableConcept> type;
2159
2160    /**
2161     * Indication of whether the diagnosis was present on admission to a facility.
2162     */
2163    @Child(name = "onAdmission", type = {
2164        CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
2165    @Description(shortDefinition = "Present on admission", formalDefinition = "Indication of whether the diagnosis was present on admission to a facility.")
2166    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-diagnosis-on-admission")
2167    protected CodeableConcept onAdmission;
2168
2169    /**
2170     * A package billing code or bundle code used to group products and services to
2171     * a particular health condition (such as heart attack) which is based on a
2172     * predetermined grouping code system.
2173     */
2174    @Child(name = "packageCode", type = {
2175        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
2176    @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.")
2177    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup")
2178    protected CodeableConcept packageCode;
2179
2180    private static final long serialVersionUID = 2120593974L;
2181
2182    /**
2183     * Constructor
2184     */
2185    public DiagnosisComponent() {
2186      super();
2187    }
2188
2189    /**
2190     * Constructor
2191     */
2192    public DiagnosisComponent(PositiveIntType sequence, Type diagnosis) {
2193      super();
2194      this.sequence = sequence;
2195      this.diagnosis = diagnosis;
2196    }
2197
2198    /**
2199     * @return {@link #sequence} (A number to uniquely identify diagnosis entries.).
2200     *         This is the underlying object with id, value and extensions. The
2201     *         accessor "getSequence" gives direct access to the value
2202     */
2203    public PositiveIntType getSequenceElement() {
2204      if (this.sequence == null)
2205        if (Configuration.errorOnAutoCreate())
2206          throw new Error("Attempt to auto-create DiagnosisComponent.sequence");
2207        else if (Configuration.doAutoCreate())
2208          this.sequence = new PositiveIntType(); // bb
2209      return this.sequence;
2210    }
2211
2212    public boolean hasSequenceElement() {
2213      return this.sequence != null && !this.sequence.isEmpty();
2214    }
2215
2216    public boolean hasSequence() {
2217      return this.sequence != null && !this.sequence.isEmpty();
2218    }
2219
2220    /**
2221     * @param value {@link #sequence} (A number to uniquely identify diagnosis
2222     *              entries.). This is the underlying object with id, value and
2223     *              extensions. The accessor "getSequence" gives direct access to
2224     *              the value
2225     */
2226    public DiagnosisComponent setSequenceElement(PositiveIntType value) {
2227      this.sequence = value;
2228      return this;
2229    }
2230
2231    /**
2232     * @return A number to uniquely identify diagnosis entries.
2233     */
2234    public int getSequence() {
2235      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2236    }
2237
2238    /**
2239     * @param value A number to uniquely identify diagnosis entries.
2240     */
2241    public DiagnosisComponent setSequence(int value) {
2242      if (this.sequence == null)
2243        this.sequence = new PositiveIntType();
2244      this.sequence.setValue(value);
2245      return this;
2246    }
2247
2248    /**
2249     * @return {@link #diagnosis} (The nature of illness or problem in a coded form
2250     *         or as a reference to an external defined Condition.)
2251     */
2252    public Type getDiagnosis() {
2253      return this.diagnosis;
2254    }
2255
2256    /**
2257     * @return {@link #diagnosis} (The nature of illness or problem in a coded form
2258     *         or as a reference to an external defined Condition.)
2259     */
2260    public CodeableConcept getDiagnosisCodeableConcept() throws FHIRException {
2261      if (this.diagnosis == null)
2262        this.diagnosis = new CodeableConcept();
2263      if (!(this.diagnosis instanceof CodeableConcept))
2264        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
2265            + this.diagnosis.getClass().getName() + " was encountered");
2266      return (CodeableConcept) this.diagnosis;
2267    }
2268
2269    public boolean hasDiagnosisCodeableConcept() {
2270      return this.diagnosis instanceof CodeableConcept;
2271    }
2272
2273    /**
2274     * @return {@link #diagnosis} (The nature of illness or problem in a coded form
2275     *         or as a reference to an external defined Condition.)
2276     */
2277    public Reference getDiagnosisReference() throws FHIRException {
2278      if (this.diagnosis == null)
2279        this.diagnosis = new Reference();
2280      if (!(this.diagnosis instanceof Reference))
2281        throw new FHIRException("Type mismatch: the type Reference was expected, but "
2282            + this.diagnosis.getClass().getName() + " was encountered");
2283      return (Reference) this.diagnosis;
2284    }
2285
2286    public boolean hasDiagnosisReference() {
2287      return this.diagnosis instanceof Reference;
2288    }
2289
2290    public boolean hasDiagnosis() {
2291      return this.diagnosis != null && !this.diagnosis.isEmpty();
2292    }
2293
2294    /**
2295     * @param value {@link #diagnosis} (The nature of illness or problem in a coded
2296     *              form or as a reference to an external defined Condition.)
2297     */
2298    public DiagnosisComponent setDiagnosis(Type value) {
2299      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2300        throw new Error("Not the right type for Claim.diagnosis.diagnosis[x]: " + value.fhirType());
2301      this.diagnosis = value;
2302      return this;
2303    }
2304
2305    /**
2306     * @return {@link #type} (When the condition was observed or the relative
2307     *         ranking.)
2308     */
2309    public List<CodeableConcept> getType() {
2310      if (this.type == null)
2311        this.type = new ArrayList<CodeableConcept>();
2312      return this.type;
2313    }
2314
2315    /**
2316     * @return Returns a reference to <code>this</code> for easy method chaining
2317     */
2318    public DiagnosisComponent setType(List<CodeableConcept> theType) {
2319      this.type = theType;
2320      return this;
2321    }
2322
2323    public boolean hasType() {
2324      if (this.type == null)
2325        return false;
2326      for (CodeableConcept item : this.type)
2327        if (!item.isEmpty())
2328          return true;
2329      return false;
2330    }
2331
2332    public CodeableConcept addType() { // 3
2333      CodeableConcept t = new CodeableConcept();
2334      if (this.type == null)
2335        this.type = new ArrayList<CodeableConcept>();
2336      this.type.add(t);
2337      return t;
2338    }
2339
2340    public DiagnosisComponent addType(CodeableConcept t) { // 3
2341      if (t == null)
2342        return this;
2343      if (this.type == null)
2344        this.type = new ArrayList<CodeableConcept>();
2345      this.type.add(t);
2346      return this;
2347    }
2348
2349    /**
2350     * @return The first repetition of repeating field {@link #type}, creating it if
2351     *         it does not already exist
2352     */
2353    public CodeableConcept getTypeFirstRep() {
2354      if (getType().isEmpty()) {
2355        addType();
2356      }
2357      return getType().get(0);
2358    }
2359
2360    /**
2361     * @return {@link #onAdmission} (Indication of whether the diagnosis was present
2362     *         on admission to a facility.)
2363     */
2364    public CodeableConcept getOnAdmission() {
2365      if (this.onAdmission == null)
2366        if (Configuration.errorOnAutoCreate())
2367          throw new Error("Attempt to auto-create DiagnosisComponent.onAdmission");
2368        else if (Configuration.doAutoCreate())
2369          this.onAdmission = new CodeableConcept(); // cc
2370      return this.onAdmission;
2371    }
2372
2373    public boolean hasOnAdmission() {
2374      return this.onAdmission != null && !this.onAdmission.isEmpty();
2375    }
2376
2377    /**
2378     * @param value {@link #onAdmission} (Indication of whether the diagnosis was
2379     *              present on admission to a facility.)
2380     */
2381    public DiagnosisComponent setOnAdmission(CodeableConcept value) {
2382      this.onAdmission = value;
2383      return this;
2384    }
2385
2386    /**
2387     * @return {@link #packageCode} (A package billing code or bundle code used to
2388     *         group products and services to a particular health condition (such as
2389     *         heart attack) which is based on a predetermined grouping code
2390     *         system.)
2391     */
2392    public CodeableConcept getPackageCode() {
2393      if (this.packageCode == null)
2394        if (Configuration.errorOnAutoCreate())
2395          throw new Error("Attempt to auto-create DiagnosisComponent.packageCode");
2396        else if (Configuration.doAutoCreate())
2397          this.packageCode = new CodeableConcept(); // cc
2398      return this.packageCode;
2399    }
2400
2401    public boolean hasPackageCode() {
2402      return this.packageCode != null && !this.packageCode.isEmpty();
2403    }
2404
2405    /**
2406     * @param value {@link #packageCode} (A package billing code or bundle code used
2407     *              to group products and services to a particular health condition
2408     *              (such as heart attack) which is based on a predetermined
2409     *              grouping code system.)
2410     */
2411    public DiagnosisComponent setPackageCode(CodeableConcept value) {
2412      this.packageCode = value;
2413      return this;
2414    }
2415
2416    protected void listChildren(List<Property> children) {
2417      super.listChildren(children);
2418      children.add(
2419          new Property("sequence", "positiveInt", "A number to uniquely identify diagnosis entries.", 0, 1, sequence));
2420      children.add(new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2421          "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0, 1,
2422          diagnosis));
2423      children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.",
2424          0, java.lang.Integer.MAX_VALUE, type));
2425      children.add(new Property("onAdmission", "CodeableConcept",
2426          "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission));
2427      children.add(new Property("packageCode", "CodeableConcept",
2428          "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.",
2429          0, 1, packageCode));
2430    }
2431
2432    @Override
2433    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2434      switch (_hash) {
2435      case 1349547969:
2436        /* sequence */ return new Property("sequence", "positiveInt",
2437            "A number to uniquely identify diagnosis entries.", 0, 1, sequence);
2438      case -1487009809:
2439        /* diagnosis[x] */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2440            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2441            1, diagnosis);
2442      case 1196993265:
2443        /* diagnosis */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2444            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2445            1, diagnosis);
2446      case 277781616:
2447        /* diagnosisCodeableConcept */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2448            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2449            1, diagnosis);
2450      case 2050454362:
2451        /* diagnosisReference */ return new Property("diagnosis[x]", "CodeableConcept|Reference(Condition)",
2452            "The nature of illness or problem in a coded form or as a reference to an external defined Condition.", 0,
2453            1, diagnosis);
2454      case 3575610:
2455        /* type */ return new Property("type", "CodeableConcept",
2456            "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
2457      case -3386134:
2458        /* onAdmission */ return new Property("onAdmission", "CodeableConcept",
2459            "Indication of whether the diagnosis was present on admission to a facility.", 0, 1, onAdmission);
2460      case 908444499:
2461        /* packageCode */ return new Property("packageCode", "CodeableConcept",
2462            "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.",
2463            0, 1, packageCode);
2464      default:
2465        return super.getNamedProperty(_hash, _name, _checkValid);
2466      }
2467
2468    }
2469
2470    @Override
2471    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2472      switch (hash) {
2473      case 1349547969:
2474        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
2475      case 1196993265:
2476        /* diagnosis */ return this.diagnosis == null ? new Base[0] : new Base[] { this.diagnosis }; // Type
2477      case 3575610:
2478        /* type */ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2479      case -3386134:
2480        /* onAdmission */ return this.onAdmission == null ? new Base[0] : new Base[] { this.onAdmission }; // CodeableConcept
2481      case 908444499:
2482        /* packageCode */ return this.packageCode == null ? new Base[0] : new Base[] { this.packageCode }; // CodeableConcept
2483      default:
2484        return super.getProperty(hash, name, checkValid);
2485      }
2486
2487    }
2488
2489    @Override
2490    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2491      switch (hash) {
2492      case 1349547969: // sequence
2493        this.sequence = castToPositiveInt(value); // PositiveIntType
2494        return value;
2495      case 1196993265: // diagnosis
2496        this.diagnosis = castToType(value); // Type
2497        return value;
2498      case 3575610: // type
2499        this.getType().add(castToCodeableConcept(value)); // CodeableConcept
2500        return value;
2501      case -3386134: // onAdmission
2502        this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2503        return value;
2504      case 908444499: // packageCode
2505        this.packageCode = castToCodeableConcept(value); // CodeableConcept
2506        return value;
2507      default:
2508        return super.setProperty(hash, name, value);
2509      }
2510
2511    }
2512
2513    @Override
2514    public Base setProperty(String name, Base value) throws FHIRException {
2515      if (name.equals("sequence")) {
2516        this.sequence = castToPositiveInt(value); // PositiveIntType
2517      } else if (name.equals("diagnosis[x]")) {
2518        this.diagnosis = castToType(value); // Type
2519      } else if (name.equals("type")) {
2520        this.getType().add(castToCodeableConcept(value));
2521      } else if (name.equals("onAdmission")) {
2522        this.onAdmission = castToCodeableConcept(value); // CodeableConcept
2523      } else if (name.equals("packageCode")) {
2524        this.packageCode = castToCodeableConcept(value); // CodeableConcept
2525      } else
2526        return super.setProperty(name, value);
2527      return value;
2528    }
2529
2530  @Override
2531  public void removeChild(String name, Base value) throws FHIRException {
2532      if (name.equals("sequence")) {
2533        this.sequence = null;
2534      } else if (name.equals("diagnosis[x]")) {
2535        this.diagnosis = null;
2536      } else if (name.equals("type")) {
2537        this.getType().remove(castToCodeableConcept(value));
2538      } else if (name.equals("onAdmission")) {
2539        this.onAdmission = null;
2540      } else if (name.equals("packageCode")) {
2541        this.packageCode = null;
2542      } else
2543        super.removeChild(name, value);
2544      
2545    }
2546
2547    @Override
2548    public Base makeProperty(int hash, String name) throws FHIRException {
2549      switch (hash) {
2550      case 1349547969:
2551        return getSequenceElement();
2552      case -1487009809:
2553        return getDiagnosis();
2554      case 1196993265:
2555        return getDiagnosis();
2556      case 3575610:
2557        return addType();
2558      case -3386134:
2559        return getOnAdmission();
2560      case 908444499:
2561        return getPackageCode();
2562      default:
2563        return super.makeProperty(hash, name);
2564      }
2565
2566    }
2567
2568    @Override
2569    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2570      switch (hash) {
2571      case 1349547969:
2572        /* sequence */ return new String[] { "positiveInt" };
2573      case 1196993265:
2574        /* diagnosis */ return new String[] { "CodeableConcept", "Reference" };
2575      case 3575610:
2576        /* type */ return new String[] { "CodeableConcept" };
2577      case -3386134:
2578        /* onAdmission */ return new String[] { "CodeableConcept" };
2579      case 908444499:
2580        /* packageCode */ return new String[] { "CodeableConcept" };
2581      default:
2582        return super.getTypesForProperty(hash, name);
2583      }
2584
2585    }
2586
2587    @Override
2588    public Base addChild(String name) throws FHIRException {
2589      if (name.equals("sequence")) {
2590        throw new FHIRException("Cannot call addChild on a singleton property Claim.sequence");
2591      } else if (name.equals("diagnosisCodeableConcept")) {
2592        this.diagnosis = new CodeableConcept();
2593        return this.diagnosis;
2594      } else if (name.equals("diagnosisReference")) {
2595        this.diagnosis = new Reference();
2596        return this.diagnosis;
2597      } else if (name.equals("type")) {
2598        return addType();
2599      } else if (name.equals("onAdmission")) {
2600        this.onAdmission = new CodeableConcept();
2601        return this.onAdmission;
2602      } else if (name.equals("packageCode")) {
2603        this.packageCode = new CodeableConcept();
2604        return this.packageCode;
2605      } else
2606        return super.addChild(name);
2607    }
2608
2609    public DiagnosisComponent copy() {
2610      DiagnosisComponent dst = new DiagnosisComponent();
2611      copyValues(dst);
2612      return dst;
2613    }
2614
2615    public void copyValues(DiagnosisComponent dst) {
2616      super.copyValues(dst);
2617      dst.sequence = sequence == null ? null : sequence.copy();
2618      dst.diagnosis = diagnosis == null ? null : diagnosis.copy();
2619      if (type != null) {
2620        dst.type = new ArrayList<CodeableConcept>();
2621        for (CodeableConcept i : type)
2622          dst.type.add(i.copy());
2623      }
2624      ;
2625      dst.onAdmission = onAdmission == null ? null : onAdmission.copy();
2626      dst.packageCode = packageCode == null ? null : packageCode.copy();
2627    }
2628
2629    @Override
2630    public boolean equalsDeep(Base other_) {
2631      if (!super.equalsDeep(other_))
2632        return false;
2633      if (!(other_ instanceof DiagnosisComponent))
2634        return false;
2635      DiagnosisComponent o = (DiagnosisComponent) other_;
2636      return compareDeep(sequence, o.sequence, true) && compareDeep(diagnosis, o.diagnosis, true)
2637          && compareDeep(type, o.type, true) && compareDeep(onAdmission, o.onAdmission, true)
2638          && compareDeep(packageCode, o.packageCode, true);
2639    }
2640
2641    @Override
2642    public boolean equalsShallow(Base other_) {
2643      if (!super.equalsShallow(other_))
2644        return false;
2645      if (!(other_ instanceof DiagnosisComponent))
2646        return false;
2647      DiagnosisComponent o = (DiagnosisComponent) other_;
2648      return compareValues(sequence, o.sequence, true);
2649    }
2650
2651    public boolean isEmpty() {
2652      return super.isEmpty()
2653          && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, diagnosis, type, onAdmission, packageCode);
2654    }
2655
2656    public String fhirType() {
2657      return "Claim.diagnosis";
2658
2659    }
2660
2661  }
2662
2663  @Block()
2664  public static class ProcedureComponent extends BackboneElement implements IBaseBackboneElement {
2665    /**
2666     * A number to uniquely identify procedure entries.
2667     */
2668    @Child(name = "sequence", type = {
2669        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
2670    @Description(shortDefinition = "Procedure instance identifier", formalDefinition = "A number to uniquely identify procedure entries.")
2671    protected PositiveIntType sequence;
2672
2673    /**
2674     * When the condition was observed or the relative ranking.
2675     */
2676    @Child(name = "type", type = {
2677        CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2678    @Description(shortDefinition = "Category of Procedure", formalDefinition = "When the condition was observed or the relative ranking.")
2679    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-procedure-type")
2680    protected List<CodeableConcept> type;
2681
2682    /**
2683     * Date and optionally time the procedure was performed.
2684     */
2685    @Child(name = "date", type = { DateTimeType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
2686    @Description(shortDefinition = "When the procedure was performed", formalDefinition = "Date and optionally time the procedure was performed.")
2687    protected DateTimeType date;
2688
2689    /**
2690     * The code or reference to a Procedure resource which identifies the clinical
2691     * intervention performed.
2692     */
2693    @Child(name = "procedure", type = { CodeableConcept.class,
2694        Procedure.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
2695    @Description(shortDefinition = "Specific clinical procedure", formalDefinition = "The code or reference to a Procedure resource which identifies the clinical intervention performed.")
2696    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/icd-10-procedures")
2697    protected Type procedure;
2698
2699    /**
2700     * Unique Device Identifiers associated with this line item.
2701     */
2702    @Child(name = "udi", type = {
2703        Device.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2704    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
2705    protected List<Reference> udi;
2706    /**
2707     * The actual objects that are the target of the reference (Unique Device
2708     * Identifiers associated with this line item.)
2709     */
2710    protected List<Device> udiTarget;
2711
2712    private static final long serialVersionUID = 935341852L;
2713
2714    /**
2715     * Constructor
2716     */
2717    public ProcedureComponent() {
2718      super();
2719    }
2720
2721    /**
2722     * Constructor
2723     */
2724    public ProcedureComponent(PositiveIntType sequence, Type procedure) {
2725      super();
2726      this.sequence = sequence;
2727      this.procedure = procedure;
2728    }
2729
2730    /**
2731     * @return {@link #sequence} (A number to uniquely identify procedure entries.).
2732     *         This is the underlying object with id, value and extensions. The
2733     *         accessor "getSequence" gives direct access to the value
2734     */
2735    public PositiveIntType getSequenceElement() {
2736      if (this.sequence == null)
2737        if (Configuration.errorOnAutoCreate())
2738          throw new Error("Attempt to auto-create ProcedureComponent.sequence");
2739        else if (Configuration.doAutoCreate())
2740          this.sequence = new PositiveIntType(); // bb
2741      return this.sequence;
2742    }
2743
2744    public boolean hasSequenceElement() {
2745      return this.sequence != null && !this.sequence.isEmpty();
2746    }
2747
2748    public boolean hasSequence() {
2749      return this.sequence != null && !this.sequence.isEmpty();
2750    }
2751
2752    /**
2753     * @param value {@link #sequence} (A number to uniquely identify procedure
2754     *              entries.). This is the underlying object with id, value and
2755     *              extensions. The accessor "getSequence" gives direct access to
2756     *              the value
2757     */
2758    public ProcedureComponent setSequenceElement(PositiveIntType value) {
2759      this.sequence = value;
2760      return this;
2761    }
2762
2763    /**
2764     * @return A number to uniquely identify procedure entries.
2765     */
2766    public int getSequence() {
2767      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
2768    }
2769
2770    /**
2771     * @param value A number to uniquely identify procedure entries.
2772     */
2773    public ProcedureComponent setSequence(int value) {
2774      if (this.sequence == null)
2775        this.sequence = new PositiveIntType();
2776      this.sequence.setValue(value);
2777      return this;
2778    }
2779
2780    /**
2781     * @return {@link #type} (When the condition was observed or the relative
2782     *         ranking.)
2783     */
2784    public List<CodeableConcept> getType() {
2785      if (this.type == null)
2786        this.type = new ArrayList<CodeableConcept>();
2787      return this.type;
2788    }
2789
2790    /**
2791     * @return Returns a reference to <code>this</code> for easy method chaining
2792     */
2793    public ProcedureComponent setType(List<CodeableConcept> theType) {
2794      this.type = theType;
2795      return this;
2796    }
2797
2798    public boolean hasType() {
2799      if (this.type == null)
2800        return false;
2801      for (CodeableConcept item : this.type)
2802        if (!item.isEmpty())
2803          return true;
2804      return false;
2805    }
2806
2807    public CodeableConcept addType() { // 3
2808      CodeableConcept t = new CodeableConcept();
2809      if (this.type == null)
2810        this.type = new ArrayList<CodeableConcept>();
2811      this.type.add(t);
2812      return t;
2813    }
2814
2815    public ProcedureComponent addType(CodeableConcept t) { // 3
2816      if (t == null)
2817        return this;
2818      if (this.type == null)
2819        this.type = new ArrayList<CodeableConcept>();
2820      this.type.add(t);
2821      return this;
2822    }
2823
2824    /**
2825     * @return The first repetition of repeating field {@link #type}, creating it if
2826     *         it does not already exist
2827     */
2828    public CodeableConcept getTypeFirstRep() {
2829      if (getType().isEmpty()) {
2830        addType();
2831      }
2832      return getType().get(0);
2833    }
2834
2835    /**
2836     * @return {@link #date} (Date and optionally time the procedure was
2837     *         performed.). This is the underlying object with id, value and
2838     *         extensions. The accessor "getDate" gives direct access to the value
2839     */
2840    public DateTimeType getDateElement() {
2841      if (this.date == null)
2842        if (Configuration.errorOnAutoCreate())
2843          throw new Error("Attempt to auto-create ProcedureComponent.date");
2844        else if (Configuration.doAutoCreate())
2845          this.date = new DateTimeType(); // bb
2846      return this.date;
2847    }
2848
2849    public boolean hasDateElement() {
2850      return this.date != null && !this.date.isEmpty();
2851    }
2852
2853    public boolean hasDate() {
2854      return this.date != null && !this.date.isEmpty();
2855    }
2856
2857    /**
2858     * @param value {@link #date} (Date and optionally time the procedure was
2859     *              performed.). This is the underlying object with id, value and
2860     *              extensions. The accessor "getDate" gives direct access to the
2861     *              value
2862     */
2863    public ProcedureComponent setDateElement(DateTimeType value) {
2864      this.date = value;
2865      return this;
2866    }
2867
2868    /**
2869     * @return Date and optionally time the procedure was performed.
2870     */
2871    public Date getDate() {
2872      return this.date == null ? null : this.date.getValue();
2873    }
2874
2875    /**
2876     * @param value Date and optionally time the procedure was performed.
2877     */
2878    public ProcedureComponent setDate(Date value) {
2879      if (value == null)
2880        this.date = null;
2881      else {
2882        if (this.date == null)
2883          this.date = new DateTimeType();
2884        this.date.setValue(value);
2885      }
2886      return this;
2887    }
2888
2889    /**
2890     * @return {@link #procedure} (The code or reference to a Procedure resource
2891     *         which identifies the clinical intervention performed.)
2892     */
2893    public Type getProcedure() {
2894      return this.procedure;
2895    }
2896
2897    /**
2898     * @return {@link #procedure} (The code or reference to a Procedure resource
2899     *         which identifies the clinical intervention performed.)
2900     */
2901    public CodeableConcept getProcedureCodeableConcept() throws FHIRException {
2902      if (this.procedure == null)
2903        this.procedure = new CodeableConcept();
2904      if (!(this.procedure instanceof CodeableConcept))
2905        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
2906            + this.procedure.getClass().getName() + " was encountered");
2907      return (CodeableConcept) this.procedure;
2908    }
2909
2910    public boolean hasProcedureCodeableConcept() {
2911      return this.procedure instanceof CodeableConcept;
2912    }
2913
2914    /**
2915     * @return {@link #procedure} (The code or reference to a Procedure resource
2916     *         which identifies the clinical intervention performed.)
2917     */
2918    public Reference getProcedureReference() throws FHIRException {
2919      if (this.procedure == null)
2920        this.procedure = new Reference();
2921      if (!(this.procedure instanceof Reference))
2922        throw new FHIRException("Type mismatch: the type Reference was expected, but "
2923            + this.procedure.getClass().getName() + " was encountered");
2924      return (Reference) this.procedure;
2925    }
2926
2927    public boolean hasProcedureReference() {
2928      return this.procedure instanceof Reference;
2929    }
2930
2931    public boolean hasProcedure() {
2932      return this.procedure != null && !this.procedure.isEmpty();
2933    }
2934
2935    /**
2936     * @param value {@link #procedure} (The code or reference to a Procedure
2937     *              resource which identifies the clinical intervention performed.)
2938     */
2939    public ProcedureComponent setProcedure(Type value) {
2940      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2941        throw new Error("Not the right type for Claim.procedure.procedure[x]: " + value.fhirType());
2942      this.procedure = value;
2943      return this;
2944    }
2945
2946    /**
2947     * @return {@link #udi} (Unique Device Identifiers associated with this line
2948     *         item.)
2949     */
2950    public List<Reference> getUdi() {
2951      if (this.udi == null)
2952        this.udi = new ArrayList<Reference>();
2953      return this.udi;
2954    }
2955
2956    /**
2957     * @return Returns a reference to <code>this</code> for easy method chaining
2958     */
2959    public ProcedureComponent setUdi(List<Reference> theUdi) {
2960      this.udi = theUdi;
2961      return this;
2962    }
2963
2964    public boolean hasUdi() {
2965      if (this.udi == null)
2966        return false;
2967      for (Reference item : this.udi)
2968        if (!item.isEmpty())
2969          return true;
2970      return false;
2971    }
2972
2973    public Reference addUdi() { // 3
2974      Reference t = new Reference();
2975      if (this.udi == null)
2976        this.udi = new ArrayList<Reference>();
2977      this.udi.add(t);
2978      return t;
2979    }
2980
2981    public ProcedureComponent addUdi(Reference t) { // 3
2982      if (t == null)
2983        return this;
2984      if (this.udi == null)
2985        this.udi = new ArrayList<Reference>();
2986      this.udi.add(t);
2987      return this;
2988    }
2989
2990    /**
2991     * @return The first repetition of repeating field {@link #udi}, creating it if
2992     *         it does not already exist
2993     */
2994    public Reference getUdiFirstRep() {
2995      if (getUdi().isEmpty()) {
2996        addUdi();
2997      }
2998      return getUdi().get(0);
2999    }
3000
3001    protected void listChildren(List<Property> children) {
3002      super.listChildren(children);
3003      children.add(
3004          new Property("sequence", "positiveInt", "A number to uniquely identify procedure entries.", 0, 1, sequence));
3005      children.add(new Property("type", "CodeableConcept", "When the condition was observed or the relative ranking.",
3006          0, java.lang.Integer.MAX_VALUE, type));
3007      children
3008          .add(new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0, 1, date));
3009      children.add(new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3010          "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3011          procedure));
3012      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
3013          0, java.lang.Integer.MAX_VALUE, udi));
3014    }
3015
3016    @Override
3017    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3018      switch (_hash) {
3019      case 1349547969:
3020        /* sequence */ return new Property("sequence", "positiveInt",
3021            "A number to uniquely identify procedure entries.", 0, 1, sequence);
3022      case 3575610:
3023        /* type */ return new Property("type", "CodeableConcept",
3024            "When the condition was observed or the relative ranking.", 0, java.lang.Integer.MAX_VALUE, type);
3025      case 3076014:
3026        /* date */ return new Property("date", "dateTime", "Date and optionally time the procedure was performed.", 0,
3027            1, date);
3028      case 1640074445:
3029        /* procedure[x] */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3030            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3031            procedure);
3032      case -1095204141:
3033        /* procedure */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3034            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3035            procedure);
3036      case -1284783026:
3037        /* procedureCodeableConcept */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3038            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3039            procedure);
3040      case 881809848:
3041        /* procedureReference */ return new Property("procedure[x]", "CodeableConcept|Reference(Procedure)",
3042            "The code or reference to a Procedure resource which identifies the clinical intervention performed.", 0, 1,
3043            procedure);
3044      case 115642:
3045        /* udi */ return new Property("udi", "Reference(Device)",
3046            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
3047      default:
3048        return super.getNamedProperty(_hash, _name, _checkValid);
3049      }
3050
3051    }
3052
3053    @Override
3054    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3055      switch (hash) {
3056      case 1349547969:
3057        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
3058      case 3575610:
3059        /* type */ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
3060      case 3076014:
3061        /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateTimeType
3062      case -1095204141:
3063        /* procedure */ return this.procedure == null ? new Base[0] : new Base[] { this.procedure }; // Type
3064      case 115642:
3065        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
3066      default:
3067        return super.getProperty(hash, name, checkValid);
3068      }
3069
3070    }
3071
3072    @Override
3073    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3074      switch (hash) {
3075      case 1349547969: // sequence
3076        this.sequence = castToPositiveInt(value); // PositiveIntType
3077        return value;
3078      case 3575610: // type
3079        this.getType().add(castToCodeableConcept(value)); // CodeableConcept
3080        return value;
3081      case 3076014: // date
3082        this.date = castToDateTime(value); // DateTimeType
3083        return value;
3084      case -1095204141: // procedure
3085        this.procedure = castToType(value); // Type
3086        return value;
3087      case 115642: // udi
3088        this.getUdi().add(castToReference(value)); // Reference
3089        return value;
3090      default:
3091        return super.setProperty(hash, name, value);
3092      }
3093
3094    }
3095
3096    @Override
3097    public Base setProperty(String name, Base value) throws FHIRException {
3098      if (name.equals("sequence")) {
3099        this.sequence = castToPositiveInt(value); // PositiveIntType
3100      } else if (name.equals("type")) {
3101        this.getType().add(castToCodeableConcept(value));
3102      } else if (name.equals("date")) {
3103        this.date = castToDateTime(value); // DateTimeType
3104      } else if (name.equals("procedure[x]")) {
3105        this.procedure = castToType(value); // Type
3106      } else if (name.equals("udi")) {
3107        this.getUdi().add(castToReference(value));
3108      } else
3109        return super.setProperty(name, value);
3110      return value;
3111    }
3112
3113  @Override
3114  public void removeChild(String name, Base value) throws FHIRException {
3115      if (name.equals("sequence")) {
3116        this.sequence = null;
3117      } else if (name.equals("type")) {
3118        this.getType().remove(castToCodeableConcept(value));
3119      } else if (name.equals("date")) {
3120        this.date = null;
3121      } else if (name.equals("procedure[x]")) {
3122        this.procedure = null;
3123      } else if (name.equals("udi")) {
3124        this.getUdi().remove(castToReference(value));
3125      } else
3126        super.removeChild(name, value);
3127      
3128    }
3129
3130    @Override
3131    public Base makeProperty(int hash, String name) throws FHIRException {
3132      switch (hash) {
3133      case 1349547969:
3134        return getSequenceElement();
3135      case 3575610:
3136        return addType();
3137      case 3076014:
3138        return getDateElement();
3139      case 1640074445:
3140        return getProcedure();
3141      case -1095204141:
3142        return getProcedure();
3143      case 115642:
3144        return addUdi();
3145      default:
3146        return super.makeProperty(hash, name);
3147      }
3148
3149    }
3150
3151    @Override
3152    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3153      switch (hash) {
3154      case 1349547969:
3155        /* sequence */ return new String[] { "positiveInt" };
3156      case 3575610:
3157        /* type */ return new String[] { "CodeableConcept" };
3158      case 3076014:
3159        /* date */ return new String[] { "dateTime" };
3160      case -1095204141:
3161        /* procedure */ return new String[] { "CodeableConcept", "Reference" };
3162      case 115642:
3163        /* udi */ return new String[] { "Reference" };
3164      default:
3165        return super.getTypesForProperty(hash, name);
3166      }
3167
3168    }
3169
3170    @Override
3171    public Base addChild(String name) throws FHIRException {
3172      if (name.equals("sequence")) {
3173        throw new FHIRException("Cannot call addChild on a singleton property Claim.sequence");
3174      } else if (name.equals("type")) {
3175        return addType();
3176      } else if (name.equals("date")) {
3177        throw new FHIRException("Cannot call addChild on a singleton property Claim.date");
3178      } else if (name.equals("procedureCodeableConcept")) {
3179        this.procedure = new CodeableConcept();
3180        return this.procedure;
3181      } else if (name.equals("procedureReference")) {
3182        this.procedure = new Reference();
3183        return this.procedure;
3184      } else if (name.equals("udi")) {
3185        return addUdi();
3186      } else
3187        return super.addChild(name);
3188    }
3189
3190    public ProcedureComponent copy() {
3191      ProcedureComponent dst = new ProcedureComponent();
3192      copyValues(dst);
3193      return dst;
3194    }
3195
3196    public void copyValues(ProcedureComponent dst) {
3197      super.copyValues(dst);
3198      dst.sequence = sequence == null ? null : sequence.copy();
3199      if (type != null) {
3200        dst.type = new ArrayList<CodeableConcept>();
3201        for (CodeableConcept i : type)
3202          dst.type.add(i.copy());
3203      }
3204      ;
3205      dst.date = date == null ? null : date.copy();
3206      dst.procedure = procedure == null ? null : procedure.copy();
3207      if (udi != null) {
3208        dst.udi = new ArrayList<Reference>();
3209        for (Reference i : udi)
3210          dst.udi.add(i.copy());
3211      }
3212      ;
3213    }
3214
3215    @Override
3216    public boolean equalsDeep(Base other_) {
3217      if (!super.equalsDeep(other_))
3218        return false;
3219      if (!(other_ instanceof ProcedureComponent))
3220        return false;
3221      ProcedureComponent o = (ProcedureComponent) other_;
3222      return compareDeep(sequence, o.sequence, true) && compareDeep(type, o.type, true)
3223          && compareDeep(date, o.date, true) && compareDeep(procedure, o.procedure, true)
3224          && compareDeep(udi, o.udi, true);
3225    }
3226
3227    @Override
3228    public boolean equalsShallow(Base other_) {
3229      if (!super.equalsShallow(other_))
3230        return false;
3231      if (!(other_ instanceof ProcedureComponent))
3232        return false;
3233      ProcedureComponent o = (ProcedureComponent) other_;
3234      return compareValues(sequence, o.sequence, true) && compareValues(date, o.date, true);
3235    }
3236
3237    public boolean isEmpty() {
3238      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, type, date, procedure, udi);
3239    }
3240
3241    public String fhirType() {
3242      return "Claim.procedure";
3243
3244    }
3245
3246  }
3247
3248  @Block()
3249  public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
3250    /**
3251     * A number to uniquely identify insurance entries and provide a sequence of
3252     * coverages to convey coordination of benefit order.
3253     */
3254    @Child(name = "sequence", type = {
3255        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
3256    @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.")
3257    protected PositiveIntType sequence;
3258
3259    /**
3260     * A flag to indicate that this Coverage is to be used for adjudication of this
3261     * claim when set to true.
3262     */
3263    @Child(name = "focal", type = { BooleanType.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
3264    @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.")
3265    protected BooleanType focal;
3266
3267    /**
3268     * The business identifier to be used when the claim is sent for adjudication
3269     * against this insurance policy.
3270     */
3271    @Child(name = "identifier", type = {
3272        Identifier.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
3273    @Description(shortDefinition = "Pre-assigned Claim number", formalDefinition = "The business identifier to be used when the claim is sent for adjudication against this insurance policy.")
3274    protected Identifier identifier;
3275
3276    /**
3277     * Reference to the insurance card level information contained in the Coverage
3278     * resource. The coverage issuing insurer will use these details to locate the
3279     * patient's actual coverage within the insurer's information system.
3280     */
3281    @Child(name = "coverage", type = { Coverage.class }, order = 4, min = 1, max = 1, modifier = false, summary = true)
3282    @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.")
3283    protected Reference coverage;
3284
3285    /**
3286     * The actual object that is the target of the reference (Reference to the
3287     * insurance card level information contained in the Coverage resource. The
3288     * coverage issuing insurer will use these details to locate the patient's
3289     * actual coverage within the insurer's information system.)
3290     */
3291    protected Coverage coverageTarget;
3292
3293    /**
3294     * A business agreement number established between the provider and the insurer
3295     * for special business processing purposes.
3296     */
3297    @Child(name = "businessArrangement", type = {
3298        StringType.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
3299    @Description(shortDefinition = "Additional provider contract number", formalDefinition = "A business agreement number established between the provider and the insurer for special business processing purposes.")
3300    protected StringType businessArrangement;
3301
3302    /**
3303     * Reference numbers previously provided by the insurer to the provider to be
3304     * quoted on subsequent claims containing services or products related to the
3305     * prior authorization.
3306     */
3307    @Child(name = "preAuthRef", type = {
3308        StringType.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3309    @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.")
3310    protected List<StringType> preAuthRef;
3311
3312    /**
3313     * The result of the adjudication of the line items for the Coverage specified
3314     * in this insurance.
3315     */
3316    @Child(name = "claimResponse", type = {
3317        ClaimResponse.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
3318    @Description(shortDefinition = "Adjudication results", formalDefinition = "The result of the adjudication of the line items for the Coverage specified in this insurance.")
3319    protected Reference claimResponse;
3320
3321    /**
3322     * The actual object that is the target of the reference (The result of the
3323     * adjudication of the line items for the Coverage specified in this insurance.)
3324     */
3325    protected ClaimResponse claimResponseTarget;
3326
3327    private static final long serialVersionUID = -1711744215L;
3328
3329    /**
3330     * Constructor
3331     */
3332    public InsuranceComponent() {
3333      super();
3334    }
3335
3336    /**
3337     * Constructor
3338     */
3339    public InsuranceComponent(PositiveIntType sequence, BooleanType focal, Reference coverage) {
3340      super();
3341      this.sequence = sequence;
3342      this.focal = focal;
3343      this.coverage = coverage;
3344    }
3345
3346    /**
3347     * @return {@link #sequence} (A number to uniquely identify insurance entries
3348     *         and provide a sequence of coverages to convey coordination of benefit
3349     *         order.). This is the underlying object with id, value and extensions.
3350     *         The accessor "getSequence" gives direct access to the value
3351     */
3352    public PositiveIntType getSequenceElement() {
3353      if (this.sequence == null)
3354        if (Configuration.errorOnAutoCreate())
3355          throw new Error("Attempt to auto-create InsuranceComponent.sequence");
3356        else if (Configuration.doAutoCreate())
3357          this.sequence = new PositiveIntType(); // bb
3358      return this.sequence;
3359    }
3360
3361    public boolean hasSequenceElement() {
3362      return this.sequence != null && !this.sequence.isEmpty();
3363    }
3364
3365    public boolean hasSequence() {
3366      return this.sequence != null && !this.sequence.isEmpty();
3367    }
3368
3369    /**
3370     * @param value {@link #sequence} (A number to uniquely identify insurance
3371     *              entries and provide a sequence of coverages to convey
3372     *              coordination of benefit order.). This is the underlying object
3373     *              with id, value and extensions. The accessor "getSequence" gives
3374     *              direct access to the value
3375     */
3376    public InsuranceComponent setSequenceElement(PositiveIntType value) {
3377      this.sequence = value;
3378      return this;
3379    }
3380
3381    /**
3382     * @return A number to uniquely identify insurance entries and provide a
3383     *         sequence of coverages to convey coordination of benefit order.
3384     */
3385    public int getSequence() {
3386      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3387    }
3388
3389    /**
3390     * @param value A number to uniquely identify insurance entries and provide a
3391     *              sequence of coverages to convey coordination of benefit order.
3392     */
3393    public InsuranceComponent setSequence(int value) {
3394      if (this.sequence == null)
3395        this.sequence = new PositiveIntType();
3396      this.sequence.setValue(value);
3397      return this;
3398    }
3399
3400    /**
3401     * @return {@link #focal} (A flag to indicate that this Coverage is to be used
3402     *         for adjudication of this claim when set to true.). This is the
3403     *         underlying object with id, value and extensions. The accessor
3404     *         "getFocal" gives direct access to the value
3405     */
3406    public BooleanType getFocalElement() {
3407      if (this.focal == null)
3408        if (Configuration.errorOnAutoCreate())
3409          throw new Error("Attempt to auto-create InsuranceComponent.focal");
3410        else if (Configuration.doAutoCreate())
3411          this.focal = new BooleanType(); // bb
3412      return this.focal;
3413    }
3414
3415    public boolean hasFocalElement() {
3416      return this.focal != null && !this.focal.isEmpty();
3417    }
3418
3419    public boolean hasFocal() {
3420      return this.focal != null && !this.focal.isEmpty();
3421    }
3422
3423    /**
3424     * @param value {@link #focal} (A flag to indicate that this Coverage is to be
3425     *              used for adjudication of this claim when set to true.). This is
3426     *              the underlying object with id, value and extensions. The
3427     *              accessor "getFocal" gives direct access to the value
3428     */
3429    public InsuranceComponent setFocalElement(BooleanType value) {
3430      this.focal = value;
3431      return this;
3432    }
3433
3434    /**
3435     * @return A flag to indicate that this Coverage is to be used for adjudication
3436     *         of this claim when set to true.
3437     */
3438    public boolean getFocal() {
3439      return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
3440    }
3441
3442    /**
3443     * @param value A flag to indicate that this Coverage is to be used for
3444     *              adjudication of this claim when set to true.
3445     */
3446    public InsuranceComponent setFocal(boolean value) {
3447      if (this.focal == null)
3448        this.focal = new BooleanType();
3449      this.focal.setValue(value);
3450      return this;
3451    }
3452
3453    /**
3454     * @return {@link #identifier} (The business identifier to be used when the
3455     *         claim is sent for adjudication against this insurance policy.)
3456     */
3457    public Identifier getIdentifier() {
3458      if (this.identifier == null)
3459        if (Configuration.errorOnAutoCreate())
3460          throw new Error("Attempt to auto-create InsuranceComponent.identifier");
3461        else if (Configuration.doAutoCreate())
3462          this.identifier = new Identifier(); // cc
3463      return this.identifier;
3464    }
3465
3466    public boolean hasIdentifier() {
3467      return this.identifier != null && !this.identifier.isEmpty();
3468    }
3469
3470    /**
3471     * @param value {@link #identifier} (The business identifier to be used when the
3472     *              claim is sent for adjudication against this insurance policy.)
3473     */
3474    public InsuranceComponent setIdentifier(Identifier value) {
3475      this.identifier = value;
3476      return this;
3477    }
3478
3479    /**
3480     * @return {@link #coverage} (Reference to the insurance card level information
3481     *         contained in the Coverage resource. The coverage issuing insurer will
3482     *         use these details to locate the patient's actual coverage within the
3483     *         insurer's information system.)
3484     */
3485    public Reference getCoverage() {
3486      if (this.coverage == null)
3487        if (Configuration.errorOnAutoCreate())
3488          throw new Error("Attempt to auto-create InsuranceComponent.coverage");
3489        else if (Configuration.doAutoCreate())
3490          this.coverage = new Reference(); // cc
3491      return this.coverage;
3492    }
3493
3494    public boolean hasCoverage() {
3495      return this.coverage != null && !this.coverage.isEmpty();
3496    }
3497
3498    /**
3499     * @param value {@link #coverage} (Reference to the insurance card level
3500     *              information contained in the Coverage resource. The coverage
3501     *              issuing insurer will use these details to locate the patient's
3502     *              actual coverage within the insurer's information system.)
3503     */
3504    public InsuranceComponent setCoverage(Reference value) {
3505      this.coverage = value;
3506      return this;
3507    }
3508
3509    /**
3510     * @return {@link #coverage} The actual object that is the target of the
3511     *         reference. The reference library doesn't populate this, but you can
3512     *         use it to hold the resource if you resolve it. (Reference to the
3513     *         insurance card level information contained in the Coverage resource.
3514     *         The coverage issuing insurer will use these details to locate the
3515     *         patient's actual coverage within the insurer's information system.)
3516     */
3517    public Coverage getCoverageTarget() {
3518      if (this.coverageTarget == null)
3519        if (Configuration.errorOnAutoCreate())
3520          throw new Error("Attempt to auto-create InsuranceComponent.coverage");
3521        else if (Configuration.doAutoCreate())
3522          this.coverageTarget = new Coverage(); // aa
3523      return this.coverageTarget;
3524    }
3525
3526    /**
3527     * @param value {@link #coverage} The actual object that is the target of the
3528     *              reference. The reference library doesn't use these, but you can
3529     *              use it to hold the resource if you resolve it. (Reference to the
3530     *              insurance card level information contained in the Coverage
3531     *              resource. The coverage issuing insurer will use these details to
3532     *              locate the patient's actual coverage within the insurer's
3533     *              information system.)
3534     */
3535    public InsuranceComponent setCoverageTarget(Coverage value) {
3536      this.coverageTarget = value;
3537      return this;
3538    }
3539
3540    /**
3541     * @return {@link #businessArrangement} (A business agreement number established
3542     *         between the provider and the insurer for special business processing
3543     *         purposes.). This is the underlying object with id, value and
3544     *         extensions. The accessor "getBusinessArrangement" gives direct access
3545     *         to the value
3546     */
3547    public StringType getBusinessArrangementElement() {
3548      if (this.businessArrangement == null)
3549        if (Configuration.errorOnAutoCreate())
3550          throw new Error("Attempt to auto-create InsuranceComponent.businessArrangement");
3551        else if (Configuration.doAutoCreate())
3552          this.businessArrangement = new StringType(); // bb
3553      return this.businessArrangement;
3554    }
3555
3556    public boolean hasBusinessArrangementElement() {
3557      return this.businessArrangement != null && !this.businessArrangement.isEmpty();
3558    }
3559
3560    public boolean hasBusinessArrangement() {
3561      return this.businessArrangement != null && !this.businessArrangement.isEmpty();
3562    }
3563
3564    /**
3565     * @param value {@link #businessArrangement} (A business agreement number
3566     *              established between the provider and the insurer for special
3567     *              business processing purposes.). This is the underlying object
3568     *              with id, value and extensions. The accessor
3569     *              "getBusinessArrangement" gives direct access to the value
3570     */
3571    public InsuranceComponent setBusinessArrangementElement(StringType value) {
3572      this.businessArrangement = value;
3573      return this;
3574    }
3575
3576    /**
3577     * @return A business agreement number established between the provider and the
3578     *         insurer for special business processing purposes.
3579     */
3580    public String getBusinessArrangement() {
3581      return this.businessArrangement == null ? null : this.businessArrangement.getValue();
3582    }
3583
3584    /**
3585     * @param value A business agreement number established between the provider and
3586     *              the insurer for special business processing purposes.
3587     */
3588    public InsuranceComponent setBusinessArrangement(String value) {
3589      if (Utilities.noString(value))
3590        this.businessArrangement = null;
3591      else {
3592        if (this.businessArrangement == null)
3593          this.businessArrangement = new StringType();
3594        this.businessArrangement.setValue(value);
3595      }
3596      return this;
3597    }
3598
3599    /**
3600     * @return {@link #preAuthRef} (Reference numbers previously provided by the
3601     *         insurer to the provider to be quoted on subsequent claims containing
3602     *         services or products related to the prior authorization.)
3603     */
3604    public List<StringType> getPreAuthRef() {
3605      if (this.preAuthRef == null)
3606        this.preAuthRef = new ArrayList<StringType>();
3607      return this.preAuthRef;
3608    }
3609
3610    /**
3611     * @return Returns a reference to <code>this</code> for easy method chaining
3612     */
3613    public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) {
3614      this.preAuthRef = thePreAuthRef;
3615      return this;
3616    }
3617
3618    public boolean hasPreAuthRef() {
3619      if (this.preAuthRef == null)
3620        return false;
3621      for (StringType item : this.preAuthRef)
3622        if (!item.isEmpty())
3623          return true;
3624      return false;
3625    }
3626
3627    /**
3628     * @return {@link #preAuthRef} (Reference numbers previously provided by the
3629     *         insurer to the provider to be quoted on subsequent claims containing
3630     *         services or products related to the prior authorization.)
3631     */
3632    public StringType addPreAuthRefElement() {// 2
3633      StringType t = new StringType();
3634      if (this.preAuthRef == null)
3635        this.preAuthRef = new ArrayList<StringType>();
3636      this.preAuthRef.add(t);
3637      return t;
3638    }
3639
3640    /**
3641     * @param value {@link #preAuthRef} (Reference numbers previously provided by
3642     *              the insurer to the provider to be quoted on subsequent claims
3643     *              containing services or products related to the prior
3644     *              authorization.)
3645     */
3646    public InsuranceComponent addPreAuthRef(String value) { // 1
3647      StringType t = new StringType();
3648      t.setValue(value);
3649      if (this.preAuthRef == null)
3650        this.preAuthRef = new ArrayList<StringType>();
3651      this.preAuthRef.add(t);
3652      return this;
3653    }
3654
3655    /**
3656     * @param value {@link #preAuthRef} (Reference numbers previously provided by
3657     *              the insurer to the provider to be quoted on subsequent claims
3658     *              containing services or products related to the prior
3659     *              authorization.)
3660     */
3661    public boolean hasPreAuthRef(String value) {
3662      if (this.preAuthRef == null)
3663        return false;
3664      for (StringType v : this.preAuthRef)
3665        if (v.getValue().equals(value)) // string
3666          return true;
3667      return false;
3668    }
3669
3670    /**
3671     * @return {@link #claimResponse} (The result of the adjudication of the line
3672     *         items for the Coverage specified in this insurance.)
3673     */
3674    public Reference getClaimResponse() {
3675      if (this.claimResponse == null)
3676        if (Configuration.errorOnAutoCreate())
3677          throw new Error("Attempt to auto-create InsuranceComponent.claimResponse");
3678        else if (Configuration.doAutoCreate())
3679          this.claimResponse = new Reference(); // cc
3680      return this.claimResponse;
3681    }
3682
3683    public boolean hasClaimResponse() {
3684      return this.claimResponse != null && !this.claimResponse.isEmpty();
3685    }
3686
3687    /**
3688     * @param value {@link #claimResponse} (The result of the adjudication of the
3689     *              line items for the Coverage specified in this insurance.)
3690     */
3691    public InsuranceComponent setClaimResponse(Reference value) {
3692      this.claimResponse = value;
3693      return this;
3694    }
3695
3696    /**
3697     * @return {@link #claimResponse} The actual object that is the target of the
3698     *         reference. The reference library doesn't populate this, but you can
3699     *         use it to hold the resource if you resolve it. (The result of the
3700     *         adjudication of the line items for the Coverage specified in this
3701     *         insurance.)
3702     */
3703    public ClaimResponse getClaimResponseTarget() {
3704      if (this.claimResponseTarget == null)
3705        if (Configuration.errorOnAutoCreate())
3706          throw new Error("Attempt to auto-create InsuranceComponent.claimResponse");
3707        else if (Configuration.doAutoCreate())
3708          this.claimResponseTarget = new ClaimResponse(); // aa
3709      return this.claimResponseTarget;
3710    }
3711
3712    /**
3713     * @param value {@link #claimResponse} The actual object that is the target of
3714     *              the reference. The reference library doesn't use these, but you
3715     *              can use it to hold the resource if you resolve it. (The result
3716     *              of the adjudication of the line items for the Coverage specified
3717     *              in this insurance.)
3718     */
3719    public InsuranceComponent setClaimResponseTarget(ClaimResponse value) {
3720      this.claimResponseTarget = value;
3721      return this;
3722    }
3723
3724    protected void listChildren(List<Property> children) {
3725      super.listChildren(children);
3726      children.add(new Property("sequence", "positiveInt",
3727          "A number to uniquely identify insurance entries and provide a sequence of coverages to convey coordination of benefit order.",
3728          0, 1, sequence));
3729      children.add(new Property("focal", "boolean",
3730          "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.", 0, 1,
3731          focal));
3732      children.add(new Property("identifier", "Identifier",
3733          "The business identifier to be used when the claim is sent for adjudication against this insurance policy.",
3734          0, 1, identifier));
3735      children.add(new Property("coverage", "Reference(Coverage)",
3736          "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.",
3737          0, 1, coverage));
3738      children.add(new Property("businessArrangement", "string",
3739          "A business agreement number established between the provider and the insurer for special business processing purposes.",
3740          0, 1, businessArrangement));
3741      children.add(new Property("preAuthRef", "string",
3742          "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.",
3743          0, java.lang.Integer.MAX_VALUE, preAuthRef));
3744      children.add(new Property("claimResponse", "Reference(ClaimResponse)",
3745          "The result of the adjudication of the line items for the Coverage specified in this insurance.", 0, 1,
3746          claimResponse));
3747    }
3748
3749    @Override
3750    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3751      switch (_hash) {
3752      case 1349547969:
3753        /* sequence */ return new Property("sequence", "positiveInt",
3754            "A number to uniquely identify insurance entries and provide a sequence of coverages to convey coordination of benefit order.",
3755            0, 1, sequence);
3756      case 97604197:
3757        /* focal */ return new Property("focal", "boolean",
3758            "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.", 0,
3759            1, focal);
3760      case -1618432855:
3761        /* identifier */ return new Property("identifier", "Identifier",
3762            "The business identifier to be used when the claim is sent for adjudication against this insurance policy.",
3763            0, 1, identifier);
3764      case -351767064:
3765        /* coverage */ return new Property("coverage", "Reference(Coverage)",
3766            "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.",
3767            0, 1, coverage);
3768      case 259920682:
3769        /* businessArrangement */ return new Property("businessArrangement", "string",
3770            "A business agreement number established between the provider and the insurer for special business processing purposes.",
3771            0, 1, businessArrangement);
3772      case 522246568:
3773        /* preAuthRef */ return new Property("preAuthRef", "string",
3774            "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.",
3775            0, java.lang.Integer.MAX_VALUE, preAuthRef);
3776      case 689513629:
3777        /* claimResponse */ return new Property("claimResponse", "Reference(ClaimResponse)",
3778            "The result of the adjudication of the line items for the Coverage specified in this insurance.", 0, 1,
3779            claimResponse);
3780      default:
3781        return super.getNamedProperty(_hash, _name, _checkValid);
3782      }
3783
3784    }
3785
3786    @Override
3787    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3788      switch (hash) {
3789      case 1349547969:
3790        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
3791      case 97604197:
3792        /* focal */ return this.focal == null ? new Base[0] : new Base[] { this.focal }; // BooleanType
3793      case -1618432855:
3794        /* identifier */ return this.identifier == null ? new Base[0] : new Base[] { this.identifier }; // Identifier
3795      case -351767064:
3796        /* coverage */ return this.coverage == null ? new Base[0] : new Base[] { this.coverage }; // Reference
3797      case 259920682:
3798        /* businessArrangement */ return this.businessArrangement == null ? new Base[0]
3799            : new Base[] { this.businessArrangement }; // StringType
3800      case 522246568:
3801        /* preAuthRef */ return this.preAuthRef == null ? new Base[0]
3802            : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
3803      case 689513629:
3804        /* claimResponse */ return this.claimResponse == null ? new Base[0] : new Base[] { this.claimResponse }; // Reference
3805      default:
3806        return super.getProperty(hash, name, checkValid);
3807      }
3808
3809    }
3810
3811    @Override
3812    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3813      switch (hash) {
3814      case 1349547969: // sequence
3815        this.sequence = castToPositiveInt(value); // PositiveIntType
3816        return value;
3817      case 97604197: // focal
3818        this.focal = castToBoolean(value); // BooleanType
3819        return value;
3820      case -1618432855: // identifier
3821        this.identifier = castToIdentifier(value); // Identifier
3822        return value;
3823      case -351767064: // coverage
3824        this.coverage = castToReference(value); // Reference
3825        return value;
3826      case 259920682: // businessArrangement
3827        this.businessArrangement = castToString(value); // StringType
3828        return value;
3829      case 522246568: // preAuthRef
3830        this.getPreAuthRef().add(castToString(value)); // StringType
3831        return value;
3832      case 689513629: // claimResponse
3833        this.claimResponse = castToReference(value); // Reference
3834        return value;
3835      default:
3836        return super.setProperty(hash, name, value);
3837      }
3838
3839    }
3840
3841    @Override
3842    public Base setProperty(String name, Base value) throws FHIRException {
3843      if (name.equals("sequence")) {
3844        this.sequence = castToPositiveInt(value); // PositiveIntType
3845      } else if (name.equals("focal")) {
3846        this.focal = castToBoolean(value); // BooleanType
3847      } else if (name.equals("identifier")) {
3848        this.identifier = castToIdentifier(value); // Identifier
3849      } else if (name.equals("coverage")) {
3850        this.coverage = castToReference(value); // Reference
3851      } else if (name.equals("businessArrangement")) {
3852        this.businessArrangement = castToString(value); // StringType
3853      } else if (name.equals("preAuthRef")) {
3854        this.getPreAuthRef().add(castToString(value));
3855      } else if (name.equals("claimResponse")) {
3856        this.claimResponse = castToReference(value); // Reference
3857      } else
3858        return super.setProperty(name, value);
3859      return value;
3860    }
3861
3862  @Override
3863  public void removeChild(String name, Base value) throws FHIRException {
3864      if (name.equals("sequence")) {
3865        this.sequence = null;
3866      } else if (name.equals("focal")) {
3867        this.focal = null;
3868      } else if (name.equals("identifier")) {
3869        this.identifier = null;
3870      } else if (name.equals("coverage")) {
3871        this.coverage = null;
3872      } else if (name.equals("businessArrangement")) {
3873        this.businessArrangement = null;
3874      } else if (name.equals("preAuthRef")) {
3875        this.getPreAuthRef().remove(castToString(value));
3876      } else if (name.equals("claimResponse")) {
3877        this.claimResponse = null;
3878      } else
3879        super.removeChild(name, value);
3880      
3881    }
3882
3883    @Override
3884    public Base makeProperty(int hash, String name) throws FHIRException {
3885      switch (hash) {
3886      case 1349547969:
3887        return getSequenceElement();
3888      case 97604197:
3889        return getFocalElement();
3890      case -1618432855:
3891        return getIdentifier();
3892      case -351767064:
3893        return getCoverage();
3894      case 259920682:
3895        return getBusinessArrangementElement();
3896      case 522246568:
3897        return addPreAuthRefElement();
3898      case 689513629:
3899        return getClaimResponse();
3900      default:
3901        return super.makeProperty(hash, name);
3902      }
3903
3904    }
3905
3906    @Override
3907    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3908      switch (hash) {
3909      case 1349547969:
3910        /* sequence */ return new String[] { "positiveInt" };
3911      case 97604197:
3912        /* focal */ return new String[] { "boolean" };
3913      case -1618432855:
3914        /* identifier */ return new String[] { "Identifier" };
3915      case -351767064:
3916        /* coverage */ return new String[] { "Reference" };
3917      case 259920682:
3918        /* businessArrangement */ return new String[] { "string" };
3919      case 522246568:
3920        /* preAuthRef */ return new String[] { "string" };
3921      case 689513629:
3922        /* claimResponse */ return new String[] { "Reference" };
3923      default:
3924        return super.getTypesForProperty(hash, name);
3925      }
3926
3927    }
3928
3929    @Override
3930    public Base addChild(String name) throws FHIRException {
3931      if (name.equals("sequence")) {
3932        throw new FHIRException("Cannot call addChild on a singleton property Claim.sequence");
3933      } else if (name.equals("focal")) {
3934        throw new FHIRException("Cannot call addChild on a singleton property Claim.focal");
3935      } else if (name.equals("identifier")) {
3936        this.identifier = new Identifier();
3937        return this.identifier;
3938      } else if (name.equals("coverage")) {
3939        this.coverage = new Reference();
3940        return this.coverage;
3941      } else if (name.equals("businessArrangement")) {
3942        throw new FHIRException("Cannot call addChild on a singleton property Claim.businessArrangement");
3943      } else if (name.equals("preAuthRef")) {
3944        throw new FHIRException("Cannot call addChild on a singleton property Claim.preAuthRef");
3945      } else if (name.equals("claimResponse")) {
3946        this.claimResponse = new Reference();
3947        return this.claimResponse;
3948      } else
3949        return super.addChild(name);
3950    }
3951
3952    public InsuranceComponent copy() {
3953      InsuranceComponent dst = new InsuranceComponent();
3954      copyValues(dst);
3955      return dst;
3956    }
3957
3958    public void copyValues(InsuranceComponent dst) {
3959      super.copyValues(dst);
3960      dst.sequence = sequence == null ? null : sequence.copy();
3961      dst.focal = focal == null ? null : focal.copy();
3962      dst.identifier = identifier == null ? null : identifier.copy();
3963      dst.coverage = coverage == null ? null : coverage.copy();
3964      dst.businessArrangement = businessArrangement == null ? null : businessArrangement.copy();
3965      if (preAuthRef != null) {
3966        dst.preAuthRef = new ArrayList<StringType>();
3967        for (StringType i : preAuthRef)
3968          dst.preAuthRef.add(i.copy());
3969      }
3970      ;
3971      dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
3972    }
3973
3974    @Override
3975    public boolean equalsDeep(Base other_) {
3976      if (!super.equalsDeep(other_))
3977        return false;
3978      if (!(other_ instanceof InsuranceComponent))
3979        return false;
3980      InsuranceComponent o = (InsuranceComponent) other_;
3981      return compareDeep(sequence, o.sequence, true) && compareDeep(focal, o.focal, true)
3982          && compareDeep(identifier, o.identifier, true) && compareDeep(coverage, o.coverage, true)
3983          && compareDeep(businessArrangement, o.businessArrangement, true)
3984          && compareDeep(preAuthRef, o.preAuthRef, true) && compareDeep(claimResponse, o.claimResponse, true);
3985    }
3986
3987    @Override
3988    public boolean equalsShallow(Base other_) {
3989      if (!super.equalsShallow(other_))
3990        return false;
3991      if (!(other_ instanceof InsuranceComponent))
3992        return false;
3993      InsuranceComponent o = (InsuranceComponent) other_;
3994      return compareValues(sequence, o.sequence, true) && compareValues(focal, o.focal, true)
3995          && compareValues(businessArrangement, o.businessArrangement, true)
3996          && compareValues(preAuthRef, o.preAuthRef, true);
3997    }
3998
3999    public boolean isEmpty() {
4000      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, focal, identifier, coverage,
4001          businessArrangement, preAuthRef, claimResponse);
4002    }
4003
4004    public String fhirType() {
4005      return "Claim.insurance";
4006
4007    }
4008
4009  }
4010
4011  @Block()
4012  public static class AccidentComponent extends BackboneElement implements IBaseBackboneElement {
4013    /**
4014     * Date of an accident event related to the products and services contained in
4015     * the claim.
4016     */
4017    @Child(name = "date", type = { DateType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
4018    @Description(shortDefinition = "When the incident occurred", formalDefinition = "Date of an accident event  related to the products and services contained in the claim.")
4019    protected DateType date;
4020
4021    /**
4022     * The type or context of the accident event for the purposes of selection of
4023     * potential insurance coverages and determination of coordination between
4024     * insurers.
4025     */
4026    @Child(name = "type", type = {
4027        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
4028    @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.")
4029    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://terminology.hl7.org/ValueSet/v3-ActIncidentCode")
4030    protected CodeableConcept type;
4031
4032    /**
4033     * The physical location of the accident event.
4034     */
4035    @Child(name = "location", type = { Address.class,
4036        Location.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
4037    @Description(shortDefinition = "Where the event occurred", formalDefinition = "The physical location of the accident event.")
4038    protected Type location;
4039
4040    private static final long serialVersionUID = 622904984L;
4041
4042    /**
4043     * Constructor
4044     */
4045    public AccidentComponent() {
4046      super();
4047    }
4048
4049    /**
4050     * Constructor
4051     */
4052    public AccidentComponent(DateType date) {
4053      super();
4054      this.date = date;
4055    }
4056
4057    /**
4058     * @return {@link #date} (Date of an accident event related to the products and
4059     *         services contained in the claim.). This is the underlying object with
4060     *         id, value and extensions. The accessor "getDate" gives direct access
4061     *         to the value
4062     */
4063    public DateType getDateElement() {
4064      if (this.date == null)
4065        if (Configuration.errorOnAutoCreate())
4066          throw new Error("Attempt to auto-create AccidentComponent.date");
4067        else if (Configuration.doAutoCreate())
4068          this.date = new DateType(); // bb
4069      return this.date;
4070    }
4071
4072    public boolean hasDateElement() {
4073      return this.date != null && !this.date.isEmpty();
4074    }
4075
4076    public boolean hasDate() {
4077      return this.date != null && !this.date.isEmpty();
4078    }
4079
4080    /**
4081     * @param value {@link #date} (Date of an accident event related to the products
4082     *              and services contained in the claim.). This is the underlying
4083     *              object with id, value and extensions. The accessor "getDate"
4084     *              gives direct access to the value
4085     */
4086    public AccidentComponent setDateElement(DateType value) {
4087      this.date = value;
4088      return this;
4089    }
4090
4091    /**
4092     * @return Date of an accident event related to the products and services
4093     *         contained in the claim.
4094     */
4095    public Date getDate() {
4096      return this.date == null ? null : this.date.getValue();
4097    }
4098
4099    /**
4100     * @param value Date of an accident event related to the products and services
4101     *              contained in the claim.
4102     */
4103    public AccidentComponent setDate(Date value) {
4104      if (this.date == null)
4105        this.date = new DateType();
4106      this.date.setValue(value);
4107      return this;
4108    }
4109
4110    /**
4111     * @return {@link #type} (The type or context of the accident event for the
4112     *         purposes of selection of potential insurance coverages and
4113     *         determination of coordination between insurers.)
4114     */
4115    public CodeableConcept getType() {
4116      if (this.type == null)
4117        if (Configuration.errorOnAutoCreate())
4118          throw new Error("Attempt to auto-create AccidentComponent.type");
4119        else if (Configuration.doAutoCreate())
4120          this.type = new CodeableConcept(); // cc
4121      return this.type;
4122    }
4123
4124    public boolean hasType() {
4125      return this.type != null && !this.type.isEmpty();
4126    }
4127
4128    /**
4129     * @param value {@link #type} (The type or context of the accident event for the
4130     *              purposes of selection of potential insurance coverages and
4131     *              determination of coordination between insurers.)
4132     */
4133    public AccidentComponent setType(CodeableConcept value) {
4134      this.type = value;
4135      return this;
4136    }
4137
4138    /**
4139     * @return {@link #location} (The physical location of the accident event.)
4140     */
4141    public Type getLocation() {
4142      return this.location;
4143    }
4144
4145    /**
4146     * @return {@link #location} (The physical location of the accident event.)
4147     */
4148    public Address getLocationAddress() throws FHIRException {
4149      if (this.location == null)
4150        this.location = new Address();
4151      if (!(this.location instanceof Address))
4152        throw new FHIRException("Type mismatch: the type Address was expected, but "
4153            + this.location.getClass().getName() + " was encountered");
4154      return (Address) this.location;
4155    }
4156
4157    public boolean hasLocationAddress() {
4158      return this.location instanceof Address;
4159    }
4160
4161    /**
4162     * @return {@link #location} (The physical location of the accident event.)
4163     */
4164    public Reference getLocationReference() throws FHIRException {
4165      if (this.location == null)
4166        this.location = new Reference();
4167      if (!(this.location instanceof Reference))
4168        throw new FHIRException("Type mismatch: the type Reference was expected, but "
4169            + this.location.getClass().getName() + " was encountered");
4170      return (Reference) this.location;
4171    }
4172
4173    public boolean hasLocationReference() {
4174      return this.location instanceof Reference;
4175    }
4176
4177    public boolean hasLocation() {
4178      return this.location != null && !this.location.isEmpty();
4179    }
4180
4181    /**
4182     * @param value {@link #location} (The physical location of the accident event.)
4183     */
4184    public AccidentComponent setLocation(Type value) {
4185      if (value != null && !(value instanceof Address || value instanceof Reference))
4186        throw new Error("Not the right type for Claim.accident.location[x]: " + value.fhirType());
4187      this.location = value;
4188      return this;
4189    }
4190
4191    protected void listChildren(List<Property> children) {
4192      super.listChildren(children);
4193      children.add(new Property("date", "date",
4194          "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date));
4195      children.add(new Property("type", "CodeableConcept",
4196          "The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.",
4197          0, 1, type));
4198      children.add(new Property("location[x]", "Address|Reference(Location)",
4199          "The physical location of the accident event.", 0, 1, location));
4200    }
4201
4202    @Override
4203    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4204      switch (_hash) {
4205      case 3076014:
4206        /* date */ return new Property("date", "date",
4207            "Date of an accident event  related to the products and services contained in the claim.", 0, 1, date);
4208      case 3575610:
4209        /* type */ return new Property("type", "CodeableConcept",
4210            "The type or context of the accident event for the purposes of selection of potential insurance coverages and determination of coordination between insurers.",
4211            0, 1, type);
4212      case 552316075:
4213        /* location[x] */ return new Property("location[x]", "Address|Reference(Location)",
4214            "The physical location of the accident event.", 0, 1, location);
4215      case 1901043637:
4216        /* location */ return new Property("location[x]", "Address|Reference(Location)",
4217            "The physical location of the accident event.", 0, 1, location);
4218      case -1280020865:
4219        /* locationAddress */ return new Property("location[x]", "Address|Reference(Location)",
4220            "The physical location of the accident event.", 0, 1, location);
4221      case 755866390:
4222        /* locationReference */ return new Property("location[x]", "Address|Reference(Location)",
4223            "The physical location of the accident event.", 0, 1, location);
4224      default:
4225        return super.getNamedProperty(_hash, _name, _checkValid);
4226      }
4227
4228    }
4229
4230    @Override
4231    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4232      switch (hash) {
4233      case 3076014:
4234        /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateType
4235      case 3575610:
4236        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
4237      case 1901043637:
4238        /* location */ return this.location == null ? new Base[0] : new Base[] { this.location }; // Type
4239      default:
4240        return super.getProperty(hash, name, checkValid);
4241      }
4242
4243    }
4244
4245    @Override
4246    public Base setProperty(int hash, String name, Base value) throws FHIRException {
4247      switch (hash) {
4248      case 3076014: // date
4249        this.date = castToDate(value); // DateType
4250        return value;
4251      case 3575610: // type
4252        this.type = castToCodeableConcept(value); // CodeableConcept
4253        return value;
4254      case 1901043637: // location
4255        this.location = castToType(value); // Type
4256        return value;
4257      default:
4258        return super.setProperty(hash, name, value);
4259      }
4260
4261    }
4262
4263    @Override
4264    public Base setProperty(String name, Base value) throws FHIRException {
4265      if (name.equals("date")) {
4266        this.date = castToDate(value); // DateType
4267      } else if (name.equals("type")) {
4268        this.type = castToCodeableConcept(value); // CodeableConcept
4269      } else if (name.equals("location[x]")) {
4270        this.location = castToType(value); // Type
4271      } else
4272        return super.setProperty(name, value);
4273      return value;
4274    }
4275
4276  @Override
4277  public void removeChild(String name, Base value) throws FHIRException {
4278      if (name.equals("date")) {
4279        this.date = null;
4280      } else if (name.equals("type")) {
4281        this.type = null;
4282      } else if (name.equals("location[x]")) {
4283        this.location = null;
4284      } else
4285        super.removeChild(name, value);
4286      
4287    }
4288
4289    @Override
4290    public Base makeProperty(int hash, String name) throws FHIRException {
4291      switch (hash) {
4292      case 3076014:
4293        return getDateElement();
4294      case 3575610:
4295        return getType();
4296      case 552316075:
4297        return getLocation();
4298      case 1901043637:
4299        return getLocation();
4300      default:
4301        return super.makeProperty(hash, name);
4302      }
4303
4304    }
4305
4306    @Override
4307    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4308      switch (hash) {
4309      case 3076014:
4310        /* date */ return new String[] { "date" };
4311      case 3575610:
4312        /* type */ return new String[] { "CodeableConcept" };
4313      case 1901043637:
4314        /* location */ return new String[] { "Address", "Reference" };
4315      default:
4316        return super.getTypesForProperty(hash, name);
4317      }
4318
4319    }
4320
4321    @Override
4322    public Base addChild(String name) throws FHIRException {
4323      if (name.equals("date")) {
4324        throw new FHIRException("Cannot call addChild on a singleton property Claim.date");
4325      } else if (name.equals("type")) {
4326        this.type = new CodeableConcept();
4327        return this.type;
4328      } else if (name.equals("locationAddress")) {
4329        this.location = new Address();
4330        return this.location;
4331      } else if (name.equals("locationReference")) {
4332        this.location = new Reference();
4333        return this.location;
4334      } else
4335        return super.addChild(name);
4336    }
4337
4338    public AccidentComponent copy() {
4339      AccidentComponent dst = new AccidentComponent();
4340      copyValues(dst);
4341      return dst;
4342    }
4343
4344    public void copyValues(AccidentComponent dst) {
4345      super.copyValues(dst);
4346      dst.date = date == null ? null : date.copy();
4347      dst.type = type == null ? null : type.copy();
4348      dst.location = location == null ? null : location.copy();
4349    }
4350
4351    @Override
4352    public boolean equalsDeep(Base other_) {
4353      if (!super.equalsDeep(other_))
4354        return false;
4355      if (!(other_ instanceof AccidentComponent))
4356        return false;
4357      AccidentComponent o = (AccidentComponent) other_;
4358      return compareDeep(date, o.date, true) && compareDeep(type, o.type, true)
4359          && compareDeep(location, o.location, true);
4360    }
4361
4362    @Override
4363    public boolean equalsShallow(Base other_) {
4364      if (!super.equalsShallow(other_))
4365        return false;
4366      if (!(other_ instanceof AccidentComponent))
4367        return false;
4368      AccidentComponent o = (AccidentComponent) other_;
4369      return compareValues(date, o.date, true);
4370    }
4371
4372    public boolean isEmpty() {
4373      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(date, type, location);
4374    }
4375
4376    public String fhirType() {
4377      return "Claim.accident";
4378
4379    }
4380
4381  }
4382
4383  @Block()
4384  public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
4385    /**
4386     * A number to uniquely identify item entries.
4387     */
4388    @Child(name = "sequence", type = {
4389        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
4390    @Description(shortDefinition = "Item instance identifier", formalDefinition = "A number to uniquely identify item entries.")
4391    protected PositiveIntType sequence;
4392
4393    /**
4394     * CareTeam members related to this service or product.
4395     */
4396    @Child(name = "careTeamSequence", type = {
4397        PositiveIntType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4398    @Description(shortDefinition = "Applicable careTeam members", formalDefinition = "CareTeam members related to this service or product.")
4399    protected List<PositiveIntType> careTeamSequence;
4400
4401    /**
4402     * Diagnosis applicable for this service or product.
4403     */
4404    @Child(name = "diagnosisSequence", type = {
4405        PositiveIntType.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4406    @Description(shortDefinition = "Applicable diagnoses", formalDefinition = "Diagnosis applicable for this service or product.")
4407    protected List<PositiveIntType> diagnosisSequence;
4408
4409    /**
4410     * Procedures applicable for this service or product.
4411     */
4412    @Child(name = "procedureSequence", type = {
4413        PositiveIntType.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4414    @Description(shortDefinition = "Applicable procedures", formalDefinition = "Procedures applicable for this service or product.")
4415    protected List<PositiveIntType> procedureSequence;
4416
4417    /**
4418     * Exceptions, special conditions and supporting information applicable for this
4419     * service or product.
4420     */
4421    @Child(name = "informationSequence", type = {
4422        PositiveIntType.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4423    @Description(shortDefinition = "Applicable exception and supporting information", formalDefinition = "Exceptions, special conditions and supporting information applicable for this service or product.")
4424    protected List<PositiveIntType> informationSequence;
4425
4426    /**
4427     * The type of revenue or cost center providing the product and/or service.
4428     */
4429    @Child(name = "revenue", type = {
4430        CodeableConcept.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
4431    @Description(shortDefinition = "Revenue or cost center code", formalDefinition = "The type of revenue or cost center providing the product and/or service.")
4432    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-revenue-center")
4433    protected CodeableConcept revenue;
4434
4435    /**
4436     * Code to identify the general type of benefits under which products and
4437     * services are provided.
4438     */
4439    @Child(name = "category", type = {
4440        CodeableConcept.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
4441    @Description(shortDefinition = "Benefit classification", formalDefinition = "Code to identify the general type of benefits under which products and services are provided.")
4442    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-benefitcategory")
4443    protected CodeableConcept category;
4444
4445    /**
4446     * When the value is a group code then this item collects a set of related claim
4447     * details, otherwise this contains the product, service, drug or other billing
4448     * code for the item.
4449     */
4450    @Child(name = "productOrService", type = {
4451        CodeableConcept.class }, order = 8, min = 1, max = 1, modifier = false, summary = false)
4452    @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.")
4453    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
4454    protected CodeableConcept productOrService;
4455
4456    /**
4457     * Item typification or modifiers codes to convey additional context for the
4458     * product or service.
4459     */
4460    @Child(name = "modifier", type = {
4461        CodeableConcept.class }, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4462    @Description(shortDefinition = "Product or service billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
4463    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
4464    protected List<CodeableConcept> modifier;
4465
4466    /**
4467     * Identifies the program under which this may be recovered.
4468     */
4469    @Child(name = "programCode", type = {
4470        CodeableConcept.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4471    @Description(shortDefinition = "Program the product or service is provided under", formalDefinition = "Identifies the program under which this may be recovered.")
4472    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-program-code")
4473    protected List<CodeableConcept> programCode;
4474
4475    /**
4476     * The date or dates when the service or product was supplied, performed or
4477     * completed.
4478     */
4479    @Child(name = "serviced", type = { DateType.class,
4480        Period.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
4481    @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.")
4482    protected Type serviced;
4483
4484    /**
4485     * Where the product or service was provided.
4486     */
4487    @Child(name = "location", type = { CodeableConcept.class, Address.class,
4488        Location.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
4489    @Description(shortDefinition = "Place of service or where product was supplied", formalDefinition = "Where the product or service was provided.")
4490    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-place")
4491    protected Type location;
4492
4493    /**
4494     * The number of repetitions of a service or product.
4495     */
4496    @Child(name = "quantity", type = {
4497        Quantity.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
4498    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
4499    protected Quantity quantity;
4500
4501    /**
4502     * If the item is not a group then this is the fee for the product or service,
4503     * otherwise this is the total of the fees for the details of the group.
4504     */
4505    @Child(name = "unitPrice", type = { Money.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
4506    @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.")
4507    protected Money unitPrice;
4508
4509    /**
4510     * A real number that represents a multiplier used in determining the overall
4511     * value of services delivered and/or goods received. The concept of a Factor
4512     * allows for a discount or surcharge multiplier to be applied to a monetary
4513     * amount.
4514     */
4515    @Child(name = "factor", type = {
4516        DecimalType.class }, order = 15, min = 0, max = 1, modifier = false, summary = false)
4517    @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.")
4518    protected DecimalType factor;
4519
4520    /**
4521     * The quantity times the unit price for an additional service or product or
4522     * charge.
4523     */
4524    @Child(name = "net", type = { Money.class }, order = 16, min = 0, max = 1, modifier = false, summary = false)
4525    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
4526    protected Money net;
4527
4528    /**
4529     * Unique Device Identifiers associated with this line item.
4530     */
4531    @Child(name = "udi", type = {
4532        Device.class }, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4533    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
4534    protected List<Reference> udi;
4535    /**
4536     * The actual objects that are the target of the reference (Unique Device
4537     * Identifiers associated with this line item.)
4538     */
4539    protected List<Device> udiTarget;
4540
4541    /**
4542     * Physical service site on the patient (limb, tooth, etc.).
4543     */
4544    @Child(name = "bodySite", type = {
4545        CodeableConcept.class }, order = 18, min = 0, max = 1, modifier = false, summary = false)
4546    @Description(shortDefinition = "Anatomical location", formalDefinition = "Physical service site on the patient (limb, tooth, etc.).")
4547    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/tooth")
4548    protected CodeableConcept bodySite;
4549
4550    /**
4551     * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
4552     */
4553    @Child(name = "subSite", type = {
4554        CodeableConcept.class }, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4555    @Description(shortDefinition = "Anatomical sub-location", formalDefinition = "A region or surface of the bodySite, e.g. limb region or tooth surface(s).")
4556    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/surface")
4557    protected List<CodeableConcept> subSite;
4558
4559    /**
4560     * The Encounters during which this Claim was created or to which the creation
4561     * of this record is tightly associated.
4562     */
4563    @Child(name = "encounter", type = {
4564        Encounter.class }, order = 20, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4565    @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.")
4566    protected List<Reference> encounter;
4567    /**
4568     * The actual objects that are the target of the reference (The Encounters
4569     * during which this Claim was created or to which the creation of this record
4570     * is tightly associated.)
4571     */
4572    protected List<Encounter> encounterTarget;
4573
4574    /**
4575     * A claim detail line. Either a simple (a product or service) or a 'group' of
4576     * sub-details which are simple items.
4577     */
4578    @Child(name = "detail", type = {}, order = 21, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4579    @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.")
4580    protected List<DetailComponent> detail;
4581
4582    private static final long serialVersionUID = -329028323L;
4583
4584    /**
4585     * Constructor
4586     */
4587    public ItemComponent() {
4588      super();
4589    }
4590
4591    /**
4592     * Constructor
4593     */
4594    public ItemComponent(PositiveIntType sequence, CodeableConcept productOrService) {
4595      super();
4596      this.sequence = sequence;
4597      this.productOrService = productOrService;
4598    }
4599
4600    /**
4601     * @return {@link #sequence} (A number to uniquely identify item entries.). This
4602     *         is the underlying object with id, value and extensions. The accessor
4603     *         "getSequence" gives direct access to the value
4604     */
4605    public PositiveIntType getSequenceElement() {
4606      if (this.sequence == null)
4607        if (Configuration.errorOnAutoCreate())
4608          throw new Error("Attempt to auto-create ItemComponent.sequence");
4609        else if (Configuration.doAutoCreate())
4610          this.sequence = new PositiveIntType(); // bb
4611      return this.sequence;
4612    }
4613
4614    public boolean hasSequenceElement() {
4615      return this.sequence != null && !this.sequence.isEmpty();
4616    }
4617
4618    public boolean hasSequence() {
4619      return this.sequence != null && !this.sequence.isEmpty();
4620    }
4621
4622    /**
4623     * @param value {@link #sequence} (A number to uniquely identify item entries.).
4624     *              This is the underlying object with id, value and extensions. The
4625     *              accessor "getSequence" gives direct access to the value
4626     */
4627    public ItemComponent setSequenceElement(PositiveIntType value) {
4628      this.sequence = value;
4629      return this;
4630    }
4631
4632    /**
4633     * @return A number to uniquely identify item entries.
4634     */
4635    public int getSequence() {
4636      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
4637    }
4638
4639    /**
4640     * @param value A number to uniquely identify item entries.
4641     */
4642    public ItemComponent setSequence(int value) {
4643      if (this.sequence == null)
4644        this.sequence = new PositiveIntType();
4645      this.sequence.setValue(value);
4646      return this;
4647    }
4648
4649    /**
4650     * @return {@link #careTeamSequence} (CareTeam members related to this service
4651     *         or product.)
4652     */
4653    public List<PositiveIntType> getCareTeamSequence() {
4654      if (this.careTeamSequence == null)
4655        this.careTeamSequence = new ArrayList<PositiveIntType>();
4656      return this.careTeamSequence;
4657    }
4658
4659    /**
4660     * @return Returns a reference to <code>this</code> for easy method chaining
4661     */
4662    public ItemComponent setCareTeamSequence(List<PositiveIntType> theCareTeamSequence) {
4663      this.careTeamSequence = theCareTeamSequence;
4664      return this;
4665    }
4666
4667    public boolean hasCareTeamSequence() {
4668      if (this.careTeamSequence == null)
4669        return false;
4670      for (PositiveIntType item : this.careTeamSequence)
4671        if (!item.isEmpty())
4672          return true;
4673      return false;
4674    }
4675
4676    /**
4677     * @return {@link #careTeamSequence} (CareTeam members related to this service
4678     *         or product.)
4679     */
4680    public PositiveIntType addCareTeamSequenceElement() {// 2
4681      PositiveIntType t = new PositiveIntType();
4682      if (this.careTeamSequence == null)
4683        this.careTeamSequence = new ArrayList<PositiveIntType>();
4684      this.careTeamSequence.add(t);
4685      return t;
4686    }
4687
4688    /**
4689     * @param value {@link #careTeamSequence} (CareTeam members related to this
4690     *              service or product.)
4691     */
4692    public ItemComponent addCareTeamSequence(int value) { // 1
4693      PositiveIntType t = new PositiveIntType();
4694      t.setValue(value);
4695      if (this.careTeamSequence == null)
4696        this.careTeamSequence = new ArrayList<PositiveIntType>();
4697      this.careTeamSequence.add(t);
4698      return this;
4699    }
4700
4701    /**
4702     * @param value {@link #careTeamSequence} (CareTeam members related to this
4703     *              service or product.)
4704     */
4705    public boolean hasCareTeamSequence(int value) {
4706      if (this.careTeamSequence == null)
4707        return false;
4708      for (PositiveIntType v : this.careTeamSequence)
4709        if (v.getValue().equals(value)) // positiveInt
4710          return true;
4711      return false;
4712    }
4713
4714    /**
4715     * @return {@link #diagnosisSequence} (Diagnosis applicable for this service or
4716     *         product.)
4717     */
4718    public List<PositiveIntType> getDiagnosisSequence() {
4719      if (this.diagnosisSequence == null)
4720        this.diagnosisSequence = new ArrayList<PositiveIntType>();
4721      return this.diagnosisSequence;
4722    }
4723
4724    /**
4725     * @return Returns a reference to <code>this</code> for easy method chaining
4726     */
4727    public ItemComponent setDiagnosisSequence(List<PositiveIntType> theDiagnosisSequence) {
4728      this.diagnosisSequence = theDiagnosisSequence;
4729      return this;
4730    }
4731
4732    public boolean hasDiagnosisSequence() {
4733      if (this.diagnosisSequence == null)
4734        return false;
4735      for (PositiveIntType item : this.diagnosisSequence)
4736        if (!item.isEmpty())
4737          return true;
4738      return false;
4739    }
4740
4741    /**
4742     * @return {@link #diagnosisSequence} (Diagnosis applicable for this service or
4743     *         product.)
4744     */
4745    public PositiveIntType addDiagnosisSequenceElement() {// 2
4746      PositiveIntType t = new PositiveIntType();
4747      if (this.diagnosisSequence == null)
4748        this.diagnosisSequence = new ArrayList<PositiveIntType>();
4749      this.diagnosisSequence.add(t);
4750      return t;
4751    }
4752
4753    /**
4754     * @param value {@link #diagnosisSequence} (Diagnosis applicable for this
4755     *              service or product.)
4756     */
4757    public ItemComponent addDiagnosisSequence(int value) { // 1
4758      PositiveIntType t = new PositiveIntType();
4759      t.setValue(value);
4760      if (this.diagnosisSequence == null)
4761        this.diagnosisSequence = new ArrayList<PositiveIntType>();
4762      this.diagnosisSequence.add(t);
4763      return this;
4764    }
4765
4766    /**
4767     * @param value {@link #diagnosisSequence} (Diagnosis applicable for this
4768     *              service or product.)
4769     */
4770    public boolean hasDiagnosisSequence(int value) {
4771      if (this.diagnosisSequence == null)
4772        return false;
4773      for (PositiveIntType v : this.diagnosisSequence)
4774        if (v.getValue().equals(value)) // positiveInt
4775          return true;
4776      return false;
4777    }
4778
4779    /**
4780     * @return {@link #procedureSequence} (Procedures applicable for this service or
4781     *         product.)
4782     */
4783    public List<PositiveIntType> getProcedureSequence() {
4784      if (this.procedureSequence == null)
4785        this.procedureSequence = new ArrayList<PositiveIntType>();
4786      return this.procedureSequence;
4787    }
4788
4789    /**
4790     * @return Returns a reference to <code>this</code> for easy method chaining
4791     */
4792    public ItemComponent setProcedureSequence(List<PositiveIntType> theProcedureSequence) {
4793      this.procedureSequence = theProcedureSequence;
4794      return this;
4795    }
4796
4797    public boolean hasProcedureSequence() {
4798      if (this.procedureSequence == null)
4799        return false;
4800      for (PositiveIntType item : this.procedureSequence)
4801        if (!item.isEmpty())
4802          return true;
4803      return false;
4804    }
4805
4806    /**
4807     * @return {@link #procedureSequence} (Procedures applicable for this service or
4808     *         product.)
4809     */
4810    public PositiveIntType addProcedureSequenceElement() {// 2
4811      PositiveIntType t = new PositiveIntType();
4812      if (this.procedureSequence == null)
4813        this.procedureSequence = new ArrayList<PositiveIntType>();
4814      this.procedureSequence.add(t);
4815      return t;
4816    }
4817
4818    /**
4819     * @param value {@link #procedureSequence} (Procedures applicable for this
4820     *              service or product.)
4821     */
4822    public ItemComponent addProcedureSequence(int value) { // 1
4823      PositiveIntType t = new PositiveIntType();
4824      t.setValue(value);
4825      if (this.procedureSequence == null)
4826        this.procedureSequence = new ArrayList<PositiveIntType>();
4827      this.procedureSequence.add(t);
4828      return this;
4829    }
4830
4831    /**
4832     * @param value {@link #procedureSequence} (Procedures applicable for this
4833     *              service or product.)
4834     */
4835    public boolean hasProcedureSequence(int value) {
4836      if (this.procedureSequence == null)
4837        return false;
4838      for (PositiveIntType v : this.procedureSequence)
4839        if (v.getValue().equals(value)) // positiveInt
4840          return true;
4841      return false;
4842    }
4843
4844    /**
4845     * @return {@link #informationSequence} (Exceptions, special conditions and
4846     *         supporting information applicable for this service or product.)
4847     */
4848    public List<PositiveIntType> getInformationSequence() {
4849      if (this.informationSequence == null)
4850        this.informationSequence = new ArrayList<PositiveIntType>();
4851      return this.informationSequence;
4852    }
4853
4854    /**
4855     * @return Returns a reference to <code>this</code> for easy method chaining
4856     */
4857    public ItemComponent setInformationSequence(List<PositiveIntType> theInformationSequence) {
4858      this.informationSequence = theInformationSequence;
4859      return this;
4860    }
4861
4862    public boolean hasInformationSequence() {
4863      if (this.informationSequence == null)
4864        return false;
4865      for (PositiveIntType item : this.informationSequence)
4866        if (!item.isEmpty())
4867          return true;
4868      return false;
4869    }
4870
4871    /**
4872     * @return {@link #informationSequence} (Exceptions, special conditions and
4873     *         supporting information applicable for this service or product.)
4874     */
4875    public PositiveIntType addInformationSequenceElement() {// 2
4876      PositiveIntType t = new PositiveIntType();
4877      if (this.informationSequence == null)
4878        this.informationSequence = new ArrayList<PositiveIntType>();
4879      this.informationSequence.add(t);
4880      return t;
4881    }
4882
4883    /**
4884     * @param value {@link #informationSequence} (Exceptions, special conditions and
4885     *              supporting information applicable for this service or product.)
4886     */
4887    public ItemComponent addInformationSequence(int value) { // 1
4888      PositiveIntType t = new PositiveIntType();
4889      t.setValue(value);
4890      if (this.informationSequence == null)
4891        this.informationSequence = new ArrayList<PositiveIntType>();
4892      this.informationSequence.add(t);
4893      return this;
4894    }
4895
4896    /**
4897     * @param value {@link #informationSequence} (Exceptions, special conditions and
4898     *              supporting information applicable for this service or product.)
4899     */
4900    public boolean hasInformationSequence(int value) {
4901      if (this.informationSequence == null)
4902        return false;
4903      for (PositiveIntType v : this.informationSequence)
4904        if (v.getValue().equals(value)) // positiveInt
4905          return true;
4906      return false;
4907    }
4908
4909    /**
4910     * @return {@link #revenue} (The type of revenue or cost center providing the
4911     *         product and/or service.)
4912     */
4913    public CodeableConcept getRevenue() {
4914      if (this.revenue == null)
4915        if (Configuration.errorOnAutoCreate())
4916          throw new Error("Attempt to auto-create ItemComponent.revenue");
4917        else if (Configuration.doAutoCreate())
4918          this.revenue = new CodeableConcept(); // cc
4919      return this.revenue;
4920    }
4921
4922    public boolean hasRevenue() {
4923      return this.revenue != null && !this.revenue.isEmpty();
4924    }
4925
4926    /**
4927     * @param value {@link #revenue} (The type of revenue or cost center providing
4928     *              the product and/or service.)
4929     */
4930    public ItemComponent setRevenue(CodeableConcept value) {
4931      this.revenue = value;
4932      return this;
4933    }
4934
4935    /**
4936     * @return {@link #category} (Code to identify the general type of benefits
4937     *         under which products and services are provided.)
4938     */
4939    public CodeableConcept getCategory() {
4940      if (this.category == null)
4941        if (Configuration.errorOnAutoCreate())
4942          throw new Error("Attempt to auto-create ItemComponent.category");
4943        else if (Configuration.doAutoCreate())
4944          this.category = new CodeableConcept(); // cc
4945      return this.category;
4946    }
4947
4948    public boolean hasCategory() {
4949      return this.category != null && !this.category.isEmpty();
4950    }
4951
4952    /**
4953     * @param value {@link #category} (Code to identify the general type of benefits
4954     *              under which products and services are provided.)
4955     */
4956    public ItemComponent setCategory(CodeableConcept value) {
4957      this.category = value;
4958      return this;
4959    }
4960
4961    /**
4962     * @return {@link #productOrService} (When the value is a group code then this
4963     *         item collects a set of related claim details, otherwise this contains
4964     *         the product, service, drug or other billing code for the item.)
4965     */
4966    public CodeableConcept getProductOrService() {
4967      if (this.productOrService == null)
4968        if (Configuration.errorOnAutoCreate())
4969          throw new Error("Attempt to auto-create ItemComponent.productOrService");
4970        else if (Configuration.doAutoCreate())
4971          this.productOrService = new CodeableConcept(); // cc
4972      return this.productOrService;
4973    }
4974
4975    public boolean hasProductOrService() {
4976      return this.productOrService != null && !this.productOrService.isEmpty();
4977    }
4978
4979    /**
4980     * @param value {@link #productOrService} (When the value is a group code then
4981     *              this item collects a set of related claim details, otherwise
4982     *              this contains the product, service, drug or other billing code
4983     *              for the item.)
4984     */
4985    public ItemComponent setProductOrService(CodeableConcept value) {
4986      this.productOrService = value;
4987      return this;
4988    }
4989
4990    /**
4991     * @return {@link #modifier} (Item typification or modifiers codes to convey
4992     *         additional context for the product or service.)
4993     */
4994    public List<CodeableConcept> getModifier() {
4995      if (this.modifier == null)
4996        this.modifier = new ArrayList<CodeableConcept>();
4997      return this.modifier;
4998    }
4999
5000    /**
5001     * @return Returns a reference to <code>this</code> for easy method chaining
5002     */
5003    public ItemComponent setModifier(List<CodeableConcept> theModifier) {
5004      this.modifier = theModifier;
5005      return this;
5006    }
5007
5008    public boolean hasModifier() {
5009      if (this.modifier == null)
5010        return false;
5011      for (CodeableConcept item : this.modifier)
5012        if (!item.isEmpty())
5013          return true;
5014      return false;
5015    }
5016
5017    public CodeableConcept addModifier() { // 3
5018      CodeableConcept t = new CodeableConcept();
5019      if (this.modifier == null)
5020        this.modifier = new ArrayList<CodeableConcept>();
5021      this.modifier.add(t);
5022      return t;
5023    }
5024
5025    public ItemComponent addModifier(CodeableConcept t) { // 3
5026      if (t == null)
5027        return this;
5028      if (this.modifier == null)
5029        this.modifier = new ArrayList<CodeableConcept>();
5030      this.modifier.add(t);
5031      return this;
5032    }
5033
5034    /**
5035     * @return The first repetition of repeating field {@link #modifier}, creating
5036     *         it if it does not already exist
5037     */
5038    public CodeableConcept getModifierFirstRep() {
5039      if (getModifier().isEmpty()) {
5040        addModifier();
5041      }
5042      return getModifier().get(0);
5043    }
5044
5045    /**
5046     * @return {@link #programCode} (Identifies the program under which this may be
5047     *         recovered.)
5048     */
5049    public List<CodeableConcept> getProgramCode() {
5050      if (this.programCode == null)
5051        this.programCode = new ArrayList<CodeableConcept>();
5052      return this.programCode;
5053    }
5054
5055    /**
5056     * @return Returns a reference to <code>this</code> for easy method chaining
5057     */
5058    public ItemComponent setProgramCode(List<CodeableConcept> theProgramCode) {
5059      this.programCode = theProgramCode;
5060      return this;
5061    }
5062
5063    public boolean hasProgramCode() {
5064      if (this.programCode == null)
5065        return false;
5066      for (CodeableConcept item : this.programCode)
5067        if (!item.isEmpty())
5068          return true;
5069      return false;
5070    }
5071
5072    public CodeableConcept addProgramCode() { // 3
5073      CodeableConcept t = new CodeableConcept();
5074      if (this.programCode == null)
5075        this.programCode = new ArrayList<CodeableConcept>();
5076      this.programCode.add(t);
5077      return t;
5078    }
5079
5080    public ItemComponent addProgramCode(CodeableConcept t) { // 3
5081      if (t == null)
5082        return this;
5083      if (this.programCode == null)
5084        this.programCode = new ArrayList<CodeableConcept>();
5085      this.programCode.add(t);
5086      return this;
5087    }
5088
5089    /**
5090     * @return The first repetition of repeating field {@link #programCode},
5091     *         creating it if it does not already exist
5092     */
5093    public CodeableConcept getProgramCodeFirstRep() {
5094      if (getProgramCode().isEmpty()) {
5095        addProgramCode();
5096      }
5097      return getProgramCode().get(0);
5098    }
5099
5100    /**
5101     * @return {@link #serviced} (The date or dates when the service or product was
5102     *         supplied, performed or completed.)
5103     */
5104    public Type getServiced() {
5105      return this.serviced;
5106    }
5107
5108    /**
5109     * @return {@link #serviced} (The date or dates when the service or product was
5110     *         supplied, performed or completed.)
5111     */
5112    public DateType getServicedDateType() throws FHIRException {
5113      if (this.serviced == null)
5114        this.serviced = new DateType();
5115      if (!(this.serviced instanceof DateType))
5116        throw new FHIRException("Type mismatch: the type DateType was expected, but "
5117            + this.serviced.getClass().getName() + " was encountered");
5118      return (DateType) this.serviced;
5119    }
5120
5121    public boolean hasServicedDateType() {
5122      return this.serviced instanceof DateType;
5123    }
5124
5125    /**
5126     * @return {@link #serviced} (The date or dates when the service or product was
5127     *         supplied, performed or completed.)
5128     */
5129    public Period getServicedPeriod() throws FHIRException {
5130      if (this.serviced == null)
5131        this.serviced = new Period();
5132      if (!(this.serviced instanceof Period))
5133        throw new FHIRException("Type mismatch: the type Period was expected, but " + this.serviced.getClass().getName()
5134            + " was encountered");
5135      return (Period) this.serviced;
5136    }
5137
5138    public boolean hasServicedPeriod() {
5139      return this.serviced instanceof Period;
5140    }
5141
5142    public boolean hasServiced() {
5143      return this.serviced != null && !this.serviced.isEmpty();
5144    }
5145
5146    /**
5147     * @param value {@link #serviced} (The date or dates when the service or product
5148     *              was supplied, performed or completed.)
5149     */
5150    public ItemComponent setServiced(Type value) {
5151      if (value != null && !(value instanceof DateType || value instanceof Period))
5152        throw new Error("Not the right type for Claim.item.serviced[x]: " + value.fhirType());
5153      this.serviced = value;
5154      return this;
5155    }
5156
5157    /**
5158     * @return {@link #location} (Where the product or service was provided.)
5159     */
5160    public Type getLocation() {
5161      return this.location;
5162    }
5163
5164    /**
5165     * @return {@link #location} (Where the product or service was provided.)
5166     */
5167    public CodeableConcept getLocationCodeableConcept() throws FHIRException {
5168      if (this.location == null)
5169        this.location = new CodeableConcept();
5170      if (!(this.location instanceof CodeableConcept))
5171        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
5172            + this.location.getClass().getName() + " was encountered");
5173      return (CodeableConcept) this.location;
5174    }
5175
5176    public boolean hasLocationCodeableConcept() {
5177      return this.location instanceof CodeableConcept;
5178    }
5179
5180    /**
5181     * @return {@link #location} (Where the product or service was provided.)
5182     */
5183    public Address getLocationAddress() throws FHIRException {
5184      if (this.location == null)
5185        this.location = new Address();
5186      if (!(this.location instanceof Address))
5187        throw new FHIRException("Type mismatch: the type Address was expected, but "
5188            + this.location.getClass().getName() + " was encountered");
5189      return (Address) this.location;
5190    }
5191
5192    public boolean hasLocationAddress() {
5193      return this.location instanceof Address;
5194    }
5195
5196    /**
5197     * @return {@link #location} (Where the product or service was provided.)
5198     */
5199    public Reference getLocationReference() throws FHIRException {
5200      if (this.location == null)
5201        this.location = new Reference();
5202      if (!(this.location instanceof Reference))
5203        throw new FHIRException("Type mismatch: the type Reference was expected, but "
5204            + this.location.getClass().getName() + " was encountered");
5205      return (Reference) this.location;
5206    }
5207
5208    public boolean hasLocationReference() {
5209      return this.location instanceof Reference;
5210    }
5211
5212    public boolean hasLocation() {
5213      return this.location != null && !this.location.isEmpty();
5214    }
5215
5216    /**
5217     * @param value {@link #location} (Where the product or service was provided.)
5218     */
5219    public ItemComponent setLocation(Type value) {
5220      if (value != null
5221          && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
5222        throw new Error("Not the right type for Claim.item.location[x]: " + value.fhirType());
5223      this.location = value;
5224      return this;
5225    }
5226
5227    /**
5228     * @return {@link #quantity} (The number of repetitions of a service or
5229     *         product.)
5230     */
5231    public Quantity getQuantity() {
5232      if (this.quantity == null)
5233        if (Configuration.errorOnAutoCreate())
5234          throw new Error("Attempt to auto-create ItemComponent.quantity");
5235        else if (Configuration.doAutoCreate())
5236          this.quantity = new Quantity(); // cc
5237      return this.quantity;
5238    }
5239
5240    public boolean hasQuantity() {
5241      return this.quantity != null && !this.quantity.isEmpty();
5242    }
5243
5244    /**
5245     * @param value {@link #quantity} (The number of repetitions of a service or
5246     *              product.)
5247     */
5248    public ItemComponent setQuantity(Quantity value) {
5249      this.quantity = value;
5250      return this;
5251    }
5252
5253    /**
5254     * @return {@link #unitPrice} (If the item is not a group then this is the fee
5255     *         for the product or service, otherwise this is the total of the fees
5256     *         for the details of the group.)
5257     */
5258    public Money getUnitPrice() {
5259      if (this.unitPrice == null)
5260        if (Configuration.errorOnAutoCreate())
5261          throw new Error("Attempt to auto-create ItemComponent.unitPrice");
5262        else if (Configuration.doAutoCreate())
5263          this.unitPrice = new Money(); // cc
5264      return this.unitPrice;
5265    }
5266
5267    public boolean hasUnitPrice() {
5268      return this.unitPrice != null && !this.unitPrice.isEmpty();
5269    }
5270
5271    /**
5272     * @param value {@link #unitPrice} (If the item is not a group then this is the
5273     *              fee for the product or service, otherwise this is the total of
5274     *              the fees for the details of the group.)
5275     */
5276    public ItemComponent setUnitPrice(Money value) {
5277      this.unitPrice = value;
5278      return this;
5279    }
5280
5281    /**
5282     * @return {@link #factor} (A real number that represents a multiplier used in
5283     *         determining the overall value of services delivered and/or goods
5284     *         received. The concept of a Factor allows for a discount or surcharge
5285     *         multiplier to be applied to a monetary amount.). This is the
5286     *         underlying object with id, value and extensions. The accessor
5287     *         "getFactor" gives direct access to the value
5288     */
5289    public DecimalType getFactorElement() {
5290      if (this.factor == null)
5291        if (Configuration.errorOnAutoCreate())
5292          throw new Error("Attempt to auto-create ItemComponent.factor");
5293        else if (Configuration.doAutoCreate())
5294          this.factor = new DecimalType(); // bb
5295      return this.factor;
5296    }
5297
5298    public boolean hasFactorElement() {
5299      return this.factor != null && !this.factor.isEmpty();
5300    }
5301
5302    public boolean hasFactor() {
5303      return this.factor != null && !this.factor.isEmpty();
5304    }
5305
5306    /**
5307     * @param value {@link #factor} (A real number that represents a multiplier used
5308     *              in determining the overall value of services delivered and/or
5309     *              goods received. The concept of a Factor allows for a discount or
5310     *              surcharge multiplier to be applied to a monetary amount.). This
5311     *              is the underlying object with id, value and extensions. The
5312     *              accessor "getFactor" gives direct access to the value
5313     */
5314    public ItemComponent setFactorElement(DecimalType value) {
5315      this.factor = value;
5316      return this;
5317    }
5318
5319    /**
5320     * @return A real number that represents a multiplier used in determining the
5321     *         overall value of services delivered and/or goods received. The
5322     *         concept of a Factor allows for a discount or surcharge multiplier to
5323     *         be applied to a monetary amount.
5324     */
5325    public BigDecimal getFactor() {
5326      return this.factor == null ? null : this.factor.getValue();
5327    }
5328
5329    /**
5330     * @param value A real number that represents a multiplier used in determining
5331     *              the overall value of services delivered and/or goods received.
5332     *              The concept of a Factor allows for a discount or surcharge
5333     *              multiplier to be applied to a monetary amount.
5334     */
5335    public ItemComponent setFactor(BigDecimal value) {
5336      if (value == null)
5337        this.factor = null;
5338      else {
5339        if (this.factor == null)
5340          this.factor = new DecimalType();
5341        this.factor.setValue(value);
5342      }
5343      return this;
5344    }
5345
5346    /**
5347     * @param value A real number that represents a multiplier used in determining
5348     *              the overall value of services delivered and/or goods received.
5349     *              The concept of a Factor allows for a discount or surcharge
5350     *              multiplier to be applied to a monetary amount.
5351     */
5352    public ItemComponent setFactor(long value) {
5353      this.factor = new DecimalType();
5354      this.factor.setValue(value);
5355      return this;
5356    }
5357
5358    /**
5359     * @param value A real number that represents a multiplier used in determining
5360     *              the overall value of services delivered and/or goods received.
5361     *              The concept of a Factor allows for a discount or surcharge
5362     *              multiplier to be applied to a monetary amount.
5363     */
5364    public ItemComponent setFactor(double value) {
5365      this.factor = new DecimalType();
5366      this.factor.setValue(value);
5367      return this;
5368    }
5369
5370    /**
5371     * @return {@link #net} (The quantity times the unit price for an additional
5372     *         service or product or charge.)
5373     */
5374    public Money getNet() {
5375      if (this.net == null)
5376        if (Configuration.errorOnAutoCreate())
5377          throw new Error("Attempt to auto-create ItemComponent.net");
5378        else if (Configuration.doAutoCreate())
5379          this.net = new Money(); // cc
5380      return this.net;
5381    }
5382
5383    public boolean hasNet() {
5384      return this.net != null && !this.net.isEmpty();
5385    }
5386
5387    /**
5388     * @param value {@link #net} (The quantity times the unit price for an
5389     *              additional service or product or charge.)
5390     */
5391    public ItemComponent setNet(Money value) {
5392      this.net = value;
5393      return this;
5394    }
5395
5396    /**
5397     * @return {@link #udi} (Unique Device Identifiers associated with this line
5398     *         item.)
5399     */
5400    public List<Reference> getUdi() {
5401      if (this.udi == null)
5402        this.udi = new ArrayList<Reference>();
5403      return this.udi;
5404    }
5405
5406    /**
5407     * @return Returns a reference to <code>this</code> for easy method chaining
5408     */
5409    public ItemComponent setUdi(List<Reference> theUdi) {
5410      this.udi = theUdi;
5411      return this;
5412    }
5413
5414    public boolean hasUdi() {
5415      if (this.udi == null)
5416        return false;
5417      for (Reference item : this.udi)
5418        if (!item.isEmpty())
5419          return true;
5420      return false;
5421    }
5422
5423    public Reference addUdi() { // 3
5424      Reference t = new Reference();
5425      if (this.udi == null)
5426        this.udi = new ArrayList<Reference>();
5427      this.udi.add(t);
5428      return t;
5429    }
5430
5431    public ItemComponent addUdi(Reference t) { // 3
5432      if (t == null)
5433        return this;
5434      if (this.udi == null)
5435        this.udi = new ArrayList<Reference>();
5436      this.udi.add(t);
5437      return this;
5438    }
5439
5440    /**
5441     * @return The first repetition of repeating field {@link #udi}, creating it if
5442     *         it does not already exist
5443     */
5444    public Reference getUdiFirstRep() {
5445      if (getUdi().isEmpty()) {
5446        addUdi();
5447      }
5448      return getUdi().get(0);
5449    }
5450
5451    /**
5452     * @return {@link #bodySite} (Physical service site on the patient (limb, tooth,
5453     *         etc.).)
5454     */
5455    public CodeableConcept getBodySite() {
5456      if (this.bodySite == null)
5457        if (Configuration.errorOnAutoCreate())
5458          throw new Error("Attempt to auto-create ItemComponent.bodySite");
5459        else if (Configuration.doAutoCreate())
5460          this.bodySite = new CodeableConcept(); // cc
5461      return this.bodySite;
5462    }
5463
5464    public boolean hasBodySite() {
5465      return this.bodySite != null && !this.bodySite.isEmpty();
5466    }
5467
5468    /**
5469     * @param value {@link #bodySite} (Physical service site on the patient (limb,
5470     *              tooth, etc.).)
5471     */
5472    public ItemComponent setBodySite(CodeableConcept value) {
5473      this.bodySite = value;
5474      return this;
5475    }
5476
5477    /**
5478     * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb
5479     *         region or tooth surface(s).)
5480     */
5481    public List<CodeableConcept> getSubSite() {
5482      if (this.subSite == null)
5483        this.subSite = new ArrayList<CodeableConcept>();
5484      return this.subSite;
5485    }
5486
5487    /**
5488     * @return Returns a reference to <code>this</code> for easy method chaining
5489     */
5490    public ItemComponent setSubSite(List<CodeableConcept> theSubSite) {
5491      this.subSite = theSubSite;
5492      return this;
5493    }
5494
5495    public boolean hasSubSite() {
5496      if (this.subSite == null)
5497        return false;
5498      for (CodeableConcept item : this.subSite)
5499        if (!item.isEmpty())
5500          return true;
5501      return false;
5502    }
5503
5504    public CodeableConcept addSubSite() { // 3
5505      CodeableConcept t = new CodeableConcept();
5506      if (this.subSite == null)
5507        this.subSite = new ArrayList<CodeableConcept>();
5508      this.subSite.add(t);
5509      return t;
5510    }
5511
5512    public ItemComponent addSubSite(CodeableConcept t) { // 3
5513      if (t == null)
5514        return this;
5515      if (this.subSite == null)
5516        this.subSite = new ArrayList<CodeableConcept>();
5517      this.subSite.add(t);
5518      return this;
5519    }
5520
5521    /**
5522     * @return The first repetition of repeating field {@link #subSite}, creating it
5523     *         if it does not already exist
5524     */
5525    public CodeableConcept getSubSiteFirstRep() {
5526      if (getSubSite().isEmpty()) {
5527        addSubSite();
5528      }
5529      return getSubSite().get(0);
5530    }
5531
5532    /**
5533     * @return {@link #encounter} (The Encounters during which this Claim was
5534     *         created or to which the creation of this record is tightly
5535     *         associated.)
5536     */
5537    public List<Reference> getEncounter() {
5538      if (this.encounter == null)
5539        this.encounter = new ArrayList<Reference>();
5540      return this.encounter;
5541    }
5542
5543    /**
5544     * @return Returns a reference to <code>this</code> for easy method chaining
5545     */
5546    public ItemComponent setEncounter(List<Reference> theEncounter) {
5547      this.encounter = theEncounter;
5548      return this;
5549    }
5550
5551    public boolean hasEncounter() {
5552      if (this.encounter == null)
5553        return false;
5554      for (Reference item : this.encounter)
5555        if (!item.isEmpty())
5556          return true;
5557      return false;
5558    }
5559
5560    public Reference addEncounter() { // 3
5561      Reference t = new Reference();
5562      if (this.encounter == null)
5563        this.encounter = new ArrayList<Reference>();
5564      this.encounter.add(t);
5565      return t;
5566    }
5567
5568    public ItemComponent addEncounter(Reference t) { // 3
5569      if (t == null)
5570        return this;
5571      if (this.encounter == null)
5572        this.encounter = new ArrayList<Reference>();
5573      this.encounter.add(t);
5574      return this;
5575    }
5576
5577    /**
5578     * @return The first repetition of repeating field {@link #encounter}, creating
5579     *         it if it does not already exist
5580     */
5581    public Reference getEncounterFirstRep() {
5582      if (getEncounter().isEmpty()) {
5583        addEncounter();
5584      }
5585      return getEncounter().get(0);
5586    }
5587
5588    /**
5589     * @return {@link #detail} (A claim detail line. Either a simple (a product or
5590     *         service) or a 'group' of sub-details which are simple items.)
5591     */
5592    public List<DetailComponent> getDetail() {
5593      if (this.detail == null)
5594        this.detail = new ArrayList<DetailComponent>();
5595      return this.detail;
5596    }
5597
5598    /**
5599     * @return Returns a reference to <code>this</code> for easy method chaining
5600     */
5601    public ItemComponent setDetail(List<DetailComponent> theDetail) {
5602      this.detail = theDetail;
5603      return this;
5604    }
5605
5606    public boolean hasDetail() {
5607      if (this.detail == null)
5608        return false;
5609      for (DetailComponent item : this.detail)
5610        if (!item.isEmpty())
5611          return true;
5612      return false;
5613    }
5614
5615    public DetailComponent addDetail() { // 3
5616      DetailComponent t = new DetailComponent();
5617      if (this.detail == null)
5618        this.detail = new ArrayList<DetailComponent>();
5619      this.detail.add(t);
5620      return t;
5621    }
5622
5623    public ItemComponent addDetail(DetailComponent t) { // 3
5624      if (t == null)
5625        return this;
5626      if (this.detail == null)
5627        this.detail = new ArrayList<DetailComponent>();
5628      this.detail.add(t);
5629      return this;
5630    }
5631
5632    /**
5633     * @return The first repetition of repeating field {@link #detail}, creating it
5634     *         if it does not already exist
5635     */
5636    public DetailComponent getDetailFirstRep() {
5637      if (getDetail().isEmpty()) {
5638        addDetail();
5639      }
5640      return getDetail().get(0);
5641    }
5642
5643    protected void listChildren(List<Property> children) {
5644      super.listChildren(children);
5645      children
5646          .add(new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence));
5647      children.add(new Property("careTeamSequence", "positiveInt",
5648          "CareTeam members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence));
5649      children.add(new Property("diagnosisSequence", "positiveInt", "Diagnosis applicable for this service or product.",
5650          0, java.lang.Integer.MAX_VALUE, diagnosisSequence));
5651      children.add(new Property("procedureSequence", "positiveInt",
5652          "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence));
5653      children.add(new Property("informationSequence", "positiveInt",
5654          "Exceptions, special conditions and supporting information applicable for this service or product.", 0,
5655          java.lang.Integer.MAX_VALUE, informationSequence));
5656      children.add(new Property("revenue", "CodeableConcept",
5657          "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
5658      children.add(new Property("category", "CodeableConcept",
5659          "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
5660          category));
5661      children.add(new Property("productOrService", "CodeableConcept",
5662          "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.",
5663          0, 1, productOrService));
5664      children.add(new Property("modifier", "CodeableConcept",
5665          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
5666          java.lang.Integer.MAX_VALUE, modifier));
5667      children.add(new Property("programCode", "CodeableConcept",
5668          "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
5669      children.add(new Property("serviced[x]", "date|Period",
5670          "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced));
5671      children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5672          "Where the product or service was provided.", 0, 1, location));
5673      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
5674          1, quantity));
5675      children.add(new Property("unitPrice", "Money",
5676          "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.",
5677          0, 1, unitPrice));
5678      children.add(new Property("factor", "decimal",
5679          "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.",
5680          0, 1, factor));
5681      children.add(new Property("net", "Money",
5682          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
5683      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
5684          0, java.lang.Integer.MAX_VALUE, udi));
5685      children.add(new Property("bodySite", "CodeableConcept",
5686          "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
5687      children.add(new Property("subSite", "CodeableConcept",
5688          "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE,
5689          subSite));
5690      children.add(new Property("encounter", "Reference(Encounter)",
5691          "The Encounters during which this Claim was created or to which the creation of this record is tightly associated.",
5692          0, java.lang.Integer.MAX_VALUE, encounter));
5693      children.add(new Property("detail", "",
5694          "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
5695          0, java.lang.Integer.MAX_VALUE, detail));
5696    }
5697
5698    @Override
5699    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5700      switch (_hash) {
5701      case 1349547969:
5702        /* sequence */ return new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0,
5703            1, sequence);
5704      case 1070083823:
5705        /* careTeamSequence */ return new Property("careTeamSequence", "positiveInt",
5706            "CareTeam members related to this service or product.", 0, java.lang.Integer.MAX_VALUE, careTeamSequence);
5707      case -909769262:
5708        /* diagnosisSequence */ return new Property("diagnosisSequence", "positiveInt",
5709            "Diagnosis applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, diagnosisSequence);
5710      case -808920140:
5711        /* procedureSequence */ return new Property("procedureSequence", "positiveInt",
5712            "Procedures applicable for this service or product.", 0, java.lang.Integer.MAX_VALUE, procedureSequence);
5713      case -702585587:
5714        /* informationSequence */ return new Property("informationSequence", "positiveInt",
5715            "Exceptions, special conditions and supporting information applicable for this service or product.", 0,
5716            java.lang.Integer.MAX_VALUE, informationSequence);
5717      case 1099842588:
5718        /* revenue */ return new Property("revenue", "CodeableConcept",
5719            "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
5720      case 50511102:
5721        /* category */ return new Property("category", "CodeableConcept",
5722            "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
5723            category);
5724      case 1957227299:
5725        /* productOrService */ return new Property("productOrService", "CodeableConcept",
5726            "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.",
5727            0, 1, productOrService);
5728      case -615513385:
5729        /* modifier */ return new Property("modifier", "CodeableConcept",
5730            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
5731            java.lang.Integer.MAX_VALUE, modifier);
5732      case 1010065041:
5733        /* programCode */ return new Property("programCode", "CodeableConcept",
5734            "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
5735      case -1927922223:
5736        /* serviced[x] */ return new Property("serviced[x]", "date|Period",
5737            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5738      case 1379209295:
5739        /* serviced */ return new Property("serviced[x]", "date|Period",
5740            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5741      case 363246749:
5742        /* servicedDate */ return new Property("serviced[x]", "date|Period",
5743            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5744      case 1534966512:
5745        /* servicedPeriod */ return new Property("serviced[x]", "date|Period",
5746            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
5747      case 552316075:
5748        /* location[x] */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5749            "Where the product or service was provided.", 0, 1, location);
5750      case 1901043637:
5751        /* location */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5752            "Where the product or service was provided.", 0, 1, location);
5753      case -1224800468:
5754        /* locationCodeableConcept */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5755            "Where the product or service was provided.", 0, 1, location);
5756      case -1280020865:
5757        /* locationAddress */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5758            "Where the product or service was provided.", 0, 1, location);
5759      case 755866390:
5760        /* locationReference */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
5761            "Where the product or service was provided.", 0, 1, location);
5762      case -1285004149:
5763        /* quantity */ return new Property("quantity", "SimpleQuantity",
5764            "The number of repetitions of a service or product.", 0, 1, quantity);
5765      case -486196699:
5766        /* unitPrice */ return new Property("unitPrice", "Money",
5767            "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.",
5768            0, 1, unitPrice);
5769      case -1282148017:
5770        /* factor */ return new Property("factor", "decimal",
5771            "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.",
5772            0, 1, factor);
5773      case 108957:
5774        /* net */ return new Property("net", "Money",
5775            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
5776      case 115642:
5777        /* udi */ return new Property("udi", "Reference(Device)",
5778            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
5779      case 1702620169:
5780        /* bodySite */ return new Property("bodySite", "CodeableConcept",
5781            "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
5782      case -1868566105:
5783        /* subSite */ return new Property("subSite", "CodeableConcept",
5784            "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0,
5785            java.lang.Integer.MAX_VALUE, subSite);
5786      case 1524132147:
5787        /* encounter */ return new Property("encounter", "Reference(Encounter)",
5788            "The Encounters during which this Claim was created or to which the creation of this record is tightly associated.",
5789            0, java.lang.Integer.MAX_VALUE, encounter);
5790      case -1335224239:
5791        /* detail */ return new Property("detail", "",
5792            "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
5793            0, java.lang.Integer.MAX_VALUE, detail);
5794      default:
5795        return super.getNamedProperty(_hash, _name, _checkValid);
5796      }
5797
5798    }
5799
5800    @Override
5801    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5802      switch (hash) {
5803      case 1349547969:
5804        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
5805      case 1070083823:
5806        /* careTeamSequence */ return this.careTeamSequence == null ? new Base[0]
5807            : this.careTeamSequence.toArray(new Base[this.careTeamSequence.size()]); // PositiveIntType
5808      case -909769262:
5809        /* diagnosisSequence */ return this.diagnosisSequence == null ? new Base[0]
5810            : this.diagnosisSequence.toArray(new Base[this.diagnosisSequence.size()]); // PositiveIntType
5811      case -808920140:
5812        /* procedureSequence */ return this.procedureSequence == null ? new Base[0]
5813            : this.procedureSequence.toArray(new Base[this.procedureSequence.size()]); // PositiveIntType
5814      case -702585587:
5815        /* informationSequence */ return this.informationSequence == null ? new Base[0]
5816            : this.informationSequence.toArray(new Base[this.informationSequence.size()]); // PositiveIntType
5817      case 1099842588:
5818        /* revenue */ return this.revenue == null ? new Base[0] : new Base[] { this.revenue }; // CodeableConcept
5819      case 50511102:
5820        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
5821      case 1957227299:
5822        /* productOrService */ return this.productOrService == null ? new Base[0]
5823            : new Base[] { this.productOrService }; // CodeableConcept
5824      case -615513385:
5825        /* modifier */ return this.modifier == null ? new Base[0]
5826            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
5827      case 1010065041:
5828        /* programCode */ return this.programCode == null ? new Base[0]
5829            : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
5830      case 1379209295:
5831        /* serviced */ return this.serviced == null ? new Base[0] : new Base[] { this.serviced }; // Type
5832      case 1901043637:
5833        /* location */ return this.location == null ? new Base[0] : new Base[] { this.location }; // Type
5834      case -1285004149:
5835        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
5836      case -486196699:
5837        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
5838      case -1282148017:
5839        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
5840      case 108957:
5841        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
5842      case 115642:
5843        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
5844      case 1702620169:
5845        /* bodySite */ return this.bodySite == null ? new Base[0] : new Base[] { this.bodySite }; // CodeableConcept
5846      case -1868566105:
5847        /* subSite */ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
5848      case 1524132147:
5849        /* encounter */ return this.encounter == null ? new Base[0]
5850            : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
5851      case -1335224239:
5852        /* detail */ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // DetailComponent
5853      default:
5854        return super.getProperty(hash, name, checkValid);
5855      }
5856
5857    }
5858
5859    @Override
5860    public Base setProperty(int hash, String name, Base value) throws FHIRException {
5861      switch (hash) {
5862      case 1349547969: // sequence
5863        this.sequence = castToPositiveInt(value); // PositiveIntType
5864        return value;
5865      case 1070083823: // careTeamSequence
5866        this.getCareTeamSequence().add(castToPositiveInt(value)); // PositiveIntType
5867        return value;
5868      case -909769262: // diagnosisSequence
5869        this.getDiagnosisSequence().add(castToPositiveInt(value)); // PositiveIntType
5870        return value;
5871      case -808920140: // procedureSequence
5872        this.getProcedureSequence().add(castToPositiveInt(value)); // PositiveIntType
5873        return value;
5874      case -702585587: // informationSequence
5875        this.getInformationSequence().add(castToPositiveInt(value)); // PositiveIntType
5876        return value;
5877      case 1099842588: // revenue
5878        this.revenue = castToCodeableConcept(value); // CodeableConcept
5879        return value;
5880      case 50511102: // category
5881        this.category = castToCodeableConcept(value); // CodeableConcept
5882        return value;
5883      case 1957227299: // productOrService
5884        this.productOrService = castToCodeableConcept(value); // CodeableConcept
5885        return value;
5886      case -615513385: // modifier
5887        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
5888        return value;
5889      case 1010065041: // programCode
5890        this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
5891        return value;
5892      case 1379209295: // serviced
5893        this.serviced = castToType(value); // Type
5894        return value;
5895      case 1901043637: // location
5896        this.location = castToType(value); // Type
5897        return value;
5898      case -1285004149: // quantity
5899        this.quantity = castToQuantity(value); // Quantity
5900        return value;
5901      case -486196699: // unitPrice
5902        this.unitPrice = castToMoney(value); // Money
5903        return value;
5904      case -1282148017: // factor
5905        this.factor = castToDecimal(value); // DecimalType
5906        return value;
5907      case 108957: // net
5908        this.net = castToMoney(value); // Money
5909        return value;
5910      case 115642: // udi
5911        this.getUdi().add(castToReference(value)); // Reference
5912        return value;
5913      case 1702620169: // bodySite
5914        this.bodySite = castToCodeableConcept(value); // CodeableConcept
5915        return value;
5916      case -1868566105: // subSite
5917        this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
5918        return value;
5919      case 1524132147: // encounter
5920        this.getEncounter().add(castToReference(value)); // Reference
5921        return value;
5922      case -1335224239: // detail
5923        this.getDetail().add((DetailComponent) value); // DetailComponent
5924        return value;
5925      default:
5926        return super.setProperty(hash, name, value);
5927      }
5928
5929    }
5930
5931    @Override
5932    public Base setProperty(String name, Base value) throws FHIRException {
5933      if (name.equals("sequence")) {
5934        this.sequence = castToPositiveInt(value); // PositiveIntType
5935      } else if (name.equals("careTeamSequence")) {
5936        this.getCareTeamSequence().add(castToPositiveInt(value));
5937      } else if (name.equals("diagnosisSequence")) {
5938        this.getDiagnosisSequence().add(castToPositiveInt(value));
5939      } else if (name.equals("procedureSequence")) {
5940        this.getProcedureSequence().add(castToPositiveInt(value));
5941      } else if (name.equals("informationSequence")) {
5942        this.getInformationSequence().add(castToPositiveInt(value));
5943      } else if (name.equals("revenue")) {
5944        this.revenue = castToCodeableConcept(value); // CodeableConcept
5945      } else if (name.equals("category")) {
5946        this.category = castToCodeableConcept(value); // CodeableConcept
5947      } else if (name.equals("productOrService")) {
5948        this.productOrService = castToCodeableConcept(value); // CodeableConcept
5949      } else if (name.equals("modifier")) {
5950        this.getModifier().add(castToCodeableConcept(value));
5951      } else if (name.equals("programCode")) {
5952        this.getProgramCode().add(castToCodeableConcept(value));
5953      } else if (name.equals("serviced[x]")) {
5954        this.serviced = castToType(value); // Type
5955      } else if (name.equals("location[x]")) {
5956        this.location = castToType(value); // Type
5957      } else if (name.equals("quantity")) {
5958        this.quantity = castToQuantity(value); // Quantity
5959      } else if (name.equals("unitPrice")) {
5960        this.unitPrice = castToMoney(value); // Money
5961      } else if (name.equals("factor")) {
5962        this.factor = castToDecimal(value); // DecimalType
5963      } else if (name.equals("net")) {
5964        this.net = castToMoney(value); // Money
5965      } else if (name.equals("udi")) {
5966        this.getUdi().add(castToReference(value));
5967      } else if (name.equals("bodySite")) {
5968        this.bodySite = castToCodeableConcept(value); // CodeableConcept
5969      } else if (name.equals("subSite")) {
5970        this.getSubSite().add(castToCodeableConcept(value));
5971      } else if (name.equals("encounter")) {
5972        this.getEncounter().add(castToReference(value));
5973      } else if (name.equals("detail")) {
5974        this.getDetail().add((DetailComponent) value);
5975      } else
5976        return super.setProperty(name, value);
5977      return value;
5978    }
5979
5980  @Override
5981  public void removeChild(String name, Base value) throws FHIRException {
5982      if (name.equals("sequence")) {
5983        this.sequence = null;
5984      } else if (name.equals("careTeamSequence")) {
5985        this.getCareTeamSequence().remove(castToPositiveInt(value));
5986      } else if (name.equals("diagnosisSequence")) {
5987        this.getDiagnosisSequence().remove(castToPositiveInt(value));
5988      } else if (name.equals("procedureSequence")) {
5989        this.getProcedureSequence().remove(castToPositiveInt(value));
5990      } else if (name.equals("informationSequence")) {
5991        this.getInformationSequence().remove(castToPositiveInt(value));
5992      } else if (name.equals("revenue")) {
5993        this.revenue = null;
5994      } else if (name.equals("category")) {
5995        this.category = null;
5996      } else if (name.equals("productOrService")) {
5997        this.productOrService = null;
5998      } else if (name.equals("modifier")) {
5999        this.getModifier().remove(castToCodeableConcept(value));
6000      } else if (name.equals("programCode")) {
6001        this.getProgramCode().remove(castToCodeableConcept(value));
6002      } else if (name.equals("serviced[x]")) {
6003        this.serviced = null;
6004      } else if (name.equals("location[x]")) {
6005        this.location = null;
6006      } else if (name.equals("quantity")) {
6007        this.quantity = null;
6008      } else if (name.equals("unitPrice")) {
6009        this.unitPrice = null;
6010      } else if (name.equals("factor")) {
6011        this.factor = null;
6012      } else if (name.equals("net")) {
6013        this.net = null;
6014      } else if (name.equals("udi")) {
6015        this.getUdi().remove(castToReference(value));
6016      } else if (name.equals("bodySite")) {
6017        this.bodySite = null;
6018      } else if (name.equals("subSite")) {
6019        this.getSubSite().remove(castToCodeableConcept(value));
6020      } else if (name.equals("encounter")) {
6021        this.getEncounter().remove(castToReference(value));
6022      } else if (name.equals("detail")) {
6023        this.getDetail().remove((DetailComponent) value);
6024      } else
6025        super.removeChild(name, value);
6026      
6027    }
6028
6029    @Override
6030    public Base makeProperty(int hash, String name) throws FHIRException {
6031      switch (hash) {
6032      case 1349547969:
6033        return getSequenceElement();
6034      case 1070083823:
6035        return addCareTeamSequenceElement();
6036      case -909769262:
6037        return addDiagnosisSequenceElement();
6038      case -808920140:
6039        return addProcedureSequenceElement();
6040      case -702585587:
6041        return addInformationSequenceElement();
6042      case 1099842588:
6043        return getRevenue();
6044      case 50511102:
6045        return getCategory();
6046      case 1957227299:
6047        return getProductOrService();
6048      case -615513385:
6049        return addModifier();
6050      case 1010065041:
6051        return addProgramCode();
6052      case -1927922223:
6053        return getServiced();
6054      case 1379209295:
6055        return getServiced();
6056      case 552316075:
6057        return getLocation();
6058      case 1901043637:
6059        return getLocation();
6060      case -1285004149:
6061        return getQuantity();
6062      case -486196699:
6063        return getUnitPrice();
6064      case -1282148017:
6065        return getFactorElement();
6066      case 108957:
6067        return getNet();
6068      case 115642:
6069        return addUdi();
6070      case 1702620169:
6071        return getBodySite();
6072      case -1868566105:
6073        return addSubSite();
6074      case 1524132147:
6075        return addEncounter();
6076      case -1335224239:
6077        return addDetail();
6078      default:
6079        return super.makeProperty(hash, name);
6080      }
6081
6082    }
6083
6084    @Override
6085    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6086      switch (hash) {
6087      case 1349547969:
6088        /* sequence */ return new String[] { "positiveInt" };
6089      case 1070083823:
6090        /* careTeamSequence */ return new String[] { "positiveInt" };
6091      case -909769262:
6092        /* diagnosisSequence */ return new String[] { "positiveInt" };
6093      case -808920140:
6094        /* procedureSequence */ return new String[] { "positiveInt" };
6095      case -702585587:
6096        /* informationSequence */ return new String[] { "positiveInt" };
6097      case 1099842588:
6098        /* revenue */ return new String[] { "CodeableConcept" };
6099      case 50511102:
6100        /* category */ return new String[] { "CodeableConcept" };
6101      case 1957227299:
6102        /* productOrService */ return new String[] { "CodeableConcept" };
6103      case -615513385:
6104        /* modifier */ return new String[] { "CodeableConcept" };
6105      case 1010065041:
6106        /* programCode */ return new String[] { "CodeableConcept" };
6107      case 1379209295:
6108        /* serviced */ return new String[] { "date", "Period" };
6109      case 1901043637:
6110        /* location */ return new String[] { "CodeableConcept", "Address", "Reference" };
6111      case -1285004149:
6112        /* quantity */ return new String[] { "SimpleQuantity" };
6113      case -486196699:
6114        /* unitPrice */ return new String[] { "Money" };
6115      case -1282148017:
6116        /* factor */ return new String[] { "decimal" };
6117      case 108957:
6118        /* net */ return new String[] { "Money" };
6119      case 115642:
6120        /* udi */ return new String[] { "Reference" };
6121      case 1702620169:
6122        /* bodySite */ return new String[] { "CodeableConcept" };
6123      case -1868566105:
6124        /* subSite */ return new String[] { "CodeableConcept" };
6125      case 1524132147:
6126        /* encounter */ return new String[] { "Reference" };
6127      case -1335224239:
6128        /* detail */ return new String[] {};
6129      default:
6130        return super.getTypesForProperty(hash, name);
6131      }
6132
6133    }
6134
6135    @Override
6136    public Base addChild(String name) throws FHIRException {
6137      if (name.equals("sequence")) {
6138        throw new FHIRException("Cannot call addChild on a singleton property Claim.sequence");
6139      } else if (name.equals("careTeamSequence")) {
6140        throw new FHIRException("Cannot call addChild on a singleton property Claim.careTeamSequence");
6141      } else if (name.equals("diagnosisSequence")) {
6142        throw new FHIRException("Cannot call addChild on a singleton property Claim.diagnosisSequence");
6143      } else if (name.equals("procedureSequence")) {
6144        throw new FHIRException("Cannot call addChild on a singleton property Claim.procedureSequence");
6145      } else if (name.equals("informationSequence")) {
6146        throw new FHIRException("Cannot call addChild on a singleton property Claim.informationSequence");
6147      } else if (name.equals("revenue")) {
6148        this.revenue = new CodeableConcept();
6149        return this.revenue;
6150      } else if (name.equals("category")) {
6151        this.category = new CodeableConcept();
6152        return this.category;
6153      } else if (name.equals("productOrService")) {
6154        this.productOrService = new CodeableConcept();
6155        return this.productOrService;
6156      } else if (name.equals("modifier")) {
6157        return addModifier();
6158      } else if (name.equals("programCode")) {
6159        return addProgramCode();
6160      } else if (name.equals("servicedDate")) {
6161        this.serviced = new DateType();
6162        return this.serviced;
6163      } else if (name.equals("servicedPeriod")) {
6164        this.serviced = new Period();
6165        return this.serviced;
6166      } else if (name.equals("locationCodeableConcept")) {
6167        this.location = new CodeableConcept();
6168        return this.location;
6169      } else if (name.equals("locationAddress")) {
6170        this.location = new Address();
6171        return this.location;
6172      } else if (name.equals("locationReference")) {
6173        this.location = new Reference();
6174        return this.location;
6175      } else if (name.equals("quantity")) {
6176        this.quantity = new Quantity();
6177        return this.quantity;
6178      } else if (name.equals("unitPrice")) {
6179        this.unitPrice = new Money();
6180        return this.unitPrice;
6181      } else if (name.equals("factor")) {
6182        throw new FHIRException("Cannot call addChild on a singleton property Claim.factor");
6183      } else if (name.equals("net")) {
6184        this.net = new Money();
6185        return this.net;
6186      } else if (name.equals("udi")) {
6187        return addUdi();
6188      } else if (name.equals("bodySite")) {
6189        this.bodySite = new CodeableConcept();
6190        return this.bodySite;
6191      } else if (name.equals("subSite")) {
6192        return addSubSite();
6193      } else if (name.equals("encounter")) {
6194        return addEncounter();
6195      } else if (name.equals("detail")) {
6196        return addDetail();
6197      } else
6198        return super.addChild(name);
6199    }
6200
6201    public ItemComponent copy() {
6202      ItemComponent dst = new ItemComponent();
6203      copyValues(dst);
6204      return dst;
6205    }
6206
6207    public void copyValues(ItemComponent dst) {
6208      super.copyValues(dst);
6209      dst.sequence = sequence == null ? null : sequence.copy();
6210      if (careTeamSequence != null) {
6211        dst.careTeamSequence = new ArrayList<PositiveIntType>();
6212        for (PositiveIntType i : careTeamSequence)
6213          dst.careTeamSequence.add(i.copy());
6214      }
6215      ;
6216      if (diagnosisSequence != null) {
6217        dst.diagnosisSequence = new ArrayList<PositiveIntType>();
6218        for (PositiveIntType i : diagnosisSequence)
6219          dst.diagnosisSequence.add(i.copy());
6220      }
6221      ;
6222      if (procedureSequence != null) {
6223        dst.procedureSequence = new ArrayList<PositiveIntType>();
6224        for (PositiveIntType i : procedureSequence)
6225          dst.procedureSequence.add(i.copy());
6226      }
6227      ;
6228      if (informationSequence != null) {
6229        dst.informationSequence = new ArrayList<PositiveIntType>();
6230        for (PositiveIntType i : informationSequence)
6231          dst.informationSequence.add(i.copy());
6232      }
6233      ;
6234      dst.revenue = revenue == null ? null : revenue.copy();
6235      dst.category = category == null ? null : category.copy();
6236      dst.productOrService = productOrService == null ? null : productOrService.copy();
6237      if (modifier != null) {
6238        dst.modifier = new ArrayList<CodeableConcept>();
6239        for (CodeableConcept i : modifier)
6240          dst.modifier.add(i.copy());
6241      }
6242      ;
6243      if (programCode != null) {
6244        dst.programCode = new ArrayList<CodeableConcept>();
6245        for (CodeableConcept i : programCode)
6246          dst.programCode.add(i.copy());
6247      }
6248      ;
6249      dst.serviced = serviced == null ? null : serviced.copy();
6250      dst.location = location == null ? null : location.copy();
6251      dst.quantity = quantity == null ? null : quantity.copy();
6252      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
6253      dst.factor = factor == null ? null : factor.copy();
6254      dst.net = net == null ? null : net.copy();
6255      if (udi != null) {
6256        dst.udi = new ArrayList<Reference>();
6257        for (Reference i : udi)
6258          dst.udi.add(i.copy());
6259      }
6260      ;
6261      dst.bodySite = bodySite == null ? null : bodySite.copy();
6262      if (subSite != null) {
6263        dst.subSite = new ArrayList<CodeableConcept>();
6264        for (CodeableConcept i : subSite)
6265          dst.subSite.add(i.copy());
6266      }
6267      ;
6268      if (encounter != null) {
6269        dst.encounter = new ArrayList<Reference>();
6270        for (Reference i : encounter)
6271          dst.encounter.add(i.copy());
6272      }
6273      ;
6274      if (detail != null) {
6275        dst.detail = new ArrayList<DetailComponent>();
6276        for (DetailComponent i : detail)
6277          dst.detail.add(i.copy());
6278      }
6279      ;
6280    }
6281
6282    @Override
6283    public boolean equalsDeep(Base other_) {
6284      if (!super.equalsDeep(other_))
6285        return false;
6286      if (!(other_ instanceof ItemComponent))
6287        return false;
6288      ItemComponent o = (ItemComponent) other_;
6289      return compareDeep(sequence, o.sequence, true) && compareDeep(careTeamSequence, o.careTeamSequence, true)
6290          && compareDeep(diagnosisSequence, o.diagnosisSequence, true)
6291          && compareDeep(procedureSequence, o.procedureSequence, true)
6292          && compareDeep(informationSequence, o.informationSequence, true) && compareDeep(revenue, o.revenue, true)
6293          && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
6294          && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
6295          && compareDeep(serviced, o.serviced, true) && compareDeep(location, o.location, true)
6296          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
6297          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
6298          && compareDeep(bodySite, o.bodySite, true) && compareDeep(subSite, o.subSite, true)
6299          && compareDeep(encounter, o.encounter, true) && compareDeep(detail, o.detail, true);
6300    }
6301
6302    @Override
6303    public boolean equalsShallow(Base other_) {
6304      if (!super.equalsShallow(other_))
6305        return false;
6306      if (!(other_ instanceof ItemComponent))
6307        return false;
6308      ItemComponent o = (ItemComponent) other_;
6309      return compareValues(sequence, o.sequence, true) && compareValues(careTeamSequence, o.careTeamSequence, true)
6310          && compareValues(diagnosisSequence, o.diagnosisSequence, true)
6311          && compareValues(procedureSequence, o.procedureSequence, true)
6312          && compareValues(informationSequence, o.informationSequence, true) && compareValues(factor, o.factor, true);
6313    }
6314
6315    public boolean isEmpty() {
6316      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, careTeamSequence, diagnosisSequence,
6317          procedureSequence, informationSequence, revenue, category, productOrService, modifier, programCode, serviced,
6318          location, quantity, unitPrice, factor, net, udi, bodySite, subSite, encounter, detail);
6319    }
6320
6321    public String fhirType() {
6322      return "Claim.item";
6323
6324    }
6325
6326  }
6327
6328  @Block()
6329  public static class DetailComponent extends BackboneElement implements IBaseBackboneElement {
6330    /**
6331     * A number to uniquely identify item entries.
6332     */
6333    @Child(name = "sequence", type = {
6334        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
6335    @Description(shortDefinition = "Item instance identifier", formalDefinition = "A number to uniquely identify item entries.")
6336    protected PositiveIntType sequence;
6337
6338    /**
6339     * The type of revenue or cost center providing the product and/or service.
6340     */
6341    @Child(name = "revenue", type = {
6342        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
6343    @Description(shortDefinition = "Revenue or cost center code", formalDefinition = "The type of revenue or cost center providing the product and/or service.")
6344    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-revenue-center")
6345    protected CodeableConcept revenue;
6346
6347    /**
6348     * Code to identify the general type of benefits under which products and
6349     * services are provided.
6350     */
6351    @Child(name = "category", type = {
6352        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
6353    @Description(shortDefinition = "Benefit classification", formalDefinition = "Code to identify the general type of benefits under which products and services are provided.")
6354    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-benefitcategory")
6355    protected CodeableConcept category;
6356
6357    /**
6358     * When the value is a group code then this item collects a set of related claim
6359     * details, otherwise this contains the product, service, drug or other billing
6360     * code for the item.
6361     */
6362    @Child(name = "productOrService", type = {
6363        CodeableConcept.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
6364    @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.")
6365    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
6366    protected CodeableConcept productOrService;
6367
6368    /**
6369     * Item typification or modifiers codes to convey additional context for the
6370     * product or service.
6371     */
6372    @Child(name = "modifier", type = {
6373        CodeableConcept.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6374    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
6375    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
6376    protected List<CodeableConcept> modifier;
6377
6378    /**
6379     * Identifies the program under which this may be recovered.
6380     */
6381    @Child(name = "programCode", type = {
6382        CodeableConcept.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6383    @Description(shortDefinition = "Program the product or service is provided under", formalDefinition = "Identifies the program under which this may be recovered.")
6384    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-program-code")
6385    protected List<CodeableConcept> programCode;
6386
6387    /**
6388     * The number of repetitions of a service or product.
6389     */
6390    @Child(name = "quantity", type = { Quantity.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
6391    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
6392    protected Quantity quantity;
6393
6394    /**
6395     * If the item is not a group then this is the fee for the product or service,
6396     * otherwise this is the total of the fees for the details of the group.
6397     */
6398    @Child(name = "unitPrice", type = { Money.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
6399    @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.")
6400    protected Money unitPrice;
6401
6402    /**
6403     * A real number that represents a multiplier used in determining the overall
6404     * value of services delivered and/or goods received. The concept of a Factor
6405     * allows for a discount or surcharge multiplier to be applied to a monetary
6406     * amount.
6407     */
6408    @Child(name = "factor", type = {
6409        DecimalType.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
6410    @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.")
6411    protected DecimalType factor;
6412
6413    /**
6414     * The quantity times the unit price for an additional service or product or
6415     * charge.
6416     */
6417    @Child(name = "net", type = { Money.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
6418    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
6419    protected Money net;
6420
6421    /**
6422     * Unique Device Identifiers associated with this line item.
6423     */
6424    @Child(name = "udi", type = {
6425        Device.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6426    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
6427    protected List<Reference> udi;
6428    /**
6429     * The actual objects that are the target of the reference (Unique Device
6430     * Identifiers associated with this line item.)
6431     */
6432    protected List<Device> udiTarget;
6433
6434    /**
6435     * A claim detail line. Either a simple (a product or service) or a 'group' of
6436     * sub-details which are simple items.
6437     */
6438    @Child(name = "subDetail", type = {}, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
6439    @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.")
6440    protected List<SubDetailComponent> subDetail;
6441
6442    private static final long serialVersionUID = -1245004924L;
6443
6444    /**
6445     * Constructor
6446     */
6447    public DetailComponent() {
6448      super();
6449    }
6450
6451    /**
6452     * Constructor
6453     */
6454    public DetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
6455      super();
6456      this.sequence = sequence;
6457      this.productOrService = productOrService;
6458    }
6459
6460    /**
6461     * @return {@link #sequence} (A number to uniquely identify item entries.). This
6462     *         is the underlying object with id, value and extensions. The accessor
6463     *         "getSequence" gives direct access to the value
6464     */
6465    public PositiveIntType getSequenceElement() {
6466      if (this.sequence == null)
6467        if (Configuration.errorOnAutoCreate())
6468          throw new Error("Attempt to auto-create DetailComponent.sequence");
6469        else if (Configuration.doAutoCreate())
6470          this.sequence = new PositiveIntType(); // bb
6471      return this.sequence;
6472    }
6473
6474    public boolean hasSequenceElement() {
6475      return this.sequence != null && !this.sequence.isEmpty();
6476    }
6477
6478    public boolean hasSequence() {
6479      return this.sequence != null && !this.sequence.isEmpty();
6480    }
6481
6482    /**
6483     * @param value {@link #sequence} (A number to uniquely identify item entries.).
6484     *              This is the underlying object with id, value and extensions. The
6485     *              accessor "getSequence" gives direct access to the value
6486     */
6487    public DetailComponent setSequenceElement(PositiveIntType value) {
6488      this.sequence = value;
6489      return this;
6490    }
6491
6492    /**
6493     * @return A number to uniquely identify item entries.
6494     */
6495    public int getSequence() {
6496      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
6497    }
6498
6499    /**
6500     * @param value A number to uniquely identify item entries.
6501     */
6502    public DetailComponent setSequence(int value) {
6503      if (this.sequence == null)
6504        this.sequence = new PositiveIntType();
6505      this.sequence.setValue(value);
6506      return this;
6507    }
6508
6509    /**
6510     * @return {@link #revenue} (The type of revenue or cost center providing the
6511     *         product and/or service.)
6512     */
6513    public CodeableConcept getRevenue() {
6514      if (this.revenue == null)
6515        if (Configuration.errorOnAutoCreate())
6516          throw new Error("Attempt to auto-create DetailComponent.revenue");
6517        else if (Configuration.doAutoCreate())
6518          this.revenue = new CodeableConcept(); // cc
6519      return this.revenue;
6520    }
6521
6522    public boolean hasRevenue() {
6523      return this.revenue != null && !this.revenue.isEmpty();
6524    }
6525
6526    /**
6527     * @param value {@link #revenue} (The type of revenue or cost center providing
6528     *              the product and/or service.)
6529     */
6530    public DetailComponent setRevenue(CodeableConcept value) {
6531      this.revenue = value;
6532      return this;
6533    }
6534
6535    /**
6536     * @return {@link #category} (Code to identify the general type of benefits
6537     *         under which products and services are provided.)
6538     */
6539    public CodeableConcept getCategory() {
6540      if (this.category == null)
6541        if (Configuration.errorOnAutoCreate())
6542          throw new Error("Attempt to auto-create DetailComponent.category");
6543        else if (Configuration.doAutoCreate())
6544          this.category = new CodeableConcept(); // cc
6545      return this.category;
6546    }
6547
6548    public boolean hasCategory() {
6549      return this.category != null && !this.category.isEmpty();
6550    }
6551
6552    /**
6553     * @param value {@link #category} (Code to identify the general type of benefits
6554     *              under which products and services are provided.)
6555     */
6556    public DetailComponent setCategory(CodeableConcept value) {
6557      this.category = value;
6558      return this;
6559    }
6560
6561    /**
6562     * @return {@link #productOrService} (When the value is a group code then this
6563     *         item collects a set of related claim details, otherwise this contains
6564     *         the product, service, drug or other billing code for the item.)
6565     */
6566    public CodeableConcept getProductOrService() {
6567      if (this.productOrService == null)
6568        if (Configuration.errorOnAutoCreate())
6569          throw new Error("Attempt to auto-create DetailComponent.productOrService");
6570        else if (Configuration.doAutoCreate())
6571          this.productOrService = new CodeableConcept(); // cc
6572      return this.productOrService;
6573    }
6574
6575    public boolean hasProductOrService() {
6576      return this.productOrService != null && !this.productOrService.isEmpty();
6577    }
6578
6579    /**
6580     * @param value {@link #productOrService} (When the value is a group code then
6581     *              this item collects a set of related claim details, otherwise
6582     *              this contains the product, service, drug or other billing code
6583     *              for the item.)
6584     */
6585    public DetailComponent setProductOrService(CodeableConcept value) {
6586      this.productOrService = value;
6587      return this;
6588    }
6589
6590    /**
6591     * @return {@link #modifier} (Item typification or modifiers codes to convey
6592     *         additional context for the product or service.)
6593     */
6594    public List<CodeableConcept> getModifier() {
6595      if (this.modifier == null)
6596        this.modifier = new ArrayList<CodeableConcept>();
6597      return this.modifier;
6598    }
6599
6600    /**
6601     * @return Returns a reference to <code>this</code> for easy method chaining
6602     */
6603    public DetailComponent setModifier(List<CodeableConcept> theModifier) {
6604      this.modifier = theModifier;
6605      return this;
6606    }
6607
6608    public boolean hasModifier() {
6609      if (this.modifier == null)
6610        return false;
6611      for (CodeableConcept item : this.modifier)
6612        if (!item.isEmpty())
6613          return true;
6614      return false;
6615    }
6616
6617    public CodeableConcept addModifier() { // 3
6618      CodeableConcept t = new CodeableConcept();
6619      if (this.modifier == null)
6620        this.modifier = new ArrayList<CodeableConcept>();
6621      this.modifier.add(t);
6622      return t;
6623    }
6624
6625    public DetailComponent addModifier(CodeableConcept t) { // 3
6626      if (t == null)
6627        return this;
6628      if (this.modifier == null)
6629        this.modifier = new ArrayList<CodeableConcept>();
6630      this.modifier.add(t);
6631      return this;
6632    }
6633
6634    /**
6635     * @return The first repetition of repeating field {@link #modifier}, creating
6636     *         it if it does not already exist
6637     */
6638    public CodeableConcept getModifierFirstRep() {
6639      if (getModifier().isEmpty()) {
6640        addModifier();
6641      }
6642      return getModifier().get(0);
6643    }
6644
6645    /**
6646     * @return {@link #programCode} (Identifies the program under which this may be
6647     *         recovered.)
6648     */
6649    public List<CodeableConcept> getProgramCode() {
6650      if (this.programCode == null)
6651        this.programCode = new ArrayList<CodeableConcept>();
6652      return this.programCode;
6653    }
6654
6655    /**
6656     * @return Returns a reference to <code>this</code> for easy method chaining
6657     */
6658    public DetailComponent setProgramCode(List<CodeableConcept> theProgramCode) {
6659      this.programCode = theProgramCode;
6660      return this;
6661    }
6662
6663    public boolean hasProgramCode() {
6664      if (this.programCode == null)
6665        return false;
6666      for (CodeableConcept item : this.programCode)
6667        if (!item.isEmpty())
6668          return true;
6669      return false;
6670    }
6671
6672    public CodeableConcept addProgramCode() { // 3
6673      CodeableConcept t = new CodeableConcept();
6674      if (this.programCode == null)
6675        this.programCode = new ArrayList<CodeableConcept>();
6676      this.programCode.add(t);
6677      return t;
6678    }
6679
6680    public DetailComponent addProgramCode(CodeableConcept t) { // 3
6681      if (t == null)
6682        return this;
6683      if (this.programCode == null)
6684        this.programCode = new ArrayList<CodeableConcept>();
6685      this.programCode.add(t);
6686      return this;
6687    }
6688
6689    /**
6690     * @return The first repetition of repeating field {@link #programCode},
6691     *         creating it if it does not already exist
6692     */
6693    public CodeableConcept getProgramCodeFirstRep() {
6694      if (getProgramCode().isEmpty()) {
6695        addProgramCode();
6696      }
6697      return getProgramCode().get(0);
6698    }
6699
6700    /**
6701     * @return {@link #quantity} (The number of repetitions of a service or
6702     *         product.)
6703     */
6704    public Quantity getQuantity() {
6705      if (this.quantity == null)
6706        if (Configuration.errorOnAutoCreate())
6707          throw new Error("Attempt to auto-create DetailComponent.quantity");
6708        else if (Configuration.doAutoCreate())
6709          this.quantity = new Quantity(); // cc
6710      return this.quantity;
6711    }
6712
6713    public boolean hasQuantity() {
6714      return this.quantity != null && !this.quantity.isEmpty();
6715    }
6716
6717    /**
6718     * @param value {@link #quantity} (The number of repetitions of a service or
6719     *              product.)
6720     */
6721    public DetailComponent setQuantity(Quantity value) {
6722      this.quantity = value;
6723      return this;
6724    }
6725
6726    /**
6727     * @return {@link #unitPrice} (If the item is not a group then this is the fee
6728     *         for the product or service, otherwise this is the total of the fees
6729     *         for the details of the group.)
6730     */
6731    public Money getUnitPrice() {
6732      if (this.unitPrice == null)
6733        if (Configuration.errorOnAutoCreate())
6734          throw new Error("Attempt to auto-create DetailComponent.unitPrice");
6735        else if (Configuration.doAutoCreate())
6736          this.unitPrice = new Money(); // cc
6737      return this.unitPrice;
6738    }
6739
6740    public boolean hasUnitPrice() {
6741      return this.unitPrice != null && !this.unitPrice.isEmpty();
6742    }
6743
6744    /**
6745     * @param value {@link #unitPrice} (If the item is not a group then this is the
6746     *              fee for the product or service, otherwise this is the total of
6747     *              the fees for the details of the group.)
6748     */
6749    public DetailComponent setUnitPrice(Money value) {
6750      this.unitPrice = value;
6751      return this;
6752    }
6753
6754    /**
6755     * @return {@link #factor} (A real number that represents a multiplier used in
6756     *         determining the overall value of services delivered and/or goods
6757     *         received. The concept of a Factor allows for a discount or surcharge
6758     *         multiplier to be applied to a monetary amount.). This is the
6759     *         underlying object with id, value and extensions. The accessor
6760     *         "getFactor" gives direct access to the value
6761     */
6762    public DecimalType getFactorElement() {
6763      if (this.factor == null)
6764        if (Configuration.errorOnAutoCreate())
6765          throw new Error("Attempt to auto-create DetailComponent.factor");
6766        else if (Configuration.doAutoCreate())
6767          this.factor = new DecimalType(); // bb
6768      return this.factor;
6769    }
6770
6771    public boolean hasFactorElement() {
6772      return this.factor != null && !this.factor.isEmpty();
6773    }
6774
6775    public boolean hasFactor() {
6776      return this.factor != null && !this.factor.isEmpty();
6777    }
6778
6779    /**
6780     * @param value {@link #factor} (A real number that represents a multiplier used
6781     *              in determining the overall value of services delivered and/or
6782     *              goods received. The concept of a Factor allows for a discount or
6783     *              surcharge multiplier to be applied to a monetary amount.). This
6784     *              is the underlying object with id, value and extensions. The
6785     *              accessor "getFactor" gives direct access to the value
6786     */
6787    public DetailComponent setFactorElement(DecimalType value) {
6788      this.factor = value;
6789      return this;
6790    }
6791
6792    /**
6793     * @return A real number that represents a multiplier used in determining the
6794     *         overall value of services delivered and/or goods received. The
6795     *         concept of a Factor allows for a discount or surcharge multiplier to
6796     *         be applied to a monetary amount.
6797     */
6798    public BigDecimal getFactor() {
6799      return this.factor == null ? null : this.factor.getValue();
6800    }
6801
6802    /**
6803     * @param value A real number that represents a multiplier used in determining
6804     *              the overall value of services delivered and/or goods received.
6805     *              The concept of a Factor allows for a discount or surcharge
6806     *              multiplier to be applied to a monetary amount.
6807     */
6808    public DetailComponent setFactor(BigDecimal value) {
6809      if (value == null)
6810        this.factor = null;
6811      else {
6812        if (this.factor == null)
6813          this.factor = new DecimalType();
6814        this.factor.setValue(value);
6815      }
6816      return this;
6817    }
6818
6819    /**
6820     * @param value A real number that represents a multiplier used in determining
6821     *              the overall value of services delivered and/or goods received.
6822     *              The concept of a Factor allows for a discount or surcharge
6823     *              multiplier to be applied to a monetary amount.
6824     */
6825    public DetailComponent setFactor(long value) {
6826      this.factor = new DecimalType();
6827      this.factor.setValue(value);
6828      return this;
6829    }
6830
6831    /**
6832     * @param value A real number that represents a multiplier used in determining
6833     *              the overall value of services delivered and/or goods received.
6834     *              The concept of a Factor allows for a discount or surcharge
6835     *              multiplier to be applied to a monetary amount.
6836     */
6837    public DetailComponent setFactor(double value) {
6838      this.factor = new DecimalType();
6839      this.factor.setValue(value);
6840      return this;
6841    }
6842
6843    /**
6844     * @return {@link #net} (The quantity times the unit price for an additional
6845     *         service or product or charge.)
6846     */
6847    public Money getNet() {
6848      if (this.net == null)
6849        if (Configuration.errorOnAutoCreate())
6850          throw new Error("Attempt to auto-create DetailComponent.net");
6851        else if (Configuration.doAutoCreate())
6852          this.net = new Money(); // cc
6853      return this.net;
6854    }
6855
6856    public boolean hasNet() {
6857      return this.net != null && !this.net.isEmpty();
6858    }
6859
6860    /**
6861     * @param value {@link #net} (The quantity times the unit price for an
6862     *              additional service or product or charge.)
6863     */
6864    public DetailComponent setNet(Money value) {
6865      this.net = value;
6866      return this;
6867    }
6868
6869    /**
6870     * @return {@link #udi} (Unique Device Identifiers associated with this line
6871     *         item.)
6872     */
6873    public List<Reference> getUdi() {
6874      if (this.udi == null)
6875        this.udi = new ArrayList<Reference>();
6876      return this.udi;
6877    }
6878
6879    /**
6880     * @return Returns a reference to <code>this</code> for easy method chaining
6881     */
6882    public DetailComponent setUdi(List<Reference> theUdi) {
6883      this.udi = theUdi;
6884      return this;
6885    }
6886
6887    public boolean hasUdi() {
6888      if (this.udi == null)
6889        return false;
6890      for (Reference item : this.udi)
6891        if (!item.isEmpty())
6892          return true;
6893      return false;
6894    }
6895
6896    public Reference addUdi() { // 3
6897      Reference t = new Reference();
6898      if (this.udi == null)
6899        this.udi = new ArrayList<Reference>();
6900      this.udi.add(t);
6901      return t;
6902    }
6903
6904    public DetailComponent addUdi(Reference t) { // 3
6905      if (t == null)
6906        return this;
6907      if (this.udi == null)
6908        this.udi = new ArrayList<Reference>();
6909      this.udi.add(t);
6910      return this;
6911    }
6912
6913    /**
6914     * @return The first repetition of repeating field {@link #udi}, creating it if
6915     *         it does not already exist
6916     */
6917    public Reference getUdiFirstRep() {
6918      if (getUdi().isEmpty()) {
6919        addUdi();
6920      }
6921      return getUdi().get(0);
6922    }
6923
6924    /**
6925     * @return {@link #subDetail} (A claim detail line. Either a simple (a product
6926     *         or service) or a 'group' of sub-details which are simple items.)
6927     */
6928    public List<SubDetailComponent> getSubDetail() {
6929      if (this.subDetail == null)
6930        this.subDetail = new ArrayList<SubDetailComponent>();
6931      return this.subDetail;
6932    }
6933
6934    /**
6935     * @return Returns a reference to <code>this</code> for easy method chaining
6936     */
6937    public DetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) {
6938      this.subDetail = theSubDetail;
6939      return this;
6940    }
6941
6942    public boolean hasSubDetail() {
6943      if (this.subDetail == null)
6944        return false;
6945      for (SubDetailComponent item : this.subDetail)
6946        if (!item.isEmpty())
6947          return true;
6948      return false;
6949    }
6950
6951    public SubDetailComponent addSubDetail() { // 3
6952      SubDetailComponent t = new SubDetailComponent();
6953      if (this.subDetail == null)
6954        this.subDetail = new ArrayList<SubDetailComponent>();
6955      this.subDetail.add(t);
6956      return t;
6957    }
6958
6959    public DetailComponent addSubDetail(SubDetailComponent t) { // 3
6960      if (t == null)
6961        return this;
6962      if (this.subDetail == null)
6963        this.subDetail = new ArrayList<SubDetailComponent>();
6964      this.subDetail.add(t);
6965      return this;
6966    }
6967
6968    /**
6969     * @return The first repetition of repeating field {@link #subDetail}, creating
6970     *         it if it does not already exist
6971     */
6972    public SubDetailComponent getSubDetailFirstRep() {
6973      if (getSubDetail().isEmpty()) {
6974        addSubDetail();
6975      }
6976      return getSubDetail().get(0);
6977    }
6978
6979    protected void listChildren(List<Property> children) {
6980      super.listChildren(children);
6981      children
6982          .add(new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence));
6983      children.add(new Property("revenue", "CodeableConcept",
6984          "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
6985      children.add(new Property("category", "CodeableConcept",
6986          "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
6987          category));
6988      children.add(new Property("productOrService", "CodeableConcept",
6989          "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.",
6990          0, 1, productOrService));
6991      children.add(new Property("modifier", "CodeableConcept",
6992          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
6993          java.lang.Integer.MAX_VALUE, modifier));
6994      children.add(new Property("programCode", "CodeableConcept",
6995          "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
6996      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
6997          1, quantity));
6998      children.add(new Property("unitPrice", "Money",
6999          "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.",
7000          0, 1, unitPrice));
7001      children.add(new Property("factor", "decimal",
7002          "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.",
7003          0, 1, factor));
7004      children.add(new Property("net", "Money",
7005          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
7006      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
7007          0, java.lang.Integer.MAX_VALUE, udi));
7008      children.add(new Property("subDetail", "",
7009          "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
7010          0, java.lang.Integer.MAX_VALUE, subDetail));
7011    }
7012
7013    @Override
7014    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7015      switch (_hash) {
7016      case 1349547969:
7017        /* sequence */ return new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0,
7018            1, sequence);
7019      case 1099842588:
7020        /* revenue */ return new Property("revenue", "CodeableConcept",
7021            "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
7022      case 50511102:
7023        /* category */ return new Property("category", "CodeableConcept",
7024            "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
7025            category);
7026      case 1957227299:
7027        /* productOrService */ return new Property("productOrService", "CodeableConcept",
7028            "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.",
7029            0, 1, productOrService);
7030      case -615513385:
7031        /* modifier */ return new Property("modifier", "CodeableConcept",
7032            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
7033            java.lang.Integer.MAX_VALUE, modifier);
7034      case 1010065041:
7035        /* programCode */ return new Property("programCode", "CodeableConcept",
7036            "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
7037      case -1285004149:
7038        /* quantity */ return new Property("quantity", "SimpleQuantity",
7039            "The number of repetitions of a service or product.", 0, 1, quantity);
7040      case -486196699:
7041        /* unitPrice */ return new Property("unitPrice", "Money",
7042            "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.",
7043            0, 1, unitPrice);
7044      case -1282148017:
7045        /* factor */ return new Property("factor", "decimal",
7046            "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.",
7047            0, 1, factor);
7048      case 108957:
7049        /* net */ return new Property("net", "Money",
7050            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
7051      case 115642:
7052        /* udi */ return new Property("udi", "Reference(Device)",
7053            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
7054      case -828829007:
7055        /* subDetail */ return new Property("subDetail", "",
7056            "A claim detail line. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
7057            0, java.lang.Integer.MAX_VALUE, subDetail);
7058      default:
7059        return super.getNamedProperty(_hash, _name, _checkValid);
7060      }
7061
7062    }
7063
7064    @Override
7065    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7066      switch (hash) {
7067      case 1349547969:
7068        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
7069      case 1099842588:
7070        /* revenue */ return this.revenue == null ? new Base[0] : new Base[] { this.revenue }; // CodeableConcept
7071      case 50511102:
7072        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
7073      case 1957227299:
7074        /* productOrService */ return this.productOrService == null ? new Base[0]
7075            : new Base[] { this.productOrService }; // CodeableConcept
7076      case -615513385:
7077        /* modifier */ return this.modifier == null ? new Base[0]
7078            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
7079      case 1010065041:
7080        /* programCode */ return this.programCode == null ? new Base[0]
7081            : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
7082      case -1285004149:
7083        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
7084      case -486196699:
7085        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
7086      case -1282148017:
7087        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
7088      case 108957:
7089        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
7090      case 115642:
7091        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
7092      case -828829007:
7093        /* subDetail */ return this.subDetail == null ? new Base[0]
7094            : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
7095      default:
7096        return super.getProperty(hash, name, checkValid);
7097      }
7098
7099    }
7100
7101    @Override
7102    public Base setProperty(int hash, String name, Base value) throws FHIRException {
7103      switch (hash) {
7104      case 1349547969: // sequence
7105        this.sequence = castToPositiveInt(value); // PositiveIntType
7106        return value;
7107      case 1099842588: // revenue
7108        this.revenue = castToCodeableConcept(value); // CodeableConcept
7109        return value;
7110      case 50511102: // category
7111        this.category = castToCodeableConcept(value); // CodeableConcept
7112        return value;
7113      case 1957227299: // productOrService
7114        this.productOrService = castToCodeableConcept(value); // CodeableConcept
7115        return value;
7116      case -615513385: // modifier
7117        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
7118        return value;
7119      case 1010065041: // programCode
7120        this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
7121        return value;
7122      case -1285004149: // quantity
7123        this.quantity = castToQuantity(value); // Quantity
7124        return value;
7125      case -486196699: // unitPrice
7126        this.unitPrice = castToMoney(value); // Money
7127        return value;
7128      case -1282148017: // factor
7129        this.factor = castToDecimal(value); // DecimalType
7130        return value;
7131      case 108957: // net
7132        this.net = castToMoney(value); // Money
7133        return value;
7134      case 115642: // udi
7135        this.getUdi().add(castToReference(value)); // Reference
7136        return value;
7137      case -828829007: // subDetail
7138        this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
7139        return value;
7140      default:
7141        return super.setProperty(hash, name, value);
7142      }
7143
7144    }
7145
7146    @Override
7147    public Base setProperty(String name, Base value) throws FHIRException {
7148      if (name.equals("sequence")) {
7149        this.sequence = castToPositiveInt(value); // PositiveIntType
7150      } else if (name.equals("revenue")) {
7151        this.revenue = castToCodeableConcept(value); // CodeableConcept
7152      } else if (name.equals("category")) {
7153        this.category = castToCodeableConcept(value); // CodeableConcept
7154      } else if (name.equals("productOrService")) {
7155        this.productOrService = castToCodeableConcept(value); // CodeableConcept
7156      } else if (name.equals("modifier")) {
7157        this.getModifier().add(castToCodeableConcept(value));
7158      } else if (name.equals("programCode")) {
7159        this.getProgramCode().add(castToCodeableConcept(value));
7160      } else if (name.equals("quantity")) {
7161        this.quantity = castToQuantity(value); // Quantity
7162      } else if (name.equals("unitPrice")) {
7163        this.unitPrice = castToMoney(value); // Money
7164      } else if (name.equals("factor")) {
7165        this.factor = castToDecimal(value); // DecimalType
7166      } else if (name.equals("net")) {
7167        this.net = castToMoney(value); // Money
7168      } else if (name.equals("udi")) {
7169        this.getUdi().add(castToReference(value));
7170      } else if (name.equals("subDetail")) {
7171        this.getSubDetail().add((SubDetailComponent) value);
7172      } else
7173        return super.setProperty(name, value);
7174      return value;
7175    }
7176
7177  @Override
7178  public void removeChild(String name, Base value) throws FHIRException {
7179      if (name.equals("sequence")) {
7180        this.sequence = null;
7181      } else if (name.equals("revenue")) {
7182        this.revenue = null;
7183      } else if (name.equals("category")) {
7184        this.category = null;
7185      } else if (name.equals("productOrService")) {
7186        this.productOrService = null;
7187      } else if (name.equals("modifier")) {
7188        this.getModifier().remove(castToCodeableConcept(value));
7189      } else if (name.equals("programCode")) {
7190        this.getProgramCode().remove(castToCodeableConcept(value));
7191      } else if (name.equals("quantity")) {
7192        this.quantity = null;
7193      } else if (name.equals("unitPrice")) {
7194        this.unitPrice = null;
7195      } else if (name.equals("factor")) {
7196        this.factor = null;
7197      } else if (name.equals("net")) {
7198        this.net = null;
7199      } else if (name.equals("udi")) {
7200        this.getUdi().remove(castToReference(value));
7201      } else if (name.equals("subDetail")) {
7202        this.getSubDetail().remove((SubDetailComponent) value);
7203      } else
7204        super.removeChild(name, value);
7205      
7206    }
7207
7208    @Override
7209    public Base makeProperty(int hash, String name) throws FHIRException {
7210      switch (hash) {
7211      case 1349547969:
7212        return getSequenceElement();
7213      case 1099842588:
7214        return getRevenue();
7215      case 50511102:
7216        return getCategory();
7217      case 1957227299:
7218        return getProductOrService();
7219      case -615513385:
7220        return addModifier();
7221      case 1010065041:
7222        return addProgramCode();
7223      case -1285004149:
7224        return getQuantity();
7225      case -486196699:
7226        return getUnitPrice();
7227      case -1282148017:
7228        return getFactorElement();
7229      case 108957:
7230        return getNet();
7231      case 115642:
7232        return addUdi();
7233      case -828829007:
7234        return addSubDetail();
7235      default:
7236        return super.makeProperty(hash, name);
7237      }
7238
7239    }
7240
7241    @Override
7242    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7243      switch (hash) {
7244      case 1349547969:
7245        /* sequence */ return new String[] { "positiveInt" };
7246      case 1099842588:
7247        /* revenue */ return new String[] { "CodeableConcept" };
7248      case 50511102:
7249        /* category */ return new String[] { "CodeableConcept" };
7250      case 1957227299:
7251        /* productOrService */ return new String[] { "CodeableConcept" };
7252      case -615513385:
7253        /* modifier */ return new String[] { "CodeableConcept" };
7254      case 1010065041:
7255        /* programCode */ return new String[] { "CodeableConcept" };
7256      case -1285004149:
7257        /* quantity */ return new String[] { "SimpleQuantity" };
7258      case -486196699:
7259        /* unitPrice */ return new String[] { "Money" };
7260      case -1282148017:
7261        /* factor */ return new String[] { "decimal" };
7262      case 108957:
7263        /* net */ return new String[] { "Money" };
7264      case 115642:
7265        /* udi */ return new String[] { "Reference" };
7266      case -828829007:
7267        /* subDetail */ return new String[] {};
7268      default:
7269        return super.getTypesForProperty(hash, name);
7270      }
7271
7272    }
7273
7274    @Override
7275    public Base addChild(String name) throws FHIRException {
7276      if (name.equals("sequence")) {
7277        throw new FHIRException("Cannot call addChild on a singleton property Claim.sequence");
7278      } else if (name.equals("revenue")) {
7279        this.revenue = new CodeableConcept();
7280        return this.revenue;
7281      } else if (name.equals("category")) {
7282        this.category = new CodeableConcept();
7283        return this.category;
7284      } else if (name.equals("productOrService")) {
7285        this.productOrService = new CodeableConcept();
7286        return this.productOrService;
7287      } else if (name.equals("modifier")) {
7288        return addModifier();
7289      } else if (name.equals("programCode")) {
7290        return addProgramCode();
7291      } else if (name.equals("quantity")) {
7292        this.quantity = new Quantity();
7293        return this.quantity;
7294      } else if (name.equals("unitPrice")) {
7295        this.unitPrice = new Money();
7296        return this.unitPrice;
7297      } else if (name.equals("factor")) {
7298        throw new FHIRException("Cannot call addChild on a singleton property Claim.factor");
7299      } else if (name.equals("net")) {
7300        this.net = new Money();
7301        return this.net;
7302      } else if (name.equals("udi")) {
7303        return addUdi();
7304      } else if (name.equals("subDetail")) {
7305        return addSubDetail();
7306      } else
7307        return super.addChild(name);
7308    }
7309
7310    public DetailComponent copy() {
7311      DetailComponent dst = new DetailComponent();
7312      copyValues(dst);
7313      return dst;
7314    }
7315
7316    public void copyValues(DetailComponent dst) {
7317      super.copyValues(dst);
7318      dst.sequence = sequence == null ? null : sequence.copy();
7319      dst.revenue = revenue == null ? null : revenue.copy();
7320      dst.category = category == null ? null : category.copy();
7321      dst.productOrService = productOrService == null ? null : productOrService.copy();
7322      if (modifier != null) {
7323        dst.modifier = new ArrayList<CodeableConcept>();
7324        for (CodeableConcept i : modifier)
7325          dst.modifier.add(i.copy());
7326      }
7327      ;
7328      if (programCode != null) {
7329        dst.programCode = new ArrayList<CodeableConcept>();
7330        for (CodeableConcept i : programCode)
7331          dst.programCode.add(i.copy());
7332      }
7333      ;
7334      dst.quantity = quantity == null ? null : quantity.copy();
7335      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
7336      dst.factor = factor == null ? null : factor.copy();
7337      dst.net = net == null ? null : net.copy();
7338      if (udi != null) {
7339        dst.udi = new ArrayList<Reference>();
7340        for (Reference i : udi)
7341          dst.udi.add(i.copy());
7342      }
7343      ;
7344      if (subDetail != null) {
7345        dst.subDetail = new ArrayList<SubDetailComponent>();
7346        for (SubDetailComponent i : subDetail)
7347          dst.subDetail.add(i.copy());
7348      }
7349      ;
7350    }
7351
7352    @Override
7353    public boolean equalsDeep(Base other_) {
7354      if (!super.equalsDeep(other_))
7355        return false;
7356      if (!(other_ instanceof DetailComponent))
7357        return false;
7358      DetailComponent o = (DetailComponent) other_;
7359      return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true)
7360          && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
7361          && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
7362          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
7363          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true)
7364          && compareDeep(subDetail, o.subDetail, true);
7365    }
7366
7367    @Override
7368    public boolean equalsShallow(Base other_) {
7369      if (!super.equalsShallow(other_))
7370        return false;
7371      if (!(other_ instanceof DetailComponent))
7372        return false;
7373      DetailComponent o = (DetailComponent) other_;
7374      return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true);
7375    }
7376
7377    public boolean isEmpty() {
7378      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category, productOrService,
7379          modifier, programCode, quantity, unitPrice, factor, net, udi, subDetail);
7380    }
7381
7382    public String fhirType() {
7383      return "Claim.item.detail";
7384
7385    }
7386
7387  }
7388
7389  @Block()
7390  public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
7391    /**
7392     * A number to uniquely identify item entries.
7393     */
7394    @Child(name = "sequence", type = {
7395        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
7396    @Description(shortDefinition = "Item instance identifier", formalDefinition = "A number to uniquely identify item entries.")
7397    protected PositiveIntType sequence;
7398
7399    /**
7400     * The type of revenue or cost center providing the product and/or service.
7401     */
7402    @Child(name = "revenue", type = {
7403        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
7404    @Description(shortDefinition = "Revenue or cost center code", formalDefinition = "The type of revenue or cost center providing the product and/or service.")
7405    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-revenue-center")
7406    protected CodeableConcept revenue;
7407
7408    /**
7409     * Code to identify the general type of benefits under which products and
7410     * services are provided.
7411     */
7412    @Child(name = "category", type = {
7413        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
7414    @Description(shortDefinition = "Benefit classification", formalDefinition = "Code to identify the general type of benefits under which products and services are provided.")
7415    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-benefitcategory")
7416    protected CodeableConcept category;
7417
7418    /**
7419     * When the value is a group code then this item collects a set of related claim
7420     * details, otherwise this contains the product, service, drug or other billing
7421     * code for the item.
7422     */
7423    @Child(name = "productOrService", type = {
7424        CodeableConcept.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
7425    @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.")
7426    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
7427    protected CodeableConcept productOrService;
7428
7429    /**
7430     * Item typification or modifiers codes to convey additional context for the
7431     * product or service.
7432     */
7433    @Child(name = "modifier", type = {
7434        CodeableConcept.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7435    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
7436    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
7437    protected List<CodeableConcept> modifier;
7438
7439    /**
7440     * Identifies the program under which this may be recovered.
7441     */
7442    @Child(name = "programCode", type = {
7443        CodeableConcept.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7444    @Description(shortDefinition = "Program the product or service is provided under", formalDefinition = "Identifies the program under which this may be recovered.")
7445    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-program-code")
7446    protected List<CodeableConcept> programCode;
7447
7448    /**
7449     * The number of repetitions of a service or product.
7450     */
7451    @Child(name = "quantity", type = { Quantity.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
7452    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
7453    protected Quantity quantity;
7454
7455    /**
7456     * If the item is not a group then this is the fee for the product or service,
7457     * otherwise this is the total of the fees for the details of the group.
7458     */
7459    @Child(name = "unitPrice", type = { Money.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
7460    @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.")
7461    protected Money unitPrice;
7462
7463    /**
7464     * A real number that represents a multiplier used in determining the overall
7465     * value of services delivered and/or goods received. The concept of a Factor
7466     * allows for a discount or surcharge multiplier to be applied to a monetary
7467     * amount.
7468     */
7469    @Child(name = "factor", type = {
7470        DecimalType.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
7471    @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.")
7472    protected DecimalType factor;
7473
7474    /**
7475     * The quantity times the unit price for an additional service or product or
7476     * charge.
7477     */
7478    @Child(name = "net", type = { Money.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
7479    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
7480    protected Money net;
7481
7482    /**
7483     * Unique Device Identifiers associated with this line item.
7484     */
7485    @Child(name = "udi", type = {
7486        Device.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7487    @Description(shortDefinition = "Unique device identifier", formalDefinition = "Unique Device Identifiers associated with this line item.")
7488    protected List<Reference> udi;
7489    /**
7490     * The actual objects that are the target of the reference (Unique Device
7491     * Identifiers associated with this line item.)
7492     */
7493    protected List<Device> udiTarget;
7494
7495    private static final long serialVersionUID = 1133026301L;
7496
7497    /**
7498     * Constructor
7499     */
7500    public SubDetailComponent() {
7501      super();
7502    }
7503
7504    /**
7505     * Constructor
7506     */
7507    public SubDetailComponent(PositiveIntType sequence, CodeableConcept productOrService) {
7508      super();
7509      this.sequence = sequence;
7510      this.productOrService = productOrService;
7511    }
7512
7513    /**
7514     * @return {@link #sequence} (A number to uniquely identify item entries.). This
7515     *         is the underlying object with id, value and extensions. The accessor
7516     *         "getSequence" gives direct access to the value
7517     */
7518    public PositiveIntType getSequenceElement() {
7519      if (this.sequence == null)
7520        if (Configuration.errorOnAutoCreate())
7521          throw new Error("Attempt to auto-create SubDetailComponent.sequence");
7522        else if (Configuration.doAutoCreate())
7523          this.sequence = new PositiveIntType(); // bb
7524      return this.sequence;
7525    }
7526
7527    public boolean hasSequenceElement() {
7528      return this.sequence != null && !this.sequence.isEmpty();
7529    }
7530
7531    public boolean hasSequence() {
7532      return this.sequence != null && !this.sequence.isEmpty();
7533    }
7534
7535    /**
7536     * @param value {@link #sequence} (A number to uniquely identify item entries.).
7537     *              This is the underlying object with id, value and extensions. The
7538     *              accessor "getSequence" gives direct access to the value
7539     */
7540    public SubDetailComponent setSequenceElement(PositiveIntType value) {
7541      this.sequence = value;
7542      return this;
7543    }
7544
7545    /**
7546     * @return A number to uniquely identify item entries.
7547     */
7548    public int getSequence() {
7549      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
7550    }
7551
7552    /**
7553     * @param value A number to uniquely identify item entries.
7554     */
7555    public SubDetailComponent setSequence(int value) {
7556      if (this.sequence == null)
7557        this.sequence = new PositiveIntType();
7558      this.sequence.setValue(value);
7559      return this;
7560    }
7561
7562    /**
7563     * @return {@link #revenue} (The type of revenue or cost center providing the
7564     *         product and/or service.)
7565     */
7566    public CodeableConcept getRevenue() {
7567      if (this.revenue == null)
7568        if (Configuration.errorOnAutoCreate())
7569          throw new Error("Attempt to auto-create SubDetailComponent.revenue");
7570        else if (Configuration.doAutoCreate())
7571          this.revenue = new CodeableConcept(); // cc
7572      return this.revenue;
7573    }
7574
7575    public boolean hasRevenue() {
7576      return this.revenue != null && !this.revenue.isEmpty();
7577    }
7578
7579    /**
7580     * @param value {@link #revenue} (The type of revenue or cost center providing
7581     *              the product and/or service.)
7582     */
7583    public SubDetailComponent setRevenue(CodeableConcept value) {
7584      this.revenue = value;
7585      return this;
7586    }
7587
7588    /**
7589     * @return {@link #category} (Code to identify the general type of benefits
7590     *         under which products and services are provided.)
7591     */
7592    public CodeableConcept getCategory() {
7593      if (this.category == null)
7594        if (Configuration.errorOnAutoCreate())
7595          throw new Error("Attempt to auto-create SubDetailComponent.category");
7596        else if (Configuration.doAutoCreate())
7597          this.category = new CodeableConcept(); // cc
7598      return this.category;
7599    }
7600
7601    public boolean hasCategory() {
7602      return this.category != null && !this.category.isEmpty();
7603    }
7604
7605    /**
7606     * @param value {@link #category} (Code to identify the general type of benefits
7607     *              under which products and services are provided.)
7608     */
7609    public SubDetailComponent setCategory(CodeableConcept value) {
7610      this.category = value;
7611      return this;
7612    }
7613
7614    /**
7615     * @return {@link #productOrService} (When the value is a group code then this
7616     *         item collects a set of related claim details, otherwise this contains
7617     *         the product, service, drug or other billing code for the item.)
7618     */
7619    public CodeableConcept getProductOrService() {
7620      if (this.productOrService == null)
7621        if (Configuration.errorOnAutoCreate())
7622          throw new Error("Attempt to auto-create SubDetailComponent.productOrService");
7623        else if (Configuration.doAutoCreate())
7624          this.productOrService = new CodeableConcept(); // cc
7625      return this.productOrService;
7626    }
7627
7628    public boolean hasProductOrService() {
7629      return this.productOrService != null && !this.productOrService.isEmpty();
7630    }
7631
7632    /**
7633     * @param value {@link #productOrService} (When the value is a group code then
7634     *              this item collects a set of related claim details, otherwise
7635     *              this contains the product, service, drug or other billing code
7636     *              for the item.)
7637     */
7638    public SubDetailComponent setProductOrService(CodeableConcept value) {
7639      this.productOrService = value;
7640      return this;
7641    }
7642
7643    /**
7644     * @return {@link #modifier} (Item typification or modifiers codes to convey
7645     *         additional context for the product or service.)
7646     */
7647    public List<CodeableConcept> getModifier() {
7648      if (this.modifier == null)
7649        this.modifier = new ArrayList<CodeableConcept>();
7650      return this.modifier;
7651    }
7652
7653    /**
7654     * @return Returns a reference to <code>this</code> for easy method chaining
7655     */
7656    public SubDetailComponent setModifier(List<CodeableConcept> theModifier) {
7657      this.modifier = theModifier;
7658      return this;
7659    }
7660
7661    public boolean hasModifier() {
7662      if (this.modifier == null)
7663        return false;
7664      for (CodeableConcept item : this.modifier)
7665        if (!item.isEmpty())
7666          return true;
7667      return false;
7668    }
7669
7670    public CodeableConcept addModifier() { // 3
7671      CodeableConcept t = new CodeableConcept();
7672      if (this.modifier == null)
7673        this.modifier = new ArrayList<CodeableConcept>();
7674      this.modifier.add(t);
7675      return t;
7676    }
7677
7678    public SubDetailComponent addModifier(CodeableConcept t) { // 3
7679      if (t == null)
7680        return this;
7681      if (this.modifier == null)
7682        this.modifier = new ArrayList<CodeableConcept>();
7683      this.modifier.add(t);
7684      return this;
7685    }
7686
7687    /**
7688     * @return The first repetition of repeating field {@link #modifier}, creating
7689     *         it if it does not already exist
7690     */
7691    public CodeableConcept getModifierFirstRep() {
7692      if (getModifier().isEmpty()) {
7693        addModifier();
7694      }
7695      return getModifier().get(0);
7696    }
7697
7698    /**
7699     * @return {@link #programCode} (Identifies the program under which this may be
7700     *         recovered.)
7701     */
7702    public List<CodeableConcept> getProgramCode() {
7703      if (this.programCode == null)
7704        this.programCode = new ArrayList<CodeableConcept>();
7705      return this.programCode;
7706    }
7707
7708    /**
7709     * @return Returns a reference to <code>this</code> for easy method chaining
7710     */
7711    public SubDetailComponent setProgramCode(List<CodeableConcept> theProgramCode) {
7712      this.programCode = theProgramCode;
7713      return this;
7714    }
7715
7716    public boolean hasProgramCode() {
7717      if (this.programCode == null)
7718        return false;
7719      for (CodeableConcept item : this.programCode)
7720        if (!item.isEmpty())
7721          return true;
7722      return false;
7723    }
7724
7725    public CodeableConcept addProgramCode() { // 3
7726      CodeableConcept t = new CodeableConcept();
7727      if (this.programCode == null)
7728        this.programCode = new ArrayList<CodeableConcept>();
7729      this.programCode.add(t);
7730      return t;
7731    }
7732
7733    public SubDetailComponent addProgramCode(CodeableConcept t) { // 3
7734      if (t == null)
7735        return this;
7736      if (this.programCode == null)
7737        this.programCode = new ArrayList<CodeableConcept>();
7738      this.programCode.add(t);
7739      return this;
7740    }
7741
7742    /**
7743     * @return The first repetition of repeating field {@link #programCode},
7744     *         creating it if it does not already exist
7745     */
7746    public CodeableConcept getProgramCodeFirstRep() {
7747      if (getProgramCode().isEmpty()) {
7748        addProgramCode();
7749      }
7750      return getProgramCode().get(0);
7751    }
7752
7753    /**
7754     * @return {@link #quantity} (The number of repetitions of a service or
7755     *         product.)
7756     */
7757    public Quantity getQuantity() {
7758      if (this.quantity == null)
7759        if (Configuration.errorOnAutoCreate())
7760          throw new Error("Attempt to auto-create SubDetailComponent.quantity");
7761        else if (Configuration.doAutoCreate())
7762          this.quantity = new Quantity(); // cc
7763      return this.quantity;
7764    }
7765
7766    public boolean hasQuantity() {
7767      return this.quantity != null && !this.quantity.isEmpty();
7768    }
7769
7770    /**
7771     * @param value {@link #quantity} (The number of repetitions of a service or
7772     *              product.)
7773     */
7774    public SubDetailComponent setQuantity(Quantity value) {
7775      this.quantity = value;
7776      return this;
7777    }
7778
7779    /**
7780     * @return {@link #unitPrice} (If the item is not a group then this is the fee
7781     *         for the product or service, otherwise this is the total of the fees
7782     *         for the details of the group.)
7783     */
7784    public Money getUnitPrice() {
7785      if (this.unitPrice == null)
7786        if (Configuration.errorOnAutoCreate())
7787          throw new Error("Attempt to auto-create SubDetailComponent.unitPrice");
7788        else if (Configuration.doAutoCreate())
7789          this.unitPrice = new Money(); // cc
7790      return this.unitPrice;
7791    }
7792
7793    public boolean hasUnitPrice() {
7794      return this.unitPrice != null && !this.unitPrice.isEmpty();
7795    }
7796
7797    /**
7798     * @param value {@link #unitPrice} (If the item is not a group then this is the
7799     *              fee for the product or service, otherwise this is the total of
7800     *              the fees for the details of the group.)
7801     */
7802    public SubDetailComponent setUnitPrice(Money value) {
7803      this.unitPrice = value;
7804      return this;
7805    }
7806
7807    /**
7808     * @return {@link #factor} (A real number that represents a multiplier used in
7809     *         determining the overall value of services delivered and/or goods
7810     *         received. The concept of a Factor allows for a discount or surcharge
7811     *         multiplier to be applied to a monetary amount.). This is the
7812     *         underlying object with id, value and extensions. The accessor
7813     *         "getFactor" gives direct access to the value
7814     */
7815    public DecimalType getFactorElement() {
7816      if (this.factor == null)
7817        if (Configuration.errorOnAutoCreate())
7818          throw new Error("Attempt to auto-create SubDetailComponent.factor");
7819        else if (Configuration.doAutoCreate())
7820          this.factor = new DecimalType(); // bb
7821      return this.factor;
7822    }
7823
7824    public boolean hasFactorElement() {
7825      return this.factor != null && !this.factor.isEmpty();
7826    }
7827
7828    public boolean hasFactor() {
7829      return this.factor != null && !this.factor.isEmpty();
7830    }
7831
7832    /**
7833     * @param value {@link #factor} (A real number that represents a multiplier used
7834     *              in determining the overall value of services delivered and/or
7835     *              goods received. The concept of a Factor allows for a discount or
7836     *              surcharge multiplier to be applied to a monetary amount.). This
7837     *              is the underlying object with id, value and extensions. The
7838     *              accessor "getFactor" gives direct access to the value
7839     */
7840    public SubDetailComponent setFactorElement(DecimalType value) {
7841      this.factor = value;
7842      return this;
7843    }
7844
7845    /**
7846     * @return A real number that represents a multiplier used in determining the
7847     *         overall value of services delivered and/or goods received. The
7848     *         concept of a Factor allows for a discount or surcharge multiplier to
7849     *         be applied to a monetary amount.
7850     */
7851    public BigDecimal getFactor() {
7852      return this.factor == null ? null : this.factor.getValue();
7853    }
7854
7855    /**
7856     * @param value A real number that represents a multiplier used in determining
7857     *              the overall value of services delivered and/or goods received.
7858     *              The concept of a Factor allows for a discount or surcharge
7859     *              multiplier to be applied to a monetary amount.
7860     */
7861    public SubDetailComponent setFactor(BigDecimal value) {
7862      if (value == null)
7863        this.factor = null;
7864      else {
7865        if (this.factor == null)
7866          this.factor = new DecimalType();
7867        this.factor.setValue(value);
7868      }
7869      return this;
7870    }
7871
7872    /**
7873     * @param value A real number that represents a multiplier used in determining
7874     *              the overall value of services delivered and/or goods received.
7875     *              The concept of a Factor allows for a discount or surcharge
7876     *              multiplier to be applied to a monetary amount.
7877     */
7878    public SubDetailComponent setFactor(long value) {
7879      this.factor = new DecimalType();
7880      this.factor.setValue(value);
7881      return this;
7882    }
7883
7884    /**
7885     * @param value A real number that represents a multiplier used in determining
7886     *              the overall value of services delivered and/or goods received.
7887     *              The concept of a Factor allows for a discount or surcharge
7888     *              multiplier to be applied to a monetary amount.
7889     */
7890    public SubDetailComponent setFactor(double value) {
7891      this.factor = new DecimalType();
7892      this.factor.setValue(value);
7893      return this;
7894    }
7895
7896    /**
7897     * @return {@link #net} (The quantity times the unit price for an additional
7898     *         service or product or charge.)
7899     */
7900    public Money getNet() {
7901      if (this.net == null)
7902        if (Configuration.errorOnAutoCreate())
7903          throw new Error("Attempt to auto-create SubDetailComponent.net");
7904        else if (Configuration.doAutoCreate())
7905          this.net = new Money(); // cc
7906      return this.net;
7907    }
7908
7909    public boolean hasNet() {
7910      return this.net != null && !this.net.isEmpty();
7911    }
7912
7913    /**
7914     * @param value {@link #net} (The quantity times the unit price for an
7915     *              additional service or product or charge.)
7916     */
7917    public SubDetailComponent setNet(Money value) {
7918      this.net = value;
7919      return this;
7920    }
7921
7922    /**
7923     * @return {@link #udi} (Unique Device Identifiers associated with this line
7924     *         item.)
7925     */
7926    public List<Reference> getUdi() {
7927      if (this.udi == null)
7928        this.udi = new ArrayList<Reference>();
7929      return this.udi;
7930    }
7931
7932    /**
7933     * @return Returns a reference to <code>this</code> for easy method chaining
7934     */
7935    public SubDetailComponent setUdi(List<Reference> theUdi) {
7936      this.udi = theUdi;
7937      return this;
7938    }
7939
7940    public boolean hasUdi() {
7941      if (this.udi == null)
7942        return false;
7943      for (Reference item : this.udi)
7944        if (!item.isEmpty())
7945          return true;
7946      return false;
7947    }
7948
7949    public Reference addUdi() { // 3
7950      Reference t = new Reference();
7951      if (this.udi == null)
7952        this.udi = new ArrayList<Reference>();
7953      this.udi.add(t);
7954      return t;
7955    }
7956
7957    public SubDetailComponent addUdi(Reference t) { // 3
7958      if (t == null)
7959        return this;
7960      if (this.udi == null)
7961        this.udi = new ArrayList<Reference>();
7962      this.udi.add(t);
7963      return this;
7964    }
7965
7966    /**
7967     * @return The first repetition of repeating field {@link #udi}, creating it if
7968     *         it does not already exist
7969     */
7970    public Reference getUdiFirstRep() {
7971      if (getUdi().isEmpty()) {
7972        addUdi();
7973      }
7974      return getUdi().get(0);
7975    }
7976
7977    protected void listChildren(List<Property> children) {
7978      super.listChildren(children);
7979      children
7980          .add(new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0, 1, sequence));
7981      children.add(new Property("revenue", "CodeableConcept",
7982          "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue));
7983      children.add(new Property("category", "CodeableConcept",
7984          "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
7985          category));
7986      children.add(new Property("productOrService", "CodeableConcept",
7987          "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.",
7988          0, 1, productOrService));
7989      children.add(new Property("modifier", "CodeableConcept",
7990          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
7991          java.lang.Integer.MAX_VALUE, modifier));
7992      children.add(new Property("programCode", "CodeableConcept",
7993          "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
7994      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
7995          1, quantity));
7996      children.add(new Property("unitPrice", "Money",
7997          "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.",
7998          0, 1, unitPrice));
7999      children.add(new Property("factor", "decimal",
8000          "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.",
8001          0, 1, factor));
8002      children.add(new Property("net", "Money",
8003          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
8004      children.add(new Property("udi", "Reference(Device)", "Unique Device Identifiers associated with this line item.",
8005          0, java.lang.Integer.MAX_VALUE, udi));
8006    }
8007
8008    @Override
8009    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
8010      switch (_hash) {
8011      case 1349547969:
8012        /* sequence */ return new Property("sequence", "positiveInt", "A number to uniquely identify item entries.", 0,
8013            1, sequence);
8014      case 1099842588:
8015        /* revenue */ return new Property("revenue", "CodeableConcept",
8016            "The type of revenue or cost center providing the product and/or service.", 0, 1, revenue);
8017      case 50511102:
8018        /* category */ return new Property("category", "CodeableConcept",
8019            "Code to identify the general type of benefits under which products and services are provided.", 0, 1,
8020            category);
8021      case 1957227299:
8022        /* productOrService */ return new Property("productOrService", "CodeableConcept",
8023            "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.",
8024            0, 1, productOrService);
8025      case -615513385:
8026        /* modifier */ return new Property("modifier", "CodeableConcept",
8027            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
8028            java.lang.Integer.MAX_VALUE, modifier);
8029      case 1010065041:
8030        /* programCode */ return new Property("programCode", "CodeableConcept",
8031            "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
8032      case -1285004149:
8033        /* quantity */ return new Property("quantity", "SimpleQuantity",
8034            "The number of repetitions of a service or product.", 0, 1, quantity);
8035      case -486196699:
8036        /* unitPrice */ return new Property("unitPrice", "Money",
8037            "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.",
8038            0, 1, unitPrice);
8039      case -1282148017:
8040        /* factor */ return new Property("factor", "decimal",
8041            "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.",
8042            0, 1, factor);
8043      case 108957:
8044        /* net */ return new Property("net", "Money",
8045            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
8046      case 115642:
8047        /* udi */ return new Property("udi", "Reference(Device)",
8048            "Unique Device Identifiers associated with this line item.", 0, java.lang.Integer.MAX_VALUE, udi);
8049      default:
8050        return super.getNamedProperty(_hash, _name, _checkValid);
8051      }
8052
8053    }
8054
8055    @Override
8056    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
8057      switch (hash) {
8058      case 1349547969:
8059        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
8060      case 1099842588:
8061        /* revenue */ return this.revenue == null ? new Base[0] : new Base[] { this.revenue }; // CodeableConcept
8062      case 50511102:
8063        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
8064      case 1957227299:
8065        /* productOrService */ return this.productOrService == null ? new Base[0]
8066            : new Base[] { this.productOrService }; // CodeableConcept
8067      case -615513385:
8068        /* modifier */ return this.modifier == null ? new Base[0]
8069            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
8070      case 1010065041:
8071        /* programCode */ return this.programCode == null ? new Base[0]
8072            : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
8073      case -1285004149:
8074        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
8075      case -486196699:
8076        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
8077      case -1282148017:
8078        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
8079      case 108957:
8080        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
8081      case 115642:
8082        /* udi */ return this.udi == null ? new Base[0] : this.udi.toArray(new Base[this.udi.size()]); // Reference
8083      default:
8084        return super.getProperty(hash, name, checkValid);
8085      }
8086
8087    }
8088
8089    @Override
8090    public Base setProperty(int hash, String name, Base value) throws FHIRException {
8091      switch (hash) {
8092      case 1349547969: // sequence
8093        this.sequence = castToPositiveInt(value); // PositiveIntType
8094        return value;
8095      case 1099842588: // revenue
8096        this.revenue = castToCodeableConcept(value); // CodeableConcept
8097        return value;
8098      case 50511102: // category
8099        this.category = castToCodeableConcept(value); // CodeableConcept
8100        return value;
8101      case 1957227299: // productOrService
8102        this.productOrService = castToCodeableConcept(value); // CodeableConcept
8103        return value;
8104      case -615513385: // modifier
8105        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
8106        return value;
8107      case 1010065041: // programCode
8108        this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
8109        return value;
8110      case -1285004149: // quantity
8111        this.quantity = castToQuantity(value); // Quantity
8112        return value;
8113      case -486196699: // unitPrice
8114        this.unitPrice = castToMoney(value); // Money
8115        return value;
8116      case -1282148017: // factor
8117        this.factor = castToDecimal(value); // DecimalType
8118        return value;
8119      case 108957: // net
8120        this.net = castToMoney(value); // Money
8121        return value;
8122      case 115642: // udi
8123        this.getUdi().add(castToReference(value)); // Reference
8124        return value;
8125      default:
8126        return super.setProperty(hash, name, value);
8127      }
8128
8129    }
8130
8131    @Override
8132    public Base setProperty(String name, Base value) throws FHIRException {
8133      if (name.equals("sequence")) {
8134        this.sequence = castToPositiveInt(value); // PositiveIntType
8135      } else if (name.equals("revenue")) {
8136        this.revenue = castToCodeableConcept(value); // CodeableConcept
8137      } else if (name.equals("category")) {
8138        this.category = castToCodeableConcept(value); // CodeableConcept
8139      } else if (name.equals("productOrService")) {
8140        this.productOrService = castToCodeableConcept(value); // CodeableConcept
8141      } else if (name.equals("modifier")) {
8142        this.getModifier().add(castToCodeableConcept(value));
8143      } else if (name.equals("programCode")) {
8144        this.getProgramCode().add(castToCodeableConcept(value));
8145      } else if (name.equals("quantity")) {
8146        this.quantity = castToQuantity(value); // Quantity
8147      } else if (name.equals("unitPrice")) {
8148        this.unitPrice = castToMoney(value); // Money
8149      } else if (name.equals("factor")) {
8150        this.factor = castToDecimal(value); // DecimalType
8151      } else if (name.equals("net")) {
8152        this.net = castToMoney(value); // Money
8153      } else if (name.equals("udi")) {
8154        this.getUdi().add(castToReference(value));
8155      } else
8156        return super.setProperty(name, value);
8157      return value;
8158    }
8159
8160  @Override
8161  public void removeChild(String name, Base value) throws FHIRException {
8162      if (name.equals("sequence")) {
8163        this.sequence = null;
8164      } else if (name.equals("revenue")) {
8165        this.revenue = null;
8166      } else if (name.equals("category")) {
8167        this.category = null;
8168      } else if (name.equals("productOrService")) {
8169        this.productOrService = null;
8170      } else if (name.equals("modifier")) {
8171        this.getModifier().remove(castToCodeableConcept(value));
8172      } else if (name.equals("programCode")) {
8173        this.getProgramCode().remove(castToCodeableConcept(value));
8174      } else if (name.equals("quantity")) {
8175        this.quantity = null;
8176      } else if (name.equals("unitPrice")) {
8177        this.unitPrice = null;
8178      } else if (name.equals("factor")) {
8179        this.factor = null;
8180      } else if (name.equals("net")) {
8181        this.net = null;
8182      } else if (name.equals("udi")) {
8183        this.getUdi().remove(castToReference(value));
8184      } else
8185        super.removeChild(name, value);
8186      
8187    }
8188
8189    @Override
8190    public Base makeProperty(int hash, String name) throws FHIRException {
8191      switch (hash) {
8192      case 1349547969:
8193        return getSequenceElement();
8194      case 1099842588:
8195        return getRevenue();
8196      case 50511102:
8197        return getCategory();
8198      case 1957227299:
8199        return getProductOrService();
8200      case -615513385:
8201        return addModifier();
8202      case 1010065041:
8203        return addProgramCode();
8204      case -1285004149:
8205        return getQuantity();
8206      case -486196699:
8207        return getUnitPrice();
8208      case -1282148017:
8209        return getFactorElement();
8210      case 108957:
8211        return getNet();
8212      case 115642:
8213        return addUdi();
8214      default:
8215        return super.makeProperty(hash, name);
8216      }
8217
8218    }
8219
8220    @Override
8221    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8222      switch (hash) {
8223      case 1349547969:
8224        /* sequence */ return new String[] { "positiveInt" };
8225      case 1099842588:
8226        /* revenue */ return new String[] { "CodeableConcept" };
8227      case 50511102:
8228        /* category */ return new String[] { "CodeableConcept" };
8229      case 1957227299:
8230        /* productOrService */ return new String[] { "CodeableConcept" };
8231      case -615513385:
8232        /* modifier */ return new String[] { "CodeableConcept" };
8233      case 1010065041:
8234        /* programCode */ return new String[] { "CodeableConcept" };
8235      case -1285004149:
8236        /* quantity */ return new String[] { "SimpleQuantity" };
8237      case -486196699:
8238        /* unitPrice */ return new String[] { "Money" };
8239      case -1282148017:
8240        /* factor */ return new String[] { "decimal" };
8241      case 108957:
8242        /* net */ return new String[] { "Money" };
8243      case 115642:
8244        /* udi */ return new String[] { "Reference" };
8245      default:
8246        return super.getTypesForProperty(hash, name);
8247      }
8248
8249    }
8250
8251    @Override
8252    public Base addChild(String name) throws FHIRException {
8253      if (name.equals("sequence")) {
8254        throw new FHIRException("Cannot call addChild on a singleton property Claim.sequence");
8255      } else if (name.equals("revenue")) {
8256        this.revenue = new CodeableConcept();
8257        return this.revenue;
8258      } else if (name.equals("category")) {
8259        this.category = new CodeableConcept();
8260        return this.category;
8261      } else if (name.equals("productOrService")) {
8262        this.productOrService = new CodeableConcept();
8263        return this.productOrService;
8264      } else if (name.equals("modifier")) {
8265        return addModifier();
8266      } else if (name.equals("programCode")) {
8267        return addProgramCode();
8268      } else if (name.equals("quantity")) {
8269        this.quantity = new Quantity();
8270        return this.quantity;
8271      } else if (name.equals("unitPrice")) {
8272        this.unitPrice = new Money();
8273        return this.unitPrice;
8274      } else if (name.equals("factor")) {
8275        throw new FHIRException("Cannot call addChild on a singleton property Claim.factor");
8276      } else if (name.equals("net")) {
8277        this.net = new Money();
8278        return this.net;
8279      } else if (name.equals("udi")) {
8280        return addUdi();
8281      } else
8282        return super.addChild(name);
8283    }
8284
8285    public SubDetailComponent copy() {
8286      SubDetailComponent dst = new SubDetailComponent();
8287      copyValues(dst);
8288      return dst;
8289    }
8290
8291    public void copyValues(SubDetailComponent dst) {
8292      super.copyValues(dst);
8293      dst.sequence = sequence == null ? null : sequence.copy();
8294      dst.revenue = revenue == null ? null : revenue.copy();
8295      dst.category = category == null ? null : category.copy();
8296      dst.productOrService = productOrService == null ? null : productOrService.copy();
8297      if (modifier != null) {
8298        dst.modifier = new ArrayList<CodeableConcept>();
8299        for (CodeableConcept i : modifier)
8300          dst.modifier.add(i.copy());
8301      }
8302      ;
8303      if (programCode != null) {
8304        dst.programCode = new ArrayList<CodeableConcept>();
8305        for (CodeableConcept i : programCode)
8306          dst.programCode.add(i.copy());
8307      }
8308      ;
8309      dst.quantity = quantity == null ? null : quantity.copy();
8310      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
8311      dst.factor = factor == null ? null : factor.copy();
8312      dst.net = net == null ? null : net.copy();
8313      if (udi != null) {
8314        dst.udi = new ArrayList<Reference>();
8315        for (Reference i : udi)
8316          dst.udi.add(i.copy());
8317      }
8318      ;
8319    }
8320
8321    @Override
8322    public boolean equalsDeep(Base other_) {
8323      if (!super.equalsDeep(other_))
8324        return false;
8325      if (!(other_ instanceof SubDetailComponent))
8326        return false;
8327      SubDetailComponent o = (SubDetailComponent) other_;
8328      return compareDeep(sequence, o.sequence, true) && compareDeep(revenue, o.revenue, true)
8329          && compareDeep(category, o.category, true) && compareDeep(productOrService, o.productOrService, true)
8330          && compareDeep(modifier, o.modifier, true) && compareDeep(programCode, o.programCode, true)
8331          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
8332          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true) && compareDeep(udi, o.udi, true);
8333    }
8334
8335    @Override
8336    public boolean equalsShallow(Base other_) {
8337      if (!super.equalsShallow(other_))
8338        return false;
8339      if (!(other_ instanceof SubDetailComponent))
8340        return false;
8341      SubDetailComponent o = (SubDetailComponent) other_;
8342      return compareValues(sequence, o.sequence, true) && compareValues(factor, o.factor, true);
8343    }
8344
8345    public boolean isEmpty() {
8346      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, revenue, category, productOrService,
8347          modifier, programCode, quantity, unitPrice, factor, net, udi);
8348    }
8349
8350    public String fhirType() {
8351      return "Claim.item.detail.subDetail";
8352
8353    }
8354
8355  }
8356
8357  /**
8358   * A unique identifier assigned to this claim.
8359   */
8360  @Child(name = "identifier", type = {
8361      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8362  @Description(shortDefinition = "Business Identifier for claim", formalDefinition = "A unique identifier assigned to this claim.")
8363  protected List<Identifier> identifier;
8364
8365  /**
8366   * The status of the resource instance.
8367   */
8368  @Child(name = "status", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = true, summary = true)
8369  @Description(shortDefinition = "active | cancelled | draft | entered-in-error", formalDefinition = "The status of the resource instance.")
8370  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/fm-status")
8371  protected Enumeration<ClaimStatus> status;
8372
8373  /**
8374   * The category of claim, e.g. oral, pharmacy, vision, institutional,
8375   * professional.
8376   */
8377  @Child(name = "type", type = { CodeableConcept.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
8378  @Description(shortDefinition = "Category or discipline", formalDefinition = "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.")
8379  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-type")
8380  protected CodeableConcept type;
8381
8382  /**
8383   * A finer grained suite of claim type codes which may convey additional
8384   * information such as Inpatient vs Outpatient and/or a specialty service.
8385   */
8386  @Child(name = "subType", type = {
8387      CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
8388  @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.")
8389  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-subtype")
8390  protected CodeableConcept subType;
8391
8392  /**
8393   * A code to indicate whether the nature of the request is: to request
8394   * adjudication of products and services previously rendered; or requesting
8395   * authorization and adjudication for provision in the future; or requesting the
8396   * non-binding adjudication of the listed products and services which could be
8397   * provided in the future.
8398   */
8399  @Child(name = "use", type = { CodeType.class }, order = 4, min = 1, max = 1, modifier = false, summary = true)
8400  @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.")
8401  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-use")
8402  protected Enumeration<Use> use;
8403
8404  /**
8405   * The party to whom the professional services and/or products have been
8406   * supplied or are being considered and for whom actual or forecast
8407   * reimbursement is sought.
8408   */
8409  @Child(name = "patient", type = { Patient.class }, order = 5, min = 1, max = 1, modifier = false, summary = true)
8410  @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.")
8411  protected Reference patient;
8412
8413  /**
8414   * The actual object that is the target of the reference (The party to whom the
8415   * professional services and/or products have been supplied or are being
8416   * considered and for whom actual or forecast reimbursement is sought.)
8417   */
8418  protected Patient patientTarget;
8419
8420  /**
8421   * The period for which charges are being submitted.
8422   */
8423  @Child(name = "billablePeriod", type = {
8424      Period.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
8425  @Description(shortDefinition = "Relevant time frame for the claim", formalDefinition = "The period for which charges are being submitted.")
8426  protected Period billablePeriod;
8427
8428  /**
8429   * The date this resource was created.
8430   */
8431  @Child(name = "created", type = { DateTimeType.class }, order = 7, min = 1, max = 1, modifier = false, summary = true)
8432  @Description(shortDefinition = "Resource creation date", formalDefinition = "The date this resource was created.")
8433  protected DateTimeType created;
8434
8435  /**
8436   * Individual who created the claim, predetermination or preauthorization.
8437   */
8438  @Child(name = "enterer", type = { Practitioner.class,
8439      PractitionerRole.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
8440  @Description(shortDefinition = "Author of the claim", formalDefinition = "Individual who created the claim, predetermination or preauthorization.")
8441  protected Reference enterer;
8442
8443  /**
8444   * The actual object that is the target of the reference (Individual who created
8445   * the claim, predetermination or preauthorization.)
8446   */
8447  protected Resource entererTarget;
8448
8449  /**
8450   * The Insurer who is target of the request.
8451   */
8452  @Child(name = "insurer", type = { Organization.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
8453  @Description(shortDefinition = "Target", formalDefinition = "The Insurer who is target of the request.")
8454  protected Reference insurer;
8455
8456  /**
8457   * The actual object that is the target of the reference (The Insurer who is
8458   * target of the request.)
8459   */
8460  protected Organization insurerTarget;
8461
8462  /**
8463   * The provider which is responsible for the claim, predetermination or
8464   * preauthorization.
8465   */
8466  @Child(name = "provider", type = { Practitioner.class, PractitionerRole.class,
8467      Organization.class }, order = 10, min = 1, max = 1, modifier = false, summary = true)
8468  @Description(shortDefinition = "Party responsible for the claim", formalDefinition = "The provider which is responsible for the claim, predetermination or preauthorization.")
8469  protected Reference provider;
8470
8471  /**
8472   * The actual object that is the target of the reference (The provider which is
8473   * responsible for the claim, predetermination or preauthorization.)
8474   */
8475  protected Resource providerTarget;
8476
8477  /**
8478   * The provider-required urgency of processing the request. Typical values
8479   * include: stat, routine deferred.
8480   */
8481  @Child(name = "priority", type = {
8482      CodeableConcept.class }, order = 11, min = 1, max = 1, modifier = false, summary = true)
8483  @Description(shortDefinition = "Desired processing ugency", formalDefinition = "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.")
8484  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/process-priority")
8485  protected CodeableConcept priority;
8486
8487  /**
8488   * A code to indicate whether and for whom funds are to be reserved for future
8489   * claims.
8490   */
8491  @Child(name = "fundsReserve", type = {
8492      CodeableConcept.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
8493  @Description(shortDefinition = "For whom to reserve funds", formalDefinition = "A code to indicate whether and for whom funds are to be reserved for future claims.")
8494  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/fundsreserve")
8495  protected CodeableConcept fundsReserve;
8496
8497  /**
8498   * Other claims which are related to this claim such as prior submissions or
8499   * claims for related services or for the same event.
8500   */
8501  @Child(name = "related", type = {}, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8502  @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.")
8503  protected List<RelatedClaimComponent> related;
8504
8505  /**
8506   * Prescription to support the dispensing of pharmacy, device or vision
8507   * products.
8508   */
8509  @Child(name = "prescription", type = { DeviceRequest.class, MedicationRequest.class,
8510      VisionPrescription.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
8511  @Description(shortDefinition = "Prescription authorizing services and products", formalDefinition = "Prescription to support the dispensing of pharmacy, device or vision products.")
8512  protected Reference prescription;
8513
8514  /**
8515   * The actual object that is the target of the reference (Prescription to
8516   * support the dispensing of pharmacy, device or vision products.)
8517   */
8518  protected Resource prescriptionTarget;
8519
8520  /**
8521   * Original prescription which has been superseded by this prescription to
8522   * support the dispensing of pharmacy services, medications or products.
8523   */
8524  @Child(name = "originalPrescription", type = { DeviceRequest.class, MedicationRequest.class,
8525      VisionPrescription.class }, order = 15, min = 0, max = 1, modifier = false, summary = false)
8526  @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.")
8527  protected Reference originalPrescription;
8528
8529  /**
8530   * The actual object that is the target of the reference (Original prescription
8531   * which has been superseded by this prescription to support the dispensing of
8532   * pharmacy services, medications or products.)
8533   */
8534  protected Resource originalPrescriptionTarget;
8535
8536  /**
8537   * The party to be reimbursed for cost of the products and services according to
8538   * the terms of the policy.
8539   */
8540  @Child(name = "payee", type = {}, order = 16, min = 0, max = 1, modifier = false, summary = false)
8541  @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.")
8542  protected PayeeComponent payee;
8543
8544  /**
8545   * A reference to a referral resource.
8546   */
8547  @Child(name = "referral", type = {
8548      ServiceRequest.class }, order = 17, min = 0, max = 1, modifier = false, summary = false)
8549  @Description(shortDefinition = "Treatment referral", formalDefinition = "A reference to a referral resource.")
8550  protected Reference referral;
8551
8552  /**
8553   * The actual object that is the target of the reference (A reference to a
8554   * referral resource.)
8555   */
8556  protected ServiceRequest referralTarget;
8557
8558  /**
8559   * Facility where the services were provided.
8560   */
8561  @Child(name = "facility", type = { Location.class }, order = 18, min = 0, max = 1, modifier = false, summary = false)
8562  @Description(shortDefinition = "Servicing facility", formalDefinition = "Facility where the services were provided.")
8563  protected Reference facility;
8564
8565  /**
8566   * The actual object that is the target of the reference (Facility where the
8567   * services were provided.)
8568   */
8569  protected Location facilityTarget;
8570
8571  /**
8572   * The members of the team who provided the products and services.
8573   */
8574  @Child(name = "careTeam", type = {}, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8575  @Description(shortDefinition = "Members of the care team", formalDefinition = "The members of the team who provided the products and services.")
8576  protected List<CareTeamComponent> careTeam;
8577
8578  /**
8579   * Additional information codes regarding exceptions, special considerations,
8580   * the condition, situation, prior or concurrent issues.
8581   */
8582  @Child(name = "supportingInfo", type = {}, order = 20, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8583  @Description(shortDefinition = "Supporting information", formalDefinition = "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.")
8584  protected List<SupportingInformationComponent> supportingInfo;
8585
8586  /**
8587   * Information about diagnoses relevant to the claim items.
8588   */
8589  @Child(name = "diagnosis", type = {}, order = 21, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8590  @Description(shortDefinition = "Pertinent diagnosis information", formalDefinition = "Information about diagnoses relevant to the claim items.")
8591  protected List<DiagnosisComponent> diagnosis;
8592
8593  /**
8594   * Procedures performed on the patient relevant to the billing items with the
8595   * claim.
8596   */
8597  @Child(name = "procedure", type = {}, order = 22, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8598  @Description(shortDefinition = "Clinical procedures performed", formalDefinition = "Procedures performed on the patient relevant to the billing items with the claim.")
8599  protected List<ProcedureComponent> procedure;
8600
8601  /**
8602   * Financial instruments for reimbursement for the health care products and
8603   * services specified on the claim.
8604   */
8605  @Child(name = "insurance", type = {}, order = 23, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
8606  @Description(shortDefinition = "Patient insurance information", formalDefinition = "Financial instruments for reimbursement for the health care products and services specified on the claim.")
8607  protected List<InsuranceComponent> insurance;
8608
8609  /**
8610   * Details of an accident which resulted in injuries which required the products
8611   * and services listed in the claim.
8612   */
8613  @Child(name = "accident", type = {}, order = 24, min = 0, max = 1, modifier = false, summary = false)
8614  @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.")
8615  protected AccidentComponent accident;
8616
8617  /**
8618   * A claim line. Either a simple product or service or a 'group' of details
8619   * which can each be a simple items or groups of sub-details.
8620   */
8621  @Child(name = "item", type = {}, order = 25, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8622  @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.")
8623  protected List<ItemComponent> item;
8624
8625  /**
8626   * The total value of the all the items in the claim.
8627   */
8628  @Child(name = "total", type = { Money.class }, order = 26, min = 0, max = 1, modifier = false, summary = false)
8629  @Description(shortDefinition = "Total claim cost", formalDefinition = "The total value of the all the items in the claim.")
8630  protected Money total;
8631
8632  private static final long serialVersionUID = -80376108L;
8633
8634  /**
8635   * Constructor
8636   */
8637  public Claim() {
8638    super();
8639  }
8640
8641  /**
8642   * Constructor
8643   */
8644  public Claim(Enumeration<ClaimStatus> status, CodeableConcept type, Enumeration<Use> use, Reference patient,
8645      DateTimeType created, Reference provider, CodeableConcept priority) {
8646    super();
8647    this.status = status;
8648    this.type = type;
8649    this.use = use;
8650    this.patient = patient;
8651    this.created = created;
8652    this.provider = provider;
8653    this.priority = priority;
8654  }
8655
8656  /**
8657   * @return {@link #identifier} (A unique identifier assigned to this claim.)
8658   */
8659  public List<Identifier> getIdentifier() {
8660    if (this.identifier == null)
8661      this.identifier = new ArrayList<Identifier>();
8662    return this.identifier;
8663  }
8664
8665  /**
8666   * @return Returns a reference to <code>this</code> for easy method chaining
8667   */
8668  public Claim setIdentifier(List<Identifier> theIdentifier) {
8669    this.identifier = theIdentifier;
8670    return this;
8671  }
8672
8673  public boolean hasIdentifier() {
8674    if (this.identifier == null)
8675      return false;
8676    for (Identifier item : this.identifier)
8677      if (!item.isEmpty())
8678        return true;
8679    return false;
8680  }
8681
8682  public Identifier addIdentifier() { // 3
8683    Identifier t = new Identifier();
8684    if (this.identifier == null)
8685      this.identifier = new ArrayList<Identifier>();
8686    this.identifier.add(t);
8687    return t;
8688  }
8689
8690  public Claim addIdentifier(Identifier t) { // 3
8691    if (t == null)
8692      return this;
8693    if (this.identifier == null)
8694      this.identifier = new ArrayList<Identifier>();
8695    this.identifier.add(t);
8696    return this;
8697  }
8698
8699  /**
8700   * @return The first repetition of repeating field {@link #identifier}, creating
8701   *         it if it does not already exist
8702   */
8703  public Identifier getIdentifierFirstRep() {
8704    if (getIdentifier().isEmpty()) {
8705      addIdentifier();
8706    }
8707    return getIdentifier().get(0);
8708  }
8709
8710  /**
8711   * @return {@link #status} (The status of the resource instance.). This is the
8712   *         underlying object with id, value and extensions. The accessor
8713   *         "getStatus" gives direct access to the value
8714   */
8715  public Enumeration<ClaimStatus> getStatusElement() {
8716    if (this.status == null)
8717      if (Configuration.errorOnAutoCreate())
8718        throw new Error("Attempt to auto-create Claim.status");
8719      else if (Configuration.doAutoCreate())
8720        this.status = new Enumeration<ClaimStatus>(new ClaimStatusEnumFactory()); // bb
8721    return this.status;
8722  }
8723
8724  public boolean hasStatusElement() {
8725    return this.status != null && !this.status.isEmpty();
8726  }
8727
8728  public boolean hasStatus() {
8729    return this.status != null && !this.status.isEmpty();
8730  }
8731
8732  /**
8733   * @param value {@link #status} (The status of the resource instance.). This is
8734   *              the underlying object with id, value and extensions. The
8735   *              accessor "getStatus" gives direct access to the value
8736   */
8737  public Claim setStatusElement(Enumeration<ClaimStatus> value) {
8738    this.status = value;
8739    return this;
8740  }
8741
8742  /**
8743   * @return The status of the resource instance.
8744   */
8745  public ClaimStatus getStatus() {
8746    return this.status == null ? null : this.status.getValue();
8747  }
8748
8749  /**
8750   * @param value The status of the resource instance.
8751   */
8752  public Claim setStatus(ClaimStatus value) {
8753    if (this.status == null)
8754      this.status = new Enumeration<ClaimStatus>(new ClaimStatusEnumFactory());
8755    this.status.setValue(value);
8756    return this;
8757  }
8758
8759  /**
8760   * @return {@link #type} (The category of claim, e.g. oral, pharmacy, vision,
8761   *         institutional, professional.)
8762   */
8763  public CodeableConcept getType() {
8764    if (this.type == null)
8765      if (Configuration.errorOnAutoCreate())
8766        throw new Error("Attempt to auto-create Claim.type");
8767      else if (Configuration.doAutoCreate())
8768        this.type = new CodeableConcept(); // cc
8769    return this.type;
8770  }
8771
8772  public boolean hasType() {
8773    return this.type != null && !this.type.isEmpty();
8774  }
8775
8776  /**
8777   * @param value {@link #type} (The category of claim, e.g. oral, pharmacy,
8778   *              vision, institutional, professional.)
8779   */
8780  public Claim setType(CodeableConcept value) {
8781    this.type = value;
8782    return this;
8783  }
8784
8785  /**
8786   * @return {@link #subType} (A finer grained suite of claim type codes which may
8787   *         convey additional information such as Inpatient vs Outpatient and/or
8788   *         a specialty service.)
8789   */
8790  public CodeableConcept getSubType() {
8791    if (this.subType == null)
8792      if (Configuration.errorOnAutoCreate())
8793        throw new Error("Attempt to auto-create Claim.subType");
8794      else if (Configuration.doAutoCreate())
8795        this.subType = new CodeableConcept(); // cc
8796    return this.subType;
8797  }
8798
8799  public boolean hasSubType() {
8800    return this.subType != null && !this.subType.isEmpty();
8801  }
8802
8803  /**
8804   * @param value {@link #subType} (A finer grained suite of claim type codes
8805   *              which may convey additional information such as Inpatient vs
8806   *              Outpatient and/or a specialty service.)
8807   */
8808  public Claim setSubType(CodeableConcept value) {
8809    this.subType = value;
8810    return this;
8811  }
8812
8813  /**
8814   * @return {@link #use} (A code to indicate whether the nature of the request
8815   *         is: to request adjudication of products and services previously
8816   *         rendered; or requesting authorization and adjudication for provision
8817   *         in the future; or requesting the non-binding adjudication of the
8818   *         listed products and services which could be provided in the future.).
8819   *         This is the underlying object with id, value and extensions. The
8820   *         accessor "getUse" gives direct access to the value
8821   */
8822  public Enumeration<Use> getUseElement() {
8823    if (this.use == null)
8824      if (Configuration.errorOnAutoCreate())
8825        throw new Error("Attempt to auto-create Claim.use");
8826      else if (Configuration.doAutoCreate())
8827        this.use = new Enumeration<Use>(new UseEnumFactory()); // bb
8828    return this.use;
8829  }
8830
8831  public boolean hasUseElement() {
8832    return this.use != null && !this.use.isEmpty();
8833  }
8834
8835  public boolean hasUse() {
8836    return this.use != null && !this.use.isEmpty();
8837  }
8838
8839  /**
8840   * @param value {@link #use} (A code to indicate whether the nature of the
8841   *              request is: to request adjudication of products and services
8842   *              previously rendered; or requesting authorization and
8843   *              adjudication for provision in the future; or requesting the
8844   *              non-binding adjudication of the listed products and services
8845   *              which could be provided in the future.). This is the underlying
8846   *              object with id, value and extensions. The accessor "getUse"
8847   *              gives direct access to the value
8848   */
8849  public Claim setUseElement(Enumeration<Use> value) {
8850    this.use = value;
8851    return this;
8852  }
8853
8854  /**
8855   * @return A code to indicate whether the nature of the request is: to request
8856   *         adjudication of products and services previously rendered; or
8857   *         requesting authorization and adjudication for provision in the
8858   *         future; or requesting the non-binding adjudication of the listed
8859   *         products and services which could be provided in the future.
8860   */
8861  public Use getUse() {
8862    return this.use == null ? null : this.use.getValue();
8863  }
8864
8865  /**
8866   * @param value A code to indicate whether the nature of the request is: to
8867   *              request adjudication of products and services previously
8868   *              rendered; or requesting authorization and adjudication for
8869   *              provision in the future; or requesting the non-binding
8870   *              adjudication of the listed products and services which could be
8871   *              provided in the future.
8872   */
8873  public Claim setUse(Use value) {
8874    if (this.use == null)
8875      this.use = new Enumeration<Use>(new UseEnumFactory());
8876    this.use.setValue(value);
8877    return this;
8878  }
8879
8880  /**
8881   * @return {@link #patient} (The party to whom the professional services and/or
8882   *         products have been supplied or are being considered and for whom
8883   *         actual or forecast reimbursement is sought.)
8884   */
8885  public Reference getPatient() {
8886    if (this.patient == null)
8887      if (Configuration.errorOnAutoCreate())
8888        throw new Error("Attempt to auto-create Claim.patient");
8889      else if (Configuration.doAutoCreate())
8890        this.patient = new Reference(); // cc
8891    return this.patient;
8892  }
8893
8894  public boolean hasPatient() {
8895    return this.patient != null && !this.patient.isEmpty();
8896  }
8897
8898  /**
8899   * @param value {@link #patient} (The party to whom the professional services
8900   *              and/or products have been supplied or are being considered and
8901   *              for whom actual or forecast reimbursement is sought.)
8902   */
8903  public Claim setPatient(Reference value) {
8904    this.patient = value;
8905    return this;
8906  }
8907
8908  /**
8909   * @return {@link #patient} The actual object that is the target of the
8910   *         reference. The reference library doesn't populate this, but you can
8911   *         use it to hold the resource if you resolve it. (The party to whom the
8912   *         professional services and/or products have been supplied or are being
8913   *         considered and for whom actual or forecast reimbursement is sought.)
8914   */
8915  public Patient getPatientTarget() {
8916    if (this.patientTarget == null)
8917      if (Configuration.errorOnAutoCreate())
8918        throw new Error("Attempt to auto-create Claim.patient");
8919      else if (Configuration.doAutoCreate())
8920        this.patientTarget = new Patient(); // aa
8921    return this.patientTarget;
8922  }
8923
8924  /**
8925   * @param value {@link #patient} The actual object that is the target of the
8926   *              reference. The reference library doesn't use these, but you can
8927   *              use it to hold the resource if you resolve it. (The party to
8928   *              whom the professional services and/or products have been
8929   *              supplied or are being considered and for whom actual or forecast
8930   *              reimbursement is sought.)
8931   */
8932  public Claim setPatientTarget(Patient value) {
8933    this.patientTarget = value;
8934    return this;
8935  }
8936
8937  /**
8938   * @return {@link #billablePeriod} (The period for which charges are being
8939   *         submitted.)
8940   */
8941  public Period getBillablePeriod() {
8942    if (this.billablePeriod == null)
8943      if (Configuration.errorOnAutoCreate())
8944        throw new Error("Attempt to auto-create Claim.billablePeriod");
8945      else if (Configuration.doAutoCreate())
8946        this.billablePeriod = new Period(); // cc
8947    return this.billablePeriod;
8948  }
8949
8950  public boolean hasBillablePeriod() {
8951    return this.billablePeriod != null && !this.billablePeriod.isEmpty();
8952  }
8953
8954  /**
8955   * @param value {@link #billablePeriod} (The period for which charges are being
8956   *              submitted.)
8957   */
8958  public Claim setBillablePeriod(Period value) {
8959    this.billablePeriod = value;
8960    return this;
8961  }
8962
8963  /**
8964   * @return {@link #created} (The date this resource was created.). This is the
8965   *         underlying object with id, value and extensions. The accessor
8966   *         "getCreated" gives direct access to the value
8967   */
8968  public DateTimeType getCreatedElement() {
8969    if (this.created == null)
8970      if (Configuration.errorOnAutoCreate())
8971        throw new Error("Attempt to auto-create Claim.created");
8972      else if (Configuration.doAutoCreate())
8973        this.created = new DateTimeType(); // bb
8974    return this.created;
8975  }
8976
8977  public boolean hasCreatedElement() {
8978    return this.created != null && !this.created.isEmpty();
8979  }
8980
8981  public boolean hasCreated() {
8982    return this.created != null && !this.created.isEmpty();
8983  }
8984
8985  /**
8986   * @param value {@link #created} (The date this resource was created.). This is
8987   *              the underlying object with id, value and extensions. The
8988   *              accessor "getCreated" gives direct access to the value
8989   */
8990  public Claim setCreatedElement(DateTimeType value) {
8991    this.created = value;
8992    return this;
8993  }
8994
8995  /**
8996   * @return The date this resource was created.
8997   */
8998  public Date getCreated() {
8999    return this.created == null ? null : this.created.getValue();
9000  }
9001
9002  /**
9003   * @param value The date this resource was created.
9004   */
9005  public Claim setCreated(Date value) {
9006    if (this.created == null)
9007      this.created = new DateTimeType();
9008    this.created.setValue(value);
9009    return this;
9010  }
9011
9012  /**
9013   * @return {@link #enterer} (Individual who created the claim, predetermination
9014   *         or preauthorization.)
9015   */
9016  public Reference getEnterer() {
9017    if (this.enterer == null)
9018      if (Configuration.errorOnAutoCreate())
9019        throw new Error("Attempt to auto-create Claim.enterer");
9020      else if (Configuration.doAutoCreate())
9021        this.enterer = new Reference(); // cc
9022    return this.enterer;
9023  }
9024
9025  public boolean hasEnterer() {
9026    return this.enterer != null && !this.enterer.isEmpty();
9027  }
9028
9029  /**
9030   * @param value {@link #enterer} (Individual who created the claim,
9031   *              predetermination or preauthorization.)
9032   */
9033  public Claim setEnterer(Reference value) {
9034    this.enterer = value;
9035    return this;
9036  }
9037
9038  /**
9039   * @return {@link #enterer} The actual object that is the target of the
9040   *         reference. The reference library doesn't populate this, but you can
9041   *         use it to hold the resource if you resolve it. (Individual who
9042   *         created the claim, predetermination or preauthorization.)
9043   */
9044  public Resource getEntererTarget() {
9045    return this.entererTarget;
9046  }
9047
9048  /**
9049   * @param value {@link #enterer} The actual object that is the target of the
9050   *              reference. The reference library doesn't use these, but you can
9051   *              use it to hold the resource if you resolve it. (Individual who
9052   *              created the claim, predetermination or preauthorization.)
9053   */
9054  public Claim setEntererTarget(Resource value) {
9055    this.entererTarget = value;
9056    return this;
9057  }
9058
9059  /**
9060   * @return {@link #insurer} (The Insurer who is target of the request.)
9061   */
9062  public Reference getInsurer() {
9063    if (this.insurer == null)
9064      if (Configuration.errorOnAutoCreate())
9065        throw new Error("Attempt to auto-create Claim.insurer");
9066      else if (Configuration.doAutoCreate())
9067        this.insurer = new Reference(); // cc
9068    return this.insurer;
9069  }
9070
9071  public boolean hasInsurer() {
9072    return this.insurer != null && !this.insurer.isEmpty();
9073  }
9074
9075  /**
9076   * @param value {@link #insurer} (The Insurer who is target of the request.)
9077   */
9078  public Claim setInsurer(Reference value) {
9079    this.insurer = value;
9080    return this;
9081  }
9082
9083  /**
9084   * @return {@link #insurer} The actual object that is the target of the
9085   *         reference. The reference library doesn't populate this, but you can
9086   *         use it to hold the resource if you resolve it. (The Insurer who is
9087   *         target of the request.)
9088   */
9089  public Organization getInsurerTarget() {
9090    if (this.insurerTarget == null)
9091      if (Configuration.errorOnAutoCreate())
9092        throw new Error("Attempt to auto-create Claim.insurer");
9093      else if (Configuration.doAutoCreate())
9094        this.insurerTarget = new Organization(); // aa
9095    return this.insurerTarget;
9096  }
9097
9098  /**
9099   * @param value {@link #insurer} The actual object that is the target of the
9100   *              reference. The reference library doesn't use these, but you can
9101   *              use it to hold the resource if you resolve it. (The Insurer who
9102   *              is target of the request.)
9103   */
9104  public Claim setInsurerTarget(Organization value) {
9105    this.insurerTarget = value;
9106    return this;
9107  }
9108
9109  /**
9110   * @return {@link #provider} (The provider which is responsible for the claim,
9111   *         predetermination or preauthorization.)
9112   */
9113  public Reference getProvider() {
9114    if (this.provider == null)
9115      if (Configuration.errorOnAutoCreate())
9116        throw new Error("Attempt to auto-create Claim.provider");
9117      else if (Configuration.doAutoCreate())
9118        this.provider = new Reference(); // cc
9119    return this.provider;
9120  }
9121
9122  public boolean hasProvider() {
9123    return this.provider != null && !this.provider.isEmpty();
9124  }
9125
9126  /**
9127   * @param value {@link #provider} (The provider which is responsible for the
9128   *              claim, predetermination or preauthorization.)
9129   */
9130  public Claim setProvider(Reference value) {
9131    this.provider = value;
9132    return this;
9133  }
9134
9135  /**
9136   * @return {@link #provider} The actual object that is the target of the
9137   *         reference. The reference library doesn't populate this, but you can
9138   *         use it to hold the resource if you resolve it. (The provider which is
9139   *         responsible for the claim, predetermination or preauthorization.)
9140   */
9141  public Resource getProviderTarget() {
9142    return this.providerTarget;
9143  }
9144
9145  /**
9146   * @param value {@link #provider} The actual object that is the target of the
9147   *              reference. The reference library doesn't use these, but you can
9148   *              use it to hold the resource if you resolve it. (The provider
9149   *              which is responsible for the claim, predetermination or
9150   *              preauthorization.)
9151   */
9152  public Claim setProviderTarget(Resource value) {
9153    this.providerTarget = value;
9154    return this;
9155  }
9156
9157  /**
9158   * @return {@link #priority} (The provider-required urgency of processing the
9159   *         request. Typical values include: stat, routine deferred.)
9160   */
9161  public CodeableConcept getPriority() {
9162    if (this.priority == null)
9163      if (Configuration.errorOnAutoCreate())
9164        throw new Error("Attempt to auto-create Claim.priority");
9165      else if (Configuration.doAutoCreate())
9166        this.priority = new CodeableConcept(); // cc
9167    return this.priority;
9168  }
9169
9170  public boolean hasPriority() {
9171    return this.priority != null && !this.priority.isEmpty();
9172  }
9173
9174  /**
9175   * @param value {@link #priority} (The provider-required urgency of processing
9176   *              the request. Typical values include: stat, routine deferred.)
9177   */
9178  public Claim setPriority(CodeableConcept value) {
9179    this.priority = value;
9180    return this;
9181  }
9182
9183  /**
9184   * @return {@link #fundsReserve} (A code to indicate whether and for whom funds
9185   *         are to be reserved for future claims.)
9186   */
9187  public CodeableConcept getFundsReserve() {
9188    if (this.fundsReserve == null)
9189      if (Configuration.errorOnAutoCreate())
9190        throw new Error("Attempt to auto-create Claim.fundsReserve");
9191      else if (Configuration.doAutoCreate())
9192        this.fundsReserve = new CodeableConcept(); // cc
9193    return this.fundsReserve;
9194  }
9195
9196  public boolean hasFundsReserve() {
9197    return this.fundsReserve != null && !this.fundsReserve.isEmpty();
9198  }
9199
9200  /**
9201   * @param value {@link #fundsReserve} (A code to indicate whether and for whom
9202   *              funds are to be reserved for future claims.)
9203   */
9204  public Claim setFundsReserve(CodeableConcept value) {
9205    this.fundsReserve = value;
9206    return this;
9207  }
9208
9209  /**
9210   * @return {@link #related} (Other claims which are related to this claim such
9211   *         as prior submissions or claims for related services or for the same
9212   *         event.)
9213   */
9214  public List<RelatedClaimComponent> getRelated() {
9215    if (this.related == null)
9216      this.related = new ArrayList<RelatedClaimComponent>();
9217    return this.related;
9218  }
9219
9220  /**
9221   * @return Returns a reference to <code>this</code> for easy method chaining
9222   */
9223  public Claim setRelated(List<RelatedClaimComponent> theRelated) {
9224    this.related = theRelated;
9225    return this;
9226  }
9227
9228  public boolean hasRelated() {
9229    if (this.related == null)
9230      return false;
9231    for (RelatedClaimComponent item : this.related)
9232      if (!item.isEmpty())
9233        return true;
9234    return false;
9235  }
9236
9237  public RelatedClaimComponent addRelated() { // 3
9238    RelatedClaimComponent t = new RelatedClaimComponent();
9239    if (this.related == null)
9240      this.related = new ArrayList<RelatedClaimComponent>();
9241    this.related.add(t);
9242    return t;
9243  }
9244
9245  public Claim addRelated(RelatedClaimComponent t) { // 3
9246    if (t == null)
9247      return this;
9248    if (this.related == null)
9249      this.related = new ArrayList<RelatedClaimComponent>();
9250    this.related.add(t);
9251    return this;
9252  }
9253
9254  /**
9255   * @return The first repetition of repeating field {@link #related}, creating it
9256   *         if it does not already exist
9257   */
9258  public RelatedClaimComponent getRelatedFirstRep() {
9259    if (getRelated().isEmpty()) {
9260      addRelated();
9261    }
9262    return getRelated().get(0);
9263  }
9264
9265  /**
9266   * @return {@link #prescription} (Prescription to support the dispensing of
9267   *         pharmacy, device or vision products.)
9268   */
9269  public Reference getPrescription() {
9270    if (this.prescription == null)
9271      if (Configuration.errorOnAutoCreate())
9272        throw new Error("Attempt to auto-create Claim.prescription");
9273      else if (Configuration.doAutoCreate())
9274        this.prescription = new Reference(); // cc
9275    return this.prescription;
9276  }
9277
9278  public boolean hasPrescription() {
9279    return this.prescription != null && !this.prescription.isEmpty();
9280  }
9281
9282  /**
9283   * @param value {@link #prescription} (Prescription to support the dispensing of
9284   *              pharmacy, device or vision products.)
9285   */
9286  public Claim setPrescription(Reference value) {
9287    this.prescription = value;
9288    return this;
9289  }
9290
9291  /**
9292   * @return {@link #prescription} The actual object that is the target of the
9293   *         reference. The reference library doesn't populate this, but you can
9294   *         use it to hold the resource if you resolve it. (Prescription to
9295   *         support the dispensing of pharmacy, device or vision products.)
9296   */
9297  public Resource getPrescriptionTarget() {
9298    return this.prescriptionTarget;
9299  }
9300
9301  /**
9302   * @param value {@link #prescription} The actual object that is the target of
9303   *              the reference. The reference library doesn't use these, but you
9304   *              can use it to hold the resource if you resolve it. (Prescription
9305   *              to support the dispensing of pharmacy, device or vision
9306   *              products.)
9307   */
9308  public Claim setPrescriptionTarget(Resource value) {
9309    this.prescriptionTarget = value;
9310    return this;
9311  }
9312
9313  /**
9314   * @return {@link #originalPrescription} (Original prescription which has been
9315   *         superseded by this prescription to support the dispensing of pharmacy
9316   *         services, medications or products.)
9317   */
9318  public Reference getOriginalPrescription() {
9319    if (this.originalPrescription == null)
9320      if (Configuration.errorOnAutoCreate())
9321        throw new Error("Attempt to auto-create Claim.originalPrescription");
9322      else if (Configuration.doAutoCreate())
9323        this.originalPrescription = new Reference(); // cc
9324    return this.originalPrescription;
9325  }
9326
9327  public boolean hasOriginalPrescription() {
9328    return this.originalPrescription != null && !this.originalPrescription.isEmpty();
9329  }
9330
9331  /**
9332   * @param value {@link #originalPrescription} (Original prescription which has
9333   *              been superseded by this prescription to support the dispensing
9334   *              of pharmacy services, medications or products.)
9335   */
9336  public Claim setOriginalPrescription(Reference value) {
9337    this.originalPrescription = value;
9338    return this;
9339  }
9340
9341  /**
9342   * @return {@link #originalPrescription} The actual object that is the target of
9343   *         the reference. The reference library doesn't populate this, but you
9344   *         can use it to hold the resource if you resolve it. (Original
9345   *         prescription which has been superseded by this prescription to
9346   *         support the dispensing of pharmacy services, medications or
9347   *         products.)
9348   */
9349  public Resource getOriginalPrescriptionTarget() {
9350    return this.originalPrescriptionTarget;
9351  }
9352
9353  /**
9354   * @param value {@link #originalPrescription} The actual object that is the
9355   *              target of the reference. The reference library doesn't use
9356   *              these, but you can use it to hold the resource if you resolve
9357   *              it. (Original prescription which has been superseded by this
9358   *              prescription to support the dispensing of pharmacy services,
9359   *              medications or products.)
9360   */
9361  public Claim setOriginalPrescriptionTarget(Resource value) {
9362    this.originalPrescriptionTarget = value;
9363    return this;
9364  }
9365
9366  /**
9367   * @return {@link #payee} (The party to be reimbursed for cost of the products
9368   *         and services according to the terms of the policy.)
9369   */
9370  public PayeeComponent getPayee() {
9371    if (this.payee == null)
9372      if (Configuration.errorOnAutoCreate())
9373        throw new Error("Attempt to auto-create Claim.payee");
9374      else if (Configuration.doAutoCreate())
9375        this.payee = new PayeeComponent(); // cc
9376    return this.payee;
9377  }
9378
9379  public boolean hasPayee() {
9380    return this.payee != null && !this.payee.isEmpty();
9381  }
9382
9383  /**
9384   * @param value {@link #payee} (The party to be reimbursed for cost of the
9385   *              products and services according to the terms of the policy.)
9386   */
9387  public Claim setPayee(PayeeComponent value) {
9388    this.payee = value;
9389    return this;
9390  }
9391
9392  /**
9393   * @return {@link #referral} (A reference to a referral resource.)
9394   */
9395  public Reference getReferral() {
9396    if (this.referral == null)
9397      if (Configuration.errorOnAutoCreate())
9398        throw new Error("Attempt to auto-create Claim.referral");
9399      else if (Configuration.doAutoCreate())
9400        this.referral = new Reference(); // cc
9401    return this.referral;
9402  }
9403
9404  public boolean hasReferral() {
9405    return this.referral != null && !this.referral.isEmpty();
9406  }
9407
9408  /**
9409   * @param value {@link #referral} (A reference to a referral resource.)
9410   */
9411  public Claim setReferral(Reference value) {
9412    this.referral = value;
9413    return this;
9414  }
9415
9416  /**
9417   * @return {@link #referral} The actual object that is the target of the
9418   *         reference. The reference library doesn't populate this, but you can
9419   *         use it to hold the resource if you resolve it. (A reference to a
9420   *         referral resource.)
9421   */
9422  public ServiceRequest getReferralTarget() {
9423    if (this.referralTarget == null)
9424      if (Configuration.errorOnAutoCreate())
9425        throw new Error("Attempt to auto-create Claim.referral");
9426      else if (Configuration.doAutoCreate())
9427        this.referralTarget = new ServiceRequest(); // aa
9428    return this.referralTarget;
9429  }
9430
9431  /**
9432   * @param value {@link #referral} The actual object that is the target of the
9433   *              reference. The reference library doesn't use these, but you can
9434   *              use it to hold the resource if you resolve it. (A reference to a
9435   *              referral resource.)
9436   */
9437  public Claim setReferralTarget(ServiceRequest value) {
9438    this.referralTarget = value;
9439    return this;
9440  }
9441
9442  /**
9443   * @return {@link #facility} (Facility where the services were provided.)
9444   */
9445  public Reference getFacility() {
9446    if (this.facility == null)
9447      if (Configuration.errorOnAutoCreate())
9448        throw new Error("Attempt to auto-create Claim.facility");
9449      else if (Configuration.doAutoCreate())
9450        this.facility = new Reference(); // cc
9451    return this.facility;
9452  }
9453
9454  public boolean hasFacility() {
9455    return this.facility != null && !this.facility.isEmpty();
9456  }
9457
9458  /**
9459   * @param value {@link #facility} (Facility where the services were provided.)
9460   */
9461  public Claim setFacility(Reference value) {
9462    this.facility = value;
9463    return this;
9464  }
9465
9466  /**
9467   * @return {@link #facility} The actual object that is the target of the
9468   *         reference. The reference library doesn't populate this, but you can
9469   *         use it to hold the resource if you resolve it. (Facility where the
9470   *         services were provided.)
9471   */
9472  public Location getFacilityTarget() {
9473    if (this.facilityTarget == null)
9474      if (Configuration.errorOnAutoCreate())
9475        throw new Error("Attempt to auto-create Claim.facility");
9476      else if (Configuration.doAutoCreate())
9477        this.facilityTarget = new Location(); // aa
9478    return this.facilityTarget;
9479  }
9480
9481  /**
9482   * @param value {@link #facility} The actual object that is the target of the
9483   *              reference. The reference library doesn't use these, but you can
9484   *              use it to hold the resource if you resolve it. (Facility where
9485   *              the services were provided.)
9486   */
9487  public Claim setFacilityTarget(Location value) {
9488    this.facilityTarget = value;
9489    return this;
9490  }
9491
9492  /**
9493   * @return {@link #careTeam} (The members of the team who provided the products
9494   *         and services.)
9495   */
9496  public List<CareTeamComponent> getCareTeam() {
9497    if (this.careTeam == null)
9498      this.careTeam = new ArrayList<CareTeamComponent>();
9499    return this.careTeam;
9500  }
9501
9502  /**
9503   * @return Returns a reference to <code>this</code> for easy method chaining
9504   */
9505  public Claim setCareTeam(List<CareTeamComponent> theCareTeam) {
9506    this.careTeam = theCareTeam;
9507    return this;
9508  }
9509
9510  public boolean hasCareTeam() {
9511    if (this.careTeam == null)
9512      return false;
9513    for (CareTeamComponent item : this.careTeam)
9514      if (!item.isEmpty())
9515        return true;
9516    return false;
9517  }
9518
9519  public CareTeamComponent addCareTeam() { // 3
9520    CareTeamComponent t = new CareTeamComponent();
9521    if (this.careTeam == null)
9522      this.careTeam = new ArrayList<CareTeamComponent>();
9523    this.careTeam.add(t);
9524    return t;
9525  }
9526
9527  public Claim addCareTeam(CareTeamComponent t) { // 3
9528    if (t == null)
9529      return this;
9530    if (this.careTeam == null)
9531      this.careTeam = new ArrayList<CareTeamComponent>();
9532    this.careTeam.add(t);
9533    return this;
9534  }
9535
9536  /**
9537   * @return The first repetition of repeating field {@link #careTeam}, creating
9538   *         it if it does not already exist
9539   */
9540  public CareTeamComponent getCareTeamFirstRep() {
9541    if (getCareTeam().isEmpty()) {
9542      addCareTeam();
9543    }
9544    return getCareTeam().get(0);
9545  }
9546
9547  /**
9548   * @return {@link #supportingInfo} (Additional information codes regarding
9549   *         exceptions, special considerations, the condition, situation, prior
9550   *         or concurrent issues.)
9551   */
9552  public List<SupportingInformationComponent> getSupportingInfo() {
9553    if (this.supportingInfo == null)
9554      this.supportingInfo = new ArrayList<SupportingInformationComponent>();
9555    return this.supportingInfo;
9556  }
9557
9558  /**
9559   * @return Returns a reference to <code>this</code> for easy method chaining
9560   */
9561  public Claim setSupportingInfo(List<SupportingInformationComponent> theSupportingInfo) {
9562    this.supportingInfo = theSupportingInfo;
9563    return this;
9564  }
9565
9566  public boolean hasSupportingInfo() {
9567    if (this.supportingInfo == null)
9568      return false;
9569    for (SupportingInformationComponent item : this.supportingInfo)
9570      if (!item.isEmpty())
9571        return true;
9572    return false;
9573  }
9574
9575  public SupportingInformationComponent addSupportingInfo() { // 3
9576    SupportingInformationComponent t = new SupportingInformationComponent();
9577    if (this.supportingInfo == null)
9578      this.supportingInfo = new ArrayList<SupportingInformationComponent>();
9579    this.supportingInfo.add(t);
9580    return t;
9581  }
9582
9583  public Claim addSupportingInfo(SupportingInformationComponent t) { // 3
9584    if (t == null)
9585      return this;
9586    if (this.supportingInfo == null)
9587      this.supportingInfo = new ArrayList<SupportingInformationComponent>();
9588    this.supportingInfo.add(t);
9589    return this;
9590  }
9591
9592  /**
9593   * @return The first repetition of repeating field {@link #supportingInfo},
9594   *         creating it if it does not already exist
9595   */
9596  public SupportingInformationComponent getSupportingInfoFirstRep() {
9597    if (getSupportingInfo().isEmpty()) {
9598      addSupportingInfo();
9599    }
9600    return getSupportingInfo().get(0);
9601  }
9602
9603  /**
9604   * @return {@link #diagnosis} (Information about diagnoses relevant to the claim
9605   *         items.)
9606   */
9607  public List<DiagnosisComponent> getDiagnosis() {
9608    if (this.diagnosis == null)
9609      this.diagnosis = new ArrayList<DiagnosisComponent>();
9610    return this.diagnosis;
9611  }
9612
9613  /**
9614   * @return Returns a reference to <code>this</code> for easy method chaining
9615   */
9616  public Claim setDiagnosis(List<DiagnosisComponent> theDiagnosis) {
9617    this.diagnosis = theDiagnosis;
9618    return this;
9619  }
9620
9621  public boolean hasDiagnosis() {
9622    if (this.diagnosis == null)
9623      return false;
9624    for (DiagnosisComponent item : this.diagnosis)
9625      if (!item.isEmpty())
9626        return true;
9627    return false;
9628  }
9629
9630  public DiagnosisComponent addDiagnosis() { // 3
9631    DiagnosisComponent t = new DiagnosisComponent();
9632    if (this.diagnosis == null)
9633      this.diagnosis = new ArrayList<DiagnosisComponent>();
9634    this.diagnosis.add(t);
9635    return t;
9636  }
9637
9638  public Claim addDiagnosis(DiagnosisComponent t) { // 3
9639    if (t == null)
9640      return this;
9641    if (this.diagnosis == null)
9642      this.diagnosis = new ArrayList<DiagnosisComponent>();
9643    this.diagnosis.add(t);
9644    return this;
9645  }
9646
9647  /**
9648   * @return The first repetition of repeating field {@link #diagnosis}, creating
9649   *         it if it does not already exist
9650   */
9651  public DiagnosisComponent getDiagnosisFirstRep() {
9652    if (getDiagnosis().isEmpty()) {
9653      addDiagnosis();
9654    }
9655    return getDiagnosis().get(0);
9656  }
9657
9658  /**
9659   * @return {@link #procedure} (Procedures performed on the patient relevant to
9660   *         the billing items with the claim.)
9661   */
9662  public List<ProcedureComponent> getProcedure() {
9663    if (this.procedure == null)
9664      this.procedure = new ArrayList<ProcedureComponent>();
9665    return this.procedure;
9666  }
9667
9668  /**
9669   * @return Returns a reference to <code>this</code> for easy method chaining
9670   */
9671  public Claim setProcedure(List<ProcedureComponent> theProcedure) {
9672    this.procedure = theProcedure;
9673    return this;
9674  }
9675
9676  public boolean hasProcedure() {
9677    if (this.procedure == null)
9678      return false;
9679    for (ProcedureComponent item : this.procedure)
9680      if (!item.isEmpty())
9681        return true;
9682    return false;
9683  }
9684
9685  public ProcedureComponent addProcedure() { // 3
9686    ProcedureComponent t = new ProcedureComponent();
9687    if (this.procedure == null)
9688      this.procedure = new ArrayList<ProcedureComponent>();
9689    this.procedure.add(t);
9690    return t;
9691  }
9692
9693  public Claim addProcedure(ProcedureComponent t) { // 3
9694    if (t == null)
9695      return this;
9696    if (this.procedure == null)
9697      this.procedure = new ArrayList<ProcedureComponent>();
9698    this.procedure.add(t);
9699    return this;
9700  }
9701
9702  /**
9703   * @return The first repetition of repeating field {@link #procedure}, creating
9704   *         it if it does not already exist
9705   */
9706  public ProcedureComponent getProcedureFirstRep() {
9707    if (getProcedure().isEmpty()) {
9708      addProcedure();
9709    }
9710    return getProcedure().get(0);
9711  }
9712
9713  /**
9714   * @return {@link #insurance} (Financial instruments for reimbursement for the
9715   *         health care products and services specified on the claim.)
9716   */
9717  public List<InsuranceComponent> getInsurance() {
9718    if (this.insurance == null)
9719      this.insurance = new ArrayList<InsuranceComponent>();
9720    return this.insurance;
9721  }
9722
9723  /**
9724   * @return Returns a reference to <code>this</code> for easy method chaining
9725   */
9726  public Claim setInsurance(List<InsuranceComponent> theInsurance) {
9727    this.insurance = theInsurance;
9728    return this;
9729  }
9730
9731  public boolean hasInsurance() {
9732    if (this.insurance == null)
9733      return false;
9734    for (InsuranceComponent item : this.insurance)
9735      if (!item.isEmpty())
9736        return true;
9737    return false;
9738  }
9739
9740  public InsuranceComponent addInsurance() { // 3
9741    InsuranceComponent t = new InsuranceComponent();
9742    if (this.insurance == null)
9743      this.insurance = new ArrayList<InsuranceComponent>();
9744    this.insurance.add(t);
9745    return t;
9746  }
9747
9748  public Claim addInsurance(InsuranceComponent t) { // 3
9749    if (t == null)
9750      return this;
9751    if (this.insurance == null)
9752      this.insurance = new ArrayList<InsuranceComponent>();
9753    this.insurance.add(t);
9754    return this;
9755  }
9756
9757  /**
9758   * @return The first repetition of repeating field {@link #insurance}, creating
9759   *         it if it does not already exist
9760   */
9761  public InsuranceComponent getInsuranceFirstRep() {
9762    if (getInsurance().isEmpty()) {
9763      addInsurance();
9764    }
9765    return getInsurance().get(0);
9766  }
9767
9768  /**
9769   * @return {@link #accident} (Details of an accident which resulted in injuries
9770   *         which required the products and services listed in the claim.)
9771   */
9772  public AccidentComponent getAccident() {
9773    if (this.accident == null)
9774      if (Configuration.errorOnAutoCreate())
9775        throw new Error("Attempt to auto-create Claim.accident");
9776      else if (Configuration.doAutoCreate())
9777        this.accident = new AccidentComponent(); // cc
9778    return this.accident;
9779  }
9780
9781  public boolean hasAccident() {
9782    return this.accident != null && !this.accident.isEmpty();
9783  }
9784
9785  /**
9786   * @param value {@link #accident} (Details of an accident which resulted in
9787   *              injuries which required the products and services listed in the
9788   *              claim.)
9789   */
9790  public Claim setAccident(AccidentComponent value) {
9791    this.accident = value;
9792    return this;
9793  }
9794
9795  /**
9796   * @return {@link #item} (A claim line. Either a simple product or service or a
9797   *         'group' of details which can each be a simple items or groups of
9798   *         sub-details.)
9799   */
9800  public List<ItemComponent> getItem() {
9801    if (this.item == null)
9802      this.item = new ArrayList<ItemComponent>();
9803    return this.item;
9804  }
9805
9806  /**
9807   * @return Returns a reference to <code>this</code> for easy method chaining
9808   */
9809  public Claim setItem(List<ItemComponent> theItem) {
9810    this.item = theItem;
9811    return this;
9812  }
9813
9814  public boolean hasItem() {
9815    if (this.item == null)
9816      return false;
9817    for (ItemComponent item : this.item)
9818      if (!item.isEmpty())
9819        return true;
9820    return false;
9821  }
9822
9823  public ItemComponent addItem() { // 3
9824    ItemComponent t = new ItemComponent();
9825    if (this.item == null)
9826      this.item = new ArrayList<ItemComponent>();
9827    this.item.add(t);
9828    return t;
9829  }
9830
9831  public Claim addItem(ItemComponent t) { // 3
9832    if (t == null)
9833      return this;
9834    if (this.item == null)
9835      this.item = new ArrayList<ItemComponent>();
9836    this.item.add(t);
9837    return this;
9838  }
9839
9840  /**
9841   * @return The first repetition of repeating field {@link #item}, creating it if
9842   *         it does not already exist
9843   */
9844  public ItemComponent getItemFirstRep() {
9845    if (getItem().isEmpty()) {
9846      addItem();
9847    }
9848    return getItem().get(0);
9849  }
9850
9851  /**
9852   * @return {@link #total} (The total value of the all the items in the claim.)
9853   */
9854  public Money getTotal() {
9855    if (this.total == null)
9856      if (Configuration.errorOnAutoCreate())
9857        throw new Error("Attempt to auto-create Claim.total");
9858      else if (Configuration.doAutoCreate())
9859        this.total = new Money(); // cc
9860    return this.total;
9861  }
9862
9863  public boolean hasTotal() {
9864    return this.total != null && !this.total.isEmpty();
9865  }
9866
9867  /**
9868   * @param value {@link #total} (The total value of the all the items in the
9869   *              claim.)
9870   */
9871  public Claim setTotal(Money value) {
9872    this.total = value;
9873    return this;
9874  }
9875
9876  protected void listChildren(List<Property> children) {
9877    super.listChildren(children);
9878    children.add(new Property("identifier", "Identifier", "A unique identifier assigned to this claim.", 0,
9879        java.lang.Integer.MAX_VALUE, identifier));
9880    children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
9881    children.add(new Property("type", "CodeableConcept",
9882        "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type));
9883    children.add(new Property("subType", "CodeableConcept",
9884        "A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.",
9885        0, 1, subType));
9886    children.add(new Property("use", "code",
9887        "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.",
9888        0, 1, use));
9889    children.add(new Property("patient", "Reference(Patient)",
9890        "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.",
9891        0, 1, patient));
9892    children.add(new Property("billablePeriod", "Period", "The period for which charges are being submitted.", 0, 1,
9893        billablePeriod));
9894    children.add(new Property("created", "dateTime", "The date this resource was created.", 0, 1, created));
9895    children.add(new Property("enterer", "Reference(Practitioner|PractitionerRole)",
9896        "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer));
9897    children.add(
9898        new Property("insurer", "Reference(Organization)", "The Insurer who is target of the request.", 0, 1, insurer));
9899    children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
9900        "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider));
9901    children.add(new Property("priority", "CodeableConcept",
9902        "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.", 0,
9903        1, priority));
9904    children.add(new Property("fundsReserve", "CodeableConcept",
9905        "A code to indicate whether and for whom funds are to be reserved for future claims.", 0, 1, fundsReserve));
9906    children.add(new Property("related", "",
9907        "Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.",
9908        0, java.lang.Integer.MAX_VALUE, related));
9909    children.add(new Property("prescription", "Reference(DeviceRequest|MedicationRequest|VisionPrescription)",
9910        "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription));
9911    children.add(new Property("originalPrescription", "Reference(DeviceRequest|MedicationRequest|VisionPrescription)",
9912        "Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.",
9913        0, 1, originalPrescription));
9914    children.add(new Property("payee", "",
9915        "The party to be reimbursed for cost of the products and services according to the terms of the policy.", 0, 1,
9916        payee));
9917    children.add(
9918        new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.", 0, 1, referral));
9919    children.add(
9920        new Property("facility", "Reference(Location)", "Facility where the services were provided.", 0, 1, facility));
9921    children.add(new Property("careTeam", "", "The members of the team who provided the products and services.", 0,
9922        java.lang.Integer.MAX_VALUE, careTeam));
9923    children.add(new Property("supportingInfo", "",
9924        "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.",
9925        0, java.lang.Integer.MAX_VALUE, supportingInfo));
9926    children.add(new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.", 0,
9927        java.lang.Integer.MAX_VALUE, diagnosis));
9928    children.add(new Property("procedure", "",
9929        "Procedures performed on the patient relevant to the billing items with the claim.", 0,
9930        java.lang.Integer.MAX_VALUE, procedure));
9931    children.add(new Property("insurance", "",
9932        "Financial instruments for reimbursement for the health care products and services specified on the claim.", 0,
9933        java.lang.Integer.MAX_VALUE, insurance));
9934    children.add(new Property("accident", "",
9935        "Details of an accident which resulted in injuries which required the products and services listed in the claim.",
9936        0, 1, accident));
9937    children.add(new Property("item", "",
9938        "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.",
9939        0, java.lang.Integer.MAX_VALUE, item));
9940    children.add(new Property("total", "Money", "The total value of the all the items in the claim.", 0, 1, total));
9941  }
9942
9943  @Override
9944  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9945    switch (_hash) {
9946    case -1618432855:
9947      /* identifier */ return new Property("identifier", "Identifier", "A unique identifier assigned to this claim.", 0,
9948          java.lang.Integer.MAX_VALUE, identifier);
9949    case -892481550:
9950      /* status */ return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
9951    case 3575610:
9952      /* type */ return new Property("type", "CodeableConcept",
9953          "The category of claim, e.g. oral, pharmacy, vision, institutional, professional.", 0, 1, type);
9954    case -1868521062:
9955      /* subType */ return new Property("subType", "CodeableConcept",
9956          "A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.",
9957          0, 1, subType);
9958    case 116103:
9959      /* use */ return new Property("use", "code",
9960          "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.",
9961          0, 1, use);
9962    case -791418107:
9963      /* patient */ return new Property("patient", "Reference(Patient)",
9964          "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.",
9965          0, 1, patient);
9966    case -332066046:
9967      /* billablePeriod */ return new Property("billablePeriod", "Period",
9968          "The period for which charges are being submitted.", 0, 1, billablePeriod);
9969    case 1028554472:
9970      /* created */ return new Property("created", "dateTime", "The date this resource was created.", 0, 1, created);
9971    case -1591951995:
9972      /* enterer */ return new Property("enterer", "Reference(Practitioner|PractitionerRole)",
9973          "Individual who created the claim, predetermination or preauthorization.", 0, 1, enterer);
9974    case 1957615864:
9975      /* insurer */ return new Property("insurer", "Reference(Organization)",
9976          "The Insurer who is target of the request.", 0, 1, insurer);
9977    case -987494927:
9978      /* provider */ return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
9979          "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, provider);
9980    case -1165461084:
9981      /* priority */ return new Property("priority", "CodeableConcept",
9982          "The provider-required urgency of processing the request. Typical values include: stat, routine deferred.", 0,
9983          1, priority);
9984    case 1314609806:
9985      /* fundsReserve */ return new Property("fundsReserve", "CodeableConcept",
9986          "A code to indicate whether and for whom funds are to be reserved for future claims.", 0, 1, fundsReserve);
9987    case 1090493483:
9988      /* related */ return new Property("related", "",
9989          "Other claims which are related to this claim such as prior submissions or claims for related services or for the same event.",
9990          0, java.lang.Integer.MAX_VALUE, related);
9991    case 460301338:
9992      /* prescription */ return new Property("prescription",
9993          "Reference(DeviceRequest|MedicationRequest|VisionPrescription)",
9994          "Prescription to support the dispensing of pharmacy, device or vision products.", 0, 1, prescription);
9995    case -1814015861:
9996      /* originalPrescription */ return new Property("originalPrescription",
9997          "Reference(DeviceRequest|MedicationRequest|VisionPrescription)",
9998          "Original prescription which has been superseded by this prescription to support the dispensing of pharmacy services, medications or products.",
9999          0, 1, originalPrescription);
10000    case 106443592:
10001      /* payee */ return new Property("payee", "",
10002          "The party to be reimbursed for cost of the products and services according to the terms of the policy.", 0,
10003          1, payee);
10004    case -722568291:
10005      /* referral */ return new Property("referral", "Reference(ServiceRequest)", "A reference to a referral resource.",
10006          0, 1, referral);
10007    case 501116579:
10008      /* facility */ return new Property("facility", "Reference(Location)",
10009          "Facility where the services were provided.", 0, 1, facility);
10010    case -7323378:
10011      /* careTeam */ return new Property("careTeam", "",
10012          "The members of the team who provided the products and services.", 0, java.lang.Integer.MAX_VALUE, careTeam);
10013    case 1922406657:
10014      /* supportingInfo */ return new Property("supportingInfo", "",
10015          "Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues.",
10016          0, java.lang.Integer.MAX_VALUE, supportingInfo);
10017    case 1196993265:
10018      /* diagnosis */ return new Property("diagnosis", "", "Information about diagnoses relevant to the claim items.",
10019          0, java.lang.Integer.MAX_VALUE, diagnosis);
10020    case -1095204141:
10021      /* procedure */ return new Property("procedure", "",
10022          "Procedures performed on the patient relevant to the billing items with the claim.", 0,
10023          java.lang.Integer.MAX_VALUE, procedure);
10024    case 73049818:
10025      /* insurance */ return new Property("insurance", "",
10026          "Financial instruments for reimbursement for the health care products and services specified on the claim.",
10027          0, java.lang.Integer.MAX_VALUE, insurance);
10028    case -2143202801:
10029      /* accident */ return new Property("accident", "",
10030          "Details of an accident which resulted in injuries which required the products and services listed in the claim.",
10031          0, 1, accident);
10032    case 3242771:
10033      /* item */ return new Property("item", "",
10034          "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.",
10035          0, java.lang.Integer.MAX_VALUE, item);
10036    case 110549828:
10037      /* total */ return new Property("total", "Money", "The total value of the all the items in the claim.", 0, 1,
10038          total);
10039    default:
10040      return super.getNamedProperty(_hash, _name, _checkValid);
10041    }
10042
10043  }
10044
10045  @Override
10046  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
10047    switch (hash) {
10048    case -1618432855:
10049      /* identifier */ return this.identifier == null ? new Base[0]
10050          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
10051    case -892481550:
10052      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<ClaimStatus>
10053    case 3575610:
10054      /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
10055    case -1868521062:
10056      /* subType */ return this.subType == null ? new Base[0] : new Base[] { this.subType }; // CodeableConcept
10057    case 116103:
10058      /* use */ return this.use == null ? new Base[0] : new Base[] { this.use }; // Enumeration<Use>
10059    case -791418107:
10060      /* patient */ return this.patient == null ? new Base[0] : new Base[] { this.patient }; // Reference
10061    case -332066046:
10062      /* billablePeriod */ return this.billablePeriod == null ? new Base[0] : new Base[] { this.billablePeriod }; // Period
10063    case 1028554472:
10064      /* created */ return this.created == null ? new Base[0] : new Base[] { this.created }; // DateTimeType
10065    case -1591951995:
10066      /* enterer */ return this.enterer == null ? new Base[0] : new Base[] { this.enterer }; // Reference
10067    case 1957615864:
10068      /* insurer */ return this.insurer == null ? new Base[0] : new Base[] { this.insurer }; // Reference
10069    case -987494927:
10070      /* provider */ return this.provider == null ? new Base[0] : new Base[] { this.provider }; // Reference
10071    case -1165461084:
10072      /* priority */ return this.priority == null ? new Base[0] : new Base[] { this.priority }; // CodeableConcept
10073    case 1314609806:
10074      /* fundsReserve */ return this.fundsReserve == null ? new Base[0] : new Base[] { this.fundsReserve }; // CodeableConcept
10075    case 1090493483:
10076      /* related */ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // RelatedClaimComponent
10077    case 460301338:
10078      /* prescription */ return this.prescription == null ? new Base[0] : new Base[] { this.prescription }; // Reference
10079    case -1814015861:
10080      /* originalPrescription */ return this.originalPrescription == null ? new Base[0]
10081          : new Base[] { this.originalPrescription }; // Reference
10082    case 106443592:
10083      /* payee */ return this.payee == null ? new Base[0] : new Base[] { this.payee }; // PayeeComponent
10084    case -722568291:
10085      /* referral */ return this.referral == null ? new Base[0] : new Base[] { this.referral }; // Reference
10086    case 501116579:
10087      /* facility */ return this.facility == null ? new Base[0] : new Base[] { this.facility }; // Reference
10088    case -7323378:
10089      /* careTeam */ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // CareTeamComponent
10090    case 1922406657:
10091      /* supportingInfo */ return this.supportingInfo == null ? new Base[0]
10092          : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // SupportingInformationComponent
10093    case 1196993265:
10094      /* diagnosis */ return this.diagnosis == null ? new Base[0]
10095          : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent
10096    case -1095204141:
10097      /* procedure */ return this.procedure == null ? new Base[0]
10098          : this.procedure.toArray(new Base[this.procedure.size()]); // ProcedureComponent
10099    case 73049818:
10100      /* insurance */ return this.insurance == null ? new Base[0]
10101          : this.insurance.toArray(new Base[this.insurance.size()]); // InsuranceComponent
10102    case -2143202801:
10103      /* accident */ return this.accident == null ? new Base[0] : new Base[] { this.accident }; // AccidentComponent
10104    case 3242771:
10105      /* item */ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
10106    case 110549828:
10107      /* total */ return this.total == null ? new Base[0] : new Base[] { this.total }; // Money
10108    default:
10109      return super.getProperty(hash, name, checkValid);
10110    }
10111
10112  }
10113
10114  @Override
10115  public Base setProperty(int hash, String name, Base value) throws FHIRException {
10116    switch (hash) {
10117    case -1618432855: // identifier
10118      this.getIdentifier().add(castToIdentifier(value)); // Identifier
10119      return value;
10120    case -892481550: // status
10121      value = new ClaimStatusEnumFactory().fromType(castToCode(value));
10122      this.status = (Enumeration) value; // Enumeration<ClaimStatus>
10123      return value;
10124    case 3575610: // type
10125      this.type = castToCodeableConcept(value); // CodeableConcept
10126      return value;
10127    case -1868521062: // subType
10128      this.subType = castToCodeableConcept(value); // CodeableConcept
10129      return value;
10130    case 116103: // use
10131      value = new UseEnumFactory().fromType(castToCode(value));
10132      this.use = (Enumeration) value; // Enumeration<Use>
10133      return value;
10134    case -791418107: // patient
10135      this.patient = castToReference(value); // Reference
10136      return value;
10137    case -332066046: // billablePeriod
10138      this.billablePeriod = castToPeriod(value); // Period
10139      return value;
10140    case 1028554472: // created
10141      this.created = castToDateTime(value); // DateTimeType
10142      return value;
10143    case -1591951995: // enterer
10144      this.enterer = castToReference(value); // Reference
10145      return value;
10146    case 1957615864: // insurer
10147      this.insurer = castToReference(value); // Reference
10148      return value;
10149    case -987494927: // provider
10150      this.provider = castToReference(value); // Reference
10151      return value;
10152    case -1165461084: // priority
10153      this.priority = castToCodeableConcept(value); // CodeableConcept
10154      return value;
10155    case 1314609806: // fundsReserve
10156      this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
10157      return value;
10158    case 1090493483: // related
10159      this.getRelated().add((RelatedClaimComponent) value); // RelatedClaimComponent
10160      return value;
10161    case 460301338: // prescription
10162      this.prescription = castToReference(value); // Reference
10163      return value;
10164    case -1814015861: // originalPrescription
10165      this.originalPrescription = castToReference(value); // Reference
10166      return value;
10167    case 106443592: // payee
10168      this.payee = (PayeeComponent) value; // PayeeComponent
10169      return value;
10170    case -722568291: // referral
10171      this.referral = castToReference(value); // Reference
10172      return value;
10173    case 501116579: // facility
10174      this.facility = castToReference(value); // Reference
10175      return value;
10176    case -7323378: // careTeam
10177      this.getCareTeam().add((CareTeamComponent) value); // CareTeamComponent
10178      return value;
10179    case 1922406657: // supportingInfo
10180      this.getSupportingInfo().add((SupportingInformationComponent) value); // SupportingInformationComponent
10181      return value;
10182    case 1196993265: // diagnosis
10183      this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent
10184      return value;
10185    case -1095204141: // procedure
10186      this.getProcedure().add((ProcedureComponent) value); // ProcedureComponent
10187      return value;
10188    case 73049818: // insurance
10189      this.getInsurance().add((InsuranceComponent) value); // InsuranceComponent
10190      return value;
10191    case -2143202801: // accident
10192      this.accident = (AccidentComponent) value; // AccidentComponent
10193      return value;
10194    case 3242771: // item
10195      this.getItem().add((ItemComponent) value); // ItemComponent
10196      return value;
10197    case 110549828: // total
10198      this.total = castToMoney(value); // Money
10199      return value;
10200    default:
10201      return super.setProperty(hash, name, value);
10202    }
10203
10204  }
10205
10206  @Override
10207  public Base setProperty(String name, Base value) throws FHIRException {
10208    if (name.equals("identifier")) {
10209      this.getIdentifier().add(castToIdentifier(value));
10210    } else if (name.equals("status")) {
10211      value = new ClaimStatusEnumFactory().fromType(castToCode(value));
10212      this.status = (Enumeration) value; // Enumeration<ClaimStatus>
10213    } else if (name.equals("type")) {
10214      this.type = castToCodeableConcept(value); // CodeableConcept
10215    } else if (name.equals("subType")) {
10216      this.subType = castToCodeableConcept(value); // CodeableConcept
10217    } else if (name.equals("use")) {
10218      value = new UseEnumFactory().fromType(castToCode(value));
10219      this.use = (Enumeration) value; // Enumeration<Use>
10220    } else if (name.equals("patient")) {
10221      this.patient = castToReference(value); // Reference
10222    } else if (name.equals("billablePeriod")) {
10223      this.billablePeriod = castToPeriod(value); // Period
10224    } else if (name.equals("created")) {
10225      this.created = castToDateTime(value); // DateTimeType
10226    } else if (name.equals("enterer")) {
10227      this.enterer = castToReference(value); // Reference
10228    } else if (name.equals("insurer")) {
10229      this.insurer = castToReference(value); // Reference
10230    } else if (name.equals("provider")) {
10231      this.provider = castToReference(value); // Reference
10232    } else if (name.equals("priority")) {
10233      this.priority = castToCodeableConcept(value); // CodeableConcept
10234    } else if (name.equals("fundsReserve")) {
10235      this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
10236    } else if (name.equals("related")) {
10237      this.getRelated().add((RelatedClaimComponent) value);
10238    } else if (name.equals("prescription")) {
10239      this.prescription = castToReference(value); // Reference
10240    } else if (name.equals("originalPrescription")) {
10241      this.originalPrescription = castToReference(value); // Reference
10242    } else if (name.equals("payee")) {
10243      this.payee = (PayeeComponent) value; // PayeeComponent
10244    } else if (name.equals("referral")) {
10245      this.referral = castToReference(value); // Reference
10246    } else if (name.equals("facility")) {
10247      this.facility = castToReference(value); // Reference
10248    } else if (name.equals("careTeam")) {
10249      this.getCareTeam().add((CareTeamComponent) value);
10250    } else if (name.equals("supportingInfo")) {
10251      this.getSupportingInfo().add((SupportingInformationComponent) value);
10252    } else if (name.equals("diagnosis")) {
10253      this.getDiagnosis().add((DiagnosisComponent) value);
10254    } else if (name.equals("procedure")) {
10255      this.getProcedure().add((ProcedureComponent) value);
10256    } else if (name.equals("insurance")) {
10257      this.getInsurance().add((InsuranceComponent) value);
10258    } else if (name.equals("accident")) {
10259      this.accident = (AccidentComponent) value; // AccidentComponent
10260    } else if (name.equals("item")) {
10261      this.getItem().add((ItemComponent) value);
10262    } else if (name.equals("total")) {
10263      this.total = castToMoney(value); // Money
10264    } else
10265      return super.setProperty(name, value);
10266    return value;
10267  }
10268
10269  @Override
10270  public void removeChild(String name, Base value) throws FHIRException {
10271    if (name.equals("identifier")) {
10272      this.getIdentifier().remove(castToIdentifier(value));
10273    } else if (name.equals("status")) {
10274      this.status = null;
10275    } else if (name.equals("type")) {
10276      this.type = null;
10277    } else if (name.equals("subType")) {
10278      this.subType = null;
10279    } else if (name.equals("use")) {
10280      this.use = null;
10281    } else if (name.equals("patient")) {
10282      this.patient = null;
10283    } else if (name.equals("billablePeriod")) {
10284      this.billablePeriod = null;
10285    } else if (name.equals("created")) {
10286      this.created = null;
10287    } else if (name.equals("enterer")) {
10288      this.enterer = null;
10289    } else if (name.equals("insurer")) {
10290      this.insurer = null;
10291    } else if (name.equals("provider")) {
10292      this.provider = null;
10293    } else if (name.equals("priority")) {
10294      this.priority = null;
10295    } else if (name.equals("fundsReserve")) {
10296      this.fundsReserve = null;
10297    } else if (name.equals("related")) {
10298      this.getRelated().remove((RelatedClaimComponent) value);
10299    } else if (name.equals("prescription")) {
10300      this.prescription = null;
10301    } else if (name.equals("originalPrescription")) {
10302      this.originalPrescription = null;
10303    } else if (name.equals("payee")) {
10304      this.payee = (PayeeComponent) value; // PayeeComponent
10305    } else if (name.equals("referral")) {
10306      this.referral = null;
10307    } else if (name.equals("facility")) {
10308      this.facility = null;
10309    } else if (name.equals("careTeam")) {
10310      this.getCareTeam().remove((CareTeamComponent) value);
10311    } else if (name.equals("supportingInfo")) {
10312      this.getSupportingInfo().remove((SupportingInformationComponent) value);
10313    } else if (name.equals("diagnosis")) {
10314      this.getDiagnosis().remove((DiagnosisComponent) value);
10315    } else if (name.equals("procedure")) {
10316      this.getProcedure().remove((ProcedureComponent) value);
10317    } else if (name.equals("insurance")) {
10318      this.getInsurance().remove((InsuranceComponent) value);
10319    } else if (name.equals("accident")) {
10320      this.accident = (AccidentComponent) value; // AccidentComponent
10321    } else if (name.equals("item")) {
10322      this.getItem().remove((ItemComponent) value);
10323    } else if (name.equals("total")) {
10324      this.total = null;
10325    } else
10326      super.removeChild(name, value);
10327    
10328  }
10329
10330  @Override
10331  public Base makeProperty(int hash, String name) throws FHIRException {
10332    switch (hash) {
10333    case -1618432855:
10334      return addIdentifier();
10335    case -892481550:
10336      return getStatusElement();
10337    case 3575610:
10338      return getType();
10339    case -1868521062:
10340      return getSubType();
10341    case 116103:
10342      return getUseElement();
10343    case -791418107:
10344      return getPatient();
10345    case -332066046:
10346      return getBillablePeriod();
10347    case 1028554472:
10348      return getCreatedElement();
10349    case -1591951995:
10350      return getEnterer();
10351    case 1957615864:
10352      return getInsurer();
10353    case -987494927:
10354      return getProvider();
10355    case -1165461084:
10356      return getPriority();
10357    case 1314609806:
10358      return getFundsReserve();
10359    case 1090493483:
10360      return addRelated();
10361    case 460301338:
10362      return getPrescription();
10363    case -1814015861:
10364      return getOriginalPrescription();
10365    case 106443592:
10366      return getPayee();
10367    case -722568291:
10368      return getReferral();
10369    case 501116579:
10370      return getFacility();
10371    case -7323378:
10372      return addCareTeam();
10373    case 1922406657:
10374      return addSupportingInfo();
10375    case 1196993265:
10376      return addDiagnosis();
10377    case -1095204141:
10378      return addProcedure();
10379    case 73049818:
10380      return addInsurance();
10381    case -2143202801:
10382      return getAccident();
10383    case 3242771:
10384      return addItem();
10385    case 110549828:
10386      return getTotal();
10387    default:
10388      return super.makeProperty(hash, name);
10389    }
10390
10391  }
10392
10393  @Override
10394  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
10395    switch (hash) {
10396    case -1618432855:
10397      /* identifier */ return new String[] { "Identifier" };
10398    case -892481550:
10399      /* status */ return new String[] { "code" };
10400    case 3575610:
10401      /* type */ return new String[] { "CodeableConcept" };
10402    case -1868521062:
10403      /* subType */ return new String[] { "CodeableConcept" };
10404    case 116103:
10405      /* use */ return new String[] { "code" };
10406    case -791418107:
10407      /* patient */ return new String[] { "Reference" };
10408    case -332066046:
10409      /* billablePeriod */ return new String[] { "Period" };
10410    case 1028554472:
10411      /* created */ return new String[] { "dateTime" };
10412    case -1591951995:
10413      /* enterer */ return new String[] { "Reference" };
10414    case 1957615864:
10415      /* insurer */ return new String[] { "Reference" };
10416    case -987494927:
10417      /* provider */ return new String[] { "Reference" };
10418    case -1165461084:
10419      /* priority */ return new String[] { "CodeableConcept" };
10420    case 1314609806:
10421      /* fundsReserve */ return new String[] { "CodeableConcept" };
10422    case 1090493483:
10423      /* related */ return new String[] {};
10424    case 460301338:
10425      /* prescription */ return new String[] { "Reference" };
10426    case -1814015861:
10427      /* originalPrescription */ return new String[] { "Reference" };
10428    case 106443592:
10429      /* payee */ return new String[] {};
10430    case -722568291:
10431      /* referral */ return new String[] { "Reference" };
10432    case 501116579:
10433      /* facility */ return new String[] { "Reference" };
10434    case -7323378:
10435      /* careTeam */ return new String[] {};
10436    case 1922406657:
10437      /* supportingInfo */ return new String[] {};
10438    case 1196993265:
10439      /* diagnosis */ return new String[] {};
10440    case -1095204141:
10441      /* procedure */ return new String[] {};
10442    case 73049818:
10443      /* insurance */ return new String[] {};
10444    case -2143202801:
10445      /* accident */ return new String[] {};
10446    case 3242771:
10447      /* item */ return new String[] {};
10448    case 110549828:
10449      /* total */ return new String[] { "Money" };
10450    default:
10451      return super.getTypesForProperty(hash, name);
10452    }
10453
10454  }
10455
10456  @Override
10457  public Base addChild(String name) throws FHIRException {
10458    if (name.equals("identifier")) {
10459      return addIdentifier();
10460    } else if (name.equals("status")) {
10461      throw new FHIRException("Cannot call addChild on a singleton property Claim.status");
10462    } else if (name.equals("type")) {
10463      this.type = new CodeableConcept();
10464      return this.type;
10465    } else if (name.equals("subType")) {
10466      this.subType = new CodeableConcept();
10467      return this.subType;
10468    } else if (name.equals("use")) {
10469      throw new FHIRException("Cannot call addChild on a singleton property Claim.use");
10470    } else if (name.equals("patient")) {
10471      this.patient = new Reference();
10472      return this.patient;
10473    } else if (name.equals("billablePeriod")) {
10474      this.billablePeriod = new Period();
10475      return this.billablePeriod;
10476    } else if (name.equals("created")) {
10477      throw new FHIRException("Cannot call addChild on a singleton property Claim.created");
10478    } else if (name.equals("enterer")) {
10479      this.enterer = new Reference();
10480      return this.enterer;
10481    } else if (name.equals("insurer")) {
10482      this.insurer = new Reference();
10483      return this.insurer;
10484    } else if (name.equals("provider")) {
10485      this.provider = new Reference();
10486      return this.provider;
10487    } else if (name.equals("priority")) {
10488      this.priority = new CodeableConcept();
10489      return this.priority;
10490    } else if (name.equals("fundsReserve")) {
10491      this.fundsReserve = new CodeableConcept();
10492      return this.fundsReserve;
10493    } else if (name.equals("related")) {
10494      return addRelated();
10495    } else if (name.equals("prescription")) {
10496      this.prescription = new Reference();
10497      return this.prescription;
10498    } else if (name.equals("originalPrescription")) {
10499      this.originalPrescription = new Reference();
10500      return this.originalPrescription;
10501    } else if (name.equals("payee")) {
10502      this.payee = new PayeeComponent();
10503      return this.payee;
10504    } else if (name.equals("referral")) {
10505      this.referral = new Reference();
10506      return this.referral;
10507    } else if (name.equals("facility")) {
10508      this.facility = new Reference();
10509      return this.facility;
10510    } else if (name.equals("careTeam")) {
10511      return addCareTeam();
10512    } else if (name.equals("supportingInfo")) {
10513      return addSupportingInfo();
10514    } else if (name.equals("diagnosis")) {
10515      return addDiagnosis();
10516    } else if (name.equals("procedure")) {
10517      return addProcedure();
10518    } else if (name.equals("insurance")) {
10519      return addInsurance();
10520    } else if (name.equals("accident")) {
10521      this.accident = new AccidentComponent();
10522      return this.accident;
10523    } else if (name.equals("item")) {
10524      return addItem();
10525    } else if (name.equals("total")) {
10526      this.total = new Money();
10527      return this.total;
10528    } else
10529      return super.addChild(name);
10530  }
10531
10532  public String fhirType() {
10533    return "Claim";
10534
10535  }
10536
10537  public Claim copy() {
10538    Claim dst = new Claim();
10539    copyValues(dst);
10540    return dst;
10541  }
10542
10543  public void copyValues(Claim dst) {
10544    super.copyValues(dst);
10545    if (identifier != null) {
10546      dst.identifier = new ArrayList<Identifier>();
10547      for (Identifier i : identifier)
10548        dst.identifier.add(i.copy());
10549    }
10550    ;
10551    dst.status = status == null ? null : status.copy();
10552    dst.type = type == null ? null : type.copy();
10553    dst.subType = subType == null ? null : subType.copy();
10554    dst.use = use == null ? null : use.copy();
10555    dst.patient = patient == null ? null : patient.copy();
10556    dst.billablePeriod = billablePeriod == null ? null : billablePeriod.copy();
10557    dst.created = created == null ? null : created.copy();
10558    dst.enterer = enterer == null ? null : enterer.copy();
10559    dst.insurer = insurer == null ? null : insurer.copy();
10560    dst.provider = provider == null ? null : provider.copy();
10561    dst.priority = priority == null ? null : priority.copy();
10562    dst.fundsReserve = fundsReserve == null ? null : fundsReserve.copy();
10563    if (related != null) {
10564      dst.related = new ArrayList<RelatedClaimComponent>();
10565      for (RelatedClaimComponent i : related)
10566        dst.related.add(i.copy());
10567    }
10568    ;
10569    dst.prescription = prescription == null ? null : prescription.copy();
10570    dst.originalPrescription = originalPrescription == null ? null : originalPrescription.copy();
10571    dst.payee = payee == null ? null : payee.copy();
10572    dst.referral = referral == null ? null : referral.copy();
10573    dst.facility = facility == null ? null : facility.copy();
10574    if (careTeam != null) {
10575      dst.careTeam = new ArrayList<CareTeamComponent>();
10576      for (CareTeamComponent i : careTeam)
10577        dst.careTeam.add(i.copy());
10578    }
10579    ;
10580    if (supportingInfo != null) {
10581      dst.supportingInfo = new ArrayList<SupportingInformationComponent>();
10582      for (SupportingInformationComponent i : supportingInfo)
10583        dst.supportingInfo.add(i.copy());
10584    }
10585    ;
10586    if (diagnosis != null) {
10587      dst.diagnosis = new ArrayList<DiagnosisComponent>();
10588      for (DiagnosisComponent i : diagnosis)
10589        dst.diagnosis.add(i.copy());
10590    }
10591    ;
10592    if (procedure != null) {
10593      dst.procedure = new ArrayList<ProcedureComponent>();
10594      for (ProcedureComponent i : procedure)
10595        dst.procedure.add(i.copy());
10596    }
10597    ;
10598    if (insurance != null) {
10599      dst.insurance = new ArrayList<InsuranceComponent>();
10600      for (InsuranceComponent i : insurance)
10601        dst.insurance.add(i.copy());
10602    }
10603    ;
10604    dst.accident = accident == null ? null : accident.copy();
10605    if (item != null) {
10606      dst.item = new ArrayList<ItemComponent>();
10607      for (ItemComponent i : item)
10608        dst.item.add(i.copy());
10609    }
10610    ;
10611    dst.total = total == null ? null : total.copy();
10612  }
10613
10614  protected Claim typedCopy() {
10615    return copy();
10616  }
10617
10618  @Override
10619  public boolean equalsDeep(Base other_) {
10620    if (!super.equalsDeep(other_))
10621      return false;
10622    if (!(other_ instanceof Claim))
10623      return false;
10624    Claim o = (Claim) other_;
10625    return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true)
10626        && compareDeep(type, o.type, true) && compareDeep(subType, o.subType, true) && compareDeep(use, o.use, true)
10627        && compareDeep(patient, o.patient, true) && compareDeep(billablePeriod, o.billablePeriod, true)
10628        && compareDeep(created, o.created, true) && compareDeep(enterer, o.enterer, true)
10629        && compareDeep(insurer, o.insurer, true) && compareDeep(provider, o.provider, true)
10630        && compareDeep(priority, o.priority, true) && compareDeep(fundsReserve, o.fundsReserve, true)
10631        && compareDeep(related, o.related, true) && compareDeep(prescription, o.prescription, true)
10632        && compareDeep(originalPrescription, o.originalPrescription, true) && compareDeep(payee, o.payee, true)
10633        && compareDeep(referral, o.referral, true) && compareDeep(facility, o.facility, true)
10634        && compareDeep(careTeam, o.careTeam, true) && compareDeep(supportingInfo, o.supportingInfo, true)
10635        && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(procedure, o.procedure, true)
10636        && compareDeep(insurance, o.insurance, true) && compareDeep(accident, o.accident, true)
10637        && compareDeep(item, o.item, true) && compareDeep(total, o.total, true);
10638  }
10639
10640  @Override
10641  public boolean equalsShallow(Base other_) {
10642    if (!super.equalsShallow(other_))
10643      return false;
10644    if (!(other_ instanceof Claim))
10645      return false;
10646    Claim o = (Claim) other_;
10647    return compareValues(status, o.status, true) && compareValues(use, o.use, true)
10648        && compareValues(created, o.created, true);
10649  }
10650
10651  public boolean isEmpty() {
10652    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type, subType, use, patient,
10653        billablePeriod, created, enterer, insurer, provider, priority, fundsReserve, related, prescription,
10654        originalPrescription, payee, referral, facility, careTeam, supportingInfo, diagnosis, procedure, insurance,
10655        accident, item, total);
10656  }
10657
10658  @Override
10659  public ResourceType getResourceType() {
10660    return ResourceType.Claim;
10661  }
10662
10663  /**
10664   * Search parameter: <b>care-team</b>
10665   * <p>
10666   * Description: <b>Member of the CareTeam</b><br>
10667   * Type: <b>reference</b><br>
10668   * Path: <b>Claim.careTeam.provider</b><br>
10669   * </p>
10670   */
10671  @SearchParamDefinition(name = "care-team", path = "Claim.careTeam.provider", description = "Member of the CareTeam", type = "reference", providesMembershipIn = {
10672      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Organization.class,
10673          Practitioner.class, PractitionerRole.class })
10674  public static final String SP_CARE_TEAM = "care-team";
10675  /**
10676   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
10677   * <p>
10678   * Description: <b>Member of the CareTeam</b><br>
10679   * Type: <b>reference</b><br>
10680   * Path: <b>Claim.careTeam.provider</b><br>
10681   * </p>
10682   */
10683  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
10684      SP_CARE_TEAM);
10685
10686  /**
10687   * Constant for fluent queries to be used to add include statements. Specifies
10688   * the path value of "<b>Claim:care-team</b>".
10689   */
10690  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include(
10691      "Claim:care-team").toLocked();
10692
10693  /**
10694   * Search parameter: <b>identifier</b>
10695   * <p>
10696   * Description: <b>The primary identifier of the financial resource</b><br>
10697   * Type: <b>token</b><br>
10698   * Path: <b>Claim.identifier</b><br>
10699   * </p>
10700   */
10701  @SearchParamDefinition(name = "identifier", path = "Claim.identifier", description = "The primary identifier of the financial resource", type = "token")
10702  public static final String SP_IDENTIFIER = "identifier";
10703  /**
10704   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
10705   * <p>
10706   * Description: <b>The primary identifier of the financial resource</b><br>
10707   * Type: <b>token</b><br>
10708   * Path: <b>Claim.identifier</b><br>
10709   * </p>
10710   */
10711  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
10712      SP_IDENTIFIER);
10713
10714  /**
10715   * Search parameter: <b>use</b>
10716   * <p>
10717   * Description: <b>The kind of financial resource</b><br>
10718   * Type: <b>token</b><br>
10719   * Path: <b>Claim.use</b><br>
10720   * </p>
10721   */
10722  @SearchParamDefinition(name = "use", path = "Claim.use", description = "The kind of financial resource", type = "token")
10723  public static final String SP_USE = "use";
10724  /**
10725   * <b>Fluent Client</b> search parameter constant for <b>use</b>
10726   * <p>
10727   * Description: <b>The kind of financial resource</b><br>
10728   * Type: <b>token</b><br>
10729   * Path: <b>Claim.use</b><br>
10730   * </p>
10731   */
10732  public static final ca.uhn.fhir.rest.gclient.TokenClientParam USE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
10733      SP_USE);
10734
10735  /**
10736   * Search parameter: <b>created</b>
10737   * <p>
10738   * Description: <b>The creation date for the Claim</b><br>
10739   * Type: <b>date</b><br>
10740   * Path: <b>Claim.created</b><br>
10741   * </p>
10742   */
10743  @SearchParamDefinition(name = "created", path = "Claim.created", description = "The creation date for the Claim", type = "date")
10744  public static final String SP_CREATED = "created";
10745  /**
10746   * <b>Fluent Client</b> search parameter constant for <b>created</b>
10747   * <p>
10748   * Description: <b>The creation date for the Claim</b><br>
10749   * Type: <b>date</b><br>
10750   * Path: <b>Claim.created</b><br>
10751   * </p>
10752   */
10753  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(
10754      SP_CREATED);
10755
10756  /**
10757   * Search parameter: <b>encounter</b>
10758   * <p>
10759   * Description: <b>Encounters associated with a billed line item</b><br>
10760   * Type: <b>reference</b><br>
10761   * Path: <b>Claim.item.encounter</b><br>
10762   * </p>
10763   */
10764  @SearchParamDefinition(name = "encounter", path = "Claim.item.encounter", description = "Encounters associated with a billed line item", type = "reference", providesMembershipIn = {
10765      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Encounter") }, target = { Encounter.class })
10766  public static final String SP_ENCOUNTER = "encounter";
10767  /**
10768   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
10769   * <p>
10770   * Description: <b>Encounters associated with a billed line item</b><br>
10771   * Type: <b>reference</b><br>
10772   * Path: <b>Claim.item.encounter</b><br>
10773   * </p>
10774   */
10775  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
10776      SP_ENCOUNTER);
10777
10778  /**
10779   * Constant for fluent queries to be used to add include statements. Specifies
10780   * the path value of "<b>Claim:encounter</b>".
10781   */
10782  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include(
10783      "Claim:encounter").toLocked();
10784
10785  /**
10786   * Search parameter: <b>priority</b>
10787   * <p>
10788   * Description: <b>Processing priority requested</b><br>
10789   * Type: <b>token</b><br>
10790   * Path: <b>Claim.priority</b><br>
10791   * </p>
10792   */
10793  @SearchParamDefinition(name = "priority", path = "Claim.priority", description = "Processing priority requested", type = "token")
10794  public static final String SP_PRIORITY = "priority";
10795  /**
10796   * <b>Fluent Client</b> search parameter constant for <b>priority</b>
10797   * <p>
10798   * Description: <b>Processing priority requested</b><br>
10799   * Type: <b>token</b><br>
10800   * Path: <b>Claim.priority</b><br>
10801   * </p>
10802   */
10803  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PRIORITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(
10804      SP_PRIORITY);
10805
10806  /**
10807   * Search parameter: <b>payee</b>
10808   * <p>
10809   * Description: <b>The party receiving any payment for the Claim</b><br>
10810   * Type: <b>reference</b><br>
10811   * Path: <b>Claim.payee.party</b><br>
10812   * </p>
10813   */
10814  @SearchParamDefinition(name = "payee", path = "Claim.payee.party", description = "The party receiving any payment for the Claim", type = "reference", providesMembershipIn = {
10815      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient"),
10816      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner"),
10817      @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { Organization.class,
10818          Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class })
10819  public static final String SP_PAYEE = "payee";
10820  /**
10821   * <b>Fluent Client</b> search parameter constant for <b>payee</b>
10822   * <p>
10823   * Description: <b>The party receiving any payment for the Claim</b><br>
10824   * Type: <b>reference</b><br>
10825   * Path: <b>Claim.payee.party</b><br>
10826   * </p>
10827   */
10828  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYEE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
10829      SP_PAYEE);
10830
10831  /**
10832   * Constant for fluent queries to be used to add include statements. Specifies
10833   * the path value of "<b>Claim:payee</b>".
10834   */
10835  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYEE = new ca.uhn.fhir.model.api.Include("Claim:payee")
10836      .toLocked();
10837
10838  /**
10839   * Search parameter: <b>provider</b>
10840   * <p>
10841   * Description: <b>Provider responsible for the Claim</b><br>
10842   * Type: <b>reference</b><br>
10843   * Path: <b>Claim.provider</b><br>
10844   * </p>
10845   */
10846  @SearchParamDefinition(name = "provider", path = "Claim.provider", description = "Provider responsible for the Claim", type = "reference", providesMembershipIn = {
10847      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Organization.class,
10848          Practitioner.class, PractitionerRole.class })
10849  public static final String SP_PROVIDER = "provider";
10850  /**
10851   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
10852   * <p>
10853   * Description: <b>Provider responsible for the Claim</b><br>
10854   * Type: <b>reference</b><br>
10855   * Path: <b>Claim.provider</b><br>
10856   * </p>
10857   */
10858  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
10859      SP_PROVIDER);
10860
10861  /**
10862   * Constant for fluent queries to be used to add include statements. Specifies
10863   * the path value of "<b>Claim:provider</b>".
10864   */
10865  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include(
10866      "Claim:provider").toLocked();
10867
10868  /**
10869   * Search parameter: <b>patient</b>
10870   * <p>
10871   * Description: <b>Patient receiving the products or services</b><br>
10872   * Type: <b>reference</b><br>
10873   * Path: <b>Claim.patient</b><br>
10874   * </p>
10875   */
10876  @SearchParamDefinition(name = "patient", path = "Claim.patient", description = "Patient receiving the products or services", type = "reference", providesMembershipIn = {
10877      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Patient.class })
10878  public static final String SP_PATIENT = "patient";
10879  /**
10880   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
10881   * <p>
10882   * Description: <b>Patient receiving the products or services</b><br>
10883   * Type: <b>reference</b><br>
10884   * Path: <b>Claim.patient</b><br>
10885   * </p>
10886   */
10887  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
10888      SP_PATIENT);
10889
10890  /**
10891   * Constant for fluent queries to be used to add include statements. Specifies
10892   * the path value of "<b>Claim:patient</b>".
10893   */
10894  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Claim:patient")
10895      .toLocked();
10896
10897  /**
10898   * Search parameter: <b>insurer</b>
10899   * <p>
10900   * Description: <b>The target payor/insurer for the Claim</b><br>
10901   * Type: <b>reference</b><br>
10902   * Path: <b>Claim.insurer</b><br>
10903   * </p>
10904   */
10905  @SearchParamDefinition(name = "insurer", path = "Claim.insurer", description = "The target payor/insurer for the Claim", type = "reference", target = {
10906      Organization.class })
10907  public static final String SP_INSURER = "insurer";
10908  /**
10909   * <b>Fluent Client</b> search parameter constant for <b>insurer</b>
10910   * <p>
10911   * Description: <b>The target payor/insurer for the Claim</b><br>
10912   * Type: <b>reference</b><br>
10913   * Path: <b>Claim.insurer</b><br>
10914   * </p>
10915   */
10916  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSURER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
10917      SP_INSURER);
10918
10919  /**
10920   * Constant for fluent queries to be used to add include statements. Specifies
10921   * the path value of "<b>Claim:insurer</b>".
10922   */
10923  public static final ca.uhn.fhir.model.api.Include INCLUDE_INSURER = new ca.uhn.fhir.model.api.Include("Claim:insurer")
10924      .toLocked();
10925
10926  /**
10927   * Search parameter: <b>detail-udi</b>
10928   * <p>
10929   * Description: <b>UDI associated with a line item, detail product or
10930   * service</b><br>
10931   * Type: <b>reference</b><br>
10932   * Path: <b>Claim.item.detail.udi</b><br>
10933   * </p>
10934   */
10935  @SearchParamDefinition(name = "detail-udi", path = "Claim.item.detail.udi", description = "UDI associated with a line item, detail product or service", type = "reference", providesMembershipIn = {
10936      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device") }, target = { Device.class })
10937  public static final String SP_DETAIL_UDI = "detail-udi";
10938  /**
10939   * <b>Fluent Client</b> search parameter constant for <b>detail-udi</b>
10940   * <p>
10941   * Description: <b>UDI associated with a line item, detail product or
10942   * service</b><br>
10943   * Type: <b>reference</b><br>
10944   * Path: <b>Claim.item.detail.udi</b><br>
10945   * </p>
10946   */
10947  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
10948      SP_DETAIL_UDI);
10949
10950  /**
10951   * Constant for fluent queries to be used to add include statements. Specifies
10952   * the path value of "<b>Claim:detail-udi</b>".
10953   */
10954  public static final ca.uhn.fhir.model.api.Include INCLUDE_DETAIL_UDI = new ca.uhn.fhir.model.api.Include(
10955      "Claim:detail-udi").toLocked();
10956
10957  /**
10958   * Search parameter: <b>enterer</b>
10959   * <p>
10960   * Description: <b>The party responsible for the entry of the Claim</b><br>
10961   * Type: <b>reference</b><br>
10962   * Path: <b>Claim.enterer</b><br>
10963   * </p>
10964   */
10965  @SearchParamDefinition(name = "enterer", path = "Claim.enterer", description = "The party responsible for the entry of the Claim", type = "reference", providesMembershipIn = {
10966      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Practitioner.class,
10967          PractitionerRole.class })
10968  public static final String SP_ENTERER = "enterer";
10969  /**
10970   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
10971   * <p>
10972   * Description: <b>The party responsible for the entry of the Claim</b><br>
10973   * Type: <b>reference</b><br>
10974   * Path: <b>Claim.enterer</b><br>
10975   * </p>
10976   */
10977  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
10978      SP_ENTERER);
10979
10980  /**
10981   * Constant for fluent queries to be used to add include statements. Specifies
10982   * the path value of "<b>Claim:enterer</b>".
10983   */
10984  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include("Claim:enterer")
10985      .toLocked();
10986
10987  /**
10988   * Search parameter: <b>procedure-udi</b>
10989   * <p>
10990   * Description: <b>UDI associated with a procedure</b><br>
10991   * Type: <b>reference</b><br>
10992   * Path: <b>Claim.procedure.udi</b><br>
10993   * </p>
10994   */
10995  @SearchParamDefinition(name = "procedure-udi", path = "Claim.procedure.udi", description = "UDI associated with a procedure", type = "reference", providesMembershipIn = {
10996      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device") }, target = { Device.class })
10997  public static final String SP_PROCEDURE_UDI = "procedure-udi";
10998  /**
10999   * <b>Fluent Client</b> search parameter constant for <b>procedure-udi</b>
11000   * <p>
11001   * Description: <b>UDI associated with a procedure</b><br>
11002   * Type: <b>reference</b><br>
11003   * Path: <b>Claim.procedure.udi</b><br>
11004   * </p>
11005   */
11006  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROCEDURE_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
11007      SP_PROCEDURE_UDI);
11008
11009  /**
11010   * Constant for fluent queries to be used to add include statements. Specifies
11011   * the path value of "<b>Claim:procedure-udi</b>".
11012   */
11013  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROCEDURE_UDI = new ca.uhn.fhir.model.api.Include(
11014      "Claim:procedure-udi").toLocked();
11015
11016  /**
11017   * Search parameter: <b>subdetail-udi</b>
11018   * <p>
11019   * Description: <b>UDI associated with a line item, detail, subdetail product or
11020   * service</b><br>
11021   * Type: <b>reference</b><br>
11022   * Path: <b>Claim.item.detail.subDetail.udi</b><br>
11023   * </p>
11024   */
11025  @SearchParamDefinition(name = "subdetail-udi", path = "Claim.item.detail.subDetail.udi", description = "UDI associated with a line item, detail, subdetail product or service", type = "reference", providesMembershipIn = {
11026      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device") }, target = { Device.class })
11027  public static final String SP_SUBDETAIL_UDI = "subdetail-udi";
11028  /**
11029   * <b>Fluent Client</b> search parameter constant for <b>subdetail-udi</b>
11030   * <p>
11031   * Description: <b>UDI associated with a line item, detail, subdetail product or
11032   * service</b><br>
11033   * Type: <b>reference</b><br>
11034   * Path: <b>Claim.item.detail.subDetail.udi</b><br>
11035   * </p>
11036   */
11037  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBDETAIL_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
11038      SP_SUBDETAIL_UDI);
11039
11040  /**
11041   * Constant for fluent queries to be used to add include statements. Specifies
11042   * the path value of "<b>Claim:subdetail-udi</b>".
11043   */
11044  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBDETAIL_UDI = new ca.uhn.fhir.model.api.Include(
11045      "Claim:subdetail-udi").toLocked();
11046
11047  /**
11048   * Search parameter: <b>facility</b>
11049   * <p>
11050   * Description: <b>Facility where the products or services have been or will be
11051   * provided</b><br>
11052   * Type: <b>reference</b><br>
11053   * Path: <b>Claim.facility</b><br>
11054   * </p>
11055   */
11056  @SearchParamDefinition(name = "facility", path = "Claim.facility", description = "Facility where the products or services have been or will be provided", type = "reference", target = {
11057      Location.class })
11058  public static final String SP_FACILITY = "facility";
11059  /**
11060   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
11061   * <p>
11062   * Description: <b>Facility where the products or services have been or will be
11063   * provided</b><br>
11064   * Type: <b>reference</b><br>
11065   * Path: <b>Claim.facility</b><br>
11066   * </p>
11067   */
11068  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FACILITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
11069      SP_FACILITY);
11070
11071  /**
11072   * Constant for fluent queries to be used to add include statements. Specifies
11073   * the path value of "<b>Claim:facility</b>".
11074   */
11075  public static final ca.uhn.fhir.model.api.Include INCLUDE_FACILITY = new ca.uhn.fhir.model.api.Include(
11076      "Claim:facility").toLocked();
11077
11078  /**
11079   * Search parameter: <b>item-udi</b>
11080   * <p>
11081   * Description: <b>UDI associated with a line item product or service</b><br>
11082   * Type: <b>reference</b><br>
11083   * Path: <b>Claim.item.udi</b><br>
11084   * </p>
11085   */
11086  @SearchParamDefinition(name = "item-udi", path = "Claim.item.udi", description = "UDI associated with a line item product or service", type = "reference", providesMembershipIn = {
11087      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device") }, target = { Device.class })
11088  public static final String SP_ITEM_UDI = "item-udi";
11089  /**
11090   * <b>Fluent Client</b> search parameter constant for <b>item-udi</b>
11091   * <p>
11092   * Description: <b>UDI associated with a line item product or service</b><br>
11093   * Type: <b>reference</b><br>
11094   * Path: <b>Claim.item.udi</b><br>
11095   * </p>
11096   */
11097  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM_UDI = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
11098      SP_ITEM_UDI);
11099
11100  /**
11101   * Constant for fluent queries to be used to add include statements. Specifies
11102   * the path value of "<b>Claim:item-udi</b>".
11103   */
11104  public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM_UDI = new ca.uhn.fhir.model.api.Include(
11105      "Claim:item-udi").toLocked();
11106
11107  /**
11108   * Search parameter: <b>status</b>
11109   * <p>
11110   * Description: <b>The status of the Claim instance.</b><br>
11111   * Type: <b>token</b><br>
11112   * Path: <b>Claim.status</b><br>
11113   * </p>
11114   */
11115  @SearchParamDefinition(name = "status", path = "Claim.status", description = "The status of the Claim instance.", type = "token")
11116  public static final String SP_STATUS = "status";
11117  /**
11118   * <b>Fluent Client</b> search parameter constant for <b>status</b>
11119   * <p>
11120   * Description: <b>The status of the Claim instance.</b><br>
11121   * Type: <b>token</b><br>
11122   * Path: <b>Claim.status</b><br>
11123   * </p>
11124   */
11125  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
11126      SP_STATUS);
11127
11128}