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