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