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