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