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