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