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