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