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