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