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