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