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