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