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